Procházet zdrojové kódy

fix 整体拆分PC页面查询/新增/修改接口,修复常住人口,户籍人口查询/人员认领列表,认领按钮接口,变更接口,异常人员列表接口,行政规划缺少晋中市

tjf před 3 roky
rodič
revize
7bbc508736
21 změnil soubory, kde provedl 743 přidání a 539 odebrání
  1. 7 8
      boman-api/boman-domain/src/main/java/com/boman/domain/Czrk.java
  2. 25 29
      boman-web-core/src/main/java/com/boman/web/core/controller/CzrkController.java
  3. 6 4
      boman-web-core/src/main/java/com/boman/web/core/controller/CzrkJzdzController.java
  4. 18 6
      boman-web-core/src/main/java/com/boman/web/core/controller/RyrlController.java
  5. 5 7
      boman-web-core/src/main/java/com/boman/web/core/controller/SysRegionController.java
  6. 22 24
      boman-web-core/src/main/java/com/boman/web/core/controller/TestController.java
  7. 3 3
      boman-web-core/src/main/java/com/boman/web/core/domain/SysRegion.java
  8. 5 2
      boman-web-core/src/main/java/com/boman/web/core/interceptor/ControllerTimeInterceptor.java
  9. 2 1
      boman-web-core/src/main/java/com/boman/web/core/interceptor/InterceptorConfig.java
  10. 2 0
      boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkJzdzMapper.java
  11. 40 15
      boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkMapper.java
  12. 50 2
      boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkJzdzServiceImpl.java
  13. 215 264
      boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java
  14. 16 0
      boman-web-core/src/main/java/com/boman/web/core/service/czrk/ICzrkJzdzService.java
  15. 13 14
      boman-web-core/src/main/java/com/boman/web/core/service/czrk/ICzrkService.java
  16. 180 0
      boman-web-core/src/main/java/com/boman/web/core/utils/CzrkUtils.java
  17. 3 2
      boman-web-core/src/main/resources/logback.xml
  18. 9 1
      boman-web-core/src/main/resources/mapper/CzrkJzdzMapper.xml
  19. 117 156
      boman-web-core/src/main/resources/mapper/CzrkMapper.xml
  20. 4 1
      boman-wechat/src/main/java/com/boman/wechat/controller/AppletLoginController.java
  21. 1 0
      boman-wechat/src/main/java/com/boman/wechat/utils/WxCodeSessionUtil.java

+ 7 - 8
boman-api/boman-domain/src/main/java/com/boman/domain/Czrk.java

