Browse Source

网格信息

LIVE_YE 3 years ago
parent
commit
db81e3158c
19 changed files with 1225 additions and 138 deletions
  1. 26 0
      boman-api/boman-api-web-core/src/main/java/com/boman/web/core/api/RemoteQianshanGridService.java
  2. 5 0
      boman-api/boman-domain/src/main/java/com.boman.domain/constant/CacheConstants.java
  3. 7 1
      boman-api/boman-domain/src/main/java/com/boman/domain/Czrk.java
  4. 20 0
      boman-api/boman-domain/src/main/java/com/boman/domain/CzrkJzdz.java
  5. 297 0
      boman-api/boman-domain/src/main/java/com/boman/domain/QianshanGrid.java
  6. 8 0
      boman-auth/pom.xml
  7. 21 2
      boman-modules/boman-system/src/main/java/com/boman/system/service/impl/ChinaAreaServiceImpl.java
  8. 1 1
      boman-modules/boman-system/src/main/resources/bootstrap.yml
  9. 10 0
      boman-web-core/pom.xml
  10. 112 0
      boman-web-core/src/main/java/com/boman/web/core/controller/QianshanGridController.java
  11. 0 2
      boman-web-core/src/main/java/com/boman/web/core/mapper/AccountingDataMapper.java
  12. 65 0
      boman-web-core/src/main/java/com/boman/web/core/mapper/QianshanGridMapper.java
  13. 5 5
      boman-web-core/src/main/java/com/boman/web/core/service/TaskService.java
  14. 4 5
      boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java
  15. 70 0
      boman-web-core/src/main/java/com/boman/web/core/service/qianshanGrid/IQianshanGridService.java
  16. 211 0
      boman-web-core/src/main/java/com/boman/web/core/service/qianshanGrid/impl/QianshanGridServiceImpl.java
  17. 174 117
      boman-web-core/src/main/resources/mapper/CzrkJzdzMapper.xml
  18. 25 5
      boman-web-core/src/main/resources/mapper/CzrkMapper.xml
  19. 164 0
      boman-web-core/src/main/resources/mapper/QianshanGridMapper.xml

+ 26 - 0
boman-api/boman-api-web-core/src/main/java/com/boman/web/core/api/RemoteQianshanGridService.java

@@ -0,0 +1,26 @@
+package com.boman.web.core.api;
+
+
+import com.boman.domain.QianshanGrid;
+import com.boman.domain.constant.ServiceNameConstants;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+
+import java.util.List;
+
+
+@FeignClient(contextId = "remoteQianshanGridService", value = ServiceNameConstants.WEB_CORE_SERVICE)
+public interface RemoteQianshanGridService {
+
+    /**
+     * 功能描述: 查询网格信息
+     *
+     *
+     * @return com.boman.domain.TableDataInfo
+     */
+    @GetMapping("core/grid/api/list/{pid}")
+    List<QianshanGrid> list(@PathVariable("pid")String pid);
+
+}
+

+ 5 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/constant/CacheConstants.java

@@ -44,4 +44,9 @@ public class CacheConstants
      * 行政区域规划树形集合
      */
     public static final String CHINA_AREA = "china_area_list:";
+
+    /**
+     * 大屏行政区域规划树形集合
+     */
+    public static final String CHINA_AREA_DP = "china_area_list_dp:";
 }

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

