shiqian 3 năm trước cách đây
mục cha
commit
6972a454db

+ 4 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/Czrk.java

@@ -237,6 +237,7 @@ public class Czrk extends BaseEntity{
 
     /** 部门id集合 */
     private List<Long> deptIdList;
+    private List<String> idCardList;
 
     /** 现居地列表展示 安徽省安庆市潜山市xx乡xx村xx组 */
     private String nowInSelect;
@@ -262,4 +263,7 @@ public class Czrk extends BaseEntity{
     private String regionXjd;
     private String villageTownsXjd;
     private String villageXjd;
+
+    private String hzName;
+    private String hzIdCard;
 }

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkJzdzMapper.java

@@ -29,6 +29,8 @@ import java.util.List;
      */
      List<CzrkJzdz> selectCzrkJzdzList(CzrkJzdz czrkJzdz);
 
+     List<String> listIdCard(CzrkJzdz czrkJzdz);
+
     /**
      * 新增常住人口对应的居住地址
      * 

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

@@ -109,4 +109,15 @@ public interface CzrkMapper {
     List<Czrk> listByHjJs(@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);
+
+    int countHj1(@Param("deptIdList") List<Long> deptIdList);
+    int countCz1(@Param("deptIdList") List<Long> deptIdList);
+
+    int countByHjXz1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deptIdList") List<Long> deptIdList);
+    int countByHjJs1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deptIdList") List<Long> deptIdList);
+
+    int countByCzXz1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deptIdList") List<Long> deptIdList);
+    int countByCzJs1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deptIdList") List<Long> deptIdList);
+
+    Czrk getHzByCode(String code);
 }

+ 5 - 0
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkJzdzServiceImpl.java

@@ -44,6 +44,11 @@ public class CzrkJzdzServiceImpl implements ICzrkJzdzService {
         return czrkJzdzMapper.selectCzrkJzdzList(czrkJzdz);
     }
 
+    @Override
+    public List<String> listIdCard(CzrkJzdz czrkJzdz) {
+        return czrkJzdzMapper.listIdCard(czrkJzdz);
+    }
+
     /**
      * 新增常住人口对应的居住地址
      *

+ 94 - 13
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -53,7 +53,7 @@ import static com.google.common.base.Strings.nullToEmpty;
 @Slf4j
 public class CzrkServiceImpl implements ICzrkService {
 
-    private static JSONObject QIANSHANSHI = null, ZHEN = null, QIANSHANSHI_SINGEL = null, ECHARTS_LINE = null;
+    private static JSONObject QIANSHANSHI = null, ZHEN = null, CUN = null, QIANSHANSHI_SINGEL = null, ECHARTS_LINE = null;
 
     @Autowired
     private CzrkMapper czrkMapper;
@@ -67,12 +67,40 @@ public class CzrkServiceImpl implements ICzrkService {
     @Resource
     private GridInfoMapper gridInfoMapper;
 
-
+    /**
+     * 功能描述: 市领导查询,deptId不起作用,具体到村,需要czrk的villageId有值就可以,只是villageId起作用
+     * 镇及以下,查询,villageId和deptIdList同时起作用
+     *
+     * @param czrk
+     * @return java.util.List<com.boman.domain.Czrk>
+     */
     @Override
     public List<Czrk> listByRlry(Czrk czrk) {
         setDeptIdList(czrk);
         setAgeScope(czrk);
 
+        // 去查jzdz表
+//        if (Czrk.CZ.equals(czrk.getQueryType())) {
+//            CzrkJzdz czrkJzdz = new CzrkJzdz();
+//            Long provinceId = czrk.getProvinceIdXjd();
+//            Long cityId = czrk.getCityIdXjd();
+//            Long regionId = czrk.getRegionIdXjd();
+//            Long villageTownsId = czrk.getVillageTownsIdXjd();
+//            Long villageId = czrk.getVillageIdXjd();
+//            if (null == provinceId && null == cityId && null == regionId && null == villageTownsId && null == villageId) {
+//                czrk.setIdCardList(null);
+//            } else {
+//                czrkJzdz.setProvinceId(provinceId);
+//                czrkJzdz.setCityId(cityId);
+//                czrkJzdz.setRegionId(regionId);
+//                czrkJzdz.setTownId(villageTownsId);
+//                czrkJzdz.setVillageId(villageId);
+//                startPage();
+//                List<String> idCardList = czrkJzdzService.listIdCard(czrkJzdz);
+//                czrk.setIdCardList(idCardList);
+//            }
+//        }
+
         startPage();
 //        List<Czrk> czrks = czrkMapper.listByRlryRel(czrk);
         List<Czrk> czrks = czrkMapper.listByRlry(czrk);
@@ -344,16 +372,26 @@ public class CzrkServiceImpl implements ICzrkService {
         }
 
         Czrk czrk = czrkMapper.selectCzrkById(id);
-        if (czrk != null){
-            Long gridId = czrk.getGridId();
-            if (gridId != null){
-                GridInfo gridInfo = gridInfoMapper.selectGridInfoById(gridId);
-                if (gridInfo != null){
-                    String areaName = gridInfo.getAreaName();
-                    czrk.setGridName(areaName);
-                }
+        if (null == czrk) {
+            return null;
+        }
+
+        Long gridId = czrk.getGridId();
+        if (gridId != null) {
+            GridInfo gridInfo = gridInfoMapper.selectGridInfoById(gridId);
+            if (gridInfo != null) {
+                String areaName = gridInfo.getAreaName();
+                czrk.setGridName(areaName);
             }
         }
+
+        // 拿到户主的姓名和身份证号
+        Czrk hzCzrk = czrkMapper.getHzByCode(czrk.getCode());
+        if (hzCzrk != null) {
+            czrk.setHzName(hzCzrk.getUserName());
+            czrk.setHzIdCard(hzCzrk.getIdCard());
+        }
+
         List<CzrkJzdz> czrkJzdzList = czrkJzdzService.listByIdCard(Collections.singletonList(czrk.getIdCard()));
         czrk.setCzrkJzdzList(czrkJzdzList);
         return czrk;
@@ -373,6 +411,8 @@ public class CzrkServiceImpl implements ICzrkService {
             czrk.setRlTime(null);
         }
 
+        // 当前登陆人的所属最后一级的dept_id
+        czrk.setDeptId(sysUser.getDeptId());
         int count = czrkMapper.countIdCard(czrk.getIdCard());
         if (count > 0) return AjaxResult.error(String.format("该人员[身份证号为: %s]已存在,请勿重复添加", czrk.getIdCard()));
 
@@ -392,6 +432,8 @@ public class CzrkServiceImpl implements ICzrkService {
             czrkJzdz.setIdCard(czrk.getIdCard());
             czrkJzdz.setCreateBy(username);
             czrkJzdz.setUpdateBy(username);
+            // 当前登陆人的所属最后一级的dept_id
+            czrkJzdz.setDeptId(sysUser.getDeptId());
             childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
         }
 
@@ -619,7 +661,7 @@ public class CzrkServiceImpl implements ICzrkService {
             }
 
             ThreadPoolService.execute(() -> {
-                Long areaId = 340882000000L;
+                Long areaId = 340882000000L; //潜山市
                 List<SysDept> allDepts = remoteDeptService.listChildrenDepts(1L);
                 List<SysDept> townsDepts = new ArrayList<>(16);
                 for (SysDept allDept : allDepts) {
@@ -641,7 +683,7 @@ public class CzrkServiceImpl implements ICzrkService {
                 }
                 result.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
 
-                // 常住人口信息 areaId 为潜山市的为常住人口
+                // 常住人口信息 需要用到deptId
                 int type = 3;
                 int czzrs = czrkMapper.countCzrk(type, areaId); // 常住人口
                 result.put("czzrs", czzrs);
@@ -704,7 +746,25 @@ public class CzrkServiceImpl implements ICzrkService {
             });
 
             return ZHEN;
-        }
+        }/*else if (roleKeySets.contains("village")) {
+            JSONObject jsonObject = redisService.getCacheObject(packRedisKey("village:" + deptId));
+            if (isNotEmpty(jsonObject)) {
+                ZHEN = jsonObject;
+                return jsonObject;
+            }
+
+            ThreadPoolService.execute(() -> {
+                String startTime = DateUtils.getTodayStartStr();
+                String endTime = DateUtils.getTodayEndStr();
+                List<SysDept> depts = remoteDeptService.listChildrenDepts(deptId);
+                result.put("dqdw", deptName);
+
+
+                setIntoRedis(packRedisKey("village:" + deptId), result);
+            });
+
+            return CUN;
+        }*/
 
         return result;
     }
@@ -735,6 +795,27 @@ public class CzrkServiceImpl implements ICzrkService {
 
         result.put("zu", isEmpty(zuDept) ? 0 : zuDept.size());
 
+        /** **/
+//        List<Long> deptIdList = map(depts, SysDept::getId);
+//        int hjzrs = czrkMapper.countHj1(deptIdList); // 该镇户籍人口总数
+//        result.put("hjzrs", hjzrs);
+//        int hjxz = czrkMapper.countByHjXz1(startTime, endTime, deptIdList); // 该镇 户籍人口今日新增
+//        result.put("hjxz", hjxz);
+//        int hjjs = czrkMapper.countByHjJs1(startTime, endTime, deptIdList); // 该镇 户籍人口今日减少
+//        result.put("hjjs", hjjs);
+//
+//        // 该镇常住人口总数
+//        int czzrs = czrkMapper.countCz1(deptIdList);
+//        result.put("czzrs", czzrs);
+//        int czxz = czrkMapper.countByCzXz1(startTime, endTime, deptIdList); // 该镇 常住人口今日新增
+//        int czjs = czrkMapper.countByCzJs1(startTime, endTime, deptIdList); // 该镇 常住人口今日减少
+//        result.put("czxz", czxz);
+//        result.put("czjs", czjs);
+//
+//        result.put("zhen", deptName);
+        /** **/
+
+
         // 常住人口信息
         int type = 4; // 乡镇
         int czzrs = czrkMapper.countCzrk(type, areaId); // 常住人口

+ 1 - 0
boman-web-core/src/main/java/com/boman/web/core/service/czrk/ICzrkJzdzService.java

@@ -27,6 +27,7 @@ public interface ICzrkJzdzService {
      * @return 常住人口对应的居住地址集合
      */
     List<CzrkJzdz> selectCzrkJzdzList(CzrkJzdz czrkJzdz);
+    List<String> listIdCard(CzrkJzdz czrkJzdz);
 
     /**
      * 新增常住人口对应的居住地址

+ 24 - 1
boman-web-core/src/main/resources/mapper/CzrkJzdzMapper.xml

@@ -55,7 +55,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null  and status != ''"> and status = #{status}</if>
         </where>
     </select>
-    
+
+    <select id="listIdCard" resultType="string">
+        select id_card from czrk_jzdz
+        <where>
+            <if test="czrkId != null "> and czrk_id = #{czrkId}</if>
+            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
+            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
+            <if test="sort != null "> and sort = #{sort}</if>
+            <if test="deptId != null "> and dept_id = #{deptId}</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="townId != null  and townId != ''"> and town_id = #{townId}</if>
+            <if test="town != null  and town != ''"> and town = #{town}</if>
+            <if test="villageId != null  and villageId != ''"> and village_id = #{villageId}</if>
+            <if test="village != null  and village != ''"> and village = #{village}</if>
+            <if test="nowIn != null  and nowIn != ''"> and now_in = #{nowIn}</if>
+            <if test="status != null  and status != ''"> and status = #{status}</if>
+        </where>
+    </select>
+
     <select id="selectCzrkJzdzById" parameterType="Long" resultMap="CzrkJzdzResult">
         <include refid="selectCzrkJzdzVo"/>
         where id = #{id}

+ 82 - 2
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -101,8 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <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="villagerGroupId != null  and villagerGroupId != ''"> and villager_group_id = #{villagerGroupId}</if>
-            <if test="villagerGroup != null  and villagerGroup != ''"> and villager_group = #{villagerGroup}</if>
+        <!--    <if test="villagerGroupId != null  and villagerGroupId != ''"> and villager_group_id = #{villagerGroupId}</if>
+            <if test="villagerGroup != null  and villagerGroup != ''"> and villager_group = #{villagerGroup}</if>-->
             <if test="nowIn != null  and nowIn != ''"> and now_in = #{nowIn}</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
             <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
@@ -114,6 +114,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{deptId}
                 </foreach>
             </if>
+            <if test="idCardList != null and idCardList.size() > 0">
+                and id_card in
+                <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
+                    #{idCard}
+                </foreach>
+            </if>
         </where>
         order by create_time DESC
     </select>
@@ -348,6 +354,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </choose>
     </select>
 
+    <select id="countHj1" resultType="int">
+        select count(vi.id)
+        from czrk vi
+        where vi.is_del = 'N'
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and vi.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="countCz1" resultType="int">
+        SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
+        where jzdz.status = 'Y'
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and jzdz.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="countByCzXz1" 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}
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and jzdz.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="countByCzJs1" 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}
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and jzdz.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="countByHjXz1" resultType="int">
+        select count(vi.id)
+        from czrk vi
+        where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and vi.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="countByHjJs1" resultType="int">
+        select count(vi.id)
+        from czrk vi
+        where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and vi.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
     <select id="selectCzrkById" parameterType="Long" resultMap="CzrkResult">
         <include refid="selectCzrkVo"/>
         where id = #{id} limit 1
@@ -391,6 +466,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </choose>
     </select>
 
+    <select id="getHzByCode" resultMap="CzrkResult">
+        SELECT user_name, id_card
+        from czrk
+        where house_type = '是' ande code = #{code} limit 1;
+    </select>
 
     <select id="stsByWrl" resultType="int">
         select count(vi.id)