Jelajahi Sumber

feature 增加检查任务和隐患任务的 提醒

xiahan 1 tahun lalu
induk
melakukan
7d60b0139f

+ 27 - 4
bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java

@@ -137,10 +137,17 @@ public class SaveConstans {
         public static final String QUESTIONNAIRE_SURVEY_TITLE = "培训需求调查提醒";
         /**
          * 检查任务提醒
-          */
+         */
         public static final String INSPECTION_TASKS_TITLE = "检查任务提醒";
+        /**
+         * 危险作业处罚提醒
+         */
         public static final String DANGEROUS_TITLE = "危险作业处罚提醒";
 
+        /**
+         * 隐患任务提醒
+         */
+        public static final String DANGER_TASKS_TITLE = "隐患任务提醒";
     }
 
     public static class NotifyContent {
@@ -160,10 +167,26 @@ public class SaveConstans {
          * 培训需求调查提醒内容
          */
         public static final String QUESTIONNAIRE_SURVEY_CONTENT = "%s年%s培训需求,已发布";
-
-         public static final String INSPECTION_TASKS_CONTENT = "日常检查%s将于%tF %tT开始检查区域为%s-;-%s";
-
+        /**
+         * 检查任务提醒内容
+         */
+        public static final String INSPECTION_TASKS_CONTENT = "日常检查%s将于%tF %tT开始检查区域为%s-;-%s";
+        /**
+         * 危险作业处罚内容
+         */
         public static final String DANGEROUS_CONTENT = "%s:%s-%s,处罚金额:%s,时间:%s";
+        /**
+         * 隐患任务提醒内容
+         */
+        public static final String DANGER_TASKS_CONTENT = "%s发现隐患任务请在%tF前整改完成";
 
+        /**
+         * 隐患任务确认提醒内容
+         */
+        public static final String DANGER_TASKS_CONFIRM_CONTENT = "隐患任务%s已整改请确认";
+        /**
+         * 隐患任务验证提醒内容
+         */
+        public static final String DANGER_TASKS_VERIFY_CONTENT = "隐患任务%s已整改并确认请验证";
     }
 }

+ 24 - 16
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/SafeCheckSendNotifyServiceImpl.java

@@ -1,5 +1,6 @@
 package com.rongwei.sfcommon.sys.service.impl;
 
+import com.rongwe.scentity.domian.HiddenDangerTrackDo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.safecommon.utils.CXCommonUtils;
 import com.rongwei.sfcommon.sys.dao.DangerousDao;
@@ -14,8 +15,8 @@ import java.util.Map;
 
 import static com.rongwei.safecommon.utils.SaveConstans.DEFAULT_SEPARATOR;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.DANGEROUS_CONTENT;
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.DANGEROUS_TITLE;
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.INSPECTION_TASKS_TITLE;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.DANGER_TASKS_CONTENT;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.*;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.DANGEROUS;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.INSPECTIONTASKS;
 
@@ -23,7 +24,7 @@ import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.INSPECTIONTAS
  * SafeCheckSendNotifyServiceImpl class
  *
  * @author XH
- * @date 2023/12/19
+ * @since 2023/12/19
  */
 @Service
 public class SafeCheckSendNotifyServiceImpl implements SafeCheckSendNotifyService {
@@ -35,18 +36,6 @@ public class SafeCheckSendNotifyServiceImpl implements SafeCheckSendNotifyServic
 
     }
 
-    /**
-     * 检查任务提醒
-     * @param sendNotifyMap
-     */
-    public void sendInspectionTasksNotify( Map<String, HashSet<String>> sendNotifyMap) {
-        sendNotifyMap.forEach((k, v) -> {
-            CXCommonUtils.sendNotify(INSPECTION_TASKS_TITLE, k.split(DEFAULT_SEPARATOR)[0], "",
-                    new ArrayList<>(v), k.split(DEFAULT_SEPARATOR)[1], INSPECTIONTASKS);
-        });
-    }
-
-
     /**
      * 危险作业每日处罚提醒
      */
@@ -80,8 +69,27 @@ public class SafeCheckSendNotifyServiceImpl implements SafeCheckSendNotifyServic
                             dangerous.get("PENALTYAMOUNT"), dangerous.get("MODIFYDATE")),
                     "", personnelIdList, null, DANGEROUS);
         }
+        return R.ok();
+    }
 
+    /**
+     * 检查任务提醒
+     */
+    public void sendInspectionTasksNotify(Map<String, HashSet<String>> sendNotifyMap) {
+        sendNotifyMap.forEach((k, v) -> CXCommonUtils.sendNotify(INSPECTION_TASKS_TITLE, k.split(DEFAULT_SEPARATOR)[0], "",
+                new ArrayList<>(v), k.split(DEFAULT_SEPARATOR)[1], INSPECTIONTASKS));
+    }
 
-        return R.ok();
+    /**
+     * 隐患任务提醒
+     */
+    public void sendDangerTasksNotify(List<HiddenDangerTrackDo> hiddenDangerTrackDos) {
+        hiddenDangerTrackDos.forEach((k) -> CXCommonUtils.sendNotify(DANGER_TASKS_TITLE,
+                String.format(DANGER_TASKS_CONTENT,k.getWorkshop(),k.getRectificationdate())
+                , "",
+                new ArrayList<String>() {{
+                    add(k.getTrackuserid());
+                }}, k.getId(), INSPECTIONTASKS));
     }
