Переглянути джерело

设备之系统——消息提醒 V2.0
根据任务ID发送验收提醒消息

hyq 1 рік тому
батько
коміт
5600fafda4

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

@@ -129,6 +129,10 @@ public class SaveConstans {
          * 保养检修
          */
         public static final String MAINTAIN = "maintain";
+        /**
+         * 保养检修
+         */
+        public static final String ACCEPTMAINTAINTASK = "acceptmaintaintask";
     }
 
     public static class NotifyTitle {
@@ -189,6 +193,11 @@ public class SaveConstans {
          */
         public static final String MAINTAIN_SYSTEM_TITLE = "保养任务";
 
+        /**
+         * 保养检修工单提醒标题
+         */
+        public static final String ACCEPTANCE_SYSTEM_TITLE = "待验收保养任务";
+
 
     }
 
@@ -247,5 +256,11 @@ public class SaveConstans {
          * 保养检修工单提醒内容
          */
         public static final String MAINTAIN_SYSTEM_CONTENT = "请及时执行%s的%s的%s( %s )-%s的保养任务并登记保养结果,负责人:%s,其他保养工程师:%s";
+
+        /**
+         * 保养检修工单提醒内容
+         */
+        public static final String ACCEPTANCE_SYSTEM_CONTENT = "请及时对已完成保养登记的%s-%s的%s(%s )%s的保养任务进行验收确认,(完成日期:%s,保养负责人:%s,其他保养工程师:%s";
+
     }
 }

+ 12 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquipmentSendNotifyService.java

@@ -10,7 +10,7 @@ import com.rongwei.rwcommon.base.R;
  */
 public interface EquipmentSendNotifyService {
     /**
-     * 根据任务ID发送 提醒
+     * 根据任务ID发送维修 提醒
      *
      * @param id 保养任务ID
      * @return {@link R}
@@ -19,4 +19,15 @@ public interface EquipmentSendNotifyService {
      *
      */
     R maintainCreateTaskNotify(String id);
+
+    /**
+     * 根据任务ID发送验收 提醒
+     *
+     * @param id 保养任务ID
+     * @return {@link R}
+     * @date 2024/1/18 17:16
+     * @author shangmi
+     *
+     */
+    R maintainVerifyTaskNotify(String id);
 }

+ 55 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquipmentSendNotifyServiceImpl.java

@@ -19,8 +19,11 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.ACCEPTANCE_SYSTEM_CONTENT;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.MAINTAIN_SYSTEM_CONTENT;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.ACCEPTANCE_SYSTEM_TITLE;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.MAINTAIN_SYSTEM_TITLE;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.ACCEPTMAINTAINTASK;
 import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.MAINTAIN;
 
 /**
@@ -101,5 +104,57 @@ public class EquipmentSendNotifyServiceImpl implements EquipmentSendNotifyServic
                 context,null,userId.stream().distinct().collect(Collectors.toList()),maintenanceTaskDo.getId(),MAINTAIN);
         return R.ok();
     }
+
+    @Override
+    public R maintainVerifyTaskNotify(String id) {
+        if (StringUtils.isBlank(id)) {
+            log.info("任务ID为空");
+            return R.ok();
+        }
+        EquMaintenanceTaskDo maintenanceTaskDo = maintenanceTaskService.getById(id);
+
+        if (null == maintenanceTaskDo) {
+            log.info("无法通过id:{}获取到任务列表", id);
+            return R.ok();
+        }
+
+        // 发送人
+        List<String> userId = new ArrayList<>();
+        // 发送内容
+        String context = null;
+        // 发送标题
+        String title = null;
+        if (maintenanceTaskDo.getAcceptorid() != null){
+            userId.addAll(Arrays.asList(maintenanceTaskDo.getAcceptorid().split(",")));
+        }
+        if (userId.isEmpty()){
+            log.info("id为{}的任务无提醒人",id);
+            return R.ok();
+        }
+        title = ACCEPTANCE_SYSTEM_TITLE;
+        context = String.format(ACCEPTANCE_SYSTEM_CONTENT,
+                maintenanceTaskDo.getPlanyear()+"-"+maintenanceTaskDo.getMonth(),
+                maintenanceTaskDo.getWorkshop(),
+                maintenanceTaskDo.getEquipmentname(),
+                maintenanceTaskDo.getEquipmentnumber(),
+                maintenanceTaskDo.getMaintenancesite(),
+                maintenanceTaskDo.getTaskendtime(),
+                maintenanceTaskDo.getPrincipal(),
+                maintenanceTaskDo.getOtherengineers()
+        );
+
+        JSONArray data = JSONUtil.parseArray( commonFeginClient.list(new HashMap<String, Object>() {{
+            this.put("NOTIFYTYPE", "acceptmaintaintask");
+            this.put("ROPTION", id);
+        }}).getData());
+        if (!data.isEmpty()){
+            List<String> ids = data.stream().map(info -> JSONUtil.parseObj(info).get("id").toString()).collect(Collectors.toList());
+            commonFeginClient.delete(ids);
+        }
+
+        CXCommonUtils.sendNotify(title,
+                context,null,userId.stream().distinct().collect(Collectors.toList()),maintenanceTaskDo.getId(),ACCEPTMAINTAINTASK);
+        return R.ok();
+    }
 }
 

+ 70 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquMaintenanceTaskDo.java

@@ -345,4 +345,74 @@ public class EquMaintenanceTaskDo implements Serializable {
 	 */
 	private String otherengineersid;
 
