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;
List<FactOriginProjectLogDailyEntity> logList = new ArrayList<>();
//节点发起人 部门流转退回结案
List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString);
if (!CollectionUtils.isEmpty(processList)) {
List<FactOriginProjectLogDailyEntity> logList = processList.stream().map(process -> {
logList = processList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
@ -243,67 +244,11 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
return entity;
}).collect(Collectors.toList());
//节点发起人 响应
List<ProcessInfoDTO> responseList = projectProcessService.getResponseProcessList(customerId, dateString);
if (!CollectionUtils.isEmpty(responseList)) {
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 -> {
}
//节点发起人 响应
List<ProcessInfoDTO> responseList = projectProcessService.getResponseProcessList(customerId, dateString);
if (!CollectionUtils.isEmpty(responseList)) {
logList.addAll(responseList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
@ -317,67 +262,123 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
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())) {
} else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(StrConstant.COLON)){
} else {
if (!process.getPids().contains(StrConstant.COLON)) {
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
} else {
String[] orgArray = process.getPids().split(StrConstant.COLON);
if(orgArray.length > NumConstant.ONE){
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);
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());
} 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);
//项目评论人
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());
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