From 8b7258c9427882bb1798f1502eaa35184c6e374e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:29:18 +0800
Subject: [PATCH] 短信指定楼栋发送

---
 src/main/java/org/springblade/modules/task/mapper/TaskPlaceSelfCheckMapper.xml |  120 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 77 insertions(+), 43 deletions(-)

diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskPlaceSelfCheckMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskPlaceSelfCheckMapper.xml
index 4378795..8dbf3fe 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskPlaceSelfCheckMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskPlaceSelfCheckMapper.xml
@@ -39,7 +39,7 @@
     <!--自定义分页查询-->
     <select id="selectTaskPlaceSelfCheckPage" resultMap="taskPlaceSelfCheckResultMap">
         select jpc.*,
-        jp.id jpid,
+        jp.id placeId,
         jp.place_name,
         jp.location,
         jg.grid_name,
@@ -51,7 +51,8 @@
         br.village_name as communityName,
         bu.`name`,
         jpe.legal_tel,
-        jpe.legal_person
+        jpe.legal_person,
+        jppl.color
         FROM jczz_task_place_self_check jpc
         LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code and jp.is_deleted = 0
         LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
@@ -59,7 +60,10 @@
         LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
         LEFT JOIN blade_user bu ON bu.id = jpc.create_user and bu.is_deleted = 0
         LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
+        LEFT JOIN jczz_place_poi_label jppl on jppl.place_id = jp.id
         <where>
+            and jp.house_code is not null
+            and jppl.type = 3
             <if test="place.id != null ">and jpc.id = #{place.id}</if>
             <if test="place.taskId != null ">and jpc.task_id = #{place.taskId}</if>
             <if test="place.taskName != null  and place.taskName != ''">and jpc.task_name = #{place.taskName}</if>
@@ -79,7 +83,7 @@
             <if test="place.remark != null  and place.remark != ''">and jpc.remark = #{place.remark}</if>
             <if test="place.updateTime != null ">and jpc.update_time = #{place.updateTime}</if>
             <if test="place.createTime != null ">and jpc.create_time = #{place.createTime}</if>
-            <if test="place.houseCode != null  and place.houseCode != ''">and jpc.house_code = #{place.houseCode}</if>
+            <if test="place.type != null  and place.type != ''">and jpc.type = #{place.type}</if>
             <if test="place.rectificationEndTime != null ">and jpc.rectification_end_time =
                 #{place.rectificationEndTime}
             </if>
@@ -111,6 +115,13 @@
             <if test="place.imageUrls != null  and place.imageUrls != ''">and jpc.image_urls = #{place.imageUrls}</if>
             <if test="place.status != null ">and jpc.status = #{place.status}</if>
             <if test="place.deleteFlag != null ">and jpc.delete_flag = #{place.deleteFlag}</if>
+
+            <if test="place.startTime != null and place.startTime != ''">
+                and date_format(jpc.create_time,'%Y-%m-%d') &gt;= #{place.startTime}
+            </if>
+            <if test="place.endTime != null and place.endTime != ''">
+                and date_format(jpc.create_time,'%Y-%m-%d') &lt;= #{place.endTime}
+            </if>
             <if test="isAdministrator==2">
                 <choose>
                     <when test="place.roleName != null and place.roleName != ''">
@@ -165,6 +176,8 @@
                     </otherwise>
                 </choose>
             </if>
+            <if test="place.houseCode != null  and place.houseCode != ''"> and jpc.house_code = #{place.houseCode}</if>
+
         </where>
         order by jpc.create_time desc
     </select>
@@ -189,6 +202,7 @@
         <result property="imageUrls" column="image_urls"/>
         <result property="status" column="status"/>
         <result property="deleteFlag" column="delete_flag"/>
+        <result property="type" column="type"/>
 
         <collection property="placePoiLabelVOList" column="jpid" javaType="java.util.List"
                     select="selectPlacePoiLabelList"
@@ -196,7 +210,7 @@
                     autoMapping="true">
         </collection>
 
-        <collection property="taskPlaceRecordVOList" column="id" select="selectPatrolRecordList"
+        <collection property="taskPlaceRecordVOList" column="{id=id,type=type}" select="selectPatrolRecordList"
                     javaType="java.util.List" ofType="org.springblade.modules.task.vo.TaskPlaceRecordVO"
                     autoMapping="true">
         </collection>
@@ -222,27 +236,31 @@
         </select>
 
 
