Ver código fonte

循环依赖启动失败处理

jingyuanchao 1 ano atrás
pai
commit
1c72aaed8a

+ 5 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/impl/CoreMonitoringTaskRegistrationServiceImpl.java

@@ -42,6 +42,7 @@ public class CoreMonitoringTaskRegistrationServiceImpl extends ServiceImpl<CoreM
     @Autowired
     private CoreMonitoringTaskRegistrationMapper coreMonitoringTaskRegistrationMapper;
     @Autowired
+    @Lazy
     private ICoreMonitoringRetrievalTaskService iCoreMonitoringRetrievalTaskService;//任务
     @Autowired
     private CoreMonitoringRetrievalTaskMapper coreMonitoringRetrievalTaskMapper;//任务
@@ -49,8 +50,9 @@ public class CoreMonitoringTaskRegistrationServiceImpl extends ServiceImpl<CoreM
     private CoreMonitoringTaskMonitorInfoMapper coreMonitoringTaskMonitorInfoMapper;//项目
     @Autowired
     private RemoteNfcBindService remoteNfcBindService;
-@Autowired
-private ITMonitoringRetrievalPlanService itMonitoringRetrievalPlanService;
+    @Autowired
+    private ITMonitoringRetrievalPlanService itMonitoringRetrievalPlanService;
+
     /**
      * 查询【请填写功能名称】
      *
@@ -111,7 +113,7 @@ private ITMonitoringRetrievalPlanService itMonitoringRetrievalPlanService;
             coreMonitoringTaskRegistration1.setAverageDuration(Double.valueOf(String.format("%.2f", avg)));
             return baseMapper.updateById(coreMonitoringTaskRegistration1);
         } else {
-            if(coreMonitoringRetrievalTask.getStatus().equals(ZERO)){
+            if (coreMonitoringRetrievalTask.getStatus().equals(ZERO)) {
                 coreMonitoringTaskRegistrationMapper.deleteByTaskId(coreMonitoringTaskRegistration.getTaskId());
             }
             coreMonitoringTaskRegistration.setCreateTime(DateUtils.getNowDate());

+ 6 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/impl/TMonitoringRetrievalPlanServiceImpl.java

@@ -106,6 +106,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
     private ICoreMonitoringRetrievalTaskBuilderService coreMonitoringRetrievalTaskBuilderService;
     @Autowired
     private RemoteFileService fileService;
+    @Lazy
     @Autowired
     private CoreMonitoringRetrievalTaskMapper coreMonitoringRetrievalTaskMapper;
     @Autowired
@@ -126,7 +127,9 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
     @Lazy
     private ICoreReminderConfigurationService reminderConfigurationService;
     @Autowired
+    @Lazy
     ICoreReminderScheduleService reminderScheduleService;
+
     @Override
     public TableDataInfo selectPage(TMonitoringRetrievalPlan tMonitoringRetrievalPlan) {
         //未删除
@@ -1840,7 +1843,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                 Long orgId = userEntry.getKey();
                 List<SysUser> userList = userEntry.getValue();
                 Optional<SysOrgVO> first = cacheList.stream().filter(org -> org.getId().equals(orgId)).findFirst();
-                if (!first.isPresent()){
+                if (!first.isPresent()) {
                     continue;
                 }
                 String path = first.get().getPath();
@@ -1851,8 +1854,8 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                 }
                 for (SysUser sysUser : userList) {
                     for (CoreMonitoringRetrievalTask task : taskList) {
-                        boolean exit = exitTaskBySendModule.stream().anyMatch(t -> ObjectUtil.equal(t.getTaskId(),  String.valueOf(task.getId())));
-                        if (exit){
+                        boolean exit = exitTaskBySendModule.stream().anyMatch(t -> ObjectUtil.equal(t.getTaskId(), String.valueOf(task.getId())));
+                        if (exit) {
                             //说明任务已经存在短信提醒任务
                             continue;
                         }

+ 5 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillPlanServiceImpl.java

@@ -120,7 +120,9 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
     @Lazy
     private ICoreReminderConfigurationService reminderConfigurationService;
     @Autowired
+    @Lazy
     ICoreReminderScheduleService reminderScheduleService;
+
     @Override
     public TableDataInfo<CoreDrillPlanPageVo> selectPage(CoreDrillPlanPageDto request) {
         //下穿
@@ -1232,7 +1234,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
                 Long orgId = userEntry.getKey();
                 List<SysUser> userList = userEntry.getValue();
                 Optional<SysOrgVO> first = cacheList.stream().filter(org -> org.getId().equals(orgId)).findFirst();
-                if (!first.isPresent()){
+                if (!first.isPresent()) {
                     continue;
                 }
                 String path = first.get().getPath();
@@ -1243,8 +1245,8 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
                 }
                 for (SysUser sysUser : userList) {
                     for (CoreDrillTask task : taskList) {
-                        boolean exit = exitTaskBySendModule.stream().anyMatch(t -> ObjectUtil.equal(t.getTaskId(),  String.valueOf(task.getId())));
-                        if (exit){
+                        boolean exit = exitTaskBySendModule.stream().anyMatch(t -> ObjectUtil.equal(t.getTaskId(), String.valueOf(task.getId())));
+                        if (exit) {
                             //说明任务已经存在短信提醒任务
                             continue;
                         }

+ 5 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingPlanServiceImpl.java

@@ -122,7 +122,9 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
     @Lazy
     private ICoreReminderConfigurationService reminderConfigurationService;
     @Autowired
+    @Lazy
     ICoreReminderScheduleService reminderScheduleService;
+
     @Override
     public TableDataInfo selectPage(CoreEduTrainingPlanPageDto request) throws InterruptedException {
 
@@ -1203,7 +1205,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
                 Long orgId = userEntry.getKey();
                 List<SysUser> userList = userEntry.getValue();
                 Optional<SysOrgVO> first = cacheList.stream().filter(org -> org.getId().equals(orgId)).findFirst();
-                if (!first.isPresent()){
+                if (!first.isPresent()) {
                     continue;
                 }
                 String path = first.get().getPath();
@@ -1214,8 +1216,8 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
                 }
                 for (SysUser sysUser : userList) {
                     for (CoreEduTrainingTask task : taskList) {
-                        boolean exit = exitTaskBySendModule.stream().anyMatch(t -> ObjectUtil.equal(t.getTaskId(),  String.valueOf(task.getId())));
-                        if (exit){
+                        boolean exit = exitTaskBySendModule.stream().anyMatch(t -> ObjectUtil.equal(t.getTaskId(), String.valueOf(task.getId())));
+                        if (exit) {
                             //说明任务已经存在短信提醒任务
                             continue;
                         }

+ 4 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reminder/service/impl/CoreReminderConfigurationServiceImpl.java

@@ -48,6 +48,7 @@ import com.xunmei.system.api.domain.SysUser;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -79,8 +80,10 @@ public class CoreReminderConfigurationServiceImpl extends ServiceImpl<CoreRemind
     @Autowired
     private ICoreSafecheckPlanService safeCheckPlanService;
     @Autowired
+    @Lazy
     private ICoreEduTrainingPlanService eduTrainingPlanService;
     @Autowired
+    @Lazy
     private ICoreDrillPlanService drillPlanService;
     @Autowired
     private ITMonitoringRetrievalPlanService tMonitoringRetrievalPlanService;
@@ -88,6 +91,7 @@ public class CoreReminderConfigurationServiceImpl extends ServiceImpl<CoreRemind
     private CoreReminderConfigurationRoleMapper configurationRoleMapper;
     @Autowired
     private CoreReminderConfigurationOrgMapper coreReminderConfigurationOrgMapper;
+    @Lazy
     @Autowired
     private ICoreReminderScheduleService reminderScheduleService;
     @Autowired

+ 2 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reminder/service/impl/CoreReminderScheduleServiceImpl.java

@@ -50,6 +50,7 @@ public class CoreReminderScheduleServiceImpl extends ServiceImpl<CoreReminderSch
     @Lazy
     private ICoreReminderScheduleService scheduleService;
     @Autowired
+    @Lazy
     private ICoreReminderConfigurationService configurationService;
     @Autowired
     private ICoreReminderLogService reminderLogService;
@@ -64,6 +65,7 @@ public class CoreReminderScheduleServiceImpl extends ServiceImpl<CoreReminderSch
     ICoreEduTrainingTaskService eduTrainingTaskService;
     @Autowired
     ICoreDrillTaskService drillTaskService;
+    @Lazy
     @Autowired
     private ICoreMonitoringRetrievalTaskService iCoreMonitoringRetrievalTaskService;
     @Autowired

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -129,6 +129,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
     @Autowired
     @Lazy
     private ICoreReminderConfigurationService reminderConfigurationService;
+    @Lazy
     @Autowired
     ICoreReminderScheduleService reminderScheduleService;
     @Override

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java

@@ -83,6 +83,7 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
     @Autowired
     RemoteWorkTimeService workTimeService;
     @Autowired
+    @Lazy
     private ITMonitoringRetrievalPlanService itMonitoringRetrievalPlanService;
     @Autowired
     CoreSafetyExceptionDataMapper exceptionDataMapper;

+ 3 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/CoreSafecheckPlanServiceImpl.java

@@ -127,6 +127,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
     @Lazy
     private ICoreReminderConfigurationService reminderConfigurationService;
     @Autowired
+    @Lazy
     ICoreReminderScheduleService reminderScheduleService;
 
     @Override
@@ -1372,7 +1373,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
                 Long orgId = userEntry.getKey();
                 List<SysUser> userList = userEntry.getValue();
                 Optional<SysOrgVO> first = cacheList.stream().filter(org -> org.getId().equals(orgId)).findFirst();
-                if (!first.isPresent()){
+                if (!first.isPresent()) {
                     continue;
                 }
                 String path = first.get().getPath();
@@ -1384,7 +1385,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
                 for (SysUser sysUser : userList) {
                     for (CoreSafetyTask task : taskList) {
                         boolean exit = exitTaskBySendModule.stream().anyMatch(t -> ObjectUtil.equal(t.getTaskId(), String.valueOf(task.getId())));
-                        if (exit){
+                        if (exit) {
                             //说明任务已经存在短信提醒任务
                             continue;
                         }