Browse Source

Merge branch 'dev_screen_data_2.0' into dev_temp

# Conflicts:
#	epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
dev_shibei_match
wxz 5 years ago
parent
commit
31a348737c
  1. 11
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/OrgSourceTypeConstant.java
  2. 17
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java
  3. 33
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/TreeResultDTO.java
  4. 371
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  5. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  6. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  7. 48
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java
  8. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  9. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java
  10. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  11. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPioneerDataDao.java
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java
  13. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java
  14. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java
  15. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java
  16. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyBaseInfoService.java
  17. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PioneerDataExtractService.java
  18. 37
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java
  19. 74
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java
  20. 25
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java
  21. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerDeptService.java
  22. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  23. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPioneerDataService.java
  24. 129
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  25. 55
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerDeptServiceImpl.java
  26. 55
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  27. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java
  28. 155
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java
  29. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java
  30. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.4__screen_org_add_source_col.sql
  31. 25
      epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml
  32. 110
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  33. 72
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml
  34. 84
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  35. 51
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml

11
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/OrgSourceTypeConstant.java

@ -0,0 +1,11 @@
package com.epmet.constant;
public interface OrgSourceTypeConstant {
// 外部
String EXTERNAL = "external";
// 内部
String INTERNAL = "internal";
}

17
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java

@ -0,0 +1,17 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2020/9/22 2:19 下午
*/
public interface ScreenConstant {
String COMMUNITY = "community";
String LEVEL = "level";
String STR_NULL = "";
String ENGLISH_COMMA = ",";
}

33
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/TreeResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.screen.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/9/22 2:00 下午
*/
@Data
public class TreeResultDTO implements Serializable {
private static final long serialVersionUID = 3860368744336541373L;
/**
* 显示名称
*/
private String agencyId;
/**
* agencyId下拉框value
*/
private String pid;
private String pids;
private String level;
}

