Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	boman-web-core/src/main/java/com/boman/web/core/controller/TestController.java
tjf 3 lat temu
rodzic
commit
768ee6be85

+ 35 - 17
boman-api/boman-domain/src/main/java/com/boman/domain/Czrk.java

@@ -1,15 +1,10 @@
 package com.boman.domain;
 
-import java.util.Date;
-import java.util.List;
-
 import com.boman.domain.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.*;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
-import lombok.experimental.SuperBuilder;
+import java.util.List;
 
 /**
  * 常住人口对象 czrk
@@ -27,6 +22,8 @@ public class Czrk extends BaseEntity {
 
     public static final String IS_DEL_N = "N";
     public static final String IS_DEL_Y = "Y";
+    public static final String CZ = "CZ";
+    public static final String HJ = "HJ";
 
     /**
      * 主键
@@ -121,7 +118,7 @@ public class Czrk extends BaseEntity {
      * 户籍地的省份
      */
     @Excel(name = "户籍地的省份")
-    private String provinceId;
+    private Long provinceId;
 
     /**
      * 户籍地的省份
@@ -133,7 +130,7 @@ public class Czrk extends BaseEntity {
      * 户籍地的城市
      */
     @Excel(name = "户籍地的城市")
-    private String cityId;
+    private Long cityId;
 
     /**
      * 户籍地的城市
@@ -145,7 +142,7 @@ public class Czrk extends BaseEntity {
      * 户籍地的区
      */
     @Excel(name = "户籍地的区")
-    private String regionId;
+    private Long regionId;
 
     /**
      * 户籍地的区
@@ -157,7 +154,7 @@ public class Czrk extends BaseEntity {
      * 户籍地的镇
      */
     @Excel(name = "户籍地的镇")
-    private String villageTownsId;
+    private Long villageTownsId;
 
     /**
      * 户籍地的镇
@@ -169,7 +166,7 @@ public class Czrk extends BaseEntity {
      * 户籍地的村
      */
     @Excel(name = "户籍地的村")
-    private String villageId;
+    private Long villageId;
 
     /**
      * 户籍地的村
@@ -181,7 +178,7 @@ public class Czrk extends BaseEntity {
      * 户籍地的组
      */
     @Excel(name = "户籍地的组")
-    private String villagerGroupId;
+    private Long villagerGroupId;
 
     /**
      * 户籍地的组
@@ -214,19 +211,40 @@ public class Czrk extends BaseEntity {
     private String deleteReason;
     private String remark;
 
+    private java.sql.Timestamp createTime;
+    private java.sql.Timestamp updateTime;
+    private String createBy;
+    private String updateBy;
+
+    /*************************************************************** Transient ***************************************************************/
     private List<CzrkJzdz> czrkJzdzList;
+    private CzrkJzdz czrkJzdz;
 
     /** 部门id集合 */
     private List<Long> deptIdList;
 
-    /** 户籍地址查询展示 安徽省安庆市潜山市xx乡xx村xx组 */
+    /** 现居地列表展示 安徽省安庆市潜山市xx乡xx村xx组 */
     private String nowInSelect;
+    /** 户籍地列表展示 安徽省安庆市潜山市xx乡xx村xx组 */
+    private String domicileSelect;
+    /*** 现居地的详细地址,只留作连表映射用 **/
+    private String domicile;
 
     private String startTime;
     private String endTime;
 
-    private java.sql.Timestamp createTime;
-    private java.sql.Timestamp updateTime;
-    private String createBy;
-    private String updateBy;
+    /** 查询类型,hj户籍,cz常住,默认是户籍人口 **/
+    private String queryType = HJ;
+    
+    private Long provinceIdXjd;
+    private Long cityIdXjd;
+    private Long regionIdXjd;
+    private Long villageTownsIdXjd;
+    private Long villageIdXjd;
+
+    private String provinceXjd;
+    private String cityXjd;
+    private String regionXjd;
+    private String villageTownsXjd;
+    private String villageXjd;
 }

+ 5 - 5
boman-api/boman-domain/src/main/java/com/boman/domain/CzrkJzdz.java

