|
|
@@ -6,14 +6,13 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.fs.app.service.IpadSendServer;
|
|
|
import com.fs.common.annotation.TenantDataScope;
|
|
|
-import com.fs.common.core.redis.RedisCacheT;
|
|
|
import com.fs.common.core.redis.RedisCacheTenant;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.PubFun;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.FsCoursePlaySourceConfig;
|
|
|
import com.fs.course.service.IFsCoursePlaySourceConfigService;
|
|
|
-import com.fs.framework.aspectj.TenantDataSourceAspect;
|
|
|
+import com.fs.framework.aspectj.SopTenantDataSourceAspect;
|
|
|
import com.fs.ipad.vo.BaseVo;
|
|
|
import com.fs.qw.domain.QwIpadServer;
|
|
|
import com.fs.qw.domain.QwPushCount;
|
|
|
@@ -65,7 +64,7 @@ public class SendMsg {
|
|
|
private final IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
|
|
|
private final QwPushCountMapper qwPushCountMapper;
|
|
|
private final QwRestrictionPushRecordMapper qwRestrictionPushRecordMapper;
|
|
|
- private final TenantDataSourceAspect tenantDataSourceAspect;
|
|
|
+ private final SopTenantDataSourceAspect sopTenantDataSourceAspect;
|
|
|
|
|
|
@Value("${group-no}")
|
|
|
private String groupNo;
|
|
|
@@ -101,7 +100,7 @@ public class SendMsg {
|
|
|
@Qualifier("customThreadPool")
|
|
|
private ThreadPoolTaskExecutor customThreadPool;
|
|
|
|
|
|
- public SendMsg(QwUserMapper qwUserMapper, QwSopLogsMapper qwSopLogsMapper, IpadSendServer sendServer, SysConfigMapper sysConfigMapper, IQwSopLogsService qwSopLogsService, QwIpadServerMapper qwIpadServerMapper, RedisCacheTenant<Long> redisCache, AsyncSopTestService asyncSopTestService, IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService, QwPushCountMapper qwPushCountMapper, QwRestrictionPushRecordMapper qwRestrictionPushRecordMapper, TenantDataSourceAspect tenantDataSourceAspect) {
|
|
|
+ public SendMsg(QwUserMapper qwUserMapper, QwSopLogsMapper qwSopLogsMapper, IpadSendServer sendServer, SysConfigMapper sysConfigMapper, IQwSopLogsService qwSopLogsService, QwIpadServerMapper qwIpadServerMapper, RedisCacheTenant<Long> redisCache, AsyncSopTestService asyncSopTestService, IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService, QwPushCountMapper qwPushCountMapper, QwRestrictionPushRecordMapper qwRestrictionPushRecordMapper, SopTenantDataSourceAspect sopTenantDataSourceAspect) {
|
|
|
this.qwUserMapper = qwUserMapper;
|
|
|
this.qwSopLogsMapper = qwSopLogsMapper;
|
|
|
this.sendServer = sendServer;
|
|
|
@@ -113,7 +112,7 @@ public class SendMsg {
|
|
|
this.fsCoursePlaySourceConfigService = fsCoursePlaySourceConfigService;
|
|
|
this.qwPushCountMapper = qwPushCountMapper;
|
|
|
this.qwRestrictionPushRecordMapper = qwRestrictionPushRecordMapper;
|
|
|
- this.tenantDataSourceAspect = tenantDataSourceAspect;
|
|
|
+ this.sopTenantDataSourceAspect = sopTenantDataSourceAspect;
|
|
|
}
|
|
|
private List<QwUser> getQwUserList() {
|
|
|
if (qwUserList.isEmpty()) {
|
|
|
@@ -155,7 +154,7 @@ public class SendMsg {
|
|
|
// 消息发送延迟
|
|
|
int delayStart;
|
|
|
int delayEnd;
|
|
|
- if (config.getDelayStart() == null || config.getDelayEnd() == null) {
|
|
|
+ if (config == null || config.getDelayStart() == null || config.getDelayEnd() == null) {
|
|
|
log.debug("消息发送延迟为空手动设置1000ms - 2000ms");
|
|
|
delayStart = 500;
|
|
|
delayEnd = 1000;
|
|
|
@@ -187,18 +186,18 @@ public class SendMsg {
|
|
|
try {
|
|
|
log.info("开始任务:{}", e.getQwUserName());
|
|
|
// 手动切换数据源到配置的租户
|
|
|
- tenantDataSourceAspect.switchTenant(tenantId);
|
|
|
+ sopTenantDataSourceAspect.switchTenant(tenantId);
|
|
|
processUser(e, delayStart, delayEnd, miniMap, newCtx);
|
|
|
} catch (Exception exception) {
|
|
|
log.error("发送错误:", exception);
|
|
|
} finally {
|
|
|
log.info("删除任务:{}", e.getQwUserName());
|
|
|
// 清理数据源
|
|
|
- tenantDataSourceAspect.clear();
|
|
|
+ sopTenantDataSourceAspect.clear();
|
|
|
qwMap.remove(e.getId());
|
|
|
}
|
|
|
}, customThreadPool).exceptionally(ex -> {
|
|
|
- log.error("任务提交失败:{}, 错误: {}", e.getQwUserName(), ex.getMessage());
|
|
|
+ log.error("任务提交失败:{}, 错误: {}", e.getQwUserName(), ex.getMessage(), ex);
|
|
|
qwMap.remove(e.getId());
|
|
|
return null;
|
|
|
});
|