From c900ba7912c2cec626cdaf0e47634c5ec4df281c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 19 Aug 2020 11:21:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E6=94=AF=E9=83=A8=E3=80=81=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=86=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/result/BranchResultDTO.java | 17 +++---- .../ParymemberDistributionResultDTO.java | 12 ++--- .../dto/result/ParymemberResultDTO.java | 18 +++++-- .../screen/dto/result/UserResultDTO.java | 12 +++++ .../controller/screen/AgencyController.java | 7 ++- .../screen/DistributionController.java | 6 ++- .../dao/screen/ScreenCustomerAgencyDao.java | 20 ++++++-- .../dao/screen/ScreenCustomerGridDao.java | 27 ++++++++++ .../service/screen/AgencyService.java | 3 +- .../service/screen/DistributionService.java | 4 +- .../screen/impl/AgencyServiceImpl.java | 9 ++-- .../screen/impl/DistributionServiceImpl.java | 51 ++++++++++++++++--- .../mapper/screen/ScreenCustomerAgencyDao.xml | 36 +++++++++++++ .../mapper/screen/ScreenCustomerGridDao.xml | 49 ++++++++++++++++++ 14 files changed, 232 insertions(+), 39 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchResultDTO.java index a41d5111b0..0a836a6bfd 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchResultDTO.java @@ -14,22 +14,17 @@ public class BranchResultDTO implements Serializable { private static final long serialVersionUID = -8001714892170166320L; /** - * 名称:根据当前所在组织,查询出的子级名称 + * 网格ID */ - private String name; + private String gridId; /** - * 可能是agencyId,也可以是gridId, 也可以是deptId + * 网格名称 */ - private String id; + private String gridName; /** - * 组织:agency 网格:grid 部门:dept + * 党支部(网格)位置 */ - private String type; - - /** - * 中心点位 - */ - private String centerMark; + private String partyMark; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberDistributionResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberDistributionResultDTO.java index e663986791..397b53287b 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberDistributionResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberDistributionResultDTO.java @@ -16,31 +16,31 @@ public class ParymemberDistributionResultDTO implements Serializable { /** * 可能是gridId,可能是agencyId */ - private String subId; + private String subId = ""; /** * 中心点位 */ - private String centerMark; + private String centerMark = ""; /** * 党员总人数 */ - private Integer totalNum; + private Integer totalNum = 0; /** * 坐标区域 */ - private String areaMarks; + private String areaMarks = ""; /** * 可以是网格的名称,可以是组织的名称 */ - private String subName; + private String subName= ""; /** * 组织:agency, 网格 : grid; */ - private String type; + private String type = ""; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java index 432d81f2ed..b655f5fad5 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.screen.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -17,17 +18,28 @@ public class ParymemberResultDTO implements Serializable { /** * 当前所选组织 */ - private String agencyId; + private String agencyId = ""; /** * 当前所选组织名称 */ - private String name; + private String name = ""; /** * 当前所选组织的坐标区域 */ - private String areaMarks; + private String areaMarks = ""; + + /** + * 机关级别 + * 社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province + */ + @JsonIgnore + private String level; /** * 子级用户分布 diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java index ea13de5f0c..102faca70d 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.screen.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -29,6 +30,17 @@ public class UserResultDTO implements Serializable { */ private String areaMarks; + /** + * 机关级别 + * 社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province + */ + @JsonIgnore + private String level; + /** * 子级用户分布 */ diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java index c37a2ad225..d4bbc8f160 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java @@ -1,5 +1,7 @@ package com.epmet.datareport.controller.screen; +import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -35,9 +37,10 @@ public class AgencyController { * @author zxc * @date 2020/8/18 2:04 下午 */ + @ExternalAppRequestAuth @PostMapping("tree") - public Result tree(){ - return new Result().ok(agencyService.tree()); + public Result tree(ExternalAppRequestParam externalAppRequestParam){ + return new Result().ok(agencyService.tree(externalAppRequestParam)); } /** 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 c9b946f620..a85fe05054 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 @@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 中央区相关各指标查询 * @@ -35,9 +37,9 @@ public class DistributionController { * @date 2020/8/18 10:59 上午 */ @PostMapping("branch") - public Result branch(@RequestBody BranchFormDTO formDTO){ + public Result> branch(@RequestBody BranchFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, BranchFormDTO.Branch.class); - return new Result().ok(distributionService.branch(formDTO)); + return new Result>().ok(distributionService.branch(formDTO)); } /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java index dc08b40c34..c97ac8b8e0 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerAgencyDao.java @@ -17,9 +17,7 @@ package com.epmet.datareport.dao.screen; -import com.epmet.screen.dto.result.AgencyDistributionResultDTO; -import com.epmet.screen.dto.result.CompartmentResultDTO; -import com.epmet.screen.dto.result.TreeResultDTO; +import com.epmet.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -66,4 +64,20 @@ public interface ScreenCustomerAgencyDao { */ List selectSubDistribution(@Param("agencyId")String agencyId); + /** + * @Description 查询子级用户分布【机关级别】 + * @param parentId + * @author zxc + * @date 2020/8/19 9:33 上午 + */ + List selectUserDistributionAgency(@Param("parentId")String parentId); + + /** + * @Description 查询子级党员分布【机关级别】 + * @param parentId + * @author zxc + * @date 2020/8/19 10:30 上午 + */ + List selectParymemberDistribution(@Param("parentId")String parentId); + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java index 5f33641d71..9dff41e9ff 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java @@ -18,6 +18,9 @@ package com.epmet.datareport.dao.screen; import com.epmet.screen.dto.result.AgencyDistributionResultDTO; +import com.epmet.screen.dto.result.BranchResultDTO; +import com.epmet.screen.dto.result.ParymemberDistributionResultDTO; +import com.epmet.screen.dto.result.UserDistributionResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -39,5 +42,29 @@ public interface ScreenCustomerGridDao { * @date 2020/8/18 5:12 下午 */ List selectSubDistribution(@Param("agencyId")String agencyId); + + /** + * @Description 查询党支部信息 + * @param agencyId + * @author zxc + * @date 2020/8/19 9:13 上午 + */ + List selectBranch(@Param("agencyId")String agencyId); + + /** + * @Description 查询子级用户分布【网格级别】 + * @param parentId + * @author zxc + * @date 2020/8/19 9:33 上午 + */ + List selectUserDistribution(@Param("parentId")String parentId); + + /** + * @Description 查询子级党员分布【网格级别】 + * @param parentId + * @author zxc + * @date 2020/8/19 10:30 上午 + */ + List selectParymemberDistribution(@Param("parentId")String parentId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/AgencyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/AgencyService.java index 5b7a48177a..d3eee4f133 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/AgencyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/AgencyService.java @@ -1,5 +1,6 @@ package com.epmet.datareport.service.screen; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.screen.dto.form.CompartmentFormDTO; import com.epmet.screen.dto.result.CompartmentResultDTO; @@ -21,7 +22,7 @@ public interface AgencyService { * @author zxc * @date 2020/8/18 2:04 下午 */ - TreeResultDTO tree(); + TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam); /** * @Description 2、组织区域查询 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/DistributionService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/DistributionService.java index c98ad3b6c0..02471cdf22 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/DistributionService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/DistributionService.java @@ -7,6 +7,8 @@ import com.epmet.screen.dto.result.BranchResultDTO; import com.epmet.screen.dto.result.ParymemberResultDTO; import com.epmet.screen.dto.result.UserResultDTO; +import java.util.List; + /** * 中央区相关各指标查询 * @@ -21,7 +23,7 @@ public interface DistributionService { * @author zxc * @date 2020/8/18 10:59 上午 */ - BranchResultDTO branch(BranchFormDTO formDTO); + List branch(BranchFormDTO formDTO); /** * @Description 2、用户分布 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java index 65682d4441..3512ed5324 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.datareport.service.screen.impl; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.datareport.dao.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.screen.ScreenCustomerGridDao; @@ -35,10 +36,9 @@ public class AgencyServiceImpl implements AgencyService { * @date 2020/8/18 2:04 下午 */ @Override - public TreeResultDTO tree() { + public TreeResultDTO tree(ExternalAppRequestParam externalAppRequestParam) { // 1. 查询客户根组织ID - // TODO 改成正式注解获取customerId - String customerId = "zxc"; + String customerId = externalAppRequestParam.getCustomerId(); TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId); if (null == rootAgency){ return new TreeResultDTO(); @@ -74,6 +74,9 @@ public class AgencyServiceImpl implements AgencyService { @Override public CompartmentResultDTO compartment(CompartmentFormDTO compartmentFormDTO) { CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(compartmentFormDTO.getAgencyId()); + if (null == agencyAreaInfo){ + return agencyAreaInfo; + } if (agencyAreaInfo.getLevel().equals(ScreenConstant.COMMUNITY)){ // 当level为"community"时,查询screen_customer_grid表 List agencyDistributionResultDTOS = screenCustomerGridDao.selectSubDistribution(compartmentFormDTO.getAgencyId()); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/DistributionServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/DistributionServiceImpl.java index c83c82aff7..1c6356d550 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/DistributionServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/DistributionServiceImpl.java @@ -1,14 +1,19 @@ package com.epmet.datareport.service.screen.impl; +import com.epmet.datareport.dao.screen.ScreenCustomerAgencyDao; +import com.epmet.datareport.dao.screen.ScreenCustomerGridDao; import com.epmet.screen.dto.form.BranchFormDTO; import com.epmet.screen.dto.form.ParymemberFormDTO; import com.epmet.screen.dto.form.UserFormDTO; -import com.epmet.screen.dto.result.BranchResultDTO; -import com.epmet.screen.dto.result.ParymemberResultDTO; -import com.epmet.screen.dto.result.UserResultDTO; +import com.epmet.screen.dto.result.*; +import com.epmet.screen.constant.*; import com.epmet.datareport.service.screen.DistributionService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * 中央区相关各指标查询 * @@ -18,6 +23,11 @@ import org.springframework.stereotype.Service; @Service public class DistributionServiceImpl implements DistributionService { + @Autowired + private ScreenCustomerGridDao screenCustomerGridDao; + @Autowired + private ScreenCustomerAgencyDao screenCustomerAgencyDao; + /** * @Description 1、党支部 * @param formDTO @@ -25,8 +35,9 @@ public class DistributionServiceImpl implements DistributionService { * @date 2020/8/18 10:59 上午 */ @Override - public BranchResultDTO branch(BranchFormDTO formDTO) { - return null; + public List branch(BranchFormDTO formDTO) { + List branchResultDTOS = screenCustomerGridDao.selectBranch(formDTO.getAgencyId()); + return branchResultDTOS; } /** @@ -37,7 +48,20 @@ public class DistributionServiceImpl implements DistributionService { */ @Override public UserResultDTO user(UserFormDTO userFormDTO) { - return null; + UserResultDTO userResult = new UserResultDTO(); + CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(userFormDTO.getAgencyId()); + if (null == agencyAreaInfo){ + return userResult; + } + BeanUtils.copyProperties(agencyAreaInfo,userResult); + if (userResult.getLevel().equals(ScreenConstant.COMMUNITY)){ + List userDistributionResultDTOS = screenCustomerGridDao.selectUserDistribution(userFormDTO.getAgencyId()); + userResult.setUserDistribution(userDistributionResultDTOS); + }else { + List userDistributionResultDTOS = screenCustomerAgencyDao.selectUserDistributionAgency(userFormDTO.getAgencyId()); + userResult.setUserDistribution(userDistributionResultDTOS); + } + return userResult; } /** @@ -48,6 +72,19 @@ public class DistributionServiceImpl implements DistributionService { */ @Override public ParymemberResultDTO parymember(ParymemberFormDTO parymemberFormDTO) { - return null; + ParymemberResultDTO parymemberResult = new ParymemberResultDTO(); + CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(parymemberFormDTO.getAgencyId()); + if (null == agencyAreaInfo){ + return parymemberResult; + } + BeanUtils.copyProperties(agencyAreaInfo,parymemberResult); + if (parymemberResult.getLevel().equals(ScreenConstant.COMMUNITY)){ + List parymemberDistributionResultDTOS = screenCustomerGridDao.selectParymemberDistribution(parymemberFormDTO.getAgencyId()); + parymemberResult.setUserDistribution(parymemberDistributionResultDTOS); + }else { + List parymemberDistributionResultDTOS = screenCustomerAgencyDao.selectParymemberDistribution(parymemberFormDTO.getAgencyId()); + parymemberResult.setUserDistribution(parymemberDistributionResultDTOS); + } + return parymemberResult; } } 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 b92fc4e8c6..cfdb8da6de 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 @@ -61,4 +61,40 @@ AND pid = #{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 df1a2fbe44..988e0b17cd 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 @@ -17,4 +17,53 @@ del_flag = 0 AND parent_agency_id = #{agencyId} + + + + + + + + + \ No newline at end of file