|
|
@ -30,6 +30,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 lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -48,6 +49,7 @@ import java.util.stream.Collectors; |
|
|
|
* @date 2020/9/15 14:00 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
|
|
|
|
@Autowired |
|
|
@ -73,6 +75,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
public void saveOriginProjectDaily(ExtractFormDTO extractFormDTO) { |
|
|
|
String dateString = extractFormDTO.getDateId(); |
|
|
|
String customerId = extractFormDTO.getCustomerId(); |
|
|
|
List<FactOriginProjectMainDailyEntity> list = new LinkedList<>(); |
|
|
|
//获取已关闭项目列表
|
|
|
|
List<ProjectProcessEntity> closedList = projectProcessService.getClosedProjectList(customerId, dateString); |
|
|
|
List<FactOriginProjectMainDailyDTO> pendingList = factOriginProjectMainDailyService.getPendingList(customerId); |
|
|
@ -117,7 +120,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
//获取网格认证党员
|
|
|
|
List<PartyMemberDTO> partyMemberList = partyMemberService.getPartyMemberByCustomer(customerId); |
|
|
|
//生成DTO
|
|
|
|
List<FactOriginProjectMainDailyEntity> list = projectList.stream().map(project -> { |
|
|
|
list = projectList.stream().map(project -> { |
|
|
|
//获取日期相关维度
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(project.getCreatedTime()); |
|
|
|
FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); |
|
|
@ -133,11 +136,14 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setProjectStatus(project.getStatus()); |
|
|
|
entity.setCreatedTime(project.getCreatedTime()); |
|
|
|
entity.setUpdatedTime(project.getUpdatedTime()); |
|
|
|
entity.setPids(project.getOrgIdPath()); |
|
|
|
String[] pIds = project.getOrgIdPath().split(":"); |
|
|
|
if (pIds.length > 1) { |
|
|
|
entity.setPid(pIds[pIds.length - 2]); |
|
|
|
} else { |
|
|
|
} else if(pIds.length == 1){ |
|
|
|
entity.setPid(pIds[0]); |
|
|
|
} else { |
|
|
|
entity.setPid(NumConstant.ZERO_STR); |
|
|
|
} |
|
|
|
entity.setIsParty(NumConstant.ZERO_STR); |
|
|
|
entity.setIsOverdue(NumConstant.ZERO_STR); |
|
|
@ -168,7 +174,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
factOriginProjectMainDailyService.insertBatch(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
final List<FactOriginProjectMainDailyEntity> mainList = list; |
|
|
|
//节点发起人
|
|
|
|
List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString); |
|
|
|
if (null != processList && !processList.isEmpty()) { |
|
|
@ -186,12 +192,47 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setOperationUserId(process.getStaffId()); |
|
|
|
entity.setActionCode(process.getOperation()); |
|
|
|
entity.setIsActive(NumConstant.ONE); |
|
|
|
entity.setOrgType("grid"); |
|
|
|
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(":")){ |
|
|
|
entity.setPids(""); |
|
|
|
entity.setPid(NumConstant.ZERO_STR); |
|
|
|
}else{ |
|
|
|
String[] orgArray = process.getPids().split(":"); |
|
|
|
if(null != orgArray && orgArray.length > NumConstant.ONE){ |
|
|
|
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]); |
|
|
|
String path = process.getPids().replaceAll(process.getAgencyId(),""); |
|
|
|
if(path.endsWith(":")){ |
|
|
|
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()); |
|
|
@ -206,14 +247,13 @@ 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<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); |
|
|
@ -231,13 +271,34 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
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()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(process.getGridId())) { |
|
|
|
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(":")){ |
|
|
|
entity.setPids(""); |
|
|
|
entity.setPid(NumConstant.ZERO_STR); |
|
|
|
}else{ |
|
|
|
String[] orgArray = process.getPids().split(":"); |
|
|
|
if(null != orgArray && orgArray.length > NumConstant.ONE){ |
|
|
|
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]); |
|
|
|
String path = process.getPids().replaceAll(process.getAgencyId(),""); |
|
|
|
if(path.endsWith(":")){ |
|
|
|
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())); |
|
|
|