Browse Source

BUG修复

wangliang 1 năm trước cách đây
mục cha
commit
15dacdacb9

+ 18 - 9
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -327,7 +327,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             tbSopInfoService.saveJobRemind(map);
         }
         TFFlowApprove tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.FLOW_APPROVE);
-        tbSopInfo.setStatus(tfFlowApprove.getSetup().intValue() == 1 ? SopStatusEnum.DRAFT : SopStatusEnum.START);
+        tbSopInfo.setStatus(tfFlowApprove.getSetup().intValue() == 1 && tfFlowApprove.getStatus() == FlowStatusEnum.DRAFT ? SopStatusEnum.DRAFT : SopStatusEnum.START);
         tbSopInfo.updateInfo(sysUser.getId());
         tbSopInfoService.updateById(tbSopInfo);
 
@@ -426,17 +426,27 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             String regionUserId = (String) m.get("region_user_id_1");
             String engineerUserId = (String) m.get("engineer_user_id_1");
             String assistantEngineerUserId = (String) m.get("assistant_engineer_user_id_1");
+            List<Long> userIdList = new ArrayList<>(3);
+            Map<Long, String> map = new HashMap<>(3);
             if (Objects.nonNull(regionUserId)) {
-                SysUser user = sysUserService.getById(regionUserId);
-                m.put("region_user_id_1", user.getRealName());
+                userIdList.add(Long.parseLong(regionUserId));
+                map.put(Long.parseLong(regionUserId), "region_user_id_1");
             }
             if (Objects.nonNull(engineerUserId)) {
-                SysUser user = sysUserService.getById(engineerUserId);
-                m.put("engineer_user_id_1", user.getRealName());
+                userIdList.add(Long.parseLong(engineerUserId));
+                map.put(Long.parseLong(engineerUserId), "engineer_user_id_1");
             }
             if (Objects.nonNull(assistantEngineerUserId)) {
-                SysUser user = sysUserService.getById(assistantEngineerUserId);
-                m.put("assistant_engineer_user_id_1", user.getRealName());
+                userIdList.add(Long.parseLong(assistantEngineerUserId));
+                map.put(Long.parseLong(assistantEngineerUserId), "assistant_engineer_user_id_1");
+            }
+            if (!CollectionUtils.isEmpty(userIdList)) {
+                List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
+                for (SysUser s : sysUsers) {
+                    if (map.containsKey(s.getId())) {
+                        m.put(map.get(s.getId()), s.getRealName());
+                    }
+                }
             }
 
             String taskIds = (String) m.get("taskId");
@@ -1026,9 +1036,8 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
 
     /**
      * 根据serviceId和userId查询所有sop信息
-     * <p>
-     * ß     * @param serviceId
      *
+     * @param serviceId
      * @param userId
      * @return
      */