lin
2024-05-20 0814274c6ef53f39d9460e4d029717c9eff999e0
Merge remote-tracking branch 'origin/master'
20 files modified
2 files added
601 ■■■■ changed files
src/main/java/org/springblade/modules/doorplateAddress/controller/DoorplateAddressController.java 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/controller/HouseTenantController.java 51 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/controller/HouseholdController.java 13 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/excel/ExportHouseTenantExcel.java 93 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/excel/HouseTenantExcel.java 82 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseTenantMapper.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseTenantMapper.xml 23 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/IHouseTenantService.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/impl/HouseTenantServiceImpl.java 74 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/vo/HouseTenantVO.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/controller/PlaceController.java 13 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/controller/PoliceAffairsGridController.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/controller/PoliceStationController.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/mapper/PoliceAffairsGridMapper.java 7 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/mapper/PoliceAffairsGridMapper.xml 49 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/mapper/PoliceStationMapper.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/mapper/PoliceStationMapper.xml 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/service/IPoliceAffairsGridService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/service/IPoliceStationService.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/service/impl/PoliceAffairsGridServiceImpl.java 47 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/service/impl/PoliceStationServiceImpl.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/police/vo/PoliceAffairsGridVO.java 30 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/doorplateAddress/controller/DoorplateAddressController.java
@@ -68,7 +68,7 @@
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入doorplateAddress")
    public R<DoorplateAddressVO> detail(DoorplateAddressEntity doorplateAddress) {
        bladeLogger.info("blade-doorplateAddress_detail", JsonUtil.toJson(doorplateAddress));
        bladeLogger.info("门牌地址详情查询", JsonUtil.toJson(doorplateAddress));
        DoorplateAddressEntity detail = doorplateAddressService.getOne(Condition.getQueryWrapper(doorplateAddress));
        return R.data(DoorplateAddressWrapper.build().entityVO(detail));
    }
@@ -79,7 +79,7 @@
    @GetMapping("/getDetail")
    @ApiLog("门牌地址表(总台账数据) 自定义详情")
    public R getDetail(DoorplateAddressVO doorplateAddress) {
        bladeLogger.info("blade-doorplateAddress_getDetail", JsonUtil.toJson(doorplateAddress));
        bladeLogger.info("门牌地址详情查询", JsonUtil.toJson(doorplateAddress));
        return R.data(doorplateAddressService.getDetail(doorplateAddress));
    }
@@ -155,7 +155,7 @@
    @GetMapping("/getFuncList")
    @ApiLog("根据角色获取功能集合数据")
    public R getFuncList(Integer type,String roleName) {
        bladeLogger.info("blade-doorplateAddress_getFuncList", JsonUtil.toJson(ToObject.toMap("type:" + type,"roleName:"+ roleName)));
        bladeLogger.info("根据角色获取功能集合数据", JsonUtil.toJson(ToObject.toMap("type:" + type,"roleName:"+ roleName)));
        return R.data(doorplateAddressService.getFuncList(type,roleName));
    }
src/main/java/org/springblade/modules/house/controller/HouseTenantController.java
@@ -16,25 +16,33 @@
 */