@@ -235,7 +235,7 @@ public class Czrk extends BaseEntity{
     /**
      * 网格id
      */
-    private Long gridId;
+    private String gridId;
     /**
      * 网格名称
      */
@@ -346,4 +346,10 @@ public class Czrk extends BaseEntity{
     private String hzIdCard;
 
 
+    private String villagerGroupIdJz;
+    private String gridIdJz;
+    private String villagerGroupJz;
+    private String gridNameJz;
+
+
 }

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

@@ -124,6 +124,26 @@ public class CzrkJzdz {
     @Excel(name = "居住详细地址")
     private String nowIn;
 
+    /**
+     * 网格id
+     */
+    private String gridId;
+    /**
+     * 网格名称
+     */
+    private String gridName;
+    /**
+     * 居住地的组
+     */
+    //@Excel(name = "户籍地的组")
+    private String villagerGroupId;
+
+    /**
+     * 居住地的组
+     */
+    //@Excel(name = "户籍地的组")
+    private String villagerGroup;
+
     /**
      * Y有效地址,N无效地址
      */

+ 297 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/QianshanGrid.java

@@ -0,0 +1,297 @@
+package com.boman.domain;
+
+import com.boman.domain.annotation.Excel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 潜山网格信息对象 qianshan_grid
+ * 
+ * @author ruoyi
+ * @date 2022-06-20
+ */
+public class QianshanGrid extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 网格名称 */
+    @Excel(name = "网格名称")
+    private String gridName;
+
+    /** 网格管理员(网格长) */
+    @Excel(name = "网格管理员(网格长)")
+    private String gridMember;
+
+    /** 网格长手机号 */
+    @Excel(name = "网格长手机号")
+    private String gridPhone;
+
+    /** 网格层级 */
+    private String gridLevel;
+
+    /** 上级网格id */
+    private String parentGridId;
+
+    /** 上级网格名称 */
+    private String parentGridName;
+
+    /**
+     * 户籍地的区
+     */
+    //@Excel(name = "户籍地的区")
+    private String regionId;
+
+    /**
+     * 户籍地的区
+     */
+    //@Excel(name = "户籍地的区")
+    private String region;
+
+    /**
+     * 户籍地的镇
+     */
+    //@Excel(name = "户籍地的镇")
+    private String villageTownsId;
+
+    /**
+     * 户籍地的镇
+     */
+    //@Excel(name = "户籍地的镇")
+    private String villageTowns;
+
+    /**
+     * 户籍地的村
+     */
+    //@Excel(name = "户籍地的村")
+    private String villageId;
+
+    /**
+     * 户籍地的村
+     */
+    //@Excel(name = "户籍地的村")
+    private String village;
+
+    /** 网格内区划名称(,号分割) */
+    @Excel(name = "网格内区划名称(,号分割)")
+    private String areaName;
+
+    /** 网格内区划id(,号分割) */
+    private String areaId;
+
+    /** 上级区划id */
+    private String parentAreaId;
+
+    /** 是否删除 */
+    private String isDel;
+
+    private Integer num;
+
+    private boolean hasChildren = Boolean.TRUE;
+
+    /** 子部门 */
+    private List<SysDept> children = new ArrayList<SysDept>();
+
+    public void setChildren(List<SysDept> children) {
+        this.children = children;
+    }
+
+    public List<SysDept> getChildren() {
+        return children;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setHasChildren(boolean hasChildren) {
+        this.hasChildren = hasChildren;
+    }
+
+    public boolean isHasChildren() {
+        return hasChildren;
+    }
+
+    public void setParentGridName(String parentGridName) {
+        this.parentGridName = parentGridName;
+    }
+
+    public String getParentGridName() {
+        return parentGridName;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public void setGridName(String gridName)
+    {
+        this.gridName = gridName;
+    }
+
+    public String getGridName() 
+    {
+        return gridName;
+    }
+    public void setGridMember(String gridMember) 
+    {
+        this.gridMember = gridMember;
+    }
+
+    public String getGridMember() 
+    {
+        return gridMember;
+    }
+    public void setGridPhone(String gridPhone) 
+    {
+        this.gridPhone = gridPhone;
+    }
+
+    public String getGridPhone() 
+    {
+        return gridPhone;
+    }
+    public void setGridLevel(String gridLevel) 
+    {
+        this.gridLevel = gridLevel;
+    }
+
+    public String getGridLevel() 
+    {
+        return gridLevel;
+    }
+    public void setParentGridId(String parentGridId)
+    {
+        this.parentGridId = parentGridId;
+    }
+
+    public String getParentGridId()
+    {
+        return parentGridId;
+    }
+    public void setAreaName(String areaName)
+    {
+        this.areaName = areaName;
+    }
+
+    public String getAreaName() 
+    {
+        return areaName;
+    }
+    public void setAreaId(String areaId) 
+    {
+        this.areaId = areaId;
+    }
+
+    public String getAreaId() 
+    {
+        return areaId;
+    }
+    public void setParentAreaId(String parentAreaId) 
+    {
+        this.parentAreaId = parentAreaId;
+    }
+
+    public String getParentAreaId() 
+    {
+        return parentAreaId;
+    }
+    public void setIsDel(String isDel) 
+    {
+        this.isDel = isDel;
+    }
+
+    public String getIsDel() 
+    {
+        return isDel;
+    }
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public String getRegionId() {
+        return regionId;
+    }
+
+    public String getRegion() {
+        return region;
+    }
+
+    public String getVillageTownsId() {
+        return villageTownsId;
+    }
+
+    public String getVillageTowns() {
+        return villageTowns;
+    }
+
+    public String getVillageId() {
+        return villageId;
+    }
+
+    public String getVillage() {
+        return village;
+    }
+
+    public void setRegionId(String regionId) {
+        this.regionId = regionId;
+    }
+
+    public void setRegion(String region) {
+        this.region = region;
+    }
+
+    public void setVillageTownsId(String villageTownsId) {
+        this.villageTownsId = villageTownsId;
+    }
+
+    public void setVillageTowns(String villageTowns) {
+        this.villageTowns = villageTowns;
+    }
+
+    public void setVillageId(String villageId) {
+        this.villageId = villageId;
+    }
+
+    public void setVillage(String village) {
+        this.village = village;
+    }
+
+    @Override
+    public String toString() {
+        return "QianshanGrid{" +
+                "id=" + id +
+                ", gridName='" + gridName + '\'' +
+                ", gridMember='" + gridMember + '\'' +
+                ", gridPhone='" + gridPhone + '\'' +
+                ", gridLevel='" + gridLevel + '\'' +
+                ", parentGridId='" + parentGridId + '\'' +
+                ", parentGridName='" + parentGridName + '\'' +
+                ", regionId='" + regionId + '\'' +
+                ", region='" + region + '\'' +
+                ", villageTownsId='" + villageTownsId + '\'' +
+                ", villageTowns='" + villageTowns + '\'' +
+                ", villageId='" + villageId + '\'' +
+                ", village='" + village + '\'' +
+                ", areaName='" + areaName + '\'' +
+                ", areaId='" + areaId + '\'' +
+                ", parentAreaId='" + parentAreaId + '\'' +
+                ", isDel='" + isDel + '\'' +
+                ", num=" + num +
+                ", hasChildren=" + hasChildren +
+                ", children=" + children +
+                '}';
+    }
+}

+ 8 - 0
boman-auth/pom.xml

@@ -76,6 +76,14 @@
     <build>
         <finalName>${project.artifactId}</finalName>
         <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.4.2</version>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>

+ 21 - 2
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/ChinaAreaServiceImpl.java

@@ -3,6 +3,7 @@ package com.boman.system.service.impl;
 import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.StringUtils;
 import com.boman.common.redis.service.RedisService;
+import com.boman.domain.QianshanGrid;
 import com.boman.domain.SysDept;
 import com.boman.domain.constant.CacheConstants;
 import com.boman.domain.dto.AjaxResult;
@@ -11,6 +12,7 @@ import com.boman.system.domain.ChinaArea;
 import com.boman.system.domain.vo.TreeSelect;
 import com.boman.system.mapper.ChinaAreaMapper;
 import com.boman.system.service.IChinaAreaService;
+import com.boman.web.core.api.RemoteQianshanGridService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
@@ -33,6 +35,9 @@ public class ChinaAreaServiceImpl implements IChinaAreaService {
 
     @Resource
     private ChinaAreaMapper chinaAreaMapper;
+
+    @Resource
+    private RemoteQianshanGridService remoteQianshanGridService;
     /**
      * 获取行政区域规划下拉树列表
      * @param chinaArea
@@ -42,7 +47,7 @@ public class ChinaAreaServiceImpl implements IChinaAreaService {
     public AjaxResult selectChinaAreaList(ChinaArea chinaArea) {
 
         //先去从redis获取
-        List<TreeSelect> treeSelects = redisService.getCacheList(CacheConstants.CHINA_AREA+chinaArea.getPid());
+        List<TreeSelect> treeSelects = redisService.getCacheList(CacheConstants.CHINA_AREA_DP+chinaArea.getPid());
         if (treeSelects != null && treeSelects.size() > 0){
             log.info("从缓存中获取到区域集合");
             return AjaxResult.success(treeSelects);
@@ -50,7 +55,21 @@ public class ChinaAreaServiceImpl implements IChinaAreaService {
         List<ChinaArea> chinaAreas = chinaAreaMapper.selectChinaAreaList(chinaArea);
         if (chinaAreas != null && chinaAreas.size() > 0){
             log.info("从数据库中获取到行政区域集合");
-            redisService.setCacheList(CacheConstants.CHINA_AREA+chinaArea.getPid(),chinaAreas);
+            redisService.setCacheList(CacheConstants.CHINA_AREA_DP+chinaArea.getPid(),chinaAreas);
+        }else{
+            List<QianshanGrid> QianshanGrids = remoteQianshanGridService.list(String.valueOf(chinaArea.getPid()));
+            if(QianshanGrids != null && QianshanGrids.size() > 0){
+                chinaAreas = new ArrayList<>();
+                for (QianshanGrid grid : QianshanGrids) {
+                    ChinaArea chinaAre = new ChinaArea();
+                    chinaAre.setAreaId(String.valueOf(grid.getId()));
+                    chinaAre.setName(grid.getGridName());
+                    chinaAre.setPid(grid.getParentGridId());
+                    chinaAreas.add(chinaAre);
+                }
+
+                redisService.setCacheList(CacheConstants.CHINA_AREA_DP+chinaArea.getPid(),chinaAreas);
+            }
         }
         return AjaxResult.success(chinaAreas);
     }

+ 1 - 1
boman-modules/boman-system/src/main/resources/bootstrap.yml

@@ -1,5 +1,5 @@
 server:
-  port: 3201
+  port: 3207
 
 spring: 
   application:

+ 10 - 0
boman-web-core/pom.xml

@@ -134,6 +134,16 @@
     <build>
         <finalName>${project.artifactId}</finalName>
         <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.4.2</version>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+
+
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>

+ 112 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/QianshanGridController.java

@@ -0,0 +1,112 @@
+package com.boman.web.core.controller;
+
+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.QianshanGrid;
+import com.boman.domain.TableDataInfo;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.web.core.service.qianshanGrid.IQianshanGridService;
+import lombok.SneakyThrows;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+
+/**
+ * 潜山网格信息Controller
+ * 
+ * @author ruoyi
+ * @date 2022-06-20
+ */
+@RestController
+@RequestMapping("/core/grid")
+public class QianshanGridController extends BaseController
+{
+    @Autowired
+    private IQianshanGridService qianshanGridService;
+
+    /**
+     * 查询潜山网格信息列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(QianshanGrid qianshanGrid)
+    {
+        startPage();
+        List<QianshanGrid> list = qianshanGridService.selectQianshanGridList(qianshanGrid);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询潜山网格信息列表
+     */
+    @GetMapping("/api/list/{pid}")
+    public List<QianshanGrid> listApi(@PathVariable("pid") String pid)
+    {
+        return qianshanGridService.listApi(pid);
+    }
+
+    /**
+     * 导出潜山网格信息列表
+     */
+    @SneakyThrows
+    @Log(title = "潜山网格信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, QianshanGrid qianshanGrid){
+        List<QianshanGrid> list = qianshanGridService.selectQianshanGridList(qianshanGrid);
+        ExcelUtil<QianshanGrid> util = new ExcelUtil<QianshanGrid>(QianshanGrid.class);
+        util.exportExcel(response, list, "潜山网格信息数据");
+    }
+
+    /**
+     * 获取潜山网格信息详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(qianshanGridService.selectQianshanGridById(id));
+    }
+
+    /**
+     * 新增潜山网格信息
+     */
+    @Log(title = "潜山网格信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody QianshanGrid qianshanGrid)
+    {
+        return toAjax(qianshanGridService.insertQianshanGrid(qianshanGrid));
+    }
+
+    /**
+     * 修改潜山网格信息
+     */
+    @Log(title = "潜山网格信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody QianshanGrid qianshanGrid)
+    {
+        return toAjax(qianshanGridService.updateQianshanGrid(qianshanGrid));
+    }
+
+    /**
+     * 删除潜山网格信息
+     */
+    @Log(title = "潜山网格信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(qianshanGridService.deleteQianshanGridByIds(ids));
+    }
+
+    /***
+     * 通过村ID获取网格信息
+     */
+    @Log(title = "潜山网格信息", businessType = BusinessType.INSERT)
+    @PostMapping("/queryParent")
+    public AjaxResult queryZu(@RequestBody QianshanGrid qianshanGrid)
+    {
+        return qianshanGridService.queryZu(qianshanGrid);
+    }
+}

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

@@ -4,9 +4,7 @@ package com.boman.web.core.mapper;
  * @Date: 2022/05/13/10:27
  */
 
-import com.boman.web.core.domain.AccountingData;
 import com.boman.web.core.domain.vo.AccountingDataVo;
-import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;

+ 65 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/QianshanGridMapper.java

@@ -0,0 +1,65 @@
+package com.boman.web.core.mapper;
+
+import com.boman.domain.QianshanGrid;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * 潜山网格信息Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-06-20
+ */
+public interface QianshanGridMapper {
+    /**
+     * 查询潜山网格信息
+     *
+     * @param id 潜山网格信息主键
+     * @return 潜山网格信息
+     */
+    public QianshanGrid selectQianshanGridById(Long id);
+
+    /**
+     * 查询潜山网格信息列表
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 潜山网格信息集合
+     */
+    public List<QianshanGrid> selectQianshanGridList(QianshanGrid qianshanGrid);
+
+    /**
+     * 新增潜山网格信息
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 结果
+     */
+    public int insertQianshanGrid(QianshanGrid qianshanGrid);
+
+    /**
+     * 修改潜山网格信息
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 结果
+     */
+    public int updateQianshanGrid(QianshanGrid qianshanGrid);
+
+    /**
+     * 删除潜山网格信息
+     *
+     * @param id 潜山网格信息主键
+     * @return 结果
+     */
+    public int deleteQianshanGridById(Long id);
+
+    /**
+     * 批量删除潜山网格信息
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteQianshanGridByIds(Long[] ids);
+
+    List<QianshanGrid> validateHasChirld(@Param("qianshanGrids") List<QianshanGrid> qianshanGrids);
+}

+ 5 - 5
boman-web-core/src/main/java/com/boman/web/core/service/TaskService.java

@@ -148,7 +148,7 @@ public class TaskService {
      * 定时执行首页数据任务(每天凌晨1点执行)
      * (cron = "0 0 1 * * ?")
      */
-    @Scheduled(cron = "0 0 1 * * ?")
+    //@Scheduled(cron = "0 0 1 * * ?")
     public void execute() {
         //将每个deptId(潜山市,乡镇,村)的首页都存入redis
         JSONObject results = new JSONObject(16);
@@ -565,7 +565,7 @@ public class TaskService {
      * 新生儿(每天18点执行)
      *
      */
-    @Scheduled(cron = "0 0 18 * * ?")
+    //@Scheduled(cron = "0 0 18 * * ?")
     public void getNewborn() {
 
         String token = getToken();
@@ -681,7 +681,7 @@ public class TaskService {
         }
     }
 
-    @Scheduled(cron = "0 0/10 * * * ? ")
+    //@Scheduled(cron = "0 0/10 * * * ? ")
     public void thirdNucleicAcid() {
         String startTime = redisService.getCacheObject("startTime");
         if (StringUtils.isEmpty(startTime)) {
@@ -773,7 +773,7 @@ public class TaskService {
     /***
      * 核酸统计(每一个小时跑一次)
      */
-    @Scheduled(cron = "0 0 * * * ? ")
+    //@Scheduled(cron = "0 0 * * * ? ")
     public void nucleicAcidStatistics() {
 
         System.out.println("batchInsert 核酸统计开始开始========");
@@ -972,7 +972,7 @@ public class TaskService {
      * 来宜数据匹配(每个小时的35分开始跑数据)
      */
     @SneakyThrows
-    @Scheduled(cron = "0 35 * * * ? ")
+    //@Scheduled(cron = "0 35 * * * ? ")
     public void toQianshanData() {
         System.out.println("batchInsert 来宜人员插入开始========");
         long start = System.currentTimeMillis();

+ 4 - 5
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -404,7 +404,7 @@ public class CzrkServiceImpl implements ICzrkService {
         log.info("{}于{}根据id:{},获取信息"
                 , AuthUtils.getLoginUser().getSysUser().getUserName(), DateUtils.dateTimeNow(), id);
         Czrk czrk = czrkMapper.selectCzrkById(id);
-        if (czrk != null) {
+        /*if (czrk != null) {
             Long gridId = czrk.getGridId();
             if (gridId != null) {
                 GridInfo gridInfo = gridInfoMapper.selectGridInfoById(gridId);
@@ -413,7 +413,7 @@ public class CzrkServiceImpl implements ICzrkService {
                     czrk.setGridName(areaName);
                 }
             }
-        }
+        }*/
         return czrk;
     }
 
@@ -878,7 +878,6 @@ public class CzrkServiceImpl implements ICzrkService {
             czrkJzdz.setUserName(czrk.getUserName());
             czrkJzdz.setIdCard(czrk.getIdCard());
             czrkJzdz.setCreateBy(username);
-            ;
             childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
         }
 
@@ -1607,14 +1606,14 @@ public class CzrkServiceImpl implements ICzrkService {
         }
 
         //获取网格id
-        Long gridId = czrk.getGridId();
+        /*Long gridId = czrk.getGridId();
         if (gridId != null) {
             GridInfo gridInfo = gridInfoMapper.selectGridInfoById(gridId);
             if (gridInfo != null) {
                 String areaName = gridInfo.getAreaName();
                 czrk.setGridName(areaName);
             }
-        }
+        }*/
 
         // 拿到户主的姓名和身份证号
         Czrk hzCzrk = czrkMapper.getHzByCode(czrk.getCode());

+ 70 - 0
boman-web-core/src/main/java/com/boman/web/core/service/qianshanGrid/IQianshanGridService.java

@@ -0,0 +1,70 @@
+package com.boman.web.core.service.qianshanGrid;
+
+
+import com.boman.domain.QianshanGrid;
+import com.boman.domain.dto.AjaxResult;
+
+import java.util.List;
+
+/**
+ * 潜山网格信息Service接口
+ *
+ * @author ruoyi
+ * @date 2022-06-20
+ */
+public interface IQianshanGridService {
+    /**
+     * 查询潜山网格信息
+     *
+     * @param id 潜山网格信息主键
+     * @return 潜山网格信息
+     */
+    public QianshanGrid selectQianshanGridById(Long id);
+
+    /**
+     * 查询潜山网格信息列表
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 潜山网格信息集合
+     */
+    public List<QianshanGrid> selectQianshanGridList(QianshanGrid qianshanGrid);
+
+    /**
+     * 新增潜山网格信息
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 结果
+     */
+    public int insertQianshanGrid(QianshanGrid qianshanGrid);
+
+    /**
+     * 修改潜山网格信息
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 结果
+     */
+    public int updateQianshanGrid(QianshanGrid qianshanGrid);
+
+    /**
+     * 批量删除潜山网格信息
+     *
+     * @param ids 需要删除的潜山网格信息主键集合
+     * @return 结果
+     */
+    public int deleteQianshanGridByIds(Long[] ids);
+
+    /**
+     * 删除潜山网格信息信息
+     *
+     * @param id 潜山网格信息主键
+     * @return 结果
+     */
+    public int deleteQianshanGridById(Long id);
+
+    /***
+     * 通过村ID获取网格信息
+     */
+    AjaxResult queryZu(QianshanGrid qianshanGrid);
+
+    List<QianshanGrid> listApi(String pid);
+}

+ 211 - 0
boman-web-core/src/main/java/com/boman/web/core/service/qianshanGrid/impl/QianshanGridServiceImpl.java

@@ -0,0 +1,211 @@
+package com.boman.web.core.service.qianshanGrid.impl;
+
+import com.boman.common.core.utils.DateUtils;
+import com.boman.common.core.utils.IdUtils;
+import com.boman.common.redis.service.RedisService;
+import com.boman.domain.QianshanGrid;
+import com.boman.domain.constant.CacheConstants;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.web.core.mapper.QianshanGridMapper;
+import com.boman.web.core.service.qianshanGrid.IQianshanGridService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 潜山网格信息Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-06-20
+ */
+@Service
+public class QianshanGridServiceImpl implements IQianshanGridService {
+    @Autowired
+    private QianshanGridMapper qianshanGridMapper;
+
+    @Resource
+    private RedisService redisService;
+
+    /**
+     * 查询潜山网格信息
+     *
+     * @param id 潜山网格信息主键
+     * @return 潜山网格信息
+     */
+    @Override
+    public QianshanGrid selectQianshanGridById(Long id) {
+        return qianshanGridMapper.selectQianshanGridById(id);
+    }
+
+    /**
+     * 查询潜山网格信息列表
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 潜山网格信息
+     */
+    @Override
+    public List<QianshanGrid> selectQianshanGridList(QianshanGrid qianshanGrid) {
+        Long id = qianshanGrid.getId();
+        if (id != null) {
+            qianshanGrid.setParentGridId(String.valueOf(id));
+            qianshanGrid.setGridLevel("4");
+        } else {
+            qianshanGrid.setGridLevel("3");
+        }
+
+
+        List<QianshanGrid> qianshanGrids = qianshanGridMapper.selectQianshanGridList(qianshanGrid);
+        // 这里的逻辑是:根据id获取到这个下面的所有子网格,每个网格判断是否有下一级别
+        if (qianshanGrids != null && qianshanGrids.size() > 0) {
+
+            List<QianshanGrid> hasChirlds = qianshanGridMapper.validateHasChirld(qianshanGrids);
+
+            if (hasChirlds != null && hasChirlds.size() > 0) {
+                Map<Long, QianshanGrid> hasChirldMap = new HashMap<>();
+                for (QianshanGrid hasChirld : hasChirlds) {
+                    hasChirldMap.put(hasChirld.getId(), hasChirld);
+                }
+                for (QianshanGrid qianshan : qianshanGrids) {
+                    if (hasChirldMap.get(qianshan.getId()) == null) {
+                        qianshan.setHasChildren(Boolean.FALSE);
+                    }
+                }
+            } else {
+                for (QianshanGrid qianshan : qianshanGrids) {
+                    qianshan.setHasChildren(Boolean.FALSE);
+                }
+            }
+        }
+        return qianshanGrids;
+    }
+
+    /**
+     * 新增潜山网格信息
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 结果
+     */
+    @Override
+    public int insertQianshanGrid(QianshanGrid qianshanGrid) {
+        qianshanGrid.setId(System.currentTimeMillis());
+        qianshanGrid.setCreateTime(DateUtils.getNowDate());
+        int count = qianshanGridMapper.insertQianshanGrid(qianshanGrid);
+
+        if(count>0){
+            //将数据更新存入redis
+            //查询同一级的所有网格
+            QianshanGrid grid = new QianshanGrid();
+            grid.setParentGridId(qianshanGrid.getParentGridId());
+            List<QianshanGrid> gridList = qianshanGridMapper.selectQianshanGridList(grid);
+
+            if(gridList != null && gridList.size() > 0){
+                List<Map<String,Object>> chinaAreasMap = new ArrayList<>();
+
+                for (QianshanGrid grids : gridList) {
+                    Map<String,Object> chinaAreMap = new HashMap<>();
+
+                    chinaAreMap.put("areaId",String.valueOf(grids.getId()));
+                    chinaAreMap.put("children",new ArrayList<>());
+                    chinaAreMap.put("name",grids.getGridName());
+                    chinaAreMap.put("params",new HashMap<String, Object>());
+                    chinaAreMap.put("pid",grids.getParentGridId());
+                    chinaAreMap.put("sort",0);
+                    chinaAreasMap.add(chinaAreMap);
+                }
+                //先将原有的删除
+                redisService.deleteObject(CacheConstants.CHINA_AREA_DP+qianshanGrid.getParentGridId());
+                redisService.setCacheList(CacheConstants.CHINA_AREA_DP+qianshanGrid.getParentGridId(),chinaAreasMap);
+            }
+
+        }
+
+
+        return count;
+    }
+
+    /**
+     * 修改潜山网格信息
+     *
+     * @param qianshanGrid 潜山网格信息
+     * @return 结果
+     */
+    @Override
+    public int updateQianshanGrid(QianshanGrid qianshanGrid) {
+        qianshanGrid.setUpdateTime(DateUtils.getNowDate());
+        int count = qianshanGridMapper.updateQianshanGrid(qianshanGrid);
+        if(count>0){
+            //将数据更新存入redis
+            //查询同一级的所有网格
+            QianshanGrid grid = new QianshanGrid();
+            grid.setParentGridId(qianshanGrid.getParentGridId());
+            List<QianshanGrid> gridList = qianshanGridMapper.selectQianshanGridList(grid);
+
+            if(gridList != null && gridList.size() > 0){
+                List<Map<String,Object>> chinaAreasMap = new ArrayList<>();
+
+                for (QianshanGrid grids : gridList) {
+                    Map<String,Object> chinaAreMap = new HashMap<>();
+
+                    chinaAreMap.put("areaId",String.valueOf(grids.getId()));
+                    chinaAreMap.put("children",new ArrayList<>());
+                    chinaAreMap.put("name",grids.getGridName());
+                    chinaAreMap.put("params",new HashMap<String, Object>());
+                    chinaAreMap.put("pid",grids.getParentGridId());
+                    chinaAreMap.put("sort",0);
+                    chinaAreasMap.add(chinaAreMap);
+                }
+                //先将原有的删除
+                redisService.deleteObject(CacheConstants.CHINA_AREA_DP+qianshanGrid.getParentGridId());
+                redisService.setCacheList(CacheConstants.CHINA_AREA_DP+qianshanGrid.getParentGridId(),chinaAreasMap);
+            }
+
+        }
+        return count;
+    }
+
+    /**
+     * 批量删除潜山网格信息
+     *
+     * @param ids 需要删除的潜山网格信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteQianshanGridByIds(Long[] ids) {
+        return qianshanGridMapper.deleteQianshanGridByIds(ids);
+    }
+
+    /**
+     * 删除潜山网格信息信息
+     *
+     * @param id 潜山网格信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteQianshanGridById(Long id) {
+        return qianshanGridMapper.deleteQianshanGridById(id);
+    }
+
+    /***
+     * 通过村ID获取下级网格信息
+     */
+    @Override
+    public AjaxResult queryZu(QianshanGrid qianshanGrid) {
+        List<QianshanGrid> qianshanGridList = qianshanGridMapper.selectQianshanGridList(qianshanGrid);
+        return AjaxResult.success(qianshanGridList);
+    }
+
+    @Override
+    public List<QianshanGrid> listApi(String pid) {
+        QianshanGrid qianshanGrid = new QianshanGrid();
+        qianshanGrid.setParentGridId(pid);
+        List<QianshanGrid> qianshanGrids = qianshanGridMapper.selectQianshanGridList(qianshanGrid);
+        return qianshanGrids;
+    }
+}

+ 174 - 117
boman-web-core/src/main/resources/mapper/CzrkJzdzMapper.xml

@@ -1,58 +1,90 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.boman.web.core.mapper.CzrkJzdzMapper">
-    
+
     <resultMap type="com.boman.domain.CzrkJzdz" id="CzrkJzdzResult">
-        <result property="id"    column="id"    />
-        <result property="czrkId"    column="czrk_id"    />
-        <result property="idCard"    column="id_card"    />
-        <result property="userName"    column="user_name"    />
-        <result property="sort"    column="sort"    />
-        <result property="deptId"    column="dept_id"    />
-        <result property="provinceId"    column="province_id"    />
-        <result property="province"    column="province"    />
-        <result property="cityId"    column="city_id"    />
-        <result property="city"    column="city"    />
-        <result property="regionId"    column="region_id"    />
-        <result property="region"    column="region"    />
-        <result property="townId"    column="town_id"    />
-        <result property="town"    column="town"    />
-        <result property="villageId"    column="village_id"    />
-        <result property="village"    column="village"    />
-        <result property="nowIn"    column="now_in"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="status"    column="status"    />
+        <result property="id" column="id"/>
+        <result property="czrkId" column="czrk_id"/>
+        <result property="idCard" column="id_card"/>
+        <result property="userName" column="user_name"/>
+        <result property="sort" column="sort"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="provinceId" column="province_id"/>
+        <result property="province" column="province"/>
+        <result property="cityId" column="city_id"/>
+        <result property="city" column="city"/>
+        <result property="regionId" column="region_id"/>
+        <result property="region" column="region"/>
+        <result property="townId" column="town_id"/>
+        <result property="town" column="town"/>
+        <result property="villageId" column="village_id"/>
+        <result property="village" column="village"/>
+
+        <result property="villagerGroupId" column="villager_group_id"/>
+        <result property="villagerGroup" column="villager_group"/>
+        <result property="gridId" column="grid_id"/>
+        <result property="gridName" column="grid_name"/>
+
+        <result property="nowIn" column="now_in"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="status" column="status"/>
     </resultMap>
 
     <sql id="selectCzrkJzdzVo">
-        select id, czrk_id, id_card, user_name, sort, dept_id, province_id, province, city_id, city, region_id, region, town_id, town, village_id, village, now_in, create_by, create_time, update_by, update_time, status from czrk_jzdz
+        select id,
+               czrk_id,
+               id_card,
+               user_name,
+               sort,
+               dept_id,
+               province_id,
+               province,
+               city_id,
+               city,
+               region_id,
+               region,
+               town_id,
+               town,
+               village_id,
+               village,
+               villager_group_id,
+               villager_group,
+               grid_id,
+               grid_name,
+               now_in,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               status
+        from czrk_jzdz
     </sql>
 
     <select id="selectCzrkJzdzList" resultMap="CzrkJzdzResult">
         <include refid="selectCzrkJzdzVo"/>
-        <where>  
-            <if test="czrkId != null "> and czrk_id = #{czrkId}</if>
-            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
-            <if test="userName != null  and userName != ''"> and user_name like concat( #{userName}, '%')</if>
-            <if test="sort != null "> and sort = #{sort}</if>
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
-            <if test="provinceId != null  and provinceId != ''"> and province_id = #{provinceId}</if>
-            <if test="province != null  and province != ''"> and province = #{province}</if>
-            <if test="cityId != null  and cityId != ''"> and city_id = #{cityId}</if>
-            <if test="city != null  and city != ''"> and city = #{city}</if>
-            <if test="regionId != null  and regionId != ''"> and region_id = #{regionId}</if>
-            <if test="region != null  and region != ''"> and region = #{region}</if>
-            <if test="townId != null  and townId != ''"> and town_id = #{townId}</if>
-            <if test="town != null  and town != ''"> and town = #{town}</if>
-            <if test="villageId != null  and villageId != ''"> and village_id = #{villageId}</if>
-            <if test="village != null  and village != ''"> and village = #{village}</if>
-            <if test="nowIn != null  and nowIn != ''"> and now_in = #{nowIn}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
+        <where>
+            <if test="czrkId != null ">and czrk_id = #{czrkId}</if>
+            <if test="idCard != null  and idCard != ''">and id_card = #{idCard}</if>
+            <if test="userName != null  and userName != ''">and user_name like concat( #{userName}, '%')</if>
+            <if test="sort != null ">and sort = #{sort}</if>
+            <if test="deptId != null ">and dept_id = #{deptId}</if>
+            <if test="provinceId != null  and provinceId != ''">and province_id = #{provinceId}</if>
+            <if test="province != null  and province != ''">and province = #{province}</if>
+            <if test="cityId != null  and cityId != ''">and city_id = #{cityId}</if>
+            <if test="city != null  and city != ''">and city = #{city}</if>
+            <if test="regionId != null  and regionId != ''">and region_id = #{regionId}</if>
+            <if test="region != null  and region != ''">and region = #{region}</if>
+            <if test="townId != null  and townId != ''">and town_id = #{townId}</if>
+            <if test="town != null  and town != ''">and town = #{town}</if>
+            <if test="villageId != null  and villageId != ''">and village_id = #{villageId}</if>
+            <if test="village != null  and village != ''">and village = #{village}</if>
+            <if test="nowIn != null  and nowIn != ''">and now_in = #{nowIn}</if>
+            <if test="status != null  and status != ''">and status = #{status}</if>
             <if test="deptIdList != null and deptIdList.size() > 0">
                 and dept_id in
                 <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
@@ -66,23 +98,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="listIdCard" resultType="string">
         select id_card from czrk_jzdz
         <where>
-            <if test="czrkId != null "> and czrk_id = #{czrkId}</if>
-            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
-            <if test="userName != null  and userName != ''"> and user_name like concat( #{userName}, '%')</if>
-            <if test="sort != null "> and sort = #{sort}</if>
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
-            <if test="provinceId != null  and provinceId != ''"> and province_id = #{provinceId}</if>
-            <if test="province != null  and province != ''"> and province = #{province}</if>
-            <if test="cityId != null  and cityId != ''"> and city_id = #{cityId}</if>
-            <if test="city != null  and city != ''"> and city = #{city}</if>
-            <if test="regionId != null  and regionId != ''"> and region_id = #{regionId}</if>
-            <if test="region != null  and region != ''"> and region = #{region}</if>
-            <if test="townId != null  and townId != ''"> and town_id = #{townId}</if>
-            <if test="town != null  and town != ''"> and town = #{town}</if>
-            <if test="villageId != null  and villageId != ''"> and village_id = #{villageId}</if>
-            <if test="village != null  and village != ''"> and village = #{village}</if>
-            <if test="nowIn != null  and nowIn != ''"> and now_in = #{nowIn}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
+            <if test="czrkId != null ">and czrk_id = #{czrkId}</if>
+            <if test="idCard != null  and idCard != ''">and id_card = #{idCard}</if>
+            <if test="userName != null  and userName != ''">and user_name like concat( #{userName}, '%')</if>
+            <if test="sort != null ">and sort = #{sort}</if>
+            <if test="deptId != null ">and dept_id = #{deptId}</if>
+            <if test="provinceId != null  and provinceId != ''">and province_id = #{provinceId}</if>
+            <if test="province != null  and province != ''">and province = #{province}</if>
+            <if test="cityId != null  and cityId != ''">and city_id = #{cityId}</if>
+            <if test="city != null  and city != ''">and city = #{city}</if>
+            <if test="regionId != null  and regionId != ''">and region_id = #{regionId}</if>
+            <if test="region != null  and region != ''">and region = #{region}</if>
+            <if test="townId != null  and townId != ''">and town_id = #{townId}</if>
+            <if test="town != null  and town != ''">and town = #{town}</if>
+            <if test="villageId != null  and villageId != ''">and village_id = #{villageId}</if>
+            <if test="village != null  and village != ''">and village = #{village}</if>
+            <if test="nowIn != null  and nowIn != ''">and now_in = #{nowIn}</if>
+            <if test="status != null  and status != ''">and status = #{status}</if>
         </where>
     </select>
 
@@ -126,6 +158,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="city != null">city,</if>
             <if test="regionId != null">region_id,</if>
             <if test="region != null">region,</if>
+
+            <if test="villagerGroupId != null">villager_group_id,</if>
+            <if test="villagerGroup != null">villager_group,</if>
+            <if test="gridId != null">grid_id,</if>
+            <if test="gridName != null">grid_name,</if>
+
             <if test="townId != null">town_id,</if>
             <if test="town != null">town,</if>
             <if test="villageId != null">village_id,</if>
@@ -136,7 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">update_time,</if>
             <if test="status != null">status,</if>
             create_time
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="czrkId != null">#{czrkId},</if>
             <if test="idCard != null">#{idCard},</if>
@@ -149,6 +187,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="city != null">#{city},</if>
             <if test="regionId != null">#{regionId},</if>
             <if test="region != null">#{region},</if>
+
+            <if test="villagerGroupId != null">#{villagerGroupId},</if>
+            <if test="villagerGroup != null">#{villagerGroup},</if>
+            <if test="gridId != null">#{gridId},</if>
+            <if test="gridName != null">#{gridName},</if>
+
             <if test="townId != null">#{townId},</if>
             <if test="town != null">#{town},</if>
             <if test="villageId != null">#{villageId},</if>
@@ -162,7 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
     </insert>
 
-    <update id="updateCzrkJzdz" >
+    <update id="updateCzrkJzdz">
         update czrk_jzdz
         <trim prefix="SET" suffixOverrides=",">
             <if test="czrkId != null">czrk_id = #{czrkId},</if>
@@ -181,6 +225,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="villageId != null">village_id = #{villageId},</if>
             <if test="village != null">village = #{village},</if>
             <if test="nowIn != null">now_in = #{nowIn},</if>
+            <if test="villagerGroupId != null">villager_group_id = #{villagerGroupId},</if>
+            <if test="villagerGroup != ''">villager_group = #{villagerGroup},</if>
+            <if test="gridId != null">grid_id = #{gridId},</if>
+            <if test="gridName != null">grid_name = #{gridName},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
@@ -190,7 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
-    <update id="updateByIdCard" >
+    <update id="updateByIdCard">
         update czrk_jzdz
         <trim prefix="SET" suffixOverrides=",">
             <if test="czrkId != null">czrk_id = #{czrkId},</if>
@@ -218,7 +266,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id_card = #{idCard}
     </update>
 
-    <update id="updateByCzrkId" >
+    <update id="updateByCzrkId">
         update czrk_jzdz
         <trim prefix="SET" suffixOverrides=",">
             <if test="czrkId != null">czrk_id = #{czrkId},</if>
@@ -249,16 +297,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateHouseholdRegister">
         update czrk_jzdz
         set province_id = #{hzCzrkJzdz.provinceId},
-            province = #{hzCzrkJzdz.province},
-            city_id = #{hzCzrkJzdz.cityId},
-            city = #{hzCzrkJzdz.city},
-            region_id = #{hzCzrkJzdz.regionId},
-            region = #{hzCzrkJzdz.region},
-            town_id = #{hzCzrkJzdz.townId},
-            town = #{hzCzrkJzdz.town},
-            village_id = #{hzCzrkJzdz.villageId},
-            village = #{hzCzrkJzdz.village},
-            now_in = #{hzCzrkJzdz.nowIn}
+        province = #{hzCzrkJzdz.province},
+        city_id = #{hzCzrkJzdz.cityId},
+        city = #{hzCzrkJzdz.city},
+        region_id = #{hzCzrkJzdz.regionId},
+        region = #{hzCzrkJzdz.region},
+        town_id = #{hzCzrkJzdz.townId},
+        town = #{hzCzrkJzdz.town},
+        village_id = #{hzCzrkJzdz.villageId},
+        village = #{hzCzrkJzdz.village},
+        now_in = #{hzCzrkJzdz.nowIn}
         where id_card in
         <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
             #{idCard}
@@ -266,15 +314,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteCzrkJzdzById" parameterType="Long">
-        delete from czrk_jzdz where id = #{id}
+        delete
+        from czrk_jzdz
+        where id = #{id}
     </delete>
 
     <delete id="deleteByCzrkId" parameterType="Long">
-        delete from czrk_jzdz where czrk_id = #{czrkId}
+        delete
+        from czrk_jzdz
+        where czrk_id = #{czrkId}
     </delete>
 
     <delete id="deleteCzrkJzdzByIds" parameterType="String">
-        delete from czrk_jzdz where id in 
+        delete from czrk_jzdz where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -299,7 +351,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectCzrkJzdzListPage" parameterType="Integer" resultMap="CzrkJzdzResult">
-        select * from czrk_jzdz where village_id = '' and  now_in != ''  limit   #{startNum}, #{endNum}
+        select *
+        from czrk_jzdz
+        where village_id = ''
+          and now_in != ''  limit #{startNum}
+            , #{endNum}
     </select>
 
     <select id="selectCzrkJzdzListByDeptId" resultMap="CzrkJzdzResult">
@@ -313,51 +369,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
     <select id="selectCzrkJzdzListByRegionId" resultMap="CzrkJzdzResult">
-        SELECT
-            MAX(ANY_VALUE(id)) as id,
-            ANY_VALUE(dept_id) as dept_id,
-            ANY_VALUE(region_id) as region_id,
-            ANY_VALUE(region) as region,
-            ANY_VALUE(town_id) as town_id,
-            ANY_VALUE(town) as town,
-            ANY_VALUE(village_id) as village_id,
-            ANY_VALUE(village) as village,
-            ANY_VALUE(create_time) as create_time,
-            MAX(ANY_VALUE(update_time)) as update_time,
-            ANY_VALUE(STATUS) as STATUS
-        FROM
-            czrk_jzdz
+        SELECT MAX(ANY_VALUE(id))          as id,
+               ANY_VALUE(dept_id)          as dept_id,
+               ANY_VALUE(region_id)        as region_id,
+               ANY_VALUE(region)           as region,
+               ANY_VALUE(town_id)          as town_id,
+               ANY_VALUE(town)             as town,
+               ANY_VALUE(village_id)       as village_id,
+               ANY_VALUE(village)          as village,
+               ANY_VALUE(create_time)      as create_time,
+               MAX(ANY_VALUE(update_time)) as update_time,
+               ANY_VALUE(STATUS)           as STATUS
+        FROM czrk_jzdz
         where region_id = #{regionId}
         GROUP BY id_card
 
 
     </select>
     <select id="getCzrkJzdzByTime" resultMap="CzrkJzdzResult">
-        select
-            ANY_VALUE(id) as id,
-            ANY_VALUE(czrk_id) as czrk_id,
-            ANY_VALUE(id_card) as id_card,
-            ANY_VALUE(user_name) as user_name,
-            ANY_VALUE(sort) as sort,
-            ANY_VALUE(dept_id) as dept_id,
-            ANY_VALUE(province_id) as province_id,
-            ANY_VALUE(province) as province,
-            ANY_VALUE(city_id) as city_id,
-            ANY_VALUE(city) as city,
-            ANY_VALUE(region_id) as region_id,
-            ANY_VALUE(region) as region,
-            ANY_VALUE(town_id) as town_id,
-            ANY_VALUE(town) as town,
-            ANY_VALUE(village_id) as village_id,
-            ANY_VALUE(village) as village,
-            ANY_VALUE(now_in) as now_in,
-            ANY_VALUE(create_by) as create_by,
-            ANY_VALUE(create_time) as create_time,
-            ANY_VALUE(update_by) as update_by,
-            ANY_VALUE(update_time) as update_time,
-            ANY_VALUE(status) as status
+        select ANY_VALUE(id)          as id,
+               ANY_VALUE(czrk_id)     as czrk_id,
+               ANY_VALUE(id_card)     as id_card,
+               ANY_VALUE(user_name)   as user_name,
+               ANY_VALUE(sort)        as sort,
+               ANY_VALUE(dept_id)     as dept_id,
+               ANY_VALUE(province_id) as province_id,
+               ANY_VALUE(province)    as province,
+               ANY_VALUE(city_id)     as city_id,
+               ANY_VALUE(city)        as city,
+               ANY_VALUE(region_id)   as region_id,
+               ANY_VALUE(region)      as region,
+               ANY_VALUE(town_id)     as town_id,
+               ANY_VALUE(town)        as town,
+               ANY_VALUE(village_id)  as village_id,
+               ANY_VALUE(village)     as village,
+               ANY_VALUE(now_in)      as now_in,
+               ANY_VALUE(create_by)   as create_by,
+               ANY_VALUE(create_time) as create_time,
+               ANY_VALUE(update_by)   as update_by,
+               ANY_VALUE(update_time) as update_time,
+               ANY_VALUE(status)      as status
         from czrk_jzdz
-        where 1=1 and status = #{status} and create_time &gt;= #{todayStartStr} and create_time &lt;= #{todayEndStr} and region_id = #{regionId}
+        where 1 = 1
+          and status = #{status}
+          and create_time &gt;= #{todayStartStr}
+          and create_time &lt;= #{todayEndStr}
+          and region_id = #{regionId}
         group by id_card
     </select>
 </mapper>

+ 25 - 5
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -39,6 +39,7 @@
         <result property="nowIn" column="now_in"/>
         <result property="remark" column="remark"/>
         <result property="gridId" column="grid_id"/>
+        <result property="gridName" column="grid_name"/>
         <result property="status" column="status"/>
         <result property="changUser" column="chang_user"/>
         <result property="changNikeUser" column="chang_nike_user"/>
@@ -72,6 +73,14 @@
         <result property="villageTownsXjd" column="villageTownsXjd"/>
         <result property="villageXjd" column="villageXjd"/>
         <result property="nowXjd" column="nowXjd"/>
+
+
+        <result property="villagerGroupIdJz" column="villagerGroupIdJz"/>
+        <result property="gridIdJz" column="gridIdJz"/>
+        <result property="villagerGroupJz" column="villagerGroupJz"/>
+        <result property="gridNameJz" column="gridNameJz"/>
+
+
         <collection property="czrkJzdzList" javaType="java.util.List" resultMap="CzrkJzdzResult"/>
     </resultMap>
 
@@ -117,13 +126,13 @@
     <sql id="selectCzrkVo">
         select id, user_name, gender, age, birthday,dept_id, id_card, phone_num, code, house_type, rlr,rlr_nike, rl_time, yhzgx
              , work_unit, province_id, province, city_id, city, region_id, region, village_towns_id, village_towns
-             , village_id, village, villager_group_id, villager_group, now_in, remark,grid_id, status,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time, create_by, create_time
+             , village_id, village, villager_group_id, villager_group, now_in, remark,grid_id,grid_name, status,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time, create_by, create_time
              , update_by, update_time, is_del, delete_reason,  is_rl, key_industries,key_category from czrk
     </sql>
 
     <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, code,is_rl,
+        villager_group,villager_group_id, house_type, code,is_rl,grid_name,grid_id,
         rlr,rlr_nike,now_in,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time,is_nucleicAcid,nucleicAcid_time,to_appropriate_phone,key_category
         from czrk
         <where>
@@ -153,6 +162,10 @@
             <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="isConfirm != null  and isConfirm != ''">and is_confirm = #{isConfirm}</if>
             <if test="gridId != null  and gridId != ''">and grid_id = #{gridId}</if>
             <if test="keyCategory != null  and keyCategory != ''">and  find_in_set(#{keyCategory}, key_category)</if>
@@ -163,8 +176,8 @@
 
     <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.is_rl, c.rlr,c.rlr_nike,
+        c.province, c.city ,c.region , c.village_towns, c.village ,c.now_in,c.grid_name,c.grid_id,c.villager_group_id,c.villager_group,
+        c.gender, c.house_type, c.update_by, c.code,c.is_rl, c.rlr,c.rlr_nike,
         c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time,c.key_category
         from czrk c left join czrk_jzdz z on c.id =z.czrk_id
         <where>
@@ -190,6 +203,10 @@
             <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>
+
+            <if test="villagerGroupIdJz != null and villagerGroupIdJz != ''">and z.villager_group_id = #{villagerGroupIdJz}</if>
+            <if test="gridIdJz != null and gridIdJz != ''">and z.grid_id = #{gridIdJz}</if>
+
             <if test="keyCategory != null  and keyCategory != ''">and  find_in_set(#{keyCategory}, key_category)</if>
         </where>
         order by c.create_time DESC
@@ -721,6 +738,7 @@
             <if test="nowIn != null">now_in,</if>
             <if test="remark != null">remark,</if>
             <if test="gridId != null">grid_id,</if>
+            <if test="gridName != null">grid_name,</if>
             <if test="status != null">status,</if>
             <if test="isConfirm != null">is_confirm,</if>
             <if test="confirmInfoUser != null and confirmInfoUser != ''">confirm_info_user,</if>
@@ -763,6 +781,7 @@
             <if test="nowIn != null">#{nowIn},</if>
             <if test="remark != null">#{remark},</if>
             <if test="gridId != null">#{gridId},</if>
+            <if test="gridName != null">#{gridName},</if>
             <if test="status != null">#{status},</if>
             <if test="isConfirm != null">#{isConfirm},</if>
             <if test="confirmInfoUser != null and confirmInfoUser != ''">#{confirmInfoUser},</if>
@@ -809,6 +828,7 @@
             <if test="nowIn != null">now_in = #{nowIn},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="gridId != null">grid_id = #{gridId},</if>
+            <if test="gridName != null">grid_name = #{gridName},</if>
             <if test="changUser != null">chang_user = #{changUser},</if>
             <if test="changNikeUser != null">chang_nike_user = #{changNikeUser},</if>
             <if test="status != null">status = #{status},</if>
@@ -1408,7 +1428,7 @@
     <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,
+        villageXjd,z.now_in,z.villager_group_id as villagerGroupIdJz,z.villager_group as villagerGroupJz,z.grid_id as gridIdJz,z.grid_name as gridNameJz,
         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,c.is_nucleicAcid,c.nucleicAcid_time,c.to_appropriate_phone
         from czrk c left join czrk_jzdz z on c.id =z.czrk_id

+ 164 - 0
boman-web-core/src/main/resources/mapper/QianshanGridMapper.xml

@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.boman.web.core.mapper.QianshanGridMapper">
+    
+    <resultMap type="com.boman.domain.QianshanGrid" id="QianshanGridResult">
+        <result property="id"    column="id"    />
+        <result property="gridName"    column="grid_name"    />
+        <result property="gridMember"    column="grid_member"    />
+        <result property="gridPhone"    column="grid_phone"    />
+        <result property="gridLevel"    column="grid_level"    />
+        <result property="parentGridId"    column="parent_grid_id"    />
+        <result property="parentGridName"    column="parent_grid_name"    />
+
+        <result property="regionId" column="region_id"/>
+        <result property="region" column="region"/>
+        <result property="villageTownsId" column="village_towns_id"/>
+        <result property="villageTowns" column="village_towns"/>
+        <result property="villageId" column="village_id"/>
+        <result property="village" column="village"/>
+
+        <result property="areaName"    column="area_name"    />
+        <result property="areaId"    column="area_id"    />
+        <result property="parentAreaId"    column="parent_area_id"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDel"    column="is_del"    />
+
+        <result property="num" column="num" />
+    </resultMap>
+
+    <sql id="selectQianshanGridVo">
+        select id, grid_name, grid_member, grid_phone, grid_level, parent_grid_id,parent_grid_name, region_id, region,
+               village_towns_id, village_towns, village_id, village, area_name, area_id, parent_area_id, create_by,
+               create_time, update_by, update_time, is_del
+        from qianshan_grid
+    </sql>
+
+    <select id="selectQianshanGridList" parameterType="com.boman.domain.QianshanGrid" resultMap="QianshanGridResult">
+        <include refid="selectQianshanGridVo"/>
+        <where>
+            <if test="gridName != null  and gridName != ''"> and grid_name like concat('%', #{gridName}, '%')</if>
+            <if test="gridMember != null  and gridMember != ''"> and grid_member = #{gridMember}</if>
+            <if test="gridPhone != null  and gridPhone != ''"> and grid_phone = #{gridPhone}</if>
+            <if test="gridLevel != null  and gridLevel != ''"> and grid_level = #{gridLevel}</if>
+            <if test="parentGridId != null  and parentGridId != ''"> and parent_grid_id = #{parentGridId}</if>
+            <if test="areaName != null  and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
+            <if test="areaId != null  and areaId != ''"> and area_id = #{areaId}</if>
+            <if test="parentAreaId != null  and parentAreaId != ''"> and parent_area_id = #{parentAreaId}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+        order by update_time
+    </select>
+    
+    <select id="selectQianshanGridById" parameterType="Long" resultMap="QianshanGridResult">
+        <include refid="selectQianshanGridVo"/>
+        where id = #{id}
+    </select>
+
+    <select id="validateHasChirld" parameterType="java.util.List" resultMap="QianshanGridResult">
+        SELECT a.id as id, count(1) as num FROM qianshan_grid a LEFT JOIN qianshan_grid b on a.id = b.parent_grid_id WHERE b.parent_grid_id in
+        <foreach collection="qianshanGrids" item="qianshanGrid" index="index" separator="," open="(" close=")">
+            #{qianshanGrid.id}
+        </foreach>
+        GROUP BY a.id
+    </select>
+
+
+    <insert id="insertQianshanGrid" parameterType="com.boman.domain.QianshanGrid">
+        insert into qianshan_grid
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="gridName != null">grid_name,</if>
+            <if test="gridMember != null">grid_member,</if>
+            <if test="gridPhone != null">grid_phone,</if>
+            <if test="gridLevel != null">grid_level,</if>
+            <if test="parentGridId != null">parent_grid_id,</if>
+
+            <if test="regionId != null">region_id,</if>
+            <if test="region != null">region,</if>
+            <if test="villageTownsId != null">village_towns_id,</if>
+            <if test="villageTowns != null">village_towns,</if>
+            <if test="villageId != null">village_id,</if>
+            <if test="village != null">village,</if>
+
+
+            <if test="areaName != null">area_name,</if>
+            <if test="areaId != null">area_id,</if>
+            <if test="parentAreaId != null">parent_area_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="isDel != null">is_del,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="gridName != null">#{gridName},</if>
+            <if test="gridMember != null">#{gridMember},</if>
+            <if test="gridPhone != null">#{gridPhone},</if>
+            <if test="gridLevel != null">#{gridLevel},</if>
+            <if test="parentGridId != null">#{parentGridId},</if>
+
+
+            <if test="regionId != null">#{regionId},</if>
+            <if test="region != null">#{region},</if>
+            <if test="villageTownsId != null">#{villageTownsId},</if>
+            <if test="villageTowns != null">#{villageTowns},</if>
+            <if test="villageId != null">#{villageId},</if>
+            <if test="village != null">#{village},</if>
+
+            <if test="areaName != null">#{areaName},</if>
+            <if test="areaId != null">#{areaId},</if>
+            <if test="parentAreaId != null">#{parentAreaId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="isDel != null">#{isDel},</if>
+         </trim>
+    </insert>
+
+    <update id="updateQianshanGrid" parameterType="com.boman.domain.QianshanGrid">
+        update qianshan_grid
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="gridName != null">grid_name = #{gridName},</if>
+            <if test="gridMember != null">grid_member = #{gridMember},</if>
+            <if test="gridPhone != null">grid_phone = #{gridPhone},</if>
+            <if test="gridLevel != null">grid_level = #{gridLevel},</if>
+            <if test="parentGridId != null">parent_grid_id = #{parentGridId},</if>
+
+            <if test="regionId != null">region_id = #{regionId},</if>
+            <if test="region != null">region = #{region},</if>
+            <if test="villageTownsId != null">village_towns_id = #{villageTownsId},</if>
+            <if test="villageTowns != null">village_towns = #{villageTowns},</if>
+            <if test="villageId != null">village_id = #{villageId},</if>
+            <if test="village != null">village = #{village},</if>
+
+            <if test="areaName != null">area_name = #{areaName},</if>
+            <if test="areaId != null">area_id = #{areaId},</if>
+            <if test="parentAreaId != null">parent_area_id = #{parentAreaId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="isDel != null">is_del = #{isDel},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteQianshanGridById" parameterType="Long">
+        delete from qianshan_grid where id = #{id}
+    </delete>
+
+    <delete id="deleteQianshanGridByIds" parameterType="String">
+        delete from qianshan_grid where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>