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/TaskLabelReportingEventMapper.xml |  442 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 413 insertions(+), 29 deletions(-)

diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskLabelReportingEventMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskLabelReportingEventMapper.xml
index 992a1d9..7efcc04 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskLabelReportingEventMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskLabelReportingEventMapper.xml
@@ -4,39 +4,423 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="taskLabelReportingEventResultMap" type="org.springblade.modules.task.entity.TaskLabelReportingEventEntity">
-        <result column="id" property="id"/>
-        <result column="task_id" property="taskId"/>
-        <result column="place_id" property="placeId"/>
-        <result column="house_id" property="houseId"/>
-        <result column="district_id" property="districtId"/>
-        <result column="happen_time" property="happenTime"/>
-        <result column="user_id" property="userId"/>
-        <result column="image_urls" property="imageUrls"/>
-        <result column="district_name" property="districtName"/>
-        <result column="event_type" property="eventType"/>
-        <result column="confirm_flag" property="confirmFlag"/>
-        <result column="confirm_user_id" property="confirmUserId"/>
-        <result column="confirm_time" property="confirmTime"/>
-        <result column="localtion" property="localtion"/>
-        <result column="confirm_notion" property="confirmNotion"/>
-        <result column="owner" property="owner"/>
-        <result column="phone_number" property="phoneNumber"/>
-        <result column="house_name" property="houseName"/>
-        <result column="task_name" property="taskName"/>
-        <result column="transaction_object_tel" property="transactionObjectTel"/>
-        <result column="transaction_money" property="transactionMoney"/>
-        <result column="goods_nums" property="goodsNums"/>
-        <result column="goods_image_urls" property="goodsImageUrls"/>
-        <result column="transaction_object" property="transactionObject"/>
-        <result column="transaction_process" property="transactionProcess"/>
-        <result column="label_name" property="labelName"/>
+        <result property="id"    column="id"    />
+        <result property="taskId"    column="task_id"    />
+        <result property="placeId"    column="place_id"    />
+        <result property="districtName"    column="district_name"    />
+        <result property="happenTime"    column="happen_time"    />
+        <result property="userId"    column="user_id"    />
+        <result property="owner"    column="owner"    />
+        <result property="phoneNumber"    column="phone_number"    />
+        <result property="imageUrls"    column="image_urls"    />
+        <result property="localtion"    column="localtion"    />
+        <result property="eventType"    column="event_type"    />
+        <result property="confirmFlag"    column="confirm_flag"    />
+        <result property="confirmUserId"    column="confirm_user_id"    />
+        <result property="confirmTime"    column="confirm_time"    />
+        <result property="confirmNotion"    column="confirm_notion"    />
+        <result property="transactionObjectTel"    column="transaction_object_tel"    />
+        <result property="transactionMoney"    column="transaction_money"    />
+        <result property="goodsNums"    column="goods_nums"    />
+        <result property="goodsImageUrls"    column="goods_image_urls"    />
+        <result property="transactionObject"    column="transaction_object"    />
+        <result property="transactionProcess"    column="transaction_process"    />
+        <result property="labelName"    column="label_name"    />
+        <result property="source"    column="source"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createUser"    column="create_user"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateUser"    column="update_user"    />
+        <result property="isDeleted"    column="is_deleted"    />
+        <result property="idCard"    column="id_card"    />
+        <result property="receiptUrls"    column="receipt_urls"    />
     </resultMap>
 
