Преглед на файлове

fix:sop执行时用户身份类型更改

caozixuan преди 1 година
родител
ревизия
347844cee0
променени са 15 файла, в които са добавени 188 реда и са изтрити 103 реда
  1. 15 2
      sop-business/src/main/java/com/qmth/sop/business/entity/SysDingObj.java
  2. 15 3
      sop-business/src/main/java/com/qmth/sop/business/entity/TBDing.java
  3. 19 30
      sop-business/src/main/java/com/qmth/sop/business/entity/TBUserArchivesAllocation.java
  4. 0 9
      sop-business/src/main/java/com/qmth/sop/business/service/SysRoleService.java
  5. 12 2
      sop-business/src/main/java/com/qmth/sop/business/service/TBUserArchivesAllocationService.java
  6. 4 18
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SysRoleServiceImpl.java
  7. 0 1
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SysUserServiceImpl.java
  8. 24 24
      sop-business/src/main/java/com/qmth/sop/business/service/impl/TBCrmServiceImpl.java
  9. 6 2
      sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java
  10. 5 4
      sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingServiceImpl.java
  11. 0 1
      sop-business/src/main/java/com/qmth/sop/business/service/impl/TBServiceServiceImpl.java
  12. 16 5
      sop-business/src/main/java/com/qmth/sop/business/service/impl/TBUserArchivesAllocationServiceImpl.java
  13. 0 1
      sop-business/src/main/java/com/qmth/sop/business/templete/service/impl/TaskLogicServiceImpl.java
  14. 39 1
      sop-business/src/main/resources/db/log/caozixuan_update_log.sql
  15. 33 0
      sop-common/src/main/java/com/qmth/sop/common/enums/SopRoleTypeEnum.java

+ 15 - 2
sop-business/src/main/java/com/qmth/sop/business/entity/SysDingObj.java

