Browse Source

add:人员调配查询相关

caozixuan 1 năm trước cách đây
mục cha
commit
74e38b5263

+ 11 - 0
sop-api/src/main/java/com/qmth/sop/server/api/TBUserArchivesAllocationController.java

@@ -46,6 +46,7 @@ public class TBUserArchivesAllocationController {
     @ApiOperation(value = "人员调配管理-分页查询")
     @RequestMapping(value = "/page", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = UserArchivesAllocationResult.class)})
+    @Deprecated
     public Result findUserArchivesAllocationPage(@ApiParam(value = "服务单元id") @RequestParam(required = false) String serviceUnitId,
                                                  @ApiParam(value = "省") @RequestParam(required = false) String province,
                                                  @ApiParam(value = "市") @RequestParam(required = false) String city,
@@ -62,6 +63,7 @@ public class TBUserArchivesAllocationController {
     @ApiOperation(value = "人员调配管理-小计查询")
     @RequestMapping(value = "/sub_total", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = UserArchivesAllocationSubTotalResult.class)})
+    @Deprecated
     public Result findUserArchivesAllocationSubTotal(@ApiParam(value = "服务单元id") @RequestParam(required = false) String serviceUnitId,
                                                      @ApiParam(value = "省") @RequestParam(required = false) String province,
                                                      @ApiParam(value = "市") @RequestParam(required = false) String city,
@@ -125,6 +127,7 @@ public class TBUserArchivesAllocationController {
     @ApiOperation(value = "人员调配管理-查询空闲工程师")
     @RequestMapping(value = "/free_engineer", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = ArchivesSourceResult.class)})
+    @Deprecated
     public Result findFreeEngineer(@ApiParam(value = "工程师类型", required = true) @RequestParam RoleTypeEnum roleType,
                                    @ApiParam(value = "派单号") @RequestParam(required = false) String crmNo) {
         return ResultUtil.ok(tbUserArchivesService.findFreeEngineerSourceByType(roleType, crmNo));
@@ -133,8 +136,16 @@ public class TBUserArchivesAllocationController {
     @ApiOperation(value = "人员调配管理-查询空闲区域协调人")
     @RequestMapping(value = "/free_coordinator", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = ArchivesSourceResult.class)})
+    @Deprecated
     public Result findFreeCoordinator(@ApiParam(value = "服务单元id", required = true) @RequestParam String serviceUnitId,
                                       @ApiParam(value = "派单号") @RequestParam(required = false) String crmNo) {
         return ResultUtil.ok(tbUserArchivesService.findFreeCoordinatorByServiceId(SystemConstant.convertIdToLong(serviceUnitId), crmNo, false));
     }
+
+    @ApiOperation(value = "人员调配管理-查询调配信息")
+    @RequestMapping(value = "/info", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = ArchivesSourceResult.class)})
+    public Result findAllocationInfo(@ApiParam(value = "派单详情id", required = true) @RequestParam String crmDetailId){
+        return ResultUtil.ok(tbUserArchivesAllocationService.findCrmDetailAllocationInfo(SystemConstant.convertIdToLong(crmDetailId)));
+    }
 }

+ 55 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/dto/AllocationDetailDto.java

