From 69d19f3a36a22bcb9412146bccdeafc5ed1efa57 Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期二, 18 十月 2022 20:16:14 +0800
Subject: [PATCH] 三说会堂事件操作权限处理

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSanshuoExpertDao.xml                                   |   27 +++++++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComSanshuoExpertDao.java          |    6 +++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml                                        |   23 -----------
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java |    7 +++
 4 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComSanshuoExpertDao.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComSanshuoExpertDao.java
index d31ad48..09f04ef 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComSanshuoExpertDao.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComSanshuoExpertDao.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoExpertDTO;
+import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO;
 import com.panzhihua.common.model.vos.sanshuo.ComSanshuoExpertVO;
 import com.panzhihua.common.model.vos.sanshuo.ExpertShowVO;
 import com.panzhihua.service_community.entity.ComSanshuoExpert;
@@ -61,6 +62,11 @@
      * 是否重名,重复手机号,重复账号
      * */
     List<ComSanshuoExpert> selectExpertByNameOrPhoneOrAccount(@Param("dto") ComSanshuoExpertDTO comSanshuoExpertDTO);
+
+    /**
+     * 获取当前级别的专家数量
+     * */
+    Integer selectExpertCount(@Param("dto") IndexDateDTO indexDataDTO);
 }
 
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java
index 37c084e..daec656 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java
@@ -28,6 +28,7 @@
 import com.panzhihua.service_community.api.ComSanShuoEventTransferRecordController;
 import com.panzhihua.service_community.dao.ComActDAO;
 import com.panzhihua.service_community.dao.ComEventMapper;
+import com.panzhihua.service_community.dao.ComSanshuoExpertDao;
 import com.panzhihua.service_community.dao.ComStreetDAO;
 import com.panzhihua.service_community.entity.*;
 import com.panzhihua.service_community.model.dos.ComActDO;
@@ -37,6 +38,7 @@
 import org.apache.commons.lang3.RandomUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -81,6 +83,9 @@
 
     @Resource
     private CommediateTypeService commediateTypeService;
+
+    @Resource
+    private ComSanshuoExpertDao comSanshuoExpertDao;
 
 
     @Override
@@ -962,6 +967,8 @@
                 vo.setSuccessRate(NumberUtil.div(vo.getSuccess(),vo.getAccepted(),2));
             }
         }
+        vo.setExpert(comSanshuoExpertDao.selectExpertCount(indexDataDTO));
+        //查询当前级别下的专家
         //折线图X轴
         List<Date> dates = pastTwelveMoth();
         vo.setX(getYAndM(dates));
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml
index d565c74..c485796 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml
@@ -366,29 +366,6 @@
 		<if test="dto.type == 1">
 			AND current_process_type=4
 		</if>) as fail,
-        (select count(id) from com_sanshuo_expert where `status`=1 and del_flag=1
-		AND user_event_status not in(3,4)
-		<if test="dto.type == 2">
-			AND current_process_type=1
-			<if test="dto.id != null">
-				AND center_id=#{dto.id}
-			</if>
-		</if>
-		<if test="dto.type == 3">
-			AND current_process_type=3
-			<if test="dto.id != null">
-				AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
-			</if>
-		</if>
-		<if test="dto.type == 4">
-			AND current_process_type in(2,5)
-			<if test="dto.id != null">
-				AND request_user_community=#{dto.id}
-			</if>
-		</if>
-		<if test="dto.type == 1">
-			AND current_process_type=4
-		</if>) as expert,
 		(select count(id) from com_sanshuo_event_info WHERE
 		create_at BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d 00:00:00') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d 23:59:59')
 		AND event_process_status not in (8)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSanshuoExpertDao.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSanshuoExpertDao.xml
index 819c115..2650b54 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSanshuoExpertDao.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSanshuoExpertDao.xml
@@ -98,4 +98,31 @@
         select * from com_sanshuo_expert where name=#{dto.name} or phone=#{dto.phone} or account=#{dto.account}
         and status=1 and del_flag=1
     </select>
+    <select id="selectExpertCount" resultType="Integer">
+        select count(id) from com_sanshuo_expert
+        where del_flag=1 and status=1
+        <if test="dto.type != null">
+            <if test="dto.type == 2">
+                AND level=2
+                <if test="dto.id != null">
+                    AND center_id=#{dto.id}
+                </if>
+            </if>
+            <if test="dto.type == 3">
+                AND level=3
+                <if test="dto.id != null">
+                    AND community_id in (select com_act.community_id from com_act where street_id=#{dto.id})
+                </if>
+            </if>
+            <if test="dto.type == 4">
+                AND level=4
+                <if test="dto.id != null">
+                    AND community_id=#{dto.id}
+                </if>
+            </if>
+            <!--<if test="dto.type == 1">-->
+                <!--AND current_process_type=4-->
+            <!--</if>-->
+        </if>
+    </select>
 </mapper>

--
Gitblit v1.7.1