lipenghui пре 2 месеци
родитељ
комит
38c1e5a4ff

+ 6 - 3
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java

@@ -83,6 +83,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
         // SupplierDO supplier = supplierService.getByBpmProcessId(reqDTO.getProcessInstanceId());
         // String msg = "【DeepOil】供应商审核流程"+"-"+supplier.getCode()+"-"+supplier.getName()+",请前往 http://1.94.244.160:91/ 处理。"+"["+new Date()+"]";
         String msg = "【DeepOil】供应商审核流程 - 有新的供应商信息需要审核"+",请前往 http://1.94.244.160:91/ 处理。"+"["+new Date()+"]";
+        String url = "";
         if ("故障上报流程".equals(reqDTO.getProcessInstanceName())){
             String templateCode = "failure-report";
             templateParams.put("businessType", "failureReport");
@@ -90,7 +91,8 @@ public class BpmMessageServiceImpl implements BpmMessageService {
             templateParams.put("processcode", reqDTO.getProcessInstanceId());
             notifyMessageSendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
                     .setUserId(reqDTO.getAssigneeUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
-            msg = "【PMS】故障上报流程 - 有新的故障上报需要审核"+",请前往 https://iot.deepoil.cc 进行处理。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
+            msg = "【PMS】您有新的故障上报流程待处理,请审批。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
+            url="https://iot.deepoil.cc/bpm/process-instance/detail?id="+reqDTO.getProcessInstanceId();
         } else if ("委外维修工单流程".equals(reqDTO.getProcessInstanceName())){
             String templateCode = "maintain-out";
             templateParams.put("businessType", "maintainOut");
@@ -98,9 +100,10 @@ public class BpmMessageServiceImpl implements BpmMessageService {
             templateParams.put("processcode", reqDTO.getProcessInstanceId());
             notifyMessageSendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
                     .setUserId(reqDTO.getAssigneeUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
-            msg = "【系统消息】有新的委外维修流程"+",请前往 https://iot.deepoil.cc 进行处理。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
+            msg = "【PMS】您有新的委外维修流程,请审批。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
+            url="https://iot.deepoil.cc/bpm/process-instance/detail?id="+reqDTO.getProcessInstanceId();
         }
-        dingtalkSendApi.send(user.getMobile(), msg);
+        dingtalkSendApi.send(user.getMobile(), msg,"link",url);
     }
 
     @Override

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/constant/PmsConstants.java

@@ -13,4 +13,6 @@ public interface PmsConstants {
     String MAINTAIN_OUT = "maintainOut";
     String MAINTAIN_OUT_TEMPLATE = "maintain-out";
 
+    String GENERATE_OPERATION = "generateOperation";
+    String GENERATE_OPERATION_TEMPLATE = "generate-operation";
 }

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/failure/IotFailureReportServiceImpl.java

@@ -175,7 +175,7 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
             String msg = "【PMS】您有新的故障上报 - "+iotFailureReport.getFailureName()+"流程待审批。"+"["+new Date()+"]";
             AdminUserRespDTO user = adminUserApi.getUser(e);
             if (Objects.nonNull(user)) {
-                dingtalkSendApi.send(user.getMobile(), msg);
+                dingtalkSendApi.send(user.getMobile(), msg,"","");
             }
         }));
     }

+ 3 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/maintain/IotMaintainServiceImpl.java