package org.springblade.modules.house.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.house.entity.HouseTenantEntity;
import org.springblade.modules.house.excel.ExportHouseTenantExcel;
import org.springblade.modules.house.excel.HouseTenantExcel;
import org.springblade.modules.house.excel.ImportHouseholdExcel;
import org.springblade.modules.house.service.IHouseTenantService;
import org.springblade.modules.house.vo.HouseTenantVO;
import org.springblade.modules.house.wrapper.HouseTenantWrapper;
import org.springblade.modules.house.service.IHouseTenantService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
/**
 * 租户管理 控制器
@@ -122,5 +130,32 @@
        return R.status(houseTenantService.removeByIds(Func.toLongList(ids)));
    }
    @GetMapping("downLoadTenantTemplate")
    @ApiOperationSupport(order = 14)
    @ApiOperation(value = "导出模板")
    public void downLoadTenantTemplate(HttpServletResponse response) {
        List<HouseTenantExcel> list = new ArrayList<>();
        ExcelUtil.export(response, "租客数据模板", "租客数据表", list, HouseTenantExcel.class);
    }
    @GetMapping("export-tenant")
    @ApiOperationSupport(order = 15)
    @ApiOperation(value = "导出租客")
    public void exportTenant(HttpServletResponse response) {
        List<ExportHouseTenantExcel> list = houseTenantService.export();
        ExcelUtil.export(response, "租客数据" + DateUtil.time(), "租客数据表", list, ExportHouseTenantExcel.class);
    }
    /**
     * 导入住户
     */
    @PostMapping("import-tenant")
    @ApiOperationSupport(order = 12)
    @ApiOperation(value = "导入住户", notes = "传入excel")
    public R importUser(MultipartFile file, Integer isCovered) {
        String data = houseTenantService.importUserTenant(ExcelUtil.read(file, HouseTenantExcel.class),isCovered==1);
        return R.data(200,data,null);
    }
}
src/main/java/org/springblade/modules/house/controller/HouseholdController.java
@@ -72,7 +72,7 @@
    @ApiLog("住户 详情")
    @ApiOperation(value = "详情", notes = "传入household")
    public R<HouseholdVO> detail(HouseholdEntity household) {
        bladeLogger.info("住户 详情", JsonUtil.toJson(household));
        bladeLogger.info("住户详情查询", JsonUtil.toJson(household));
        HouseholdEntity detail = householdService.getOne(Condition.getQueryWrapper(household).last("limit 1"));
        return R.data(HouseholdWrapper.build().entityVO(detail));
    }
@@ -87,7 +87,7 @@
    @ApiLog("住户 详情")
    @ApiOperation(value = "详情", notes = "传入household")
    public R getDetail(HouseholdEntity household) {
        bladeLogger.info("住户 详情", JsonUtil.toJson(household));
        bladeLogger.info("住户详情查询", JsonUtil.toJson(household));
        return R.data(householdService.getDetail(household));
    }
@@ -110,7 +110,7 @@
    @ApiLog("住户 自定义分页")
    @ApiOperation(value = "分页", notes = "传入household")
    public R<IPage<HouseholdVO>> page(HouseholdVO household, Query query) {
        bladeLogger.info("住户 自定义分页", JsonUtil.toJson(household));
        bladeLogger.info("住户列表信息查询", JsonUtil.toJson(household));
        IPage<HouseholdVO> pages = householdService.selectHouseholdPage(Condition.getPage(query), household);
        return R.data(pages);
    }
@@ -123,7 +123,7 @@
    @ApiLog("住户 自定义分页")
    @ApiOperation(value = "分页", notes = "传入household")
    public R<IPage<HouseholdVO>> getKeynotePersonnelPage(HouseholdVO household, Query query) {
        bladeLogger.info("住户 自定义分页", JsonUtil.toJson(household));
        bladeLogger.info("住户列表信息查询", JsonUtil.toJson(household));
        IPage<HouseholdVO> pages = householdService.getKeynotePersonnelPage(Condition.getPage(query), household);
        return R.data(pages);
    }
@@ -195,7 +195,7 @@
    @ApiLog("住户 自定义新增或修改")
    @ApiOperation(value = "自定义新增或修改", notes = "传入household")
    public R saveOrUpdateHousehold(@Valid @RequestBody HouseholdVO household) {
        bladeLogger.info("住户 自定义新增或修改", JsonUtil.toJson(household));
        bladeLogger.info("住户信息新增或修改", JsonUtil.toJson(household));
        return R.status(householdService.saveOrUpdateHousehold(household));
    }
@@ -208,7 +208,7 @@
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    @Transactional(rollbackFor = Exception.class)
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        bladeLogger.info("住户 删除", JsonUtil.toJson(ids));
        bladeLogger.info("住户信息删除", JsonUtil.toJson(ids));
        // 返回
        return R.status(householdService.removeHousehold(ids));
    }
@@ -232,6 +232,7 @@
    @ApiOperationSupport(order = 12)
    @ApiOperation(value = "导入住户", notes = "传入excel")
    public R importUser(MultipartFile file, Integer isCovered) {
        bladeLogger.info("住户信息导入", JsonUtil.toJson(isCovered));
        String data = householdService.importUserHouseHold(ExcelUtil.read(file, ImportHouseholdExcel.class),isCovered==1);
        return R.data(200,data,null);
    }
