diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/BranchCountFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/BranchCountFormDTO.java new file mode 100644 index 0000000000..1d2d9cb77f --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/BranchCountFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.evaluationindex.screen.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/10/27 11:08 上午 + */ +@Data +public class BranchCountFormDTO implements Serializable { + + private static final long serialVersionUID = -4869326660700557193L; + + public interface BranchCount{} + + /** + * 机关ID + */ + @NotBlank(message = "机关ID不能为空",groups = {BranchCount.class}) + private String agencyId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java index 97c32e1994..d6cc4cd785 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.evaluationindex.screen.dto.result; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * 按月查询各项指标数据--接口返参 @@ -30,4 +31,9 @@ public class AblityListResultDTO implements Serializable { */ private String showType; + /** + * 指标对应的权重 + */ + private BigDecimal weight; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/BranchCountResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/BranchCountResultDTO.java new file mode 100644 index 0000000000..5a2c8cd391 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/BranchCountResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.evaluationindex.screen.dto.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/10/27 11:03 上午 + */ +@Data +public class BranchCountResultDTO implements Serializable { + + private static final long serialVersionUID = -5915969126291502360L; + + private String agencyId; + + /** + * 机关名称 + */ + private String name; + + @JsonIgnore + private String level; + + private List partyDistribution; + + public BranchCountResultDTO() { + this.agencyId = ""; + this.name = ""; + this.partyDistribution = new ArrayList<>(); + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/DepartmentNameListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/DepartmentNameListResultDTO.java index 94cfb8fc51..033acfa1ed 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/DepartmentNameListResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/DepartmentNameListResultDTO.java @@ -2,6 +2,7 @@ package com.epmet.evaluationindex.screen.dto.result; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import java.io.Serializable; import java.util.List; @@ -12,6 +13,7 @@ import java.util.List; */ @Data @AllArgsConstructor +@NoArgsConstructor public class DepartmentNameListResultDTO implements Serializable { private static final long serialVersionUID = -801407836277197080L; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SubBranchCountResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SubBranchCountResultDTO.java new file mode 100644 index 0000000000..eac362ef84 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/SubBranchCountResultDTO.java @@ -0,0 +1,52 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/10/27 5:22 下午 + */ +@Data +public class SubBranchCountResultDTO implements Serializable { + + private static final long serialVersionUID = -4174988002147169566L; + + private String subId; + + /** + * 机关名称 + */ + private String name; + + /** + * 中心点位 + */ + private String centerMark; + + /** + * 社区下的党支部数 + */ + private Integer totalNum; + + /** + * 坐标区域 + */ + private String areaMarks; + + @JsonIgnore + private String allParentIds; + @JsonIgnore + private String subAgencyId; + + public SubBranchCountResultDTO() { + this.subId = ""; + this.name = ""; + this.centerMark = ""; + this.totalNum = 0; + this.areaMarks = ""; + this.subAgencyId = ""; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java index 8c17f03238..fb9eeb8860 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/DistributionController.java @@ -27,8 +27,8 @@ public class DistributionController { private DistributionService distributionService; /** - * @Description 1、党支部 * @param formDTO + * @Description 1、党支部分布 【只显示 screen_customer_biz_org 表中存在的orgId的数据】 * @author zxc * @date 2020/8/18 10:59 上午 */ @@ -39,7 +39,19 @@ public class DistributionController { } /** - * @Description 2、用户分布 + * @Description 查询机关下的党支部 + * @Param branchCountFormDTO + * @author zxc + * @date 2020/10/27 11:11 上午 + */ + @PostMapping("branchcount") + public Result branchCount(@RequestBody BranchCountFormDTO branchCountFormDTO){ + ValidatorUtils.validateEntity(branchCountFormDTO, BranchCountFormDTO.BranchCount.class); + return new Result().ok(distributionService.branchCount(branchCountFormDTO)); + } + + /** + * @Description 2、用户分布 【只显示 is_display = 1 的数据】 * @param userFormDTO * @author zxc * @date 2020/8/18 11:10 上午 @@ -51,7 +63,7 @@ public class DistributionController { } /** - * @Description 3、党员分布 + * @Description 3、党员分布 【只显示 is_display = 1 的数据】 * @param parymemberFormDTO * @author zxc * @date 2020/8/18 11:20 上午 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 7efd4d1853..52ddea4bd0 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -104,4 +104,12 @@ public interface ScreenCustomerAgencyDao { * @date 2020/10/23 3:54 下午 */ CompartmentResultDTO getAgencyInfoByAegncyId(@Param("agencyId") String agencyId); + + /** + * @Description 查询组织的下级组织ID + * @Param agencyId + * @author zxc + * @date 2020/10/28 10:33 上午 + */ + List selectSubAgencyId(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java index b6196411f8..a024d60791 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -48,6 +48,15 @@ public interface ScreenCustomerGridDao { */ List selectBranch(@Param("agencyId")String agencyId); + /** + * @Description 查询机关下的党支部 + * @Param branchCountFormDTO + * @author zxc + * @date 2020/10/27 11:11 上午 + */ + BranchCountResultDTO selectAgencyInfo(@Param("agencyId")String agencyId); + List selectBranchCount(@Param("agencyId")String agencyId); + /** * @Description 查询子级用户分布【网格级别】 * @param parentId diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/DistributionService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/DistributionService.java index a73d1ccfcd..9f2552329b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/DistributionService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/DistributionService.java @@ -21,6 +21,14 @@ public interface DistributionService { */ List branch(BranchFormDTO formDTO); + /** + * @Description 查询机关下的党支部 + * @Param branchCountFormDTO + * @author zxc + * @date 2020/10/27 11:11 上午 + */ + BranchCountResultDTO branchCount(BranchCountFormDTO branchCountFormDTO); + /** * @Description 2、用户分布 * @param userFormDTO diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/DistributionServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/DistributionServiceImpl.java index b65c0fe059..c94e85dc89 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/DistributionServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/DistributionServiceImpl.java @@ -11,12 +11,16 @@ import com.epmet.datareport.service.evaluationindex.screen.DistributionService; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 中央区相关各指标查询 @@ -24,6 +28,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/8/18 10:19 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class DistributionServiceImpl implements DistributionService { @@ -50,6 +55,45 @@ public class DistributionServiceImpl implements DistributionService { return branchResultDTOS; } + /** + * @Description 查询机关下的党支部 + * @Param branchCountFormDTO + * @author zxc + * @date 2020/10/27 11:11 上午 + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + public BranchCountResultDTO branchCount(BranchCountFormDTO branchCountFormDTO) { + BranchCountResultDTO branchCountResultDTO = screenCustomerGridDao.selectAgencyInfo(branchCountFormDTO.getAgencyId()); + if (null == branchCountResultDTO){ + return new BranchCountResultDTO(); + } + if (branchCountResultDTO.getLevel().equals(ScreenConstant.COMMUNITY)){ + return new BranchCountResultDTO(); + } + List agencyIds = screenCustomerAgencyDao.selectSubAgencyId(branchCountFormDTO.getAgencyId()); + List subList = screenCustomerGridDao.selectBranchCount(branchCountFormDTO.getAgencyId()); + if (!CollectionUtils.isEmpty(subList)){ + subList.forEach(sub -> { + agencyIds.forEach(agencyId -> { + if (sub.getAllParentIds().contains(agencyId.getSubId())){ + sub.setSubAgencyId(agencyId.getSubId()); + } + }); + }); + } + Map> groupBySubAgency = subList.stream().collect(Collectors.groupingBy(sub -> sub.getSubAgencyId())); + agencyIds.forEach(a -> { + groupBySubAgency.forEach((agencyId,value) -> { + if (a.getSubId().equals(agencyId)){ + a.setTotalNum(value.stream().collect(Collectors.summingInt(v -> v.getTotalNum()))); + } + }); + }); + branchCountResultDTO.setPartyDistribution(CollectionUtils.isEmpty(agencyIds) ? new ArrayList<>() : agencyIds); + return branchCountResultDTO; + } + /** * @Description 2、用户分布 * @param userFormDTO diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java index 6f8a0a0918..71b36fac4f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java @@ -207,7 +207,7 @@ public class ProjectServiceImpl implements ProjectService { ProcessAndCurrentDeptResultDTO data = processList.getData(); List processResultDTOS = ConvertUtils.sourceToTarget(data.getProcessList(), ProjectProcessResultDTO.class); projectDetailResultDTO.setProcessList(processResultDTOS); - List departmentNameListResultDTOS = ConvertUtils.sourceToTarget(data.getProcessList(), DepartmentNameListResultDTO.class); + List departmentNameListResultDTOS = ConvertUtils.sourceToTarget(data.getDepartmentList(), DepartmentNameListResultDTO.class); projectDetailResultDTO.setDepartmentList(departmentNameListResultDTOS); projectDetailResultDTO.setDepartmentNameList(data.getDepartmentNameList()); return projectDetailResultDTO; diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml index 9744157016..691f149e1c 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -7,7 +7,8 @@ SELECT fact.index_code AS "key", IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", - dict.index_name AS "name" + dict.index_name AS "name", + round(fact.WEIGHT,2) AS weight FROM fact_index_agency_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml index 197b6f9bf9..db57d11ee3 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml @@ -7,7 +7,8 @@ SELECT fact.index_code AS "key", IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", - dict.index_name AS "name" + dict.index_name AS "name", + round(fact.WEIGHT,2) AS weight FROM fact_index_community_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml index 1b317e2791..0cf826892b 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml @@ -7,7 +7,8 @@ SELECT fact.index_code AS "key", IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value", - dict.index_name AS "name" + dict.index_name AS "name", + round(fact.WEIGHT,2) AS weight FROM fact_index_grid_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 9007350e5c..8dd92ec0d1 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -80,7 +80,7 @@ sutd.org_type AS type FROM screen_user_total_data sutd - LEFT JOIN screen_customer_agency sca ON sca.agency_id = sutd.org_id + LEFT JOIN screen_customer_agency sca ON sca.agency_id = sutd.org_id AND sca.is_display = 1 WHERE sutd.del_flag = '0' AND sca.del_flag = 0 @@ -98,7 +98,7 @@ sutd.org_type AS type FROM screen_user_total_data sutd - LEFT JOIN screen_customer_agency sca ON sca.agency_id = sutd.org_id + LEFT JOIN screen_customer_agency sca ON sca.agency_id = sutd.org_id AND sca.is_display = 1 WHERE sutd.del_flag = '0' AND sca.del_flag = 0 @@ -197,4 +197,19 @@ del_flag = 0 AND agency_id = #{agencyId} + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index b17fe0f6a8..be82c07755 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -21,14 +21,16 @@ @@ -82,4 +84,41 @@ ORDER BY created_time DESC + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml index 2bbdece16c..7a59c7f16d 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml @@ -6,13 +6,14 @@ \ No newline at end of file