@@ -250,13 +250,13 @@ public class IotMaintainServiceImpl implements IotMaintainService {
         localStockAndOut(updateReqVO);
         if ("in".equals(updateReqVO.getMaintain().getType())) {
             String msg = "【PMS】维修工单 - "+updateReqVO.getMaintain().getFailureName()+"已处理。"+"["+new Date()+"]";
-            sendMessage(BeanUtils.toBean(updateReqVO.getMaintain(), IotMaintainDO.class), "maintain-report", msg);
+//            sendMessage(BeanUtils.toBean(updateReqVO.getMaintain(), IotMaintainDO.class), "maintain-report", msg);
         }
         //委外发起流程
         if ("out".equals(updateReqVO.getMaintain().getType())){
             submitForApproval(updateReqVO.getMaintain().getId());
             String msg = "【PMS】有新的委外维修流程, 请前往系统审批";
-            sendMessage(BeanUtils.toBean(updateReqVO, IotMaintainDO.class), "maintain-out", msg);
+//            sendMessage(BeanUtils.toBean(updateReqVO, IotMaintainDO.class), "maintain-out", msg);
         }
         //故障上报处理转为工单已完成-orderfinished
         if (StringUtils.isNotBlank(updateReqVO.getMaintain().getFailureId())){
@@ -329,7 +329,7 @@ public class IotMaintainServiceImpl implements IotMaintainService {
                         .setUserId(parentDept.getLeaderUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
                 AdminUserRespDTO user = adminUserApi.getUser(parentDept.getLeaderUserId());
                 if (Objects.nonNull(user)) {
-                    dingtalkSendApi.send(user.getMobile(), msg);
+                    dingtalkSendApi.send(user.getMobile(), msg,"","");
                 }
             }
 

+ 1 - 1
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dingtalk/DingtalkSendApi.java

@@ -16,6 +16,6 @@ public interface DingtalkSendApi {
      * @param sendContent 通知内容
      * @return com.yanfan.common.core.notify.NotifySendResponse
      */
-    NotifySendResponse send(String sendAccount, String sendContent);
+    NotifySendResponse send(String sendAccount, String sendContent,String type, String url);
 
 }

+ 8 - 4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dingtalk/DingtalkSendServiceImpl.java

@@ -47,7 +47,7 @@ public class DingtalkSendServiceImpl implements DingtalkSendApi {
     private String getUserInfoByMobile;
 
     @Override
-    public NotifySendResponse send(String sendAccount, String sendContent) {
+    public NotifySendResponse send(String sendAccount, String sendContent, String type, String jumpUrl) {
         NotifySendResponse notifySendResponse = new NotifySendResponse();
         notifySendResponse.setSendContent(sendContent);
         notifySendResponse.setStatus(1);
@@ -77,7 +77,11 @@ public class DingtalkSendServiceImpl implements DingtalkSendApi {
                 req.setUseridList(userId);
                 req.setToAllUser(Boolean.FALSE);
             }
-            OapiMessageCorpconversationAsyncsendV2Request.Msg msg = this.createOapiMessageMsg(null, sendContent);
+            DingTalkMsgParams dingTalkMsgParams = new DingTalkMsgParams();
+            dingTalkMsgParams.setMessageUrl(jumpUrl);
+            dingTalkMsgParams.setTitle("DeepOil-PMS");
+            dingTalkMsgParams.setPicUrl("https://iot.deepoil.cc/images/logo.png");
+            OapiMessageCorpconversationAsyncsendV2Request.Msg msg = this.createOapiMessageMsg(dingTalkMsgParams, sendContent, type);
             req.setMsg(msg);
             OapiMessageCorpconversationAsyncsendV2Response rsp = dingTalkClient.execute(req, accessToken);
             notifySendResponse.setStatus(0 == rsp.getErrcode() ? 1 : 0);
@@ -95,9 +99,9 @@ public class DingtalkSendServiceImpl implements DingtalkSendApi {
      * @param msgParams 消息参数
      * @return
      */
-    private OapiMessageCorpconversationAsyncsendV2Request.Msg createOapiMessageMsg(DingTalkMsgParams msgParams, String content) {
+    private OapiMessageCorpconversationAsyncsendV2Request.Msg createOapiMessageMsg(DingTalkMsgParams msgParams, String content, String type) {
         OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
-        msg.setMsgtype("text");
+        msg.setMsgtype(type);
         switch (msg.getMsgtype()) {
             case "text":
                 msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());