From 4feaef5e35f0dad7cc3f05e32fc7e3e52fa9396d Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期四, 10 三月 2022 17:17:14 +0800
Subject: [PATCH] 随手拍/微心愿/志愿者修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngVolunteerMngDAO.java                  |   18 +++-----
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngVolunteerMngDOMapper.xml                                      |   41 +++++++++++++++++++-
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java                           |   10 +++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVolunteerMngServiceImpl.java |   11 ++---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActMicroWishDOMapper.xml                                         |    6 +-
 5 files changed, 63 insertions(+), 23 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
index 3d8188e..afd04a4 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -9,6 +9,7 @@
 import javax.annotation.Resource;
 
 import com.panzhihua.common.model.dtos.property.CommonPage;
+import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.community.ComActActivityTypeVO;
 import com.panzhihua.common.model.vos.community.volunteer.ComMngVolunteerExcelVO;
 import com.panzhihua.common.model.vos.user.SysTemplateConfigVO;
@@ -1218,6 +1219,15 @@
      */
     @PostMapping("addvolunteer")
     R addVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO) {
+        Long submitUserId = comMngVolunteerMngVO.getSubmitUserId();
+        if (Objects.nonNull(submitUserId)) {
+            //获取小程序用户信息
+            R<LoginUserInfoVO> userInfoR = userService.getUserInfoByUserId(submitUserId.toString());
+            LoginUserInfoVO userInfo = userInfoR.getData();
+            if (Objects.nonNull(userInfo)) {
+                comMngVolunteerMngVO.setIdCard(userInfo.getIdCard());
+            }
+        }
         return comMngVolunteerMngService.addVolunteer(comMngVolunteerMngVO);
     }
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngVolunteerMngDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngVolunteerMngDAO.java
index 139f9b4..73b5873 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngVolunteerMngDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngVolunteerMngDAO.java
@@ -33,17 +33,6 @@
     IPage<ComMngVolunteerMngVO> pageVolunteer(Page page,
         @Param("comMngVolunteerMngVO") ComMngVolunteerMngVO comMngVolunteerMngVO);
 
-    @Select("<script> " + "SELECT\n" + "t.id,\n" + "t.`name`,\n" + "t.state,\n" + "t.phone,\n" + "t.apply_reson,\n"
-        + "t.create_at, " + "t.submit_user_id \n" + "FROM\n" + "com_mng_volunteer_mng t\n" + " RIGHT JOIN \n"
-        + "(select submit_user_id, MAX(create_at)create_at  from com_mng_volunteer_mng where state IN ( 1, 3 ) GROUP BY submit_user_id ) tmp \n"
-        + "on t.create_at = tmp.create_at and t.submit_user_id=tmp.submit_user_id " + "WHERE\n"
-        + "state in (1,3)  and community_id = ${comMngVolunteerMngVO.communityId} \n"
-        + "<if test='comMngVolunteerMngVO.name != null and comMngVolunteerMngVO.name.trim() != &quot;&quot;'>"
-        + "and t.name like concat(#{comMngVolunteerMngVO.name},'%')  \n" + " </if> "
-        + "<if test='comMngVolunteerMngVO.phone != null and comMngVolunteerMngVO.phone.trim() != &quot;&quot;'>"
-        + "AND t.phone like concat(#{comMngVolunteerMngVO.phone},'%')\n" + " </if> "
-        + "<if test='comMngVolunteerMngVO.state != null and comMngVolunteerMngVO.state != 0'>"
-        + "and t.state=#{comMngVolunteerMngVO.state}\n" + " </if> " + " \tORDER BY t.state asc  " + "</script>")
     IPage<ComMngVolunteerMngVO> pageVolunteerExamine(Page page,
         @Param("comMngVolunteerMngVO") ComMngVolunteerMngVO comMngVolunteerMngVO);
 
@@ -98,4 +87,11 @@
      * @return
      */
     List<ComMngVolunteerMngVO> selectVolunteerByCommunityId(@Param("communityId") Long communityId);
+
+    /**
+     * 志愿者审核详情
+     * @param id
+     * @return
+     */
+    ComMngVolunteerMngVO detailVolunteerExamine(@Param("communityId") Long id);
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVolunteerMngServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVolunteerMngServiceImpl.java
index 7b333ab..377e862 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVolunteerMngServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVolunteerMngServiceImpl.java
@@ -59,8 +59,10 @@
     @Override
     public R addVolunteer(ComMngVolunteerMngVO comMngVolunteerMngVO) {
         String phone = comMngVolunteerMngVO.getPhone();
+        String idCard = comMngVolunteerMngVO.getIdCard();
         Integer integer = comMngVolunteerMngDAO.selectCount(new QueryWrapper<ComMngVolunteerMngDO>().lambda()
-            .eq(ComMngVolunteerMngDO::getPhone, phone).in(ComMngVolunteerMngDO::getState, Arrays.asList(1, 2)));
+                .and(wrapper -> wrapper.eq(ComMngVolunteerMngDO::getPhone, phone).or().eq(ComMngVolunteerMngDO::getIdCard, idCard))
+                .in(ComMngVolunteerMngDO::getState, Arrays.asList(1, 2)));
         if (null != integer && integer.intValue() > 0) {
             return R.fail("请勿重复申请");
         }
