Pārlūkot izejas kodu

fix 修改小程序统计接口sts

tjf 3 gadi atpakaļ
vecāks
revīzija
7a3f3e6327

+ 17 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkMapper.java

@@ -211,4 +211,21 @@ public interface CzrkMapper {
     List<Czrk> getAllCzrk(Czrk czrk);
 
     List<Czrk> listByIdCard(@Param("czrkIdCardList")List<String> czrkIdCardList);
+
+
+    /**
+     * 小程序统计所有人员信息数量
+     * @param czrk
+     * @return
+     */
+    long selectCzrkCount(Czrk czrk);
+
+    /**
+     *小程序统计所有人员信息数量查询条件带居住地址
+     * @param czrk
+     * @return
+     */
+    long selectCzrkJzdzCount(Czrk czrk);
+
+
 }

+ 22 - 9
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -1259,7 +1259,11 @@ public class CzrkServiceImpl implements ICzrkService {
         String queryType = czrk.getQueryType();
         long total = 0, yrl = 0, wrl = 0;
         //搜索常住人口全部未认领人员需要在设置权限之前
+        long startTimeSql = System.currentTimeMillis();
         wrl = czrkMapper.stsByWrl(czrk);
+        long endTimeSql = System.currentTimeMillis() - startTimeSql;
+        log.info("执行查询未认领sql语句时间:" + endTimeSql + "ms");
+
         //设置查询权限
         setQueryRole(czrk, sysUser, queryType);
         if (Czrk.HJ.equals(queryType)) {
@@ -1269,19 +1273,28 @@ public class CzrkServiceImpl implements ICzrkService {
             String regionId = czrk.getRegionIdXjd();
             String villageTownsId = czrk.getVillageTownsIdXjd();
             String villageId = czrk.getVillageIdXjd();
-            List<Czrk> czrks = new ArrayList<>();
             //如果查询参数有居住地址,进行连表查询
             if (StringUtils.isNotBlank(provinceId) || StringUtils.isNotBlank(cityId) || StringUtils.isNotBlank(regionId) || StringUtils.isNotBlank(villageTownsId) || StringUtils.isNotBlank(villageId)) {
-                czrks = czrkMapper.listCzrkByJzdz(czrk);
+                long startTimeSql1 = System.currentTimeMillis();
+                total = czrkMapper.selectCzrkJzdzCount(czrk);
+                long endTimeSql1 = System.currentTimeMillis() - startTimeSql1;
+                log.info("sts执行查询所有带居住条件户籍人员sql语句时间:" + endTimeSql1 + "ms");
+                czrk.setIsRl("是");
+                long startTimeSql2 = System.currentTimeMillis();
+                yrl = czrkMapper.selectCzrkJzdzCount(czrk);
+                long endTimeSql2 = System.currentTimeMillis() - startTimeSql2;
+                log.info("sts执行查询所有带居住条件户籍人员已认领的sql语句时间:" + endTimeSql2 + "ms");
             } else {
                 //没有搜索居住地址的条件,进行单表查询
-                czrks = czrkMapper.listByCzrk(czrk);
-            }
-            if (czrks != null && czrks.size() > 0) {
-                //户籍人口全部人员
-                total = czrks.size();
-                //户籍人口已认领
-                yrl = czrks.stream().filter(e -> StringUtils.isNotBlank(e.getIsRl()) && "是".equals(e.getIsRl())).count();
+                long startTimeSql1 = System.currentTimeMillis();
+                total = czrkMapper.selectCzrkCount(czrk);
+                long endTimeSql1 = System.currentTimeMillis() - startTimeSql1;
+                log.info("sts执行查询所有户籍人员sql语句时间:" + endTimeSql1 + "ms");
+                czrk.setIsRl("是");
+                long startTimeSql2 = System.currentTimeMillis();
+                yrl = czrkMapper.selectCzrkCount(czrk);
+                long endTimeSql2 = System.currentTimeMillis() - startTimeSql2;
+                log.info("sts执行查询所有户籍人员已认领的sql语句时间:" + endTimeSql2 + "ms");
             }
         } else {
             //常住人口全部人员

+ 71 - 1
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -565,6 +565,7 @@
             <if test="params.endAge != null  and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
             <if test="idCard != null  and idCard != ''">and c.id_card = #{idCard}</if>
             <if test="phoneNum != null  and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
             <if test="houseType != null  and houseType != ''">and c.house_type = #{houseType}</if>
             <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
             <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
@@ -614,7 +615,6 @@
         <where>
             c.is_del = 'N'
             and c.is_rl = '否'
-            and c.is_confirm = 'N'
             and c.status = '1'
             <if test="userName != null  and userName != ''">
                 and c.user_name like concat(#{userName}, '%')
@@ -623,6 +623,7 @@
             <if test="params.endAge != null  and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
             <if test="idCard != null  and idCard != ''">and c.id_card = #{idCard}</if>
             <if test="phoneNum != null  and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
             <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
             <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
             <if test="regionId != null  and regionId != ''">and c.region_id = #{regionId}</if>
@@ -649,6 +650,7 @@
             <if test="params.endAge != null  and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
             <if test="idCard != null  and idCard != ''">and c.id_card = #{idCard}</if>
             <if test="phoneNum != null  and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
             <if test="houseType != null  and houseType != ''">and c.house_type = #{houseType}</if>
             <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
             <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
@@ -1289,4 +1291,72 @@
             #{idCard}
         </foreach>
     </select>
+
+
+    <select id="selectCzrkCount" resultType="long">
+        select ifnull(count(1),0)
+        from czrk
+        <where>
+            is_del = 'N'
+            and status = '1'
+            <!-- 已认领 -->
+            <if test="isRl != null and isRl != ''">and is_rl = #{isRl}</if>
+            <if test="userName != null  and userName != ''">
+                and user_name like concat(#{userName}, '%')
+            </if>
+            <if test="params.startAge != null  and params.startAge != ''">and age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''">and age &lt;= #{params.endAge}</if>
+            <if test="gender != null  and gender != ''">and gender = #{gender}</if>
+            <if test="age != null ">and age = #{age}</if>
+            <if test="birthday != null ">and birthday = #{birthday}</if>
+            <if test="idCard != null  and idCard != ''">and id_card = #{idCard}</if>
+            <if test="phoneNum != null  and phoneNum != ''">and phone_num = #{phoneNum}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
+            <if test="houseType != null  and houseType != ''">and house_type = #{houseType}</if>
+            <if test="provinceId != null  and provinceId != ''">and province_id = #{provinceId}</if>
+            <if test="province != null  and province != ''">and province = #{province}</if>
+            <if test="cityId != null  and cityId != ''">and city_id = #{cityId}</if>
+            <if test="city != null  and city != ''">and city = #{city}</if>
+            <if test="regionId != null  and regionId != ''">and region_id = #{regionId}</if>
+            <if test="region != null  and region != ''">and region = #{region}</if>
+            <if test="villageTownsId != null  and villageTownsId != ''">and village_towns_id = #{villageTownsId}</if>
+            <if test="villageTowns != null  and villageTowns != ''">and village_towns = #{villageTowns}</if>
+            <if test="villageId != null  and villageId != ''">and village_id = #{villageId}</if>
+            <if test="village != null  and village != ''">and village = #{village}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and is_confirm = #{isConfirm}</if>
+            <if test="gridId != null  and gridId != ''">and grid_id = #{gridId}</if>
+        </where>
+        order by create_time DESC
+    </select>
+
+    <select id="selectCzrkJzdzCount" resultType="java.lang.long">
+        select ifnull(count(1),0)
+        from czrk c left join czrk_jzdz z on c.id =z.czrk_id
+        <where>
+            c.is_del = 'N'
+            and c.status = '1'
+            <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
+            <if test="userName != null  and userName != ''">
+                and c.user_name like concat(#{userName}, '%')
+            </if>
+            <if test="params.startAge != null  and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
+            <if test="idCard != null  and idCard != ''">and c.id_card = #{idCard}</if>
+            <if test="phoneNum != null  and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
+            <if test="houseType != null  and houseType != ''">and c.house_type = #{houseType}</if>
+            <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
+            <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
+            <if test="regionId != null  and regionId != ''">and c.region_id = #{regionId}</if>
+            <if test="villageTownsId != null  and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
+            <if test="villageId != null  and villageId != ''">and c.village_id = #{villageId}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
+            <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
+            <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
+            <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
+            <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
+            <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
+        </where>
+        order by c.create_time DESC
+    </select>
 </mapper>