|
|
@ -5,6 +5,8 @@ import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.OrgTypeConstant; |
|
|
|
import com.epmet.constant.ProjectConstant; |
|
|
|
import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; |
|
|
|
import com.epmet.dto.ProjectDTO; |
|
|
|
import com.epmet.dto.extract.FactOriginProjectMainDailyDTO; |
|
|
@ -32,10 +34,10 @@ import com.epmet.service.project.ProjectService; |
|
|
|
import com.epmet.service.topic.TopicService; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
@ -86,9 +88,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
if (!CollectionUtils.isEmpty(closedList)) { |
|
|
|
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.getProjectId()); |
|
|
|
entity.setProjectStatus("closed"); |
|
|
|
FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); |
|
|
|
entity.setId(process.getProjectId()); |
|
|
|
entity.setProjectStatus(ProjectConstant.CLOSED); |
|
|
|
entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); |
|
|
|
entity.setUpdatedTime(process.getUpdatedTime()); |
|
|
|
entity.setIsResolved(process.getIsResolved()); |
|
|
@ -194,10 +196,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(); |
|
|
@ -213,11 +216,11 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setIsActive(NumConstant.ONE); |
|
|
|
entity.setPids(process.getPids()); |
|
|
|
if (StringUtils.isNotBlank(process.getDepartmentId())) { |
|
|
|
entity.setOrgType("department"); |
|
|
|
entity.setOrgType(OrgTypeConstant.DEPARTMENT); |
|
|
|
entity.setOrgId(process.getDepartmentId()); |
|
|
|
entity.setPid(process.getAgencyId()); |
|
|
|
}else if (StringUtils.isNotBlank(process.getGridId())) { |
|
|
|
entity.setOrgType("grid"); |
|
|
|
entity.setOrgType(OrgTypeConstant.GRID); |
|
|
|
entity.setOrgId(process.getGridId()); |
|
|
|
entity.setPid(process.getAgencyId()); |
|
|
|
}else{ |
|
|
@ -243,67 +246,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 +264,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.setOrgType(OrgTypeConstant.DEPARTMENT); |
|
|
|
entity.setOrgId(process.getDepartmentId()); |
|
|
|
entity.setPid(process.getAgencyId()); |
|
|
|
}else if (StringUtils.isNotBlank(process.getGridId())) { |
|
|
|
entity.setOrgType("grid"); |
|
|
|
} else if (StringUtils.isNotBlank(process.getGridId())) { |
|
|
|
entity.setOrgType(OrgTypeConstant.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(OrgTypeConstant.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(OrgTypeConstant.DEPARTMENT); |
|
|
|
entity.setOrgId(process.getDepartmentId()); |
|
|
|
entity.setPid(process.getAgencyId()); |
|
|
|
}else if (StringUtils.isNotBlank(process.getGridId())) { |
|
|
|
entity.setOrgType(OrgTypeConstant.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); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -404,21 +407,21 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
dest.setOrgType("dept"); |
|
|
|
dest.setPid(original.getOrgId()); |
|
|
|
dest.setPids(original.getOrgIdPath()); |
|
|
|
}else if(StringUtils.isNotBlank(original.getGridId())){ |
|
|
|
dest.setOrgType("grid"); |
|
|
|
}else if(StringUtils.isNotBlank(original.getGridId())) { |
|
|
|
dest.setOrgType(OrgTypeConstant.GRID); |
|
|
|
dest.setPid(original.getOrgId()); |
|
|
|
dest.setPids(original.getOrgIdPath()); |
|
|
|
}else{ |
|
|
|
dest.setOrgType("agency"); |
|
|
|
}else { |
|
|
|
dest.setOrgType(OrgTypeConstant.AGENCY); |
|
|
|
dest.setPids(""); |
|
|
|
String[] array = original.getOrgIdPath().split(StrConstant.COLON); |
|
|
|
if(array.length <= NumConstant.ZERO){ |
|
|
|
if (array.length <= NumConstant.ZERO) { |
|
|
|
dest.setPid(NumConstant.ZERO_STR); |
|
|
|
} |
|
|
|
if(array[NumConstant.ZERO].equals(original.getOrgId()) && array.length == NumConstant.ONE){ |
|
|
|
if (array[NumConstant.ZERO].equals(original.getOrgId()) && array.length == NumConstant.ONE) { |
|
|
|
dest.setPid(NumConstant.ZERO_STR); |
|
|
|
} |
|
|
|
if(array.length > NumConstant.ONE && original.getOrgId().equals(array[array.length - NumConstant.ONE])){ |
|
|
|
if (array.length > NumConstant.ONE && original.getOrgId().equals(array[array.length - NumConstant.ONE])) { |
|
|
|
dest.setPid(array[array.length - NumConstant.TWO]); |
|
|
|
dest.setPids(original.getOrgIdPath().replace(original.getOrgId(),"")); |
|
|
|
} |
|
|
@ -456,7 +459,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
*/ |
|
|
|
private Integer getDetentionDays(String id, Date startDate, Date endDate) { |
|
|
|
int result; |
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
|
|
|
|
List<WorkDayFormDTO> list = new ArrayList<>(); |
|
|
|
WorkDayFormDTO workDayFormDTO = new WorkDayFormDTO(); |
|
|
|