浏览代码

BUG修复

wangliang 1 年之前
父节点
当前提交
c173f3f875

+ 2 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/TBSopInfoMapper.java

@@ -90,9 +90,10 @@ public interface TBSopInfoMapper extends BaseMapper<TBSopInfo> {
      *
      * @param crmNo
      * @param userId
+     * @param roleType
      * @return
      */
-    List<String> findFlowPassageByCrmNo(@Param("crmNo") String crmNo, @Param("userId") Long userId);
+    List<String> findFlowPassageByCrmNo(@Param("crmNo") String crmNo, @Param("userId") Long userId, @Param("roleType") String roleType);
 
     /**
      * 根据serviceId和userId查询所有sop信息

+ 19 - 8
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -86,6 +86,9 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     @Resource
     TFFlowLogService tfFlowLogService;
 
+    @Resource
+    SysUserRoleService sysUserRoleService;
+
     /**
      * 查询动态sop表名是否存在
      *
@@ -324,12 +327,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
             tbSopInfoService.saveJobRemind(map);
         }
         TFFlowApprove tfFlowApprove = (TFFlowApprove) map.get(SystemConstant.FLOW_APPROVE);
-
-        if (flowApproveParam.getApprove() != FlowApprovePassEnum.PASS && flowApproveParam.getApprove() != FlowApprovePassEnum.REJECT) {
-            tbSopInfo.setStatus(SopStatusEnum.valueOf(flowApproveParam.getApprove().name()));
-        } else if (flowApproveParam.getApprove() == FlowApprovePassEnum.PASS) {
-            tbSopInfo.setStatus(SopStatusEnum.START);
-        }
+        tbSopInfo.setStatus(tfFlowApprove.getSetup().intValue() == 1 ? SopStatusEnum.DRAFT : SopStatusEnum.START);
         tbSopInfo.updateInfo(sysUser.getId());
         tbSopInfoService.updateById(tbSopInfo);
 
@@ -1011,13 +1009,26 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     public List<String> findFlowPassageByCrmNo(String crmNo) {
         Optional.ofNullable(crmNo).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return this.baseMapper.findFlowPassageByCrmNo(crmNo, sysUser.getId());
+        List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(sysUser.getId());
+        RoleTypeEnum roleTypeEnum = null;
+        if (!CollectionUtils.isEmpty(sysRoleList)) {
+            for (SysRole sysRole : sysRoleList) {
+                if (sysRole.getType() == RoleTypeEnum.EFFECT_ENGINEER) {
+                    roleTypeEnum = sysRole.getType();
+                    break;
+                } else if (sysRole.getType() == RoleTypeEnum.ASSISTANT_ENGINEER) {
+                    roleTypeEnum = sysRole.getType();
+                }
+            }
+        }
+        return this.baseMapper.findFlowPassageByCrmNo(crmNo, sysUser.getId(), Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
     }
 
     /**
      * 根据serviceId和userId查询所有sop信息
+     * <p>
+     * ß     * @param serviceId
      *
-     * @param serviceId
      * @param userId
      * @return
      */

+ 9 - 2
sop-business/src/main/resources/mapper/TBSopInfoMapper.xml

@@ -174,12 +174,19 @@
                 join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
         <where> 1 = 1
             <if test="userId != null and userId != ''">
-                and (tbsid.engineer_user_id is not null and tbsid.engineer_user_id = #{userId})
+                <choose>
+                    <when test="roleType != null roleType != '' and roleType == 'EFFECT_ENGINEER'">
+                        and (tbsid.engineer_user_id is not null and tbsid.engineer_user_id = #{userId})
+                    </when>
+                    <otherwise>
+                        and (tbsid.assistant_engineer_user_ids is not null and FIND_IN_SET(#{userId},tbsid.assistant_engineer_user_ids))
+                    </otherwise>
+                </choose>
             </if>
             <if test="crmNo != null and crmNo != ''">
                 and tbsi.crm_no = #{crmNo}
             </if>
-                and tffa.setup > 1 and tffa.status not in('FINISH', 'END')
+                and tbsi.status = 'START' and tffa.status not in('FINISH', 'END')
         </where>
     </select>