diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/OrgSourceTypeConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/OrgSourceTypeConstant.java new file mode 100644 index 0000000000..966c3edc80 --- /dev/null +++ b/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"; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/ScreenConstant.java new file mode 100644 index 0000000000..e7bb0e3dc3 --- /dev/null +++ b/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 = ","; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/TreeResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/TreeResultDTO.java new file mode 100644 index 0000000000..9a40652c09 --- /dev/null +++ b/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; +} + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index 4c323ae151..852f7b7d02 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/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(); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index b672d53351..413ff84e10 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/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"); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 471c65ee0d..4c3b670b57 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/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(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java new file mode 100644 index 0000000000..1c0f7520b0 --- /dev/null +++ b/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(); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 04e5a0027d..7d9362a1aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/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 selectSubAgencyList(@Param("pids") String pids); + + ScreenCustomerAgencyEntity getLastAddedAgency(); + + ScreenCustomerAgencyEntity getLastUpdatedAgency(); + + ScreenCustomerAgencyEntity selectByAgencyId(String agencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java index cbe11d059c..3a992c7ca6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java +++ b/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 * @Date 16:57 2020-09-03 **/ List selectListDeptInfo(@Param("customerId")String customerId); + + /** + * 查询最后一次添加的部门 + * @return + */ + ScreenCustomerDeptEntity getLastAddDept(); + + ScreenCustomerDeptEntity getLastUpdateDept(); + + ScreenCustomerDeptEntity selectByDeptId(String deptId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index c6aac179af..5e49d15e0c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/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 * @Date 16:57 2020-09-03 **/ List selectListGridInfo(@Param("customerId")String customerId); + + /** + * @Description 根据agencyId查询网格ID + * @param agencyId + * @author zxc + * @date 2020/9/22 2:16 下午 + */ + List selectGridIdByAgencyId(@Param("agencyId")String agencyId); + + ScreenCustomerGridEntity getLastAddGrid(); + + ScreenCustomerGridEntity getLastUpdateGrid(); + + ScreenCustomerGridEntity getByGridId(String gridId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPioneerDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPioneerDataDao.java index 8789e6edef..c9307411d5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPioneerDataDao.java +++ b/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 { * @Date 10:52 2020-08-18 **/ void batchInsertPioneerData(@Param("list") List list, @Param("customerId")String customerId); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 初始化好orgType="grid"的插入对象 + * @Date 2020/9/22 15:03 + **/ + List initGridPioneerDataList(@Param("customerId") String customerId); + + /** + * @return java.util.List + * @param customerId + * @param agencyLevel + * @author yinzuomei + * @description 初始化好orgType="agency"的插入对象 + * @Date 2020/9/22 15:03 + **/ + List initAgencyPioneerDataList(@Param("customerId")String customerId, @Param("agencyLevel")String agencyLevel); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java index e06907ca84..da0a164888 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java +++ b/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新增) */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java index 6fdb38f4b8..474243815a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java +++ b/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; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java index 19fdd132be..0b98a125eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java +++ b/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; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java new file mode 100644 index 0000000000..64ba669caf --- /dev/null +++ b/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(); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyBaseInfoService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyBaseInfoService.java new file mode 100644 index 0000000000..91656440bf --- /dev/null +++ b/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); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PioneerDataExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PioneerDataExtractService.java index 1b82c8588c..520977c323 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PioneerDataExtractService.java +++ b/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); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java new file mode 100644 index 0000000000..39a7724f3a --- /dev/null +++ b/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 stringObjectMap = agencyService.selectAllSubAgencyId(agencyId, customerId); + System.out.println(stringObjectMap); + return null; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index 66ae834dae..b658ec71aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/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 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) { + + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index 438eb66c38..4928669aaa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/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 { +public interface ScreenCustomerAgencyService{ + + /** + * @Description 根据agencyId,查询所有子级agencyId,【当机关的级别为 community时,所有子级为gridId】 + * @param agencyId + * @param customerId + * map.put('机关的级别(level)','community/street/district/city/province') + * map.put('agencyId','List 所有子级agencyId') + * @author zxc + * @date 2020/9/22 1:39 下午 + */ + Map selectAllSubAgencyId(String agencyId, String customerId); + + ScreenCustomerAgencyEntity getLastAddedAgency(); + + ScreenCustomerAgencyEntity getLastUpdatedAgency(); + + void initAgencies(List agencies2Add, List agencies2Update); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerDeptService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerDeptService.java index e2acb8dee2..88405c7f49 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerDeptService.java +++ b/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 { + /** + * 最后一次添加的部门 + * @return + */ + ScreenCustomerDeptEntity getLastAddDept(); + + ScreenCustomerDeptEntity getLastUpdateDept(); + + void addAndUpdateDepartments(List depts2Add, List depts2Update); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index 5093fedbae..d12238c077 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/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 getLastAddGrid(); + ScreenCustomerGridEntity getLastUpdateGrid(); + + void addAndUpdateGrids(List grids2Add, List grids2Update); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPioneerDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPioneerDataService.java index 8bec0b6ac2..1add697600 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPioneerDataService.java +++ b/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 { + /** + * @return java.util.List + * @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 initPioneerDataList(String customerId, String orgType,String agencyLevel); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index a5d0a6bece..cdb9d68da4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/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 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 所有子级agencyId') + * @author zxc + * @date 2020/9/22 1:39 下午 + */ + @Override + public Map selectAllSubAgencyId(String agencyId, String customerId) { + Map resultMap = new HashMap<>(16); + TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId,agencyId); + if (null == rootAgency){ + return new HashMap<>(16); + } + if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){ + List 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 getDepartmentList(String subAgencyPids) { + List result = new ArrayList<>(); + List subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids); + if (!CollectionUtils.isEmpty(subAgencyList)) { + result.addAll(subAgencyList.stream().map(sub -> sub.getAgencyId()).collect(Collectors.toList())); + subAgencyList.forEach(sub -> { + List 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 agencies2Add, List 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); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerDeptServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerDeptServiceImpl.java index ae997fc4b3..0570eb7de1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerDeptServiceImpl.java +++ b/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 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 depts2Add, List 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); + } + } + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index fe8a29e993..a2922cbc19 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/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 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 grids2Add, List 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); + } + } + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java index 6d56c57ff0..f7299247ac 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPioneerDataServiceImpl.java +++ b/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 implements ScreenPioneerDataService { + /** + * @param customerId + * @param orgType :grid,agency + * @param agencyLevel : 机关级别(社区级:community, 乡(镇、街道)级:street,区县级: district,市级: city 省级:province) + * @return java.util.List + * @author yinzuomei + * @description 构造screen_pioneer_data 初始数据,先赋值为0 + * @Date 2020/9/22 14:41 + **/ + @DataSource(DataSourceConstant.EVALUATION_INDEX) + @Override + public List initPioneerDataList(String customerId, String orgType, String agencyLevel) { + List list=new ArrayList<>(); + if("grid".equals(orgType)){ + list=baseDao.initGridPioneerDataList(customerId); + }else if("agency".equals(orgType)){ + list=baseDao.initAgencyPioneerDataList(customerId,agencyLevel); + } + return list; + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java new file mode 100644 index 0000000000..d35aa6bec6 --- /dev/null +++ b/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 agencies2Add = listAgencies2Add(); + List agencies2Update = listAgencies2Update(); + + screenCustomerAgencyService.initAgencies(agencies2Add, agencies2Update); + } + + /** + * 查询可更新的单位 + * @return + */ + private List 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 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 depts2Add = listDepts2Add(); + List depts2Update = listDepts2Update(); + screenCustomerDeptService.addAndUpdateDepartments(depts2Add, depts2Update); + } + + /** + * 查询需要更新的部门列表 + * @return + */ + private List 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 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 grids2Add = listGrids2Add(); + List grids2Update =listGrids2Update(); + screenCustomerGridService.addAndUpdateGrids(grids2Add, grids2Update); + } + + private List 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 listGrids2Add() { + ScreenCustomerGridEntity lastAddGrid = screenCustomerGridService.getLastAddGrid(); + + Date endTime = new Date(); + Date startTime = null; + if (lastAddGrid != null) { + startTime = lastAddGrid.getCreatedTime(); + } + + return customerGridService.listGridsByCreateTime(startTime, endTime); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java index 15178715ed..f7d5900682 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java @@ -9,5 +9,5 @@ public interface CustomerDepartmentService { List listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo); - List listDepartmentsByUpdatedTime(Date createdTime, Date initTime); + List listDepartmentsByUpdatedTime(Date startTime, Date endTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.4__screen_org_add_source_col.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.4__screen_org_add_source_col.sql new file mode 100644 index 0000000000..88d6e55b66 --- /dev/null +++ b/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; \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml index 216db98691..99ae63af58 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml @@ -138,39 +138,16 @@ - - - - - ${log.path}/feign.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - ${log.path}/feign-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 5 - - - - - @@ -179,14 +156,12 @@ - - diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 49ce41b17c..7067515e0a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/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} + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml index 1533203d14..26c34d328b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml +++ b/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} + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index 92486a3f10..3a15aae8e7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/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} + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml index 91d8537c19..70e8170efb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml @@ -66,4 +66,55 @@ + + + + + +