@@ -0,0 +1,55 @@
+package com.qmth.sop.business.bean.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+/**
+ * @Description: 分配详情dto
+ * @Author: CaoZixuan
+ * @Date: 2024-05-20
+ */
+public class AllocationDetailDto {
+    @ApiModelProperty("已分配")
+    private List<UserArchivesDto> allocatedList;
+
+    @ApiModelProperty("可分配")
+    private List<UserArchivesDto> canChooseList;
+
+    @ApiModelProperty("历史记录")
+    private List<UserArchivesDto> historicalList;
+
+    public AllocationDetailDto() {
+    }
+
+    public AllocationDetailDto(List<UserArchivesDto> allocatedList, List<UserArchivesDto> canChooseList,
+            List<UserArchivesDto> historicalList) {
+        this.allocatedList = allocatedList;
+        this.canChooseList = canChooseList;
+        this.historicalList = historicalList;
+    }
+
+    public List<UserArchivesDto> getAllocatedList() {
+        return allocatedList;
+    }
+
+    public void setAllocatedList(List<UserArchivesDto> allocatedList) {
+        this.allocatedList = allocatedList;
+    }
+
+    public List<UserArchivesDto> getCanChooseList() {
+        return canChooseList;
+    }
+
+    public void setCanChooseList(List<UserArchivesDto> canChooseList) {
+        this.canChooseList = canChooseList;
+    }
+
+    public List<UserArchivesDto> getHistoricalList() {
+        return historicalList;
+    }
+
+    public void setHistoricalList(List<UserArchivesDto> historicalList) {
+        this.historicalList = historicalList;
+    }
+}