src/main/java/org/springblade/modules/house/excel/ExportHouseTenantExcel.java
New file
@@ -0,0 +1,93 @@
package org.springblade.modules.house.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.common.excel.ExcelDictConverter;
import org.springblade.common.excel.ExcelDictItem;
import java.io.Serializable;
import java.util.Date;
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class ExportHouseTenantExcel implements Serializable {
    private static final long serialVersionUID = 2L;
    /**
     * 出租屋ID
     */
    @ExcelProperty(value = "房屋地址")
    @ColumnWidth(25)
    private String addressName;
    /**
     * 出租屋ID
     */
    @ExcelProperty(value = "地址编码")
    @ColumnWidth(25)
    private String houseCode;
    /**
     * 姓名
     */
    @ExcelProperty(value = "姓名")
    @ColumnWidth(25)
    private String name;
    /**
     * 联系电话
     */
    @ExcelProperty(value = "联系电话")
    @ColumnWidth(25)
    private String phone;
    /**
     * 身份证
     */
    @ExcelProperty(value = "身份证")
    @ColumnWidth(25)
    private String idCard;
    /**
     * 户籍
     */
    @ExcelProperty(value = "户籍")
    @ColumnWidth(25)
    private String domicile;
    /**
     * 工作单位
     */
    @ExcelProperty(value = "工作单位")
    @ColumnWidth(25)
    private String workUnit;
    /**
     * 备注
     */
    @ExcelProperty(value = "备注")
    @ColumnWidth(25)
    private String remark;
    /** 性别 */
    @ExcelProperty(value = "性别",converter = ExcelDictConverter.class)
    @ExcelDictItem(type = "sex")
    @ColumnWidth(25)
    private Integer gender;
    /** 民族 */
    @ExcelProperty(value = "民族",converter = ExcelDictConverter.class)
    @ExcelDictItem(type = "nationType")
    private Integer ethnicity;
    /** 创建时间 */
    @ExcelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
src/main/java/org/springblade/modules/house/excel/HouseTenantExcel.java
New file
@@ -0,0 +1,82 @@
package org.springblade.modules.house.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.springblade.common.excel.ExcelDictConverter;
import org.springblade.common.excel.ExcelDictItem;
import org.springblade.common.excel.ExcelDictItemLabel;
import java.io.Serializable;
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class HouseTenantExcel implements Serializable {
    private static final long serialVersionUID = 2L;
    /**
     * 出租屋ID
     */
    @ExcelProperty(value = "地址编码")
    @ColumnWidth(25)
    private String houseCode;
    /**
     * 姓名
     */
    @ExcelProperty(value = "姓名")
    @ColumnWidth(25)
    private String name;
    /**
     * 联系电话
     */
    @ExcelProperty(value = "联系电话")
    @ColumnWidth(25)
    private String phone;
    /**
     * 身份证
     */
    @ExcelProperty(value = "身份证")
    @ColumnWidth(25)
    private String idCard;
    /**
     * 户籍
     */
    @ExcelProperty(value = "户籍")
    @ColumnWidth(25)
    private String domicile;
    /**
     * 工作单位
     */
    @ExcelProperty(value = "工作单位")
    @ColumnWidth(25)
    private String workUnit;
    /**
     * 备注
     */
    @ExcelProperty(value = "备注")
    @ColumnWidth(25)
    private String remark;
    /** 性别 1: 男 0:女  2: 未知 */
    @ColumnWidth(15)
    @ExcelProperty( value = "性别",converter = ExcelDictConverter.class)
    @ExcelDictItemLabel(type = "sex")
    @ExcelDictItem(type = "sex")
    private String gender;
    /** 民族 */
    @ColumnWidth(15)
    @ExcelProperty( value = "民族",converter = ExcelDictConverter.class)
    @ExcelDictItemLabel(type = "nationType")
    @ExcelDictItem(type = "nationType")
    private String ethnicity;
}
src/main/java/org/springblade/modules/house/mapper/HouseTenantMapper.java
@@ -18,6 +18,8 @@
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.house.entity.HouseTenantEntity;
import org.springblade.modules.house.excel.ExportHouseTenantExcel;
import org.springblade.modules.house.excel.HouseTenantExcel;
import org.springblade.modules.house.vo.HouseTenantVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -46,4 +48,10 @@
     * @return
     */
    int removeByHousingRentalId(@Param("housingRentalId") Long housingRentalId);
    /**
     * 导出租客
     * @return
     */
    List<ExportHouseTenantExcel> export();
}
src/main/java/org/springblade/modules/house/mapper/HouseTenantMapper.xml
@@ -55,6 +55,29 @@
        </where>
    </select>
    <select id="export" resultType="org.springblade.modules.house.excel.ExportHouseTenantExcel">
        SELECT
            jhr.house_code,
            jda.address_name,
            jht.NAME,
            jht.phone,
            jht.id_card,
            jht.domicile,
            jht.work_unit,
            jht.remark,
            jht.gender,
            jht.ethnicity,
            jht.create_time
        FROM
            jczz_house_tenant jht
                LEFT JOIN jczz_house_rental jhr ON jht.housing_rental_id = jhr.id
                LEFT JOIN jczz_doorplate_address jda on jda.address_code=jhr.house_code
        WHERE
            jht.is_deleted = 0
    </select>
    <!--根据租房id删除租户信息-->
    <update id="removeByHousingRentalId">
        update jczz_house_tenant set is_deleted = 1 where housing_rental_id = #{housingRentalId}
