|
|
@ -1623,4 +1623,141 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
projectProcessAttachmentService.insertBatch(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param fromDTO |
|
|
|
* @Description 项目退回V2.0接口 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void projectReturnV2(ReturnFromDTO fromDTO) { |
|
|
|
//公开回复内容审核
|
|
|
|
if (com.alibaba.nacos.client.utils.StringUtils.isNotBlank(fromDTO.getPublicReply())) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
taskDTO.setContent(fromDTO.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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ProjectEntity projectEntity = baseDao.selectById(fromDTO.getProjectId()); |
|
|
|
if (ProjectConstant.CLOSED.equals(projectEntity.getStatus())) { |
|
|
|
throw new RenException(EpmetErrorCode.PROJECT_IS_CLOSED.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
Date current = new Date(); |
|
|
|
//更新项目关联表
|
|
|
|
ProjectStaffEntity projectStaffEntity = new ProjectStaffEntity(); |
|
|
|
projectStaffEntity.setId(fromDTO.getProjectStaffId()); |
|
|
|
projectStaffEntity.setIsHandle(ProjectConstant.HANDLE); |
|
|
|
projectStaffService.updateById(projectStaffEntity); |
|
|
|
|
|
|
|
//查找对应的project_staff的信息,为了取出机关的信息,给即将要生成的“退回”节点赋值
|
|
|
|
ProjectStaffEntity sourceProjectStaff = projectStaffService.selectById(fromDTO.getProjectStaffId()); |
|
|
|
if(null == sourceProjectStaff){ |
|
|
|
log.error("com.epmet.service.impl.ProjectServiceImpl.projectReturn,找不到发起退回的项目相关人员的记录,参数:{}",JSON.toJSONString(fromDTO)); |
|
|
|
throw new RenException("找不到发起退回的项目相关人员的记录"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//结案记录加入项目进展表
|
|
|
|
ProjectProcessEntity projectProcessEntity = new ProjectProcessEntity(); |
|
|
|
projectProcessEntity.setProjectId(fromDTO.getProjectId()); |
|
|
|
projectProcessEntity.setCustomerId(sourceProjectStaff.getCustomerId()); |
|
|
|
projectProcessEntity.setDepartmentName(fromDTO.getDepartmentName()); |
|
|
|
projectProcessEntity.setOrgIdPath(sourceProjectStaff.getOrgIdPath()); |
|
|
|
projectProcessEntity.setGridId(sourceProjectStaff.getGridId()); |
|
|
|
projectProcessEntity.setDepartmentId(sourceProjectStaff.getDepartmentId()); |
|
|
|
projectProcessEntity.setAgencyId(sourceProjectStaff.getOrgId()); |
|
|
|
projectProcessEntity.setOperation(ProjectConstant.OPERATION_RETURN); |
|
|
|
projectProcessEntity.setOperationName(ProjectConstant.OPERATION_RETURN_NAME); |
|
|
|
projectProcessEntity.setPublicReply(fromDTO.getPublicReply()); |
|
|
|
projectProcessEntity.setInternalRemark(fromDTO.getInternalRemark()); |
|
|
|
projectProcessEntity.setStaffId(fromDTO.getUserId()); |
|
|
|
projectProcessService.insert(projectProcessEntity); |
|
|
|
|
|
|
|
//项目附件表新增数据 sun 2020.12.22
|
|
|
|
if (fromDTO.getPublicFile().size() > NumConstant.ZERO || fromDTO.getInternalFile().size() > NumConstant.ZERO) { |
|
|
|
saveFile(fromDTO.getPublicFile(), fromDTO.getInternalFile(), sourceProjectStaff.getCustomerId(), fromDTO.getProjectId(), projectProcessEntity.getId()); |
|
|
|
}//end
|
|
|
|
|
|
|
|
//将人员关系添加到项目关联表
|
|
|
|
ProjectStaffDTO projectStaffDTO = projectStaffService.getProjectStaffInfo(fromDTO.getProjectProcessId()); |
|
|
|
ProjectStaffEntity projectStaff = ConvertUtils.sourceToTarget(projectStaffDTO, ProjectStaffEntity.class); |
|
|
|
projectStaff.setId(null); |
|
|
|
//防止将被退回的项目相关人员节点的创建时间赋值给新增的相关人员节点的创建时间,否则数据统计将出现误差
|
|
|
|
projectStaff.setCreatedTime(current); |
|
|
|
projectStaff.setUpdatedTime(current); |
|
|
|
projectStaff.setProcessId(projectProcessEntity.getId()); |
|
|
|
projectStaff.setIsHandle(ProjectConstant.UNHANDLED); |
|
|
|
projectStaffService.insert(projectStaff); |
|
|
|
|
|
|
|
//更新退回发起人的节点耗时记录
|
|
|
|
ProjectOrgRelationEntity orientRelation = relationDao.selectByProjectStaffId(fromDTO.getProjectStaffId()); |
|
|
|
if(null == orientRelation){ |
|
|
|
log.error("com.epmet.service.impl.ProjectServiceImpl.projectReturn,找不到发起退回的项目相关人员的节点耗时记录,参数:{}",JSON.toJSONString(fromDTO)); |
|
|
|
throw new RenException("找不到发起退回的项目相关人员的节点耗时记录"); |
|
|
|
} |
|
|
|
ProjectOrgRelationEntity relationDto = new ProjectOrgRelationEntity(); |
|
|
|
relationDto.setProjectStaffId(orientRelation.getProjectStaffId()); |
|
|
|
relationDto.setHandledDate(current); |
|
|
|
Integer costTime = calculateDelta_T(ProjectConstant.IMPRECISE_CALCULATION, |
|
|
|
ProjectConstant.CALCULATION_TYPE_DEFAULT, |
|
|
|
orientRelation.getProjectStaffId(), |
|
|
|
orientRelation.getInformedDate(), |
|
|
|
current); |
|
|
|
relationDto.setTotalPeriod(costTime); |
|
|
|
relationDto.setOperation(ProjectConstant.OPERATION_RETURN); |
|
|
|
if(null == orientRelation.getFirstDealtDate()){ |
|
|
|
relationDto.setFirstDealtDate(current); |
|
|
|
relationDto.setFirstReplyPeriod(costTime); |
|
|
|
} |
|
|
|
relationDao.maintainTimePropertyConsistency(relationDto); |
|
|
|
|
|
|
|
//初始化被退回人的节点耗时记录
|
|
|
|
ProjectOrgRelationEntity newRelation = new ProjectOrgRelationEntity(); |
|
|
|
newRelation.setProjectStaffId(projectStaff.getId()); |
|
|
|
newRelation.setSourceOperation(ProjectConstant.OPERATION_RETURN); |
|
|
|
newRelation.setInformedDate(current); |
|
|
|
relationDao.insert(newRelation); |
|
|
|
|
|
|
|
//通知
|
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); |
|
|
|
messageFormDTO.setCustomerId(projectEntity.getCustomerId()); |
|
|
|
messageFormDTO.setApp(ProjectConstant.GOV); |
|
|
|
messageFormDTO.setGridId("*"); |
|
|
|
messageFormDTO.setUserId(projectStaffDTO.getStaffId()); |
|
|
|
messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE); |
|
|
|
messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, projectEntity.getTitle())); |
|
|
|
messageFormDTO.setReadFlag(Constant.UNREAD); |
|
|
|
msgList.add(messageFormDTO); |
|
|
|
messageFeignClient.saveUserMessageList(msgList); |
|
|
|
//2020.10.26 添加项目退回给勾选人推送微信订阅消息 sun
|
|
|
|
List<WxSubscribeMessageFormDTO> wxmpMsgList = new ArrayList<>(); |
|
|
|
WxSubscribeMessageFormDTO msg = new WxSubscribeMessageFormDTO(); |
|
|
|
msg.setCustomerId(projectEntity.getCustomerId()); |
|
|
|
msg.setClientType(AppClientConstant.APP_GOV); |
|
|
|
msg.setUserId(projectStaffDTO.getStaffId()); |
|
|
|
msg.setBehaviorType("项目消息"); |
|
|
|
msg.setMessageContent(String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, projectEntity.getTitle())); |
|
|
|
msg.setMessageTime(new Date()); |
|
|
|
msg.setGridId("*"); |
|
|
|
wxmpMsgList.add(msg); |
|
|
|
//发送微信订阅消息 sun
|
|
|
|
logger.info("项目退回,开始推送微信订阅消息"); |
|
|
|
Result result = epmetMessageOpenFeignClient.sendWxSubscribeMessage(wxmpMsgList); |
|
|
|
if (!result.success()) { |
|
|
|
logger.error("项目退回成功,发送微信订阅消息失败" + JSON.toJSONString(result)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |