Selaa lähdekoodia

出库发送消息提醒

3254194295 8 kuukautta sitten
vanhempi
commit
07cac7d4ec

+ 2 - 0
platform-service/src/main/java/com/platform/service/activiti/strategy/ActivitiAssignStrategyUser.java

@@ -1,6 +1,7 @@
 package com.platform.service.activiti.strategy;
 
 import com.platform.common.exception.BusinessException;
+import com.platform.common.util.RedisUtils;
 import com.platform.dao.entity.activiti.ActivitiUserModel;
 import com.platform.dao.entity.upms.SysUser;
 import com.platform.dao.enums.ActivitiUserModelTypeEnum;
@@ -56,6 +57,7 @@ public class ActivitiAssignStrategyUser implements ActivitiAssignStrategy<String
         if(sysUser == null){
             throw new BusinessException("找不到指定用户,无法设置,用户id:" + activitiUserModel.getAssignee());
         }
+        RedisUtils.set("outStoreUser",sysUser,30);
         task.setAssignee(activitiUserModel.getAssignee());
         taskService.saveTask(task);
     }

+ 16 - 0
platform-service/src/main/java/com/platform/service/business/impl/OutStoreFormActivitiServiceImpl.java

@@ -24,6 +24,7 @@ import com.platform.dao.vo.SysUserVO;
 import com.platform.dao.vo.query.customize.CustomFieldTemplateDataVO;
 import com.platform.dao.vo.query.store.OutStoreDetailVO;
 import com.platform.dao.vo.query.store.OutStoreFormVO;
+import com.platform.service.activiti.ActivitiUserModelService;
 import com.platform.service.customize.BaseFormCheckServiceAbstract;
 import com.platform.service.event.WorkplaceBacklogEvent;
 import com.platform.service.upms.SysUserDeptService;
@@ -115,6 +116,7 @@ public class OutStoreFormActivitiServiceImpl extends BaseFormCheckServiceAbstrac
      */
     private void sendMessageToManger(OutStoreForm outForm){
         SysUser sysUser = sysUserMapper.selectByPrimaryKey(outForm.getUpdateUserId());
+        log.info("发送消息给审批人:"+sysUser.getUsername());
         SysUser applyUser = sysUserMapper.selectByPrimaryKey(outForm.getCreatedUserId());
         String info = MessageTemplateUtil.getOutStoreFormSuccess(outForm.getOutNo());
         Integer detailType = WorkplaceBacklogDetailTypeEnum.OUT_STORE_NOTICE.getValue();
@@ -238,6 +240,20 @@ public class OutStoreFormActivitiServiceImpl extends BaseFormCheckServiceAbstrac
         return null;
     }
 
+    @Override
+    public void sendMessage(ActAuditRequest actAuditRequest) {
+        Object o = RedisUtils.get("outStoreUser");
+        RedisUtils.del("outStoreUser");
+        if (o instanceof SysUser){
+            OutStoreForm form = RedisUtils.get("outStoreForm");
+            form.setUpdateUserId(((SysUser) o).getUserId());
+            sendMessageToManger(form);
+        }else {
+            return;
+        }
+
+    }
+
     /**
      * 终止审批业务
      * 清空:processInstanceId

+ 2 - 0
platform-service/src/main/java/com/platform/service/customize/BaseFormCheckService.java

@@ -99,6 +99,8 @@ public interface BaseFormCheckService {
      */
     String doFinish(ActAuditRequest actAuditRequest);
 
+    void sendMessage(ActAuditRequest actAuditRequest);
+
     /**
      * 终止审核的数据更新
      * @param actAuditRequest

+ 11 - 0
platform-service/src/main/java/com/platform/service/customize/BaseFormCheckServiceAbstract.java

@@ -11,16 +11,19 @@ import com.platform.common.exception.BusinessException;
 import com.platform.common.model.UserInfo;
 import com.platform.common.util.IdGeneratorUtils;
 import com.platform.common.util.JsonUtils;
+import com.platform.common.util.RedisUtils;
 import com.platform.common.util.SecurityUtils;
 import com.platform.dao.dto.activiti.SbAllocateFormActiviti;
 import com.platform.dao.entity.activiti.ActivitiUserModel;
 import com.platform.dao.entity.activiti.LocalAuditRecord;
 import com.platform.dao.entity.customize.CustomFieldTemplateData;
+import com.platform.dao.entity.store.OutStoreForm;
 import com.platform.dao.entity.upms.SysUser;
 import com.platform.dao.enums.ActivitiFormStatusEnum;
 import com.platform.dao.mapper.activiti.LocalAuditRecordMapper;
 import com.platform.dao.mapper.customize.CustomFieldTemplateDataMapper;
 import com.platform.dao.mapper.sb.SbInfoMapper;
+import com.platform.dao.mapper.store.OutStoreFormMapper;
 import com.platform.service.activiti.ActivitiAssignStrategy;
 import com.platform.service.activiti.ActivitiUserModelService;
 import com.platform.service.upms.SysUserService;
@@ -58,6 +61,8 @@ public abstract class BaseFormCheckServiceAbstract implements BaseFormCheckServi
     private LocalAuditRecordMapper localAuditRecordMapper;
     @Autowired
     private ActivitiUserModelService activitiUserModelService;
+    @Autowired
+    private OutStoreFormMapper outStoreFormMapper;
     /**
      * 通过spring获取所有策略类
      */
