|
|
@ -521,4 +521,168 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl<ProjectProcessDao |
|
|
|
return baseDao.selectResponseTrace(projects); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 项目跟踪-转其他部门2.0接口 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void transferV2(TransferFormDTO formDTO) { |
|
|
|
//公开回复内容审核
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getPublicReply())) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
taskDTO.setContent(formDTO.getPublicReply()); |
|
|
|
textScanParamDTO.getTasks().add(taskDTO); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
|
if (!textSyncScanResult.success()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//1:更新项目人员关联表数据状态为已处理
|
|
|
|
ProjectStaffEntity staffEntity = projectStaffDao.selectById(formDTO.getProjectStaffId()); |
|
|
|
if (null == staffEntity) { |
|
|
|
throw new RenException(ProjectConstant.SELECT_PROJECTSTAFF_EXCEPTION); |
|
|
|
} |
|
|
|
if (!ProjectConstant.UNHANDLED.equals(staffEntity.getIsHandle())) { |
|
|
|
throw new RenException(ProjectConstant.UNHANDLED_EXCEPTION); |
|
|
|
} |
|
|
|
staffEntity.setIsHandle(ProjectConstant.HANDLE); |
|
|
|
if (projectStaffDao.updateById(staffEntity) < NumConstant.ONE) { |
|
|
|
throw new RenException(ProjectConstant.UPDATE_PROJECTSTAFF_EXCEPTION); |
|
|
|
} |
|
|
|
|
|
|
|
//2:项目处理进展列表新增数据
|
|
|
|
ProjectProcessEntity processEntity = ConvertUtils.sourceToTarget(formDTO, ProjectProcessEntity.class); |
|
|
|
processEntity.setCustomerId(staffEntity.getCustomerId()); |
|
|
|
processEntity.setDepartmentName(staffEntity.getDepartmentName()); |
|
|
|
processEntity.setStaffId(staffEntity.getStaffId()); |
|
|
|
processEntity.setOperation(ProjectConstant.OPERATION_TRANSFER); |
|
|
|
processEntity.setOperationName(ProjectConstant.OPERATION_TRANSFER_NAME); |
|
|
|
processEntity.setAgencyId(staffEntity.getOrgId()); |
|
|
|
processEntity.setDepartmentId(staffEntity.getDepartmentId()); |
|
|
|
processEntity.setGridId(staffEntity.getGridId()); |
|
|
|
processEntity.setOrgIdPath(staffEntity.getOrgIdPath()); |
|
|
|
projectProcessDao.insert(processEntity); |
|
|
|
//2-1.项目附件表新增数据
|
|
|
|
if (formDTO.getPublicFile().size() > NumConstant.ZERO || formDTO.getInternalFile().size() > NumConstant.ZERO) { |
|
|
|
projectService.saveFile(formDTO.getPublicFile(), formDTO.getInternalFile(), staffEntity.getCustomerId(), formDTO.getProjectId(), processEntity.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
//3:项目人员关联表新增部门流转数据
|
|
|
|
List<TickStaffFormDTO> staffList = formDTO.getStaffList(); |
|
|
|
if (null == staffList || staffList.size() < NumConstant.ONE) { |
|
|
|
throw new RenException(ProjectConstant.DATE_EXCEPTION); |
|
|
|
} |
|
|
|
//3.1:调用gov-org服务,获取所有勾选人员对应的组织信息、部门信息、网格信息用于对处理部门和ORG_ID_PATH字段的赋值
|
|
|
|
List<String> agencyIdList = staffList.stream().map(TickStaffFormDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
agencyIdList = new ArrayList<String>(new LinkedHashSet<>(agencyIdList));agencyIdList.removeAll(Collections.singleton("")); |
|
|
|
List<String> deptIdList = staffList.stream().map(TickStaffFormDTO::getDepartmentId).collect(Collectors.toList()); |
|
|
|
deptIdList = new ArrayList<String>(new LinkedHashSet<>(deptIdList));deptIdList.removeAll(Collections.singleton("")); |
|
|
|
List<String> gridIdList = staffList.stream().map(TickStaffFormDTO::getGridId).collect(Collectors.toList()); |
|
|
|
gridIdList = new ArrayList<String>(new LinkedHashSet<>(gridIdList));gridIdList.removeAll(Collections.singleton("")); |
|
|
|
AgencyDeptGridFormDTO agencyDeptGridFormDTO = new AgencyDeptGridFormDTO(); |
|
|
|
agencyDeptGridFormDTO.setAgencyIdList(agencyIdList); |
|
|
|
agencyDeptGridFormDTO.setDeptIdList(deptIdList); |
|
|
|
agencyDeptGridFormDTO.setGridIdList(gridIdList); |
|
|
|
Result<AgencyDeptGridResultDTO> resultDTO = govOrgFeignClient.getAgencyDeptGridList(agencyDeptGridFormDTO); |
|
|
|
if (!resultDTO.success() || null == resultDTO.getData()) { |
|
|
|
throw new RenException(ProjectConstant.SELECT_GOV_ORG_EXCEPTION); |
|
|
|
} |
|
|
|
AgencyDeptGridResultDTO agencyDeptGrid = resultDTO.getData(); |
|
|
|
//3.2:批量新增项目人员关联表数据
|
|
|
|
List<ProjectStaffEntity> entityList = new ArrayList<>(); |
|
|
|
staffList.forEach(ts->{ |
|
|
|
ProjectStaffEntity entity = ConvertUtils.sourceToTarget(ts, ProjectStaffEntity.class); |
|
|
|
entity.setOrgId(ts.getAgencyId()); |
|
|
|
entity.setProjectId(formDTO.getProjectId()); |
|
|
|
entity.setProcessId(processEntity.getId()); |
|
|
|
entity.setIsHandle(ProjectConstant.UNHANDLED); |
|
|
|
agencyDeptGrid.getAgencyList().forEach(agency->{ |
|
|
|
if (ts.getAgencyId().equals(agency.getId())) { |
|
|
|
entity.setCustomerId(agency.getCustomerId()); |
|
|
|
entity.setOrgIdPath(("".equals(agency.getPids()) ? "" : agency.getPids() + ":") + agency.getId()); |
|
|
|
entity.setDepartmentName(agency.getOrganizationName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (StringUtils.isNotBlank(ts.getDepartmentId())) { |
|
|
|
agencyDeptGrid.getDeptList().forEach(dept -> { |
|
|
|
if (ts.getDepartmentId().equals(dept.getId())) { |
|
|
|
entity.setDepartmentName(entity.getDepartmentName() + "-" + dept.getDepartmentName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(ts.getGridId())) { |
|
|
|
agencyDeptGrid.getGridList().forEach(grid -> { |
|
|
|
if (ts.getGridId().equals(grid.getId())) { |
|
|
|
entity.setDepartmentName(entity.getDepartmentName() + "-" + grid.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
entityList.add(entity); |
|
|
|
}); |
|
|
|
projectStaffService.insertBatch(entityList); |
|
|
|
|
|
|
|
//3.3 项目机关历时关系 project_org_relation 更新原来的
|
|
|
|
ProjectOrgRelationEntity orientRelation = relationDao.selectByProjectStaffId(staffEntity.getId()); |
|
|
|
if(null == orientRelation){ |
|
|
|
log.error("com.epmet.service.impl.ProjectProcessServiceImpl.transfer,找不到项目节点机关历时记录,参数:{}",JSON.toJSONString(formDTO)); |
|
|
|
} |
|
|
|
Date current = new Date(); |
|
|
|
WorkMinuteFormDTO timeParam = new WorkMinuteFormDTO(); |
|
|
|
timeParam.setIfPrecise(ProjectConstant.IMPRECISE_CALCULATION); |
|
|
|
timeParam.setIfCustom(ProjectConstant.CALCULATION_TYPE_DEFAULT); |
|
|
|
TimestampIntervalFormDTO interval = new TimestampIntervalFormDTO(orientRelation.getProjectStaffId(),orientRelation.getInformedDate(),current); |
|
|
|
List<TimestampIntervalFormDTO> intervalList = new LinkedList<>();intervalList.add(interval); |
|
|
|
timeParam.setTimeList(intervalList); |
|
|
|
Result<Map<String,Integer>> timeResult = epmetCommonServiceOpenFeignClient.workMinutes(timeParam); |
|
|
|
|
|
|
|
if(timeResult.success() && !CollectionUtils.isEmpty(timeResult.getData()) && null != timeResult.getData().get(staffEntity.getId())){ |
|
|
|
|
|
|
|
ProjectOrgRelationEntity relationDto = new ProjectOrgRelationEntity(); |
|
|
|
relationDto.setProjectStaffId(orientRelation.getProjectStaffId()); |
|
|
|
relationDto.setHandledDate(current); |
|
|
|
relationDto.setTotalPeriod(timeResult.getData().get(staffEntity.getId())); |
|
|
|
relationDto.setOperation(ProjectConstant.OPERATION_TRANSFER); |
|
|
|
if(null == orientRelation.getFirstDealtDate()){ |
|
|
|
relationDto.setFirstDealtDate(current); |
|
|
|
relationDto.setFirstReplyPeriod(relationDto.getTotalPeriod()); |
|
|
|
} |
|
|
|
relationDao.maintainTimePropertyConsistency(relationDto); |
|
|
|
}else{ |
|
|
|
log.error("com.epmet.service.impl.ProjectProcessServiceImpl.transfer,计算节点耗时失败,参数:{}", JSON.toJSONString(timeParam)); |
|
|
|
throw new RenException("计算节点耗时失败"); |
|
|
|
} |
|
|
|
|
|
|
|
//3.4 项目机关历时关系 project_org_relation 插入新增的
|
|
|
|
List<ProjectOrgRelationEntity> relationList = new LinkedList<>(); |
|
|
|
entityList.forEach(staff -> { |
|
|
|
ProjectOrgRelationEntity relation = new ProjectOrgRelationEntity(); |
|
|
|
relation.setProjectStaffId(staff.getId()); |
|
|
|
relation.setInformedDate(current); |
|
|
|
relation.setSourceOperation(ProjectConstant.OPERATION_TRANSFER); |
|
|
|
relationList.add(relation); |
|
|
|
}); |
|
|
|
relationDao.insertBatch(relationList); |
|
|
|
|
|
|
|
//4:调用epmet-message服务,给项目流转过程中的工作人员发送消息
|
|
|
|
if (!transferMessage(formDTO).success()) { |
|
|
|
throw new RenException(ProjectConstant.SAVE_MSG_EXCEPTION); |
|
|
|
} |
|
|
|
|
|
|
|
//5:调用epmet-message服务,给项目流转过程中的工作人员发送订阅的微信消息
|
|
|
|
if (!transferWxmpMessage(formDTO).success()) { |
|
|
|
logger.error("项目流转,推送微信订阅消息失败"); |
|
|
|
//throw new RenException(ProjectConstant.SAVE_WXMP_MSG_EXCEPTION);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |