Ver código fonte

物资-领用和退回流程调整并抄送仓管

huangguoce 3 semanas atrás
pai
commit
a751baa2d4

+ 60 - 1
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/collect/service/PsiCollectService.java

@@ -235,7 +235,7 @@ public class PsiCollectService {
                         psiCollectDetailedRecordMapper.updateById(psiCollectDetailedRecord);
                         //如果全部退回,删除对应领用数据
                         if((backNum + ybackNum) == collectNumber){
-                            //psiDetailedMapper.delete(new LambdaQueryWrapper<PsiCollectDetailed>().eq(PsiCollectDetailed::getId,detailInfo.getDetailId()));
+                            psiDetailedMapper.delete(new LambdaQueryWrapper<PsiCollectDetailed>().eq(PsiCollectDetailed::getId,detailInfo.getDetailId()));
                         }
 
                         updateList.add(psiWareHouseDetailed);
@@ -254,6 +254,36 @@ public class PsiCollectService {
         // 修改退回流程的状态
         psiDetailedMapper.updateStatusByIdReturn(collectBasicsReturn.getId(), dto.getStatusReturn());
         // 删除退回关联附件
+        if(StringUtils.isNotBlank(dto.getStatusReturn()) && dto.getStatusReturn().equals("5")){
+            UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken ( ));
+            // 通过审批,抄送至仓库管理员
+            Map<String, String> keyMap = new HashMap<>();
+            keyMap.put("name", "仓库管理员");
+            keyMap.put("tenantId", "10009");
+            List<RoleDTO> roleDTO = SpringUtil.getBean(IRoleApi.class).getRoleDTOByNameAndTenantId(keyMap);
+            RoleDTO role = roleDTO.get(0);
+            List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(role.getId());
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+            String day = format.format(new Date());
+            String title = "[领用编号:"+dto.getCollectNo()+"]-领用退回申请审批通过";
+            //向用户发起通知
+            if (null != notifiedPartyUsers) {
+                for (UserDTO userDTO1 : notifiedPartyUsers) {
+                    //发送通知
+                    Map<String ,String > map = new HashMap<>();
+                    map.put("taskId",dto.getProcInsIdReturn());
+                    map.put("title",title);
+                    map.put("defId",dto.getProcessDefinitionIdReturn());
+                    map.put("taskName","领用退回申请审批通过");
+                    map.put("createUser","管理员");
+                    map.put("createTime",day);
+                    map.put("noticeName",userDTO1.getLoginName());
+                    map.put("noticeId",userDTO1.getId());
+                    map.put("createById",userDTO.getId());
+                    flowTaskService.add(map);
+                }
+            }
+        }
 //        ossService.remove(new LambdaQueryWrapper<WorkAttachment>().eq(WorkAttachment::getAttachmentId, collectBasicsReturn.getId()));
         SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(collectBasicsReturn.getId());
         if (ObjectUtil.isNotEmpty(collectBasicsReturn)) {
@@ -446,6 +476,35 @@ public class PsiCollectService {
                 }
 
 
+                if(StringUtils.isNotBlank(dto.getStatus()) && dto.getStatus().equals("5")){
+                    //审核通过抄送仓库管理员
+                        Map<String, String> keyMap = new HashMap<>();
+                        keyMap.put("name", "仓库管理员");
+                        keyMap.put("tenantId", "10009");
+                        List<RoleDTO> roleDTO = SpringUtil.getBean(IRoleApi.class).getRoleDTOByNameAndTenantId(keyMap);
+                        RoleDTO role = roleDTO.get(0);
+                        List<UserDTO> notifiedPartyUsers =SpringUtil.getBean(IUserApi.class).findListByRoleId(role.getId());
+                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+                        String day = format.format(new Date());
+                        String title = "[领用编号:"+dto.getCollectNo()+"]-领用申请审批通过";
+                        //向用户发起通知
+                        if (null != notifiedPartyUsers) {
+                            for (UserDTO userDTO1 : notifiedPartyUsers) {
+                                //发送通知
+                                Map<String ,String > map = new HashMap<>();
+                                map.put("taskId",dto.getProcInsId());
+                                map.put("title",title);
+                                map.put("defId",dto.getProcessDefinitionId());
+                                map.put("taskName","领用申请审批通过");
+                                map.put("createUser","管理员");
+                                map.put("createTime",day);
+                                map.put("noticeName",userDTO1.getLoginName());
+                                map.put("noticeId",userDTO1.getId());
+                                map.put("createById",userDTO.getId());
+                                flowTaskService.add(map);
+                        }
+                    }
+                }
                 //发起提醒操作
                 if (CollectionUtil.isNotEmpty(warnInfoList)) {
                     String warnInfo = String.join("、", warnInfoList);