@@ -6,7 +6,6 @@ import lombok.*;
 
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 常住人口对象 czrk
@@ -106,7 +105,7 @@ public class Czrk extends BaseEntity{
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "认领时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private java.sql.Date rlTime;
+    private Date rlTime;
 
     /**
      * 与户主关系
@@ -134,7 +133,7 @@ public class Czrk extends BaseEntity{
      * 户籍地的省份
      */
     @Excel(name = "户籍地的省份")
-    private Long provinceId;
+    private String provinceId;
 
     /**
      * 户籍地的省份
@@ -146,7 +145,7 @@ public class Czrk extends BaseEntity{
      * 户籍地的城市
      */
     @Excel(name = "户籍地的城市")
-    private Long cityId;
+    private String cityId;
 
     /**
      * 户籍地的城市
@@ -158,7 +157,7 @@ public class Czrk extends BaseEntity{
      * 户籍地的区
      */
     @Excel(name = "户籍地的区")
-    private Long regionId;
+    private String regionId;
 
     /**
      * 户籍地的区
@@ -170,7 +169,7 @@ public class Czrk extends BaseEntity{
      * 户籍地的镇
      */
     @Excel(name = "户籍地的镇")
-    private Long villageTownsId;
+    private String villageTownsId;
 
     /**
      * 户籍地的镇
@@ -182,7 +181,7 @@ public class Czrk extends BaseEntity{
      * 户籍地的村
      */
     @Excel(name = "户籍地的村")
-    private Long villageId;
+    private String villageId;
 
     /**
      * 户籍地的村
@@ -194,7 +193,7 @@ public class Czrk extends BaseEntity{
      * 户籍地的组
      */
     @Excel(name = "户籍地的组")
-    private Long villagerGroupId;
+    private String villagerGroupId;
 
     /**
      * 户籍地的组

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

@@ -41,10 +41,19 @@ public class CzrkController extends BaseController {
     public TableDataInfo list(Czrk czrk) {
         startPage();
         List<Czrk> list = czrkService.listByCzrk(czrk);
-        //List<Czrk> list = czrkService.listByRlry(czrk);
         return getDataTable(list);
     }
 
+    /**
+     * 2022/3/24修改的根据czrkId查询该用户信息
+     * @param id id
+     * @return com.boman.domain.dto.AjaxResult
+     */
+    @GetMapping("/getById/{id}")
+    public AjaxResult getById(@PathVariable Long id) {
+        return AjaxResult.success("成功", czrkService.getById(id));
+    }
+
     @GetMapping("/listByXz")
     public TableDataInfo listByXz(Czrk czrk) {
         List<Czrk> list = czrkService.listByXz(czrk);
@@ -57,18 +66,6 @@ public class CzrkController extends BaseController {
         return getDataTable(list);
     }
 
-    /**
-     * 导出常住人口列表
-     */
-//    @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, "常住人口数据");
-//    }
-
     /**
      * 获取常住人口详细信息
      */
@@ -88,23 +85,22 @@ public class CzrkController extends BaseController {
     }
 
     /**
-     * 新增常住人口
+     * 2022/3/24修改的PC人员信息新增人员接口
+     * 新增户籍人口
      */
-//    @PreAuthorize("@ss.hasPermi('system:czrk:add')")
-    @Log(title = "常住人口", businessType = BusinessType.INSERT)
-    @PostMapping
+    @Log(title = "户籍人口", businessType = BusinessType.INSERT)
+    @PostMapping("/addCzrk")
     public AjaxResult add(@RequestBody Czrk czrk) {
-        return toAjax(czrkService.insertCzrk(czrk));
+        return czrkService.insertCzrk(czrk);
     }
 
     /**
-     * 修改常住人口
+     * 修改户籍人口/修改并确认
      */
-//    @PreAuthorize("@ss.hasPermi('system:czrk:edit')")
-    @Log(title = "常住人口", businessType = BusinessType.UPDATE)
-    @PutMapping
+    @Log(title = "户籍人口", businessType = BusinessType.UPDATE)
+    @PostMapping("/editCzrk")
     public AjaxResult edit(@RequestBody Czrk czrk) {
-        return toAjax(czrkService.updateCzrk(czrk));
+        return czrkService.updateCzrk(czrk);
     }
 
     /**
@@ -177,24 +173,23 @@ public class CzrkController extends BaseController {
      * @return
      */
     @Log(title = "变更接口", businessType = BusinessType.UPDATE)
-    @GetMapping("/changeCzrk")
-    public AjaxResult changeCzrk(Czrk czrk) {
+    @PostMapping("/changeCzrk")
+    public AjaxResult changeCzrk(@RequestBody Czrk czrk) {
         return czrkService.changeCzrk(czrk);
     }
 
     /**
      * 查询非正常人员列表(死亡,失踪)
      */
-
-    @GetMapping("/unusualList")
-    public TableDataInfo unusualList(Czrk czrk) {
+    @PostMapping("/unusualList")
+    public TableDataInfo unusualList(@RequestBody Czrk czrk) {
         startPage();
         List<Czrk> list = czrkService.unusualList(czrk);
         return getDataTable(list);
     }
 
     /**
-     * 外部访问czrk的字段
+     * 外部访问czrk的字段 史前写
      */
     @GetMapping("/open/getInfo")
     public AjaxResult getInfo(String appKey, String appSecret, String idCard) {
@@ -202,6 +197,7 @@ public class CzrkController extends BaseController {
     }
 
     /**
+     * 暂未测试
      * 外部访问czrk的字段
      * RSE加密请求
      */

+ 6 - 4
boman-web-core/src/main/java/com/boman/web/core/controller/CzrkJzdzController.java

@@ -4,6 +4,7 @@ import com.boman.common.core.utils.poi.ExcelUtil;
 import com.boman.common.core.web.controller.BaseController;
 import com.boman.common.log.annotation.Log;
 import com.boman.common.log.enums.BusinessType;
+import com.boman.domain.Czrk;
 import com.boman.domain.CzrkJzdz;
 import com.boman.domain.TableDataInfo;
 import com.boman.domain.dto.AjaxResult;
@@ -22,19 +23,20 @@ import java.util.List;
  * @date 2022-01-14
  */
 @RestController
-@RequestMapping("/system/jzdz")
+@RequestMapping("/core/jzdz")
 public class CzrkJzdzController extends BaseController {
     @Autowired
     private ICzrkJzdzService czrkJzdzService;
 
     /**
-     * 查询常住人口对应的居住地址列表
+     * 人员信息中查询常住人口
+     * 2022/3/23重新修复的PC人员信息查看常住人口接口
      */
 //    @PreAuthorize("@ss.hasPermi('system:jzdz:list')")
     @GetMapping("/list")
-    public TableDataInfo list(CzrkJzdz czrkJzdz) {
+    public TableDataInfo list(Czrk czrk) {
         startPage();
-        List<CzrkJzdz> list = czrkJzdzService.selectCzrkJzdzList(czrkJzdz);
+        List<Czrk> list = czrkJzdzService.listByCzrkJzdz(czrk);
         return getDataTable(list);
     }
 

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

@@ -26,14 +26,26 @@ public class RyrlController extends BaseController {
     private ICzrkService czrkService;
 
     /**
-     * 功能描述: 认领人员list, 如果isDel="Y", 则为回收站的功能,默认是isDel="N"
-     *
+     * 功能描述: 户籍认领人员list
+     *2022/3/24修复户籍人员认领接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
+     * @param czrk czrk
+     * @return com.boman.domain.TableDataInfo
+     */
+    @GetMapping("/listHj")
+    public TableDataInfo listHj(Czrk czrk) {
+        List<Czrk> list = czrkService.listByRlryHj(czrk);
+        return getDataTable(list);
+    }
+
+    /**
+     * 功能描述: 常住认领人员list
+     *2022/3/24修复常住人员认领接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
      * @param czrk czrk
      * @return com.boman.domain.TableDataInfo
      */
-    @GetMapping("/list")
-    public TableDataInfo list(Czrk czrk) {
-        List<Czrk> list = czrkService.listByRlry(czrk);
+    @GetMapping("/listCz")
+    public TableDataInfo listCz(Czrk czrk) {
+        List<Czrk> list = czrkService.listByRlryCz(czrk);
         return getDataTable(list);
     }
 
@@ -49,7 +61,7 @@ public class RyrlController extends BaseController {
     }
 
     /**
-     * 功能描述: 修改 也即 由未认领到认领
+     * 功能描述: 人员认领菜单中认领接口
      *
      * @param czrk czrk
      * @return com.boman.domain.dto.AjaxResult

+ 5 - 7
boman-web-core/src/main/java/com/boman/web/core/controller/SysRegionController.java

@@ -37,7 +37,7 @@ public class SysRegionController {
     private SysRegionMapper sysRegionMapper;
 
 
-    //@PostMapping("/insert")
+    @PostMapping("/insert")
     public void insertSysRegion() throws IOException {
 
         System.out.println("开始爬取");
@@ -56,8 +56,8 @@ public class SysRegionController {
                 String href = a.attr("href");     // 11.html
                 String name = a.text();           // 浙江省
 
-                Long id = 1L;
-                if ("北京市".equals(name)) {
+                Long id = 4L;
+                if ("山西省".equals(name)) {
 /*                    SysRegion region = new SysRegion();
                     region.setId(id);
                     region.setPid(0L);
@@ -110,7 +110,7 @@ public class SysRegionController {
             String name = nametd.select("a").text();        // 衢州市
             System.out.println("开始爬取" + name);
 
-        /*    if ( "安阳市".equals(name)|| "鹤壁市".equals(name)|| "新乡市".equals(name)||"焦作市".equals(name)) {*/
+            if ( "晋中市".equals(name)) {
                 SysRegion region = new SysRegion();
                 region.setId(Long.valueOf(code));
                 region.setPid(String.valueOf(i));
@@ -122,7 +122,7 @@ public class SysRegionController {
                 region.setSort(sort);
                 //regions.add(region);
                 getQu(href, code);
-           /* }*/
+            }
         }
     }
 
@@ -149,7 +149,6 @@ public class SysRegionController {
                 String href = codetd.select("a").attr("href");  // 02/330281.html
                 String code = codetd.select("a").text();        // 330281000000
                 String name = nametd.select("a").text();        // 余姚市
-                if ("东城区".equals(name)){
                     System.out.println("开始爬取" + name);
 
                     SysRegion region = new SysRegion();
@@ -165,7 +164,6 @@ public class SysRegionController {
                     region.setSort(sort);
                     regions.add(region);
                     getJiedao(href, code);
-                }
             }
         }
     }

+ 22 - 24
boman-web-core/src/main/java/com/boman/web/core/controller/TestController.java

@@ -62,15 +62,15 @@ public class TestController {
                     String nowIn = czrk.getNowIn();
                     if (com.boman.common.core.utils.StringUtils.isNotBlank(nowIn)){
                         czrk.setProvince("安徽省");
-                        czrk.setProvinceId(12L);
+                        czrk.setProvinceId("12");
                         czrk.setCity("安庆市");
-                        czrk.setCityId(340800000000L);
-                        czrk.setRegionId(340882000000L);
+                        czrk.setCityId("340800000000");
+                        czrk.setRegionId("340882000000");
                         czrk.setRegion("潜山市");
                         //判断有没有详细地址
                         if (nowIn.contains("梅城镇")){
                             czrk.setVillageTowns("梅城镇");
-                            czrk.setVillageTownsId(340882100000L);
+                            czrk.setVillageTownsId("340882100000");
                         }else {
                             Map<String, String> addressResolutionMap = addressResolutionMap(nowIn);
                             System.out.println(addressResolutionMap);
@@ -88,8 +88,8 @@ public class TestController {
                                     for (SysRegion sysRegion : sysRegions) {
                                         if (sysRegion != null) {
                                             String pid = sysRegion.getPid();
-                                            Long regionId = czrk.getRegionId();
-                                            if (regionId != null && String.valueOf(regionId).equals(pid)) {
+                                            String regionId = czrk.getRegionId();
+                                            if (regionId != null && regionId.equals(pid)) {
                                                 //说明是这个镇
                                                 czrk.setVillageTowns(sysRegion.getName());
                                                 czrk.setVillageTownsId(sysRegion.getAreaId());
@@ -111,8 +111,8 @@ public class TestController {
                                         for (SysRegion sysRegion : sysRegionsVillage) {
                                             if (sysRegion != null) {
                                                 String pid = sysRegion.getPid();
-                                                Long villageTownsId = czrk.getVillageTownsId();
-                                                if (villageTownsId != null && String.valueOf(villageTownsId).equals(pid)) {
+                                                String villageTownsId = czrk.getVillageTownsId();
+                                                if (villageTownsId != null && villageTownsId.equals(pid)) {
                                                     //说明是这个镇下面的村
                                                     czrk.setVillage(sysRegion.getName());
                                                     czrk.setVillageId(sysRegion.getAreaId());
@@ -228,7 +228,7 @@ public class TestController {
                                 if (sysRegions.size() > 1) {
                                     for (SysRegion sysRegion : sysRegions) {
                                         if (sysRegion != null) {
-                                            Long villageTownsId = czrk.getVillageTownsId();
+                                            String villageTownsId = czrk.getVillageTownsId();
                                             if (villageTownsId != null && villageTownsId.equals(sysRegion.getPid())) {
                                                 czrk.setVillageId(sysRegion.getAreaId());
                                                 czrk.setVillage(villager);
@@ -398,7 +398,7 @@ public class TestController {
                                     for (SysRegion sysRegion : sysRegions) {
                                         if (sysRegion != null) {
                                             String pid = sysRegion.getPid();
-                                            Long villageTownsId = czrk.getVillageTownsId();
+                                            String villageTownsId = czrk.getVillageTownsId();
                                             if (villageTownsId != null && String.valueOf(villageTownsId).equals(pid)) {
                                                 //说明是这个镇下面的村
                                                 czrk.setVillage(sysRegion.getName());
@@ -438,8 +438,8 @@ public class TestController {
                                                         for (SysRegion sysRegion : sysRegions) {
                                                             if (sysRegion != null) {
                                                                 String pid = sysRegion.getPid();
-                                                                Long villageTownsId = czrk.getVillageTownsId();
-                                                                if (villageTownsId != null && String.valueOf(villageTownsId).equals(pid)) {
+                                                                String villageTownsId = czrk.getVillageTownsId();
+                                                                if (villageTownsId != null && villageTownsId.equals(pid)) {
                                                                     //说明是这个镇下面的村
                                                                     czrk.setVillage(sysRegion.getName());
                                                                     czrk.setVillageId(sysRegion.getAreaId());
@@ -468,8 +468,8 @@ public class TestController {
                                                 for (SysRegion sysRegion : sysRegions) {
                                                     if (sysRegion != null) {
                                                         String pid = sysRegion.getPid();
-                                                        Long villageTownsId = czrk.getVillageTownsId();
-                                                        if (villageTownsId != null && String.valueOf(villageTownsId).equals(pid)) {
+                                                        String villageTownsId = czrk.getVillageTownsId();
+                                                        if (villageTownsId != null && villageTownsId.equals(pid)) {
                                                             //说明是这个镇下面的村
                                                             czrk.setVillage(sysRegion.getName());
                                                             czrk.setVillageId(sysRegion.getAreaId());
@@ -478,8 +478,6 @@ public class TestController {
                                                 }
                                             }
                                         }
-
-
                                     }
                                 }
                             }
@@ -487,7 +485,7 @@ public class TestController {
 
                         //村名称
                         String village = czrk.getVillage();
-                        Long villageId = czrk.getVillageId();
+                        String villageId = czrk.getVillageId();
                         String idCard = czrk.getIdCard();
                         if (StringUtils.isNotBlank(village)) {
                             Czrk czrkNew = new Czrk();
@@ -548,7 +546,7 @@ public class TestController {
                                         SysRegion sysRegion = sysRegions.get(0);
                                         if (sysRegion != null) {
                                             String name = sysRegion.getName();
-                                            Long areaId = sysRegion.getAreaId();
+                                            String areaId = sysRegion.getAreaId();
                                             czrkJzdz.setTown(name);
                                             czrkJzdz.setTownId(String.valueOf(areaId));
                                         }
@@ -558,9 +556,9 @@ public class TestController {
                                             String pid = sysRegion.getPid();
                                             if ("340882000000".equals(pid)) {
                                                 String name = sysRegion.getName();
-                                                Long areaId = sysRegion.getAreaId();
+                                                String areaId = sysRegion.getAreaId();
                                                 czrkJzdz.setTown(name);
-                                                czrkJzdz.setTownId(String.valueOf(areaId));
+                                                czrkJzdz.setTownId(areaId);
                                             }
                                         }
                                     }
@@ -574,9 +572,9 @@ public class TestController {
                                         SysRegion sysRegion = sysRegions.get(0);
                                         if (sysRegion != null) {
                                             String name = sysRegion.getName();
-                                            Long areaId = sysRegion.getAreaId();
+                                            String areaId = sysRegion.getAreaId();
                                             czrkJzdz.setVillage(name);
-                                            czrkJzdz.setVillageId(String.valueOf(areaId));
+                                            czrkJzdz.setVillageId(areaId);
                                         }
                                     }
                                     if (sysRegions.size() > 1) {
@@ -584,9 +582,9 @@ public class TestController {
                                             String pid = sysRegion.getPid();
                                             if (String.valueOf(czrkJzdz.getTownId()).equals(pid)) {
                                                 String name = sysRegion.getName();
-                                                Long areaId = sysRegion.getAreaId();
+                                                String areaId = sysRegion.getAreaId();
                                                 czrkJzdz.setVillage(name);
-                                                czrkJzdz.setVillageId(String.valueOf(areaId));
+                                                czrkJzdz.setVillageId(areaId);
                                             }
                                         }
                                     }

+ 3 - 3
boman-web-core/src/main/java/com/boman/web/core/domain/SysRegion.java

@@ -18,7 +18,7 @@ public class SysRegion implements Serializable {
     /**
      * 数据库字段id
      */
-    private Long areaId;
+    private String areaId;
 
     /**
      * 上级ID,一级为0
@@ -50,11 +50,11 @@ public class SysRegion implements Serializable {
 
     private Long sort;
 
-    public Long getAreaId() {
+    public String getAreaId() {
         return areaId;
     }
 
-    public void setAreaId(Long areaId) {
+    public void setAreaId(String areaId) {
         this.areaId = areaId;
     }
 

+ 5 - 2
boman-web-core/src/main/java/com/boman/web/core/interceptor/ControllerTimeInterceptor.java

@@ -37,8 +37,11 @@ public class ControllerTimeInterceptor implements HandlerInterceptor {
         sb.append("URL       : ").append(url).append("\n");
         // 打印请求参数
         if (isJsonRequest(httpServletRequest)) {
-            String jsonParam = JSONObject.toJSONString(httpServletRequest.getParameterMap());
-            LOGGER.info("[**]开始请求 => URL[{}],参数类型[json],参数:[{}]", url, jsonParam);
+            Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
+            if (parameterMap !=null && parameterMap.size() > 0) {
+                String jsonParam = JSONObject.toJSONString(parameterMap);
+                LOGGER.info("[**]开始请求 => URL[{}],参数类型[json],参数:[{}]", url, jsonParam);
+            }
         } else {
             Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
             if (parameterMap !=null && parameterMap.size() > 0) {

+ 2 - 1
boman-web-core/src/main/java/com/boman/web/core/interceptor/InterceptorConfig.java

@@ -16,7 +16,8 @@ public class InterceptorConfig implements WebMvcConfigurer {
     public void addInterceptors(InterceptorRegistry interceptorRegistry) {
         InterceptorRegistration registration=interceptorRegistry.addInterceptor(new ControllerTimeInterceptor());
         // 此处添加拦截策略 /**表示全部拦截
-        registration.addPathPatterns("/**");
+        registration.addPathPatterns("/core/ryrl/**");
+        registration.addPathPatterns("/applet/**");
     }
 
 }

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

@@ -66,6 +66,8 @@ import java.util.List;
 
     List<CzrkJzdz> listByIdCard(@Param("idCardList") List<String> idCardList);
 
+    List<CzrkJzdz> listByCzrkIds(@Param("czrkIds") List<Long> czrkIds);
+
     List<CzrkJzdz> listByCzrkId(@Param("czrkId") Long czrkId);
 
     List<Long> listCzrkIdByTypeAreaIdUserName(@Param("type") int type, @Param("areaId") Long areaId, @Param("userName") String userName);

+ 40 - 15
boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkMapper.java

@@ -19,7 +19,7 @@ import java.util.List;
  */
 public interface CzrkMapper {
     /**
-     * 查询常住人口
+     * 查询czkr表人口
      *
      * @param id 常住人口主键
      * @return 常住人口
@@ -28,14 +28,6 @@ public interface CzrkMapper {
     List<Czrk> selectCzrkByIds(@Param("ids") List<Long> ids);
     int countIdCard(String idCard);
 
-    /**
-     * 查询常住人口列表
-     *
-     * @param czrk 常住人口
-     * @return 常住人口集合
-     */
-    List<Czrk> selectCzrkList(Czrk czrk);
-
     /**
      * 根据户主号查看是否有户主
      * @param code
@@ -44,17 +36,17 @@ public interface CzrkMapper {
     Czrk  selectCzrkByCode(String code);
 
     /**
-     * 新增常住人口
+     * 新增户籍人口
      *
-     * @param czrk 常住人口
+     * @param czrk 户籍人口
      * @return 结果
      */
     int insertCzrk(Czrk czrk);
 
     /**
-     * 修改常住人口
+     * 修改户籍人口
      *
-     * @param czrk 常住人口
+     * @param czrk 户籍人口
      * @return 结果
      */
     int updateCzrk(Czrk czrk);
@@ -73,9 +65,20 @@ public interface CzrkMapper {
 //    int deleteCzrk(Long[] ids);
     int deleteCzrk(Czrk czrk);
 
-    List<Czrk> listByRlry(Czrk czrk);
+    /**
+     * 查询户籍人口列表
+     * @param czrk
+     * @return
+     */
+    List<Czrk> listByCzrk(Czrk czrk);
+
+    /**
+     * 查询户籍人口列表,查询条件带居住地址
+     * @param czrk
+     * @return
+     */
+    List<Czrk> listCzrkByJzdz(Czrk czrk);
 
-    List<Czrk> listByRlryJzdz(Czrk czrk);
     List<Czrk> listByRlryRel(Czrk czrk);
 
     List<Czrk> listByXz(Czrk czrk);
@@ -140,6 +143,7 @@ public interface CzrkMapper {
     int countByCzJs1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deptIdList") List<Long> deptIdList);
     List<Czrk> listByCzJs1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deptIdList") List<Long> deptIdList);
 
+    //根据户籍号查询户主的信息
     Czrk getHzByCode(String code);
 
     JSONObject getColumnNamesByIdCard(@Param("columnNames") String columnNames, @Param("idCard") String idCard);
@@ -181,4 +185,25 @@ public interface CzrkMapper {
      * @return
      */
     List<Czrk> unusualList(Czrk czrk);
+
+    /**
+     * 2022/3/23重新修复的PC人员信息查看户籍人口接口
+     * @param czrk
+     * @return
+     */
+    List<Czrk> listByCzrkJzdz(Czrk czrk);
+
+    /**
+     * 2022/3/24修复人员认领接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
+     * @param czrk
+     * @return
+     */
+    List<Czrk> selectCzrkByNotRl(Czrk czrk);
+
+    /**
+     * 2022/3/24修复常住人员认领接口列表
+     * @param czrk
+     * @return
+     */
+    List<Czrk> selectCzrkByNotRlCz(Czrk czrk);
 }

+ 50 - 2
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkJzdzServiceImpl.java

@@ -1,14 +1,25 @@
 package com.boman.web.core.service.czrk;
 
+import com.alibaba.fastjson.JSON;
+import com.boman.common.core.utils.DateUtils;
+import com.boman.common.core.utils.StringUtils;
+import com.boman.domain.Czrk;
 import com.boman.domain.CzrkJzdz;
+import com.boman.domain.SysUser;
 import com.boman.web.core.mapper.CzrkJzdzMapper;
+import com.boman.web.core.mapper.CzrkMapper;
+import com.boman.web.core.utils.AuthUtils;
+import com.boman.web.core.utils.CzrkUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.Collections;
 import java.util.List;
 
 import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
+import static com.boman.web.core.utils.CzrkUtils.*;
 
 /**
  * 常住人口对应的居住地址Service业务层处理
@@ -17,11 +28,15 @@ import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
  * @date 2022-01-14
  */
 @Service
+@Slf4j
 public class CzrkJzdzServiceImpl implements ICzrkJzdzService {
 
     @Autowired
     private CzrkJzdzMapper czrkJzdzMapper;
 
+    @Resource
+    private CzrkMapper czrkMapper;
+
     /**
      * 查询常住人口对应的居住地址
      *
@@ -107,6 +122,15 @@ public class CzrkJzdzServiceImpl implements ICzrkJzdzService {
         return czrkJzdzMapper.listByIdCard(idCardList);
     }
 
+    @Override
+    public List<CzrkJzdz> listByCzrkIds(List<Long> czrkIds) {
+        if (isEmpty(czrkIds)) {
+            return Collections.emptyList();
+        }
+
+        return czrkJzdzMapper.listByCzrkIds(czrkIds);
+    }
+
     @Override
     public List<Long> listCzrkIdByTypeAreaIdUserName(int type, Long areaId, String userName) {
         return czrkJzdzMapper.listCzrkIdByTypeAreaIdUserName(type, areaId, userName);
@@ -124,8 +148,8 @@ public class CzrkJzdzServiceImpl implements ICzrkJzdzService {
     }
 
     @Override
-    public int updateHouseholdRegister(List<String> idCardList,CzrkJzdz hzCzrkJzdz) {
-        return czrkJzdzMapper.updateHouseholdRegister(idCardList,hzCzrkJzdz);
+    public int updateHouseholdRegister(List<String> idCardList, CzrkJzdz hzCzrkJzdz) {
+        return czrkJzdzMapper.updateHouseholdRegister(idCardList, hzCzrkJzdz);
     }
 
     @Override
@@ -138,8 +162,32 @@ public class CzrkJzdzServiceImpl implements ICzrkJzdzService {
         return czrkJzdzMapper.selectCzrkJzdzListByRegionId(regionId);
     }
 
+    /**
+     * 2022/3/23重新修复的PC人员信息查看常住人口接口
+     *
+     * @param czrk
+     * @return
+     */
+    @Override
+    public List<Czrk> listByCzrkJzdz(Czrk czrk) {
+        //todo 获取行政区域id和人员角色,来进行判断查询字段
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}查询常住人员列表,查询条件:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+        setAgeScope(czrk);
+        //当前用户只能看到居住地址在当前的人员
+        setQueryRole(czrk,sysUser,Czrk.CZ);
+        long startTimeSql = System.currentTimeMillis();
+        List<Czrk> czrks = czrkMapper.listByCzrkJzdz(czrk);
+        long endTimeSql = System.currentTimeMillis() - startTimeSql;
+        log.info("执行查询人员信息中常住人员的sql语句时间:" + endTimeSql + "ms");
+        packAddr(czrks);
+        return czrks;
+    }
+
     /**
      * 根据czrdId查询对应的居住地址
+     *
      * @param czrkId
      * @return
      */

+ 215 - 264
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -2,9 +2,7 @@ package com.boman.web.core.service.czrk;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.TypeReference;
 import com.boman.common.core.utils.DateUtils;
-import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.StringUtils;
 import com.boman.common.core.utils.constant.HttpStatus;
 import com.boman.common.core.utils.ip.IpUtils;
@@ -27,16 +25,11 @@ import com.boman.web.core.mapper.CzrkChangeMapper;
 import com.boman.web.core.mapper.CzrkMapper;
 import com.boman.web.core.mapper.GridInfoMapper;
 import com.boman.web.core.service.ip.IpTimesService;
-import com.boman.web.core.service.ip.IpTimesServiceImpl;
-import com.boman.web.core.utils.AESUtil;
-import com.boman.web.core.utils.AuthUtils;
-import com.boman.web.core.utils.IdCardUtils;
-import com.boman.web.core.utils.RSAUtil;
+import com.boman.web.core.utils.*;
 import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.tomcat.util.buf.HexUtils;
-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;
@@ -45,20 +38,17 @@ import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
 import javax.annotation.Resource;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Size;
 import java.sql.Date;
 import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 import static com.boman.common.core.utils.StringUtils.isNotEmpty;
 import static com.boman.common.core.utils.fieldTranslator.IdCardUtils.getSex;
 import static com.boman.common.core.utils.obj.ObjectUtils.*;
 import static com.boman.common.redis.RedisKey.*;
+import static com.boman.web.core.utils.CzrkUtils.*;
 import static com.boman.web.core.utils.IdCardUtils.getAge;
 import static com.google.common.base.Strings.nullToEmpty;
 
@@ -94,98 +84,38 @@ public class CzrkServiceImpl implements ICzrkService {
     private TokenService tokenService;
 
     /**
-     * 功能描述: 市领导查询,deptId不起作用,具体到村,需要czrk的villageId有值就可以,只是villageId起作用
-     * 镇及以下,查询,villageId和deptIdList同时起作用
+     * 2022/3/24修复人员认领接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
      *
      * @param czrk
      * @return java.util.List<com.boman.domain.Czrk>
      */
     @Override
-    public List<Czrk> listByRlry(Czrk czrk) {
-        log.info("{}于{}查询常住人员列表,查询条件:{}"
-                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+    public List<Czrk> listByRlryHj(Czrk czrk) {
+        //2022/3/24修复人员认领接口列表,等需要上线后开放
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}查询待认领人员列表,查询条件:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+        //拆分搜索接口中年龄字段
         setAgeScope(czrk);
-        //获取到居住地的查询条件
-        String provinceId = czrk.getProvinceIdXjd();
-        String cityId = czrk.getCityIdXjd();
-        String regionId = czrk.getRegionIdXjd();
-        String villageTownsId = czrk.getVillageTownsIdXjd();
-        String villageId = czrk.getVillageIdXjd();
-        // 去查jzdz表
-        if (Czrk.CZ.equals(czrk.getQueryType())) {
-            CzrkJzdz czrkJzdz = new CzrkJzdz();
-            Long deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
-            //判断是否是管理员
-            List<SysRole> roles = AuthUtils.getLoginUser().getSysUser().getRoles();
-            boolean flag = true;
-            if (isNotEmpty(roles)) {
-                for (SysRole role : roles) {
-                    String roleKey = role.getRoleKey();
-                    if ("admin".equals(roleKey) || "city".equals(roleKey) || "yanshi".equals(roleKey)) {
-                        flag = false;
-                    }
-                }
-            }
-            if (deptId != null && flag) {
-                //设置查询列表权限
-                List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
-                if (isNotEmpty(sysDepts)) {
-                    czrkJzdz.setDeptIdList(map(sysDepts, SysDept::getId));
-                }
-            }
-            List<Czrk> czrks = null;
-            if (StringUtils.isNotBlank(provinceId) || StringUtils.isNotBlank(cityId) || StringUtils.isNotBlank(regionId) || StringUtils.isNotBlank(villageTownsId) || StringUtils.isNotBlank(villageId)) {
-                czrkJzdz.setProvinceId(provinceId);
-                czrkJzdz.setCityId(cityId);
-                czrkJzdz.setRegionId(regionId);
-                czrkJzdz.setTownId(villageTownsId);
-                czrkJzdz.setVillageId(villageId);
-            } else {
-                //固定查询潜山市
-                czrkJzdz.setRegionId("340882000000");
-            }
+        List<Czrk> czrkNotRl = czrkMapper.selectCzrkByNotRl(czrk);
+        return czrkNotRl;
+    }
 
-            //先去查询居住地址在潜山的人员身份证
-            startPage();
-            long startTimeSql = System.currentTimeMillis();
-            //todo 这个sql可能会慢需要检查原因
-            czrks = czrkMapper.selectCzrkList(czrk);
-            long endTimeSql = System.currentTimeMillis() - startTimeSql;
-            log.info("执行常驻查询sql语句时间:" + endTimeSql + "ms");
-            if (czrks != null && czrks.size() > 0) {
-                for (Czrk crk : czrks) {
-                    String provinceCz = nullToEmpty(crk.getProvince()), cityCz = nullToEmpty(crk.getCity()), regionCz = nullToEmpty(crk.getRegion()), villageTownsCz = nullToEmpty(crk.getVillageTowns()), villageCz = nullToEmpty(crk.getVillage()), nowInCz = nullToEmpty(crk.getNowIn());
-                    crk.setNowInSelect(provinceCz + cityCz + regionCz + villageTownsCz + villageCz);
-                }
-            }
-            return czrks;
-        }
-        //设置查询列表权限
-        setDeptIdList(czrk);
-        startPage();
-        if (StringUtils.isNotBlank(provinceId) || StringUtils.isNotBlank(cityId) || StringUtils.isNotBlank(regionId) || StringUtils.isNotBlank(villageTownsId) || StringUtils.isNotBlank(villageId)) {
-            CzrkJzdz czrkJzdz = new CzrkJzdz();
-            czrkJzdz.setProvinceId(provinceId);
-            czrkJzdz.setCityId(cityId);
-            czrkJzdz.setRegionId(regionId);
-            czrkJzdz.setTownId(villageTownsId);
-            czrkJzdz.setVillageId(villageId);
-            czrk.setCzrkJzdz(czrkJzdz);
-            long startTimeSql = System.currentTimeMillis();
-            List<Czrk> czrks = czrkMapper.listByRlryJzdz(czrk);
-            long endTimeSql = System.currentTimeMillis() - startTimeSql;
-            log.info("执行查询居住地址的sql语句时间:" + endTimeSql + "ms");
-            packAddr(czrks);
-            return czrks;
-/*            List<String> idCardList = czrkJzdzService.listIdCard(czrkJzdz);
-            czrk.setIdCardList(idCardList);*/
-        }
-        long startTimeSql = System.currentTimeMillis();
-        List<Czrk> czrks = czrkMapper.listByRlry(czrk);
-        long endTimeSql = System.currentTimeMillis() - startTimeSql;
-        log.info("执行查询sql语句时间:" + endTimeSql + "ms");
-        packAddr(czrks);
-        return czrks;
+    /**
+     * 2022/3/24修复人员认领中常住人员接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
+     * @param czrk
+     * @return
+     */
+    @Override
+    public List<Czrk> listByRlryCz(Czrk czrk) {
+        //2022/3/24修复人员认领接口列表,等需要上线后开放
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}查询常住待认领人员列表,查询条件:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+        //拆分搜索接口中年龄字段
+        setAgeScope(czrk);
+        List<Czrk> czrkNotRl = czrkMapper.selectCzrkByNotRlCz(czrk);
+        return czrkNotRl;
     }
 
     /**
@@ -194,8 +124,9 @@ public class CzrkServiceImpl implements ICzrkService {
      */
     @Override
     public List<Czrk> listByCzrk(Czrk czrk) {
-        log.info("{}于{}查询常住人员列表,查询条件:{}"
-                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}查询户籍人员列表,查询条件:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         setAgeScope(czrk);
         //获取到居住地的查询条件
         String provinceId = czrk.getProvinceIdXjd();
@@ -203,30 +134,23 @@ public class CzrkServiceImpl implements ICzrkService {
         String regionId = czrk.getRegionIdXjd();
         String villageTownsId = czrk.getVillageTownsIdXjd();
         String villageId = czrk.getVillageIdXjd();
-        //设置查询列表权限,todo 后期修改不进行dept_id in 的操作
-        setDeptIdList(czrk);
+        //设置查询列表权限
+        setQueryRole(czrk,sysUser,Czrk.HJ);
         //如果查询参数有居住地址,进行连表查询
         if (StringUtils.isNotBlank(provinceId) || StringUtils.isNotBlank(cityId) || StringUtils.isNotBlank(regionId) || StringUtils.isNotBlank(villageTownsId) || StringUtils.isNotBlank(villageId)) {
-            CzrkJzdz czrkJzdz = new CzrkJzdz();
-            czrkJzdz.setProvinceId(provinceId);
-            czrkJzdz.setCityId(cityId);
-            czrkJzdz.setRegionId(regionId);
-            czrkJzdz.setTownId(villageTownsId);
-            czrkJzdz.setVillageId(villageId);
-            czrk.setCzrkJzdz(czrkJzdz);
             long startTimeSql = System.currentTimeMillis();
-            List<Czrk> czrks = czrkMapper.listByRlryJzdz(czrk);
+            List<Czrk> czrks = czrkMapper.listCzrkByJzdz(czrk);
             long endTimeSql = System.currentTimeMillis() - startTimeSql;
             log.info("执行查询人员信息中包含居住地址的sql语句时间:" + endTimeSql + "ms");
-            packAddr(czrks);
+            CzrkUtils.packAddr(czrks);
             return czrks;
         }
         long startTimeSql = System.currentTimeMillis();
         //没有搜索居住地址的条件,进行单表查询
-        List<Czrk> czrks = czrkMapper.listByRlry(czrk);
+        List<Czrk> czrks = czrkMapper.listByCzrk(czrk);
         long endTimeSql = System.currentTimeMillis() - startTimeSql;
         log.info("执行查询sql语句时间:" + endTimeSql + "ms");
-        packAddr(czrks);
+        CzrkUtils.packAddr(czrks);
         return czrks;
     }
 
@@ -238,40 +162,32 @@ public class CzrkServiceImpl implements ICzrkService {
      */
     @Override
     public List<Czrk> unusualList(Czrk czrk) {
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}查询非正常人员人员列表,查询条件:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         setAgeScope(czrk);
-        //获取到居住地的查询条件
-        String provinceId = czrk.getProvinceIdXjd();
-        String cityId = czrk.getCityIdXjd();
-        String regionId = czrk.getRegionIdXjd();
-        String villageTownsId = czrk.getVillageTownsIdXjd();
-        String villageId = czrk.getVillageIdXjd();
-        CzrkJzdz czrkJzdz = new CzrkJzdz();
-        czrkJzdz.setProvinceId(provinceId);
-        czrkJzdz.setCityId(cityId);
-        czrkJzdz.setRegionId(regionId);
-        czrkJzdz.setTownId(villageTownsId);
-        czrkJzdz.setVillageId(villageId);
-        czrk.setCzrkJzdz(czrkJzdz);
-        //设置查询列表权限
-        setDeptIdList(czrk);
+
+        //设置权限
+        setQueryRole(czrk,sysUser,Czrk.HJ);
         startPage();
         long startTimeSql = System.currentTimeMillis();
-        //todo 重新写个接口查询状态值 != 1的数据
         List<Czrk> czrks = czrkMapper.unusualList(czrk);
         long endTimeSql = System.currentTimeMillis() - startTimeSql;
         log.info("执行查询异常人员sql语句时间:" + endTimeSql + "ms");
-        packAddr(czrks);
+        CzrkUtils.packAddr(czrks);
         return czrks;
     }
 
+    /**
+     * 查看家庭成员,获取居住地址,根据czrkId查询
+     *
+     * @param czrks
+     * @return
+     */
     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);
-//        }
-
+        List<Long> czrkIdList = map(czrks, Czrk::getId);
+        List<CzrkJzdz> czrkJzdzList = czrkJzdzService.listByCzrkIds(czrkIdList);
+        //List<CzrkJzdz> czrkJzdzList = czrkJzdzService.listByIdCard(idCardList);
         return czrkJzdzList;
     }
 
@@ -313,7 +229,6 @@ public class CzrkServiceImpl implements ICzrkService {
 
     private void handleList(List<Czrk> czrks, String queryType, List<CzrkJzdz> czrkJzdzList) {
         for (Czrk crk : czrks) {
-//            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);
@@ -327,20 +242,6 @@ public class CzrkServiceImpl implements ICzrkService {
                 crk.setDomicile(nowInCz);
                 break;
             }
-//            }
-        }
-    }
-
-    private void packAddr(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);
-
-            // 现居住地
-            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);
         }
     }
 
@@ -378,18 +279,6 @@ public class CzrkServiceImpl implements ICzrkService {
         }
     }
 
-    private void setAgeScope(Czrk czrk) {
-        Map<String, Object> params = czrk.getParams();
-        String ageScope = (String) params.get("age");
-        if (isNotEmpty(ageScope)) {
-            ageScope = ageScope.trim();
-            String[] split = ageScope.split("-");
-            params.put("startAge", Integer.parseInt(split[0]));
-            if (split.length == 2) {
-                params.put("endAge", Integer.parseInt(split[1]));
-            }
-        }
-    }
 
     private void setDeptIdList(Czrk czrk) {
         Long deptId = czrk.getDeptId();
@@ -464,16 +353,6 @@ public class CzrkServiceImpl implements ICzrkService {
         return czrk;
     }
 
-    /**
-     * 查询常住人口列表
-     *
-     * @param czrk 常住人口
-     * @return 常住人口
-     */
-    @Override
-    public List<Czrk> selectCzrkList(Czrk czrk) {
-        return czrkMapper.selectCzrkList(czrk);
-    }
 
     /**
      * 新增常住人口
@@ -482,38 +361,136 @@ public class CzrkServiceImpl implements ICzrkService {
      * @return 结果
      */
     @Override
-    public int insertCzrk(Czrk czrk) {
-        log.info("{}于{}新增常住人口:{}"
-                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
-        //新增常驻人口后同步修改redis数据
-        //修改潜山市总数居
-        //从redis取出潜山市数据
-        //111
-        /*JSONObject jsonObject = redisService.getCacheObject(packRedisKey("1"));
-        //将JSONObject转为map
-        Map<String,Object> parMap =  JSONObject.parseObject(jsonObject.toJSONString(), new TypeReference<Map<String, Object>>(){});
-        //判断
-        SysDept dept = remoteDeptService.getById(czrk.getDeptId());
-        //人员存在的地址的deptId(市、乡镇、村)当长度为2时,人员的信息为村,长度为3时信息为组
-        List<String> resultList = Arrays.asList(dept.getAncestors().split(","));
-        if(resultList.size()==3){
-
-        }*/
-
-        return czrkMapper.insertCzrk(czrk);
+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+    public AjaxResult insertCzrk(Czrk czrk) {
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}新增户籍人口:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+        List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
+        if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
+        //一开始就判断是否是户籍和所有居住地址是否都不在权限之下
+        if (setInsertRole(czrk,sysUser)) {
+            return AjaxResult.error(HttpStatus.NOT_IMPLEMENTED, "当前填写的户籍地址和居住地址均不属于权限范围");
+        }
+        String houseType = czrk.getHouseType();
+        String code = czrk.getCode();
+        if ("是".equals(houseType) && StringUtils.isNotBlank(code)) {
+            //去查询该户号的户主信息
+            Czrk czrkCode = czrkMapper.selectCzrkByCode(code);
+            if (czrkCode != null && StringUtils.isNotBlank(czrkCode.getIdCard())) {
+                return AjaxResult.error("该户编号已存在户主,请勿重复添加户主");
+            }
+        }
+        //用户账号
+        String username = sysUser.getUserName();
+        //用户姓名
+        String nickName = sysUser.getNickName();
+        //判断是否选择到了现在乡镇,则判断为认领
+        if (isNotEmpty(czrk.getVillageTowns())) {
+            czrk.setRlrNike(nickName);
+            czrk.setRlr(username);
+            czrk.setIsRl("是");
+            czrk.setRlTime(DateUtils.getNowDate());
+        }
+
+        // 当前登陆人的dept_id
+        czrk.setDeptId(sysUser.getDeptId());
+        int count = czrkMapper.countIdCard(czrk.getIdCard());
+        if (count > 0) return AjaxResult.error(String.format("该人员[身份证号为: %s]已存在,请勿重复添加", czrk.getIdCard()));
+
+        czrk.setCreateBy(username);
+        count = czrkMapper.insertCzrk(czrk);
+        if (count < 1) return AjaxResult.error("新增户籍信息失败");
+        int sort = 0, childCount = 0;
+        for (CzrkJzdz czrkJzdz : czrkJzdzList) {
+            czrkJzdz.setCzrkId(czrk.getId());
+            czrkJzdz.setSort(++sort);
+            czrkJzdz.setUserName(czrk.getUserName());
+            czrkJzdz.setIdCard(czrk.getIdCard());
+            czrkJzdz.setCreateBy(username);
+            // 当前登陆人的所属最后一级的dept_id
+            czrkJzdz.setDeptId(sysUser.getDeptId());
+            childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
+
+        }
+        return childCount > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
     /**
-     * 修改常住人口
+     * 修改户籍人口
      *
-     * @param czrk 常住人口
+     * @param czrk 户籍人口
      * @return 结果
      */
     @Override
-    public int updateCzrk(Czrk czrk) {
-        log.info("{}于{}修改常住人口:{}"
-                , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
-        return czrkMapper.updateCzrk(czrk);
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxResult updateCzrk(Czrk czrk) {
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}修改户籍人口:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+        List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
+        if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
+        //一开始就判断是否是户籍和所有居住地址是否都不在权限之下
+        if (setInsertRole(czrk,sysUser)) {
+            return AjaxResult.error(HttpStatus.NOT_IMPLEMENTED, "当前填写的户籍地址和居住地址均不属于权限范围");
+        }
+        //看是否是户主,且有户主号需要去查看该家庭是否有户主
+        String houseType = czrk.getHouseType();
+        String code = czrk.getCode();
+        if ("是".equals(houseType) && StringUtils.isNotBlank(code)) {
+            Czrk czrkCode = czrkMapper.selectCzrkByCode(code);
+            if (czrkCode != null && !czrkCode.getIdCard().equals(czrk.getIdCard())) {
+                return AjaxResult.error("该户编号已存在户主,请勿重复添加户主");
+            }
+        }
+        // 获取当前的用户账号
+        String username = sysUser.getUserName();
+        //用户姓名
+        String nickName = sysUser.getNickName();
+        String isRl = czrk.getIsRl();
+        if ("否".equals(isRl)) {
+            if (isNotEmpty(czrk.getVillageTowns())) {
+                czrk.setRlrNike(nickName);
+                czrk.setRlr(username);
+                czrk.setIsRl("是");
+                czrk.setDeptId(sysUser.getDeptId());
+                czrk.setRlTime(DateUtils.getNowDate());
+            }
+        }
+        czrk.setUpdateBy(username);
+
+        //判断是否确认
+        String isConfirm = czrk.getIsConfirm();
+        if (StringUtils.isNotBlank(isConfirm) && "Y".equals(isConfirm)) {
+            czrk.setConfirmInfoUser(username);
+            czrk.setConfirmInfoUserTime(DateUtils.getNowDate());
+            czrk.setConfirmInfoNikeUser(nickName);
+        }
+
+
+        int count = czrkMapper.updateCzrk(czrk);
+        if (count <= 0) return AjaxResult.error();
+        //往confirm_info_user表中差数据
+        ConfirmInfoUser confirmInfoUser = new ConfirmInfoUser();
+        confirmInfoUser.setCzrkId(czrk.getId());
+        confirmInfoUser.setConfirmInfoUser(username);
+        confirmInfoUser.setConfirmInfoNikeUser(nickName);
+        czrkMapper.insertConfirmInfoUser(confirmInfoUser);
+
+
+        czrkJzdzService.deleteByCzrkId(czrk.getId());
+        int sort = 0, childCount = 0;
+        //处理居住地址
+        for (CzrkJzdz czrkJzdz : czrkJzdzList) {
+            czrkJzdz.setCzrkId(czrk.getId());
+            czrkJzdz.setSort(++sort);
+            czrkJzdz.setUserName(czrk.getUserName());
+            czrkJzdz.setIdCard(czrk.getIdCard());
+            czrkJzdz.setCreateBy(username);;
+            childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
+        }
+
+        return childCount == czrkJzdzList.size() ? AjaxResult.success() : AjaxResult.error();
     }
 
     /**
@@ -666,6 +643,12 @@ public class CzrkServiceImpl implements ICzrkService {
         return AjaxResult.error("变更失败");
     }
 
+    /**
+     * 2022/3/24修改的根据czrkId查询该用户信息
+     *
+     * @param id
+     * @return
+     */
     @Override
     public Czrk getById(Long id) {
         if (isEmpty(id)) {
@@ -677,6 +660,7 @@ public class CzrkServiceImpl implements ICzrkService {
             return null;
         }
 
+        //获取网格id
         Long gridId = czrk.getGridId();
         if (gridId != null) {
             GridInfo gridInfo = gridInfoMapper.selectGridInfoById(gridId);
@@ -693,9 +677,10 @@ public class CzrkServiceImpl implements ICzrkService {
             czrk.setHzIdCard(hzCzrk.getIdCard());
         }
 
+        //查询改用户居住地址信息
         List<CzrkJzdz> czrkJzdzList = czrkJzdzService.listByCzrkId(czrk.getId());
         czrk.setCzrkJzdzList(czrkJzdzList);
-        //todo 重新计算年龄
+        // 重新计算年龄
         String birthday = czrk.getBirthday();
         if (StringUtils.isNotBlank(birthday)) {
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -779,27 +764,23 @@ public class CzrkServiceImpl implements ICzrkService {
         return childCount > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
+    /**
+     * 功能描述: 人员认领菜单中认领接口
+     * @param czrk
+     * @return
+     */
     @Override
     public AjaxResult editRlry(Czrk czrk) {
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}人员认领:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
         List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
         if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
-        //一开始就判断是否是户籍和所有居住地址都不在对应辖区
-        String region = czrk.getRegion();
-        if (StringUtils.isBlank(region) || !"潜山市".equals(region)) {
-            boolean flag = true;
-            for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-                String regionJzdz = czrkJzdz.getRegion();
-                if (StringUtils.isNotBlank(regionJzdz) && "潜山市".equals(regionJzdz)) {
-                    flag = false;
-                }
-            }
-            if (flag) {
-                return AjaxResult.error(HttpStatus.NOT_IMPLEMENTED, "当前填写的户籍地址和居住地址均不属于对应辖区");
-            }
+        //一开始就判断是否是户籍和所有居住地址是否都不在权限之下
+        if (setInsertRole(czrk,sysUser)) {
+            return AjaxResult.error(HttpStatus.NOT_IMPLEMENTED, "当前填写的户籍地址和居住地址均不属于权限范围,请先修改后认领");
         }
-
-        //todo 看是否是户主,且有户主号需要去查看该家庭是否有户主
-
+        //看是否是户主,且有户主号需要去查看该家庭是否有户主
         String houseType = czrk.getHouseType();
         String code = czrk.getCode();
         if ("是".equals(houseType) && StringUtils.isNotBlank(code)) {
@@ -808,46 +789,17 @@ public class CzrkServiceImpl implements ICzrkService {
                 return AjaxResult.error("该户编号已存在户主,请勿重复添加户主");
             }
         }
-        LoginUser loginUser = tokenService.getLoginUser();
-
-        // 获取当前的用户账号
-        String username = loginUser.getUsername();
+        // 获取当前的用户手机号
+        String username = sysUser.getUserName();
         //用户姓名
-        String nickName = loginUser.getSysUser().getNickName();
-        String isRl = czrk.getIsRl();
-        if ("否".equals(isRl)) {
-            if (isNotEmpty(czrk.getVillageTowns())) {
-                czrk.setRlrNike(nickName);
-                czrk.setRlr(username);
-                czrk.setIsRl("是");
-                czrk.setDeptId(loginUser.getSysUser().getDeptId());
-                czrk.setRlTime(new Date(System.currentTimeMillis()));
-            } else {
-                czrk.setIsRl("否");
-                czrk.setRlTime(null);
-            }
-        }
-
-        czrk.setUpdateBy(username);
-        //判断是否确认
-        String isConfirm = czrk.getIsConfirm();
-        if (StringUtils.isNotBlank(isConfirm) && "Y".equals(isConfirm)) {
-            czrk.setConfirmInfoUser(username);
-            czrk.setConfirmInfoUserTime(DateUtils.getNowDate());
-            czrk.setConfirmInfoNikeUser(nickName);
-        }
-
-
+        String nickName = sysUser.getNickName();
+        czrk.setRlrNike(nickName);
+        czrk.setRlr(username);
+        czrk.setIsRl("是");
+        czrk.setDeptId(sysUser.getDeptId());
+        czrk.setRlTime(DateUtils.getNowDate());
         int count = czrkMapper.updateCzrk(czrk);
         if (count <= 0) return AjaxResult.error();
-        //往confirm_info_user表中差数据
-        ConfirmInfoUser confirmInfoUser = new ConfirmInfoUser();
-        confirmInfoUser.setCzrkId(czrk.getId());
-        confirmInfoUser.setConfirmInfoUser(username);
-        confirmInfoUser.setConfirmInfoNikeUser(nickName);
-        czrkMapper.insertConfirmInfoUser(confirmInfoUser);
-
-
         czrkJzdzService.deleteByCzrkId(czrk.getId());
         int sort = 0, childCount = 0;
         for (CzrkJzdz czrkJzdz : czrkJzdzList) {
@@ -856,15 +808,14 @@ public class CzrkServiceImpl implements ICzrkService {
             czrkJzdz.setUserName(czrk.getUserName());
             czrkJzdz.setIdCard(czrk.getIdCard());
             czrkJzdz.setCreateBy(username);
-            czrkJzdz.setUpdateBy(username);
             childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
         }
-
         return childCount == czrkJzdzList.size() ? AjaxResult.success() : AjaxResult.error();
     }
 
     /**
      * 小程序接口统计认领人员
+     *
      * @param provinceId
      * @param cityId
      * @param regionId
@@ -1218,7 +1169,7 @@ public class CzrkServiceImpl implements ICzrkService {
         List<Long> deptIdList = map(depts, SysDept::getId);
         //查询当前乡镇下的户籍总人数
         List<Czrk> czrkList = czrkMapper.selectCzrkListByDeptId(deptIdList);
-        if(czrkList==null){
+        if (czrkList == null) {
             czrkList = new ArrayList<>();
         }
         //该镇户籍人口总数
@@ -1231,14 +1182,14 @@ public class CzrkServiceImpl implements ICzrkService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (Czrk czrk : czrkList) {
-            if("Y".equals(czrk.getIsDel())){
+            if ("Y".equals(czrk.getIsDel())) {
                 hjzrs--;
             }
             //判断是否是在今天操作的人员信息
-            if(s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)){
-                if("Y".equals(czrk.getIsDel())){
+            if (s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)) {
+                if ("Y".equals(czrk.getIsDel())) {
                     hjjs++;
-                }else{
+                } else {
                     hjxz++;
                 }
             }
@@ -1259,7 +1210,7 @@ public class CzrkServiceImpl implements ICzrkService {
 
 
         List<CzrkJzdz> czrkJzdzList = czrkJzdzService.selectCzrkJzdzListByDeptId(deptIdList);
-        if(czrkJzdzList==null){
+        if (czrkJzdzList == null) {
             czrkJzdzList = new ArrayList<>();
         }
         //该镇户籍人口总数
@@ -1272,14 +1223,14 @@ public class CzrkServiceImpl implements ICzrkService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-            if("Y".equals(czrkJzdz.getStatus())){
+            if ("Y".equals(czrkJzdz.getStatus())) {
                 czzrs--;
             }
             //判断是否是在今天操作的人员信息
-            if(s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)){
-                if("Y".equals(czrkJzdz.getStatus())){
+            if (s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)) {
+                if ("Y".equals(czrkJzdz.getStatus())) {
                     czjs++;
-                }else{
+                } else {
                     czxz++;
                 }
             }

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

@@ -1,6 +1,7 @@
 package com.boman.web.core.service.czrk;
 
 
+import com.boman.domain.Czrk;
 import com.boman.domain.CzrkJzdz;
 import org.apache.ibatis.annotations.Param;
 
@@ -65,6 +66,14 @@ public interface ICzrkJzdzService {
 
     List<CzrkJzdz> listByIdCard(List<String> idCardList);
 
+
+    /**
+     * 查看家庭成员,获取居住地址,根据czrkId查询
+     * @param czrkIds
+     * @return
+     */
+    List<CzrkJzdz> listByCzrkIds(List<Long> czrkIds);
+
     List<Long> listCzrkIdByTypeAreaIdUserName(int type, Long areaId, String userName);
 
     int updateByIdCard(CzrkJzdz czrkJzdz);
@@ -77,4 +86,11 @@ public interface ICzrkJzdzService {
     List<CzrkJzdz> selectCzrkJzdzListByDeptId(List<Long> deptIdList);
 
     List<CzrkJzdz> selectCzrkJzdzListByRegionId(String regionId);
+
+    /**
+     * 2022/3/23重新修复的PC人员信息查看常住人口接口
+     * @param czrk
+     * @return
+     */
+    List<Czrk> listByCzrkJzdz(Czrk czrk);
 }

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

@@ -17,11 +17,18 @@ public interface ICzrkService {
 
 
     /**
-     * 查看人员认领列表接口
+     * 2022/3/24修复户籍人员认领接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
      * @param czrk
      * @return
      */
-    List<Czrk> listByRlry(Czrk czrk);
+    List<Czrk> listByRlryHj(Czrk czrk);
+
+    /**
+     * 2022/3/24修复常住人员认领接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
+     * @param czrk
+     * @return
+     */
+    List<Czrk> listByRlryCz(Czrk czrk);
 
     /**
      * 2022/3/22重新修复的PC人员信息查看户籍人口接口
@@ -48,20 +55,12 @@ public interface ICzrkService {
     Czrk selectCzrkById(Long id);
 
     /**
-     * 查询常住人口列表
+     * 新增户籍人口
      *
-     * @param czrk 常住人口
-     * @return 常住人口集合
-     */
-    List<Czrk> selectCzrkList(Czrk czrk);
-
-    /**
-     * 新增常住人口
-     *
-     * @param czrk 常住人口
+     * @param czrk 户籍人口
      * @return 结果
      */
-    int insertCzrk(Czrk czrk);
+    AjaxResult insertCzrk(Czrk czrk);
 
     /**
      * 修改常住人口
@@ -69,7 +68,7 @@ public interface ICzrkService {
      * @param czrk 常住人口
      * @return 结果
      */
-    int updateCzrk(Czrk czrk);
+    AjaxResult updateCzrk(Czrk czrk);
 
     /**
      * 批量删除常住人口

+ 180 - 0
boman-web-core/src/main/java/com/boman/web/core/utils/CzrkUtils.java

@@ -0,0 +1,180 @@
+package com.boman.web.core.utils;
+
+import com.boman.common.core.exception.BaseException;
+import com.boman.common.core.utils.StringUtils;
+import com.boman.domain.Czrk;
+import com.boman.domain.SysDept;
+import com.boman.domain.SysRole;
+import com.boman.domain.SysUser;
+import java.util.List;
+import java.util.Map;
+import static com.boman.common.core.utils.StringUtils.isNotEmpty;
+import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
+import static com.google.common.base.Strings.nullToEmpty;
+
+/**
+ * @author tjf
+ * @Date: 2022/03/23/17:23
+ */
+public class CzrkUtils {
+    /**
+     * 拼接出前端需要的户籍地或者现居住地
+     */
+    public static void packAddr(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);
+
+            // 现居住地
+            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);
+        }
+    }
+
+
+    /**
+     * 人员信息拆分查询参数年龄
+     *
+     * @param czrk
+     */
+    public static void setAgeScope(Czrk czrk) {
+        Map<String, Object> params = czrk.getParams();
+        String ageScope = (String) params.get("age");
+        if (isNotEmpty(ageScope)) {
+            ageScope = ageScope.trim();
+            String[] split = ageScope.split("-");
+            params.put("startAge", Integer.parseInt(split[0]));
+            if (split.length == 2) {
+                params.put("endAge", Integer.parseInt(split[1]));
+            }
+        }
+    }
+
+
+    /**
+     * 查询使用
+     * 根据当前登录人判断该用户是什么角色权限字符,来进行判断该用户能查询到什么层级的数据
+     * @param czrk
+     * @param sysUser
+     * @param type 查询常住还是户籍
+     */
+    public static void setQueryRole(Czrk czrk, SysUser sysUser,String type) {
+        //todo 从部门中获取行政区域规划id
+        SysDept dept = sysUser.getDept();
+        if (dept == null){
+            throw new BaseException("对不起,未获相关部门信息");
+        }
+        //判断该用户是什么角色权限字符
+        List<SysRole> roles = sysUser.getRoles();
+        if (roles != null && roles.size() > 0){
+            for (SysRole role : roles) {
+                if (role != null){
+                     String roleKey = role.getRoleKey();
+                     if (StringUtils.isNotBlank(roleKey)){
+                         switch (roleKey){
+                             case "province":
+                                 if (type.equals(Czrk.HJ)){
+                                     //czrk.setProvinceId();
+                                 }else {
+                                     //czrk.setProvinceIdXjd();
+                                 }
+                             case "city":
+                                 if (type.equals(Czrk.HJ)){
+                                     //czrk.setCityId();
+                                 }else {
+                                     //czrk.setCityIdXjd();
+                                 }
+                             case "region":
+                                 if (type.equals(Czrk.HJ)){
+                                     //czrk.setRegionId();
+                                 }else {
+                                     //czrk.setRegionIdXjd();
+                                 }
+                             case "villageTowns":
+                                 if (type.equals(Czrk.HJ)){
+                                     //czrk.setVillageTownsId();
+                                 }else {
+                                     //czrk.setVillageTownsXjd();
+                                 }
+                             case "village":
+                                 if (type.equals(Czrk.HJ)){
+                                     //czrk.setVillageId();
+                                 }else {
+                                     //czrk.setVillageIdXjd();
+                                 }
+                             case "villagerGroup":
+                                 if (type.equals(Czrk.HJ)){
+                                     //czrk.setVillagerGroupId();
+                                 }else {
+                                     //czrk.setVillagerGroupIdXjd();
+                                 }
+                             default:
+                         }
+                     }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 新增用户的时候,判断登录用户是否能新增
+     * @param czrk
+     * @param sysUser
+     */
+    public static Boolean setInsertRole(Czrk czrk, SysUser sysUser) {
+        Boolean flag = false;
+        //todo 从部门中获取行政区域规划id
+        SysDept dept = sysUser.getDept();
+        if (dept == null){
+            throw new BaseException("对不起,未获相关部门信息");
+        }
+        //判断该用户是什么角色权限字符
+        List<SysRole> roles = sysUser.getRoles();
+        if (roles != null && roles.size() > 0){
+            for (SysRole role : roles) {
+                if (role != null){
+                    String roleKey = role.getRoleKey();
+                    if (StringUtils.isNotBlank(roleKey)){
+                        switch (roleKey){
+                            case "province":
+                                String provinceId = czrk.getProvinceId();
+/*                                if (StringUtils.isNotBlank(provinceId) && provinceId.equals()){
+                                     flag = true;
+                                }*/
+                            case "city":
+                                String cityId = czrk.getCityId();
+/*                                if (StringUtils.isNotBlank(cityId) && cityId.equals()){
+                                    flag = true;
+                                }*/
+                            case "region":
+                                String regionId = czrk.getRegionId();
+/*                                if (StringUtils.isNotBlank(regionId) && regionId.equals()){
+                                    flag = true;
+                                }*/
+                            case "villageTowns":
+                                String villageTownsId = czrk.getVillageTownsId();
+/*                                if (StringUtils.isNotBlank(villageTownsId) && villageTownsId.equals()){
+                                    flag = true;
+                                }*/
+                            case "village":
+                                String village = czrk.getVillage();
+/*                                if (StringUtils.isNotBlank(village) && village.equals()){
+                                    flag = true;
+                                }*/
+                            case "villagerGroup":
+                                String villagerGroup = czrk.getVillagerGroup();
+/*                                if (StringUtils.isNotBlank(villagerGroup) && villagerGroup.equals()){
+                                    flag = true;
+                                }*/
+                            default:
+                        }
+                    }
+                }
+            }
+        }
+        return flag;
+    }
+}

+ 3 - 2
boman-web-core/src/main/resources/logback.xml

@@ -85,13 +85,14 @@
 	<!-- Spring日志级别控制  -->
 	<logger name="org.springframework" level="warn" />
 
-	<root level="debug">
+	<root level="info">
 		<appender-ref ref="console" />
 	</root>
 
 	<!--系统操作日志-->
-    <root level="debug">
+    <root level="info">
         <appender-ref ref="file_info" />
         <appender-ref ref="file_error" />
+        <appender-ref ref="file_warn" />
     </root>
 </configuration>

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

@@ -99,9 +99,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </select>
 
+    <select id="listByCzrkIds" resultMap="CzrkJzdzResult">
+        <include refid="selectCzrkJzdzVo"/>
+        where czrk_id in
+        <foreach item="czrkId" collection="czrkIds" open="(" separator="," close=")">
+            #{czrkId}
+        </foreach>
+    </select>
+
     <select id="listByCzrkId" resultMap="CzrkJzdzResult">
         <include refid="selectCzrkJzdzVo"/>
-        where czrk_id = #{czrkId}
+        where czrk_id = #{czrkId} and status = 'Y'
     </select>
 
     <insert id="insertCzrkJzdz" useGeneratedKeys="true" keyProperty="id">

+ 117 - 156
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -101,16 +101,16 @@
              , update_by, update_time, is_del, delete_reason,  is_rl, key_industries from czrk
     </sql>
 
-    <select id="listByRlry" resultMap="CzrkResult">
-        select id, user_name, phone_num,dept_id, id_card, gender, province, city, region, village_towns, village,
-        villager_group, grid_id
-        , house_type, update_by, code, rlr,rlr_nike, update_time, delete_reason,
-        now_in,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time
+    <select id="listByCzrk" resultMap="CzrkResult">
+        select id, user_name, phone_num, id_card, gender, province, city, region, village_towns, village,
+        villager_group, grid_id, house_type, update_by, code,
+        rlr,rlr_nike,now_in,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time
         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>
@@ -121,12 +121,7 @@
             <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="code != null  and code != ''">and code = #{code}</if>
             <if test="houseType != null  and houseType != ''">and house_type = #{houseType}</if>
-            <if test="rlr != null  and rlr != ''">and rlr = #{rlr}</if>
-            <if test="rlTime != null ">and rl_time = #{rlTime}</if>
-            <if test="yhzgx != null  and yhzgx != ''">and yhzgx = #{yhzgx}</if>
-            <if test="workUnit != null  and workUnit != ''">and work_unit = #{workUnit}</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>
@@ -137,95 +132,45 @@
             <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="nowIn != null  and nowIn != ''">and now_in = #{nowIn}</if>
-            <if test="status != null  and status != ''">and status = #{status}</if>
             <if test="isConfirm != null  and isConfirm != ''">and is_confirm = #{isConfirm}</if>
-            <if test="isDel != null  and isDel != ''">and is_del = #{isDel}</if>
-            <if test="deleteReason != null  and deleteReason != ''">and delete_reason = #{deleteReason}</if>
             <if test="gridId != null  and gridId != ''">and grid_id = #{gridId}</if>
-            <if test="deptIdList != null and deptIdList.size() > 0">
-                and dept_id in
-                <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
-                    #{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>
 
-    <select id="listByRlryJzdz" resultMap="CzrkResult">
-        select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card, c.gender, c.province, c.city, c.region,
-        c.village_towns, c.village, c.villager_group, c.grid_id
-        , c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike, c.update_time, c.delete_reason,
-        c.now_in,c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
+
+    <select id="listCzrkByJzdz" resultMap="CzrkResult">
+        select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card,
+        c.province, c.city ,c.region , c.village_towns, c.village ,c.now_in,
+        c.gender, c.grid_id, c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike,
+        c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
         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="gender != null  and gender != ''">and c.gender = #{gender}</if>
-            <if test="birthday != null ">and c.birthday = #{birthday}</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="code != null  and code != ''">and c.code = #{code}</if>
             <if test="houseType != null  and houseType != ''">and c.house_type = #{houseType}</if>
-            <if test="rlr != null  and rlr != ''">and c.rlr = #{rlr}</if>
-            <if test="rlTime != null ">and c.rl_time = #{rlTime}</if>
-            <if test="yhzgx != null  and yhzgx != ''">and c.yhzgx = #{yhzgx}</if>
-            <if test="workUnit != null  and workUnit != ''">and c.work_unit = #{workUnit}</if>
             <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
-            <if test="province != null  and province != ''">and c.province = #{province}</if>
             <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
-            <if test="city != null  and city != ''">and c.city = #{city}</if>
             <if test="regionId != null  and regionId != ''">and c.region_id = #{regionId}</if>
-            <if test="region != null  and region != ''">and c.region = #{region}</if>
             <if test="villageTownsId != null  and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
-            <if test="villageTowns != null  and villageTowns != ''">and c.village_towns = #{villageTowns}</if>
             <if test="villageId != null  and villageId != ''">and c.village_id = #{villageId}</if>
-            <if test="village != null  and village != ''">and c.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="nowIn != null  and nowIn != ''">and c.now_in = #{nowIn}</if>
-            <if test="status != null  and status != ''">and c.status = #{status}</if>
             <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
-            <if test="isDel != null  and isDel != ''">and c.is_del = #{isDel}</if>
-            <if test="deleteReason != null  and deleteReason != ''">and c.delete_reason = #{deleteReason}</if>
-            <if test="gridId != null  and gridId != ''">and c.grid_id = #{gridId}</if>
-            <if test="deptIdList != null and deptIdList.size() > 0">
-                and c.dept_id in
-                <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
-                    #{deptId}
-                </foreach>
-            </if>
-            <if test="idCardList != null and idCardList.size() > 0">
-                and c.id_card in
-                <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
-                    #{idCard}
-                </foreach>
-            </if>
-            <if test="czrkJzdz.provinceId != null">and z.province_id = #{czrkJzdz.provinceId}</if>
-            <if test="czrkJzdz.cityId != null">and z.city_id = #{czrkJzdz.cityId}</if>
-            <if test="czrkJzdz.regionId != null">and z.region_id = #{czrkJzdz.regionId}</if>
-            <if test="czrkJzdz.townId != null">and z.town_id = #{czrkJzdz.townId}</if>
-            <if test="czrkJzdz.villageId != null">and z.village_id = #{czrkJzdz.villageId}</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>
-
     <select id="listByRlryRel" resultType="com.boman.domain.Czrk">
         SELECT
         czrk.id,
@@ -1076,71 +1021,6 @@
     </insert>
 
 
-    <select id="selectCzrkList" resultMap="CzrkResult">
-        select c.id,z.id as czrk_jzdz_id,c.user_name,c.id_card,z.province_id, z.province, z.city_id, z.city,
-        z.region_id, z.region, z.town_id as village_towns_id, z.town as village_towns, z.village_id, z.village,
-        z.now_in,c.phone_num,c.house_type,c.rlr,c.rlr_nike,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
-        from czrk_jzdz z left join czrk c on c.id = z.czrk_id
-        <where>
-            <!-- 已认领 -->
-            <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="gender != null  and gender != ''">and c.gender = #{gender}</if>
-            <if test="age != null ">and c.age = #{age}</if>
-            <if test="birthday != null ">and c.birthday = #{birthday}</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="code != null  and code != ''">and c.code = #{code}</if>
-            <if test="houseType != null  and houseType != ''">and c.house_type = #{houseType}</if>
-            <if test="rlr != null  and rlr != ''">and c.rlr = #{rlr}</if>
-            <if test="rlTime != null ">and c.rl_time = #{rlTime}</if>
-            <if test="yhzgx != null  and yhzgx != ''">and c.yhzgx = #{yhzgx}</if>
-            <if test="workUnit != null  and workUnit != ''">and c.work_unit = #{workUnit}</if>
-            <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
-            <if test="province != null  and province != ''">and c.province = #{province}</if>
-            <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
-            <if test="city != null  and city != ''">and c.city = #{city}</if>
-            <if test="regionId != null  and regionId != ''">and c.region_id = #{regionId}</if>
-            <if test="region != null  and region != ''">and c.region = #{region}</if>
-            <if test="villageTownsId != null  and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
-            <if test="villageTowns != null  and villageTowns != ''">and c.village_towns = #{villageTowns}</if>
-            <if test="villageId != null  and villageId != ''">and c.village_id = #{villageId}</if>
-            <if test="village != null  and village != ''">and c.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="nowIn != null  and nowIn != ''">and c.now_in = #{nowIn}</if>
-            <if test="status != null  and status != ''">and c.status = #{status}</if>
-            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
-            <if test="isDel != null  and isDel != ''">and c.is_del = #{isDel}</if>
-            <if test="deleteReason != null  and deleteReason != ''">and c.delete_reason = #{deleteReason}</if>
-            <if test="gridId != null  and gridId != ''">and c.grid_id = #{gridId}</if>
-            <if test="provinceIdXjd != null ">and z.province_id = #{provinceIdXjd}</if>
-            <if test="cityIdXjd != null ">and z.city_id = #{cityIdXjd}</if>
-            <if test="regionIdXjd != null ">and z.region_id = #{regionIdXjd}</if>
-            <if test="villageTownsIdXjd != null ">and z.town_id = #{villageTownsIdXjd}</if>
-            <if test="villageIdXjd != null ">and z.village_id = #{villageIdXjd}</if>
-            <if test="deptIdList != null and deptIdList.size() > 0">
-                and c.dept_id in
-                <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
-                    #{deptId}
-                </foreach>
-            </if>
-            <if test="idCardList != null and idCardList.size() > 0">
-                and c.id_card in
-                <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
-                    #{idCard}
-                </foreach>
-            </if>
-        </where>
-        order by c.create_time DESC
-    </select>
-
-
     <select id="selectCzrkByCode" resultType="java.lang.Integer" resultMap="CzrkResult">
        select id_card from czrk where is_del = 'N' and code = #{code} and house_type = '是' limit 1;
     </select>
@@ -1165,17 +1045,14 @@
         where is_confirm = 'Y' and (village_towns is null or village_towns = '') and is_del ='N'
     </select>
 
-    <select id="unusualList"  resultMap="CzrkResult">
+    <select id="unusualList" resultMap="CzrkResult">
         select id, user_name, phone_num,dept_id, id_card, gender, province, city, region, village_towns, village,
         villager_group, grid_id
         , house_type, update_by, code, rlr,rlr_nike, update_time, delete_reason,
         now_in,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time
         from czrk
         <where>
-            status != 1
-            <!-- 已认领 -->
-            <if test="isRl != null and isRl != ''">and is_rl = #{isRl}</if>
-
+            status not in ('1','2')
             <if test="userName != null  and userName != ''">
                 and user_name like concat(#{userName}, '%')
             </if>
@@ -1209,18 +1086,6 @@
             <if test="isDel != null  and isDel != ''">and is_del = #{isDel}</if>
             <if test="deleteReason != null  and deleteReason != ''">and delete_reason = #{deleteReason}</if>
             <if test="gridId != null  and gridId != ''">and grid_id = #{gridId}</if>
-            <if test="deptIdList != null and deptIdList.size() > 0">
-                and dept_id in
-                <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
-                    #{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>
@@ -1239,4 +1104,100 @@
                  , village_id, village create_time, is_del, area_id from czrk
         where region_id = #{regionId};
     </select>
+
+
+    <select id="listByCzrkJzdz" resultMap="CzrkResult">
+        select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card,
+        z.province as provinceXjd, z.city as cityXjd,z.region as regionXjd, z.town as villageTownsXjd, z.village as
+        villageXjd,z.now_in,
+        c.gender, c.grid_id, c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike,
+        c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
+        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="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>
+
+
+    <select id="selectCzrkByNotRl" resultMap="CzrkResult">
+        select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card, c.gender, c.province, c.city, c.region,
+        c.village_towns, c.village, c.villager_group, c.grid_id
+        , c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike, c.update_time, c.delete_reason,
+        c.now_in,c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
+        from czrk c
+        <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}, '%')
+            </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="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>
+        </where>
+        order by c.create_time DESC
+    </select>
+
+    <select id="selectCzrkByNotRlCz" resultMap="CzrkResult">
+        select c.id, c.user_name, c.phone_num, c.id_card, c.gender,
+        z.province as provinceXjd, z.city as cityXjd,z.region as regionXjd, z.town as villageTownsXjd, z.village as
+        villageXjd,z.now_in,c.grid_id
+        , c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike, c.update_time, c.delete_reason,
+        c.now_in,c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
+        from czrk c  left join czrk_jzdz z on c.id = z.czrk_id
+        <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}, '%')
+            </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="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="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>

+ 4 - 1
boman-wechat/src/main/java/com/boman/wechat/controller/AppletLoginController.java

@@ -69,9 +69,12 @@ public class AppletLoginController {
         AppletSessionDTO dto = codeUtil.jscode2Session(form);
         String phoneNumber = dto.getPhoneNumber();
         if (StringUtils.isBlank(phoneNumber)){
-            System.out.println("未获取到手机号");
+            throw new BaseException("对不起,未获取到手机号");
         }
         SysUser user = remoteUserService.getByPhone(dto.getPhoneNumber());
+        if (user == null){
+            throw new BaseException("对不起,未获取到相关信息");
+        }
         String userName = user.getUserName();
         if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
             remoteLogService.saveLogininfor(userName, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");

+ 1 - 0
boman-wechat/src/main/java/com/boman/wechat/utils/WxCodeSessionUtil.java

@@ -75,6 +75,7 @@ public class WxCodeSessionUtil {
         appletSession.setUnionId(result.getString("unionid"));
         appletSession.setSessionKey(result.getString("session_key"));
 
+        System.out.println();
         String phoneNumber = getPhoneNumber(form, appletSession);
         appletSession.setPhoneNumber(phoneNumber);
         return appletSession;