src/main/java/org/springblade/modules/house/service/IHouseTenantService.java
@@ -18,9 +18,13 @@
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.house.entity.HouseTenantEntity;
import org.springblade.modules.house.excel.ExportHouseTenantExcel;
import org.springblade.modules.house.excel.HouseTenantExcel;
import org.springblade.modules.house.vo.HouseTenantVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 租户管理 服务类
@@ -45,4 +49,12 @@
     * @return
     */
    int removeByHousingRentalId(Long id);
    /**
     * 导出租客
     * @return
     */
    List<ExportHouseTenantExcel> export();
    String importUserTenant(List<HouseTenantExcel> read, boolean b);
}
src/main/java/org/springblade/modules/house/service/impl/HouseTenantServiceImpl.java
@@ -16,14 +16,25 @@
 */
package org.springblade.modules.house.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.house.entity.HouseTenantEntity;
import org.springblade.modules.house.vo.HouseTenantVO;
import org.springblade.modules.house.mapper.HouseTenantMapper;
import org.springblade.modules.house.service.IHouseTenantService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.logging.log4j.util.Strings;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.house.entity.HouseRentalEntity;
import org.springblade.modules.house.entity.HouseTenantEntity;
import org.springblade.modules.house.excel.ExportHouseTenantExcel;
import org.springblade.modules.house.excel.HouseTenantExcel;
import org.springblade.modules.house.mapper.HouseTenantMapper;
import org.springblade.modules.house.service.IHouseRentalService;
import org.springblade.modules.house.service.IHouseTenantService;
import org.springblade.modules.house.vo.HouseTenantVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
 * 租户管理 服务实现类
