|
|
@ -1,8 +1,10 @@ |
|
|
|
package com.epmet.service.evaluationindex.extract.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; |
|
|
|
import com.epmet.dto.ProjectDTO; |
|
|
|
import com.epmet.dto.extract.FactOriginProjectMainDailyDTO; |
|
|
|
import com.epmet.dto.extract.form.ExtractFormDTO; |
|
|
@ -10,10 +12,12 @@ import com.epmet.dto.form.WorkDayFormDTO; |
|
|
|
import com.epmet.dto.issue.IssueDTO; |
|
|
|
import com.epmet.dto.party.PartyMemberDTO; |
|
|
|
import com.epmet.dto.project.ProcessInfoDTO; |
|
|
|
import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; |
|
|
|
import com.epmet.dto.result.WorkDayResultDTO; |
|
|
|
import com.epmet.dto.topic.ResiTopicDTO; |
|
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectLogDailyEntity; |
|
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; |
|
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; |
|
|
|
import com.epmet.entity.project.ProjectProcessEntity; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.service.Issue.IssueService; |
|
|
@ -28,10 +32,12 @@ import com.epmet.util.DimIdGenerator; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.LinkedList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -59,7 +65,8 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
private ProjectProcessService projectProcessService; |
|
|
|
@Autowired |
|
|
|
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveOriginProjectDaily(ExtractFormDTO extractFormDTO) { |
|
|
@ -219,6 +226,72 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 抽取项目节点历时逻辑 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.09.17 14:05 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void extractProjectPeriodData(ExtractFormDTO param) { |
|
|
|
int trace = factOriginProjectOrgPeriodDailyDao.selectIfExisted(param.getCustomerId()); |
|
|
|
Boolean isFirst = trace <= NumConstant.ZERO ? true : false; |
|
|
|
if(StringUtils.isBlank(param.getDateId())){ |
|
|
|
Date yesterday = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
param.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
List<ProjectOrgPeriodResultDTO> extractData = |
|
|
|
projectProcessService.getProjectPeriod(isFirst,param.getCustomerId(),param.getDateId()); |
|
|
|
List<FactOriginProjectOrgPeriodDailyEntity> formattingData = new LinkedList<>(); |
|
|
|
extractData.forEach(original -> { |
|
|
|
FactOriginProjectOrgPeriodDailyEntity dest |
|
|
|
= ConvertUtils.sourceToTarget(original,FactOriginProjectOrgPeriodDailyEntity.class); |
|
|
|
if(StringUtils.isNotBlank(original.getDepartmentId())){ |
|
|
|
dest.setOrgType("dept"); |
|
|
|
dest.setPid(original.getOrgId()); |
|
|
|
dest.setPids(original.getOrgIdPath()); |
|
|
|
}else if(StringUtils.isNotBlank(original.getGridId())){ |
|
|
|
dest.setOrgType("grid"); |
|
|
|
dest.setPid(original.getOrgId()); |
|
|
|
dest.setPids(original.getOrgIdPath()); |
|
|
|
}else{ |
|
|
|
dest.setOrgType("agency"); |
|
|
|
dest.setPids(""); |
|
|
|
String[] array = original.getOrgIdPath().split(":"); |
|
|
|
if(null == array || array.length <= NumConstant.ZERO){ |
|
|
|
dest.setPid(NumConstant.ZERO_STR); |
|
|
|
} |
|
|
|
if(array[NumConstant.ZERO] == original.getOrgId() && array.length == NumConstant.ONE){ |
|
|
|
dest.setPid(NumConstant.ZERO_STR); |
|
|
|
} |
|
|
|
if(array.length > NumConstant.ONE && original.getOrgId() == 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(":")){ |
|
|
|
dest.setPids(dest.getPids().substring(NumConstant.ZERO,dest.getPids().length() - NumConstant.ONE)); |
|
|
|
} |
|
|
|
while(dest.getPids().startsWith(":")){ |
|
|
|
dest.setPids(dest.getPids().replaceFirst(":","")); |
|
|
|
} |
|
|
|
} |
|
|
|
dest.setPids(dest.getPids().replaceAll(" ","")); |
|
|
|
} |
|
|
|
|
|
|
|
formattingData.add(dest); |
|
|
|
}); |
|
|
|
if(!CollectionUtils.isEmpty(formattingData)) { |
|
|
|
List<String> projectIds = formattingData.stream().map(FactOriginProjectOrgPeriodDailyEntity::getProjectId).distinct().collect(Collectors.toList()); |
|
|
|
if (!CollectionUtils.isEmpty(projectIds)) { |
|
|
|
factOriginProjectOrgPeriodDailyDao.deleteByProjectId(projectIds); |
|
|
|
factOriginProjectOrgPeriodDailyDao.insertBatch(formattingData); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 工作日计算 |
|
|
|