From fa31c6f51e3669e292b06a31be95c6336521a22c Mon Sep 17 00:00:00 2001 From: yanghui <2536613402@qq.com> Date: 星期四, 20 十月 2022 15:53:46 +0800 Subject: [PATCH] #feat 修复bug --- springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 173 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java index 5fc4ea0..3a5477d 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java @@ -1,5 +1,7 @@ package com.panzhihua.service_dangjian.service.impl; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.google.common.collect.Lists; @@ -7,6 +9,7 @@ import com.panzhihua.common.model.vos.common.ComPbCheckUnitVo; import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitErrorExcelVO; import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitExcelVO; +import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_dangjian.dao.ComPbMemberDAO; import com.panzhihua.service_dangjian.dao.ComPbMemberRoleDAO; @@ -16,6 +19,7 @@ import com.panzhihua.service_dangjian.model.dos.ComPbMemberRoleDO; import com.panzhihua.service_dangjian.service.ComPbCheckUnitService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.panzhihua.service_dangjian.service.ComPbMemberService; import org.springframework.beans.BeanUtils; import com.panzhihua.common.model.dtos.common.*; import com.panzhihua.common.model.vos.R; @@ -45,6 +49,10 @@ private ComPbMemberDAO comPbMemberDAO; @Resource private ComPbMemberRoleDAO comPbMemberRoleDAO; + @Resource + private ComPbMemberService comPbMemberService; + @Resource + private CommunityService communityService; /** * description queryByPage 分页查询 @@ -56,6 +64,21 @@ */ @Override public R queryByPage(PageComPbCheckUnitDto comPbCheckUnit) { + + Long communityId = comPbCheckUnit.getCommunityId(); + R r = communityService.selectCommunityIds(communityId); + List<Long> communityIds = null; + if(R.isOk(r)){ + communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + }else { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + comPbCheckUnit.setCommunityIds(communityIds); IPage<ComPbCheckUnitVo> checkUnitVoPage= this.baseMapper.queryAllByLimit(comPbCheckUnit, new Page(comPbCheckUnit.getPageNum(), comPbCheckUnit.getPageSize())); checkUnitVoPage.getRecords().forEach(checkUnit -> { if(StringUtils.isEmpty(checkUnit.getOrgName())){ @@ -74,9 +97,14 @@ * @date 2022-02-16 16:22:26 */ @Override + @Transactional public R insert(AddComPbCheckUnitDto comPbCheckUnit) { + Long communityId=this.baseMapper.selectCommunityId(comPbCheckUnit.getHelpCommunityName().split(",")[0],comPbCheckUnit.getHelpCommunityName().split(",")[1],comPbCheckUnit.getHelpCommunityName().split(",")[2]); ComPbCheckUnit entity = new ComPbCheckUnit(); BeanUtils.copyProperties(comPbCheckUnit, entity); + if(communityId!=null){ + entity.setCommunityId(communityId); + } if (this.baseMapper.insert(entity) > 0) { return R.ok(); } @@ -160,6 +188,20 @@ */ @Override public R queryByList(PageComPbCheckUnitDto comPbCheckUnit) { + Long communityId = comPbCheckUnit.getCommunityId(); + R r = communityService.selectCommunityIds(communityId); + List<Long> communityIds = null; + if(R.isOk(r)){ + communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + }else { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + comPbCheckUnit.setCommunityIds(communityIds); IPage<ComPbCheckUnitVo> checkUnitList = this.baseMapper.queryAllByLimit(comPbCheckUnit,new Page(comPbCheckUnit.getPageNum(),comPbCheckUnit.getPageSize())); checkUnitList.getRecords().forEach(checkUnit -> { if(StringUtils.isEmpty(checkUnit.getOrgName())){ @@ -219,4 +261,135 @@ } return R.ok(); } + + @Override + public R detailByPhone(String phone) { + List<ComPbCheckUnit> comPbCheckUnits=this.baseMapper.selectList(new QueryWrapper<ComPbCheckUnit>().lambda().eq(ComPbCheckUnit::getAdminPhone,phone)); + if(!comPbCheckUnits.isEmpty()){ + return R.ok(comPbCheckUnits.get(0)); + } + return R.ok(); + } + + /** + * 报到单位统计-顶部数据 + * @param communityId + * @param belongTo + * @param choice + * @return + */ + @Override + public R unitStatisticsTop(Long communityId, String belongTo, String choice) { + R r = communityService.selectCommunityIds(communityId); + List<Long> communityIds = null; + if(R.isOk(r)){ + communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + }else { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + return R.ok(this.baseMapper.unitStatisticsTop(communityIds, belongTo, choice)); + } + + /** + * 报到单位统计 + * @param commonDto + * @return + */ + @Override + public R unitStatistics(PagePbCheckUnitCommonDto commonDto) { + Long communityId = commonDto.getCommunityId(); + R r = communityService.selectCommunityIds(communityId); + List<Long> communityIds = null; + if(R.isOk(r)){ + communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + }else { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + commonDto.setCommunityIds(communityIds); + return R.ok(this.baseMapper.unitStatistics(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize()))); + } + + /** + * 报到党员统计-顶部数据 + * @param communityId + * @param belongTo + * @param choice + * @param checkUnitId + * @return + */ + @Override + public R pbStatisticsTop(Long communityId, String belongTo, String choice, Long checkUnitId) { + + R r = communityService.selectCommunityIds(communityId); + List<Long> communityIds = null; + if(R.isOk(r)){ + communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + }else { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + return R.ok(this.baseMapper.pbStatisticsTop(communityIds, belongTo, choice, checkUnitId)); + } + + /** + * 报到党员统计-按单位归属统计 + * @param commonDto + * @return + */ + @Override + public R pbStatisticsBelong(PagePbCheckUnitCommonDto commonDto) { + Long communityId = commonDto.getCommunityId(); + R r = communityService.selectCommunityIds(communityId); + List<Long> communityIds = null; + if(R.isOk(r)){ + communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + }else { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + commonDto.setCommunityIds(communityIds); + return R.ok(this.baseMapper.pbStatisticsBelong(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize()))); + } + + /** + * 报到党员统计-按单位统计 + * @param commonDto + * @return + */ + @Override + public R pbStatisticsUnit(PagePbCheckUnitCommonDto commonDto) { + Long communityId = commonDto.getCommunityId(); + R r = communityService.selectCommunityIds(communityId); + List<Long> communityIds = null; + if(R.isOk(r)){ + communityIds = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); + if (CollUtil.isEmpty(communityIds)) { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + }else { + communityIds = new ArrayList<>(); + communityIds.add(communityId); + } + commonDto.setCommunityIds(communityIds); + return R.ok(this.baseMapper.pbStatisticsUnit(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize()))); + } } -- Gitblit v1.7.1