|
|
@ -24,6 +24,7 @@ import com.epmet.service.project.ProjectProcessService; |
|
|
|
import com.epmet.service.project.ProjectService; |
|
|
|
import com.epmet.service.topic.TopicService; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -68,18 +69,20 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
//获取已关闭项目列表
|
|
|
|
List<ProjectProcessEntity> closedList = projectProcessService.getClosedProjectList(customerId, dateString); |
|
|
|
List<FactOriginProjectMainDailyDTO> pendingList = factOriginProjectMainDailyService.getPendingList(customerId); |
|
|
|
List<FactOriginProjectMainDailyEntity> closeProjects = |
|
|
|
pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { |
|
|
|
FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); |
|
|
|
entity.setId(process.getId()); |
|
|
|
entity.setProjectStatus("close"); |
|
|
|
entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); |
|
|
|
entity.setUpdatedTime(process.getUpdatedTime()); |
|
|
|
return entity; |
|
|
|
})).collect(Collectors.toList()); |
|
|
|
//更新状态
|
|
|
|
if (null != closeProjects && !closeProjects.isEmpty()) { |
|
|
|
factOriginProjectMainDailyService.updateBatchById(closeProjects); |
|
|
|
if (null != closedList && !closedList.isEmpty()) { |
|
|
|
List<FactOriginProjectMainDailyEntity> closeProjects = |
|
|
|
pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { |
|
|
|
FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); |
|
|
|
entity.setId(process.getId()); |
|
|
|
entity.setProjectStatus("close"); |
|
|
|
entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); |
|
|
|
entity.setUpdatedTime(process.getUpdatedTime()); |
|
|
|
return entity; |
|
|
|
})).collect(Collectors.toList()); |
|
|
|
//更新状态
|
|
|
|
if (!closeProjects.isEmpty()) { |
|
|
|
factOriginProjectMainDailyService.updateBatchById(closeProjects); |
|
|
|
} |
|
|
|
} |
|
|
|
//获取项目信息
|
|
|
|
List<ProjectDTO> projectList = projectService.getProjectInfo(customerId, dateString); |
|
|
@ -133,7 +136,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setIsParty(NumConstant.ONE_STR); |
|
|
|
})); |
|
|
|
//插入数据
|
|
|
|
factOriginProjectMainDailyService.insertBatch(list); |
|
|
|
if (!list.isEmpty()) { |
|
|
|
factOriginProjectMainDailyService.insertBatch(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//节点发起人
|
|
|
@ -157,9 +162,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
return entity; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//节点接收人
|
|
|
|
List<ProcessInfoDTO> processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString); |
|
|
|
logList.addAll(processStaffList.stream().map(process -> { |
|
|
|
//项目评论人
|
|
|
|
List<ProcessInfoDTO> satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString); |
|
|
|
logList.addAll(satisfactionRecordList.stream().map(process -> { |
|
|
|
//获取日期相关维度
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime()); |
|
|
|
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity(); |
|
|
@ -172,14 +177,19 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setProjectId(process.getProjectId()); |
|
|
|
entity.setOperationUserId(process.getStaffId()); |
|
|
|
entity.setActionCode(process.getOperation()); |
|
|
|
entity.setIsActive(NumConstant.ZERO); |
|
|
|
entity.setIsActive(NumConstant.ONE); |
|
|
|
entity.setOrgType("grid"); |
|
|
|
return entity; |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
|
|
//项目评论人
|
|
|
|
List<ProcessInfoDTO> satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString); |
|
|
|
logList.addAll(satisfactionRecordList.stream().map(process -> { |
|
|
|
List<FactOriginProjectMainDailyDTO> projectMainList = factOriginProjectMainDailyService.getProjectByCustomer(customerId); |
|
|
|
logList.forEach(log -> projectMainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> { |
|
|
|
log.setOrgId(main.getGridId()); |
|
|
|
})); |
|
|
|
|
|
|
|
//节点接收人
|
|
|
|
List<ProcessInfoDTO> processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString); |
|
|
|
logList.addAll(processStaffList.stream().map(process -> { |
|
|
|
//获取日期相关维度
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime()); |
|
|
|
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity(); |
|
|
@ -192,17 +202,21 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setProjectId(process.getProjectId()); |
|
|
|
entity.setOperationUserId(process.getStaffId()); |
|
|
|
entity.setActionCode(process.getOperation()); |
|
|
|
entity.setIsActive(NumConstant.ONE); |
|
|
|
entity.setOrgType("grid"); |
|
|
|
entity.setIsActive(NumConstant.ZERO); |
|
|
|
if (StringUtils.isNotBlank(process.getDepartmentId())) { |
|
|
|
entity.setOrgType("department"); |
|
|
|
entity.setOrgId(process.getDepartmentId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(process.getGridId())) { |
|
|
|
entity.setOrgType("grid"); |
|
|
|
entity.setOrgId(process.getGridId()); |
|
|
|
} |
|
|
|
return entity; |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
|
|
List<FactOriginProjectMainDailyDTO> projectMainList = factOriginProjectMainDailyService.getProjectByCustomer(customerId); |
|
|
|
logList.forEach(log -> projectMainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> { |
|
|
|
log.setOrgId(main.getGridId()); |
|
|
|
})); |
|
|
|
|
|
|
|
factOriginProjectLogDailyService.insertBatch(logList); |
|
|
|
if (!logList.isEmpty()) { |
|
|
|
factOriginProjectLogDailyService.insertBatch(logList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|