Explorar o código

安全观察指标提醒

wangxuan hai 1 ano
pai
achega
8c968a06d3

+ 13 - 0
bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java

@@ -196,6 +196,10 @@ public class SaveConstans {
          * 报工不合格提醒
          */
         public static final String REPORTUNQUALIFY_REMIND = "reportunqualify";
+        /**
+         * 安全观察指标提醒
+         */
+        public static final String OBSERVATION_AUDIT = "observation";
     }
 
     public static class NotifyTitle {
@@ -321,6 +325,10 @@ public class SaveConstans {
          * 报工不合格提醒
          */
         public static final String REPORTUNQUALIFY_TITLE="订单作业报工不合格";
+        /**
+         * 安全观察指标提醒
+         */
+        public static final String OBSERVATION_TITLE="安全观察指标提醒";
     }
 
     public static class NotifyContent {
@@ -445,6 +453,11 @@ public class SaveConstans {
          * 报工不合格提醒
          */
         public static final String REPORTUNQUALIFY_CONTENT = "报工检验不合格,请及时调整计划,详情参见邮件提醒";
+
+        /**
+         * 安全观察指标提醒
+         */
+        public static final String OBSERVATION_CONTENT = "新的安全观察目标值【%s】已下达,请及时完成!";
     }
 
     /**

+ 7 - 1
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/AspSafetyProductObjectiveService.java

@@ -3,7 +3,13 @@ package com.rongwei.sfcommon.sys.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwe.scentity.domian.AspSafetyProductObjective;
 
+import java.util.List;
+import java.util.Map;
+
 public interface AspSafetyProductObjectiveService extends IService<AspSafetyProductObjective> {
     void safetyResult();
-
+    /**
+     * 安全观察指标提醒
+     */
+    void reportObservationConfig(List<String> list);
 }

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

@@ -23,6 +23,10 @@ import org.springframework.stereotype.Service;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.OBSERVATION_CONTENT;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.OBSERVATION_TITLE;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.OBSERVATION_AUDIT;
+
 /**
  * @author :sc
  * @since :2023/12/7
@@ -112,6 +116,31 @@ public class AspSafetyProductObjectiveServiceImpl extends ServiceImpl<AspSafetyP
 
     }
 
+    @Override
+    public void reportObservationConfig(List<String> list) {
+        if(!list.isEmpty()){
+            // {"ad8106741bf547778d01d556e371ac98/34d64aaae0344b109ad8909f3afa4d40/69"}
+            for (String str : list) {
+                String[] split = str.split("/");
+                if(split.length<3){
+                    return;
+                }
+                String value = split[0];
+                String userId = split[1];
+                String count = split[2];
+                //系统通知(移动端和PC端个人工作台)
+                CXCommonUtils.sendNotify(OBSERVATION_TITLE,
+                        String.format(OBSERVATION_CONTENT, count),
+                        null,
+                        Collections.singletonList(userId),
+                        value,
+                        OBSERVATION_AUDIT,
+                        false);
+
+            }
+        }
+    }
+
     private void sendMessage(List<AspSafetyProductObjectiveResult> mainResList) {
         //维护指标级别对应的角色ID
         //objectivelevel:指标级别。

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

@@ -6,10 +6,10 @@ import com.rongwei.rwcommon.utils.StringUtils;
 import com.rongwei.sfcommon.sys.service.AspSafetyProductObjectiveService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * 安全生产目标
@@ -40,4 +40,12 @@ public class AspSafetyProductObjectiveController {
         }
     }
 
+    /**
+     * 安全观察指标提醒
+     * @param list 参数:key->id value->userId/安全观察值
+     */
+    @PostMapping("/reportObservationConfig")
+    public void reportObservationConfig(@RequestBody List<String> list){
+        aspSafetyProductObjectiveService.reportObservationConfig(list);
+    }
 }