Forráskód Böngészése

feature 增加检查任务提醒

xiahan 1 éve
szülő
commit
0eb016dac9

+ 59 - 6
bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java

@@ -22,6 +22,7 @@ public class SaveConstans {
 
     public static final String MINUS_ONE = "-1";
     public static final String AND = "and";
+    public static final String DEFAULT_SEPARATOR="-;-";
 
     /**
      * orgId和 code的对应关系
@@ -86,26 +87,78 @@ public class SaveConstans {
         /**
          * 安全应急
          */
-        public static final String  SAFETYEMERGENCY="safetyemergency";
+        public static final String SAFETYEMERGENCY = "safetyemergency";
         /**
          * 安全会议
          */
-        public static final String  SAFETYMEETING="safetymeeting";
+        public static final String SAFETYMEETING = "safetymeeting";
         /**
          * 特种设备提醒
          */
-        public static final String  SPECIALEQUIPMENT="specialequipment";
+        public static final String SPECIALEQUIPMENT = "specialequipment";
         /**
          * 目标考核
          */
-        public static final String  TARGETASSESSMENT="targetassessment";
+        public static final String TARGETASSESSMENT = "targetassessment";
         /**
          * 危险作业
          */
-        public static final String  DANGEROUS="dangerous";
+        public static final String DANGEROUS = "dangerous";
         /**
          * 问题跟踪与解决
          */
-        public static final String  ISSUETRACKING="issuetracking";
+        public static final String ISSUETRACKING = "issuetracking";
+        /**
+         * 检查任务
+         */
+        public static final String INSPECTIONTASKS = "inspectiontasks";
+        /**
+         * 隐患任务
+         */
+        public static final String DANGERTASKS = "dangertasks";
+    }
+
+    public static class NotifyTitle {
+        /**
+         * 培训截止提醒
+         */
+        public static final String CUT_OFF_TRAIN_TITLE = "培训截止提醒";
+        /**
+         * 我的培训
+         */
+        public static final String TRAIN_NOTIFY_TITLE = "我的培训";
+        /**
+         * 培训取消提醒
+         */
+        public static final String CANCEL_TRAIN_TITLE = "培训取消提醒";
+        /**
+         * 培训需求调查提醒
+         */
+        public static final String QUESTIONNAIRE_SURVEY_TITLE = "培训需求调查提醒";
+        /**
+         * 检查任务提醒
+          */
+        public static final String INSPECTION_TASKS_TITLE = "检查任务提醒";
+    }
+
+    public static class NotifyContent {
+        /**
+         * 培训截止提醒内容
+         */
+        public static final String CUT_OFF_TRAIN_CONTENT = "培训考试将于%tF截止,请尽快参加考试。";
+        /**
+         * 我的培训提醒内容
+         */
+        public static final String TRAIN_NOTIFY_CONTENT = "%s,培训时间:%tF至%tF";
+        /**
+         * 培训取消提醒内容
+         */
+        public static final String CANCEL_TRAIN_CONTENT = "%s已取消";
+        /**
+         * 培训需求调查提醒内容
+         */
+        public static final String QUESTIONNAIRE_SURVEY_CONTENT = "%s年%s培训需求,已发布";
+
+         public static final String INSPECTION_TASKS_CONTENT = "日常检查%s将于%tF %tT开始检查区域为%s-;-%s";
     }
 }

+ 16 - 0
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/SafeCheckSendNotifyService.java

@@ -0,0 +1,16 @@
+package com.rongwei.sfcommon.sys.service;
+
+/**
+ * SendNotifyService class
+ *
+ * @author XH
+ * @date 2023/12/15
+ */
+public interface SafeCheckSendNotifyService {
+
+    /**
+     * 检查任务
+     */
+    void inspectionTasks();
+
+}

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