+ 45 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/dto/UserArchivesDto.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
  * @Date: 2023-08-31
  */
 public class UserArchivesDto {
+
     @ApiModelProperty("用户id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long userId;
@@ -21,6 +22,18 @@ public class UserArchivesDto {
     @ApiModelProperty("名称")
     private String name;
 
+    @ApiModelProperty("省份")
+    private String province;
+
+    @ApiModelProperty("城市")
+    private String city;
+
+    @ApiModelProperty("供应商")
+    private String supplierName;
+
+    @ApiModelProperty("创建时间")
+    private Long createTime;
+
     public Long getUserId() {
         return userId;
     }
@@ -44,4 +57,36 @@ public class UserArchivesDto {
     public void setName(String name) {
         this.name = name;
     }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+    public Long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
 }

+ 169 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/CrmDetailAllocationResult.java

@@ -0,0 +1,169 @@
+package com.qmth.sop.business.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.business.bean.dto.AllocationDetailDto;
+import com.qmth.sop.common.enums.ProductTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 派单详情人员分配结果
+ * @Author: CaoZixuan
+ * @Date: 2024-05-20
+ */
+public class CrmDetailAllocationResult {
+    @ApiModelProperty("服务单元名称")
+    private String serviceUnitName;
+
+    @ApiModelProperty("派单号")
+    private String crmNo;
+
+    @ApiModelProperty("派单详情id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long crmDetailId;
+
+    @ApiModelProperty("客户类型")
+    private ProductTypeEnum customType;
+
+    @ApiModelProperty("客户名称")
+    private String customName;
+
+    @ApiModelProperty("科目名称")
+    private String courseName;
+
+    @ApiModelProperty("服务档位")
+    private String level;
+
+    @ApiModelProperty("客户省")
+    private String customProvince;
+
+    @ApiModelProperty("客户市")
+    private String customCity;
+
+    @ApiModelProperty("客户区")
+    private String customArea;
+
+    @ApiModelProperty("客户地址")
+    private String customAddress;
+
+    @ApiModelProperty("区域协调人信息")
+    private AllocationDetailDto regionCoordinatorInfo;
+
+    @ApiModelProperty("项目经理信息")
+    private AllocationDetailDto projectManagerInfo;
+
+    @ApiModelProperty("工程师信息")
+    private AllocationDetailDto engineerInfo;
+
+    public String getServiceUnitName() {
+        return serviceUnitName;
+    }
+
+    public void setServiceUnitName(String serviceUnitName) {
+        this.serviceUnitName = serviceUnitName;
+    }
+
+    public String getCrmNo() {
+        return crmNo;
+    }
+
+    public void setCrmNo(String crmNo) {
+        this.crmNo = crmNo;
+    }
+
+    public Long getCrmDetailId() {
+        return crmDetailId;
+    }
+
+    public void setCrmDetailId(Long crmDetailId) {
+        this.crmDetailId = crmDetailId;
+    }
+
+    public ProductTypeEnum getCustomType() {
+        return customType;
+    }
+
+    public void setCustomType(ProductTypeEnum customType) {
+        this.customType = customType;
+    }
+
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getLevel() {
+        return level;
+    }
+
+    public void setLevel(String level) {
+        this.level = level;
+    }
+
+    public String getCustomProvince() {
+        return customProvince;
+    }
+
+    public void setCustomProvince(String customProvince) {
+        this.customProvince = customProvince;
+    }
+
+    public String getCustomCity() {
+        return customCity;
+    }
+
+    public void setCustomCity(String customCity) {
+        this.customCity = customCity;
+    }
+
+    public String getCustomArea() {
+        return customArea;
+    }
+
+    public void setCustomArea(String customArea) {
+        this.customArea = customArea;
+    }
+
+    public String getCustomAddress() {
+        return customAddress;
+    }
+
+    public void setCustomAddress(String customAddress) {
+        this.customAddress = customAddress;
+    }
+
+    public AllocationDetailDto getRegionCoordinatorInfo() {
+        return regionCoordinatorInfo;
+    }
+
+    public void setRegionCoordinatorInfo(AllocationDetailDto regionCoordinatorInfo) {
+        this.regionCoordinatorInfo = regionCoordinatorInfo;
+    }
+
+    public AllocationDetailDto getProjectManagerInfo() {
+        return projectManagerInfo;
+    }
+
+    public void setProjectManagerInfo(AllocationDetailDto projectManagerInfo) {
+        this.projectManagerInfo = projectManagerInfo;
+    }
+
+    public AllocationDetailDto getEngineerInfo() {
+        return engineerInfo;
+    }
+
+    public void setEngineerInfo(AllocationDetailDto engineerInfo) {
+        this.engineerInfo = engineerInfo;
+    }
+}

+ 55 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/CrmProjectResult.java

@@ -41,6 +41,21 @@ public class CrmProjectResult {
     @ApiModelProperty("客户名称")
     private String customName;
 
+    @ApiModelProperty("客户省份")
+    private String customProvince;
+
+    @ApiModelProperty("客户城市")
+    private String customCity;
+
+    @ApiModelProperty("客户县区")
+    private String customArea;
+
+    @ApiModelProperty("客户地址")
+    private String customAddress;
+
+    @ApiModelProperty("服务档位")
+    private String level;
+
     @ApiModelProperty("考试开始时间")
     private Long examStartTime;
 
@@ -147,6 +162,46 @@ public class CrmProjectResult {
         this.customName = customName;
     }
 
+    public String getCustomProvince() {
+        return customProvince;
+    }
+
+    public void setCustomProvince(String customProvince) {
+        this.customProvince = customProvince;
+    }
+
+    public String getCustomCity() {
+        return customCity;
+    }
+
+    public void setCustomCity(String customCity) {
+        this.customCity = customCity;
+    }
+
+    public String getCustomArea() {
+        return customArea;
+    }
+
+    public void setCustomArea(String customArea) {
+        this.customArea = customArea;
+    }
+
+    public String getCustomAddress() {
+        return customAddress;
+    }
+
+    public void setCustomAddress(String customAddress) {
+        this.customAddress = customAddress;
+    }
+
+    public String getLevel() {
+        return level;
+    }
+
+    public void setLevel(String level) {
+        this.level = level;
+    }
+
     public Long getExamStartTime() {
         return examStartTime;
     }

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TBUserArchivesAllocation.java

@@ -47,6 +47,9 @@ public class TBUserArchivesAllocation implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long archivesId;
 
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
     public Long getId() {
         return id;
     }
@@ -102,4 +105,12 @@ public class TBUserArchivesAllocation implements Serializable {
     public void setArchivesId(Long archivesId) {
         this.archivesId = archivesId;
     }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
 }

+ 12 - 1
sop-business/src/main/java/com/qmth/sop/business/service/TBUserArchivesAllocationLogService.java

@@ -1,7 +1,11 @@
 package com.qmth.sop.business.service;
 
+import com.qmth.sop.business.bean.dto.UserArchivesDto;
 import com.qmth.sop.business.entity.TBUserArchivesAllocationLog;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +16,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2024-05-15
  */
 public interface TBUserArchivesAllocationLogService extends IService<TBUserArchivesAllocationLog> {
-
+    /**
+     * 查询人员调配历史记录
+     *
+     * @param crmDetailId     派单详情id
+     * @param sopRoleTypeEnum sop角色
+     * @return 历史记录
+     */
+    List<UserArchivesDto> findUserArchivesAllocationHistory(Long crmDetailId, SopRoleTypeEnum sopRoleTypeEnum);
 }

+ 22 - 3
sop-business/src/main/java/com/qmth/sop/business/service/TBUserArchivesAllocationService.java

@@ -2,12 +2,12 @@ package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.dto.UserArchivesDto;
 import com.qmth.sop.business.bean.params.AutoAllocationParam;
 import com.qmth.sop.business.bean.params.UserArchivesAllocationParam;
-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.bean.result.*;
 import com.qmth.sop.business.entity.TBUserArchivesAllocation;
+import com.qmth.sop.common.enums.RoleTypeEnum;
 import com.qmth.sop.common.enums.SopRoleTypeEnum;
 
 import java.util.List;
@@ -36,6 +36,7 @@ public interface TBUserArchivesAllocationService extends IService<TBUserArchives
      * @param pageSize      分页容量
      * @return 分页查询结果
      */
+    @Deprecated
     IPage<UserArchivesAllocationResult> findCrmAllocationPage(Long serviceUnitId, String province, String city, String area, String customName, Integer gap, Long regionId, Integer pageNumber, Integer pageSize);
 
     /**
@@ -50,6 +51,7 @@ public interface TBUserArchivesAllocationService extends IService<TBUserArchives
      * @param regionId      大区id
      * @return 小计结果
      */
+    @Deprecated
     UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, String province, String city,
             String area, String customName, Integer gap, Long regionId);
 
@@ -97,4 +99,21 @@ public interface TBUserArchivesAllocationService extends IService<TBUserArchives
      * @return 角色
      */
     SopRoleTypeEnum findRoleTypeByUserCrm(Long userId, String crmNo);
+
+    /**
+     * 查询派单详情中可以分配的人员
+     *
+     * @param crmDetailId     派单详情id
+     * @param sopRoleTypeEnum 角色身份
+     * @return 可选择人员集合
+     */
+    List<UserArchivesDto> findCanChooseArchives(Long crmDetailId, SopRoleTypeEnum sopRoleTypeEnum);
+
+    /**
+     * 根据派单明细id查询派单分配信息
+     *
+     * @param crmDetailId 派单明细id
+     * @return 分配信息
+     */
+    CrmDetailAllocationResult findCrmDetailAllocationInfo(Long crmDetailId);
 }

+ 2 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TBUserArchivesService.java

@@ -108,6 +108,7 @@ public interface TBUserArchivesService extends IService<TBUserArchives> {
      * @param crmNo    派单号(调配选人列表的特殊查询)
      * @return 档案资源
      */
+    @Deprecated
     List<ArchivesSourceResult> findFreeEngineerSourceByType(RoleTypeEnum roleType, String crmNo);
 
     /**
@@ -118,6 +119,7 @@ public interface TBUserArchivesService extends IService<TBUserArchives> {
      * @param verifyRate    校验服务单元区域配比
      * @return 区域负责人
      */
+    @Deprecated
     List<ArchivesSourceResult> findFreeCoordinatorByServiceId(Long serviceUnitId, String crmNo, boolean verifyRate);
 
     List<Map<String, Object>> findTempEmp();

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

@@ -469,6 +469,7 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
             tbCrmDetail = tbCrmDetailService.getOne(
                     new QueryWrapper<TBCrmDetail>().lambda().eq(TBCrmDetail::getSopNo, sopNo).last(SystemConstant.LIMIT1));
         } else if (crmNo != null && crmNo.length() > 0) {
+            // 传派单号 -> 派单详情的调配信息直接返回派单信息
             List<CrmProjectResult> crmProjectResultList = this.baseMapper.findCrmProjectByCrmNo(crmNo);
             if (CollectionUtils.isNotEmpty(crmProjectResultList)) {
                 return crmProjectResultList.get(0);
@@ -860,9 +861,13 @@ public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements
         return datasource.stream().filter(e -> sopRoleTypeEnum.equals(e.getSopRoleType())).flatMap(e -> {
             UserArchivesDto dto = new UserArchivesDto();
             Long userArchivesId = e.getArchivesId();
+            UserArchivesResult userArchivesResult = tbUserArchivesService.findUserArchivesByArchivesIdORUserId(userArchivesId, null);
             dto.setUserArchivesId(userArchivesId);
             dto.setUserId(e.getUserId());
             dto.setName(tbUserArchivesService.getById(userArchivesId).getName());
+            dto.setProvince(userArchivesResult.getProvince());
+            dto.setCity(userArchivesResult.getCity());
+            dto.setSupplierName(userArchivesResult.getSupplierName());
             return Stream.of(dto);
         }).collect(Collectors.toList());
     }

+ 25 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBUserArchivesAllocationLogServiceImpl.java

@@ -1,11 +1,19 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.sop.business.bean.dto.UserArchivesDto;
 import com.qmth.sop.business.entity.TBUserArchivesAllocationLog;
 import com.qmth.sop.business.mapper.TBUserArchivesAllocationLogMapper;
 import com.qmth.sop.business.service.TBUserArchivesAllocationLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 /**
  * <p>
  * 人员调配历史记录 服务实现类
@@ -17,4 +25,21 @@ import org.springframework.stereotype.Service;
 @Service
 public class TBUserArchivesAllocationLogServiceImpl extends ServiceImpl<TBUserArchivesAllocationLogMapper, TBUserArchivesAllocationLog> implements TBUserArchivesAllocationLogService {
 
+    @Override
+    public List<UserArchivesDto> findUserArchivesAllocationHistory(Long crmDetailId, SopRoleTypeEnum sopRoleTypeEnum) {
+        List<TBUserArchivesAllocationLog> datasource = this.list(new QueryWrapper<TBUserArchivesAllocationLog>().lambda()
+                .eq(TBUserArchivesAllocationLog::getCrmDetailId, crmDetailId)
+                .eq(TBUserArchivesAllocationLog::getSopRoleType, sopRoleTypeEnum).orderByAsc(TBUserArchivesAllocationLog::getCreateTime));
+
+        return datasource.stream().flatMap(e -> {
+            UserArchivesDto userArchivesDto = new UserArchivesDto();
+            userArchivesDto.setUserId(e.getUserId());
+            userArchivesDto.setUserArchivesId(e.getArchivesId());
+            userArchivesDto.setName(e.getArchivesName());
+            userArchivesDto.setCity(e.getCity());
+            userArchivesDto.setSupplierName(e.getSupplierName());
+            userArchivesDto.setCreateTime(e.getCreateTime());
+            return Stream.of(userArchivesDto);
+        }).collect(Collectors.toList());
+    }
 }

+ 69 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBUserArchivesAllocationServiceImpl.java

@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.activiti.service.ActivitiService;
+import com.qmth.sop.business.bean.dto.AllocationDetailDto;
 import com.qmth.sop.business.bean.dto.DataPermissionDto;
+import com.qmth.sop.business.bean.dto.UserArchivesDto;
 import com.qmth.sop.business.bean.params.AllocationParam;
 import com.qmth.sop.business.bean.params.AutoAllocationParam;
 import com.qmth.sop.business.bean.params.SopPublishParam;
@@ -68,6 +70,9 @@ public class TBUserArchivesAllocationServiceImpl
     @Resource
     private SysUserService sysUserService;
 
+    @Resource
+    private TBUserArchivesAllocationLogService tbUserArchivesAllocationLogService;
+
     @Override
     public IPage<UserArchivesAllocationResult> findCrmAllocationPage(Long serviceUnitId, String province, String city,
             String area, String customName, Integer gap, Long regionId, Integer pageNumber, Integer pageSize) {
@@ -541,6 +546,70 @@ public class TBUserArchivesAllocationServiceImpl
         return result;
     }
 
+    @Override
+    public List<UserArchivesDto> findCanChooseArchives(Long crmDetailId, SopRoleTypeEnum sopRoleTypeEnum) {
+        List<TBUserArchivesAllocation> allocatedList = this.list(new QueryWrapper<TBUserArchivesAllocation>().lambda()
+                .eq(TBUserArchivesAllocation::getCrmDetailId, crmDetailId)
+                .eq(TBUserArchivesAllocation::getSopRoleType, sopRoleTypeEnum));
+        List<Long> allocatedIdList = allocatedList.stream().map(TBUserArchivesAllocation::getArchivesId).distinct().collect(Collectors.toList());
+
+        List<TBUserArchivesAllocation> datasource = this.list();
+        List<Long> effectArchivesIdList = datasource.stream().map(TBUserArchivesAllocation::getArchivesId)
+                .filter(e -> !allocatedIdList.contains(e)).distinct().collect(Collectors.toList());
+
+        List<UserArchivesDto> result = new ArrayList<>();
+        for (Long effectArchivesId : effectArchivesIdList) {
+            UserArchivesResult tbUserArchivesResult = tbUserArchivesService.findUserArchivesByArchivesIdORUserId(
+                    effectArchivesId, null);
+            if (tbUserArchivesResult.getAuthenticationStatus()) {
+                UserArchivesDto cell = new UserArchivesDto();
+                cell.setUserId(tbUserArchivesResult.getUserId());
+                cell.setUserArchivesId(tbUserArchivesResult.getUserArchivesId());
+                cell.setName(tbUserArchivesResult.getName());
+                cell.setProvince(tbUserArchivesResult.getProvince());
+                cell.setCity(tbUserArchivesResult.getCity());
+                cell.setSupplierName(tbUserArchivesResult.getSupplierName());
+                result.add(cell);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public CrmDetailAllocationResult findCrmDetailAllocationInfo(Long crmDetailId) {
+        CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectInfo(null, crmDetailId, null);
+        List<UserArchivesDto> rcAllocatedList = crmProjectResult.getRegionCoordinatorList();
+        List<UserArchivesDto> pmAllocatedList = crmProjectResult.getProjectManagerList();
+        List<UserArchivesDto> enAllocatedList = crmProjectResult.getEngineerList();
+
+        List<UserArchivesDto> rcHistoricalList = tbUserArchivesAllocationLogService.findUserArchivesAllocationHistory(
+                crmDetailId, SopRoleTypeEnum.REGION_COORDINATOR);
+        List<UserArchivesDto> pmHistoricalList = tbUserArchivesAllocationLogService.findUserArchivesAllocationHistory(
+                crmDetailId, SopRoleTypeEnum.PROJECT_MANAGER);
+        List<UserArchivesDto> enHistoricalList = tbUserArchivesAllocationLogService.findUserArchivesAllocationHistory(
+                crmDetailId, SopRoleTypeEnum.ENGINEER);
+
+        List<UserArchivesDto> rcCanChooseList = this.findCanChooseArchives(crmDetailId, SopRoleTypeEnum.REGION_COORDINATOR);
+        List<UserArchivesDto> pmCanChooseList = this.findCanChooseArchives(crmDetailId, SopRoleTypeEnum.PROJECT_MANAGER);
+        List<UserArchivesDto> enCanChooseList = this.findCanChooseArchives(crmDetailId, SopRoleTypeEnum.ENGINEER);
+
+        CrmDetailAllocationResult result = new CrmDetailAllocationResult();
+        result.setServiceUnitName(crmProjectResult.getServiceUnitName());
+        result.setCrmNo(crmProjectResult.getCrmNo());
+        result.setCrmDetailId(crmDetailId);
+        result.setCustomType(crmProjectResult.getCustomType());
+        result.setCustomName(crmProjectResult.getCustomName());
+        result.setLevel(crmProjectResult.getLevel());
+        result.setCustomProvince(crmProjectResult.getCustomProvince());
+        result.setCustomCity(crmProjectResult.getCustomCity());
+        result.setCustomArea(crmProjectResult.getCustomArea());
+        result.setCustomAddress(crmProjectResult.getCustomAddress());
+        result.setRegionCoordinatorInfo(new AllocationDetailDto(rcAllocatedList, rcHistoricalList, rcCanChooseList));
+        result.setProjectManagerInfo(new AllocationDetailDto(pmAllocatedList, pmHistoricalList, pmCanChooseList));
+        result.setEngineerInfo(new AllocationDetailDto(enAllocatedList, enHistoricalList, enCanChooseList));
+        return result;
+    }
+
     /**
      * 处理临时新增的分配名单
      *

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

@@ -51,4 +51,8 @@ INSERT INTO sequence (name, current_value, increment) VALUES ('sysCustomCode', '
 INSERT INTO sys_config (id, config_key, config_name, config_value, enable, sort, create_id) VALUES ('39', 'sms.custom.info.missing.remind.code', '客户信息缺失通知', 'SMS_467015006', '1', '1', '1');
 
 -- 2024-05-17
-UPDATE sys_privilege SET name = '服务范围管理-划定派单和服务单元关系', url = '/api/service/service/scope/bind' WHERE (id = '2009');
+UPDATE sys_privilege SET name = '服务范围管理-划定派单和服务单元关系', url = '/api/service/service/scope/bind' WHERE (id = '2009');
+
+-- 2024-05-20
+ALTER TABLE t_b_user_archives_allocation
+    ADD COLUMN remark VARCHAR(45) NULL COMMENT '备注' AFTER archives_id;

+ 7 - 0
sop-business/src/main/resources/mapper/TBCrmMapper.xml

@@ -306,6 +306,11 @@
             sc.type AS customType,
             sc.id AS customId,
             sc.name AS customName,
+            sc.province AS customProvince,
+            sc.city AS customCity,
+            sc.area AS customArea,
+            sc.address AS customAddress,
+            sl.level AS level,
             customManager.id AS customManagerId,
             customManager.real_name AS customManagerName,
             tbc.exam_start_time AS examStartTime,
@@ -323,6 +328,8 @@
                 LEFT JOIN
             sys_custom sc ON tbc.custom_id = sc.id
                 LEFT JOIN
+            sys_level sl ON sc.level_id = sl.id
+                LEFT JOIN
             t_b_product tbp ON tbc.product_id = tbp.id
                 LEFT JOIN
             t_b_service tbs ON tbc.service_id = tbs.id

+ 1 - 0
sop-business/src/main/resources/mapper/TBUserArchivesMapper.xml

@@ -196,6 +196,7 @@
             tbuas.archives_time AS archivesTime,
             tbuas.authentication_score AS authenticationScore,
             tbuas.authentication_valid_time AS authenticationValidTime,
+            IF(REPLACE(UNIX_TIMESTAMP(NOW(3)), '.', '') &lt;= tbuas.authentication_valid_time,TRUE,FALSE)
             tbuas.remark,
             su.id AS userId,
             tbua.status AS status,