@@ -34,6 +45,9 @@
@Service
public class HouseTenantServiceImpl extends ServiceImpl<HouseTenantMapper, HouseTenantEntity> implements IHouseTenantService {
    @Autowired
    private IHouseRentalService iHouseRentalService;
    @Override
    public IPage<HouseTenantVO> selectHouseTenantPage(IPage<HouseTenantVO> page, HouseTenantVO houseTenant) {
        return page.setRecords(baseMapper.selectHouseTenantPage(page, houseTenant));
@@ -41,6 +55,7 @@
    /**
     * 根据租房id删除租户信息
     *
     * @param id
     * @return
     */
@@ -48,4 +63,49 @@
    public int removeByHousingRentalId(Long id) {
        return baseMapper.removeByHousingRentalId(id);
    }
    /**
     * 导出租客
     *
     * @return
     */
    @Override
    public List<ExportHouseTenantExcel> export() {
        return baseMapper.export();
    }
    @Override
    public String importUserTenant(List<HouseTenantExcel> data, boolean b) {
        List<HouseTenantEntity> HouseTenantList = new ArrayList<>();
        int totalNum = data.size();
        int importNum = 0;
        int updateNum = 0;
        int errorNum = 0;
        for (HouseTenantExcel houseHoldExcel : data) {
            HouseTenantVO houseTenantVO = Objects.requireNonNull(BeanUtil.copy(houseHoldExcel, HouseTenantVO.class));
            HouseRentalEntity houseRentalEntity = iHouseRentalService.getOne(Wrappers.<HouseRentalEntity>lambdaQuery()
                .eq(HouseRentalEntity::getHouseCode, houseTenantVO.getHouseCode()));
            if (houseRentalEntity != null) {
                // 性别
                if (!Strings.isBlank(houseHoldExcel.getGender())) {
                    houseTenantVO.setGender(Integer.valueOf(houseHoldExcel.getGender()));
                }
                houseTenantVO.setHousingRentalId(houseRentalEntity.getId());
                HouseTenantList.add(houseTenantVO);
            } else {
                errorNum++;
            }
        }
        importNum = saveBatch(HouseTenantList) ? HouseTenantList.size() : 0;
        StringBuilder builder = new StringBuilder("导入完成!");
        builder.append("其中本次表格共有 ").append(totalNum).append(" 条数据,")
            .append("成功导入 ").append(importNum).append(" 条数据。");
        // if (updateNum > 0) {
        //     builder.append("其中有 ").append(updateNum).append(" 条数据已存在。");
        // }
        if (errorNum > 0) {
            builder.append("共有 ").append(errorNum).append(" 条数据由于查询不到出租屋信息未导入!");
        }
        return builder.toString();
    }
}
src/main/java/org/springblade/modules/house/vo/HouseTenantVO.java
@@ -16,6 +16,7 @@
 */
package org.springblade.modules.house.vo;
import io.swagger.annotations.ApiModelProperty;
import org.springblade.modules.house.entity.HouseTenantEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
@@ -32,4 +33,6 @@
public class HouseTenantVO extends HouseTenantEntity {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "地址编码")
    private String houseCode;
}
src/main/java/org/springblade/modules/place/controller/PlaceController.java
@@ -91,7 +91,7 @@
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页page", notes = "传入place")
    public R<IPage<PlaceVO>> page(PlaceVO place, Query query) {
        bladeLogger.info("blade-place_page", JsonUtil.toJson(place));
        bladeLogger.info("场所列表查询", JsonUtil.toJson(place));
        IPage<PlaceVO> pages = placeService.selectPlacePage(Condition.getPage(query), place);
        return R.data(pages);
    }
@@ -104,7 +104,7 @@
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "九小场所档案", notes = "传入place")
    public R<IPage<PlaceVO>> ninePage(PlaceVO place, Query query) {
        bladeLogger.info("blade-place_ninePage", JsonUtil.toJson(place));
        bladeLogger.info("九小场所档案列表查询", JsonUtil.toJson(place));
        IPage<PlaceVO> pages = placeService.selectNinePlacePage(Condition.getPage(query), place);
        return R.data(pages);
    }
@@ -117,7 +117,7 @@
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "企业商超列表查询", notes = "传入place")
    public R<IPage<PlaceVO>> mallPage(PlaceVO place, Query query) {
        bladeLogger.info("blade-place_mallPage", JsonUtil.toJson(place));
        bladeLogger.info("企业商超列表查询", JsonUtil.toJson(place));
        IPage<PlaceVO> pages = placeService.selectMallPage(Condition.getPage(query), place);
        return R.data(pages);
    }
@@ -141,7 +141,7 @@
    @ApiLog("场所自定义新增")
    @ApiOperation(value = "自定义新增", notes = "传入place")
    public R add(@RequestBody PlaceVO placeVO){
        bladeLogger.info("场所自定义新增", JsonUtil.toJson(placeVO));
        bladeLogger.info("场所信息采集/修改", JsonUtil.toJson(placeVO));
        return R.status(placeService.addOrUpdate(placeVO));
    }
@@ -155,7 +155,7 @@
    @ApiLog("场所自定义新增/修改")
    @ApiOperation(value = "自定义新增/修改", notes = "传入place")
    public R addOrUpdate(@RequestBody PlaceVO placeVO){
        bladeLogger.info("场所自定义新增/修改", JsonUtil.toJson(placeVO));
        bladeLogger.info("场所信息采集/修改", JsonUtil.toJson(placeVO));
        return R.status(placeService.addOrUpdate(placeVO));
    }
