Browse Source

Merge branch 'dev_screen_data_2.0' into dev_temp

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
25c07ea86e
  1. 2
      epmet-cloud-generator/src/main/resources/application.yml
  2. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  3. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollDistrictDepartmentServiceImpl.java
  5. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/ProjectPeriodExtractService.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java
  7. 104
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectPeriodExtractServiceImpl.java
  8. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java
  9. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java
  10. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml

2
epmet-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.1.130:3306/epmet_data_statistical?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://192.168.1.130:3306/epmet_gov_project?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet_dba
password: EpmEt-dbA-UsEr
#oracle配置

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

@ -33,10 +33,7 @@ import com.epmet.entity.stats.DimCustomerEntity;
import com.epmet.entity.stats.DimDateEntity;
import com.epmet.entity.stats.DimMonthEntity;
import com.epmet.service.StatsDemoService;
import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService;
import com.epmet.service.evaluationindex.extract.dataToIndex.CalGridIndexService;
import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollCommunityService;
import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollStreetService;
import com.epmet.service.evaluationindex.extract.dataToIndex.*;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService;
import com.epmet.service.evaluationindex.extract.toscreen.*;
@ -99,6 +96,8 @@ public class DemoController {
@Autowired
private IndexCollStreetService indexCollStreetService;
@Autowired
private IndexCollDistrictDepartmentService indexCollDistrictDepartmentService;
@Autowired
private GovernRankDataExtractService governRankDataExtractService;
@Autowired
private OrgRankExtractService orgRankExtractService;
@ -629,6 +628,12 @@ public class DemoController {
return new Result();
}
@PostMapping("indexCollDept")
public Result indexCollDept(@RequestBody CustomerIdAndDateIdFormDTO formDTO){
indexCollDistrictDepartmentService.saveDepartmentAbility(formDTO.getCustomerId(), formDTO.getDateId());
return new Result();
}
@Autowired
private PartyBaseInfoService partyBaseInfoService;

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java

@ -67,8 +67,14 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao<FactOriginPr
List<OrgStatisticsResultDTO> selectResponsiveness(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("level")String level,
@Param("orgType")String orgType);
void deleteByProjectId(@Param("list") List<String> list);
/***
* @Description 在插入之前先删除所有与这个项目相关的历时信息
* @param list
* @return void
* @author wangc
* @date 2020.10.19 16:26
*/
void deleteByProjectIds(@Param("list") List<String> list);
/**
* @Description 批量插入

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollDistrictDepartmentServiceImpl.java

@ -128,7 +128,7 @@ public class IndexCollDistrictDepartmentServiceImpl implements IndexCollDistrict
factIndexGovrnAblityDeptMonthlyService.deleteByCustomer(customerId, dimId.getMonthId());
factIndexGovrnAblityDeptMonthlyService.insertBatch(list);
factIndexGovrnAblityDeptMonthlyService.saveList(list);
}
}
}

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/ProjectPeriodExtractService.java

@ -1,21 +0,0 @@
package com.epmet.service.evaluationindex.extract.todata;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
/**
* @Desc 业务数据抽取 - 项目节点历时
* @Author wangc
* @DateTime 2020/9/14 5:07 下午
*/
public interface ProjectPeriodExtractService {
/**
* @param param
* @return
* @Description 抽取项目节点历时逻辑
* @author wangc
* @date 2020.09.17 14:05
**/
void extractProjectPeriodData(ExtractOriginFormDTO param);
}

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

@ -438,7 +438,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
if(!CollectionUtils.isEmpty(formattingData)) {
List<String> projectIds = formattingData.stream().map(FactOriginProjectOrgPeriodDailyEntity::getProjectId).distinct().collect(Collectors.toList());
if (!CollectionUtils.isEmpty(projectIds)) {
factOriginProjectOrgPeriodDailyDao.deleteByProjectId(projectIds);
factOriginProjectOrgPeriodDailyDao.deleteByProjectIds(projectIds);
factOriginProjectOrgPeriodDailyDao.insertBatch(formattingData);
}
}

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

@ -1,104 +0,0 @@
package com.epmet.service.evaluationindex.extract.todata.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.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity;
import com.epmet.service.evaluationindex.extract.todata.ProjectPeriodExtractService;
import com.epmet.service.project.ProjectProcessService;
import lombok.extern.slf4j.Slf4j;
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.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description 业务数据抽取 - 项目节点历时
* @ClassName ProjectPeriodExtractServiceImpl
* @Auth wangc
* @Date 2020-09-17 13:52
*/
@Service
@Slf4j
public class ProjectPeriodExtractServiceImpl implements ProjectPeriodExtractService {
@Autowired
private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao;
@Autowired
private ProjectProcessService projectProcessService;
/**
* @param param
* @return
* @Description 抽取项目节点历时逻辑
* @author wangc
* @date 2020.09.17 14:05
**/
@Override
public void extractProjectPeriodData(ExtractOriginFormDTO 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);
}
}
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java

@ -3,6 +3,8 @@ package com.epmet.service.evaluationindex.indexcoll;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
@ -18,4 +20,13 @@ public interface FactIndexGovrnAblityDeptMonthlyService extends BaseService<Fact
* @return void
*/
void deleteByCustomer(String customerId, String monthId);
/**
* 批量插入
* @author zhaoqifeng
* @date 2020/9/21 17:08
* @param list
* @return void
*/
void saveList(List<FactIndexGovrnAblityDeptMonthlyEntity> list);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java

@ -8,6 +8,8 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthl
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
@ -21,4 +23,17 @@ public class FactIndexGovrnAblityDeptMonthlyServiceImpl extends BaseServiceImpl<
public void deleteByCustomer(String customerId, String monthId) {
baseDao.deleteFactIndexGovrnAblityDeptMonthly(customerId, monthId);
}
/**
* 批量插入
*
* @param list
* @return void
* @author zhaoqifeng
* @date 2020/9/21 17:08
*/
@Override
public void saveList(List<FactIndexGovrnAblityDeptMonthlyEntity> list) {
insertBatch(list);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml

@ -34,7 +34,7 @@
</select>
<!-- 在插入之前,先删除所有与这个项目相关的历时信息 -->
<delete id="deleteByProjectId">
<delete id="deleteByProjectIds">
DELETE FROM
fact_origin_project_org_period_daily
WHERE
@ -54,6 +54,9 @@
FROM
fact_origin_project_org_period_daily f
INNER JOIN dim_agency da ON f.ORG_ID = da.ID
<if test='"dept" != orgType'>
AND da.`LEVEL` = #{level}
</if>
WHERE
f.ORG_TYPE = #{orgType}
AND DATE_FORMAT(INFORMED_DATE, '%Y%m') = #{monthId}

Loading…
Cancel
Save