@@ -171,12 +173,7 @@
      */
     @Override
     public R detailVolunteerExamine(Long id) {
-        ComMngVolunteerMngDO comMngVolunteerMngDO = comMngVolunteerMngDAO.selectById(id);
-        if (ObjectUtils.isEmpty(comMngVolunteerMngDO)) {
-            return R.fail("审核不存在");
-        }
-        ComMngVolunteerMngVO comMngVolunteerMngVO = new ComMngVolunteerMngVO();
-        BeanUtils.copyProperties(comMngVolunteerMngDO, comMngVolunteerMngVO);
+        ComMngVolunteerMngVO comMngVolunteerMngVO = comMngVolunteerMngDAO.detailVolunteerExamine(id);
         // String phone = comMngVolunteerMngVO.getPhone();
         // comMngVolunteerMngVO.setUserId(comMngVolunteerMngDAO.selectUserIdByPhone(phone));
         return R.ok(comMngVolunteerMngVO);
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActMicroWishDOMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActMicroWishDOMapper.xml
index fd47c34..0e20f45 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActMicroWishDOMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActMicroWishDOMapper.xml
@@ -129,7 +129,6 @@
         w.`detail`,
         w.form,
         w.reject_reason,
-        su1.`name` responsible_name,
         w.score,
         w.img_width,
         w.finish_at,
@@ -141,7 +140,8 @@
         com_act_micro_wish w
         left join com_act_micro_wish_user wu on w.id=wu.micro_wish_id
         left JOIN sys_user u ON w.sponsor_id = u.user_id
-        LEFT JOIN sys_user su1 ON w.responsible_id = su1.user_id
+        LEFT JOIN (SELECT * FROM com_act_easy_photo_handler WHERE service_type = 2) ch ON w.id = ch.service_id
+        LEFT JOIN sys_user u2 ON ch.user_id = u2.user_id
         <where>
             <if test='comActMicroWishVO.communityId != null and comActMicroWishVO.communityId != 0'>
                 and w.community_id = ${comActMicroWishVO.communityId}
@@ -157,7 +157,7 @@
                 AND u.`name` like concat(#{comActMicroWishVO.sponsorName},'%')
             </if>
             <if test='comActMicroWishVO.responsibleName != null and comActMicroWishVO.responsibleName != &quot;&quot;'>
-                AND su1.`name` like concat(#{comActMicroWishVO.responsibleName},'%')
+                AND u2.`name` like concat(#{comActMicroWishVO.responsibleName},'%')
             </if>
             <if test='comActMicroWishVO.status != null'>
                 AND w.`status` = #{comActMicroWishVO.status}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngVolunteerMngDOMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngVolunteerMngDOMapper.xml
index c18e976..2154bb7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngVolunteerMngDOMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngVolunteerMngDOMapper.xml
@@ -42,7 +42,7 @@
         cmvm.org_id,
         cmvm.team_id,
         cmvm.is_university,
-        cmvm.university_name,
+        IF(cmvm.is_university = 1,cmvm.university_name,null) AS university_name,
         cmvot.`name` as orgName,
         cmvot1.`name` as teamName,
         cmvot1.`service_type_id`,
@@ -73,7 +73,8 @@
             cmvm.name like concat(#{comMngVolunteerMngVO.keyWord},'%') or
             cmvm.phone like concat(#{comMngVolunteerMngVO.keyWord},'%') or
             cmvm.id_card = #{comMngVolunteerMngVO.keyWord} or
-            cmvm.university_name like concat(#{comMngVolunteerMngVO.keyWord},'%')
+            cmvm.university_name like concat(#{comMngVolunteerMngVO.keyWord},'%') or
+            TIMESTAMPDIFF(YEAR, SUBSTRING(cmvm.id_card, 7, 8), NOW()) = #{comMngVolunteerMngVO.keyWord}
             )
         </if>
         <if test="comMngVolunteerMngVO.orgId != null">
@@ -176,5 +177,41 @@
         INNER JOIN com_mng_volunteer_org_team t3 ON t1.org_id = t3.id
         WHERE t1.community_id = #{communityId}
     </select>
+    <select id="pageVolunteerExamine"
+            resultType="com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO">
+        SELECT
+        t.id,
+        t.`name`,
+        t.state,
+        t.phone,
+        t.apply_reson,
+        t.create_at,
+        t.submit_user_id
+        FROM
+        com_mng_volunteer_mng t
+        RIGHT JOIN ( SELECT submit_user_id, MAX( create_at ) create_at FROM com_mng_volunteer_mng WHERE state IN ( 1, 3 ) GROUP BY submit_user_id ) tmp ON t.create_at = tmp.create_at
+        AND t.submit_user_id = tmp.submit_user_id
+        WHERE
+        state IN ( 1, 3 )
+        AND community_id = $ { comMngVolunteerMngVO.communityId }
+        <if test = 'comMngVolunteerMngVO.name != null and comMngVolunteerMngVO.name.trim() != &quot;&quot;' >
+        AND t.NAME LIKE concat(#{comMngVolunteerMngVO.name},'%')
+        </if>
+        <if test = 'comMngVolunteerMngVO.phone != null and comMngVolunteerMngVO.phone.trim() != &quot;&quot;' >
+        AND t.phone LIKE concat(#{comMngVolunteerMngVO.phone},'%')
+        </if>
+        <if test = 'comMngVolunteerMngVO.state != null and comMngVolunteerMngVO.state != 0' >
+        AND t.state = #{comMngVolunteerMngVO.state}
+        </if>
+        <if test="comMngVolunteerMngVO.isUniversity != null">
+            and t.is_university = #{comMngVolunteerMngVO.isUniversity}
+        </if>
+        ORDER BY
+        t.state ASC
+    </select>
+    <select id="detailVolunteerExamine"
+            resultType="com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO">
+
+    </select>
 
 </mapper>

--
Gitblit v1.7.1