371
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -25,146 +25,148 @@ import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class)
public interface DataStatisticalOpenFeignClient {
/**
* desc: 统计文章总数及在线文章总数 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/articleSummaryDailyStatsjob")
Result articleSummaryDailyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 定时任务 统计文章总数及在线文章总数 包含 机关 部门 网格
*
* @return:
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagUsedDailyStatsjob")
Result tagUsedDailyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagUsedMonthlyStatsjob")
Result tagUsedMonthlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagUsedQuarterlyStatsjob")
Result tagUsedQuarterlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagViewedDailyStatsjob")
Result tagViewedDailyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagViewedMonthlyStatsjob")
Result tagViewedMonthlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
* @param date
*/
@PostMapping(value = "data/stats/statspublicity/tagViewedQuarterlyStatsjob")
Result tagViewedQuarterlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* @Description 统计 网格小组 dim网格-
* @param
* @author zxc
*/
@PostMapping("/data/stats/statsgroup/groupgriddaily")
Result groupGridDaily(@RequestBody GroupStatsFormDTO formDTO);
/**
* @Description 统计 网格小组 dim机关-
* @param
* @author zxc
*/
@PostMapping("/data/stats/statsgroup/groupagencydaily")
Result groupAgencyDaily(@RequestBody GroupStatsFormDTO formDTO);
/**
* @Description 统计 网格小组 dim机关-
* @param
* @author zxc
*/
@PostMapping("/data/stats/statsgroup/groupagencymonthly")
Result groupAgencyMonthly(@RequestBody GroupStatsFormDTO formDTO);
/**
* 议题统计
* @author zhaoqifeng
* @date 2020/6/23 14:34
* @param
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/data/stats/statsissue/issuestats")
Result agencyGridIssueStats();
/**
* 指定日期统计
* @author zhaoqifeng
* @date 2020/7/1 15:29
* @param fromDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/data/stats/statsissue/issuestatsofdate")
Result agencyGridIssueStatsOfDate(@RequestBody IssueJobFromDTO fromDTO);
/**
* @Description 数据统计-项目-机关日月统计
* @Author sun
*/
@PostMapping("/data/stats/statsproject/agencyprojectstats")
Result agencyProjectStats(StatsFormDTO formDTO);
/**
* @Description 数据统计-项目-网格日月统计
* @Author sun
*/
@PostMapping("/data/stats/statsproject/gridprojectstats")
Result gridProjectStats(StatsFormDTO formDTO);
/**
* 初始化所有维度
*
* @return
*/
@PostMapping("/data/stats/dim/all/init")
Result initAllDims();
/**
* @Description 执行用户统计
* @param
* @return
* @author wangc
* @date 2020.06.29 09:26
**/
@PostMapping("/data/stats/statsuser/execute")
Result execUserStatistical(@RequestParam(value = "date",required = false) String date);
/**
* desc: 统计文章总数及在线文章总数 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/articleSummaryDailyStatsjob")
Result articleSummaryDailyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 定时任务 统计文章总数及在线文章总数 包含 机关 部门 网格
*
* @return:
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagUsedDailyStatsjob")
Result tagUsedDailyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagUsedMonthlyStatsjob")
Result tagUsedMonthlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagUsedQuarterlyStatsjob")
Result tagUsedQuarterlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagViewedDailyStatsjob")
Result tagViewedDailyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagViewedMonthlyStatsjob")
Result tagViewedMonthlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @param date
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/statspublicity/tagViewedQuarterlyStatsjob")
Result tagViewedQuarterlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO);
/**
* @param
* @Description 统计 网格小组 dim网格-
* @author zxc
*/
@PostMapping("/data/stats/statsgroup/groupgriddaily")
Result groupGridDaily(@RequestBody GroupStatsFormDTO formDTO);
/**
* @param
* @Description 统计 网格小组 dim机关-
* @author zxc
*/
@PostMapping("/data/stats/statsgroup/groupagencydaily")
Result groupAgencyDaily(@RequestBody GroupStatsFormDTO formDTO);
/**
* @param
* @Description 统计 网格小组 dim机关-
* @author zxc
*/
@PostMapping("/data/stats/statsgroup/groupagencymonthly")
Result groupAgencyMonthly(@RequestBody GroupStatsFormDTO formDTO);
/**
* 议题统计
*
* @param
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2020/6/23 14:34
*/
@PostMapping("/data/stats/statsissue/issuestats")
Result agencyGridIssueStats();
/**
* 指定日期统计
*
* @param fromDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2020/7/1 15:29
*/
@PostMapping("/data/stats/statsissue/issuestatsofdate")
Result agencyGridIssueStatsOfDate(@RequestBody IssueJobFromDTO fromDTO);
/**
* @Description 数据统计-项目-机关日月统计
* @Author sun
*/
@PostMapping("/data/stats/statsproject/agencyprojectstats")
Result agencyProjectStats(StatsFormDTO formDTO);
/**
* @Description 数据统计-项目-网格日月统计
* @Author sun
*/
@PostMapping("/data/stats/statsproject/gridprojectstats")
Result gridProjectStats(StatsFormDTO formDTO);
/**
* 初始化所有维度
*
* @return
*/
@PostMapping("/data/stats/dim/all/init")
Result initAllDims();
/**
* @param
* @return
* @Description 执行用户统计
* @author wangc
* @date 2020.06.29 09:26
**/
@PostMapping("/data/stats/statsuser/execute")
Result execUserStatistical(@RequestParam(value = "date", required = false) String date);
/**
* @Description 执行话题统计
@ -175,41 +177,56 @@ public interface DataStatisticalOpenFeignClient {
**/
@PostMapping("/data/stats/statstopic/execute")
Result execTopicStatistical(@RequestParam(value = "date", required = false) String date);
/**
* @Description 统计党员
* @param customerIdAndDateIdFormDTO
* @author zxc
* @date 2020/9/17 3:10 下午
*/
@PostMapping("/data/stats/dim/statsparty")
Result getPartyInfo(@RequestBody CustomerIdAndDateIdFormDTO customerIdAndDateIdFormDTO);
/**
* 处理暂停的计算
*
* @return
*/
@PostMapping("/data/stats/indexcalculate/process-pendding-cals")
Result processPenddingCalculate();
/**
* desc: 抽取业务数据到统计库 小组 话题 议题 项目
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "/data/stats/factorigin/extractall")
Result factOriginExtractAll(@RequestBody(required = false) ExtractFormDTO formDTO);
/**
* ˚
* desc: 抽取统计数据到指标库
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "/data/stats/indexorigin/extractall")
Result indexOriginExtractAll(@RequestBody(required = false) ExtractIndexFormDTO formDTO);
/**
* @param
* @return
* @Description 执行话题统计
* @author wangc
* @date 2020.06.29 09:27
**/
@PostMapping("/data/stats/statstopic/execute")
Result execTopicStatistical(@RequestParam(value = "date", required = false) String date);
/**
* @param customerIdAndDateIdFormDTO
* @Description 统计党员
* @author zxc
* @date 2020/9/17 3:10 下午
*/
@PostMapping("/data/stats/dim/statsparty")
Result getPartyInfo(@RequestBody CustomerIdAndDateIdFormDTO customerIdAndDateIdFormDTO);
/**
* 处理暂停的计算
*
* @return
*/
@PostMapping("/data/stats/indexcalculate/process-pendding-cals")
Result processPenddingCalculate();
/**
* desc: 抽取业务数据到统计库 小组 话题 议题 项目
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "/data/stats/factorigin/extractall")
Result factOriginExtractAll(@RequestBody(required = false) ExtractFormDTO formDTO);
/**
* ˚
* desc: 抽取统计数据到指标库
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "/data/stats/indexorigin/extractall")
Result indexOriginExtractAll(@RequestBody(required = false) ExtractIndexFormDTO formDTO);
/**
* 初始化维度
* @return
*/
@PostMapping("/data/stats/eidim/init-all")
Result initAll();
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -207,4 +207,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result indexOriginExtractAll(ExtractIndexFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "indexOriginExtractAll", formDTO);
}
@Override
public Result initAll() {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "initAll");
}
}

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

@ -34,6 +34,7 @@ import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollCommunityS
import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollStreetService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService;
import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService;
import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.service.stats.DimAgencyService;
import com.epmet.service.stats.DimCustomerPartymemberService;
@ -632,4 +633,13 @@ public class DemoController {
return new Result();
}
@Autowired
private PartyBaseInfoService partyBaseInfoService;
@PostMapping("zxczxczxc")
public Result getZxcZxcZxc(){
partyBaseInfoService.statsPartyMemberBaseInfoToScreen("45687aa479955f9d06204d415238f7cc","20200922");
return new Result();
}
}

48
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java

