From 4ad4b51a4fb177eafee8a3a355496e7b6c1be662 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期四, 11 七月 2024 16:24:46 +0800
Subject: [PATCH] 花城 小程序签退打卡获取积分详情报错2

---
 springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java |   64 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 5 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 21c87c0..f2e355a 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,6 +1,8 @@
 package com.panzhihua.service_dangjian.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,7 +14,9 @@
 import com.panzhihua.common.model.dtos.common.PageComPbCheckUnitDto;
 import com.panzhihua.common.model.dtos.common.PagePbCheckUnitCommonDto;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.model.vos.TreeListVO;
 import com.panzhihua.common.model.vos.common.ComPbCheckUnitVo;
+import com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo;
 import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitErrorExcelVO;
 import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitExcelVO;
 import com.panzhihua.common.utlis.StringUtils;
@@ -31,6 +35,8 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * title: 党建-报到单位表服务实现类
@@ -80,6 +86,34 @@
         return R.ok(checkUnitVoPage);
     }
 
+    @Override
+    public R treeList(TreeListVO treeListVO) {
+        QueryWrapper<ComPbCheckUnit> wrapper = new QueryWrapper<>();
+        if(treeListVO.getName() != null){
+            wrapper.eq("belong_to",treeListVO.getName());
+        } else if(treeListVO.getOrgName() != null){
+            wrapper.eq("org_name",treeListVO.getOrgName());
+        } else {
+            return R.ok();
+        }
+        List<ComPbCheckUnit> comPbCheckUnits = this.baseMapper.selectList(wrapper);
+        return R.ok(comPbCheckUnits);
+    }
+
+    @Override
+    public R orgList() {
+        QueryWrapper<ComPbCheckUnit> wrapper = new QueryWrapper<>();
+        List<ComPbCheckUnitVo> voList = new ArrayList<>();
+        List<ComPbCheckUnit> list = this.baseMapper.selectList(wrapper);
+        Map<String, List<ComPbCheckUnit>> map = list.stream().filter(f -> f.getOrgName() != null).collect(Collectors.groupingBy(ComPbCheckUnit::getOrgName));
+        for (Map.Entry<String, List<ComPbCheckUnit>> entry : map.entrySet()) {
+            ComPbCheckUnitVo pbCheckUnitVo = new ComPbCheckUnitVo();
+            pbCheckUnitVo.setOrgName(entry.getKey());
+            voList.add(pbCheckUnitVo);
+        }
+        return R.ok(voList);
+    }
+
     /**
      * description  insert  新增数据
      *
@@ -94,6 +128,15 @@
         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);
+        int a=0;
+        if(!StringUtils.isEmpty(comPbCheckUnit.getAdminPhone()))
+        {
+            a=this.baseMapper.selectOrgAdmin(comPbCheckUnit.getAdminPhone());
+        }
+        if(a!=0)
+        {
+            return R.fail("该手机号已绑定管理员!");
+        }
         if(communityId!=null){
             entity.setCommunityId(communityId);
         }
@@ -266,7 +309,7 @@
      * @return
      */
     @Override
-    public R unitStatisticsTop(Long communityId, String belongTo, String choice) {
+    public R unitStatisticsTop(Long communityId, String belongTo, String choice,Long[] unitIds,String yearTime) {
         List<Long> communityIds = new ArrayList<>();
         if (null != communityId){
              communityIds = comPbMemberDAO.selectIds(communityId);
@@ -274,8 +317,13 @@
                 communityIds.add(communityId);
             }
         }
-
-        return R.ok(this.baseMapper.unitStatisticsTop(communityIds, belongTo, choice));
+        //查询 活动总积分
+        PbCheckUnitStatisticsVo vo = this.baseMapper.unitStatisticsTop(communityIds, belongTo, choice,unitIds,yearTime);
+        if(null != vo) {
+            Integer sum = this.baseMapper.organSumIntegral(communityIds,yearTime);
+            vo.setOrganSumIntegral(sum);
+        }
+        return R.ok(vo);
     }
 
     /**
@@ -306,7 +354,7 @@
      * @return
      */
     @Override
-    public R pbStatisticsTop(Long communityId, String belongTo, String choice, Long checkUnitId) {
+    public R pbStatisticsTop(Long communityId, String belongTo, String choice, Long checkUnitId,Long[] unitIds ,String yearTime) {
 
         List<Long> communityIds = new ArrayList<>();
         if (null != communityId){
@@ -315,7 +363,13 @@
                 communityIds.add(communityId);
             }
         }
-        return R.ok(this.baseMapper.pbStatisticsTop(communityIds, belongTo, choice, checkUnitId));
+        //查询 活动总积分
+        PbCheckUnitStatisticsVo vo = this.baseMapper.pbStatisticsTop(communityIds, belongTo, choice, checkUnitId,unitIds,yearTime);
+        if(null != vo) {
+            Integer sum = this.baseMapper.pbOrganSumIntegral(communityIds,yearTime);
+            vo.setOrganSumIntegral(sum);
+        }
+        return R.ok(vo);
     }
 
     /**

--
Gitblit v1.7.1