@@ -245,7 +245,7 @@
    @ApiLog("场所表 自定义详情查询")
    @ApiOperation(value = "场所表 自定义详情查询", notes = "传入ids")
    public R<PlaceVO> getDetail(PlaceVO place) {
        bladeLogger.info("场所表 自定义详情查询", JsonUtil.toJson(place));
        bladeLogger.info("场所表详情查询", JsonUtil.toJson(place));
        return R.data(placeService.getDetail(place));
    }
@@ -255,6 +255,7 @@
     */
    @PostMapping("/import-place")
    public R importPlace(MultipartFile file, Integer isCovered) {
        bladeLogger.info("场所信息批量导入", JsonUtil.toJson(isCovered));
        String data = placeService.importPlace(ExcelUtil.read(file, ImportPlaceExcel.class),isCovered==1);
        return R.data(200,data,"");
    }
src/main/java/org/springblade/modules/police/controller/PoliceAffairsGridController.java
@@ -1,19 +1,3 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.police.controller;
import io.swagger.annotations.Api;
@@ -22,24 +6,21 @@
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.police.excel.PoliceAffairsGridExcel;
import org.springblade.modules.police.excel.PoliceAffairsGridImporter;
import org.springblade.modules.police.excel.PoliceStationExcel;
import org.springblade.modules.police.excel.PoliceStationImporter;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.modules.police.vo.PoliceAffairsGridVO;
import org.springblade.modules.police.wrapper.PoliceAffairsGridWrapper;
import org.springblade.modules.police.service.IPoliceAffairsGridService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.multipart.MultipartFile;
/**
@@ -55,6 +36,7 @@
public class PoliceAffairsGridController {
    private final IPoliceAffairsGridService policeAffairsGridService;
    private final BladeLogger bladeLogger;
    /**
     * 警务网格(辖区)表 详情
@@ -109,6 +91,17 @@
    }
    /**
     * 警务网格(辖区)表 自定义新增或修改
     */
    @PostMapping("/saveOrUpdate")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "自定义新增或修改", notes = "传入policeAffairsGrid")
    public R saveOrUpdate(@Valid @RequestBody PoliceAffairsGridEntity policeAffairsGrid) {
        bladeLogger.info("警务网格(辖区)表 自定义新增或修改",JsonUtil.toJson(policeAffairsGrid));
        return R.status(policeAffairsGridService.saveOrUpdatePoliceAffairsGrid(policeAffairsGrid));
    }
    /**
     * 警务网格(辖区)表 新增或修改
     */
    @PostMapping("/submit")