+	/**
+	 * table name:TASKSTARTTIME
+	 * table type:datetime
+	 * table comment:保养开始时间
+	 */
+	private Date taskstarttime;
+
+	/**
+	 * table name:TASKENDTIME
+	 * table type:datetime
+	 * table comment:保养完成时间
+	 */
+	private Date taskendtime;
+
+	/**
+	 * table name:PREVIOUSSITUATION
+	 * table type:text
+	 * table comment:保养前情况
+	 */
+	private String previoussituation;
+
+	/**
+	 * table name:ACCEPTOR
+	 * table type:varchar(50)
+	 * table comment:验收人
+	 */
+	private String acceptor;
+
+	/**
+	 * table name:ACCEPTORID
+	 * table type:varchar(36)
+	 * table comment:验收人ID
+	 */
+	private String acceptorid;
+
+	/**
+	 * table name:RESULTCHART
+	 * table type:text
+	 * table comment:保养结果图
+	 */
+	private String resultchart;
+
+	/**
+	 * table name:CONFIRMRESULT
+	 * table type:varchar(20)
+	 * table comment:确认结果
+	 */
+	private String confirmresult;
+
+	/**
+	 * table name:AFFIRMSTATE
+	 * table type:text
+	 * table comment:确认说明
+	 */
+	private String affirmstate;
+
+	/**
+	 * table name:ACCEPTANCETIME
+	 * table type:datetime
+	 * table comment:确认验收时间
+	 */
+	private Date acceptancetime;
+
+	/**
+	 * table name:RETURNMARK
+	 * table type:varchar(255)
+	 * table comment:返工标记
+	 */
+	private String returnmark;
+
 }

+ 24 - 1
cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquipmentSendNotifyController.java

@@ -27,7 +27,7 @@ public class EquipmentSendNotifyController {
 
 
     /**
-     * 根据任务ID发送 提醒
+     * 根据任务ID发送维修 提醒
      *
      * @param idGeneralDTO 保养任务ID
      * @return {@link R}
@@ -46,7 +46,30 @@ public class EquipmentSendNotifyController {
             log.info(e.getMessage());
             return R.error(e.getMessage());
         }
+    };
+
+
+
+    /**
+     * 根据任务ID发送验收 提醒
+     *
+     * @param idGeneralDTO 保养任务ID
+     * @return {@link R}
+     * @date 2024/1/18 17:16
+     * @author shangmi
+     *
+     */
 
+    @PostMapping("/maintainVerifyTaskNotify")
+    public R maintainVerifyTaskNotify(@RequestBody IdGeneralDTO idGeneralDTO){
+        try {
+            log.info("进入接口:/send-notify/maintainVerifyTaskNotify;入参为:{}",idGeneralDTO);
+            return sendNotifyService.maintainVerifyTaskNotify(idGeneralDTO.getId());
+        }catch (Exception e){
+            ExceptionUtils.printExceptionDetail(e,"发送消息提醒失败,异常为:");
+            log.info(e.getMessage());
+            return R.error(e.getMessage());
+        }
     };
 
 }