+    <!--二手交易自定义分页查询-->
+    <select id="selectTaskLabelReportingEventPage" resultType="org.springblade.modules.task.vo.TaskLabelReportingEventVO">
+        select
+        jtlre.*,
+        jp.place_name,
+        jp.principal,
+        jp.principal_phone,
+        jp.nine_type ,
+        jp.front_type ,
+        jp.location,
+        br.town_name streetName,
+        br.village_name communityName
+        from
+        jczz_task_label_reporting_event jtlre
+        LEFT JOIN jczz_place jp ON jtlre.place_id=jp.id and jp.is_deleted = 0
+        LEFT JOIN jczz_grid jg on jg.grid_code = jp.grid_code and jg.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 blade_region br on br.code = jpag.community_code
+        where jtlre.is_deleted = 0
+        <if test="taskLabelReportingEvent.streetName != null and taskLabelReportingEvent.streetName != ''">
+            AND br.town_name like concat('%',#{taskLabelReportingEvent.streetName},'%')
+        </if>
 
-    <select id="selectTaskLabelReportingEventPage" resultMap="taskLabelReportingEventResultMap">
-        select * from jczz_task_label_reporting_event where is_deleted = 0
+        <if test="taskLabelReportingEvent.communityName != null and taskLabelReportingEvent.communityName != ''">
+            AND br.village_name like concat('%',#{taskLabelReportingEvent.communityName},'%')
+        </if>
+
         <if test="taskLabelReportingEvent.userId != null and taskLabelReportingEvent.userId != ''">
-            AND user_id = #{taskLabelReportingEvent.userId}
+            AND jtlre.user_id = #{taskLabelReportingEvent.userId}
+        </if>
+
+        <if test="taskLabelReportingEvent.houseCode != null  and taskLabelReportingEvent.houseCode != ''">
+            and jp.house_code = #{taskLabelReportingEvent.houseCode}
+        </if>
+
+        <if test="taskLabelReportingEvent.eventType != null and taskLabelReportingEvent.eventType != ''">
+            AND jtlre.event_type = #{taskLabelReportingEvent.eventType}
+        </if>
+        <if test="taskLabelReportingEvent.transactionObject != null and taskLabelReportingEvent.transactionObject != ''">
+            AND jtlre.transaction_object like concat('%',#{taskLabelReportingEvent.transactionObject},'%')
+        </if>
+        <if test="taskLabelReportingEvent.transactionObjectTel != null and taskLabelReportingEvent.transactionObjectTel != ''">
+            AND jtlre.transaction_object_tel like concat('%',#{taskLabelReportingEvent.transactionObjectTel},'%')
+        </if>
+        <if test="taskLabelReportingEvent.idCard != null and taskLabelReportingEvent.idCard != ''">
+            AND jtlre.id_card like concat('%',#{taskLabelReportingEvent.idCard},'%')
+        </if>
+        <if test="taskLabelReportingEvent.frontType != null ">
+            AND jp.front_type = #{taskLabelReportingEvent.frontType}
+        </if>
+        <if test="taskLabelReportingEvent.placeName != null and taskLabelReportingEvent.placeName != ''">
+            AND jp.place_name like concat('%',#{taskLabelReportingEvent.placeName},'%')
+        </if>
+        <if test="taskLabelReportingEvent.principal != null and taskLabelReportingEvent.principal != ''">
+            AND jp.principal like concat('%',#{taskLabelReportingEvent.principal},'%')
+        </if>
+        <if test="taskLabelReportingEvent.principalPhone != null and taskLabelReportingEvent.principalPhone != ''">
+            AND jp.principal_phone like concat('%',#{taskLabelReportingEvent.principalPhone},'%')
+        </if>
+        <if test="taskLabelReportingEvent.startTime != null and taskLabelReportingEvent.startTime != '' and taskLabelReportingEvent.endTime != null and taskLabelReportingEvent.endTime != '' ">
+            AND jtlre.create_time BETWEEN #{taskLabelReportingEvent.startTime} and #{taskLabelReportingEvent.endTime}
+        </if>
+        <if test="taskLabelReportingEvent.roleName != null and taskLabelReportingEvent.roleName != ''">
+            <if test="taskLabelReportingEvent.roleName=='wgy'">
+                <if test="isAdministrator==2">
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and jp.grid_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            and jp.grid_code in ('')
+                        </otherwise>
+                    </choose>
+                </if>
+            </if>
+            <if test="taskLabelReportingEvent.roleName=='mj'">
+                <if test="isAdministrator==2">
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and jpag.community_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            and jpag.community_code in ('')
+                        </otherwise>
+                    </choose>
+                </if>
+            </if>
+        </if>
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                    and
+                    (
+                    jg.community_code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                    or
+                    br.village_code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                    )
+                </when>
+                <otherwise>
+                    and
+                    (
+                    jg.grid_code in ('') or br.village_code in ('')
+                    )
+                </otherwise>
+            </choose>
+        </if>
+        order by jtlre.create_time desc,jtlre.id desc
+    </select>
+
+
+    <resultMap type="org.springblade.modules.task.dto.TaskLabelReportingEventDTO" id="TaskLabelReportingEventDTOResult">
+        <result property="id"    column="id"    />
+        <result property="taskId"    column="task_id"    />
+        <result property="placeId"    column="place_id"    />
+        <result property="districtName"    column="district_name"    />
+        <result property="happenTime"    column="happen_time"    />
+        <result property="userId"    column="user_id"    />
+        <result property="owner"    column="owner"    />
+        <result property="phoneNumber"    column="phone_number"    />
+        <result property="imageUrls"    column="image_urls"    />
+        <result property="localtion"    column="localtion"    />
+        <result property="eventType"    column="event_type"    />
+        <result property="confirmFlag"    column="confirm_flag"    />
+        <result property="confirmUserId"    column="confirm_user_id"    />
+        <result property="confirmTime"    column="confirm_time"    />
+        <result property="confirmNotion"    column="confirm_notion"    />
+        <result property="transactionObjectTel"    column="transaction_object_tel"    />
+        <result property="transactionMoney"    column="transaction_money"    />
+        <result property="goodsNums"    column="goods_nums"    />
+        <result property="goodsImageUrls"    column="goods_image_urls"    />
+        <result property="transactionObject"    column="transaction_object"    />
+        <result property="transactionProcess"    column="transaction_process"    />
+        <result property="labelName"    column="label_name"    />
+        <result property="source"    column="source"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createUser"    column="create_user"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateUser"    column="update_user"    />
+        <result property="isDeleted"    column="is_deleted"    />
+        <result property="idCard"    column="id_card"    />
+        <result property="receiptUrls"    column="receipt_urls"    />
+    </resultMap>
+
+    <sql id="selectTaskLabelReportingEvent">
+    	select
+	        id,
+	        task_id,
+	        place_id,
+	        district_name,
+	        happen_time,
+	        user_id,
+	        owner,
+	        phone_number,
+	        image_urls,
+	        localtion,
+	        event_type,
+	        confirm_flag,
+	        confirm_user_id,
+	        confirm_time,
+	        confirm_notion,
+	        transaction_object_tel,
+	        transaction_money,
+	        goods_nums,
+	        goods_image_urls,
+	        transaction_object,
+	        transaction_process,
+	        label_name,
+	        source,
+	        create_time,
+	        create_user,
+	        update_time,
+	        update_user,
+	        is_deleted,
+	        id_card,
+	        receipt_urls
+		from
+        	jczz_task_label_reporting_event
+    </sql>
+
+    <select id="selectTaskLabelReportingEventById" parameterType="long" resultMap="TaskLabelReportingEventDTOResult">
+        <include refid="selectTaskLabelReportingEvent"/>
+        where
+        id = #{id}
+    </select>
+
+    <select id="selectTaskLabelReportingEventList" parameterType="org.springblade.modules.task.dto.TaskLabelReportingEventDTO" resultMap="TaskLabelReportingEventDTOResult">
+        <include refid="selectTaskLabelReportingEvent"/>
+        <where>
+            <if test="id != null "> and id = #{id}</if>
+            <if test="taskId != null "> and task_id = #{taskId}</if>
+            <if test="placeId != null "> and place_id = #{placeId}</if>
+            <if test="districtName != null  and districtName != ''"> and district_name = #{districtName}</if>
+            <if test="happenTime != null "> and happen_time = #{happenTime}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="owner != null  and owner != ''"> and owner = #{owner}</if>
+            <if test="phoneNumber != null  and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
+            <if test="imageUrls != null  and imageUrls != ''"> and image_urls = #{imageUrls}</if>
+            <if test="localtion != null  and localtion != ''"> and localtion = #{localtion}</if>
+            <if test="eventType != null  and eventType != ''"> and event_type = #{eventType}</if>
+            <if test="confirmFlag != null  and confirmFlag != ''"> and confirm_flag = #{confirmFlag}</if>
+            <if test="confirmUserId != null "> and confirm_user_id = #{confirmUserId}</if>
+            <if test="confirmTime != null "> and confirm_time = #{confirmTime}</if>
+            <if test="confirmNotion != null  and confirmNotion != ''"> and confirm_notion = #{confirmNotion}</if>
+            <if test="transactionObjectTel != null  and transactionObjectTel != ''"> and transaction_object_tel = #{transactionObjectTel}</if>
+            <if test="transactionMoney != null "> and transaction_money = #{transactionMoney}</if>
+            <if test="goodsNums != null "> and goods_nums = #{goodsNums}</if>
+            <if test="goodsImageUrls != null  and goodsImageUrls != ''"> and goods_image_urls = #{goodsImageUrls}</if>
+            <if test="transactionObject != null  and transactionObject != ''"> and transaction_object = #{transactionObject}</if>
+            <if test="transactionProcess != null  and transactionProcess != ''"> and transaction_process = #{transactionProcess}</if>
+            <if test="labelName != null  and labelName != ''"> and label_name = #{labelName}</if>
+            <if test="source != null "> and source = #{source}</if>
+            <if test="createTime != null "> and create_time = #{createTime}</if>
+            <if test="createUser != null "> and create_user = #{createUser}</if>
+            <if test="updateTime != null "> and update_time = #{updateTime}</if>
+            <if test="updateUser != null "> and update_user = #{updateUser}</if>
+            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
+            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
+            <if test="receiptUrls != null  and receiptUrls != ''"> and receipt_urls = #{receiptUrls}</if>
+        </where>
+    </select>
+
+    <!--二手交易自定义分页查询-->
+    <select id="exportTaskLabelReportingEventList" resultType="org.springblade.modules.task.excel.TaskLabelReportingEventExcel">
+        select
+        jtlre.id,
+        jtlre.transaction_object,
+        jtlre.transaction_object_tel,
+        jtlre.id_card,
+        jtlre.goods_nums,
+        jtlre.transaction_money,
+        jtlre.transaction_process,
+        case when jtlre.confirm_flag=1 then '待审核'
+        when jtlre.confirm_flag=2 then '审核通过'
+        when jtlre.confirm_flag=3 then '审核不通过'
+        else '待完成' end as confirm_flag,
+        jtlre.confirm_notion,
+        jtlre.create_time,
+        jp.place_name,
+        jp.principal,
+        jp.principal_phone,
+        jp.nine_type ,
+        jp.front_type ,
+        jp.location,
+        br.town_name streetName,
+        br.village_name communityName
+        from
+        jczz_task_label_reporting_event jtlre
+        LEFT JOIN jczz_place jp ON jtlre.place_id=jp.id and jp.is_deleted = 0
+        LEFT JOIN jczz_grid jg on jg.grid_code = jp.grid_code and jg.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 blade_region br on br.code = jpag.community_code
+        where jtlre.is_deleted = 0
+        <if test="taskLabelReportingEvent.streetName != null and taskLabelReportingEvent.streetName != ''">
+            AND br.town_name like concat('%',#{taskLabelReportingEvent.streetName},'%')
+        </if>
+
+        <if test="taskLabelReportingEvent.communityName != null and taskLabelReportingEvent.communityName != ''">
+            AND br.village_name like concat('%',#{taskLabelReportingEvent.communityName},'%')
+        </if>
+
+        <if test="taskLabelReportingEvent.userId != null and taskLabelReportingEvent.userId != ''">
+            AND jtlre.user_id = #{taskLabelReportingEvent.userId}
+        </if>
+
+        <if test="taskLabelReportingEvent.houseCode != null  and taskLabelReportingEvent.houseCode != ''">
+            and jp.house_code = #{taskLabelReportingEvent.houseCode}
+        </if>
+
+        <if test="taskLabelReportingEvent.eventType != null and taskLabelReportingEvent.eventType != ''">
+            AND jtlre.event_type = #{taskLabelReportingEvent.eventType}
+        </if>
+        <if test="taskLabelReportingEvent.transactionObject != null and taskLabelReportingEvent.transactionObject != ''">
+            AND jtlre.transaction_object like concat('%',#{taskLabelReportingEvent.transactionObject},'%')
+        </if>
+        <if test="taskLabelReportingEvent.transactionObjectTel != null and taskLabelReportingEvent.transactionObjectTel != ''">
+            AND jtlre.transaction_object_tel like concat('%',#{taskLabelReportingEvent.transactionObjectTel},'%')
+        </if>
+        <if test="taskLabelReportingEvent.idCard != null and taskLabelReportingEvent.idCard != ''">
+            AND jtlre.id_card like concat('%',#{taskLabelReportingEvent.idCard},'%')
+        </if>
+        <if test="taskLabelReportingEvent.frontType != null ">
+            AND jp.front_type = #{taskLabelReportingEvent.frontType}
+        </if>
+        <if test="taskLabelReportingEvent.placeName != null and taskLabelReportingEvent.placeName != ''">
+            AND jp.place_name like concat('%',#{taskLabelReportingEvent.placeName},'%')
+        </if>
+        <if test="taskLabelReportingEvent.principal != null and taskLabelReportingEvent.principal != ''">
+            AND jp.principal like concat('%',#{taskLabelReportingEvent.principal},'%')
+        </if>
+        <if test="taskLabelReportingEvent.principalPhone != null and taskLabelReportingEvent.principalPhone != ''">
+            AND jp.principal_phone like concat('%',#{taskLabelReportingEvent.principalPhone},'%')
+        </if>
+        <if test="taskLabelReportingEvent.startTime != null and taskLabelReportingEvent.startTime != '' and taskLabelReportingEvent.endTime != null and taskLabelReportingEvent.endTime != '' ">
+            AND jtlre.create_time BETWEEN #{taskLabelReportingEvent.startTime} and #{taskLabelReportingEvent.endTime}
+        </if>
+        <if test="taskLabelReportingEvent.roleName != null and taskLabelReportingEvent.roleName != ''">
+            <if test="taskLabelReportingEvent.roleName=='wgy'">
+                <if test="isAdministrator==2">
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and jp.grid_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            and jp.grid_code in ('')
+                        </otherwise>
+                    </choose>
+                </if>
+            </if>
+            <if test="taskLabelReportingEvent.roleName=='mj'">
+                <if test="isAdministrator==2">
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and jpag.community_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            and jpag.community_code in ('')
+                        </otherwise>
+                    </choose>
+                </if>
+            </if>
+        </if>
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                    and
+                    (
+                    jg.grid_code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                    or
+                    br.village_code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                    )
+                </when>
+                <otherwise>
+                    and
+                    (
+                    jg.grid_code in ('') or br.village_code in ('')
+                    )
+                </otherwise>
+            </choose>
+        </if>
+        order by jtlre.create_time desc,jtlre.id desc
+    </select>
+
+    <!--二手交易自定义分页查询-->
+    <select id="getDetail" resultType="org.springblade.modules.task.vo.TaskLabelReportingEventVO">
+        select
+        jtlre.*,
+        jp.place_name,
+        jp.principal,
+        jp.principal_phone,
+        jp.nine_type ,
+        jp.front_type ,
+        jp.location
+        from
+        jczz_task_label_reporting_event jtlre
+        LEFT JOIN jczz_place jp ON jtlre.place_id=jp.id and jp.is_deleted = 0
+        where jtlre.is_deleted = 0
+        <if test="taskLabelReportingEvent.id != null">
+            AND jtlre.id = #{taskLabelReportingEvent.id}
+        </if>
+        <if test="taskLabelReportingEvent.taskId != null">
+            AND jtlre.task_id = #{taskLabelReportingEvent.taskId}
         </if>
     </select>
 

--
Gitblit v1.9.3