@@ -3,10 +3,10 @@ package com.qmth.sop.business.entity;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.enums.DingObjTypeEnum;
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
-import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
@@ -32,11 +32,16 @@ public class SysDingObj implements Serializable {
     @NotNull(message = "考勤组id不能为空")
     private Long dingGroupId;
 
+    // TODO: 2024/5/15 考勤组针对sop角色考核打卡-czx
     @ApiModelProperty(value = "角色id")
     @JsonSerialize(using = ToStringSerializer.class)
-    @NotNull(message = "角色id不能为空")
     private Long roleId;
 
+    @ApiModelProperty(value = "角色id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "角色类型不能为空")
+    private SopRoleTypeEnum sopRoleType;
+
     @ApiModelProperty(value = "类型,DING:考勤,APPROVE:审核")
     @NotNull(message = "类型不能为空")
     private DingObjTypeEnum type;
@@ -65,6 +70,14 @@ public class SysDingObj implements Serializable {
         this.roleId = roleId;
     }
 
+    public SopRoleTypeEnum getSopRoleType() {
+        return sopRoleType;
+    }
+
+    public void setSopRoleType(SopRoleTypeEnum sopRoleType) {
+        this.sopRoleType = sopRoleType;
+    }
+
     public DingObjTypeEnum getType() {
         return type;
     }

+ 15 - 3
sop-business/src/main/java/com/qmth/sop/business/entity/TBDing.java

@@ -6,6 +6,7 @@ import com.qmth.sop.common.base.BaseEntity;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.DingDateTypeEnum;
 import com.qmth.sop.common.enums.RoleTypeEnum;
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -41,9 +42,12 @@ public class TBDing extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long userArchivesId;
 
-    @ApiModelProperty("角色类型")
+    @ApiModelProperty("sop角色类型")
     private RoleTypeEnum roleType;
 
+    @ApiModelProperty("sop角色类型")
+    private SopRoleTypeEnum sopRoleType;
+
     @ApiModelProperty(value = "用户id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long userId;
@@ -99,14 +103,14 @@ public class TBDing extends BaseEntity implements Serializable {
 
     }
 
-    public TBDing(String sopNo, String crmNo, Long serviceId, Long userArchivesId, RoleTypeEnum roleType, Long userId, Long flowId) {
+    public TBDing(String sopNo, String crmNo, Long serviceId, Long userArchivesId, SopRoleTypeEnum sopRoleType, Long userId, Long flowId) {
         setId(SystemConstant.getDbUuid());
         this.sopNo = sopNo;
         this.dingSopNo = sopNo;
         this.crmNo = crmNo;
         this.serviceId = serviceId;
         this.userArchivesId = userArchivesId;
-        this.roleType = roleType;
+        this.sopRoleType = sopRoleType;
         this.userId = userId;
         this.flowId = flowId;
         setCreateId(userId);
@@ -161,6 +165,14 @@ public class TBDing extends BaseEntity implements Serializable {
         this.roleType = roleType;
     }
 
+    public SopRoleTypeEnum getSopRoleType() {
+        return sopRoleType;
+    }
+
+    public void setSopRoleType(SopRoleTypeEnum sopRoleType) {
+        this.sopRoleType = sopRoleType;
+    }
+
     public Long getUserId() {
         return userId;
     }

+ 19 - 30
sop-business/src/main/java/com/qmth/sop/business/entity/TBUserArchivesAllocation.java

@@ -2,6 +2,7 @@ package com.qmth.sop.business.entity;
 
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -24,28 +25,24 @@ public class TBUserArchivesAllocation implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
 
+    @ApiModelProperty(value = "派单明细id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long crmDetailId;
+
     @ApiModelProperty(value = "服务单元id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long serviceId;
 
-    @ApiModelProperty(value = "sop单号")
-    private String sopNo;
-
     @ApiModelProperty(value = "crm单号")
     private String crmNo;
 
-    @ApiModelProperty(value = "区域协调人id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long regionUserId;
+    @ApiModelProperty(value = "sop角色类型")
+    private SopRoleTypeEnum sopRoleType;
 
     @ApiModelProperty(value = "工程师id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long userId;
 
-    @ApiModelProperty(value = "角色id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long roleId;
-
     @ApiModelProperty(value = "人员档案id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long archivesId;
@@ -58,20 +55,20 @@ public class TBUserArchivesAllocation implements Serializable {
         this.id = id;
     }
 
-    public Long getServiceId() {
-        return serviceId;
+    public Long getCrmDetailId() {
+        return crmDetailId;
     }
 
-    public void setServiceId(Long serviceId) {
-        this.serviceId = serviceId;
+    public void setCrmDetailId(Long crmDetailId) {
+        this.crmDetailId = crmDetailId;
     }
 
-    public String getSopNo() {
-        return sopNo;
+    public Long getServiceId() {
+        return serviceId;
     }
 
-    public void setSopNo(String sopNo) {
-        this.sopNo = sopNo;
+    public void setServiceId(Long serviceId) {
+        this.serviceId = serviceId;
     }
 
     public String getCrmNo() {
@@ -82,12 +79,12 @@ public class TBUserArchivesAllocation implements Serializable {
         this.crmNo = crmNo;
     }
 
-    public Long getRegionUserId() {
-        return regionUserId;
+    public SopRoleTypeEnum getSopRoleType() {
+        return sopRoleType;
     }
 
-    public void setRegionUserId(Long regionUserId) {
-        this.regionUserId = regionUserId;
+    public void setSopRoleType(SopRoleTypeEnum sopRoleType) {
+        this.sopRoleType = sopRoleType;
     }
 
     public Long getUserId() {
@@ -98,14 +95,6 @@ public class TBUserArchivesAllocation implements Serializable {
         this.userId = userId;
     }
 
-    public Long getRoleId() {
-        return roleId;
-    }
-
-    public void setRoleId(Long roleId) {
-        this.roleId = roleId;
-    }
-
     public Long getArchivesId() {
         return archivesId;
     }

+ 0 - 9
sop-business/src/main/java/com/qmth/sop/business/service/SysRoleService.java

@@ -64,13 +64,4 @@ public interface SysRoleService extends IService<SysRole> {
      * @return 角色
      */
     RoleResult findRoleInfoByArchivesType(RoleTypeEnum roleTypeEnum);
-
-    /**
-     * 查询用户在某派单中执行的工程师
-     *
-     * @param userId 用户id
-     * @param crmNo  派单号
-     * @return 角色
-     */
-    RoleTypeEnum findRoleTypeByUserCrm(Long userId, String crmNo);
 }

+ 12 - 2
sop-business/src/main/java/com/qmth/sop/business/service/TBUserArchivesAllocationService.java

@@ -8,6 +8,7 @@ import com.qmth.sop.business.bean.result.CrmArchivesAllocationResult;
 import com.qmth.sop.business.bean.result.UserArchivesAllocationResult;
 import com.qmth.sop.business.bean.result.UserArchivesAllocationSubTotalResult;
 import com.qmth.sop.business.entity.TBUserArchivesAllocation;
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
 
 import java.util.List;
 
@@ -49,7 +50,8 @@ public interface TBUserArchivesAllocationService extends IService<TBUserArchives
      * @param regionId      大区id
      * @return 小计结果
      */
-    UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, String province, String city, String area, String customName, Integer gap, Long regionId);
+    UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, String province, String city,
+            String area, String customName, Integer gap, Long regionId);
 
     /**
      * 分配派单
@@ -58,7 +60,6 @@ public interface TBUserArchivesAllocationService extends IService<TBUserArchives
      */
     void editCrmAllocation(UserArchivesAllocationParam userArchivesAllocationParam);
 
-
     /**
      * 根据派单号查询派单分配信息
      *
@@ -87,4 +88,13 @@ public interface TBUserArchivesAllocationService extends IService<TBUserArchives
      * @param crmNo crmNo
      */
     void unPublishSop(String crmNo);
+
+    /**
+     * 查询用户在某派单中执行的工程师
+     *
+     * @param userId 用户id
+     * @param crmNo  派单号
+     * @return 角色
+     */
+    SopRoleTypeEnum findRoleTypeByUserCrm(Long userId, String crmNo);
 }

+ 4 - 18
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysRoleServiceImpl.java

@@ -8,7 +8,10 @@ import com.qmth.sop.business.bean.dto.RoleDto;
 import com.qmth.sop.business.bean.params.SysRolePrivilegeParam;
 import com.qmth.sop.business.bean.result.RoleResult;
 import com.qmth.sop.business.cache.CommonCacheService;
-import com.qmth.sop.business.entity.*;
+import com.qmth.sop.business.entity.SysRole;
+import com.qmth.sop.business.entity.SysRolePrivilege;
+import com.qmth.sop.business.entity.SysUser;
+import com.qmth.sop.business.entity.SysUserRole;
 import com.qmth.sop.business.mapper.SysRoleMapper;
 import com.qmth.sop.business.service.*;
 import com.qmth.sop.common.enums.ExceptionResultEnum;
@@ -182,21 +185,4 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         }
         return result;
     }
-
-    @Override
-    public RoleTypeEnum findRoleTypeByUserCrm(Long userId, String crmNo) {
-        RoleTypeEnum result = null;
-        List<TBUserArchivesAllocation> tbUserArchivesAllocationList = tbUserArchivesAllocationService.list(new QueryWrapper<TBUserArchivesAllocation>().lambda()
-                .eq(TBUserArchivesAllocation::getUserId, userId)
-                .eq(TBUserArchivesAllocation::getCrmNo, crmNo));
-        if (!CollectionUtils.isEmpty(tbUserArchivesAllocationList)) {
-            TBUserArchivesAllocation tbUserArchivesAllocation = tbUserArchivesAllocationList.get(0);
-            Long roleId = tbUserArchivesAllocation.getRoleId();
-            SysRole role = this.getById(roleId);
-            if (Objects.nonNull(role)) {
-                result = role.getType();
-            }
-        }
-        return result;
-    }
 }

+ 0 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysUserServiceImpl.java

@@ -631,7 +631,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             rtzfUserInfo.setCompanyName(companyName);
         }
         rtzfUserInfo.setPhoneNo(willUpdateUser.getMobileNumber());
-        // TODO: 2023/11/27 密码要解密再加密
         String password = willUpdateUser.getPassword();
         rtzfUserInfo.setPassword(password);
         rtzfUserInfo.setVerifyPassword(password);

+ 24 - 24
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBCrmServiceImpl.java

@@ -300,30 +300,30 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
 
             RoleResult effectRole = sysRoleService.findRoleInfoByArchivesType(RoleTypeEnum.EFFECT_ENGINEER);
             Long effectRoleId = effectRole.getRoleId();
-
-            List<UserArchivesDto> effectEngineerList = archivesAllocationList.stream()
-                    .filter(e -> effectRoleId.equals(e.getRoleId())).flatMap(e -> {
-                        UserArchivesDto dto = new UserArchivesDto();
-                        Long userArchivesId = e.getArchivesId();
-                        dto.setUserArchivesId(userArchivesId);
-                        dto.setUserId(e.getUserId());
-                        dto.setName(tbUserArchivesService.getById(userArchivesId).getName());
-                        return Stream.of(dto);
-                    }).collect(Collectors.toList());
-
-            RoleResult assistant = sysRoleService.findRoleInfoByArchivesType(RoleTypeEnum.ASSISTANT_ENGINEER);
-            Long assistantRoleId = assistant.getRoleId();
-            List<UserArchivesDto> assistantEngineerList = archivesAllocationList.stream()
-                    .filter(e -> assistantRoleId.equals(e.getRoleId())).flatMap(e -> {
-                        UserArchivesDto dto = new UserArchivesDto();
-                        Long userArchivesId = e.getArchivesId();
-                        dto.setUserArchivesId(userArchivesId);
-                        dto.setUserId(e.getUserId());
-                        dto.setName(tbUserArchivesService.getById(userArchivesId).getName());
-                        return Stream.of(dto);
-                    }).collect(Collectors.toList());
-            crmProjectResult.setEffectEngineerList(effectEngineerList);
-            crmProjectResult.setAssistantEngineerList(assistantEngineerList);
+            // TODO: 2024/5/14 查询派单分配信息修改 -czx 
+//            List<UserArchivesDto> effectEngineerList = archivesAllocationList.stream()
+//                    .filter(e -> effectRoleId.equals(e.getRoleId())).flatMap(e -> {
+//                        UserArchivesDto dto = new UserArchivesDto();
+//                        Long userArchivesId = e.getArchivesId();
+//                        dto.setUserArchivesId(userArchivesId);
+//                        dto.setUserId(e.getUserId());
+//                        dto.setName(tbUserArchivesService.getById(userArchivesId).getName());
+//                        return Stream.of(dto);
+//                    }).collect(Collectors.toList());
+//
+//            RoleResult assistant = sysRoleService.findRoleInfoByArchivesType(RoleTypeEnum.ASSISTANT_ENGINEER);
+//            Long assistantRoleId = assistant.getRoleId();
+//            List<UserArchivesDto> assistantEngineerList = archivesAllocationList.stream()
+//                    .filter(e -> assistantRoleId.equals(e.getRoleId())).flatMap(e -> {
+//                        UserArchivesDto dto = new UserArchivesDto();
+//                        Long userArchivesId = e.getArchivesId();
+//                        dto.setUserArchivesId(userArchivesId);
+//                        dto.setUserId(e.getUserId());
+//                        dto.setName(tbUserArchivesService.getById(userArchivesId).getName());
+//                        return Stream.of(dto);
+//                    }).collect(Collectors.toList());
+//            crmProjectResult.setEffectEngineerList(effectEngineerList);
+//            crmProjectResult.setAssistantEngineerList(assistantEngineerList);
             result = crmProjectResult;
         }
         return result;

+ 6 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -79,6 +79,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Resource
     TFFlowLogService tfFlowLogService;
 
+    @Resource
+    TBUserArchivesAllocationService tbUserArchivesAllocationService;
+
     /**
      * 新增考勤异常补卡申请
      *
@@ -340,8 +343,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                 TBUserArchives tbUserArchives = tbUserArchivesService.getOne(new QueryWrapper<TBUserArchives>().lambda()
                         .eq(TBUserArchives::getMobileNumber, sysUser.getMobileNumber()));
                 tbDing = new TBDing(tbDingApply.getSopNo(), tbDingApply.getCrmNo(), tbCrm.getServiceId(),
-                        tbUserArchives.getId(), sysRoleList.get(0).getType(), sysUser.getId(),
-                        tfCustomFlowEntity.getFlowId());
+                        tbUserArchives.getId(),
+                        tbUserArchivesAllocationService.findRoleTypeByUserCrm(sysUser.getId(), tbCrm.getCrmNo()),
+                        sysUser.getId(), tfCustomFlowEntity.getFlowId());
                 tbDing.setSignDate(
                         DateFormatUtils.format(tbDingApply.getApplyTime(), SystemConstant.DEFAULT_DATE_DAY_PATTERN));
                 tbDing.setSignYear(

+ 5 - 4
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingServiceImpl.java

@@ -70,6 +70,8 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
     private TBSopInfoService tbSopInfoService;
     @Resource
     private TBServiceService tbServiceService;
+    @Resource
+    private TBUserArchivesAllocationService tbUserArchivesAllocationService;
 
     @Override
     public DingElementResult findDingElements(String sopNo, Long userId) {
@@ -338,7 +340,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
         String crmNo = sopCrmInfo.getCrmNo();
         Long serviceId = sopCrmInfo.getServiceUnitId();
         Long flowId = sopCrmInfo.getFlowId();
-        RoleTypeEnum roleType = sysRoleService.findRoleTypeByUserCrm(userId, crmNo);
+        SopRoleTypeEnum roleType = tbUserArchivesAllocationService.findRoleTypeByUserCrm(userId, crmNo);
         String signDate = DateFormatUtils.format(signTime, SystemConstant.DEFAULT_DATE_DAY_PATTERN);
         String signYear = DateFormatUtils.format(signTime, SystemConstant.DEFAULT_DATE_YEAR_PATTERN);
         String currentDayStr = DateFormatUtils.format(System.currentTimeMillis(), SystemConstant.DEFAULT_DATE_DAY_PATTERN);
@@ -380,7 +382,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
             tbDing.setCrmNo(crmNo);
             tbDing.setServiceId(serviceId);
             tbDing.setUserArchivesId(userArchivesId);
-            tbDing.setRoleType(roleType);
+            tbDing.setSopRoleType(roleType);
             tbDing.setUserId(userId);
             tbDing.setFlowId(flowId);
             tbDing.setSignDate(signDate);
@@ -591,7 +593,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
 
     @Override
     public int findRemainCount(Long userId, String sopNo) {
-        // TODO: 2023/11/8 查明为什么会有sop找不到对应的派单 (脏数据)
         SopCrmInfo sopCrmInfo = tbCrmService.findSopCrmInfoBySop(sopNo);
         if (Objects.isNull(sopCrmInfo)) {
             return 0;
@@ -668,7 +669,7 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                         addDing.setServiceId(tbCrm.getServiceId());
                         addDing.setUserId(userId);
                         addDing.setUserArchivesId(tbUserArchivesService.findByUserId(userId).getId());
-                        addDing.setRoleType(sysRoleService.findRoleTypeByUserCrm(userId, crmNo));
+                        addDing.setSopRoleType(tbUserArchivesAllocationService.findRoleTypeByUserCrm(userId, crmNo));
                         addDing.setFlowId(sopCrmInfo.getFlowId());
                         addDing.setSignYear(signYear);
                         addDing.setSignDate(signDay);

+ 0 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBServiceServiceImpl.java

@@ -142,7 +142,6 @@ public class TBServiceServiceImpl extends ServiceImpl<TBServiceMapper, TBService
         if (!ServiceStatusEnum.NEW.equals(status) && !ServiceStatusEnum.FINISH.equals(status)) {
             throw ExceptionResultEnum.ERROR.exception(String.format("只有[%s]状态的服务单元可以被发布,当前状态[%s]", ServiceStatusEnum.NEW.getTitle() + "或" + ServiceStatusEnum.FINISH.getTitle(), status.getTitle()));
         }
-        // TODO: 2023/8/8 业务校验 服务单元完成了相关准备工作:服务范围划定、供应商划定
         List<SysDingGroup> sysDingGroupList = sysDingGroupService.list(new QueryWrapper<SysDingGroup>().lambda().eq(SysDingGroup::getServiceId,serviceUnitId));
         if (CollectionUtils.isEmpty(sysDingGroupList)){
             throw ExceptionResultEnum.ERROR.exception("未完成考勤组设置的服务单元不能发布");

+ 16 - 5
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBUserArchivesAllocationServiceImpl.java

@@ -130,9 +130,9 @@ public class TBUserArchivesAllocationServiceImpl extends ServiceImpl<TBUserArchi
                 .lambda()
                 .eq(TBUserArchivesAllocation::getCrmNo, crmNo));
 
-        if (dbList.stream().anyMatch(e -> Objects.nonNull(e.getSopNo()))) {
-            throw ExceptionResultEnum.ERROR.exception("已发布的派单不能调配");
-        }
+//        if (dbList.stream().anyMatch(e -> Objects.nonNull(e.getSopNo()))) {
+//            throw ExceptionResultEnum.ERROR.exception("已发布的派单不能调配");
+//        }
 
         // 新增关系
         List<AllocationParam> allocationParamList = userArchivesAllocationParam.getAllocationParams();
@@ -177,8 +177,6 @@ public class TBUserArchivesAllocationServiceImpl extends ServiceImpl<TBUserArchi
                     tbUserArchivesAllocation.setArchivesId(tbUserArchives.getId());
                     tbUserArchivesAllocation.setServiceId(serviceUnitId);
                     tbUserArchivesAllocation.setUserId(userId);
-                    tbUserArchivesAllocation.setRoleId(roleId);
-                    tbUserArchivesAllocation.setRegionUserId(regionUserId);
                     tbUserArchivesAllocationList.add(tbUserArchivesAllocation);
                 }
             }
@@ -504,6 +502,19 @@ public class TBUserArchivesAllocationServiceImpl extends ServiceImpl<TBUserArchi
         activitiService.flowEnd(crmNo);
     }
 
+    @Override
+    public SopRoleTypeEnum findRoleTypeByUserCrm(Long userId, String crmNo) {
+        SopRoleTypeEnum result = null;
+        List<TBUserArchivesAllocation> tbUserArchivesAllocationList = this.list(new QueryWrapper<TBUserArchivesAllocation>().lambda()
+                .eq(TBUserArchivesAllocation::getUserId, userId)
+                .eq(TBUserArchivesAllocation::getCrmNo, crmNo));
+        if (!org.springframework.util.CollectionUtils.isEmpty(tbUserArchivesAllocationList)) {
+            TBUserArchivesAllocation tbUserArchivesAllocation = tbUserArchivesAllocationList.get(0);
+            result = tbUserArchivesAllocation.getSopRoleType();
+        }
+        return result;
+    }
+
     /**
      * 处理临时新增的分配名单
      *

+ 0 - 1
sop-business/src/main/java/com/qmth/sop/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -587,7 +587,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 rtzfUserInfo.setCompanyName(companyName);
             }
             rtzfUserInfo.setPhoneNo(e.getMobileNumber());
-            // TODO: 2023/11/27 密码要解密再加密
             String password = e.getPassword();
             rtzfUserInfo.setPassword(password);
             rtzfUserInfo.setVerifyPassword(password);

+ 39 - 1
sop-business/src/main/resources/db/log/caozixuan_update_log.sql

@@ -1,3 +1,41 @@
---caozixuan
+-- 2024-05-13
 ALTER TABLE t_b_crm
     ADD COLUMN lead_type VARCHAR(45) NULL COMMENT '大区经理指定类型(BY_PERSON(\"按人员指定\"), BY_AREA(\"按地区指定\");)' AFTER lead_id;
+
+-- 2024-05-14
+ALTER TABLE t_b_user_archives_allocation
+    DROP COLUMN role_id,
+    DROP COLUMN region_user_id,
+    DROP COLUMN sop_no,
+    ADD COLUMN crm_detail_id BIGINT NOT NULL COMMENT '派单详情表id' AFTER id,
+    ADD COLUMN sop_role_type VARCHAR(45) NOT NULL COMMENT 'sop角色类型\nREGION_COORDINATOR(\"区域协调人\"),PROJECT_MANAGER(\"项目经理\"),ENGINEER(\"工程师\");' AFTER crm_no,
+    CHANGE COLUMN service_id service_id BIGINT NOT NULL COMMENT '服务单元id' ,
+    CHANGE COLUMN user_id user_id BIGINT NOT NULL COMMENT '用户id' ;
+ALTER TABLE t_b_user_archives_allocation
+    DROP INDEX t_b_user_archives_allocation_un ,
+    ADD UNIQUE INDEX t_b_user_archives_allocation_un (crm_detail_id ASC, sop_role_type ASC, archives_id ASC) VISIBLE;
+;
+
+CREATE TABLE t_b_user_archives_allocation_log (
+    id bigint NOT NULL COMMENT '主键',
+    crm_detail_id bigint NOT NULL COMMENT '派单详情表id',
+    sop_role_type varchar(45) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'sop角色类型\nREGION_COORDINATOR("区域协调人"),PROJECT_MANAGER("项目经理"),ENGINEER("工程师");',
+    user_id bigint NOT NULL COMMENT '用户id',
+    archives_id bigint NOT NULL COMMENT '人员档案id',
+    archives_name varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '档案名称',
+    supplier_name varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '供应商名称',
+    city varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '城市',
+    create_id bigint DEFAULT NULL COMMENT '创建人',
+    create_time bigint DEFAULT NULL COMMENT '创建时间',
+    update_id bigint DEFAULT NULL COMMENT '更新人',
+    update_time bigint DEFAULT NULL COMMENT '更新时间',
+    PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='人员调配历史记录';
+
+ALTER TABLE t_b_ding
+    ADD COLUMN sop_role_type VARCHAR(45) NOT NULL COMMENT 'sop角色' AFTER role_type,
+    CHANGE COLUMN role_type role_type VARCHAR(20) CHARACTER SET 'utf8mb4' NULL COMMENT '项目角色' ;
+
+-- 2024-05-15
+ALTER TABLE sys_ding_obj
+    ADD COLUMN sop_role_type VARCHAR(45) NOT NULL COMMENT 'sop角色' AFTER type;

+ 33 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/SopRoleTypeEnum.java

@@ -0,0 +1,33 @@
+package com.qmth.sop.common.enums;
+
+/**
+ * @Description: sop执行 角色类型枚举
+ * @Author: CaoZixuan
+ * @Date: 2024-05-14
+ */
+public enum SopRoleTypeEnum {
+    REGION_COORDINATOR("区域协调人", new RoleTypeEnum[] { RoleTypeEnum.REGION_MANAGER, RoleTypeEnum.REGION_COORDINATOR,
+            RoleTypeEnum.EFFECT_ENGINEER, RoleTypeEnum.ASSISTANT_ENGINEER }),
+    PROJECT_MANAGER("项目经理", new RoleTypeEnum[] { RoleTypeEnum.REGION_MANAGER, RoleTypeEnum.REGION_COORDINATOR,
+            RoleTypeEnum.EFFECT_ENGINEER, RoleTypeEnum.ASSISTANT_ENGINEER }),
+    ENGINEER("工程师", new RoleTypeEnum[] { RoleTypeEnum.REGION_MANAGER, RoleTypeEnum.REGION_COORDINATOR,
+            RoleTypeEnum.EFFECT_ENGINEER, RoleTypeEnum.ASSISTANT_ENGINEER });
+
+    private final String title;
+
+    // 可选择的用户所属角色类型
+    private final RoleTypeEnum[] roleTypes;
+
+    SopRoleTypeEnum(String title, RoleTypeEnum[] roleTypes) {
+        this.title = title;
+        this.roleTypes = roleTypes;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public RoleTypeEnum[] getRoleTypes() {
+        return roleTypes;
+    }
+}