From 3b4a560d7c568946b79bbed72cc177101dd6e503 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Mon, 14 Dec 2020 21:08:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PartyOrganizeAppController.java | 29 ++++++ .../PartyOrganizeResourceController.java | 37 ++++++++ .../IPartyMemberOrganizeDao.java | 6 ++ .../dao/partyorganize/IPartyOrganizeDao.java | 14 +++ .../partyorganize/IPartyOrganizeService.java | 14 +++ .../impl/PartyOrganizeServiceImpl.java | 89 ++++++++++++++++++- .../partymemberorganize-mapper.xml | 68 ++++++++++++-- .../partyorganize/partyorganize-mapper.xml | 61 +++++++++++++ 8 files changed, 308 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/cm/partybuilding/controller/app/apis/partyorganize/PartyOrganizeAppController.java b/src/main/java/com/cm/partybuilding/controller/app/apis/partyorganize/PartyOrganizeAppController.java index 77f0421..21cda63 100644 --- a/src/main/java/com/cm/partybuilding/controller/app/apis/partyorganize/PartyOrganizeAppController.java +++ b/src/main/java/com/cm/partybuilding/controller/app/apis/partyorganize/PartyOrganizeAppController.java @@ -108,6 +108,15 @@ public class PartyOrganizeAppController extends AbstractController { return partyOrganizeService.listPagePartyOrganize(page); } + @ApiOperation(value = "党组织分页列表", notes = "党组织分页列表接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpagepartyorganize" + ISystemConstant.APP_RELEASE_SUFFIX) + public SuccessResultList> listPagePartyOrganizeNoToken(ListPage page) throws SearchException { + Map params = requestParams(); + page.setParams(params); + return partyOrganizeService.listPagePartyOrganize(page); + } + @ApiOperation(value = "党组织统计", notes = "党组织统计接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("countpartyorganize") @@ -124,4 +133,24 @@ public class PartyOrganizeAppController extends AbstractController { return partyOrganizeService.countPartyMember(params); } + @ApiOperation(value = "该党组织中党员人数统计", notes = "该党组织中党员人数统计接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countpartymember" + ISystemConstant.APP_RELEASE_SUFFIX) + SuccessResultData countPartyMemberNoToken() throws SearchException { + Map params = requestParams(); + return partyOrganizeService.countPartyMember(params); + } + + @ApiOperation(value = "大数据页面统计用(支部数,党员数,男女比例)", notes = "大数据页面统计用(支部数,党员数,男女比例)接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "belongLevel", value = "所属级别", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("bigdata" + ISystemConstant.APP_RELEASE_SUFFIX) + SuccessResultData> bigData(@RequestParam("belongLevel") String belongLevel) throws SearchException { + Map params = requestParams(); + params.put("belongLevel", belongLevel); + return partyOrganizeService.bigData(params); + } + } \ No newline at end of file diff --git a/src/main/java/com/cm/partybuilding/controller/resources/partyorganize/PartyOrganizeResourceController.java b/src/main/java/com/cm/partybuilding/controller/resources/partyorganize/PartyOrganizeResourceController.java index e6fd681..c7aecfb 100644 --- a/src/main/java/com/cm/partybuilding/controller/resources/partyorganize/PartyOrganizeResourceController.java +++ b/src/main/java/com/cm/partybuilding/controller/resources/partyorganize/PartyOrganizeResourceController.java @@ -125,4 +125,41 @@ public class PartyOrganizeResourceController extends AbstractController { return partyOrganizeService.countPartyMember(params); } + @ApiOperation(value = "党组织分页列表", notes = "党组织分页列表接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpagepartyorganize" + ISystemConstant.APP_RELEASE_SUFFIX) + public SuccessResultList> listPagePartyOrganizeNoToken(ListPage page) throws SearchException { + Map params = requestParams(); + page.setParams(params); + return partyOrganizeService.listPagePartyOrganize(page); + } + + @ApiOperation(value = "该党组织中党员人数统计", notes = "该党组织中党员人数统计接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countpartymember" + ISystemConstant.APP_RELEASE_SUFFIX) + SuccessResultData countPartyMemberNoToken() throws SearchException { + Map params = requestParams(); + return partyOrganizeService.countPartyMember(params); + } + + @ApiOperation(value = "该党组织中党员人数统计", notes = "该党组织中党员人数统计接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("countpartymembersex" + ISystemConstant.APP_RELEASE_SUFFIX) + SuccessResultData> countPartyMemberSexNoToken() throws SearchException { + Map params = requestParams(); + return partyOrganizeService.countPartyMemberSex(params); + } + + @ApiOperation(value = "大数据页面统计用(支部数,党员数,男女比例)", notes = "大数据页面统计用(支部数,党员数,男女比例)接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "belongLevel", value = "所属级别", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("bigdata" + ISystemConstant.APP_RELEASE_SUFFIX) + SuccessResultData> bigData(@RequestParam("belongLevel") String belongLevel) throws SearchException { + Map params = requestParams(); + params.put("belongLevel", belongLevel); + return partyOrganizeService.bigData(params); + } + } \ No newline at end of file diff --git a/src/main/java/com/cm/partybuilding/dao/partymemberorganize/IPartyMemberOrganizeDao.java b/src/main/java/com/cm/partybuilding/dao/partymemberorganize/IPartyMemberOrganizeDao.java index eed0a5c..f0b0a20 100644 --- a/src/main/java/com/cm/partybuilding/dao/partymemberorganize/IPartyMemberOrganizeDao.java +++ b/src/main/java/com/cm/partybuilding/dao/partymemberorganize/IPartyMemberOrganizeDao.java @@ -80,4 +80,10 @@ public interface IPartyMemberOrganizeDao { */ Integer countPartyMemberOrganize(Map params) throws SearchException; + /** + * 党员数(大数据页面用) + * @param params + * @return + */ + List listPartyMemberOrganizeForBigData(Map params); } \ No newline at end of file diff --git a/src/main/java/com/cm/partybuilding/dao/partyorganize/IPartyOrganizeDao.java b/src/main/java/com/cm/partybuilding/dao/partyorganize/IPartyOrganizeDao.java index ad83d8e..50f4bf6 100644 --- a/src/main/java/com/cm/partybuilding/dao/partyorganize/IPartyOrganizeDao.java +++ b/src/main/java/com/cm/partybuilding/dao/partyorganize/IPartyOrganizeDao.java @@ -87,4 +87,18 @@ public interface IPartyOrganizeDao { * @throws SearchException */ Integer countPartyMemberOfPartyOrganize(Map params) throws SearchException; + + /** + * 党组织列表(大数据页面用) + * @param params + * @return + */ + List listPartyOrganizeForBigData(Map params); + + /** + * 某支部下党员男女比 + * @param params + * @return + */ + List countPartyMemberOfSex(Map params); } \ No newline at end of file diff --git a/src/main/java/com/cm/partybuilding/service/partyorganize/IPartyOrganizeService.java b/src/main/java/com/cm/partybuilding/service/partyorganize/IPartyOrganizeService.java index d04718d..4696d32 100644 --- a/src/main/java/com/cm/partybuilding/service/partyorganize/IPartyOrganizeService.java +++ b/src/main/java/com/cm/partybuilding/service/partyorganize/IPartyOrganizeService.java @@ -160,4 +160,18 @@ public interface IPartyOrganizeService { * @throws SearchException */ SuccessResultData countPartyMember(Map params) throws SearchException; + + /** + * 大数据页面统计用(支部数,党员数,男女比例) + * @param params + * @return + */ + SuccessResultData> bigData(Map params); + + /** + * 某支部下党员男女比 + * @param params + * @return + */ + SuccessResultData> countPartyMemberSex(Map params); } \ No newline at end of file diff --git a/src/main/java/com/cm/partybuilding/service/partyorganize/impl/PartyOrganizeServiceImpl.java b/src/main/java/com/cm/partybuilding/service/partyorganize/impl/PartyOrganizeServiceImpl.java index 0bdd21a..f0b0d6a 100644 --- a/src/main/java/com/cm/partybuilding/service/partyorganize/impl/PartyOrganizeServiceImpl.java +++ b/src/main/java/com/cm/partybuilding/service/partyorganize/impl/PartyOrganizeServiceImpl.java @@ -10,12 +10,16 @@ import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.UUIDUtil; +import com.cm.partybuilding.dao.partymemberorganize.IPartyMemberOrganizeDao; import com.cm.partybuilding.dao.partyorganize.IPartyOrganizeDao; +import com.cm.partybuilding.pojo.dtos.partymemberorganize.PartyMemberOrganizeDTO; import com.cm.partybuilding.pojo.dtos.partyorganize.PartyOrganizeDTO; import com.cm.partybuilding.pojo.vos.partyorganize.PartyOrganizeVO; +import com.cm.partybuilding.service.partymemberorganize.IPartyMemberOrganizeService; import com.cm.partybuilding.service.partyorganize.IPartyOrganizeService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -35,6 +39,8 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO private IPartyOrganizeDao partyOrganizeDao; @Autowired private SecurityComponent securityComponent; + @Autowired + private IPartyMemberOrganizeDao partyMemberOrganizeDao; @Override public SuccessResult savePartyOrganize(PartyOrganizeVO partyOrganizeVO) throws Exception { @@ -171,8 +177,10 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO @Override public SuccessResultList> listPagePartyOrganize(ListPage page) throws SearchException { PageHelper.startPage(page.getPage(), page.getRows()); - setDataAuthorityInfo(page.getParams()); - page.getParams().put("creator", securityComponent.getCurrentUser().getUserId()); + if(page.getParams().get("bigData") == null) { + setDataAuthorityInfo(page.getParams()); + page.getParams().put("creator", securityComponent.getCurrentUser().getUserId()); + } List partyOrganizeDTOs = partyOrganizeDao.listPartyOrganize(page.getParams()); PageInfo pageInfo = new PageInfo<>(partyOrganizeDTOs); return new SuccessResultList<>(partyOrganizeDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); @@ -194,6 +202,66 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO return new SuccessResultData<>(countPartyMemberOfPartyOrganize(params)); } + @Override + public SuccessResultData> bigData(Map params) { + getPartyOrganizeCount(params); + getPartyOrganizeMemberCount(params); + getPartyOrganizeMemberSexCount(params); + return new SuccessResultData<>(params); + } + + /** + * 获取支部数 + * @param params + */ + private void getPartyOrganizeCount(Map params) { + List partyOrganizeDTO = partyOrganizeDao.listPartyOrganizeForBigData(params); + partyOrganizeDTO = partyOrganizeDTO == null ? new ArrayList<>() : partyOrganizeDTO; + int count = partyOrganizeDTO == null ? 0 : partyOrganizeDTO.size(); + params.put("partyOrganizeCount", count); + params.put("partyOrganizeDTOList", partyOrganizeDTO); + } + + /** + * 获取支部党员数 + * @param params + */ + private void getPartyOrganizeMemberCount(Map params) { + List partyOrganizeIds = new ArrayList<>(); + for(PartyOrganizeDTO partyMemberOrganizeDTO : (List) params.get("partyOrganizeDTOList")) { + partyOrganizeIds.add(partyMemberOrganizeDTO.getPartyOrganizeId()); + } + List partyMemberOrganizeDTO = null; + if(partyOrganizeIds.size() > 0) { + params.put("partyOrganizeIds", partyOrganizeIds); + partyMemberOrganizeDTO = partyMemberOrganizeDao.listPartyMemberOrganizeForBigData(params); + } + partyMemberOrganizeDTO = partyMemberOrganizeDTO == null ? new ArrayList<>() : partyMemberOrganizeDTO; + int count = partyMemberOrganizeDTO == null ? 0 : partyMemberOrganizeDTO.size(); + params.put("partyMemberCount", count); + params.put("partyMemberList", partyMemberOrganizeDTO); + params.remove("partyOrganizeIds"); + } + + /** + * 获取支部党员男女比例 + * @param params + */ + private void getPartyOrganizeMemberSexCount(Map params) { + int girl = 0; + int boy = 0; + for(PartyMemberOrganizeDTO partyMemberOrganizeDTO : (List) params.get("partyMemberList")) { + if(partyMemberOrganizeDTO.getSexName().equals("男")) { + boy++; + }else { + girl++; + } + } + params.put("boy", boy); + params.put("girl", girl); + params.remove("partyMemberList"); + } + /** * 计算党组织中的党员数量(私有方法) * @param params @@ -205,4 +273,21 @@ public class PartyOrganizeServiceImpl extends AbstractService implements IPartyO return count == null ? 0 : count; } + @Override + public SuccessResultData> countPartyMemberSex(Map params) { + List sexList = partyOrganizeDao.countPartyMemberOfSex(params); + int boy = 0; + int girl = 0; + for(String s: sexList) { + if(s.equals("男")) { + boy++; + }else if(s.equals("女")) { + girl++; + } + } + params.put("boy", boy); + params.put("girl", girl); + return new SuccessResultData<>(params); + } + } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/partymemberorganize/partymemberorganize-mapper.xml b/src/main/resources/mybatis/mapper/partymemberorganize/partymemberorganize-mapper.xml index 6e80552..619514d 100644 --- a/src/main/resources/mybatis/mapper/partymemberorganize/partymemberorganize-mapper.xml +++ b/src/main/resources/mybatis/mapper/partymemberorganize/partymemberorganize-mapper.xml @@ -321,8 +321,8 @@ - - SELECT t1.landline, t1.education, @@ -364,11 +364,63 @@ gen_party_member_organize t1 WHERE t1.is_delete = 0 + + AND + t1.belong_party_organize IN + + #{partyOrganizeIds[${index}]} + + + + + + + + + + + + \ No newline at end of file