|
|
@ -29,6 +29,7 @@ import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.ParameterKeyConstant; |
|
|
@ -43,6 +44,7 @@ import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.feign.*; |
|
|
|
import com.epmet.redis.ProjectRedis; |
|
|
|
import com.epmet.resi.group.constant.TopicConstant; |
|
|
|
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
@ -109,6 +111,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
private GovIssueOpenFeignClient govIssueOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ProjectSubProcessService projectSubProcessService; |
|
|
|
@Autowired |
|
|
|
private EpmetThirdOpenFeignClient epmetThirdOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
private final static String ONE_DAY = "<1"; |
|
|
|
|
|
|
@ -1280,7 +1287,9 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void projectProcessCostTimeDataCompensation() { |
|
|
|
List<String> customers = baseDao.selectAllCustomerIds(); |
|
|
|
if(CollectionUtils.isEmpty(customers))return; |
|
|
|
if(CollectionUtils.isEmpty(customers)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
List<ProjectOrgRelationDTO> totalContainer = new LinkedList<>(); |
|
|
|
customers.forEach(customerId -> { |
|
|
|
List<ProjectOrgPeriodResultDTO> projectNodePeriodPerOrgList = projectStaffService.selectProjectOrgPeriod(customerId); |
|
|
@ -1364,8 +1373,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
dataMap.forEach((k,v) -> { |
|
|
|
if(null != v){ |
|
|
|
v.setTotalPeriod(batchDelta_T.get(k)); |
|
|
|
if(v.getHandledDate() == v.getFirstDealtDate())v.setFirstReplyPeriod(batchDelta_T.get(k)); |
|
|
|
else v.setFirstReplyPeriod(batchDelta_TResponse.get(k)); |
|
|
|
if(v.getHandledDate() == v.getFirstDealtDate()) { |
|
|
|
v.setFirstReplyPeriod(batchDelta_T.get(k)); |
|
|
|
} else { |
|
|
|
v.setFirstReplyPeriod(batchDelta_TResponse.get(k)); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
List<List<ProjectOrgRelationDTO>> partition = ListUtils.partition(totalContainer, NumConstant.ONE_HUNDRED); |
|
|
@ -1557,17 +1569,25 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
int seq = NumConstant.ZERO; |
|
|
|
a: |
|
|
|
for (int index = NumConstant.ZERO; index < staffResponseTraceUnit.size(); index++) { |
|
|
|
if(StringUtils.isNotBlank(staffResponseTraceUnit.get(index).getOperation()) && staffResponseTraceUnit.get(index).getOperation().contains("create")) continue; |
|
|
|
if(StringUtils.isNotBlank(staffResponseTraceUnit.get(index).getOperation()) && staffResponseTraceUnit.get(index).getOperation().contains("create")) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.equals("response", staffResponseTraceUnit.get(index).getOperation())) { |
|
|
|
|
|
|
|
replaceFirstResponseDate(incompleteBodyUnit,staffResponseTraceUnit.get(index),seq); |
|
|
|
seq++; |
|
|
|
int cursor = index; |
|
|
|
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) break; |
|
|
|
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) { |
|
|
|
break; |
|
|
|
} |
|
|
|
while (StringUtils.equals("response", staffResponseTraceUnit.get(cursor++).getOperation())) { |
|
|
|
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) break a; |
|
|
|
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) { |
|
|
|
break a; |
|
|
|
} |
|
|
|
} |
|
|
|
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) { |
|
|
|
break; |
|
|
|
} |
|
|
|
if (cursor == staffResponseTraceUnit.size() - NumConstant.ZERO) break; |
|
|
|
index = cursor; |
|
|
|
} else { |
|
|
|
replaceFirstResponseDate(incompleteBodyUnit,staffResponseTraceUnit.get(index),seq); |
|
|
@ -1589,7 +1609,9 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
// 传递过来的dest是已经按照projectId分好组之后再按照staff分组的集合
|
|
|
|
// dest key->staff
|
|
|
|
ProjectOrgPeriodResultDTO target = dest.get(seq); |
|
|
|
if(null != target) target.setPeriodTillReplyFirstly(staffResponseTraceUnit.getCreatedTime()); |
|
|
|
if(null != target) { |
|
|
|
target.setPeriodTillReplyFirstly(staffResponseTraceUnit.getCreatedTime()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -1968,4 +1990,207 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
return projectInfoDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 发送到外部平台 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2021/3/17 14:33 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void sendTo(SendToFormDTO 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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//获取项目相关信息
|
|
|
|
ProjectEntity projectEntity = baseDao.selectById(formDTO.getProjectId()); |
|
|
|
if (ProjectConstant.CLOSED.equals(projectEntity.getStatus())) { |
|
|
|
throw new RenException(EpmetErrorCode.PROJECT_IS_CLOSED.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
if(StringUtils.isBlank(formDTO.getProjectStaffId())){ |
|
|
|
ProjectStaffDTO projectStaff = projectStaffService.getLatestIdByProjectIdAndStaffId(formDTO.getProjectId(),formDTO.getUserId()); |
|
|
|
if(null == projectStaff){ |
|
|
|
log.error("com.epmet.service.impl.ProjectServiceImpl.response,project_staff表中没有与之对应的数据,传参:{}", JSON.toJSONString(formDTO)); |
|
|
|
throw new RenException("未找到项目相关人员记录"); |
|
|
|
} |
|
|
|
formDTO.setProjectStaffId(projectStaff.getId()); |
|
|
|
} |
|
|
|
ProjectStaffDTO projectStaff = projectStaffService.get(formDTO.getProjectStaffId()); |
|
|
|
//处理响应记录加入项目进展表
|
|
|
|
ProjectProcessEntity projectProcessEntity = new ProjectProcessEntity(); |
|
|
|
projectProcessEntity.setProjectId(formDTO.getProjectId()); |
|
|
|
projectProcessEntity.setCustomerId(projectStaff.getCustomerId()); |
|
|
|
projectProcessEntity.setDepartmentName(formDTO.getDepartmentName()); |
|
|
|
projectProcessEntity.setOrgIdPath(projectStaff.getOrgIdPath()); |
|
|
|
projectProcessEntity.setGridId(projectStaff.getGridId()); |
|
|
|
projectProcessEntity.setDepartmentId(projectStaff.getDepartmentId()); |
|
|
|
projectProcessEntity.setAgencyId(projectStaff.getOrgId()); |
|
|
|
projectProcessEntity.setOperation(ProjectConstant.OPERATION_RESPONSES); |
|
|
|
projectProcessEntity.setOperationName(ProjectConstant.OPERATION_RESPONSES_NAME); |
|
|
|
projectProcessEntity.setPublicReply(formDTO.getPublicReply()); |
|
|
|
projectProcessEntity.setInternalRemark(formDTO.getInternalRemark()); |
|
|
|
projectProcessEntity.setStaffId(formDTO.getUserId()); |
|
|
|
projectProcessEntity.setIsSend(NumConstant.ONE); |
|
|
|
projectProcessService.insert(projectProcessEntity); |
|
|
|
|
|
|
|
//项目附件表新增数据 sun 2020.12.22
|
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getPublicFile()) || CollectionUtils.isNotEmpty(formDTO.getInternalFile())) { |
|
|
|
saveFile(formDTO.getPublicFile(), formDTO.getInternalFile(), projectStaff.getCustomerId(), formDTO.getProjectId(), projectProcessEntity.getId()); |
|
|
|
}//end
|
|
|
|
|
|
|
|
//TODO 发送到外部系统 start
|
|
|
|
ProjectApplyAssistFormDTO applyAssistFormDTO = new ProjectApplyAssistFormDTO(); |
|
|
|
applyAssistFormDTO.setCustomerId(projectStaff.getCustomerId()); |
|
|
|
applyAssistFormDTO.setPlatformId(formDTO.getPlatformId()); |
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getInternalFile())) { |
|
|
|
List<String> imageList = |
|
|
|
formDTO.getInternalFile().stream().filter(fileDTO -> TopicConstant.IMAGE.equals(fileDTO.getType())).map(FileDTO::getUrl).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(imageList)) { |
|
|
|
applyAssistFormDTO.setImageLink(String.join(StrConstant.COMMA, imageList)); |
|
|
|
} |
|
|
|
List<String> voiceList = |
|
|
|
formDTO.getInternalFile().stream().filter(fileDTO -> TopicConstant.VOICE.equals(fileDTO.getType())).map(FileDTO::getUrl).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(imageList)) { |
|
|
|
applyAssistFormDTO.setVoiceLink(String.join(StrConstant.COMMA, voiceList)); |
|
|
|
} |
|
|
|
List<String> videoList = |
|
|
|
formDTO.getInternalFile().stream().filter(fileDTO -> TopicConstant.VIDEO.equals(fileDTO.getType())).map(FileDTO::getUrl).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(imageList)) { |
|
|
|
applyAssistFormDTO.setVideoLink(String.join(StrConstant.COMMA, videoList)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//获取网格信息
|
|
|
|
List<ProjectRelatedPersonnelDTO> relatedPersonnel = projectRelatedPersonnelService.getPersonnelListByProjectId(formDTO.getProjectId()); |
|
|
|
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); |
|
|
|
customerGridFormDTO.setGridId(relatedPersonnel.get(0).getGridId()); |
|
|
|
Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getCustomerGridByGridId(customerGridFormDTO); |
|
|
|
if (!gridResult.success()) { |
|
|
|
throw new RenException(gridResult.getCode(), gridResult.getMsg()); |
|
|
|
} |
|
|
|
applyAssistFormDTO.setLatitude(gridResult.getData().getLatitude()); |
|
|
|
applyAssistFormDTO.setLongitude(gridResult.getData().getLongitude()); |
|
|
|
|
|
|
|
//获取议题详情
|
|
|
|
IssueDetailFormDTO issueDetailFormDTO = new IssueDetailFormDTO(); |
|
|
|
issueDetailFormDTO.setIssueId(projectEntity.getOriginId()); |
|
|
|
Result<GovIssueDetailResultDTO> issueDetail = govIssueOpenFeignClient.votingissuedetail(issueDetailFormDTO); |
|
|
|
if (!issueDetail.success()) { |
|
|
|
throw new RenException(issueDetail.getCode(), issueDetail.getMsg()); |
|
|
|
} |
|
|
|
ProjectDetailDTO projectDetailDTO = ConvertUtils.sourceToTarget(issueDetail.getData(), ProjectDetailDTO.class); |
|
|
|
projectDetailDTO = ConvertUtils.sourceToTarget(issueDetail.getData().getTopicInfo(), ProjectDetailDTO.class); |
|
|
|
applyAssistFormDTO.setDetail(projectDetailDTO.toString()); |
|
|
|
applyAssistFormDTO.setDetailAddress(projectDetailDTO.getBelongsGridName()); |
|
|
|
Result result = epmetThirdOpenFeignClient.applyAssist(applyAssistFormDTO); |
|
|
|
if (!result.success()) { |
|
|
|
throw new RenException(result.getCode(), result.getMsg()); |
|
|
|
} |
|
|
|
applyAssistFormDTO.setSource("党建引领"); |
|
|
|
ProjectAssistResult assistResult = (ProjectAssistResult)result.getData(); |
|
|
|
//发送到外部系统 end
|
|
|
|
|
|
|
|
//结果存入project_sub_process表
|
|
|
|
ProjectSubProcessDTO projectSubProcess = new ProjectSubProcessDTO(); |
|
|
|
projectSubProcess.setCustomerId(projectStaff.getCustomerId()); |
|
|
|
projectSubProcess.setProjectId(formDTO.getProjectId()); |
|
|
|
projectSubProcess.setProcessId(projectProcessEntity.getId()); |
|
|
|
projectSubProcess.setProjectStaffId(formDTO.getProjectStaffId()); |
|
|
|
projectSubProcess.setPlatformId(formDTO.getPlatformId()); |
|
|
|
projectSubProcess.setPlatformName(formDTO.getPlatformName()); |
|
|
|
projectSubProcess.setTaskId(assistResult.getTaskId()); |
|
|
|
projectSubProcess.setExternalStatus(NumConstant.ONE_STR); |
|
|
|
projectSubProcess.setExternalStatusDesc("待处理"); |
|
|
|
projectSubProcess.setInternalStatus(ProjectConstant.PENDING); |
|
|
|
projectSubProcessService.save(projectSubProcess); |
|
|
|
|
|
|
|
//项目节点历时
|
|
|
|
ProjectOrgRelationEntity relationEntity = relationDao.selectByProjectStaffId(formDTO.getProjectStaffId()); |
|
|
|
if(null != relationEntity){ |
|
|
|
ProjectOrgRelationEntity relationDto = new ProjectOrgRelationEntity(); |
|
|
|
relationDto.setProjectStaffId(relationEntity.getProjectStaffId()); |
|
|
|
if(null == relationEntity.getFirstDealtDate()){ |
|
|
|
Date current = new Date(); |
|
|
|
relationDto.setFirstDealtDate(current); |
|
|
|
relationDto.setFirstReplyPeriod(calculateDelta_T(ProjectConstant.IMPRECISE_CALCULATION, |
|
|
|
ProjectConstant.CALCULATION_TYPE_DEFAULT,projectStaff.getId(), |
|
|
|
relationEntity.getInformedDate(),current)); |
|
|
|
relationDto.setOperation(ProjectConstant.OPERATION_RESPONSES); |
|
|
|
relationDao.maintainTimePropertyConsistency(relationDto); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
log.error("com.epmet.service.impl.ProjectServiceImpl#response,没有找到相关的节点耗时记录,参数:{}",JSON.toJSONString(formDTO)); |
|
|
|
throw new RenException("没有找到相关的节点耗时记录"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 第三方平台回调 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2021/3/19 15:12 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void platformCallBack(PlatformCallBackFormDTO formDTO) { |
|
|
|
ProjectSubProcessDTO projectSubProcessDTO = projectSubProcessService.getSubProcessByPlatformId(formDTO.getEventId()); |
|
|
|
projectSubProcessDTO.setExternalStatus(formDTO.getStatus()); |
|
|
|
projectSubProcessDTO.setResult(formDTO.getNote()); |
|
|
|
projectSubProcessDTO.setHandleDate(DateUtils.stringToDate(formDTO.getHandleDate(), DateUtils.DATE_TIME_PATTERN)); |
|
|
|
projectSubProcessDTO.setHandleUserName(formDTO.getHandleUserName()); |
|
|
|
switch (formDTO.getStatus()) { |
|
|
|
case NumConstant.ONE_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("待处理"); |
|
|
|
break; |
|
|
|
case NumConstant.TWO_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("待核实"); |
|
|
|
break; |
|
|
|
case NumConstant.THREE_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("已上报"); |
|
|
|
break; |
|
|
|
case NumConstant.FOUR_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("已完结"); |
|
|
|
projectSubProcessDTO.setInternalStatus(NumConstant.ONE_STR); |
|
|
|
break; |
|
|
|
case NumConstant.FIVE_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("处理中"); |
|
|
|
break; |
|
|
|
case NumConstant.SIX_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("待分发"); |
|
|
|
break; |
|
|
|
case NumConstant.SEVEN_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("归档"); |
|
|
|
break; |
|
|
|
case NumConstant.EIGHT_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("催办"); |
|
|
|
break; |
|
|
|
case NumConstant.NINE_STR: |
|
|
|
projectSubProcessDTO.setExternalStatusDesc("超时"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
projectSubProcessService.save(projectSubProcessDTO); |
|
|
|
//TODO 保存附件
|
|
|
|
} |
|
|
|
|
|
|
|
} |