src/main/java/org/springblade/modules/police/controller/PoliceStationController.java
@@ -117,5 +117,12 @@
        return R.success("操作成功");
    }
    /**
     * 派出所树查询
     */
    @GetMapping("/tree")
    public R tree(PoliceStationEntity policeStation) {
        return R.data(policeStationService.tree(policeStation));
    }
}
src/main/java/org/springblade/modules/police/mapper/PoliceAffairsGridMapper.java
@@ -38,7 +38,12 @@
     * @param policeAffairsGrid
     * @return
     */
    List<PoliceAffairsGridVO> selectPoliceAffairsGridPage(IPage page, PoliceAffairsGridVO policeAffairsGrid);
    List<PoliceAffairsGridVO> selectPoliceAffairsGridPage(IPage page,
                                                          @Param("policeAffairsGrid") PoliceAffairsGridVO policeAffairsGrid,
                                                          @Param("isAdministrator") Integer isAdministrator,
                                                          @Param("regionChildCodesList") List<String> regionChildCodesList,
                                                          @Param("gridCodeList") List<String> gridCodeList
    );
    /**
     * 空间分析
src/main/java/org/springblade/modules/police/mapper/PoliceAffairsGridMapper.xml
@@ -3,7 +3,7 @@
<mapper namespace="org.springblade.modules.police.mapper.PoliceAffairsGridMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="policeAffairsGridResultMap" type="org.springblade.modules.police.entity.PoliceAffairsGridEntity">
    <resultMap id="policeAffairsGridResultMap" type="org.springblade.modules.police.vo.PoliceAffairsGridVO">
        <result column="id" property="id"/>
        <result column="object_id" property="objectId"/>
        <result column="jws_code" property="jwsCode"/>
@@ -24,9 +24,54 @@
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <!--自定义分页查询-->
    <select id="selectPoliceAffairsGridPage" resultMap="policeAffairsGridResultMap">
        select * from jczz_police_affairs_grid where is_deleted = 0
        <if test="policeAffairsGrid.communityName!=null and policeAffairsGrid.communityName!=''">
            and community_name like concat('%',#{policeAffairsGrid.communityName},'%')
        </if>
        <if test="policeAffairsGrid.jwGridCode!=null and policeAffairsGrid.jwGridCode!=''">
            and jw_grid_code like concat('%',#{policeAffairsGrid.jwGridCode},'%')
        </if>
        <if test="policeAffairsGrid.pcsCode!=null and policeAffairsGrid.pcsCode!=''">
            and pcs_code like concat('%',#{policeAffairsGrid.pcsCode},'%')
        </if>
        <if test="policeAffairsGrid.pcsName!=null and policeAffairsGrid.pcsName!=''">
            and pcs_name like concat('%',#{policeAffairsGrid.pcsName},'%')
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="policeAffairsGrid.roleName != null and policeAffairsGrid.roleName != ''">
                    <if test="policeAffairsGrid.roleName=='mj'">
                        <choose>
                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                and community_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                            </when>
                            <otherwise>
                                and community_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                </when>
                <otherwise>
                    <choose>
                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                            and community_code in
                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                #{code}
                            </foreach>
                        </when>
                        <otherwise>
                            and community_code in ('')
                        </otherwise>
                    </choose>
                </otherwise>
            </choose>
        </if>
        order by id desc,pcs_code desc
    </select>
    <!--判断该点在哪个警务网格-->
src/main/java/org/springblade/modules/police/mapper/PoliceStationMapper.java
@@ -16,11 +16,15 @@
 */
package org.springblade.modules.police.mapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springblade.common.node.TreeStringNode;
import org.springblade.modules.police.entity.PoliceStationEntity;
import org.springblade.modules.police.vo.PoliceStationVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
/**
 * 派出所信息表 Mapper 接口
@@ -39,5 +43,11 @@
     */
    List<PoliceStationVO> selectPoliceStationPage(IPage page, PoliceStationVO policeStation);
    /**
     * 派出所树查询
     * @param policeStation
     * @return
     */
    @MapKey(value = "id")
    Map<String, TreeStringNode> tree(@Param("policeStation") PoliceStationEntity policeStation);
}
src/main/java/org/springblade/modules/police/mapper/PoliceStationMapper.xml
@@ -22,5 +22,14 @@
        select * from jczz_police_station where is_deleted = 0
    </select>
    <!--派出所树查询-->
    <select id="tree" resultType="org.springblade.common.node.TreeStringNode">
        SELECT
        code as id,
        parent_code as parentId,
        name
        FROM jczz_police_station
    </select>
