|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.epmet.service.evaluationindex.extract.todata.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
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; |
|
|
@ -71,6 +72,8 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
@Autowired |
|
|
|
private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; |
|
|
|
|
|
|
|
private final static String ONE_DAY = "<1"; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveOriginProjectDaily(ExtractOriginFormDTO extractOriginFormDTO) { |
|
|
|
String dateString = extractOriginFormDTO.getDateId(); |
|
|
@ -80,7 +83,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
List<ProjectProcessEntity> closedList = projectProcessService.getClosedProjectList(customerId, dateString); |
|
|
|
List<FactOriginProjectMainDailyDTO> pendingList = factOriginProjectMainDailyService.getPendingList(customerId); |
|
|
|
List<FinishOrgDTO> finishOrgList = projectProcessService.getFinishOrg(customerId, dateString); |
|
|
|
if (null != closedList && !closedList.isEmpty()) { |
|
|
|
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(); |
|
|
@ -92,9 +95,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
return entity; |
|
|
|
})).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (null != finishOrgList && !finishOrgList.isEmpty()) { |
|
|
|
if (CollectionUtils.isEmpty(finishOrgList)) { |
|
|
|
closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { |
|
|
|
String[] orgIds = dto.getPIdPath().split(":"); |
|
|
|
String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); |
|
|
|
if (orgIds.length > NumConstant.ONE) { |
|
|
|
close.setFinishOrgIds(orgIds[orgIds.length - 1]); |
|
|
|
} else { |
|
|
@ -109,7 +112,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
} |
|
|
|
//获取项目信息
|
|
|
|
List<ProjectDTO> projectList = projectService.getProjectInfo(customerId, dateString); |
|
|
|
if (null != projectList && !projectList.isEmpty()) { |
|
|
|
if (CollectionUtils.isEmpty(projectList)) { |
|
|
|
//提取议题ID
|
|
|
|
List<String> issueIds = projectList.stream().map(ProjectDTO::getOriginId).collect(Collectors.toList()); |
|
|
|
//获取议题信息
|
|
|
@ -139,7 +142,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setCreatedTime(project.getCreatedTime()); |
|
|
|
entity.setUpdatedTime(project.getUpdatedTime()); |
|
|
|
entity.setPids(project.getOrgIdPath()); |
|
|
|
String[] pIds = project.getOrgIdPath().split(":"); |
|
|
|
String[] pIds = project.getOrgIdPath().split(StrConstant.COLON); |
|
|
|
if (pIds.length > 1) { |
|
|
|
entity.setPid(pIds[pIds.length - 2]); |
|
|
|
} else if(pIds.length == 1){ |
|
|
@ -163,7 +166,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setIsParty(NumConstant.ONE_STR); |
|
|
|
})); |
|
|
|
list.forEach(entity -> finishOrgList.stream().filter(finish -> entity.getId().equals(finish.getProjectId())).forEach(dto -> { |
|
|
|
String[] orgIds = dto.getPIdPath().split(":"); |
|
|
|
String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); |
|
|
|
if (orgIds.length > NumConstant.ONE) { |
|
|
|
entity.setFinishOrgIds(orgIds[orgIds.length - 1]); |
|
|
|
} else { |
|
|
@ -179,7 +182,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
final List<FactOriginProjectMainDailyEntity> mainList = list; |
|
|
|
//节点发起人
|
|
|
|
List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString); |
|
|
|
if (null != processList && !processList.isEmpty()) { |
|
|
|
if (CollectionUtils.isEmpty(processList)) { |
|
|
|
List<FactOriginProjectLogDailyEntity> logList = processList.stream().map(process -> { |
|
|
|
//获取日期相关维度
|
|
|
|
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime()); |
|
|
@ -204,15 +207,15 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setOrgId(process.getGridId()); |
|
|
|
entity.setPid(process.getAgencyId()); |
|
|
|
}else{ |
|
|
|
if(!process.getPids().contains(":")){ |
|
|
|
if(!process.getPids().contains(StrConstant.COLON)){ |
|
|
|
entity.setPids(""); |
|
|
|
entity.setPid(NumConstant.ZERO_STR); |
|
|
|
}else{ |
|
|
|
String[] orgArray = process.getPids().split(":"); |
|
|
|
if(null != orgArray && orgArray.length > NumConstant.ONE){ |
|
|
|
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(":")){ |
|
|
|
if(path.endsWith(StrConstant.COLON)){ |
|
|
|
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE); |
|
|
|
} |
|
|
|
entity.setPids(path); |
|
|
@ -283,15 +286,15 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
entity.setOrgId(process.getGridId()); |
|
|
|
entity.setPid(process.getAgencyId()); |
|
|
|
}else{ |
|
|
|
if(!process.getPids().contains(":")){ |
|
|
|
if(!process.getPids().contains(StrConstant.COLON)){ |
|
|
|
entity.setPids(""); |
|
|
|
entity.setPid(NumConstant.ZERO_STR); |
|
|
|
}else{ |
|
|
|
String[] orgArray = process.getPids().split(":"); |
|
|
|
if(null != orgArray && orgArray.length > NumConstant.ONE){ |
|
|
|
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(":")){ |
|
|
|
if(path.endsWith(StrConstant.COLON)){ |
|
|
|
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE); |
|
|
|
} |
|
|
|
entity.setPids(path); |
|
|
@ -322,7 +325,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
@Override |
|
|
|
public void extractProjectPeriodData(ExtractOriginFormDTO param) { |
|
|
|
int trace = factOriginProjectOrgPeriodDailyDao.selectIfExisted(param.getCustomerId()); |
|
|
|
Boolean isFirst = trace <= NumConstant.ZERO ? true : false; |
|
|
|
Boolean isFirst = trace <= NumConstant.ZERO; |
|
|
|
if (StringUtils.isBlank(param.getDateId())) { |
|
|
|
Date yesterday = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
@ -345,23 +348,23 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
}else{ |
|
|
|
dest.setOrgType("agency"); |
|
|
|
dest.setPids(""); |
|
|
|
String[] array = original.getOrgIdPath().split(":"); |
|
|
|
if(null == array || array.length <= NumConstant.ZERO){ |
|
|
|
String[] array = original.getOrgIdPath().split(StrConstant.COLON); |
|
|
|
if(array.length <= NumConstant.ZERO){ |
|
|
|
dest.setPid(NumConstant.ZERO_STR); |
|
|
|
} |
|
|
|
if(array[NumConstant.ZERO] == 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() == 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(),"")); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(dest.getPids())){ |
|
|
|
while(dest.getPids().endsWith(":")){ |
|
|
|
while(dest.getPids().endsWith(StrConstant.COLON)){ |
|
|
|
dest.setPids(dest.getPids().substring(NumConstant.ZERO,dest.getPids().length() - NumConstant.ONE)); |
|
|
|
} |
|
|
|
while(dest.getPids().startsWith(":")){ |
|
|
|
dest.setPids(dest.getPids().replaceFirst(":","")); |
|
|
|
while(dest.getPids().startsWith(StrConstant.COLON)){ |
|
|
|
dest.setPids(dest.getPids().replaceFirst(StrConstant.COLON,"")); |
|
|
|
} |
|
|
|
} |
|
|
|
dest.setPids(dest.getPids().replaceAll(" ","")); |
|
|
@ -400,13 +403,29 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
list.add(workDayFormDTO); |
|
|
|
Result<List<WorkDayResultDTO>> detentionDays = epmetCommonServiceOpenFeignClient.detentionDays(list); |
|
|
|
String days = detentionDays.getData().get(NumConstant.ZERO).getDetentionDays(); |
|
|
|
if (("<1").equals(days)) { |
|
|
|
result = 1; |
|
|
|
if (ONE_DAY.equals(days)) { |
|
|
|
result = NumConstant.ONE; |
|
|
|
} else { |
|
|
|
result = Integer.parseInt(days); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 客户配置的可滞留时间,没有的话默认5天 |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/9/28 10:27 |
|
|
|
* @param customerId |
|
|
|
* @return java.lang.Integer |
|
|
|
*/ |
|
|
|
private Integer getDays(String customerId) { |
|
|
|
String value = projectService.getParameterValueByKey(customerId); |
|
|
|
Integer days = NumConstant.FIVE; |
|
|
|
if (StringUtils.isNotBlank(value)) { |
|
|
|
days = Integer.valueOf(value); |
|
|
|
} |
|
|
|
return days; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|