Browse Source

转其他部门V2、sql脚本

master
sunyuchao 5 years ago
parent
commit
ffa49475fc
  1. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessAttachmentDTO.java
  2. 8
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java
  3. 15
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java
  4. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessAttachmentEntity.java
  5. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectProcessAttachmentExcel.java
  6. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java
  7. 164
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java
  8. 41
      epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.5__create_project_attachment.sql

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessAttachmentDTO.java

@ -89,7 +89,7 @@ public class ProjectProcessAttachmentDTO implements Serializable {
private String attachmentUrl;
/**
* 排序(按文件所属节点的所属位置分组在按文件类型排序)
* 排序(需求确定按上传顺序排序)
*/
private Integer sort;

8
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java

@ -32,5 +32,13 @@ public class TransferFormDTO implements Serializable {
@Valid
private List<TickStaffFormDTO> staffList;
/**
* 公开答复对应文件集合
*/
private List<FileDTO> publicFile;
/**
* 内部备注对应文件集合
*/
private List<FileDTO> internalFile;
}

15
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java

@ -279,5 +279,20 @@ public class ProjectTraceController {
ValidatorUtils.validateEntity(formDTO, ProcessListV2FormDTO.ProcessListV2Form.class);
return new Result<List<ProcessListV2ResultDTO>>().ok(projectTraceService.processListV2(formDTO));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 项目跟踪-转其他部门2.0接口
**/
@PostMapping("transfer-v2")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_TRANSFER)
public Result transferV2(@LoginUser TokenDto tokenDTO, @RequestBody TransferFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
projectProcessService.transferV2(formDTO);
return new Result();
}
}

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessAttachmentEntity.java

@ -89,7 +89,7 @@ public class ProjectProcessAttachmentEntity extends BaseEpmetEntity {
private String attachmentUrl;
/**
* 排序(按文件所属节点的所属位置分组在按文件类型排序)
* 排序(需求确定按上传顺序排序)
*/
private Integer sort;

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectProcessAttachmentExcel.java

@ -64,7 +64,7 @@ public class ProjectProcessAttachmentExcel {
@Excel(name = "url地址")
private String attachmentUrl;
@Excel(name = "排序(按文件所属节点的所属位置分组,在按文件类型排序)")
@Excel(name = "排序(需求确定,按上传顺序排序)")
private Integer sort;
@Excel(name = "语音或视频时长,秒")

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java

@ -151,4 +151,12 @@ public interface ProjectProcessService extends BaseService<ProjectProcessEntity>
**/
List<ProjectOrgRelationWhenResponseResultDTO > selectResponseTrace(List<String> projects);
/**
* @param formDTO
* @return
* @Author sun
* @Description 项目跟踪-转其他部门2.0接口
**/
void transferV2(TransferFormDTO formDTO);
}

164
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java

@ -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);
}
}
}

41
epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.5__create_project_attachment.sql

@ -0,0 +1,41 @@
CREATE TABLE `project_process_attachment` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`PROJECT_ID` varchar(64) NOT NULL COMMENT '项目ID',
`PROCESS_ID` varchar(64) NOT NULL COMMENT '项目进展表ID',
`FILE_PLACE` varchar(64) NOT NULL COMMENT '文件所属位置(内部备注: internal 公开答复:public)',
`FILE_NAME` varchar(255) DEFAULT NULL COMMENT '文件名',
`ATTACHMENT_NAME` varchar(255) DEFAULT NULL COMMENT '附件名(uuid随机生成)',
`ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小',
`ATTACHMENT_FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、JPEG、BMP、GIF、PDF、PPT、PPTX、DOC、DOCX、XLS、XLSX、MP3、WMA、M4A、MP4、AVI、MOV、RMVB、RM、WMV)',
`ATTACHMENT_TYPE` varchar(64) DEFAULT NULL COMMENT '文件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))',
`ATTACHMENT_URL` varchar(255) NOT NULL COMMENT 'url地址',
`SORT` int(11) NOT NULL COMMENT '排序(需求确定,按上传顺序排序)',
`DURATION` int(11) unsigned zerofill DEFAULT '00000000000' COMMENT '语音或视频时长,秒',
`IS_RELEASE` int(1) NOT NULL DEFAULT '0' COMMENT '是否强制发布(0:否 1:是)',
`DEL_FLAG` char(1) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目节点附件表';
CREATE TABLE `project_process_scan_task` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`PROJECT_ID` varchar(64) NOT NULL COMMENT '项目ID',
`PROCESS_ID` varchar(64) NOT NULL COMMENT '项目进展表(project_process)ID',
`PROJECT_PROCESS_ATTACHMENT_ID` varchar(64) NOT NULL COMMENT '项目附件表主键,对应dataId',
`TASK_ID` varchar(64) NOT NULL COMMENT '阿里云审核任务Id',
`STATUS` varchar(32) NOT NULL COMMENT '审核状态【auditing: 审核中;\r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;】',
`ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型(视频 - video、 语音 - voice 文件 - doc)',
`DEL_FLAG` char(1) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目节点附件安全校验任务表';
Loading…
Cancel
Save