</mapper>
src/main/java/org/springblade/modules/police/service/IPoliceAffairsGridService.java
@@ -46,4 +46,11 @@
     * @return
     */
    List<String> getCommunityCodeListByUserId(Long userId);
    /**
     * 警务网格(辖区)表 自定义新增或修改
     * @param policeAffairsGrid
     * @return
     */
    boolean saveOrUpdatePoliceAffairsGrid(PoliceAffairsGridEntity policeAffairsGrid);
}
src/main/java/org/springblade/modules/police/service/IPoliceStationService.java
@@ -1,6 +1,7 @@
package org.springblade.modules.police.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.common.node.TreeStringNode;
import org.springblade.modules.police.entity.PoliceStationEntity;
import org.springblade.modules.police.excel.PoliceStationExcel;
import org.springblade.modules.police.vo.PoliceStationVO;
@@ -32,4 +33,11 @@
     * @param isCovered
     */
    void importPoliceStation(List<PoliceStationExcel> data, Boolean isCovered);
    /**
     * 派出所树查询
     * @param policeStation
     * @return
     */
    List<TreeStringNode> tree(PoliceStationEntity policeStation);
}
src/main/java/org/springblade/modules/police/service/impl/PoliceAffairsGridServiceImpl.java
@@ -2,9 +2,13 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.param.CommonParamSet;
import org.springblade.common.utils.SpringUtils;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.modules.community.entity.CommunityEntity;
import org.springblade.modules.community.service.ICommunityService;
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.modules.police.entity.PoliceStationEntity;
import org.springblade.modules.police.excel.PoliceAffairsGridExcel;
@@ -32,7 +36,13 @@
    @Override
    public IPage<PoliceAffairsGridVO> selectPoliceAffairsGridPage(IPage<PoliceAffairsGridVO> page, PoliceAffairsGridVO policeAffairsGrid) {
        return page.setRecords(baseMapper.selectPoliceAffairsGridPage(page, policeAffairsGrid));
        CommonParamSet commonParamSet = new CommonParamSet<>().invoke(PoliceAffairsGridVO.class, policeAffairsGrid);
        return page.setRecords(baseMapper.selectPoliceAffairsGridPage(page,
            policeAffairsGrid,
            commonParamSet.getIsAdministrator(),
            commonParamSet.getRegionChildCodesList(),
            commonParamSet.getGridCodeList()
        ));
    }
    /**
@@ -80,4 +90,39 @@
    public List<String> getCommunityCodeListByUserId(Long userId) {
        return baseMapper.getCommunityCodeListByUserId(userId.toString());
    }
    /**
     * 警务网格(辖区)表 自定义新增或修改
     * @param policeAffairsGrid
     * @return
     */
    @Override
    public boolean saveOrUpdatePoliceAffairsGrid(PoliceAffairsGridEntity policeAffairsGrid) {
        boolean flag = false;
        // 查询对应的派出所及社区名称
        IPoliceStationService policeStationService = SpringUtils.getBean(IPoliceStationService.class);
        QueryWrapper<PoliceStationEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("code",policeAffairsGrid.getPcsCode());
        List<PoliceStationEntity> policeStationEntityList = policeStationService.list(queryWrapper);
        if (policeStationEntityList.size()>0){
            policeAffairsGrid.setPcsName(policeStationEntityList.get(0).getName());
        }
        ICommunityService communityService = SpringUtils.getBean(ICommunityService.class);
        QueryWrapper<CommunityEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("code",policeAffairsGrid.getCommunityCode());
        List<CommunityEntity> communityEntityList = communityService.list(wrapper);
        if (communityEntityList.size()>0){
            policeAffairsGrid.setCommunityName(communityEntityList.get(0).getName());
        }
        if (null!=policeAffairsGrid.getId()){
            policeAffairsGrid.setGeom(null);
            // 更新
            flag = updateById(policeAffairsGrid);
        }else {
            policeAffairsGrid.setGeom(null);
            // 新增
            flag = save(policeAffairsGrid);
        }
        return flag;
    }
}
src/main/java/org/springblade/modules/police/service/impl/PoliceStationServiceImpl.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.node.TreeStringNode;
import org.springblade.common.utils.NodeTreeUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.police.entity.PoliceStationEntity;
import org.springblade.modules.police.excel.PoliceStationExcel;
@@ -59,4 +61,14 @@
            }
        }
    }
    /**
     * 派出所树查询
     * @param policeStation
     * @return
     */
    @Override
    public List<TreeStringNode> tree(PoliceStationEntity policeStation) {
        return NodeTreeUtil.getStringNodeTree(baseMapper.tree(policeStation));
    }
}
src/main/java/org/springblade/modules/police/vo/PoliceAffairsGridVO.java
@@ -1,23 +1,7 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.police.vo;
import io.swagger.annotations.ApiModelProperty;
import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -32,4 +16,16 @@
public class PoliceAffairsGridVO extends PoliceAffairsGridEntity {
    private static final long serialVersionUID = 1L;
    /**
     * 社区编号
     */
    @ApiModelProperty(value = "社区编号")
    private String communityCode;
    /**
     * 角色别名
     */
    @ApiModelProperty(value = "角色别名")
    private String roleName;
}