-    <select id="selectPatrolRecordList" parameterType="Long"
+    <select id="selectPatrolRecordList"  parameterType="java.util.Map"
             resultType="org.springblade.modules.task.vo.TaskPlaceRecordVO">
-            select
-	        jpr.id,
-	        jpr.item_id,
-	        jpr.task_place_self_check_id,
-	        jpr.state,
-	        jpr.remark,
-	        jpr.image_urls,
-	        jpr.create_user,
-	        jpr.create_time,
-	        jpr.is_deleted,
-	        jpr.rectification_image_urls,
-	        jpr.rectification_remark,
-	        jpr.rectification_time,
-	        jpgi.items_name
-		from
-        	jczz_task_place_record  jpr
-            LEFT JOIN jczz_patrol_group_item jpgi on jpr.item_id= jpgi.id
-             where task_place_self_check_id = #{id}
-        </select>
+        select jpr.id,
+        jpr.item_id,
+        jpr.task_place_self_check_id,
+        jpr.state,
+        jpr.remark,
+        jpr.image_urls,
+        jpr.create_user,
+        jpr.create_time,
+        jpr.is_deleted,
+        jpr.rectification_image_urls,
+        jpr.rectification_remark,
+        jpr.rectification_time,
+        jpgi.items_name
+        from jczz_task_place_record jpr
+        LEFT JOIN jczz_patrol_group_item jpgi on jpr.item_id = jpgi.id
+        where task_place_self_check_id = #{id}
+        <if test="type == 1">
+            and jpr.type = 1
+        </if>
+        <if test="type == 2">
+            and jpr.type = 3
+        </if>
+    </select>
 
     <sql id="selectTaskPlaceSelfCheck">
     	select
@@ -270,24 +288,7 @@
 
     <select id="selectTaskPlaceSelfCheckById" parameterType="long" resultMap="TaskPlaceSelfCheckDTOResult">
         SELECT
-        jtpr.id,
-        jtpr.task_id,
-        jtpr.task_name,
-        jtpr.place_name,
-        jtpr.remark,
-        jtpr.update_time,
-        jtpr.create_time,
-        jtpr.house_code,
-        jtpr.rectification_end_time,
-        jtpr.rectification_complete_time,
-        jtpr.rectification_flag,
-        jtpr.police_station,
-        jtpr.rectification_notice_img_url,
-        jtpr.signature_path,
-        jtpr.create_user,
-        jtpr.image_urls,
-        jtpr.STATUS,
-        jtpr.delete_flag,
+        jtpr.*,
         jp.id jpid,
         jp.place_name,
         jp.location,
@@ -489,8 +490,41 @@
         SELECT count(1)
         FROM jczz_task_place_self_check jtpsc
                  LEFT JOIN jczz_place jp ON jp.house_code = jtpsc.house_code
+                 LEFT JOIN jczz_grid jg on jg.grid_code=jp.grid_code
         WHERE jp.jw_grid_code IN
-              (SELECT jpag.jw_grid_code FROM jczz_police_affairs_grid jpag WHERE jpag.police_user_id like concat('%',${userId},'%') )
+              (SELECT jpag.jw_grid_code FROM jczz_police_affairs_grid jpag WHERE jpag.police_user_id like concat('%',#{userId},'%') )
           AND jtpsc.`status` = 1
+          AND jtpsc.`type` = #{type}
+          AND jg.community_code=#{neiCode}
+    </select>
+
+
+
+    <select id="getDetailByTaskId" resultType="org.springblade.modules.task.entity.TaskPlaceSelfCheckEntity">
+            SELECT
+                jtpsc.*,
+                jp.id jpid,
+                jp.place_name,
+                jp.location,
+                jg.grid_name,
+                jp.principal,
+                jp.principal_phone,
+                br.town_name,
+                br.village_name,
+                bu.`name`,
+                jpe.legal_tel,
+                jpe.legal_person,
+                jt.remark reasonFailure,
+                jda.address_name
+            FROM
+                    jczz_task_place_self_check jtpsc
+                    LEFT JOIN jczz_task jt on jt.id = jtpsc.task_id
+                    LEFT JOIN jczz_place jp ON jtpsc.house_code = jp.house_code
+                    LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code
+                    LEFT JOIN blade_region br ON br.`code` = jg.community_code
+                    LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
+                    LEFT JOIN blade_user bu ON bu.id = jtpsc.create_user
+                    LEFT JOIN jczz_doorplate_address jda on jda.address_code=jtpsc.house_code
+            WHERE jtpsc.task_id = #{taskId}
     </select>
 </mapper>

--
Gitblit v1.9.3