+
 }

+ 10 - 5
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/SaveCheckItemServiceImpl.java

@@ -19,7 +19,6 @@ import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
 import com.rongwei.rwcommon.vo.MailDo;
-import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
 import com.rongwei.sfcommon.sys.dao.SaveCheckCommonDao;
 import com.rongwei.sfcommon.sys.service.SaveCheckItemService;
 import com.rongwei.sfcommon.sys.service.ThemeCheckItemService;
@@ -59,6 +58,9 @@ public class SaveCheckItemServiceImpl implements SaveCheckItemService {
     private SysSerialNumberService sysSerialNumberService;
     @Autowired
     private HiddenDangerTrackServiceImpl hiddenDangerTrackService;
+    @Autowired
+    private SafeCheckSendNotifyServiceImpl sendNotifyService;
+
     private static final String SPECIALCHECK_MAIL_SUBJECT = "周五专项检查结果";
     private static final String TYPE_DAYCHECK_MAIL_SUBJECT = "主管经理检查结果";
     private static final String DISCOVERY_ITEM_MAIL_CONTENT = "检查主题:%s \n组长:%s\n组员:%s\n检查工段:%s\n" +
@@ -100,13 +102,13 @@ public class SaveCheckItemServiceImpl implements SaveCheckItemService {
             log.error("无法通过ID:{}获取到检查项信息", id);
         }
         // 任务生成
-        generateHiddenDangerTrack(checkItemDo, themeCheck, aspCheckDiscoveryItemDos);
+        List<HiddenDangerTrackDo> sendNotifyData = generateHiddenDangerTrack(checkItemDo, themeCheck, aspCheckDiscoveryItemDos);
         // 更新任务状态
         List<String> discoverIds = aspCheckDiscoveryItemDos.stream().map(AspCheckDiscoveryItemDo::getId).collect(Collectors.toList());
         aspCheckDiscoveryItemService.update(new LambdaUpdateWrapper<AspCheckDiscoveryItemDo>()
                 .set(AspCheckDiscoveryItemDo::getCreatetask,1)
                 .eq(AspCheckDiscoveryItemDo::getId,discoverIds));
-
+        sendNotifyService.sendDangerTasksNotify(sendNotifyData);
 //        ThreadPoolExecutor threadPool = ExecutorBuilder.create()
 //                .setCorePoolSize(1)
 //                .setMaxPoolSize(3)
@@ -124,9 +126,11 @@ public class SaveCheckItemServiceImpl implements SaveCheckItemService {
     /**
      * 生成隐患跟踪任务
      * 每一个检查项生成一个隐患跟踪任务
+     *
+     * @return
      */
-    public void generateHiddenDangerTrack(ThemeCheckItemDo checkItemDo, ThemeCheckDo themeCheck,
-                                          List<AspCheckDiscoveryItemDo> aspCheckDiscoveryItemDos) {
+    public List<HiddenDangerTrackDo> generateHiddenDangerTrack(ThemeCheckItemDo checkItemDo, ThemeCheckDo themeCheck,
+                                                               List<AspCheckDiscoveryItemDo> aspCheckDiscoveryItemDos) {
         if (MlConstants.CHECK_RESULT_TRACK.equals(checkItemDo.getCheckresult()) || aspCheckDiscoveryItemDos.isEmpty()) {
             log.debug("检查结果为正常或无发现项,无需生成检查任务");
         }
@@ -191,6 +195,7 @@ public class SaveCheckItemServiceImpl implements SaveCheckItemService {
         hiddenDangerTrackService.saveBatch(addList);
         checkItemDo.setSaved("1");
         themeCheckItemService.saveOrUpdate(checkItemDo);
+        return addList;
     }
 
 

+ 12 - 3
cx-safe-check/cx-save-check-server/src/main/java/com/rongwei/savecheck/controller/SafeSendNotifyController.java

@@ -21,8 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/notify")
 @Slf4j
 public class SafeSendNotifyController {
-    @Autowired
-    private SafeCheckSendNotifyService sendNotify;
+
     @Autowired
     private SafeCheckSendNotifyServiceImpl sendNotifyService;
     @PostMapping("/dangerousDailyNotify")
@@ -34,11 +33,21 @@ public class SafeSendNotifyController {
     public R dangerousTimelyNotify(@PathVariable String id) {
         try {
             log.info("开始即使发送危险作业处罚提醒");
-            return sendNotify.sendDangerousTimelyNotify(id);
+            return sendNotifyService.sendDangerousTimelyNotify(id);
         } catch (Exception e) {
             log.error(StringUtils.spliceErrorMsg(e), e.fillInStackTrace());
             return R.queryError();
         }
 
     }
+
+    /**
+     * 开始生成检查任务提醒
+     */
+    @PostMapping("/inspection")
+    public void inspectionTasks(){
+        log.info("开始生成检查任务提醒");
+        sendNotifyService.inspectionTasks();
+    }
+
 }