Browse Source

Merge remote-tracking branch 'origin/develop' into release_temp

master
yinzuomei 4 years ago
parent
commit
eeb775d89c
  1. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectDao.java
  2. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  3. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml
  4. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  5. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  6. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java
  8. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  9. 28
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java
  10. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
  11. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  12. 18
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
  13. 4
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectDao.java

@ -55,7 +55,7 @@ public interface PrUserProjectDao extends BaseDao<PrUserProjectEntity> {
* @author zxc
* @date 2021/9/17 2:16 下午
*/
List<String> selectProjectKey(@Param("orgIds")List<String> orgIds);
List<String> selectProjectKey(@Param("orgIds")List<String> orgIds,@Param("customerId")String customerId);
/**
* @Description 根据keys查询project

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java

@ -209,7 +209,7 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
orgIds.add(oneOrg);
}
// 根据orgIds查询 问卷调查的key
List<String> projectKeys = baseDao.selectProjectKey(orgIds);
List<String> projectKeys = baseDao.selectProjectKey(orgIds,formDTO.getCustomerId());
if (CollectionUtils.isEmpty(projectKeys)){
return new ArrayList<>();
}

1
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml

@ -73,6 +73,7 @@
DISTINCT project_key
FROM pr_publish_range
WHERE del_flag = 0
AND customer_id = #{customerId}
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
#{orgId} LIKE CONCAT(org_ids,'%')

44
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -61,6 +61,7 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException;
@ -865,11 +866,36 @@ public class DemoController {
return new Result();
}
/**
* screen_project_datascreen_project_processscreen_project_img_data
*
* @param param 不传客户id,执行dim中所有有效客户
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @date 2021/10/12 5:54 下午
*/
@PostMapping("project-test")
public Result project(@RequestBody ScreenCentralZoneDataFormDTO param){
screenProjectSettleService.extractScreenData(param);
public Result project(@RequestBody ScreenCentralZoneDataFormDTO param) {
if(StringUtils.isBlank(param.getDateId())){
//默认截止到昨天。
param.setDateId(DateUtils.getBeforeNDay(1));
}
List<String> customerIds = new ArrayList();
if (StringUtils.isNotBlank(param.getCustomerId())) {
customerIds.add(param.getCustomerId());
} else {
customerIds = dimCustomerService.selectCustomerIdPage(1, 100);
}
for (String customerId : customerIds) {
ScreenCentralZoneDataFormDTO formDTO = new ScreenCentralZoneDataFormDTO();
formDTO.setCustomerId(customerId);
formDTO.setDateId(param.getDateId());
screenProjectSettleService.extractScreenData(param);
log.error(String.format("/data/stats/demo/project-test,screen_project_**表抽取完毕,customerId:%s", customerId));
}
return new Result();
}
public static void main(String[] args) {
List<String> monthIds = DateUtils.getMonthBetween("202001","202012");
for(String monthId:monthIds){
@ -899,7 +925,19 @@ public class DemoController {
**/
@PostMapping("extractProjectCategory")
public Result extractProjectCategory(@RequestBody ExtractOriginFormDTO formDTO){
originProjectCategoryDailyService.extractProjectCategory(formDTO);
List<String> customerIds = new ArrayList();
if (StringUtils.isNotBlank(formDTO.getCustomerId())) {
customerIds.add(formDTO.getCustomerId());
} else {
customerIds = dimCustomerService.selectCustomerIdPage(1, 100);
}
for (String customerId : customerIds) {
ExtractOriginFormDTO paramDTO = new ExtractOriginFormDTO();
paramDTO.setCustomerId(customerId);
paramDTO.setDateId(formDTO.getDateId());
originProjectCategoryDailyService.extractProjectCategory(paramDTO);
log.error(String.format("/data/stats/demo/extractProjectCategory,fact_origin_project_category_daily表抽取完毕,customerId:%s", customerId));
}
return new Result();
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java

@ -139,6 +139,7 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
List<com.epmet.dto.ProjectCategoryDTO> getProjectCategoryData(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<com.epmet.dto.ProjectCategoryDTO> selectProjectCategoryData(@Param("customerId") String customerId, @Param("dateId") String dateId);
/**
* 获取项目满意度
*

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.dto.extract.result.SatisfactionInfoResultDTO;
import com.epmet.dto.issue.*;
import com.epmet.entity.issue.IssueEntity;
import com.epmet.service.Issue.IssueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -26,6 +27,7 @@ import java.util.Set;
* @dscription
* @date 2020/6/17 16:02
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.GOV_ISSUE)
public class IssueServiceImpl implements IssueService {
@ -162,8 +164,11 @@ public class IssueServiceImpl implements IssueService {
List<IssueProjectCategoryDictDTO> categories = statsIssueDao.selectCategory(customerId, categoryIds);
if(!CollectionUtils.isEmpty(categories)){
StringBuilder str = new StringBuilder();
categories.forEach(category -> {str.append(category.getCategoryName()).append(StrConstant.COMMA);});
map.put(projectId,str.substring(NumConstant.ZERO,str.length() - NumConstant.TWO));
categories.forEach(category -> {
str.append(category.getCategoryName()).append(StrConstant.COMMA);
//log.info(str.toString());
});
map.put(projectId,str.substring(NumConstant.ZERO,str.length() - NumConstant.ONE));
}
});

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java

@ -74,7 +74,9 @@ public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl<F
if (NumConstant.ZERO == count){
dateString = null;
}
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(customerId, dateString);
// 原来一个项目有多个分类,现在几个分类可能会对上同一个省里的编码,所以去重一下,插入到fact_origin_project_category表
// List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(customerId, dateString);
List<ProjectCategoryDTO> projectCategoryData = projectService.queryProjectCategoryData(customerId, dateString);
HashSet<String> projectIdSet=new HashSet<>();
if (!CollectionUtils.isEmpty(projectCategoryData)){
projectCategoryData.forEach(data->{

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java

@ -249,8 +249,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
//项目分类数据 todo 暂时查询所有
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null);
//key projectId:categoryCode Set
Map<String, List<String>> projectCategoryMap = projectCategoryData.stream()
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toList())));
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream()
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet())));
//2.获取项目的所有节点耗时数据
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param);
@ -370,15 +370,15 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
* @param categoryList
* @param projectCategoryMap
*/
private void setCategoryInfo(ScreenDifficultyDataEntity diffEntity, String projectId, List<IssueProjectCategoryDictEntity> categoryList, Map<String, List<String>> projectCategoryMap) {
List<String> categorySet = projectCategoryMap.get(projectId);
private void setCategoryInfo(ScreenDifficultyDataEntity diffEntity, String projectId, List<IssueProjectCategoryDictEntity> categoryList, Map<String, Set<String>> projectCategoryMap) {
Set<String> categorySet = projectCategoryMap.get(projectId);
if (CollectionUtils.isEmpty(categorySet)) {
return;
}
projectCategoryMap.forEach((k, v) -> {
StringBuilder code = new StringBuilder();
StringBuilder name = new StringBuilder();
v.forEach(categoryCode -> {
StringBuilder code = new StringBuilder();
StringBuilder name = new StringBuilder();
//projectCategoryMap.forEach((k, v) -> {
categorySet.forEach(categoryCode -> {
List<IssueProjectCategoryDictEntity> childCategory = new ArrayList<>();
getParentNode(childCategory, categoryList, categoryCode);
String categoryCodes = childCategory.stream().map(IssueProjectCategoryDictEntity::getCategoryCode).collect(Collectors.joining(StrConstant.HYPHEN));
@ -389,12 +389,11 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
});
code.deleteCharAt(code.length() - NumConstant.ONE);
name.deleteCharAt(name.length() - NumConstant.ONE);
diffEntity.setEventCategoryCode(code.toString());
diffEntity.setEventCategoryName(name.toString());
log.debug("code:{}",code.toString());
log.debug("name:{}",name.toString());
});
//});
diffEntity.setEventCategoryCode(code.toString());
diffEntity.setEventCategoryName(name.toString());
}
/**

28
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java

@ -41,7 +41,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
@Autowired
private ScreenProjectDataService targetDbService;
private ScreenProjectDataService screenProjectDataService;
@Autowired
private FactOriginProjectMainDailyService originMainService;
@Autowired
@ -55,9 +55,9 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
@Autowired
private IssueService issueService;
@Autowired
private ScreenProjectProcessService targetProcessService;
private ScreenProjectProcessService screenProjectProcessService;
@Autowired
private ScreenProjectImgDataService targetImgService;
private ScreenProjectImgDataService screenProjectImgDataService;
@Autowired
private ScreenProjectProcessAttachmentService targetAttachmentService;
@ -71,7 +71,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
@Override
public void extractScreenData(ScreenCentralZoneDataFormDTO param) {
//screen_project_data表是否存在此客户数据
int rows = targetDbService.checkIfExisted(param.getCustomerId());
int rows = screenProjectDataService.checkIfExisted(param.getCustomerId());
List<ScreenProjectDataDTO> metaData =
originMainService.initNewScreenProjectData(param.getCustomerId(), rows , param.getDateId());
@ -119,7 +119,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
orientCase.setCustomerId(param.getCustomerId());
//待更新的数据 需要检测更新的字段为:①projectStatusCode ②closeCaseTime ③allCategoryName ④projectLevel
List<ScreenProjectDataDTO> orientData =
targetDbService.getPending(orientCase,param.getDateId());
screenProjectDataService.getPending(orientCase,param.getDateId());
// 给metaData和orientData赋上分类信息
List<String> projectIds =
@ -127,6 +127,8 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
if(!CollectionUtils.isEmpty(orientData)) {
projectIds.addAll(orientData.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList()));
}
projectIds.clear();
projectIds.add("18759f2fb5c5fb8513c4a21b0be81834");
Map<String, Set<String>> categoryMap = projectService.getProjectCategory(projectIds);
if(!CollectionUtils.isEmpty(categoryMap)){
Map<String, String> integratedProjectCategoryMap = issueService.getIntegratedProjectCategory(categoryMap, param.getCustomerId());
@ -139,7 +141,9 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
});
}
}
if(projectIds.contains("4f670b349899b33c20e888e77842d938")){
return;
}
//重新计算orientData的级别 有现成的方法 fact_origin_project_org_period_daily
// originMainService.computerIfExceed(orientData, exceedLimit,about2ExceedLimit);
//todo 与上面重复处理 暂时注释掉
@ -148,20 +152,20 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
//更新结案时间和结案状态
processService.updateProjectStatus(orientData,param.getDateId(),param.getCustomerId());
targetDbService.insertOrUpdateBatch(param.getCustomerId(),param.getDateId(),metaData,orientData);
screenProjectDataService.insertOrUpdateBatch(param.getCustomerId(),param.getDateId(),metaData,orientData);
if(!CollectionUtils.isEmpty(metaData)){
List<ScreenProjectImgDataDTO> imgs = topicService.buildNewScreenProjectImgData(metaData);
if(!CollectionUtils.isEmpty(imgs)){
targetImgService.insertBatch(imgs);
screenProjectImgDataService.insertBatch(imgs);
}
}
//
List<ScreenProjectProcessDTO> processes = processService.buildNewScreenProjectProcessData(param.getCustomerId(), param.getDateId(),!targetProcessService.checkIfHistoricalDataExists(param.getCustomerId()));
List<ScreenProjectProcessDTO> processes = processService.buildNewScreenProjectProcessData(param.getCustomerId(), param.getDateId(),!screenProjectProcessService.checkIfHistoricalDataExists(param.getCustomerId()));
if(!CollectionUtils.isEmpty(processes)){
targetProcessService.insertBatch(processes,param.getCustomerId(),param.getDateId());
screenProjectProcessService.insertBatch(processes,param.getCustomerId(),param.getDateId());
List<ScreenProjectProcessAttachmentDTO> attachments = processService.buildProcessAttachmentData(processes.stream().map(ScreenProjectProcessDTO::getProcessId).distinct().collect(Collectors.toList()));
if(!CollectionUtils.isEmpty(attachments)){
@ -186,7 +190,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
if(StringUtils.isNotBlank(projectId)){
BigDecimal calProjectSatisfactionScore = projectService.calProjectSatisfactionScore(customerId, projectId);
log.warn("单独计算projectId=" + projectId + "满意度得分:" + calProjectSatisfactionScore);
targetDbService.updateProjectSatisfactionScore(projectId,calProjectSatisfactionScore);
screenProjectDataService.updateProjectSatisfactionScore(projectId,calProjectSatisfactionScore);
return;
}
List<String> projectIds=new ArrayList<>();
@ -207,7 +211,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
projectIds.forEach(id -> {
BigDecimal calProjectSatisfactionScore = projectService.calProjectSatisfactionScore(customerId, id);
log.warn("projectId=" + id + "满意度得分:" + calProjectSatisfactionScore);
targetDbService.updateProjectSatisfactionScore(id, calProjectSatisfactionScore);
screenProjectDataService.updateProjectSatisfactionScore(id, calProjectSatisfactionScore);
});
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java

@ -155,6 +155,7 @@ public interface ProjectService extends BaseService<ProjectEntity> {
*/
List<ProjectCategoryDTO> getProjectCategoryData(String customerId, String dateId);
List<ProjectCategoryDTO> queryProjectCategoryData(String customerId, String dateId);
/**
* 获取项目满意度
* @author zhaoqifeng

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java

@ -161,6 +161,10 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
return baseDao.getProjectCategoryData(customerId,dateId);
}
@Override
public List<com.epmet.dto.ProjectCategoryDTO> queryProjectCategoryData(String customerId, String dateId) {
return baseDao.selectProjectCategoryData(customerId,dateId);
}
/**
* 获取项目满意度
*

18
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

@ -146,6 +146,24 @@
AND DATE_FORMAT(CREATED_TIME,'%Y%m%d')=#{dateId}
</if>
</select>
<!-- 原来一个项目有多个分类,现在几个分类可能会对上同一个省里的编码,所以去重一下,插入到fact_origin_project_category表 -->
<select id="selectProjectCategoryData" parameterType="map" resultType="com.epmet.dto.ProjectCategoryDTO">
select
distinct pc.CATEGORY_ID,
pc.CATEGORY_CODE,
pc.CATEGORY_PIDS,
pc.PROJECT_ID,
pc.CREATED_TIME
from
`project_category` pc
where pc.del_flag = '0'
and pc.customer_id = #{customerId}
<if test="dateId != null">
AND DATE_FORMAT(pc.CREATED_TIME,'%Y%m%d')=#{dateId}
</if>
</select>
<select id="selectProjectSatisfaction" resultType="com.epmet.dto.project.ProjectPointDTO">
SELECT
PROJECT_ID,

4
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml

@ -5,7 +5,7 @@
<select id="selectProjectCategoryIdList" resultType="java.lang.String">
SELECT
category_id
distinct category_id
FROM
project_category
WHERE
@ -38,8 +38,8 @@
<!-- 根据项目ID查询项目分类 -->
<select id="selectCategoryByIds" resultType="com.epmet.dto.result.ProjectCategoryDisPoseResultDTO">
SELECT
distinct CATEGORY_CODE,
PROJECT_ID,
CATEGORY_CODE,
CUSTOMER_ID
FROM project_category
WHERE DEL_FLAG = '0'

Loading…
Cancel
Save