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/TaskReportForRepairsMapper.xml | 204 ++++++++++++++++++++++++++++++++++++---------------
1 files changed, 144 insertions(+), 60 deletions(-)
diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
index 3037f1a..ddd595c 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
@@ -41,6 +41,7 @@
<result property="lat" column="lat"/>
<result property="address" column="address"/>
<result property="viewType" column="view_type"/>
+ <result property="houseFlag" column="house_flag"/>
<collection property="taskRepairStepList" column="id" select="selectTaskRepairStepList"
@@ -122,7 +123,8 @@
lng,
lat,
address,
- view_type
+ view_type,
+ house_flag
from jczz_task_report_for_repairs
</sql>
@@ -152,16 +154,46 @@
jtrfr.lat,
jtrfr.address,
jtrfr.view_type,
+ jtrfr.house_flag,
+ br.town_name streetName,
+ jg.grid_name,
+ jda.aoi_name,
+ br.village_name communityName,
jda.address_name as addressName
- from jczz_task_report_for_repairs jtrfr
- left join jczz_doorplate_address jda on jda.address_code = jtrfr.address_code
- left join jczz_grid_range jgr on jgr.house_code = jtrfr.address_code
- left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
- left join blade_region br on br.code = jg.community_code
- where jtrfr.is_deleted = 0
+ FROM jczz_task_report_for_repairs jtrfr
+ LEFT JOIN jczz_doorplate_address jda on jda.address_code = jtrfr.address_code
+ LEFT JOIN jczz_house jh on jh.house_code=jtrfr.address_code
+ LEFT JOIN jczz_place jp on jtrfr.address_code = jp.house_code and jp.is_deleted = 0
+ LEFT JOIN jczz_grid jg on (jg.grid_code = jh.grid_code or jg.grid_code = jp.grid_code) and jg.is_deleted = 0
+ LEFT JOIN blade_region br on br.code = jg.community_code
+ WHERE jtrfr.is_deleted = 0
<if test="vo.createUser != null and vo.createUser != ''">
AND jtrfr.create_user = #{vo.createUser}
</if>
+
+ <if test="communityCode !=null and communityCode !=''">
+ and jg.community_code = #{communityCode}
+ </if>
+
+ <if test="vo.houseCode != null and vo.houseCode != ''">
+ and jtrfr.address_code = #{vo.houseCode}
+ </if>
+
+ <if test="vo.streetName != null and vo.streetName != ''">
+ AND br.town_name like concat('%',#{vo.streetName},'%')
+ </if>
+ <if test="vo.communityName != null and vo.communityName != ''">
+ AND br.village_name like concat('%',#{vo.communityName},'%')
+ </if>
+
+ <if test="vo.gridName != null and vo.gridName != ''">
+ AND jg.grid_name like concat('%',#{vo.gridName},'%')
+ </if>
+
+ <if test="vo.aoiName != null and vo.aoiName != ''">
+ AND jda.aoi_name like concat('%',#{vo.aoiName},'%')
+ </if>
+
<if test="vo.type != null">
AND jtrfr.type = #{vo.type}
</if>
@@ -188,33 +220,74 @@
AND jtrfr.create_time BETWEEN #{vo.startTime} and #{vo.endTime}
</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}
+ <!-- 物业和居民 -->
+ <if test="vo.roleType !=null and (vo.roleType == 'wy' or vo.roleType == 'inhabitant')">
+ <if test="aoiCodeList!=null and aoiCodeList.size()>0">
+ and (
+ jda.aoi_code in
+ <foreach collection="aoiCodeList" item="item" separator="," open="(" close=")">
+ #{item}
</foreach>
- </when>
- <otherwise>
- and jg.community_code in ('')
- </otherwise>
- </choose>
- </if>
- <if test="vo.roleName!=null and vo.roleName!=''">
- <if test="vo.roleName=='网格员'">
+ or
+ jp.aoi_code in
+ <foreach collection="aoiCodeList" item="item" separator="," open="(" close=")">
+ #{item}
+ </foreach>
+ )
+ </if>
+
+ <if test="vo.roleType == 'wy' and vo.confirmUserId != null ">
+ or jtrfr.confirm_user_id = #{vo.confirmUserId}
+ </if>
+ </if>
+ <!-- 其他 -->
+ <if test="vo.roleType ==null and vo.roleName !='wgy' ">
<choose>
- <when test="list != null and list.size()>0">
- and (jda.address_code in
- <foreach collection="list" item="houseCode" separator="," open="(" close=")">
- #{houseCode}
+ <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+ and (
+ jg.grid_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
</foreach>
- or jtrfr.confirm_user_id = #{vo.confirmUserId})
+ or
+ jp.grid_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ )
+ </when>
+ </choose>
+ </if>
+ <!-- 网格员 -->
+ <if test="vo.roleName =='wgy' ">
+ <choose>
+ <when test="gridCodeList !=null and gridCodeList.size()>0">
+ and (
+ jg.grid_code in
+ <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ or
+ jp.grid_code in
+ <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ )
+ <if test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+ and jg.community_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ </if>
</when>
<otherwise>
- and (jda.address_code in ('')
- or jtrfr.confirm_user_id = #{vo.confirmUserId})
+ and jg.grid_code in ('')
</otherwise>
</choose>
+
+ <if test="vo.confirmUserId != null ">
+ or jtrfr.confirm_user_id = #{vo.confirmUserId}
+ </if>
</if>
</if>
ORDER BY jtrfr.create_time DESC
@@ -258,7 +331,7 @@
jczz_doorplate_address jda
LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
WHERE
- jc.res_police_user_id = #{userId})
+ jc.res_police_user_id like concat('%',#{userId},'%'))
)
</if>
</select>
@@ -278,19 +351,7 @@
<if test="houseCode != null and houseCode != ''">
and jtrfr.address_code = #{houseCode}
</if>
- <if test="isAdministrator==2">
- <choose>
- <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
- and jda.nei_code in
- <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
- #{code}
- </foreach>
- </when>
- <otherwise>
- and jda.nei_code in ('')
- </otherwise>
- </choose>
- </if>
+
</select>
@@ -299,34 +360,57 @@
count( 1 )
FROM
jczz_task_report_for_repairs jtr
- LEFT JOIN jczz_doorplate_address jda ON jtr.address_code = jda.address_code
+ LEFT JOIN jczz_house jh ON jh.house_code = jtr.address_code
+ LEFT JOIN jczz_place jp ON jtr.address_code = jp.house_code
+ LEFT JOIN jczz_grid jg on (jh.grid_code = jg.grid_code or jp.grid_code = jg.grid_code )
+ LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
<where>
-
- <if test="neiCode != null and neiCode != ''">
- and jda.nei_code = #{neiCode}
- </if>
- <if test="userId != null">
- AND jtr.address_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid_range jgr
- LEFT JOIN jczz_grid jg ON jg.id = jgr.grid_id
- LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
- WHERE
- jg.is_deleted = 0
- AND jgm.user_id = #{userId} )
- </if>
and jtr.is_deleted = 0
and jtr.confirm_flag = 1
- </where>
+ <if test="neiCode !=null and neiCode !=''">
+ and jg.community_code = #{neiCode}
+ </if>
+ <if test="roleName != null and roleName != ''">
+ <if test="roleName=='wgy'">
+ <if test="isAdministrator==2">
+ <choose>
+ <when test="gridCodeList !=null and gridCodeList.size()>0">
+ and jg.grid_code in
+ <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and jg.grid_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ </if>
+ <if test="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>
+ </where>
</select>
<!--更新状态-临时接口-->
<update id="updateView">
- update jczz_task_report_for_repairs set view_type = 1
+ update jczz_task_report_for_repairs
+ set view_type = 1
</update>
--
Gitblit v1.9.3