@@ -182,6 +187,12 @@ public abstract class BaseFormCheckServiceAbstract implements BaseFormCheckServi
                 Task nextTask = taskService.createTaskQuery().processInstanceId(actAuditRequest.getProcessInstanceId()).orderByTaskCreateTime().desc().singleResult();
                 insertNecessaryValue(maps, actAuditRequest.getId());
                 modifyTaskAssign(model.getId(), maps, nextTask, list);
+                OutStoreForm form = outStoreFormMapper.selectByPrimaryKey(actAuditRequest.getId());
+                if (form!=null){
+                    RedisUtils.set("outStoreForm",form,30);
+                    sendMessage(actAuditRequest);
+                }
+
             } else {
                 doFinish(actAuditRequest);
             }

+ 6 - 4
platform-service/src/main/java/com/platform/service/customize/impl/SbAllocateCheckServiceImpl.java

@@ -4,10 +4,7 @@ import com.platform.activiti.dao.entity.ActAuditRequest;
 import com.platform.common.bean.AbstractPageResultBean;
 import com.platform.common.constant.CommonConstants;
 import com.platform.common.exception.DeniedException;
-import com.platform.common.util.IdGeneratorUtils;
-import com.platform.common.util.JsonUtils;
-import com.platform.common.util.SecurityUtils;
-import com.platform.common.util.StringUtils;
+import com.platform.common.util.*;
 import com.platform.dao.dto.activiti.SbAllocateFormActiviti;
 import com.platform.dao.dto.upms.SysUserDeptDTO;
 import com.platform.dao.entity.activiti.ActivitiUserModel;
@@ -75,6 +72,11 @@ public class SbAllocateCheckServiceImpl extends BaseFormCheckServiceAbstract {
         return null;
     }
 
+    @Override
+    public void sendMessage(ActAuditRequest actAuditRequest) {
+        RedisUtils.del("outStoreUser");
+    }
+
     @Override
     public String doStop(ActAuditRequest actAuditRequest) {
         return super.doStop(actAuditRequest);

+ 6 - 0
platform-service/src/main/java/com/platform/service/customize/impl/SbScrapCheckServiceImpl.java

@@ -7,6 +7,7 @@ import com.platform.common.exception.BusinessException;
 import com.platform.common.exception.DeniedException;
 import com.platform.common.util.IdGeneratorUtils;
 import com.platform.common.util.JsonUtils;
+import com.platform.common.util.RedisUtils;
 import com.platform.common.util.SecurityUtils;
 import com.platform.dao.dto.activiti.SbScrapFormActiviti;
 import com.platform.dao.entity.activiti.ActivitiUserModel;
@@ -150,6 +151,11 @@ public class SbScrapCheckServiceImpl extends BaseFormCheckServiceAbstract {
         return sbId;
     }
 
+    @Override
+    public void sendMessage(ActAuditRequest actAuditRequest) {
+        RedisUtils.del("outStoreUser");
+    }
+
     /**
      * 终止业务
      *

+ 6 - 0
platform-service/src/main/java/com/platform/service/customize/impl/SbStopCheckServiceImpl.java

@@ -7,6 +7,7 @@ import com.platform.common.exception.BusinessException;
 import com.platform.common.exception.DeniedException;
 import com.platform.common.util.IdGeneratorUtils;
 import com.platform.common.util.JsonUtils;
+import com.platform.common.util.RedisUtils;
 import com.platform.common.util.SecurityUtils;
 import com.platform.dao.dto.activiti.SbStopFormActiviti;
 import com.platform.dao.entity.activiti.ActivitiUserModel;
@@ -126,6 +127,11 @@ public class SbStopCheckServiceImpl extends BaseFormCheckServiceAbstract {
         return sbId;
     }
 
+    @Override
+    public void sendMessage(ActAuditRequest actAuditRequest) {
+        RedisUtils.del("outStoreUser");
+    }
+
     @Override
     public String doStop(ActAuditRequest actAuditRequest) {
         String sbId = super.doStop(actAuditRequest);