@ -0,0 +1,48 @@
package com.epmet.controller;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.EIDimService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* epmet_evaluation_index库的维度controller
*/
@RestController
@RequestMapping("eidim")
public class EIDimController {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private EIDimService eiDimService;
@PostMapping("init-all")
public Result initAll() {
try {
//eiDimService.initAgencies();
} catch (Exception e) {
logger.error("初始化epmet_evaluation_index的agency维度失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
try {
//eiDimService.initDepartments();
} catch (Exception e) {
logger.error("初始化epmet_evaluation_index的department维度失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
try {
eiDimService.initGrids();
} catch (Exception e) {
logger.error("初始化epmet_evaluation_index的grids维度失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
return new Result();
}
}

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
@ -102,4 +103,26 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @return
*/
int selectCountByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询客户根组织ID
* @param customerId
* @author zxc
* @date 2020/9/22 2:44 下午
*/
TreeResultDTO selectRootAgencyId(@Param("customerId")String customerId,@Param("agencyId") String agencyId);
/**
* @Description 查询下级机关的 id
* @param pids
* @author zxc
* @date 2020/9/22 4:48 下午
*/
List<TreeResultDTO> selectSubAgencyList(@Param("pids") String pids);
ScreenCustomerAgencyEntity getLastAddedAgency();
ScreenCustomerAgencyEntity getLastUpdatedAgency();
ScreenCustomerAgencyEntity selectByAgencyId(String agencyId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java

@ -86,4 +86,14 @@ public interface ScreenCustomerDeptDao extends BaseDao<ScreenCustomerDeptEntity>
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerDeptEntity> selectListDeptInfo(@Param("customerId")String customerId);
/**
* 查询最后一次添加的部门
* @return
*/
ScreenCustomerDeptEntity getLastAddDept();
ScreenCustomerDeptEntity getLastUpdateDept();
ScreenCustomerDeptEntity selectByDeptId(String deptId);
}

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -114,4 +114,18 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId")String customerId);
/**
* @Description 根据agencyId查询网格ID
* @param agencyId
* @author zxc
* @date 2020/9/22 2:16 下午
*/
List<String> selectGridIdByAgencyId(@Param("agencyId")String agencyId);
ScreenCustomerGridEntity getLastAddGrid();
ScreenCustomerGridEntity getLastUpdateGrid();
ScreenCustomerGridEntity getByGridId(String gridId);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPioneerDataDao.java

@ -55,4 +55,23 @@ public interface ScreenPioneerDataDao extends BaseDao<ScreenPioneerDataEntity> {
* @Date 10:52 2020-08-18
**/
void batchInsertPioneerData(@Param("list") List<PioneerDataFormDTO> list, @Param("customerId")String customerId);
/**
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity>
* @param customerId
* @author yinzuomei
* @description 初始化好orgType="grid"的插入对象
* @Date 2020/9/22 15:03
**/
List<ScreenPioneerDataEntity> initGridPioneerDataList(@Param("customerId") String customerId);
/**
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity>
* @param customerId
* @param agencyLevel
* @author yinzuomei
* @description 初始化好orgType="agency"的插入对象
* @Date 2020/9/22 15:03
**/
List<ScreenPioneerDataEntity> initAgencyPioneerDataList(@Param("customerId")String customerId, @Param("agencyLevel")String agencyLevel);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java

@ -93,6 +93,8 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity {
*/
private String areaCode;
private String sourceType;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java

@ -75,4 +75,6 @@ public class ScreenCustomerDeptEntity extends BaseEpmetEntity {
*/
private String dataEndTime;
private String sourceType;
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java

@ -79,4 +79,6 @@ public class ScreenCustomerGridEntity extends BaseEpmetEntity {
* 所有上级ID用英文逗号分开(8.26新增)
*/
private String allParentIds;
private String sourceType;
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java

@ -0,0 +1,13 @@
package com.epmet.service;
import org.springframework.stereotype.Service;
/**
* epmet_evaluation_index 维度的service
*/
@Service
public interface EIDimService {
void initAgencies();
void initDepartments();
void initGrids();
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyBaseInfoService.java

@ -0,0 +1,19 @@
package com.epmet.service.evaluationindex.extract.toscreen;
/**
* @Desciption 党员基本情况
* @Author zxc
* @DateTime 2020/9/22 11:14 上午
*/
public interface PartyBaseInfoService {
/**
* @Description 统计基层党建-党员基本情况
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/22 1:22 下午
*/
Boolean statsPartyMemberBaseInfoToScreen(String customerId,String dateId);
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PioneerDataExtractService.java

@ -1,10 +1,48 @@
package com.epmet.service.evaluationindex.extract.toscreen;
/**
* 先进模范数据抽取到大屏表screen_pioneer_data
* 先进模范数据抽取到大屏表 screen_pioneer_data
*
* @author yinzuomei@elink-cn.com
* @date 2020/9/22 11:25
*/
public interface PioneerDataExtractService {
/**
* @return void
* @param customerId
* @param dateId
* @author yinzuomei
* @description 总方法入口
* @Date 2020/9/22 14:17
**/
void extractPioneerData(String customerId, String dateId);
// 机关级别(社区级:community,
// 乡(镇、街道)级:street,
// 区县级: district,
// 市级: city
// 省级:province)
/**
* @param customerId
* @param dateId
* @return void
* @author yinzuomei
* @description 网格级别的 党建引领-先锋模范数据
* @Date 2020/9/22 13:46
**/
void extractGridPioneerData(String customerId, String dateId);
// 社区、街道、区县、市级别、省级
void extractCommunityPioneerData(String customerId, String dateId);
void extractStreetPioneerData(String customerId, String dateId);
void extractDistrictPioneerData(String customerId, String dateId);
void extractCityPioneerData(String customerId, String dateId);
void extractProvincePioneerData(String customerId, String dateId);
}

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

@ -0,0 +1,37 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @Desciption 党员基本情况
* @Author zxc
* @DateTime 2020/9/22 11:15 上午
*/
@Service
@Slf4j
public class PartyBaseInfoServiceImpl implements PartyBaseInfoService {
@Autowired
private ScreenCustomerAgencyService agencyService;
/**
* @Description 统计基层党建-党员基本情况
* @param customerId
* @param dateId
* @author zxc
* @date 2020/9/22 1:22 下午
*/
@Override
public Boolean statsPartyMemberBaseInfoToScreen(String customerId, String dateId) {
String agencyId = "cyagstrbee8711eaa1fac03fd56f7847";
Map<String, Object> stringObjectMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
System.out.println(stringObjectMap);
return null;
}
}

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

@ -1,6 +1,13 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity;
import com.epmet.service.evaluationindex.extract.toscreen.PioneerDataExtractService;
import com.epmet.service.evaluationindex.screen.ScreenPioneerDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* 先进模范数据抽取到大屏表screen_pioneer_data
@ -9,4 +16,71 @@ import com.epmet.service.evaluationindex.extract.toscreen.PioneerDataExtractServ
* @date 2020/9/22 11:25
*/
public class PioneerDataExtractServiceImpl implements PioneerDataExtractService {
@Autowired
private ScreenPioneerDataService screenPioneerDataService;
/**
* @param customerId
* @param dateId
* @return void
* @author yinzuomei
* @description 总方法入口
* @Date 2020/9/22 14:17
**/
@Override
public void extractPioneerData(String customerId, String dateId) {
extractGridPioneerData(customerId, dateId);
extractCommunityPioneerData(customerId, dateId);
extractStreetPioneerData(customerId, dateId);
extractDistrictPioneerData(customerId, dateId);
extractCityPioneerData(customerId, dateId);
extractProvincePioneerData(customerId, dateId);
}
/**
* @param customerId
* @param dateId
* @return void
* @author yinzuomei
* @description 网格级别的 党建引领-先锋模范数据
* @Date 2020/9/22 13:46
**/
@Override
public void extractGridPioneerData(String customerId, String dateId) {
List<ScreenPioneerDataEntity> gridList=screenPioneerDataService.initPioneerDataList(customerId,"grid", StrConstant.EPMETY_STR);
if(CollectionUtils.isEmpty(gridList)){
return;
}
gridList.forEach(entity->{
entity.setDataEndTime(dateId);
});
}
@Override
public void extractCommunityPioneerData(String customerId, String dateId) {
}
@Override
public void extractStreetPioneerData(String customerId, String dateId) {
}
@Override
public void extractDistrictPioneerData(String customerId, String dateId) {
}
@Override
public void extractCityPioneerData(String customerId, String dateId) {
}
@Override
public void extractProvincePioneerData(String customerId, String dateId) {
}
}

25
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java

@ -17,9 +17,11 @@
package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import java.util.List;
import java.util.Map;
/**
* 组织机构信息
@ -27,5 +29,22 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-22
*/
public interface ScreenCustomerAgencyService extends BaseService<ScreenCustomerAgencyEntity> {
public interface ScreenCustomerAgencyService{
/**
* @Description 根据agencyId查询所有子级agencyId当机关的级别为 community时所有子级为gridId
* @param agencyId
* @param customerId
* map.put('机关的级别(level)','community/street/district/city/province')
* map.put('agencyId','List<String> 所有子级agencyId')
* @author zxc
* @date 2020/9/22 1:39 下午
*/
Map<String,Object> selectAllSubAgencyId(String agencyId, String customerId);
ScreenCustomerAgencyEntity getLastAddedAgency();
ScreenCustomerAgencyEntity getLastUpdatedAgency();
void initAgencies(List<CustomerAgencyEntity> agencies2Add, List<CustomerAgencyEntity> agencies2Update);
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerDeptService.java

@ -19,6 +19,9 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.entity.org.CustomerDepartmentEntity;
import java.util.List;
/**
* 部门信息
@ -28,4 +31,14 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
*/
public interface ScreenCustomerDeptService extends BaseService<ScreenCustomerDeptEntity> {
/**
* 最后一次添加的部门
* @return
*/
ScreenCustomerDeptEntity getLastAddDept();
ScreenCustomerDeptEntity getLastUpdateDept();
void addAndUpdateDepartments(List<CustomerDepartmentEntity> depts2Add, List<CustomerDepartmentEntity> depts2Update);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java

@ -20,6 +20,9 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
import java.util.List;
/**
* 网格(党支部)信息
@ -29,4 +32,8 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
*/
public interface ScreenCustomerGridService extends BaseService<ScreenCustomerGridEntity> {
ScreenCustomerGridEntity getLastAddGrid();
ScreenCustomerGridEntity getLastUpdateGrid();
void addAndUpdateGrids(List<CustomerGridEntity> grids2Add, List<CustomerGridEntity> grids2Update);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPioneerDataService.java

@ -20,6 +20,8 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity;
import java.util.List;
/**
* 党建引领-先锋模范数据
*
@ -28,4 +30,14 @@ import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity;
*/
public interface ScreenPioneerDataService extends BaseService<ScreenPioneerDataEntity> {
/**
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity>
* @param customerId
* @param orgType grid,agency
* @param agencyLevel : 机关级别社区级community 街道:street,区县级: district,市级: city 省级:province
* @author yinzuomei
* @description 构造screen_pioneer_data 初始数据先赋值为0
* @Date 2020/9/22 14:41
**/
List<ScreenPioneerDataEntity> initPioneerDataList(String customerId, String orgType,String agencyLevel);
}

129
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java

@ -17,11 +17,28 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.OrgSourceTypeConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.constant.ScreenConstant;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 组织机构信息
@ -30,6 +47,114 @@ import org.springframework.stereotype.Service;
* @since v1.0.0 2020-09-22
*/
@Service
public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl<ScreenCustomerAgencyDao, ScreenCustomerAgencyEntity> implements ScreenCustomerAgencyService {
@Slf4j
public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyService {
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Autowired
private ScreenCustomerGridDao screenCustomerGridDao;
/**
* @Description 根据agencyId查询所有子级agencyId当机关的级别为 community时所有子级为gridId
* @param agencyId
* @param customerId
* map.put('机关的级别(level)','community/street/district/city/province')
* map.put('agencyId','List<String> 所有子级agencyId')
* @author zxc
* @date 2020/9/22 1:39 下午
*/
@Override
public Map<String,Object> selectAllSubAgencyId(String agencyId, String customerId) {
Map<String,Object> resultMap = new HashMap<>(16);
TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId,agencyId);
if (null == rootAgency){
return new HashMap<>(16);
}
if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){
List<String> gridIdList = screenCustomerGridDao.selectGridIdByAgencyId(agencyId);
resultMap.put(ScreenConstant.LEVEL,ScreenConstant.COMMUNITY);
resultMap.put(agencyId,gridIdList);
}else {
resultMap.put(ScreenConstant.LEVEL,rootAgency.getLevel());
resultMap.put(agencyId,getDepartmentList((ScreenConstant.STR_NULL.equals(rootAgency.getPids())||rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getAgencyId() : rootAgency.getPids().concat(ScreenConstant.ENGLISH_COMMA).concat(rootAgency.getAgencyId())));
}
return resultMap;
}
private List<String> getDepartmentList(String subAgencyPids) {
List<String> result = new ArrayList<>();
List<TreeResultDTO> subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids);
if (!CollectionUtils.isEmpty(subAgencyList)) {
result.addAll(subAgencyList.stream().map(sub -> sub.getAgencyId()).collect(Collectors.toList()));
subAgencyList.forEach(sub -> {
List<String> subAgency = getDepartmentList(sub.getPids() + "," + sub.getAgencyId());
result.addAll(subAgency);
});
}
return result;
}
@Override
public ScreenCustomerAgencyEntity getLastAddedAgency() {
return screenCustomerAgencyDao.getLastAddedAgency();
}
@Override
public ScreenCustomerAgencyEntity getLastUpdatedAgency() {
return screenCustomerAgencyDao.getLastUpdatedAgency();
}
@Transactional(rollbackFor = Exception.class)
@Override
public void initAgencies(List<CustomerAgencyEntity> agencies2Add, List<CustomerAgencyEntity> agencies2Update) {
String dateEndTime = DateUtils.format(new Date(), "YYYYmmdd");
if (!CollectionUtils.isEmpty(agencies2Add)) {
// 添加
for (CustomerAgencyEntity e : agencies2Add) {
addAgency(e, dateEndTime);
}
}
if (!CollectionUtils.isEmpty(agencies2Update)) {
// 更新
for (CustomerAgencyEntity e : agencies2Update) {
ScreenCustomerAgencyEntity exists = screenCustomerAgencyDao.selectByAgencyId(e.getId());
if (exists != null) {
exists.setAgencyName(e.getOrganizationName());
exists.setPids(e.getPids());
exists.setPid(e.getPid());
exists.setLevel(e.getLevel());
exists.setDataEndTime(dateEndTime);
exists.setAreaCode(e.getAreaCode());
exists.setAllParentNames(e.getAllParentName());
updateAgency(exists);
}
}
}
}
private void updateAgency(ScreenCustomerAgencyEntity exists) {
screenCustomerAgencyDao.updateById(exists);
}
/**
* 添加agency
* @param e
*/
private void addAgency(CustomerAgencyEntity e, String dateEndTime) {
ScreenCustomerAgencyEntity cae = new ScreenCustomerAgencyEntity();
cae.setAgencyId(e.getId());
cae.setAgencyName(e.getOrganizationName());
cae.setAllParentNames(e.getAllParentName());
cae.setAreaCode(e.getAreaCode());
//cae.setAreaMarks(e);
cae.setCustomerId(e.getCustomerId());
cae.setDataEndTime(dateEndTime);
cae.setLevel(e.getLevel());
cae.setPid(e.getPid());
cae.setPids(e.getPids());
cae.setSourceType(OrgSourceTypeConstant.INTERNAL);
screenCustomerAgencyDao.insert(cae);
}
}

55
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerDeptServiceImpl.java

@ -18,10 +18,18 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.OrgSourceTypeConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerDeptDao;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.entity.org.CustomerDepartmentEntity;
import com.epmet.service.evaluationindex.screen.ScreenCustomerDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 部门信息
@ -32,5 +40,52 @@ import org.springframework.stereotype.Service;
@Service
public class ScreenCustomerDeptServiceImpl extends BaseServiceImpl<ScreenCustomerDeptDao, ScreenCustomerDeptEntity> implements ScreenCustomerDeptService {
@Autowired
private ScreenCustomerDeptDao screenCustomerDeptDao;
@Override
public ScreenCustomerDeptEntity getLastAddDept() {
return screenCustomerDeptDao.getLastAddDept();
}
@Override
public ScreenCustomerDeptEntity getLastUpdateDept() {
return screenCustomerDeptDao.getLastUpdateDept();
}
/**
* 添加/更新部门列表
* @param depts2Add
* @param depts2Update
*/
@Transactional(rollbackFor = Exception.class)
public void addAndUpdateDepartments(List<CustomerDepartmentEntity> depts2Add, List<CustomerDepartmentEntity> depts2Update) {
String dateStr = DateUtils.format(new Date(), "YYYYmmdd");
for (CustomerDepartmentEntity dept : depts2Add) {
ScreenCustomerDeptEntity e = screenCustomerDeptDao.selectByDeptId(dept.getId());
if (e == null) {
e = new ScreenCustomerDeptEntity();
e.setCustomerId(dept.getCustomerId());
e.setDataEndTime(dateStr);
e.setDeptId(dept.getId());
e.setDeptName(dept.getDepartmentName());
e.setParentAgencyId(dept.getAgencyId());
e.setSourceType(OrgSourceTypeConstant.INTERNAL);
screenCustomerDeptDao.insert(e);
}
}
for (CustomerDepartmentEntity dept : depts2Update) {
ScreenCustomerDeptEntity e = screenCustomerDeptDao.selectByDeptId(dept.getId());
if (e != null) {
// 不是新增的
e.setParentAgencyId(dept.getAgencyId());
e.setDeptName(dept.getDepartmentName());
e.setDataEndTime(dateStr);
e.setCustomerId(dept.getCustomerId());
screenCustomerDeptDao.updateById(e);
}
}
}
}

55
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -18,11 +18,21 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgSourceTypeConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 网格(党支部)信息
@ -30,8 +40,53 @@ import org.springframework.stereotype.Service;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-22
*/
@DataSource(DataSourceConstant.EVALUATION_INDEX)
@Service
public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustomerGridDao, ScreenCustomerGridEntity> implements ScreenCustomerGridService {
@Autowired
private ScreenCustomerGridDao screenCustomerGridDao;
@Override
public ScreenCustomerGridEntity getLastAddGrid() {
return screenCustomerGridDao.getLastAddGrid();
}
@Override
public ScreenCustomerGridEntity getLastUpdateGrid() {
return screenCustomerGridDao.getLastUpdateGrid();
}
@Transactional(rollbackFor = Exception.class)
@Override
public void addAndUpdateGrids(List<CustomerGridEntity> grids2Add, List<CustomerGridEntity> grids2Update) {
String dateStr = DateUtils.format(new Date(), "YYYYmmdd");
for (CustomerGridEntity grid : grids2Add) {
ScreenCustomerGridEntity screenGrid = screenCustomerGridDao.getByGridId(grid.getId());
if (screenGrid == null) {
ScreenCustomerGridEntity insertOne = new ScreenCustomerGridEntity();
insertOne.setAllParentIds(grid.getPids());
insertOne.setCustomerId(grid.getCustomerId());
insertOne.setDataEndTime(dateStr);
insertOne.setGridId(grid.getId());
insertOne.setGridName(grid.getGridName());
insertOne.setParentAgencyId(grid.getPid());
insertOne.setSourceType(OrgSourceTypeConstant.INTERNAL);
screenCustomerGridDao.insert(insertOne);
}
}
for (CustomerGridEntity grid : grids2Update) {
ScreenCustomerGridEntity screenGrid = screenCustomerGridDao.getByGridId(grid.getId());
if (screenGrid != null) {
//说明之前已经插入了该数据
screenGrid.setParentAgencyId(grid.getPid());
screenGrid.setAllParentIds(grid.getPid());
screenGrid.setCustomerId(grid.getCustomerId());
screenGrid.setDataEndTime(dateStr);
screenGrid.setGridName(grid.getGridName());
screenCustomerGridDao.updateById(screenGrid);
}
}
}
}

27
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java

@ -18,20 +18,47 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenPioneerDataDao;
import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity;
import com.epmet.service.evaluationindex.screen.ScreenPioneerDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 党建引领-先锋模范数据
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-22
*/
@Slf4j
@Service
public class ScreenPioneerDataServiceImpl extends BaseServiceImpl<ScreenPioneerDataDao, ScreenPioneerDataEntity> implements ScreenPioneerDataService {
/**
* @param customerId
* @param orgType grid,agency
* @param agencyLevel : 机关级别社区级community 街道:street,区县级: district,市级: city 省级:province
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity>
* @author yinzuomei
* @description 构造screen_pioneer_data 初始数据先赋值为0
* @Date 2020/9/22 14:41
**/
@DataSource(DataSourceConstant.EVALUATION_INDEX)
@Override
public List<ScreenPioneerDataEntity> initPioneerDataList(String customerId, String orgType, String agencyLevel) {
List<ScreenPioneerDataEntity> list=new ArrayList<>();
if("grid".equals(orgType)){
list=baseDao.initGridPioneerDataList(customerId);
}else if("agency".equals(orgType)){
list=baseDao.initAgencyPioneerDataList(customerId,agencyLevel);
}
return list;
}
}

155
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java

@ -0,0 +1,155 @@
package com.epmet.service.impl;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.entity.org.CustomerDepartmentEntity;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.EIDimService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerDeptService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.org.CustomerAgencyService;
import com.epmet.service.org.CustomerDepartmentService;
import com.epmet.service.org.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class EIDimServiceImpl implements EIDimService {
@Autowired
private ScreenCustomerAgencyService screenCustomerAgencyService;
@Autowired
private ScreenCustomerDeptService screenCustomerDeptService;
@Autowired
private ScreenCustomerGridService screenCustomerGridService;
@Autowired
private CustomerAgencyService originCustomerAgencyService;
@Autowired
private CustomerDepartmentService originCustomerDepartmentService;
@Autowired
private CustomerGridService customerGridService;
@Override
public void initAgencies() {
List<CustomerAgencyEntity> agencies2Add = listAgencies2Add();
List<CustomerAgencyEntity> agencies2Update = listAgencies2Update();
screenCustomerAgencyService.initAgencies(agencies2Add, agencies2Update);
}
/**
* 查询可更新的单位
* @return
*/
private List<CustomerAgencyEntity> listAgencies2Update() {
ScreenCustomerAgencyEntity e = screenCustomerAgencyService.getLastUpdatedAgency();
if (e != null) {
// 说明不是第一次初始化
Date startTime = e.getUpdatedTime();
Date endTime = new Date();
return originCustomerAgencyService.listAgenciesByUpdatedTime(startTime, endTime);
}
return new ArrayList<>();
}
/**
* 查询可增加的单位
* @return
*/
private List<CustomerAgencyEntity> listAgencies2Add() {
ScreenCustomerAgencyEntity e = screenCustomerAgencyService.getLastAddedAgency();
Date endTime = new Date();
Date startTime = null;
if (e != null) {
startTime = e.getCreatedTime();
}
return originCustomerAgencyService.listAgenciesByCreateTime(startTime, endTime);
}
@Override
public void initDepartments() {
List<CustomerDepartmentEntity> depts2Add = listDepts2Add();
List<CustomerDepartmentEntity> depts2Update = listDepts2Update();
screenCustomerDeptService.addAndUpdateDepartments(depts2Add, depts2Update);
}
/**
* 查询需要更新的部门列表
* @return
*/
private List<CustomerDepartmentEntity> listDepts2Update() {
ScreenCustomerDeptEntity lastUpdateDept = screenCustomerDeptService.getLastUpdateDept();
if (lastUpdateDept != null) {
// 不是第一次初始化
Date endTime = new Date();
Date startTime = lastUpdateDept.getUpdatedTime();
return originCustomerDepartmentService.listDepartmentsByUpdatedTime(startTime, endTime);
}
return new ArrayList<>();
}
/**
* 查询需要新增的部门列表
* @return
*/
private List<CustomerDepartmentEntity> listDepts2Add() {
ScreenCustomerDeptEntity lastAddDept = screenCustomerDeptService.getLastAddDept();
Date startTime = null;
Date endTime = new Date();
if (lastAddDept != null) {
startTime = lastAddDept.getCreatedTime();
}
return originCustomerDepartmentService.listDepartmentsByCreatedTime(startTime, endTime);
}
@Override
public void initGrids() {
List<CustomerGridEntity> grids2Add = listGrids2Add();
List<CustomerGridEntity> grids2Update =listGrids2Update();
screenCustomerGridService.addAndUpdateGrids(grids2Add, grids2Update);
}
private List<CustomerGridEntity> listGrids2Update() {
ScreenCustomerGridEntity lastUpdateGrid = screenCustomerGridService.getLastUpdateGrid();
if (lastUpdateGrid != null) {
Date endTime = new Date();
Date startTime = lastUpdateGrid.getUpdatedTime();
return customerGridService.listUpdatedGridsByUpdateTime(startTime, endTime);
}
return new ArrayList();
}
private List<CustomerGridEntity> listGrids2Add() {
ScreenCustomerGridEntity lastAddGrid = screenCustomerGridService.getLastAddGrid();
Date endTime = new Date();
Date startTime = null;
if (lastAddGrid != null) {
startTime = lastAddGrid.getCreatedTime();
}
return customerGridService.listGridsByCreateTime(startTime, endTime);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java

@ -9,5 +9,5 @@ public interface CustomerDepartmentService {
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date createdTime, Date initTime);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date startTime, Date endTime);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.4__screen_org_add_source_col.sql

@ -0,0 +1,3 @@
alter table screen_customer_agency add column SOURCE_TYPE varchar(20) default 'external' after AREA_CODE;
alter table screen_customer_dept add column SOURCE_TYPE varchar(20) default 'external' after DEPT_MARK;
alter table screen_customer_grid add column SOURCE_TYPE varchar(20) default 'external' after PARTY_MARK;

25
epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml

@ -138,39 +138,16 @@
</filter>
</appender>
<!-- 2.3 level为 INFO 日志,时间滚动输出 -->
<appender name="FEIGEN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/feign.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/feign-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>5</maxHistory>
</rollingPolicy>
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test,local">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="DEBUG"/>
<logger name="com.epmet.feign.DataStatisticalOpenFeignClient" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
<appender-ref ref="FEIGEN_FILE"/>
</root>
</springProfile>
@ -179,14 +156,12 @@
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.epmet.feign.DataStatisticalOpenFeignClient" level="INFO"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
<appender-ref ref="FEIGEN_FILE"/>
</root>
</springProfile>

110
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -133,4 +133,114 @@
select count(*) from screen_customer_agency
where DEL_FLAG = '0' and CUSTOMER_ID = #{customerId}
</select>
<!-- 查询客户根组织ID -->
<select id="selectRootAgencyId" resultType="com.epmet.dto.screen.result.TreeResultDTO">
SELECT
agency_id,
pid,
pids,
level
FROM
screen_customer_agency
WHERE
del_flag = 0
AND agency_id = #{agencyId}
AND customer_id = #{customerId}
</select>
<!-- 查询下级机关的 id -->
<select id="selectSubAgencyList" resultType="com.epmet.dto.screen.result.TreeResultDTO">
SELECT
agency_id,
pids,
level
FROM
screen_customer_agency
WHERE
del_flag = '0'
AND pids = #{pids}
ORDER BY created_time DESC
</select>
<select id="getLastAddedAgency"
resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
select id,
customer_id,
agency_id,
agency_name,
pid,
pids,
all_parent_names,
area_marks,
center_mark,
party_mark,
level,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time
from screen_customer_agency sca
where sca.del_flag = 0
and sca.source_type='internal'
order by sca.CREATED_TIME desc
limit 1
</select>
<select id="getLastUpdatedAgency"
resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
select id,
customer_id,
agency_id,
agency_name,
pid,
pids,
all_parent_names,
area_marks,
center_mark,
party_mark,
level,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time
from screen_customer_agency sca
where sca.del_flag=0
and sca.source_type='internal'
order by sca.UPDATED_TIME desc
limit 1
</select>
<select id="selectByAgencyId"
resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
select id,
customer_id,
agency_id,
agency_name,
pid,
pids,
all_parent_names,
area_marks,
center_mark,
party_mark,
level,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time
from screen_customer_agency sca
where sca.AGENCY_ID = #{agencyId}
</select>
</mapper>

72
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml

@ -91,4 +91,76 @@
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
</select>
<select id="getLastAddDept" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity">
select id,
customer_id,
dept_id,
dept_name,
parent_agency_id,
area_marks,
center_mark,
dept_mark,
source_type,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time
from screen_customer_dept
where DEL_FLAG = 0
and SOURCE_TYPE = 'internal'
order by CREATED_TIME desc
limit 1
</select>
<select id="getLastUpdateDept" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity">
select id,
customer_id,
dept_id,
dept_name,
parent_agency_id,
area_marks,
center_mark,
dept_mark,
source_type,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time
from screen_customer_dept
where DEL_FLAG = 0
and SOURCE_TYPE = 'internal'
order by UPDATED_TIME desc
limit 1
</select>
<select id="selectByDeptId"
resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity">
select id,
customer_id,
dept_id,
dept_name,
parent_agency_id,
area_marks,
center_mark,
dept_mark,
source_type,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time
from screen_customer_dept
where DEPT_ID = #{deptId}
</select>
</mapper>

84
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml

@ -133,4 +133,88 @@
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
</select>
<!-- 根据agencyId查询网格ID -->
<select id="selectGridIdByAgencyId" resultType="java.lang.String">
SELECT
grid_id
FROM
screen_customer_grid
WHERE
del_flag = '0'
AND parent_agency_id = #{agencyId}
ORDER BY created_time DESC
</select>
<select id="getLastAddGrid" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity">
select id,
customer_id,
grid_id,
grid_name,
parent_agency_id,
area_marks,
center_mark,
party_mark,
source_type,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time,
all_parent_ids
from screen_customer_grid
where DEL_FLAG = 0 and SOURCE_TYPE='internal'
order by CREATED_TIME desc
limit 1
</select>
<select id="getLastUpdateGrid"
resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity">
select id,
customer_id,
grid_id,
grid_name,
parent_agency_id,
area_marks,
center_mark,
party_mark,
source_type,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time,
all_parent_ids
from screen_customer_grid
where DEL_FLAG = 0 and SOURCE_TYPE='internal'
order by UPDATED_TIME desc
limit 1
</select>
<select id="getByGridId" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity">
select id,
customer_id,
grid_id,
grid_name,
parent_agency_id,
area_marks,
center_mark,
party_mark,
source_type,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
data_end_time,
all_parent_ids
from screen_customer_grid
where DEL_FLAG = 0
and GRID_ID = #{gridId}
</select>
</mapper>

51
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml

@ -66,4 +66,55 @@
</foreach>
</insert>
<!-- 初始化好orgType="grid"的插入对象 -->
<select id="initGridPioneerDataList" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity">
SELECT
scg.CUSTOMER_ID,
'grid' AS ORG_TYPE,
SCG.GRID_ID AS ORG_ID,
scg.PARENT_AGENCY_ID AS PARENT_ID,
scg.GRID_NAME AS ORG_NAME,
0 as ISSUE_TOTAL,
0 asISSUE_RATIO,
0 asTOPIC_TOTAL,
0 asTOPIC_RATIO,
0 asPUBLISH_ISSUE_TOTAL,
0 asPUBLISH_ISSUE_RATIO,
0 asSHIFT_PROJECT_TOTAL,
0 asSHIFT_PROJECT_RATIO,
0 asRESOLVED_PROJECT_TOTAL,
0 asRESOLVED_PROJECT_RATIO
FROM
screen_customer_grid scg
WHERE
scg.DEL_FLAG = '0'
AND scg.CUSTOMER_ID =#{customerId}
</select>
<!-- 初始化好orgType="agency"的插入对象 -->
<select id="initAgencyPioneerDataList" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity">
SELECT
sca.CUSTOMER_ID,
'agency' AS ORG_TYPE,
sca.AGENCY_NAME AS ORG_ID,
sca.PID AS PARENT_ID,
sca.AGENCY_NAME AS ORG_NAME,
0 as ISSUE_TOTAL,
0 asISSUE_RATIO,
0 asTOPIC_TOTAL,
0 asTOPIC_RATIO,
0 asPUBLISH_ISSUE_TOTAL,
0 asPUBLISH_ISSUE_RATIO,
0 asSHIFT_PROJECT_TOTAL,
0 asSHIFT_PROJECT_RATIO,
0 asRESOLVED_PROJECT_TOTAL,
0 asRESOLVED_PROJECT_RATIO
FROM
screen_customer_agency sca
WHERE
sca.DEL_FLAG = '0'
and sca.`LEVEL`=#{agencyLevel}
AND sca.CUSTOMER_ID = #{customerId}
</select>
</mapper>

Loading…
Cancel
Save