Browse Source

项目统计

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
ed8018a07c
  1. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProcessInfoDTO.java
  2. 70
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectExtractServiceImpl.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProcessInfoDTO.java

@ -14,6 +14,8 @@ import java.util.Date;
public class ProcessInfoDTO implements Serializable { public class ProcessInfoDTO implements Serializable {
private static final long serialVersionUID = 4586424046147127143L; private static final long serialVersionUID = 4586424046147127143L;
private String agencyId; private String agencyId;
private String departmentId;
private String gridId;
private String projectId; private String projectId;
/** /**
* 处理结案close退回return部门流转transfer创建项目created * 处理结案close退回return部门流转transfer创建项目created

70
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectExtractServiceImpl.java

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

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml

@ -35,7 +35,9 @@
</select> </select>
<select id="selectProcessStaffByCustomer" resultType="com.epmet.dto.project.ProcessInfoDTO"> <select id="selectProcessStaffByCustomer" resultType="com.epmet.dto.project.ProcessInfoDTO">
SELECT SELECT
p.AGENCY_ID, ps.ORG_ID AS "agencyId",
ps.DEPARTMENT_ID,
ps.GRID_ID,
pp.PROJECT_ID, pp.PROJECT_ID,
pp.OPERATION, pp.OPERATION,
ps.STAFF_ID, ps.STAFF_ID,

Loading…
Cancel
Save