shiqian 3 rokov pred
rodič
commit
dead440516

+ 5 - 3
boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkMapper.java

@@ -102,9 +102,11 @@ public interface CzrkMapper {
     int countByCzXz(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
     int countByCzJs(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
 
-    List<Czrk>  countByHjXz(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
+    int countByHjXz(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
+    List<Czrk>  listByHjXz(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
 
-    List<Czrk>  countByHjJs(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
+    int countByHjJs(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
+    List<Czrk> listByHjJs(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
 
-    List<Czrk> countHj(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
+    int countHj(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("type") int type, @Param("areaId") Long areaId);
 }

+ 27 - 24
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -74,8 +74,11 @@ public class CzrkServiceImpl implements ICzrkService {
         setAgeScope(czrk);
 
         startPage();
-        List<Czrk> czrks = czrkMapper.listByRlryRel(czrk);
+//        List<Czrk> czrks = czrkMapper.listByRlryRel(czrk);
+        List<Czrk> czrks = czrkMapper.listByRlry(czrk);
+//        List<CzrkJzdz> czrkJzdzs = getCzrkJzdzs(czrks);
         handleList1(czrks);
+//        handleList(czrks, Czrk.HJ, czrkJzdzs);
         return czrks;
     }
 
@@ -554,16 +557,16 @@ public class CzrkServiceImpl implements ICzrkService {
 
                 // 户籍人口信息
                 // 户籍总人数
-                List<Czrk> hjzrsList = czrkMapper.countHj(startTime, endTime, type, areaId);
-                int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
+                int hjzrs = czrkMapper.countHj(startTime, endTime, type, areaId);
+//                int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
                 result.put("hjzrs", hjzrs);
 
                 // 户籍人口信息 新增 减少
                 type = 3; // regionId
-                List<Czrk> hjxzs = czrkMapper.countByHjXz(startTime, endTime, type, areaId); // 新增
-                List<Czrk> hjjss = czrkMapper.countByHjJs(startTime, endTime, type, areaId);// 减少
-                result.put("hjxz", isEmpty(hjxzs) ? 0 : hjxzs.size());
-                result.put("hjjs", isEmpty(hjjss) ? 0 : hjjss.size());
+                int hjxzs = czrkMapper.countByHjXz(startTime, endTime, type, areaId); // 新增
+                int hjjss = czrkMapper.countByHjJs(startTime, endTime, type, areaId);// 减少
+                result.put("hjxz", hjxzs);
+                result.put("hjjs", hjjss);
 
                 // 户籍人口信息 百分比
                 String hjbfb = NumberUtils.percent(hjzrs, zrs);
@@ -657,16 +660,16 @@ public class CzrkServiceImpl implements ICzrkService {
 
                 // 户籍人口信息
                 // 户籍总人数
-                List<Czrk> hjzrsList = czrkMapper.countHj(todayStart, todayEnd, type, areaId);
-                int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
+                int hjzrs = czrkMapper.countHj(todayStart, todayEnd, type, areaId);
+//                int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
                 result.put("hjzrs", hjzrs);
 
                 // 户籍人口信息 新增 减少
                 type = 3; // regionId
-                List<Czrk> hjxzs = czrkMapper.countByHjXz(todayStart, todayEnd, type, areaId); // 新增
-                List<Czrk> hjjss = czrkMapper.countByHjJs(todayStart, todayEnd, type, areaId);// 减少
-                result.put("hjxz", isEmpty(hjxzs) ? 0 : hjxzs.size());
-                result.put("hjjs", isEmpty(hjjss) ? 0 : hjjss.size());
+                int hjxzs = czrkMapper.countByHjXz(todayStart, todayEnd, type, areaId); // 新增
+                int hjjss = czrkMapper.countByHjJs(todayStart, todayEnd, type, areaId);// 减少
+                result.put("hjxz", hjxzs);
+                result.put("hjjs", hjjss);
 
                 // 户籍人口信息 百分比
                 String hjbfb = NumberUtils.percent(hjzrs, zrs);
@@ -732,8 +735,8 @@ public class CzrkServiceImpl implements ICzrkService {
 
         result.put("zu", isEmpty(zuDept) ? 0 : zuDept.size());
 
-        // 常住人口信息 areaId 为潜山市的为常住人口
-        int type = 0;
+        // 常住人口信息
+        int type = 4; // 乡镇
         int czzrs = czrkMapper.countCzrk(type, areaId); // 常住人口
         result.put("czzrs", czzrs);
 
@@ -746,7 +749,7 @@ public class CzrkServiceImpl implements ICzrkService {
             result.put("czbfb", czbfb);
         }
 
-        type = 4;
+//        type = 4;
         int czxz = czrkMapper.countByCzXz(startTime, endTime, type, areaId);
         int czjs = czrkMapper.countByCzJs(startTime, endTime, type, areaId);
         result.put("czxz", czxz);
@@ -755,14 +758,14 @@ public class CzrkServiceImpl implements ICzrkService {
         result.put("zhen", deptName);
 
         // 户籍人口信息
-        List<Czrk> hjxzs = czrkMapper.countByHjXz(startTime, endTime, type, areaId); // 新增
-        List<Czrk> hjjss = czrkMapper.countByHjJs(startTime, endTime, type, areaId);// 减少
-        result.put("hjxz", isEmpty(hjxzs) ? 0 : hjxzs.size());
-        result.put("hjjs", isEmpty(hjjss) ? 0 : hjjss.size());
+        int hjxzs = czrkMapper.countByHjXz(startTime, endTime, type, areaId); // 新增
+        int hjjss = czrkMapper.countByHjJs(startTime, endTime, type, areaId);// 减少
+        result.put("hjxz", hjxzs);
+        result.put("hjjs", hjjss);
 
         // 户籍总人数
-        List<Czrk> hjzrsList = czrkMapper.countHj(startTime, endTime, type, areaId);
-        int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
+        int hjzrs = czrkMapper.countHj(startTime, endTime, type, areaId);
+//                int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
         result.put("hjzrs", hjzrs);
         String hjbfb = NumberUtils.percent(hjzrs, zrs);
         result.put("hjbfb", hjbfb);
@@ -803,8 +806,8 @@ public class CzrkServiceImpl implements ICzrkService {
             List<Czrk> czjss = czrkMapper.listByCzJs(startTime, endTime, type, areaId);
 
             // 户籍人口信息
-            List<Czrk> hjxzs = czrkMapper.countByHjXz(startTime, endTime, type, areaId); // 新增
-            List<Czrk> hjjss = czrkMapper.countByHjJs(startTime, endTime, type, areaId);// 减少
+            List<Czrk> hjxzs = czrkMapper.listByHjXz(startTime, endTime, type, areaId); // 新增
+            List<Czrk> hjjss = czrkMapper.listByHjJs(startTime, endTime, type, areaId);// 减少
 
             List<JSONObject> result = new ArrayList<>();
             for (java.util.Date week : dateList) {

+ 57 - 18
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -611,12 +611,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         GROUP BY czrk.id
     </select>
 
-    <select id="countByHjXz" resultMap="CzrkResult">
-        SELECT czrk.id, czrk.create_time
+    <select id="countByHjXz" resultType="int">
+        SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
+        where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
+        <!--SELECT czrk.id, czrk.create_time
         from czrk
         left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
-        where czrk.is_del = 'N' and czrk.create_time &gt;= #{startTime} and czrk.create_time &lt;= #{endTime}
-       <!-- <if test="userName != null  and userName != ''">
+        where czrk.is_del = 'N'
+        <if test="userName != null  and userName != ''">
             and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
         </if>-->
 
@@ -627,15 +629,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <when test="type == 4">and jzdz.town_id = #{areaId}</when>
             <when test="type == 5">and jzdz.village_id = #{areaId}</when>
         </choose>
-        GROUP BY czrk.id
+        <!--GROUP BY czrk.id-->
     </select>
 
-    <select id="countByHjJs" resultMap="CzrkResult">
-        SELECT czrk.id, czrk.update_time
-        from czrk
-        left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
-        where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
-       <!-- <if test="userName != null  and userName != ''">
+    <select id="listByHjXz" resultMap="CzrkResult">
+        SELECT czrk.id, czrk.create_time
+        where czrk.is_del = 'N' and czrk.create_time &gt;= #{startTime} and czrk.create_time &lt;= #{endTime}
+        <!-- <if test="userName != null  and userName != ''">
             and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
         </if>-->
 
@@ -649,16 +649,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         GROUP BY czrk.id
     </select>
 
+     <select id="countByHjJs" resultType="int">
+         SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
+         where jzdz.status = 'N' and jzdz.update_time &gt;= #{startTime} and jzdz.update_time &lt;= #{endTime}
+         <!-- SELECT czrk.id, czrk.update_time
+          from czrk
+          left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
+          where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
+          <if test="userName != null  and userName != ''">
+              and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
+          </if>-->
+
+        <choose>
+            <when test="type == 1">and jzdz.province_id = #{areaId}</when>
+            <when test="type == 2">and jzdz.city_id = #{areaId}</when>
+            <when test="type == 3">and jzdz.region_id = #{areaId}</when>
+            <when test="type == 4">and jzdz.town_id = #{areaId}</when>
+            <when test="type == 5">and jzdz.village_id = #{areaId}</when>
+        </choose>
+        <!--GROUP BY czrk.id-->
+    </select>
 
-    <select id="countHj" resultMap="CzrkResult">
-        SELECT czrk.id
+    <select id="listByHjJs" resultMap="CzrkResult">
+        SELECT czrk.id, czrk.update_time
         from czrk
         left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
-        where czrk.is_del = 'N'
-        <!--<if test="userName != null  and userName != ''">
-            and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
-        </if>-->
-
+        where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
+        <!-- <if test="userName != null  and userName != ''">
+             and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
+         </if>-->
         <choose>
             <when test="type == 1">and jzdz.province_id = #{areaId}</when>
             <when test="type == 2">and jzdz.city_id = #{areaId}</when>
@@ -669,5 +688,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         GROUP BY czrk.id
     </select>
 
+    <select id="countHj" resultType="int">
+        SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz where jzdz.status = 'Y'
+        <!-- SELECT czrk.id
+         from czrk
+         left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
+         where czrk.is_del = 'N'
+         <if test="userName != null  and userName != ''">
+             and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
+         </if>-->
+
+        <choose>
+            <when test="type == 1">and jzdz.province_id = #{areaId}</when>
+            <when test="type == 2">and jzdz.city_id = #{areaId}</when>
+            <when test="type == 3">and jzdz.region_id = #{areaId}</when>
+            <when test="type == 4">and jzdz.town_id = #{areaId}</when>
+            <when test="type == 5">and jzdz.village_id = #{areaId}</when>
+        </choose>
+        <!--GROUP BY czrk.id-->
+    </select>
+
 
 </mapper>