Explorar o código

完善检查任务生成

jiawuxian %!s(int64=2) %!d(string=hai) anos
pai
achega
2fd6b4b725

+ 2 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/job/SafetyCheckJobBusiness.java

@@ -234,6 +234,8 @@ public class SafetyCheckJobBusiness extends TaskCreatingServiceImplBase<CoreSafe
                 //选择了具体的受检机构
                 List<Long> ids = checkOrg.stream().map(CoreSafecheckPlanToCheckOrg::getOrgId).collect(Collectors.toList());
                 checkOrgs = orgService.selectOrgByIdList(ids, SecurityConstants.INNER);
+                //保留检查机构下属机构
+                checkOrgs = checkOrgs.stream().filter(o -> o.getPath().startsWith(org.getPath())).collect(Collectors.toList());
             }
 //            checkOrgs = checkOrgs.stream().filter(o -> ObjectUtil.equal(o.getIsLock(), false)).collect(Collectors.toList());
             checkOrgs = checkOrgs.stream().filter(o -> o.getIsLock() < 1).collect(Collectors.toList());

+ 12 - 5
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/listener/WorkTimeChangeEventListener.java

@@ -11,16 +11,18 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.event.EventListener;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.event.TransactionPhase;
 import org.springframework.transaction.event.TransactionalEventListener;
 import springfox.documentation.spring.web.json.Json;
 
+import java.util.concurrent.CompletableFuture;
+
 @Component
 @Slf4j
 public class WorkTimeChangeEventListener implements ApplicationListener<WorkTimeChangeEvent> {
-
-
     @Autowired
     RemoteResumptionTaskService remoteResumptionTaskService;
     @Autowired
@@ -34,10 +36,15 @@ public class WorkTimeChangeEventListener implements ApplicationListener<WorkTime
     @EventListener(WorkTimeChangeEvent.class)
     @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = false)
     public void onApplicationEvent(WorkTimeChangeEvent event) {
+        CompletableFuture.supplyAsync(() ->
+                {
+                    remoteResumptionTaskService.rebuild(JSON.toJSONString(event), SecurityConstants.INNER);
+                    eduTrainingService.rebuild(JSON.toJSONString(event), SecurityConstants.INNER);
+                    remoteRetrievalTaskService.rebuild(JSON.toJSONString(event), SecurityConstants.INNER);
+                    return null;
+                }
+        );
 
-        remoteResumptionTaskService.rebuild(JSON.toJSONString(event), SecurityConstants.INNER);
-        eduTrainingService.rebuild(JSON.toJSONString(event), SecurityConstants.INNER);
-        remoteRetrievalTaskService.rebuild(JSON.toJSONString(event), SecurityConstants.INNER);
 //        remoteSafetyCheckService.rebuild(JSON.toJSONString(event), SecurityConstants.INNER);
     }
 }