|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 处理临时新增的分配名单
|
|
|
*
|