Browse Source

项目数据抽取修改

master
zhaoqifeng 5 years ago
parent
commit
a34d7ad044
  1. 199
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java

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

@ -194,10 +194,11 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
} }
} }
final List<FactOriginProjectMainDailyEntity> mainList = list; final List<FactOriginProjectMainDailyEntity> mainList = list;
List<FactOriginProjectLogDailyEntity> logList = new ArrayList<>();
//节点发起人 部门流转退回结案 //节点发起人 部门流转退回结案
List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString); List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString);
if (!CollectionUtils.isEmpty(processList)) { if (!CollectionUtils.isEmpty(processList)) {
List<FactOriginProjectLogDailyEntity> logList = processList.stream().map(process -> { logList = processList.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();
@ -243,67 +244,11 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
return entity; return entity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
}
//节点发起人 响应 //节点发起人 响应
List<ProcessInfoDTO> responseList = projectProcessService.getResponseProcessList(customerId, dateString); List<ProcessInfoDTO> responseList = projectProcessService.getResponseProcessList(customerId, dateString);
if (!CollectionUtils.isEmpty(responseList)) { if (!CollectionUtils.isEmpty(responseList)) {
logList.addAll(responseList.stream().map(process -> { logList.addAll(responseList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE);
entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId());
entity.setPid(process.getAgencyId());
} else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
} else {
if (!process.getPids().contains(StrConstant.COLON)) {
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
} else {
String[] orgArray = process.getPids().split(StrConstant.COLON);
if (orgArray.length > NumConstant.ONE) {
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(), "");
if (path.endsWith(StrConstant.COLON)) {
path = path.substring(NumConstant.ZERO, path.length() - NumConstant.ONE);
}
entity.setPids(path);
} else {
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}", process.getAgencyId(), process.getPids());
entity.setPid(NumConstant.ZERO_STR);
entity.setPids("");
}
}
}
return entity;
}).collect(Collectors.toList()));
}
//项目评论人
List<ProcessInfoDTO> satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString);
satisfactionRecordList.forEach(log -> mainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> {
//进行满意度评价的居民的所属机关的父机机关信息
log.setPid(main.getPid());
log.setPids(main.getPids());
}));
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();
@ -317,67 +262,123 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setOperationUserId(process.getStaffId()); entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation()); entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE); entity.setIsActive(NumConstant.ONE);
entity.setOrgId(process.getGridId());
entity.setOrgType("grid");
entity.setPids(process.getPids());
entity.setPid(process.getPid());
return entity;
}).collect(Collectors.toList()));
//节点接收人
List<ProcessInfoDTO> processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString);
logList.addAll(processStaffList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ZERO);
entity.setPids(process.getPids()); entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) { if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department"); entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId()); entity.setOrgId(process.getDepartmentId());
entity.setPid(process.getAgencyId()); entity.setPid(process.getAgencyId());
}else if (StringUtils.isNotBlank(process.getGridId())) { } else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid"); entity.setOrgType("grid");
entity.setOrgId(process.getGridId()); entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId()); entity.setPid(process.getAgencyId());
}else{ } else {
if(!process.getPids().contains(StrConstant.COLON)){ if (!process.getPids().contains(StrConstant.COLON)) {
entity.setPids(""); entity.setPids("");
entity.setPid(NumConstant.ZERO_STR); entity.setPid(NumConstant.ZERO_STR);
}else{ } else {
String[] orgArray = process.getPids().split(StrConstant.COLON); String[] orgArray = process.getPids().split(StrConstant.COLON);
if(orgArray.length > NumConstant.ONE){ if (orgArray.length > NumConstant.ONE) {
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]); entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),""); String path = process.getPids().replaceAll(process.getAgencyId(), "");
if(path.endsWith(StrConstant.COLON)){ if (path.endsWith(StrConstant.COLON)) {
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE); path = path.substring(NumConstant.ZERO, path.length() - NumConstant.ONE);
} }
entity.setPids(path); entity.setPids(path);
}else{ } else {
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}",process.getAgencyId(),process.getPids()); log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}", process.getAgencyId(), process.getPids());
entity.setPid(NumConstant.ZERO_STR); entity.setPid(NumConstant.ZERO_STR);
entity.setPids(""); entity.setPids("");
} }
} }
} }
return entity; return entity;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
}
if (!logList.isEmpty()) { //项目评论人
factOriginProjectLogDailyService.deleteByDate(customerId, dateString); List<ProcessInfoDTO> satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString);
factOriginProjectLogDailyService.insertBatch(logList);
satisfactionRecordList.forEach(log -> mainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> {
//进行满意度评价的居民的所属机关的父机机关信息
log.setPid(main.getPid());
log.setPids(main.getPids());
}));
logList.addAll(satisfactionRecordList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE);
entity.setOrgId(process.getGridId());
entity.setOrgType("grid");
entity.setPids(process.getPids());
entity.setPid(process.getPid());
return entity;
}).collect(Collectors.toList()));
//节点接收人
List<ProcessInfoDTO> processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString);
logList.addAll(processStaffList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ZERO);
entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId());
entity.setPid(process.getAgencyId());
}else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(StrConstant.COLON)){
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
String[] orgArray = process.getPids().split(StrConstant.COLON);
if(orgArray.length > NumConstant.ONE){
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),"");
if(path.endsWith(StrConstant.COLON)){
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE);
}
entity.setPids(path);
}else{
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}",process.getAgencyId(),process.getPids());
entity.setPid(NumConstant.ZERO_STR);
entity.setPids("");
}
}
} }
return entity;
}).collect(Collectors.toList()));
if (!logList.isEmpty()) {
factOriginProjectLogDailyService.deleteByDate(customerId, dateString);
factOriginProjectLogDailyService.insertBatch(logList);
} }
} }
/** /**

Loading…
Cancel
Save