@@ -0,0 +1,38 @@
+package com.rongwei.sfcommon.sys.service.impl;
+
+import com.rongwei.safecommon.utils.CXCommonUtils;
+import com.rongwei.sfcommon.sys.service.SafeCheckSendNotifyService;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Map;
+
+import static com.rongwei.safecommon.utils.SaveConstans.DEFAULT_SEPARATOR;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.INSPECTION_TASKS_TITLE;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.INSPECTIONTASKS;
+
+/**
+ * SafeCheckSendNotifyServiceImpl class
+ *
+ * @author XH
+ * @date 2023/12/19
+ */
+@Service
+public class SafeCheckSendNotifyServiceImpl implements SafeCheckSendNotifyService {
+    @Override
+    public void inspectionTasks() {
+
+    }
+
+    /**
+     * 检查任务提醒
+     * @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);
+        });
+    }
+}

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

@@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.INSPECTION_TASKS_CONTENT;
 import static com.rongwei.sfcommon.utils.MlConstants.THEME_CHECK_STATUS_WAIT;
 
 @Service("themeCheckService")
@@ -51,7 +52,8 @@ public class ThemeCheckServiceImpl extends ServiceImpl<ThemeCheckDao, ThemeCheck
     private SafetyObservationService safetyObservationService;
     @Autowired
     private SafetyObservationDao safetyObservationDao;
-
+    @Autowired
+    private SafeCheckSendNotifyServiceImpl sendNotifyService;
     public static final String INSPECTION_TEAM = "%s,%s";
 
     /**
@@ -207,6 +209,8 @@ public class ThemeCheckServiceImpl extends ServiceImpl<ThemeCheckDao, ThemeCheck
                 .in(CheckTemplateItemsDo::getChecktemplateid, checkTemplateIds)
         );
         String mailSubject = MlConstants.THEMECHECK_TYPE_SPECIALCHECK.equals(themeCheckDo.getChecktype()) ? "周五专项检查" : "全厂检查";
+        // 发送提醒的map
+        Map<String, HashSet<String>> sendNotifyMap = new HashMap<>();
         // 生成检查任务
         themeCheckWorkparks.forEach(info -> {
             String groupleader = info.getGroupleader();
@@ -226,6 +230,10 @@ public class ThemeCheckServiceImpl extends ServiceImpl<ThemeCheckDao, ThemeCheck
                     saveCheckContentList.add(generateThemeCheckContent(userDo, themeCheckItemDo, checkTemplate));
                 });
             });
+            // 任务名称  计划检查时间 区域
+            sendNotifyMap.put(String.format(INSPECTION_TASKS_CONTENT,themeCheckDo.getCheckname(),themeCheckDo.getPlanstarttime(),
+                            themeCheckDo.getPlanstarttime(),info.getChargeorgname(),themeCheckDo.getId()),
+                    currentCheckUserIds);
          /* 注释邮件相关功能
             MailDo mail = new MailDo();
             mail.setSubject(mailSubject);
@@ -236,6 +244,7 @@ public class ThemeCheckServiceImpl extends ServiceImpl<ThemeCheckDao, ThemeCheck
         this.update(new LambdaUpdateWrapper<ThemeCheckDo>().set(ThemeCheckDo::getCreatetask, 1).eq(ThemeCheckDo::getId, themeCheckId));
         themeCheckItemService.saveBatch(saveCheckItemList);
         themeCheckContentService.saveBatch(saveCheckContentList);
+        sendNotifyService.sendInspectionTasksNotify(sendNotifyMap);
     }
 
 

+ 1 - 6
rw-training/training-common/src/main/java/com/rongwei/trainingcommon/sys/service/SendNotifyService.java

@@ -1,17 +1,12 @@
 package com.rongwei.trainingcommon.sys.service;
 
-import com.rongwei.training.domain.PlanDo;
-
-import java.util.Map;
-import java.util.Set;
-
 /**
  * SendNotifyService class
  *
  * @author XH
  * @date 2023/12/15
  */
-public interface SendNotifyService {
+public interface TrainingSendNotifyService {
 
     /**
      * 考试截止提醒邮件

+ 1 - 1
rw-training/training-common/src/main/java/com/rongwei/trainingcommon/sys/service/impl/TrainingDemandServiceImpl.java

@@ -72,7 +72,7 @@ public class TrainingDemandServiceImpl implements TrainingDemandService {
     @Autowired
     private DemandSurveyUserAnswerServiceImpl demandSurveyUserAnswerService;
     @Autowired
-    private SendNotifyServiceImpl sendNotifyService;
+    private TrainingSendNotifyServiceImpl sendNotifyService;
 
     public static final String ERROR_MSG = "问卷调查发布失败";
     /**

+ 9 - 14
rw-training/training-common/src/main/java/com/rongwei/trainingcommon/sys/service/impl/SendNotifyServiceImpl.java

@@ -12,7 +12,7 @@ import com.rongwei.training.domain.TrainingDemandSurveyBackupsDo;
 import com.rongwei.trainingcommon.sys.service.EmpExamService;
 import com.rongwei.trainingcommon.sys.service.PlanPaperService;
 import com.rongwei.trainingcommon.sys.service.PlanService;
-import com.rongwei.trainingcommon.sys.service.SendNotifyService;
+import com.rongwei.trainingcommon.sys.service.TrainingSendNotifyService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,8 +23,10 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.TRAINING;
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.TRAININGFORM;
+import static com.rongwei.safecommon.utils.SaveConstans.DEFAULT_SEPARATOR;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.*;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.*;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.*;
 
 /**
  * SendNotifyService class
@@ -33,7 +35,7 @@ import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.TRAININGFORM;
  * @date 2023/12/15
  */
 @Service
-public class SendNotifyServiceImpl implements SendNotifyService {
+public class TrainingSendNotifyServiceImpl implements TrainingSendNotifyService {
     private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
     public static final ThreadPoolExecutor threadPool = ExecutorBuilder.create()
             .setCorePoolSize(8)
@@ -49,16 +51,7 @@ public class SendNotifyServiceImpl implements SendNotifyService {
     private SendMailServiceImpl sendMailService;
     @Autowired
     private EmpExamService empExamService;
-    public static final String CUT_OFF_TRAIN_TITLE = "培训截止提醒";
-    public static final String CUT_OFF_TRAIN_CONTENT = "培训考试将于%tF截止,请尽快参加考试。";
-    public static final String TRAIN_NOTIFY_TITLE = "我的培训";
-    public static final String TRAIN_NOTIFY_CONTENT = "%s,培训时间:%tF至%tF";
 
-    public static final String CANCEL_TRAIN_TITLE = "培训取消提醒";
-    public static final String CANCEL_TRAIN_CONTENT = "%s已取消";
-
-    public static final String QUESTIONNAIRE_SURVEY_TITLE="培训需求调查提醒";
-    public static final String QUESTIONNAIRE_SURVEY_CONTENT="%s年%s培训需求,已发布";
 
     // 培训计划已发布
     private static final String TRAINING_PLAN_PUBLISH = "y";
@@ -123,7 +116,7 @@ public class SendNotifyServiceImpl implements SendNotifyService {
     /**
      * 问卷调查提现
      *
-     * @param planAndUserIdMap
+     * @param
      */
     public void sendQuestionnaireSurveyNotify(List<TrainingDemandSurveyBackupsDo> saveDemandSurveyBackupsDos) {
         // 获取用户id
@@ -161,4 +154,6 @@ public class SendNotifyServiceImpl implements SendNotifyService {
         });
     }
 
+
+
 }

+ 2 - 2
rw-training/training-server/src/main/java/com/rongwei/training/controller/PlanController.java

@@ -13,7 +13,7 @@ import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
 import com.rongwei.training.domain.*;
 import com.rongwei.trainingcommon.sys.service.*;
-import com.rongwei.trainingcommon.sys.service.impl.SendNotifyServiceImpl;
+import com.rongwei.trainingcommon.sys.service.impl.TrainingSendNotifyServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -43,7 +43,7 @@ public class PlanController {
     @Autowired
     private PlanPaperService PlanPaperService;
     @Autowired
-    private SendNotifyServiceImpl sendNotifyService;
+    private TrainingSendNotifyServiceImpl sendNotifyService;
 
     public static final String TRAIN_NOTIFY_TITLE = "我的培训";
     public static final String TRAIN_NOTIFY_CONTENT = "%s,培训时间:%tF-%tF";

+ 2 - 2
rw-training/training-server/src/main/java/com/rongwei/training/controller/SendNotifyController.java

@@ -1,6 +1,6 @@
 package com.rongwei.training.controller;
 
-import com.rongwei.trainingcommon.sys.service.impl.SendNotifyServiceImpl;
+import com.rongwei.trainingcommon.sys.service.impl.TrainingSendNotifyServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
 @Slf4j
 public class SendNotifyController {
     @Autowired
-    private SendNotifyServiceImpl sendNotifyService;
+    private TrainingSendNotifyServiceImpl sendNotifyService;
 
     @PostMapping("/end/reminder-email")
     public void endReminderMail() {