Kaynağa Gözat

调整OA调用消息中心代码;修复消息提醒审批人设置有误问题

fuyuchuan 2 hafta önce
ebeveyn
işleme
170f3afc64

+ 3 - 3
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaApprovalServiceImpl.java

@@ -239,7 +239,7 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
                             // 发送消息通知下一步审批人
                             oaSendMessageCenter.sendAsyncMessage(
                                     oaApproval.getCreateBy(),
-                                    Long.valueOf(oaApproval.getProposer()),
+                                    oaApproval.getApprovalUid(),
                                     approval.getId(),
                                     userIds,
                                     3,
@@ -254,7 +254,7 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
                 Long proposerId = Long.valueOf(oaApproval.getProposer());
                 oaSendMessageCenter.sendAsyncMessage(
                         oaApproval.getCreateBy(),
-                        proposerId,
+                        oaApproval.getApprovalUid(),
                         oaApproval.getId(),
                         Collections.singletonList(proposerId),
                         1,
@@ -266,7 +266,7 @@ public class OaApprovalServiceImpl extends AbstractCrudService<OaApprovalMapper,
             // 发送消息通知申请人审核不通过
             oaSendMessageCenter.sendAsyncMessage(
                     oaApproval.getCreateBy(),
-                    proposerId,
+                    oaApproval.getApprovalUid(),
                     oaApproval.getId(),
                     Collections.singletonList(proposerId),
                     0,

+ 9 - 8
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/impl/OaFbdDocumentServiceImpl.java

@@ -177,16 +177,17 @@ public class OaFbdDocumentServiceImpl extends AbstractCrudService<OaFbdDocumentM
             approval.setTenantId(oaFbdDocument.getTenantId());
             approval.setNodeId(oaNode.getId());
             oaApprovalMapper.insert(approval);
+
+            oaSendMessageCenter.sendAsyncMessage(
+                    oaFbdDocument.getCreateBy(),
+                    approval.getApprovalUid(),
+                    oaFbdDocument.getId(),
+                    userIds,
+                    3,
+                    oaApprovalService.getFieldInfo(oaFbdDocument.getDocNo())
+            );
         }
 
-        oaSendMessageCenter.sendAsyncMessage(
-                oaFbdDocument.getCreateBy(),
-                oaFbdDocument.getProposer(),
-                oaFbdDocument.getId(),
-                userIds,
-                3,
-                oaApprovalService.getFieldInfo(oaFbdDocument.getDocNo())
-        );
     }
 
     /**

+ 31 - 15
service-oa/service-oa-biz/src/main/java/com/usky/oa/service/utils/OaSendMessageCenter.java

@@ -10,6 +10,7 @@ import com.usky.oa.mapper.OaFormDefinitionMapper;
 import com.usky.oa.mapper.SysUserMapper;
 import com.usky.oa.service.enums.OaBuiltInDocument;
 import com.usky.system.RemoteMceService;
+import com.usky.system.domain.MceRequestVO;
 import com.usky.system.domain.SysUser;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -49,44 +50,59 @@ public class OaSendMessageCenter {
      * 异步发送消息
      *
      * @param username 提交人账号名
-     * @param submitterId 提交人id
+     * @param approvalUid 审批人userId
      * @param id 数据id
      * @param receivers 接收人userId集合
      * @param isPass 是否通过(0:不通过,1:通过)
+     * @param sign 申请单类型
      */
     @Async
-    public void sendAsyncMessage(String username, Long submitterId, Integer id, List<Long> receivers, Integer isPass, String sign) {
+    public void sendAsyncMessage(String username, Long approvalUid, Integer id, List<Long> receivers, Integer isPass, String sign) {
 
         log.info(username + "的申请开始发送消息中心-----------------------------------");
 
         LambdaQueryWrapper<SysUser> nickNameQuery = Wrappers.lambdaQuery();
         nickNameQuery.select(SysUser::getNickName)
-                .eq(SysUser::getUserId, submitterId);
-        SysUser nickName = sysUserMapper.selectOne(nickNameQuery);
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("infoTitle", INFO_TITLE);
+                .eq(SysUser::getUserId, approvalUid);
+        SysUser user = sysUserMapper.selectOne(nickNameQuery);
+
+        // JSONObject jsonObject = new JSONObject();
+        // jsonObject.put("infoTitle", INFO_TITLE);
+
+        MceRequestVO mceRequestVO = new MceRequestVO();
+        mceRequestVO.setInfoTitle(INFO_TITLE);
 
         switch (isPass) {
             case 0:
-                jsonObject.put("infoContent", nickName.getNickName() + INFO_APPROVE_FAIL);
+                // jsonObject.put("infoContent", nickName.getNickName() + INFO_APPROVE_FAIL);
+                mceRequestVO.setInfoContent(user.getNickName() + INFO_APPROVE_FAIL);
                 break;
             case 1:
-                jsonObject.put("infoContent", nickName.getNickName() + INFO_APPROVE_SUCCESS);
+                // jsonObject.put("infoContent", nickName.getNickName() + INFO_APPROVE_SUCCESS);
+                mceRequestVO.setInfoContent(user.getNickName() + INFO_APPROVE_SUCCESS);
                 break;
             default:
                 OaBuiltInDocument oaBuiltInDocument = OaBuiltInDocument.valueOf(sign);
                 String name = oaBuiltInDocument.getName();
-                jsonObject.put("infoContent", nickName.getNickName() + "的" + name + INFO_CONTENT);
+                // jsonObject.put("infoContent", username + "的" + name + INFO_CONTENT);
+                mceRequestVO.setInfoContent(username + "的" + name + INFO_CONTENT);
         }
 
-        jsonObject.put("infoType", INFO_TYPE);
-        jsonObject.put("id", id);
-        jsonObject.put("infoTypeName", INFO_TITLE);
-        jsonObject.put("userName", username);
-        jsonObject.put("userIds", receivers);
+        // jsonObject.put("infoType", INFO_TYPE);
+        // jsonObject.put("id", id);
+        // jsonObject.put("infoTypeName", INFO_TITLE);
+        // jsonObject.put("userName", username);
+        // jsonObject.put("userIds", receivers);
+
+        mceRequestVO.setInfoType(String.valueOf(INFO_TYPE));
+        mceRequestVO.setId(id);
+        mceRequestVO.setInfoTypeName(INFO_TITLE);
+        mceRequestVO.setUserName(username);
+        mceRequestVO.setUserIds(receivers);
         try {
             // 推送消息中心
-            ApiResult<Void> voidApiResult = remoteMceService.addMce(jsonObject.toString());
+            //ApiResult<Void> voidApiResult = remoteMceService.addMce(jsonObject.toString());
+            ApiResult<Void> voidApiResult = remoteMceService.addMceReceive(mceRequestVO);
 
             if (voidApiResult.isSuccess()) {
                 log.info("申请消息发送成功!");