@@ -60,7 +60,7 @@ public class CzrkJzdz {
      * 户籍地的省份
      */
     @Excel(name = "户籍地的省份")
-    private String provinceId;
+    private Long provinceId;
 
     /**
      * 户籍地的省份
@@ -72,7 +72,7 @@ public class CzrkJzdz {
      * 户籍地的城市
      */
     @Excel(name = "户籍地的城市")
-    private String cityId;
+    private Long cityId;
 
     /**
      * 户籍地的城市
@@ -84,7 +84,7 @@ public class CzrkJzdz {
      * 户籍地的区
      */
     @Excel(name = "户籍地的区")
-    private String regionId;
+    private Long regionId;
 
     /**
      * 户籍地的区
@@ -96,7 +96,7 @@ public class CzrkJzdz {
      * 居住地的镇
      */
     @Excel(name = "居住地的镇")
-    private String townId;
+    private Long townId;
 
     /**
      * 居住地的镇
@@ -108,7 +108,7 @@ public class CzrkJzdz {
      * 居住地的村
      */
     @Excel(name = "居住地的村")
-    private String villageId;
+    private Long villageId;
 
     /**
      * 居住地的村

+ 15 - 19
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysDeptServiceImpl.java

@@ -1,38 +1,33 @@
 package com.boman.system.service.impl;
 
-import java.util.*;
-import java.util.stream.Collectors;
-
-import com.boman.common.core.utils.SecurityUtils;
-import com.boman.common.core.utils.number.NumberUtils;
 import com.alibaba.fastjson.JSONObject;
-import com.boman.common.core.utils.obj.ObjectUtils;
-import com.boman.common.redis.service.RedisService;
-import com.boman.common.security.service.TokenService;
-import com.boman.domain.SysUser;
-import com.boman.domain.constant.CacheConstants;
-import com.boman.system.api.model.LoginUser;
-import com.boman.system.mapper.SyncMapper;
-import com.google.common.collect.Lists;
-import com.sun.org.apache.regexp.internal.RE;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.boman.domain.constant.UserConstants;
 import com.boman.common.core.exception.CustomException;
+import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.StringUtils;
+import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.common.datascope.annotation.DataScope;
+import com.boman.common.redis.service.RedisService;
 import com.boman.domain.SysDept;
 import com.boman.domain.SysRole;
+import com.boman.domain.SysUser;
+import com.boman.domain.constant.CacheConstants;
+import com.boman.domain.constant.UserConstants;
+import com.boman.system.api.model.LoginUser;
 import com.boman.system.domain.vo.TreeSelect;
+import com.boman.system.mapper.SyncMapper;
 import com.boman.system.mapper.SysDeptMapper;
 import com.boman.system.mapper.SysRoleMapper;
 import com.boman.system.service.ISysDeptService;
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
 
-import static com.boman.common.core.utils.StringUtils.isNotEmpty;
 import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
-import static com.boman.common.datascope.aspect.DataScopeAspect.DATA_SCOPE_ALL;
 
 /**
  * 部门管理 服务实现
@@ -40,6 +35,7 @@ import static com.boman.common.datascope.aspect.DataScopeAspect.DATA_SCOPE_ALL;
  * @author ruoyi
  */
 @Service
+@Slf4j
 public class SysDeptServiceImpl implements ISysDeptService {
     @Autowired
     private SysDeptMapper deptMapper;

+ 104 - 104
boman-web-core/src/main/java/com/boman/web/core/controller/Czrk1Controller.java

@@ -1,104 +1,104 @@
-package com.boman.web.core.controller;
-
-import com.boman.common.core.web.controller.BaseController;
-import com.boman.domain.TableDataInfo;
-import com.boman.domain.VaccineInfoOperation;
-import com.boman.domain.dto.AjaxResult;
-import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * @author shiqian
- * @description 常驻人口
- * @date 2022年01月05日 15:39
- **/
-@RestController
-@RequestMapping("/core/czrk")
-public class Czrk1Controller extends BaseController {
-
-    @Autowired
-    private IVaccineInfoService vaccineInfoService;
-
-    /**
-     * 功能描述: 项目首页统计信息,
-     * 当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人
-     *
-     * @return com.boman.domain.dto.AjaxResult
-     */
-    @GetMapping("/stsByCzrkHomePage")
-    public AjaxResult stsByCzrkHomePage() {
-        return AjaxResult.success("成功", vaccineInfoService.stsByCzrkHomePage());
-    }
-
-    /**
-     * 功能描述: 当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人
-     *
-     * @return com.boman.domain.dto.AjaxResult
-     */
-    @GetMapping("/stsByCzrk")
-    public AjaxResult stsByCzrk() {
-        return AjaxResult.success("成功", vaccineInfoService.stsByCzrk());
-    }
-
-    /**
-     * 功能描述: ”当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人“ 中的新增人员列表
-     *
-     * @return com.boman.domain.dto.AjaxResult
-     */
-    @GetMapping("/listByXz")
-    public TableDataInfo listByXz(VaccineInfoOperation condition) {
-        List<VaccineInfoOperation> list = vaccineInfoService.listByXz(condition);
-        return getDataTable(list);
-    }
-
-    /**
-     * 功能描述: ”当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人“ 中的减少人员列表
-     *
-     * @return com.boman.domain.dto.AjaxResult
-     */
-    @GetMapping("/listByJs")
-    public TableDataInfo listByJs(VaccineInfoOperation condition) {
-        List<VaccineInfoOperation> list = vaccineInfoService.listByJs(condition);
-        return getDataTable(list);
-    }
-
-    /**
-     * 功能描述: 删除常住人口,人员认领中的删除也是这个接口
-     *
-     * @return com.boman.domain.dto.AjaxResult
-     */
-    @GetMapping("/deleteCzrk")
-    public AjaxResult deleteCzrk(VaccineInfoOperation vaccineInfoOperation) {
-        return vaccineInfoService.deleteCzrk(vaccineInfoOperation);
-    }
-
-    /**
-     * 功能描述: 回收站的还原功能
-     *
-     * @return com.boman.domain.dto.AjaxResult
-     */
-    @GetMapping("/reduction/{id}")
-    public AjaxResult reduction(@PathVariable("id") String id) {
-        int reduction = vaccineInfoService.reduction(id);
-        return reduction > 0 ? AjaxResult.success() : AjaxResult.error();
-    }
-
-    /**
-     * 功能描述: 根据户号查找家庭中所有人员
-     *
-     * @return com.boman.domain.dto.AjaxResult
-     */
-    @GetMapping("/family/{code}")
-    public AjaxResult family(@PathVariable("code") String code) {
-        return AjaxResult.success(vaccineInfoService.family(code));
-    }
-
-
-
-}
+//package com.boman.web.core.controller;
+//
+//import com.boman.common.core.web.controller.BaseController;
+//import com.boman.domain.TableDataInfo;
+//import com.boman.domain.VaccineInfoOperation;
+//import com.boman.domain.dto.AjaxResult;
+//import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.GetMapping;
+//import org.springframework.web.bind.annotation.PathVariable;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RestController;
+//
+//import java.util.List;
+//
+///**
+// * @author shiqian
+// * @description 常驻人口
+// * @date 2022年01月05日 15:39
+// **/
+//@RestController
+//@RequestMapping("/core/czrk")
+//public class Czrk1Controller extends BaseController {
+//
+//    @Autowired
+//    private IVaccineInfoService vaccineInfoService;
+//
+//    /**
+//     * 功能描述: 项目首页统计信息,
+//     * 当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人
+//     *
+//     * @return com.boman.domain.dto.AjaxResult
+//     */
+//    @GetMapping("/stsByCzrkHomePage")
+//    public AjaxResult stsByCzrkHomePage() {
+//        return AjaxResult.success("成功", vaccineInfoService.stsByCzrkHomePage());
+//    }
+//
+//    /**
+//     * 功能描述: 当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人
+//     *
+//     * @return com.boman.domain.dto.AjaxResult
+//     */
+//    @GetMapping("/stsByCzrk")
+//    public AjaxResult stsByCzrk() {
+//        return AjaxResult.success("成功", vaccineInfoService.stsByCzrk());
+//    }
+//
+//    /**
+//     * 功能描述: ”当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人“ 中的新增人员列表
+//     *
+//     * @return com.boman.domain.dto.AjaxResult
+//     */
+//    @GetMapping("/listByXz")
+//    public TableDataInfo listByXz(VaccineInfoOperation condition) {
+//        List<VaccineInfoOperation> list = vaccineInfoService.listByXz(condition);
+//        return getDataTable(list);
+//    }
+//
+//    /**
+//     * 功能描述: ”当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人  减少 2人“ 中的减少人员列表
+//     *
+//     * @return com.boman.domain.dto.AjaxResult
+//     */
+//    @GetMapping("/listByJs")
+//    public TableDataInfo listByJs(VaccineInfoOperation condition) {
+//        List<VaccineInfoOperation> list = vaccineInfoService.listByJs(condition);
+//        return getDataTable(list);
+//    }
+//
+//    /**
+//     * 功能描述: 删除常住人口,人员认领中的删除也是这个接口
+//     *
+//     * @return com.boman.domain.dto.AjaxResult
+//     */
+//    @GetMapping("/deleteCzrk")
+//    public AjaxResult deleteCzrk(VaccineInfoOperation vaccineInfoOperation) {
+//        return vaccineInfoService.deleteCzrk(vaccineInfoOperation);
+//    }
+//
+//    /**
+//     * 功能描述: 回收站的还原功能
+//     *
+//     * @return com.boman.domain.dto.AjaxResult
+//     */
+//    @GetMapping("/reduction/{id}")
+//    public AjaxResult reduction(@PathVariable("id") String id) {
+//        int reduction = vaccineInfoService.reduction(id);
+//        return reduction > 0 ? AjaxResult.success() : AjaxResult.error();
+//    }
+//
+//    /**
+//     * 功能描述: 根据户号查找家庭中所有人员
+//     *
+//     * @return com.boman.domain.dto.AjaxResult
+//     */
+//    @GetMapping("/family/{code}")
+//    public AjaxResult family(@PathVariable("code") String code) {
+//        return AjaxResult.success(vaccineInfoService.family(code));
+//    }
+//
+//
+//
+//}

+ 8 - 8
boman-web-core/src/main/java/com/boman/web/core/controller/CzrkController.java

@@ -22,7 +22,7 @@ import java.util.List;
  * @date 2022-01-14
  */
 @RestController
-@RequestMapping("/core/czrk1")
+@RequestMapping("/core/czrk")
 public class CzrkController extends BaseController {
 
     @Autowired
@@ -49,13 +49,13 @@ public class CzrkController extends BaseController {
      * 导出常住人口列表
      */
 //    @PreAuthorize("@ss.hasPermi('system:czrk:export')")
-    @Log(title = "常住人口", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, Czrk czrk) throws IOException {
-        List<Czrk> list = czrkService.selectCzrkList(czrk);
-        ExcelUtil<Czrk> util = new ExcelUtil<>(Czrk.class);
-        util.exportExcel(response, list, "常住人口数据");
-    }
+//    @Log(title = "常住人口", businessType = BusinessType.EXPORT)
+//    @PostMapping("/export")
+//    public void export(HttpServletResponse response, Czrk czrk) throws IOException {
+//        List<Czrk> list = czrkService.selectCzrkList(czrk);
+//        ExcelUtil<Czrk> util = new ExcelUtil<>(Czrk.class);
+//        util.exportExcel(response, list, "常住人口数据");
+//    }
 
     /**
      * 获取常住人口详细信息

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/controller/RyrlController.java

@@ -53,7 +53,7 @@ public class RyrlController extends BaseController {
      */
     @PostMapping("/editRlry")
     public AjaxResult editRlry(@RequestBody Czrk czrk) {
-        return toAjax(czrkService.editRlry(czrk));
+        return czrkService.editRlry(czrk);
     }
 
     /**

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

@@ -1,6 +1,7 @@
 package com.boman.web.core.mapper;
 
 import com.boman.domain.CzrkJzdz;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -51,6 +52,7 @@ import java.util.List;
      * @return 结果
      */
      int deleteCzrkJzdzById(Long id);
+     int deleteByCzrkId(Long czrkId);
 
     /**
      * 批量删除常住人口对应的居住地址
@@ -59,4 +61,6 @@ import java.util.List;
      * @return 结果
      */
      int deleteCzrkJzdzByIds(Long[] ids);
+
+    List<CzrkJzdz> listByIdCard(@Param("idCardList") List<String> idCardList);
 }

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

@@ -68,6 +68,7 @@ public interface CzrkMapper {
     int deleteCzrk(Czrk czrk);
 
     List<Czrk> listByRlry(Czrk czrk);
+    List<Czrk> listByRlryRel(Czrk czrk);
 
     List<Czrk> listByXz(Czrk czrk);
     List<Czrk> listByJs(Czrk czrk);

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

@@ -5,8 +5,11 @@ import com.boman.web.core.mapper.CzrkJzdzMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
+import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
+
 /**
  * 常住人口对应的居住地址Service业务层处理
  *
@@ -84,4 +87,18 @@ public class CzrkJzdzServiceImpl implements ICzrkJzdzService {
     public int deleteCzrkJzdzById(Long id) {
         return czrkJzdzMapper.deleteCzrkJzdzById(id);
     }
+
+    @Override
+    public int deleteByCzrkId(Long czrkId) {
+        return czrkJzdzMapper.deleteByCzrkId(czrkId);
+    }
+
+    @Override
+    public List<CzrkJzdz> listByIdCard(List<String> idCardList) {
+        if (isEmpty(idCardList)) {
+            return Collections.emptyList();
+        }
+
+        return czrkJzdzMapper.listByIdCard(idCardList);
+    }
 }

+ 124 - 29
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -18,9 +18,10 @@ import com.boman.web.core.utils.AuthUtils;
 import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.BooleanUtils;
-import org.checkerframework.checker.units.qual.C;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.sql.Date;
@@ -35,6 +36,7 @@ import static com.boman.common.core.utils.StringUtils.isNotEmpty;
 import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
 import static com.boman.common.core.utils.obj.ObjectUtils.map;
 import static com.boman.common.redis.RedisKey.STS_CZRK_;
+import static com.google.common.base.Strings.nullToEmpty;
 
 /**
  * 常住人口Service业务层处理
@@ -54,41 +56,91 @@ public class CzrkServiceImpl implements ICzrkService {
     private RemoteDeptService remoteDeptService;
     @Resource
     private RedisService redisService;
+    @Resource
+    private ICzrkJzdzService czrkJzdzService;
 
 
     @Override
     public List<Czrk> listByRlry(Czrk czrk) {
         setDeptIdList(czrk);
         setAgeScope(czrk);
+
         startPage();
+//        List<Czrk> czrks = czrkMapper.listByRlry(czrk);
+        List<Czrk> czrks = czrkMapper.listByRlryRel(czrk);
 
-        List<Czrk> czrks = czrkMapper.listByRlry(czrk);
-        handleList(czrks);
+        // 居住地址
+//        List<CzrkJzdz> czrkJzdzList = getCzrkJzdzs(czrks);
+
+//        handleList(czrks, czrk.getQueryType(), czrkJzdzList);
+        handleList1(czrks);
         return czrks;
     }
 
+    private List<CzrkJzdz> getCzrkJzdzs(List<Czrk> czrks) {
+//        List<CzrkJzdz> czrkJzdzList = null;
+//        // 常住人口需要查 czrk_jzdz
+//        if (Czrk.CZ.equals(queryType)) {
+        List<String> idCardList = map(czrks, Czrk::getIdCard);
+        List<CzrkJzdz> czrkJzdzList = czrkJzdzService.listByIdCard(idCardList);
+//        }
+
+        return czrkJzdzList;
+    }
+
     @Override
     public List<Czrk> listByXz(Czrk czrk) {
         setDeptIdList(czrk);
-        List<Czrk> czrks = czrkMapper.listByXz(czrk);
-        handleList(czrks);
+//        List<Czrk> czrks = czrkMapper.listByXz(czrk);
+//        // 居住地址
+//        List<CzrkJzdz> czrkJzdzList = getCzrkJzdzs(czrks);
+//        handleList(czrks, Czrk.HJ, czrkJzdzList);
+        List<Czrk> czrks = czrkMapper.listByRlryRel(czrk);
+        handleList1(czrks);
         return czrks;
     }
 
     @Override
     public List<Czrk> listByJs(Czrk czrk) {
         setDeptIdList(czrk);
-        List<Czrk> czrks = czrkMapper.listByJs(czrk);
-        handleList(czrks);
+//        List<Czrk> czrks = czrkMapper.listByJs(czrk);
+//        // 居住地址
+//        List<CzrkJzdz> czrkJzdzList = getCzrkJzdzs(czrks);
+//        handleList(czrks, Czrk.HJ, czrkJzdzList);
+        List<Czrk> czrks = czrkMapper.listByRlryRel(czrk);
+        handleList1(czrks);
         return czrks;
     }
 
-    private void handleList(List<Czrk> czrks) {
+    private void handleList(List<Czrk> czrks, String queryType, List<CzrkJzdz> czrkJzdzList) {
         for (Czrk crk : czrks) {
-            // 現在居住地址查询展示 安徽省安庆市潜山市xx乡xx村xx组
-            String addr = crk.getProvince() + crk.getCity() + crk.getRegion() + crk.getVillageTowns() +
-                    crk.getVillage() + crk.getVillagerGroup() + crk.getNowIn();
-            crk.setNowInSelect(addr);
+//            if (Czrk.HJ.equals(queryType)) {
+            // 户籍地
+            String province = nullToEmpty(crk.getProvince()), city = nullToEmpty(crk.getCity()), region = nullToEmpty(crk.getRegion()), villageTowns = nullToEmpty(crk.getVillageTowns()), village = nullToEmpty(crk.getVillage()), villageGroup = nullToEmpty(crk.getVillagerGroup()), nowIn = nullToEmpty(crk.getNowIn());
+            crk.setDomicileSelect(province + city + region + villageTowns + village + villageGroup + nowIn);
+
+            // 现居住地
+            for (CzrkJzdz czrkJzdz : czrkJzdzList) {
+                if (!czrkJzdz.getIdCard().equals(crk.getIdCard())) continue;
+
+                String provinceCz = nullToEmpty(czrkJzdz.getProvince()), cityCz = nullToEmpty(czrkJzdz.getCity()), regionCz = nullToEmpty(czrkJzdz.getRegion()), villageTownsCz = nullToEmpty(czrkJzdz.getTown()), villageCz = nullToEmpty(czrkJzdz.getVillage()), nowInCz = nullToEmpty(czrkJzdz.getNowIn());
+                crk.setNowInSelect(provinceCz + cityCz + regionCz + villageTownsCz + villageCz + nowInCz);
+                break;
+            }
+//            }
+        }
+    }
+
+    private void handleList1(List<Czrk> czrks) {
+        if (isEmpty(czrks)) return;
+        for (Czrk crk : czrks) {
+            // 户籍地
+            String province = nullToEmpty(crk.getProvince()), city = nullToEmpty(crk.getCity()), region = nullToEmpty(crk.getRegion()), villageTowns = nullToEmpty(crk.getVillageTowns()), village = nullToEmpty(crk.getVillage()), villageGroup = nullToEmpty(crk.getVillagerGroup()), nowIn = nullToEmpty(crk.getNowIn());
+            crk.setDomicileSelect(province + city + region + villageTowns + village + villageGroup + nowIn);
+
+            // 现居住地
+            String provinceCz = nullToEmpty(crk.getProvinceXjd()), cityCz = nullToEmpty(crk.getCityXjd()), regionCz = nullToEmpty(crk.getRegionXjd()), villageTownsCz = nullToEmpty(crk.getVillageTownsXjd()), villageCz = nullToEmpty(crk.getVillageXjd()), nowInCz = nullToEmpty(crk.getDomicile());
+            crk.setNowInSelect(provinceCz + cityCz + regionCz + villageTownsCz + villageCz + nowInCz);
         }
     }
 
@@ -124,7 +176,7 @@ public class CzrkServiceImpl implements ICzrkService {
             if (isNotEmpty(roles)) {
                 for (SysRole role : roles) {
                     String roleKey = role.getRoleKey();
-                    if ("admin".equals(roleKey) || "city".equals(roleKey)) {
+                    if ("admin".equals(roleKey) || "city".equals(roleKey) || "yanshi".equals(roleKey)) {
                         return;
                     }
                 }
@@ -166,37 +218,34 @@ public class CzrkServiceImpl implements ICzrkService {
 
     /**
      * 查询常住人口
-     * 
+     *
      * @param id 常住人口主键
      * @return 常住人口
      */
     @Override
-    public Czrk selectCzrkById(Long id)
-    {
+    public Czrk selectCzrkById(Long id) {
         return czrkMapper.selectCzrkById(id);
     }
 
     /**
      * 查询常住人口列表
-     * 
+     *
      * @param czrk 常住人口
      * @return 常住人口
      */
     @Override
-    public List<Czrk> selectCzrkList(Czrk czrk)
-    {
+    public List<Czrk> selectCzrkList(Czrk czrk) {
         return czrkMapper.selectCzrkList(czrk);
     }
 
     /**
      * 新增常住人口
-     * 
+     *
      * @param czrk 常住人口
      * @return 结果
      */
     @Override
-    public int insertCzrk(Czrk czrk)
-    {
+    public int insertCzrk(Czrk czrk) {
         return czrkMapper.insertCzrk(czrk);
     }
 
@@ -261,7 +310,9 @@ public class CzrkServiceImpl implements ICzrkService {
         }
 
         List<Czrk> czrks = czrkMapper.listByCode(code);
-        handleList(czrks);
+        // 居住地址
+        List<CzrkJzdz> czrkJzdzList = getCzrkJzdzs(czrks);
+        handleList(czrks, Czrk.HJ, czrkJzdzList);
         return czrks;
     }
 
@@ -274,7 +325,9 @@ public class CzrkServiceImpl implements ICzrkService {
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public AjaxResult addRlry(Czrk czrk) {
+        String username = SecurityUtils.getUsername();
         if (isNotEmpty(czrk.getVillageTowns())) {
             czrk.setRlr(SecurityUtils.getUsername());
             czrk.setIsRl("是");
@@ -289,12 +342,33 @@ public class CzrkServiceImpl implements ICzrkService {
             return AjaxResult.error(String.format("该人员[身份证号为: %s]已存在,请勿重复添加", czrk.getIdCard()));
         }
 
+        czrk.setCreateBy(username);
+        czrk.setUpdateBy(username);
         count = czrkMapper.insertCzrk(czrk);
-        return count > 0 ? AjaxResult.success() : AjaxResult.error();
+        if (count <= 0) {
+            return AjaxResult.error();
+        }
+
+        List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
+        if (isEmpty(czrkJzdzList)) {
+            return AjaxResult.error("该人员常住地址未添加");
+        }
+
+        int sort = 0, childCount = 0;
+        for (CzrkJzdz czrkJzdz : czrkJzdzList) {
+            czrkJzdz.setCzrkId(czrk.getId());
+            czrkJzdz.setSort(++sort);
+            czrkJzdz.setCreateBy(SecurityUtils.getUsername());
+            czrkJzdz.setUpdateBy(SecurityUtils.getUsername());
+            childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
+        }
+
+        return childCount == czrkJzdzList.size() ? AjaxResult.success() : AjaxResult.error();
     }
 
     @Override
-    public int editRlry(Czrk czrk) {
+    public AjaxResult editRlry(Czrk czrk) {
+        String username = SecurityUtils.getUsername();
         if (isNotEmpty(czrk.getVillageTowns())) {
             czrk.setRlr(SecurityUtils.getUsername());
             czrk.setIsRl("是");
@@ -304,7 +378,28 @@ public class CzrkServiceImpl implements ICzrkService {
             czrk.setRlTime(null);
         }
 
-        return czrkMapper.updateCzrk(czrk);
+        czrk.setUpdateBy(username);
+        int count = czrkMapper.updateCzrk(czrk);
+        if (count <= 0) {
+            return AjaxResult.error();
+        }
+
+        List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
+        if (isEmpty(czrkJzdzList)) {
+            return AjaxResult.error("该人员常住地址未添加");
+        }
+
+        czrkJzdzService.deleteByCzrkId(czrk.getId());
+        int sort = 0, childCount = 0;
+        for (CzrkJzdz czrkJzdz : czrkJzdzList) {
+            czrkJzdz.setCzrkId(czrk.getId());
+            czrkJzdz.setSort(++sort);
+            czrkJzdz.setCreateBy(username);
+            czrkJzdz.setUpdateBy(username);
+            childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
+        }
+
+        return childCount == czrkJzdzList.size() ? AjaxResult.success() : AjaxResult.error();
     }
 
     @Override
@@ -455,7 +550,7 @@ public class CzrkServiceImpl implements ICzrkService {
                 return jsonObject;
             }
 
-            ThreadPoolService.execute(()->{
+            ThreadPoolService.execute(() -> {
                 List<SysDept> allDepts = remoteDeptService.listChildrenDepts(1L);
                 List<SysDept> townsDepts = new ArrayList<>(16);
                 for (SysDept allDept : allDepts) {
@@ -576,11 +671,11 @@ public class CzrkServiceImpl implements ICzrkService {
         result.put("zhen", deptName);
     }
 
-    private String packRedisKey(String deptId){
+    private String packRedisKey(String deptId) {
         return STS_CZRK_ + deptId + ":" + DateUtils.getDate();
     }
 
-    private void setIntoRedis(String key, Object result){
+    private void setIntoRedis(String key, Object result) {
         redisService.setCacheObject(key, result, 1L, TimeUnit.HOURS);
     }
 }

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

@@ -59,4 +59,7 @@ public interface ICzrkJzdzService {
      * @return 结果
      */
     int deleteCzrkJzdzById(Long id);
+    int deleteByCzrkId(Long czrkId);
+
+    List<CzrkJzdz> listByIdCard(List<String> idCardList);
 }

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

@@ -76,7 +76,7 @@ public interface ICzrkService {
     Czrk getById(Long id);
 
     AjaxResult addRlry(Czrk czrk);
-    int editRlry(Czrk czrk);
+    AjaxResult editRlry(Czrk czrk);
 
     JSONObject stsByApplet(Long townId, Long villageId, String userName);
     JSONObject stsByCzrk();

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

@@ -60,7 +60,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectCzrkJzdzVo"/>
         where id = #{id}
     </select>
-        
+
+    <select id="listByIdCard" resultMap="CzrkJzdzResult">
+        select id, czrk_id, id_card, province, city, region, town, village, now_in from czrk_jzdz
+        where id_card in
+        <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
+            #{idCard}
+        </foreach>
+    </select>
+
     <insert id="insertCzrkJzdz" useGeneratedKeys="true" keyProperty="id">
         insert into czrk_jzdz
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -143,6 +151,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from czrk_jzdz where id = #{id}
     </delete>
 
+    <delete id="deleteByCzrkId" parameterType="Long">
+        delete from czrk_jzdz where czrk_id = #{czrkId}
+    </delete>
+
     <delete id="deleteCzrkJzdzByIds" parameterType="String">
         delete from czrk_jzdz where id in 
         <foreach item="id" collection="array" open="(" separator="," close=")">

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

@@ -89,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
             <if test="deleteReason != null  and deleteReason != ''"> and delete_reason = #{deleteReason}</if>
             <if test="deptIdList != null and deptIdList.size() > 0">
-                and vi.dept_id in
+                and dept_id in
                 <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
                     #{deptId}
                 </foreach>
@@ -98,6 +98,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by create_time DESC
     </select>
 
+    <select id="listByRlryRel"  resultType="com.boman.domain.Czrk">
+        select czrk.id, czrk.user_name userName, czrk.phone_num phoneNum, czrk.id_card idCard, czrk.gender, czrk.province
+             , czrk.city, czrk.region, czrk.house_type houseType, czrk.update_by updateBy, czrk.code, czrk.rlr
+             , czrk.update_time updateTime, czrk.delete_reason deleteReason, czrk.now_in nowIn, jzdz.province provinceXjd
+             , jzdz.city cityXjd, jzdz.region regionXjd, jzdz.town villageTownsXjd, jzdz.village villageXjd, jzdz.now_in domicile
+        from czrk
+        left join czrk_jzdz jzdz on czrk.id = jzdz.id
+        <where>
+            <!-- 已认领 -->
+            <if test="isRl != null and isRl != ''">and czrk.is_rl = #{isRl}</if>
+
+            <if test="userName != null  and userName != ''">
+                and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
+            </if>
+            <if test="params.startAge != null  and params.startAge != ''">and czrk.age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''">and czrk.age &lt;= #{params.endAge}</if>
+            <if test="gender != null  and gender != ''"> and czrk.gender = #{gender}</if>
+            <if test="age != null "> and czrk.age = #{age}</if>
+            <if test="birthday != null "> and czrk.birthday = #{birthday}</if>
+            <if test="idCard != null  and idCard != ''"> and czrk.id_card = #{idCard}</if>
+            <if test="phoneNum != null  and phoneNum != ''"> and czrk.phone_num = #{phoneNum}</if>
+            <if test="code != null  and code != ''"> and czrk.code = #{code}</if>
+            <if test="houseType != null  and houseType != ''"> and czrk.house_type = #{houseType}</if>
+            <if test="rlr != null  and rlr != ''"> and czrk.rlr = #{rlr}</if>
+            <if test="rlTime != null "> and czrk.rl_time = #{rlTime}</if>
+            <if test="yhzgx != null  and yhzgx != ''"> and czrk.yhzgx = #{yhzgx}</if>
+            <if test="workUnit != null  and workUnit != ''"> and czrk.work_unit = #{workUnit}</if>
+            <if test="provinceId != null  and provinceId != ''"> and czrk.province_id = #{provinceId}</if>
+
+            <if test="provinceIdXjd != null  and provinceIdXjd != ''"> and jzdz.province_id = #{provinceId}</if>
+            <if test="cityIdXjd != null  and cityIdXjd != ''"> and jzdz.city_id = #{cityIdXjd}</if>
+            <if test="regionIdXjd != null  and regionIdXjd != ''"> and jzdz.region_id = #{regionIdXjd}</if>
+            <if test="villageTownsIdXjd != null  and villageTownsIdXjd != ''"> and jzdz.town_id = #{villageTownsIdXjd}</if>
+            <if test="villageIdXjd != null  and villageIdXjd != ''"> and jzdz.village_id = #{villageIdXjd}</if>
+
+            <if test="province != null  and province != ''"> and czrk.province = #{province}</if>
+            <if test="cityId != null  and cityId != ''"> and czrk.city_id = #{cityId}</if>
+            <if test="city != null  and city != ''"> and czrk.city = #{city}</if>
+            <if test="regionId != null  and regionId != ''"> and czrk.region_id = #{regionId}</if>
+            <if test="region != null  and region != ''"> and czrk.region = #{region}</if>
+            <if test="villageTownsId != null  and villageTownsId != ''"> and czrk.village_towns_id = #{villageTownsId}</if>
+            <if test="villageTowns != null  and villageTowns != ''"> and czrk.village_towns = #{villageTowns}</if>
+            <if test="villageId != null  and villageId != ''"> and czrk.village_id = #{villageId}</if>
+            <if test="village != null  and village != ''"> and czrk.village = #{village}</if>
+            <if test="villagerGroupId != null  and villagerGroupId != ''"> and czrk.villager_group_id = #{villagerGroupId}</if>
+            <if test="villagerGroup != null  and villagerGroup != ''"> and czrk.villager_group = #{villagerGroup}</if>
+            <if test="nowIn != null  and nowIn != ''"> and czrk.now_in = #{nowIn}</if>
+            <if test="status != null  and status != ''"> and czrk.status = #{status}</if>
+            <if test="isDel != null  and isDel != ''"> and czrk.is_del = #{isDel}</if>
+            <if test="deleteReason != null  and deleteReason != ''"> and czrk.delete_reason = #{deleteReason}</if>
+            <if test="deptIdList != null and deptIdList.size() > 0">
+                and czrk.dept_id in
+                <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                    #{deptId}
+                </foreach>
+            </if>
+        </where>
+        order by czrk.update_time DESC
+    </select>
+
     <select id="listByXz"  resultMap="CzrkResult">
         select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
         , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code