Browse Source

小区,楼宇,房屋管理新增,修改,查询,删除,导入,导出接口

dev_shibei_match
lzh 4 years ago
parent
commit
6ccee69563
  1. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java
  2. 15
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java
  3. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java
  4. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java
  5. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java
  6. 8
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java
  7. 70
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  8. 81
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  9. 98
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  10. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  11. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcBuildingExcel.java
  12. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcHouseExcel.java
  13. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcNeighborHoodExcel.java
  14. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  15. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  16. 119
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  17. 93
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  18. 160
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  19. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ExcelPoiUtils.java
  20. 31
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ExcelVerifyInfo.java
  21. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_export.xlsx
  22. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_export.xlsx
  23. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/neighbor_export.xlsx
  24. 86
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  25. 137
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  26. 48
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java

@ -6,10 +6,10 @@ package com.epmet.constant;
*/
public interface NeighborhoodConstant {
String NEIGHBOR_HOOD= "neighbourHood";
String GRID = "grid";
String NEIGHBOR_HOOD= "neighbourHood";
String BUILDING = "building";
String HOUSE = "house";
}

15
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java

@ -24,6 +24,7 @@ import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ -74,43 +75,43 @@ public class IcBulidingFormDTO implements Serializable {
/**
* 排序
*/
@NotBlank(message = "排序不能为空", groups = { UpdateGroup.class})
@NotNull(message = "排序不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer sort = 0;
/**
* 总单元数
*/
@NotBlank(message = "总单元数不能为空", groups = {AddGroup.class, UpdateGroup.class})
@NotNull(message = "总单元数不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer totalUnitNum=1;
/**
* 总楼层总数
*/
@NotBlank(message = "总楼层总数不能为空", groups = {AddGroup.class, UpdateGroup.class})
@NotNull(message = "总楼层总数不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer totalFloorNum;
/**
* 总户数
*/
@NotBlank(message = "总户数不能为空", groups = {AddGroup.class, UpdateGroup.class})
@NotNull(message = "总户数不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer totalHouseNum;
/**
* 坐标位置
*/
@NotBlank(message = "坐标位置不能为空", groups = { UpdateGroup.class})
private String location;
/**
* 中心点位经度
*/
@NotBlank(message = "经度不能为空", groups = {UpdateGroup.class})
private String longitude;
/**
* 中心点位纬度
*/
@NotBlank(message = "维度不能为空", groups = {UpdateGroup.class})
private String latitude;

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java

@ -21,9 +21,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ -77,8 +77,8 @@ public class IcHouseFormDTO implements Serializable {
/**
* 1出租0未出租
*/
@NotBlank(message = "是否出租不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Boolean rentFlag;
@NotNull(message = "是否出租不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer rentFlag;
/**
* 房主姓名

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java

@ -94,13 +94,13 @@ public class IcNeighborHoodFormDTO implements Serializable {
/**
* 中心点位经度
*/
@NotBlank(message = "经度不能为空", groups = {UpdateGroup.class})
private String longitude;
/**
* 中心点位纬度
*/
@NotBlank(message = "纬度不能为空", groups = {UpdateGroup.class})
private String latitude;

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java

@ -70,11 +70,11 @@ public class ListIcNeighborHoodFormDTO implements Serializable{
/**
* 楼栋ID
*/
// private String buildingId;
private String buildingId;
/**
* 小区ID
*/
// private String neighborHoodId;
private String neighborHoodId;
}

8
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java

@ -22,10 +22,10 @@ public class IcNeighborHoodResultDTO implements Serializable {
* */
private Long total;
/**
* 数据类型小区neighbourHood楼栋building房屋house
* */
private String dataType;
// /**
// * 数据类型【小区:neighbourHood,楼栋:building,房屋:house】
// * */
// private String dataType;
/**
* 结果集

70
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java

@ -17,29 +17,43 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.NeighborhoodConstant;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcHouseExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.service.BuildingService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.IcNeighborHoodService;
import com.epmet.service.NeighborHoodService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -70,7 +84,7 @@ public class BuildingController {
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = buildingService.listBuilding(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
}
@ -110,6 +124,60 @@ public class BuildingController {
List<BuildingTreeLevelDTO> buildingTreeLevelDTOS =buildingService.treeList(tokenDTO.getUserId());
return new Result().ok(buildingTreeLevelDTOS);
}
/**
* 导出模板
* @param formDTO
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
public void exportTemplate(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/building_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcBuildingExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"楼宇信息录入表",response);
}
/**
* 导出
* @param formDTO
* @param response
* @throws Exception
*/
@RequestMapping("exportbuildinginfo")
public void exportbuildinginfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
buildingService.exportBuildinginfo(formDTO,response);
}
/**
* 导入数据
* @param file
* @return
* @throws IOException
*/
@PostMapping("import")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException {
// String customerId = tokenDTO.getCustomerId();
String customerId = "123123";
ExcelImportResult<IcBuildingExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcBuildingExcel.class);
List<IcBuildingExcel> failList = importResult.getFailList();
if(!CollectionUtils.isEmpty(failList)){
for ( IcBuildingExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
}
return new Result().error(8000,failList.get(0).getErrorMsg());
}
List<IcBuildingExcel> result =importResult.getList();
buildingService.importExcel(customerId,result);
return new Result().ok("导入成功");
}
}

81
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -17,24 +17,40 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.NeighborhoodConstant;
import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcHouseExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.service.HouseService;
import com.epmet.service.NeighborHoodService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -60,7 +76,7 @@ public class HouseController {
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = houseService.listNeighborhood(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
}
@ -93,5 +109,60 @@ public class HouseController {
houseService.delHouse(formDTO.getHouseId());
return new Result();
}
/**
* 导出模板
* @param formDTO
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
public void exportTemplate(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/house_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcHouseExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"房屋信息录入表",response);
}
/**
* 导出
* @param formDTO
* @param response
* @throws Exception
*/
@RequestMapping("exporthouseinfo")
public void exporthouseinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
houseService.exportBuildinginfo(formDTO,response);
}
/**
* 导入数据
* @param file
* @return
* @throws IOException
*/
@PostMapping("import")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException {
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
ExcelImportResult<IcHouseExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcHouseExcel.class);
List<IcHouseExcel> failList = importResult.getFailList();
if(!CollectionUtils.isEmpty(failList)){
for ( IcHouseExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
}
return new Result().error(8000,failList.get(0).getErrorMsg());
}
List<IcHouseExcel> result =importResult.getList();
houseService.importExcel(customerId,result);
return new Result().ok("导入成功");
}
}

98
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java

@ -19,6 +19,9 @@ package com.epmet.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -27,28 +30,30 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.NeighborhoodConstant;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcHouseExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.service.BuildingService;
import com.epmet.service.HouseService;
import com.epmet.service.IcNeighborHoodService;
import com.epmet.service.NeighborHoodService;
import com.epmet.service.*;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -73,6 +78,8 @@ public class NeighborHoodController {
private BuildingService buildingService;
@Autowired
private HouseService houseService;
@Resource
private IcBuildingDao icBuildingDao;
@ -112,8 +119,13 @@ public class NeighborHoodController {
//效验数据
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class);
String neighborHoodId = formDTO.getNeighborHoodId();
//判断是否存在楼宇,如果存在不能删除
List<IcBuildingEntity> icBuildingEntities = icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().eq(IcBuildingEntity::getNeighborHoodId, neighborHoodId));
if(!CollectionUtils.isEmpty(icBuildingEntities)){
return new Result().error(8000,"小区下已存在楼宇,无法删除");
}
neighborHoodService.DelNeighborhood(neighborHoodId);
return new Result();
return new Result().ok("删除成功");
}
@ -123,13 +135,55 @@ public class NeighborHoodController {
* @param response
* @throws Exception
*/
@RequestMapping("exportneighborhoodinfo")
@PostMapping("exportneighborhoodinfo")
public void exportneighborhoodinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
neighborHoodService.exportNeighborhoodinfo(formDTO,response);
}
/**
* 导出模板
* @param formDTO
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
public void exportTemplate(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcNeighborHoodExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"小区信息录入表",response);
}
/**
* 导出模板
* @param response
* @throws Exception
*/
/*@GetMapping("export")
public void export( HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcNeighborHoodExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"小区信息录入表",response);
}*/
/**
* 导出
* @param response
* @throws Exception
*/
/* @RequestMapping("exportinfo")
public void exportinfo(HttpServletResponse response) throws Exception {
ListIcNeighborHoodFormDTO formDTO = new ListIcNeighborHoodFormDTO();
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
neighborHoodService.exportNeighborhoodinfo(formDTO,response);
}*/
// /**
@ -151,25 +205,25 @@ public class NeighborHoodController {
* @return
* @throws IOException
*/
@PostMapping("importneighborhoodinfo")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file, HttpServletRequest request) throws IOException {
String dataType = request.getParameter("dataType");
if(StringUtils.isEmpty(dataType)){
return new Result().error(ErrorCode.PASSWORD_ERROR);
}
@PostMapping("import")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException {
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
if(NeighborhoodConstant.NEIGHBOR_HOOD.equals(dataType)){
List<IcNeighborHoodExcel> result = ExcelPoiUtils.importExcel(file, 0, 1, IcNeighborHoodExcel.class);
neighborHoodService.importExcel(customerId,result);
}else if(NeighborhoodConstant.BUILDING.equals(dataType)){
List<IcBuildingExcel> result = ExcelPoiUtils.importExcel(file, 0, 1, IcBuildingExcel.class);
buildingService.importExcel(customerId,result);
}else if(NeighborhoodConstant.HOUSE.equals(dataType)){
List<IcHouseExcel> result = ExcelPoiUtils.importExcel(file, 0, 1, IcHouseExcel.class);
houseService.importExcel(customerId,result);
ExcelImportResult<IcNeighborHoodExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcNeighborHoodExcel.class);
// List<IcNeighborHoodExcel> result = ExcelPoiUtils.importExcel(file, 0, 1, IcNeighborHoodExcel.class);
List<IcNeighborHoodExcel> failList = importResult.getFailList();
if(!CollectionUtils.isEmpty(failList)){
for ( IcNeighborHoodExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
}
return new Result().error(8000,failList.get(0).getErrorMsg());
}
return new Result().ok("导入成功");
List<IcNeighborHoodExcel> result =importResult.getList();
// log.info(JSON.toJSONString(result));
neighborHoodService.importExcel(customerId,result);
return new Result();
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java

@ -51,7 +51,5 @@ public interface IcHouseDao extends BaseDao<IcHouseEntity> {
IPage<Map<String, Object>> searchHouseByPage(IPage<IcHouseEntity> page,
@Param("house") IcHouseEntity house);
List<IcHouseExcel> searchAllHouse(@Param("neighbor") IcNeighborHoodEntity neighbor,
@Param("building") IcBuildingEntity building,
@Param("house") IcHouseEntity house);
List<IcHouseExcel> searchAllHouse(@Param("house") IcHouseEntity house);
}

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcBuildingExcel.java

@ -18,11 +18,13 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.epmet.util.ExcelVerifyInfo;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 楼栋信息
@ -31,7 +33,7 @@ import java.util.Date;
* @since v1.0.0 2021-10-27
*/
@Data
public class IcBuildingExcel {
public class IcBuildingExcel extends ExcelVerifyInfo implements Serializable {
/*@Excel(name = "楼栋主键")
private String id;
@ -108,14 +110,14 @@ public class IcBuildingExcel {
private String buildingName;
@Excel(name = "单元数")
@NotBlank(message = "单元数不能位空")
@NotNull(message = "单元数不能位空")
private Integer totalUnitNum;
@Excel(name = "层数")
@NotBlank(message = "层数不能位空")
@NotNull(message = "层数不能位空")
private Integer totalFloorNum;
@Excel(name = "户数")
@NotBlank(message = "户数不能位空")
@NotNull(message = "户数不能位空")
private Integer totalHouseNum;
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcHouseExcel.java

@ -18,11 +18,13 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.epmet.util.ExcelVerifyInfo;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 房屋信息
@ -31,7 +33,7 @@ import java.util.Date;
* @since v1.0.0 2021-10-27
*/
@Data
public class IcHouseExcel {
public class IcHouseExcel extends ExcelVerifyInfo implements Serializable {
/*@Excel(name = "房屋主键")
private String id;
@ -95,17 +97,17 @@ public class IcHouseExcel {
@Excel(name = "小区名称")
@Excel(name = "所属小区")
@NotBlank(message = "小区名称不能位空")
@Length(max=50,message = "小区名称不能超过50个字")
private String neighborHoodName;
@Excel(name = "楼栋名称")
@Excel(name = "所属楼栋")
@NotBlank(message = "楼栋名称不能位空")
private String buildingName;
@Excel(name = "单元号")
@NotBlank(message = "单元号不能位空")
@NotNull(message = "单元号不能位空")
private Integer buildingUnit;
@Excel(name = "门牌号")
@ -132,7 +134,7 @@ public class IcHouseExcel {
@NotBlank(message = "房主电话不能位空")
private String ownerPhone;
@Excel(name = "房主身份证")
@Excel(name = "房主身份证")
@NotBlank(message = "房主身份证号不能位空")
private String ownerIdCard;

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcNeighborHoodExcel.java

@ -20,10 +20,12 @@ package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.util.ExcelVerifyInfo;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
@ -33,7 +35,7 @@ import java.util.Date;
* @since v1.0.0 2021-10-26
*/
@Data
public class IcNeighborHoodExcel {
public class IcNeighborHoodExcel extends ExcelVerifyInfo implements Serializable {
/*@Excel(name = "小区主键")
private String id;
@ -109,7 +111,6 @@ public class IcNeighborHoodExcel {
private String neighborHoodName;
@Excel(name = "关联物业")
private String propertyName;
@Excel(name = "详细地址")

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java

@ -19,9 +19,12 @@ package com.epmet.service;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -50,4 +53,8 @@ public interface BuildingService {
List<BuildingTreeLevelDTO> treeList(String customerId);
void importExcel(String customerId, List<IcBuildingExcel> list);
IcNeighborHoodResultDTO listBuilding(ListIcNeighborHoodFormDTO formDTO);
void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception ;
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java

@ -18,9 +18,12 @@
package com.epmet.service;
import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcHouseExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -44,4 +47,8 @@ public interface HouseService {
void importExcel(String customerId, List<IcHouseExcel> list);
IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO);
void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception;
}

119
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -1,15 +1,23 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.ExtStaffPermissionResultDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.*;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.service.*;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -48,6 +57,8 @@ public class BuildingServiceImpl implements BuildingService {
private IcNeighborHoodDao icNeighborHoodDao;
@Resource
private CustomerStaffAgencyDao customerStaffAgencyDao;
@Resource
private IcBuildingUnitDao icBuildingUnitDao;
@Override
@Transactional(rollbackFor = Exception.class)
@ -63,7 +74,7 @@ public class BuildingServiceImpl implements BuildingService {
for(int i =0 ;i<totalUnitNum;i++){
IcBuildingUnitEntity icBuildingUnit= new IcBuildingUnitEntity();
icBuildingUnit.setBuildingId(entity.getId());
icBuildingUnit.setUnitName(String.valueOf(i+1));
icBuildingUnit.setUnitName(String.valueOf(i+1)+"单元");
icBuildingUnit.setUnitNum(String.valueOf(i+1));
unitList.add(icBuildingUnit);
}
@ -201,8 +212,10 @@ public class BuildingServiceImpl implements BuildingService {
String uuid = UUID.randomUUID().toString().replace("-", "");
entity.setId(uuid);
entity.setCustomerId(customerId);
entity.setNeighborHoodId(neighborHoodMap.get(icBuildingExcel.getNeighborHoodName()).getId());
entity.setNeighborHoodId(Optional.ofNullable(neighborHoodMap.get(icBuildingExcel.getNeighborHoodName())).map(u->u.getId()).orElse(""));//neighborHoodMap.get(icBuildingExcel.getNeighborHoodName()).getId()
entity.setBuildingName(icBuildingExcel.getBuildingName());
entity.setType("");
entity.setSort(0);
entity.setTotalUnitNum(icBuildingExcel.getTotalUnitNum());
entity.setTotalFloorNum(icBuildingExcel.getTotalFloorNum());
entity.setTotalHouseNum(icBuildingExcel.getTotalHouseNum());
@ -214,7 +227,8 @@ public class BuildingServiceImpl implements BuildingService {
for(int i =0 ;i<totalUnitNum;i++){
IcBuildingUnitEntity icBuildingUnit= new IcBuildingUnitEntity();
icBuildingUnit.setBuildingId(uuid);
icBuildingUnit.setUnitName(String.valueOf(i+1));
icBuildingUnit.setCustomerId(customerId);
icBuildingUnit.setUnitName(String.valueOf(i+1)+"单元");
icBuildingUnit.setUnitNum(String.valueOf(i+1));
unitList.add(icBuildingUnit);
}
@ -227,6 +241,74 @@ public class BuildingServiceImpl implements BuildingService {
}
@Override
public IcNeighborHoodResultDTO listBuilding(ListIcNeighborHoodFormDTO formDTO) {
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
IPage<Map<String, Object>> resultMap = searchBuilding(formDTO);
result.setTotal(resultMap.getTotal());
result.setList(resultMap.getRecords());
return result;
}
@Override
public void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
//如果类型是building 查楼栋
//导出楼栋
List<IcBuildingExcel> icBuildingExcels = searchAllBuilding(formDTO);
TemplateExportParams templatePath = new TemplateExportParams("excel/building_export.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",icBuildingExcels);
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"楼宇信息录入表",response);
return ;
}
private List<IcBuildingExcel> searchAllBuilding(ListIcNeighborHoodFormDTO formDTO) {
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0");
return icBuildingDao.searchAllBuilding(building);
}
private IPage<Map<String, Object>> searchBuilding(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcBuildingEntity> page = new Page<IcBuildingEntity>(formDTO.getPageNo(),formDTO.getPageSize());
// IcNeighborHoodEntity neighbor = new IcNeighborHoodEntity();
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0");
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
//
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
return icBuildingDao.searchBuildingByPage(page,building);
}
private List<BuildingTreeLevelDTO> covertToTree(CustomerAgencyEntity customerAgency,List<BuildingTreeLevelDTO> agencyList) {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
@ -264,7 +346,7 @@ public class BuildingServiceImpl implements BuildingService {
IcBuildingDTO icBuilding= icBuildingService.get(formDTO.getBuildingId());
if(!icBuilding.getNeighborHoodId().equals(formDTO.getNeighborHoodId())){
//更新对应房屋小区
//更新对应房屋小区id
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()));
icHouseEntities.forEach(item->{
item.setNeighborHoodId(formDTO.getNeighborHoodId());
@ -277,7 +359,24 @@ public class BuildingServiceImpl implements BuildingService {
icBuildingService.update(icBuildingDTO);
//更新楼宇单元
//如果楼宇单元大于之前的楼宇单元,新增单元
//如果小于,判断是否存在房屋,如果存在就提示不能更改
Integer nowUnit= formDTO.getTotalUnitNum();
Integer unit = icBuilding.getTotalUnitNum();
if(nowUnit>unit){
//新增单元
List<IcBuildingUnitEntity> unitList = new ArrayList<>();
for(int i =unit ;i<nowUnit;i++){
IcBuildingUnitEntity icBuildingUnit= new IcBuildingUnitEntity();
icBuildingUnit.setBuildingId(icBuilding.getId());
icBuildingUnit.setUnitName(String.valueOf(i+1));
icBuildingUnit.setUnitNum(String.valueOf(i+1));
unitList.add(icBuildingUnit);
}
icBuildingUnitService.insertBatch(unitList);
}else{
//如果小于,判断是否存在房屋,如果存在就提示不能更改
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),"楼宇单元下存在房屋,无法更新");
}
}
@ -289,8 +388,16 @@ public class BuildingServiceImpl implements BuildingService {
@Override
@Transactional(rollbackFor = Exception.class)
public void DelBuilding(String buildingId) {
//删除小区
//如果存在房屋,无法删除
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, buildingId));
if(!CollectionUtils.isEmpty(icHouseEntities)){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),"楼宇单元下存在房屋,无法删除");
}
//删除楼宇
icBuildingService.deleteById(buildingId);
//删除楼宇单元
icBuildingUnitDao.delete(new QueryWrapper<IcBuildingUnitEntity>().lambda().eq(IcBuildingUnitEntity::getBuildingId,buildingId));
}
}

93
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -1,5 +1,8 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dao.IcBuildingUnitDao;
@ -9,12 +12,17 @@ import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.IcBuildingUnitDTO;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcHouseEntity;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.excel.IcHouseExcel;
import com.epmet.service.HouseService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.IcBuildingUnitService;
import com.epmet.service.IcHouseService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -22,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
@ -51,7 +60,7 @@ public class HouseServiceImpl implements HouseService {
public void addHouse(String customerId, IcHouseFormDTO formDTO) {
IcHouseDTO icHouseDTO= ConvertUtils.sourceToTarget(formDTO, IcHouseDTO.class);
icHouseDTO.setCustomerId(customerId);
icHouseDTO.setRentFlag(formDTO.getRentFlag()?1:0);
icHouseDTO.setRentFlag(formDTO.getRentFlag());
icHouseDTO.setHouseName(getHouseName(formDTO));
icHouseService.save(icHouseDTO);
@ -78,7 +87,7 @@ public class HouseServiceImpl implements HouseService {
IcHouseDTO icHouseDTO = ConvertUtils.sourceToTarget(formDTO, IcHouseDTO.class);
icHouseDTO.setId(formDTO.getHouseId());
icHouseDTO.setCustomerId(customerId);
icHouseDTO.setRentFlag(formDTO.getRentFlag()?1:0);
icHouseDTO.setRentFlag(formDTO.getRentFlag());
//设置
icHouseDTO.setHouseName(getHouseName(formDTO));
icHouseService.update(icHouseDTO);
@ -127,12 +136,12 @@ public class HouseServiceImpl implements HouseService {
entity.setId(uuid);
entity.setCustomerId(customerId);
Map<String,Object> item = buildMap.get(icHouseExcel.getNeighborHoodName()+","+icHouseExcel.getBuildingName()+","+icHouseExcel.getBuildingUnit());
if(!CollectionUtils.isEmpty(item)){
entity.setNeighborHoodId(String.valueOf(item.get("neighborId")));
entity.setBuildingId(String.valueOf(item.get("buildingId")));
entity.setBuildingUnitId(String.valueOf(item.get("buildingUnitId")));
entity.setHouseName(icHouseExcel.getBuildingName()+"-"+icHouseExcel.getBuildingUnit()+"-"+icHouseExcel.getDoorName());
}
entity.setNeighborHoodId(String.valueOf(Optional.ofNullable(item).map(u->u.get("neighborId")).orElse("")));
entity.setBuildingId(String.valueOf(Optional.ofNullable(item).map(u->u.get("buildingId")).orElse("")));
entity.setBuildingUnitId(String.valueOf(Optional.ofNullable(item).map(u->u.get("buildingUnitId")).orElse("")));
entity.setHouseName(icHouseExcel.getBuildingName()+"-"+icHouseExcel.getBuildingUnit()+"-"+icHouseExcel.getDoorName());
entity.setDoorName(icHouseExcel.getDoorName());
entity.setHouseType(icHouseExcel.getHouseType());
entity.setPurpose(icHouseExcel.getPurpose());
@ -143,10 +152,76 @@ public class HouseServiceImpl implements HouseService {
houseEntityList.add(entity);
}
//3.保存
//4.新增单元
icHouseService.insertBatch(houseEntityList);
}
@Override
public IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
//如果类型是house 查房屋
IPage<Map<String, Object>> resultMap = searchHouse(formDTO);
result.setTotal(resultMap.getTotal());
result.setList(resultMap.getRecords());
return result;
}
@Override
public void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
//如果类型是house 查房屋
//导出房屋
List<IcHouseExcel> icHouseExcels = searchAllHouse(formDTO);
TemplateExportParams templatePath = new TemplateExportParams("excel/house_export.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",icHouseExcels);
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"房屋信息录入表",response);
return ;
}
private List<IcHouseExcel> searchAllHouse(ListIcNeighborHoodFormDTO formDTO) {
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0");
return icHouseDao.searchAllHouse(house);
}
private IPage<Map<String, Object>> searchHouse(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcHouseEntity> page = new Page<IcHouseEntity>(formDTO.getPageNo(),formDTO.getPageSize());
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
// QueryWrapper<IcHouseEntity> houseEntityQueryWrapper = new QueryWrapper<>();
// houseEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getOwnerName()),IcHouseEntity::getOwnerName,formDTO.getOwnerName())
// .like(!StringUtils.isEmpty(formDTO.getOwnerPhone()),IcHouseEntity::getOwnerPhone,formDTO.getOwnerPhone());
// houseEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0");
return icHouseDao.searchHouseByPage(page,house);
}
}

160
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java

@ -102,91 +102,26 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
*/
@Override
public IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
String dataType = formDTO.getLevel();
String level = formDTO.getLevel();
Integer pageNo = formDTO.getPageNo();
Integer pageSize = formDTO.getPageSize();
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
result.setDataType(dataType);
if(StringUtils.isEmpty(dataType)|| NeighborhoodConstant.NEIGHBOR_HOOD.equals(dataType)){
//如果类型是neighbourHood 查小区
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO);
result.setTotal(resultMap.getTotal());
result.setList(resultMap.getRecords());
}else if(NeighborhoodConstant.BUILDING.equals(dataType)){
//如果类型是building 查楼栋
IPage<Map<String, Object>> resultMap = searchBuilding(formDTO);
result.setTotal(resultMap.getTotal());
result.setList(resultMap.getRecords());
}else if(NeighborhoodConstant.HOUSE.equals(dataType)){
//如果类型是house 查房屋
IPage<Map<String, Object>> resultMap = searchHouse(formDTO);
result.setTotal(resultMap.getTotal());
result.setList(resultMap.getRecords());
}
return result;
}
private IPage<Map<String, Object>> searchHouse(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcHouseEntity> page = new Page<IcHouseEntity>(formDTO.getPageNo(),formDTO.getPageSize());
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO);
result.setTotal(resultMap.getTotal());
result.setList(resultMap.getRecords());
return result;
// QueryWrapper<IcHouseEntity> houseEntityQueryWrapper = new QueryWrapper<>();
// houseEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getOwnerName()),IcHouseEntity::getOwnerName,formDTO.getOwnerName())
// .like(!StringUtils.isEmpty(formDTO.getOwnerPhone()),IcHouseEntity::getOwnerPhone,formDTO.getOwnerPhone());
// houseEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0");
return icHouseDao.searchHouseByPage(page,house);
}
private IPage<Map<String, Object>> searchBuilding(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcBuildingEntity> page = new Page<IcBuildingEntity>(formDTO.getPageNo(),formDTO.getPageSize());
// IcNeighborHoodEntity neighbor = new IcNeighborHoodEntity();
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0");
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
//
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
return icBuildingDao.searchBuildingByPage(page,building);
}
private IPage<Map<String,Object>> searchNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
@ -202,6 +137,13 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
neighbor.setDelFlag("0");
if(NeighborhoodConstant.GRID.equals(formDTO.getLevel())){
//根据网格过滤
neighbor.setGridId(formDTO.getId());
}else{
//根据组织过滤
neighbor.setAgencyId(formDTO.getId());
}
return icNeighborHoodDao.searchNeighborhoodByPage(page, neighbor);
}
@ -274,38 +216,14 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
*/
@Override
public void exportNeighborhoodinfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
String dataType = formDTO.getLevel();
if(StringUtils.isEmpty(dataType)|| NeighborhoodConstant.NEIGHBOR_HOOD.equals(dataType)){
//如果类型是neighbourHood 查小区
//导出小区
List<IcNeighborHoodExcel> icNeighborHoodExcels = searchAllNeighborhood(formDTO);
//导出小区
List<IcNeighborHoodExcel> icNeighborHoodExcels = searchAllNeighborhood(formDTO);
// ExcelUtils.exportExcelToTarget(response, "小区信息录入表", icNeighborHoodExcels, IcNeighborHoodExcel.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_template.xlsx");
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"小区信息录入表",response);
return ;
}else if(NeighborhoodConstant.BUILDING.equals(dataType)){
//如果类型是building 查楼栋
//导出楼栋
List<IcBuildingExcel> icBuildingExcels = searchAllBuilding(formDTO);
// ExcelUtils.exportExcelToTarget(response, "楼宇信息录入表", icBuildingExcels, IcBuildingExcel.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/building_template.xlsx");
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"楼宇信息录入表",response);
return ;
}else if(NeighborhoodConstant.HOUSE.equals(dataType)){
//如果类型是house 查房屋
//导出房屋
List<IcHouseExcel> icHouseExcels = searchAllHouse(formDTO);
// ExcelUtils.exportExcelToTarget(response, "房屋信息录入表", icHouseExcels, IcHouseExcel.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/house_template.xlsx");
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"房屋信息录入表",response);
return ;
}
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_export.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",icNeighborHoodExcels);
ExcelPoiUtils.exportExcel(templatePath ,map,"小区信息录入表",response);
}
@Override
@ -339,16 +257,18 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
entity.setId(uuid);
entity.setCustomerId(customerId);
entity.setNeighborHoodName(icNeighborHoodExcel.getNeighborHoodName());
entity.setAgencyId(agencyMap.get(icNeighborHoodExcel.getAgencyName()).getId());
entity.setParentAgencyId(agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPid());
entity.setAgencyPids(agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPids());
entity.setGridId(gridMap.get(icNeighborHoodExcel.getGridName()).getId());
entity.setAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName())).map(u->u.getId()).orElse("")); // agencyMap.get(icNeighborHoodExcel.getAgencyName()).getId());
entity.setParentAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName())).map(u->u.getPid()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPid()
entity.setAgencyPids(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName())).map(u->u.getPids()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPids()
entity.setGridId(Optional.ofNullable(gridMap.get(icNeighborHoodExcel.getGridName())).map(u->u.getId()).orElse(""));//gridMap.get(icNeighborHoodExcel.getGridName()).getId()
entity.setAddress(icNeighborHoodExcel.getAddress());
entity.setRemark(icNeighborHoodExcel.getRemark());
neighborHoodEntityList.add(entity);
IcNeighborHoodPropertyEntity entity1 = new IcNeighborHoodPropertyEntity();
entity1.setPropertyId(propertyMap.get(icNeighborHoodExcel.getPropertyName()).getId());
entity1.setPropertyId(Optional.ofNullable(propertyMap.get(icNeighborHoodExcel.getPropertyName())).map(u->u.getId()).orElse(""));
entity1.setNeighborHoodId(uuid);
icNeighborHoodPropertyEntityList.add(entity1);
}
@ -360,26 +280,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
}
private List<IcBuildingExcel> searchAllBuilding(ListIcNeighborHoodFormDTO formDTO) {
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0");
return icBuildingDao.searchAllBuilding(building);
}
private List<IcNeighborHoodExcel> searchAllNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
@ -395,18 +296,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
return icNeighborHoodDao.searchAllNeighborhood(neighbor);
}
private List<IcHouseExcel> searchAllHouse(ListIcNeighborHoodFormDTO formDTO) {
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0");
return icHouseDao.searchAllHouse(neighbor,building,house);
}

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ExcelPoiUtils.java

@ -169,7 +169,7 @@ public class ExcelPoiUtils {
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
params.setNeedSave(true);
params.setSaveUrl("/excel/");
params.setSaveUrl("/tmp/excel/");
try {
return ExcelImportUtil.importExcel(new File(filePath), pojoClass, params);
} catch (NoSuchElementException e) {
@ -218,7 +218,7 @@ public class ExcelPoiUtils {
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
params.setSaveUrl("/excel/");
params.setSaveUrl("/tmp/excel/");
params.setNeedSave(true);
try {
return ExcelImportUtil.importExcel(inputStream, pojoClass, params);
@ -236,12 +236,12 @@ public class ExcelPoiUtils {
* @param <T>
* @return
*/
public static <T> ExcelImportResult<T> importExcelMore(MultipartFile file, Class<T> pojoClass) throws IOException {
public static <T> ExcelImportResult<T> importExcelMore(MultipartFile file,Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (file == null) {
return null;
}
try {
return importExcelMore(file.getInputStream(), pojoClass);
return importExcelMore(file.getInputStream(), titleRows, headerRows, pojoClass);
} catch (Exception e) {
throw new IOException(e.getMessage());
}
@ -255,14 +255,14 @@ public class ExcelPoiUtils {
* @param <T>
* @return
*/
private static <T> ExcelImportResult<T> importExcelMore(InputStream inputStream, Class<T> pojoClass) throws IOException {
private static <T> ExcelImportResult<T> importExcelMore(InputStream inputStream,Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (inputStream == null) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(1);//表格内数据标题行
params.setHeadRows(1);//表头行
params.setSaveUrl("/excel/");
params.setTitleRows(titleRows);//表格内数据标题行
params.setHeadRows(headerRows);//表头行
params.setSaveUrl("/tmp/excel/");
params.setNeedSave(true);
params.setNeedVerify(true);
try {

31
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ExcelVerifyInfo.java

@ -0,0 +1,31 @@
package com.epmet.util;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
public class ExcelVerifyInfo implements IExcelModel, IExcelDataModel {
private String errorMsg;
private int rowNum;
@Override
public Integer getRowNum() {
return rowNum;
}
@Override
public void setRowNum(Integer rowNum) {
this.rowNum = rowNum;
}
@Override
public String getErrorMsg() {
return errorMsg;
}
@Override
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_export.xlsx

Binary file not shown.

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_export.xlsx

Binary file not shown.

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/neighbor_export.xlsx

Binary file not shown.

86
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -49,23 +49,57 @@
<select id="searchBuildingByPage" resultType="map">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName
a.TYPE as buildingType,
a.ID as buildingId,
c.ID as agencyId.
c.ORGANIZATION_NAME as agencyName,
d.ID as gridId,
d.GRID_NAME as gridName,
a.SORT as sort,
a.LONGITUDE as longitude,
a.LATITUDE as latitude,
a.TYPE as buildingTypeKey
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
<where>
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID and b.DEL_FLAG='0'
left join customer_agency c on b.AGENCY_ID = c.ID and c.DEL_FLAG='0'
<if test="building.id != null and building.id.trim() != ''">
left join customer_grid d on b.GRID_ID = d.ID and d.DEL_FLAG='0'
<where>
<if test="building.neighborHoodId != null and building.neighborHoodId.trim() != ''">
AND a.NEIGHBOR_HOOD_ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND a.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
<if test="building.delFlag != null and building.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>
<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
a.TYPE as buildingType,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName,
c.ORGANIZATION_NAME as agencyName,
d.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID and b.DEL_FLAG='0'
LEFT JOIN customer_agency c on b.AGENCY_ID = c.ID and c.DEL_FLAG='0'
LEFT JOIN customer_grid d on b.GRID_ID = d.ID and d.DEL_FLAG='0'
<where>
<if test="building.neighborHoodId != null and building.neighborHoodId.trim() != ''">
AND a.NEIGHBOR_HOOD_ID = #{building.id}
</if>
<if test="building.delFlag != null and building.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
@ -73,6 +107,7 @@
</where>
</select>
<!--<select id="searchBuildingByPage" resultType="map">
select
a.ID as buildingId,
@ -182,36 +217,7 @@
</if>
</where>
</select>-->
<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName,
c.ORGANIZATION_NAME as agencyName,
d.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
LEFT JOIN customer_agency c on b.AGENCY_ID = c.ID
LEFT JOIN customer_grid c on b.GRID_ID = d.ID
<where>
<if test="building.id != null and building.id.trim() != ''">
AND a.NEIGHBOR_HOOD_ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND a.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
</if>
<if test="building.delFlag != null and building.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>
<select id="selectAgencyChildrenList" resultType="com.epmet.entity.CustomerAgencyEntity">
@ -241,15 +247,15 @@
from ic_neighbor_hood a
INNER JOIN ic_building b on a.ID = b.NEIGHBOR_HOOD_ID and b.DEL_FLAG = '0' and b.BUILDING_NAME in
<foreach collection="buildingNameList" open="(" separator="," close=")" item="val">
${val}
#{val}
</foreach>
INNER JOIN ic_building_unit c on b.ID = c.BUILDING_ID and c.DEL_FLAG = '0' and c.UNIT_NUM in
<foreach collection="buildingUnitList" open="(" separator="," close=")" item="val">
${val}
#{val}
</foreach>
WHERE a.DEL_FLAG = '0' and a.NEIGHBOR_HOOD_NAME in
<foreach collection="neighborNameList" open="(" separator="," close=")" item="val">
${val}
#{val}
</foreach>
</select>

137
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -104,39 +104,78 @@
</where>
</select>-->
<select id="searchHouseByPage" resultType="map">
select
a.ID as houseId,
a.HOUSE_NAME as houseName,
a.DOOR_NAME as doorName,
a.HOUSE_TYPE as houseType,
a.PURPOSE as purpose,
a.RENT_FLAG as rentFlag,
a.OWNER_NAME as ownerName,
a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName,
d.UNIT_NUM as unitName
from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID
INNER JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID
LEFT JOIN ic_building_unit d on a.BUILDING_UNIT_ID = d.ID
<where>
<if test="house.id != null and house.id.trim() != ''">
AND a.BUILDING_ID = #{house.id}
</if>
<if test="house.ownerName != null and house.ownerName.trim() != ''">
AND a.OWNER_NAME = #{house.ownerName}
</if>
<if test="house.ownerPhone != null and house.ownerPhone.trim() != ''">
AND a.OWNER_PHONE = #{house.ownerPhone}
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{house.delFlag}
</if>
</where>
select
a.HOUSE_NAME as houseName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName,
b.BUILDING_NAME as buildingName,
d.UNIT_NUM as unitNum,
a.DOOR_NAME as doorName,
a.HOUSE_TYPE as houseType,
a.OWNER_NAME as ownerName,
a.RENT_FLAG as rentFlag,
a.PURPOSE as purpose,
a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard,
a.ID as houseId,
c.ID as neighbourHoodId,
b.ID as buildingId,
a.BUILDING_UNIT_ID as unitNumKey,
a.HOUSE_TYPE as houseTypeKey,
a.PURPOSE as purposeKey
from ic_house a
LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0'
LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0'
LEFT JOIN ic_building_unit d on a.BUILDING_UNIT_ID = d.ID and d.DEL_FLAG = '0'
<where>
<if test="house.buildingId != null and house.buildingId.trim() != ''">
AND a.BUILDING_ID = #{house.buildingId}
</if>
<if test="house.ownerName != null and house.ownerName.trim() != ''">
AND a.OWNER_NAME = #{house.ownerName}
</if>
<if test="house.ownerPhone != null and house.ownerPhone.trim() != ''">
AND a.OWNER_PHONE = #{house.ownerPhone}
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{house.delFlag}
</if>
</where>
</select>
<select id="searchAllHouse" resultType="com.epmet.excel.IcHouseExcel">
select
a.HOUSE_NAME as houseName,
a.DOOR_NAME as doorName,
a.HOUSE_TYPE as houseType,
a.PURPOSE as purpose,
if(a.RENT_FLAG=1,'是','否') as rentFlag,
a.OWNER_NAME as ownerName,
a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName,
d.UNIT_NUM as unitName
from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0'
INNER JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0'
LEFT JOIN ic_building_unit d on a.BUILDING_UNIT_ID = d.ID and d.DEL_FLAG = '0'
<where>
<if test="house.buildingId != null and house.buildingId.trim() != ''">
AND a.BUILDING_ID = #{house.buildingId}
</if>
<if test="house.ownerName != null and house.ownerName.trim() != ''">
AND a.OWNER_NAME = #{house.ownerName}
</if>
<if test="house.ownerPhone != null and house.ownerPhone.trim() != ''">
AND a.OWNER_PHONE = #{house.ownerPhone}
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{house.delFlag}
</if>
</where>
</select>
<!-- <select id="searchAllHouse" resultType="com.epmet.excel.IcHouseExcel">
select
@ -188,39 +227,7 @@
</where>
</select>-->
<select id="searchAllHouse" resultType="com.epmet.excel.IcHouseExcel">
select
a.HOUSE_NAME as houseName,
a.DOOR_NAME as doorName,
a.HOUSE_TYPE as houseType,
a.PURPOSE as purpose,
a.RENT_FLAG as rentFlag,
a.OWNER_NAME as ownerName,
a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName,
d.UNIT_NUM as unitName
from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID
INNER JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID
LEFT JOIN ic_building_unit d on a.BUILDING_UNIT_ID = d.ID
<where>
<if test="house.id != null and house.id.trim() != ''">
AND a.BUILDING_ID = #{house.id}
</if>
<if test="house.ownerName != null and house.ownerName.trim() != ''">
AND a.OWNER_NAME = #{house.ownerName}
</if>
<if test="house.ownerPhone != null and house.ownerPhone.trim() != ''">
AND a.OWNER_PHONE = #{house.ownerPhone}
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{house.delFlag}
</if>
</where>
</select>
</mapper>

48
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

@ -61,19 +61,30 @@
select
a.id as neighborHoodId,
a.NEIGHBOR_HOOD_NAME as neighborHoodName,
b.ORGANIZATION_NAME as agencyName,
c.GRID_NAME as gridName,
a.ADDRESS as address,
a.REMARK as remark,
b.ID as agencyId,
c.ID as gridId,
d.PROPERTY_ID as propertyId ,
a.LOCATION as location,
a.LONGITUDE as longitude,
a.LATITUDE as latitude
b.ORGANIZATION_NAME as orgName,
c.GRID_NAME as gridName
from ic_neighbor_hood a
left join customer_agency b on a.AGENCY_ID = b.ID
left join customer_agency b on a.AGENCY_ID = b.ID and b.DEL_FLAG='0'
left join customer_grid c on a.GRID_ID = c.ID
left join customer_grid c on a.GRID_ID = c.ID and c.DEL_FLAG='0'
left join ic_neighbor_hood_property d on a.ID = d.NEIGHBOR_HOOD_ID and d.DEL_FLAG='0'
<where>
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND a.GRID_ID = #{neighbor.id}
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND a.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND (a.AGENCY_ID = #{neighbor.agencyId} or CONCAT(':',a.PIDS, ':') like CONCAT('%:',#{neighbor.agencyId},':%'))
</if>
<if test="neighbor.delFlag != null and neighbor.delFlag.trim() != ''">
AND a.DEL_FLAG = #{neighbor.delFlag}
@ -90,17 +101,20 @@
c.GRID_NAME as gridName
from ic_neighbor_hood a
left join customer_agency b on a.AGENCY_ID = b.ID
left join customer_agency b on a.AGENCY_ID = b.ID and b.DEL_FLAG='0'
left join customer_grid c on a.GRID_ID = c.ID
left join ic_neighbor_hood_property d on a.ID = d.NEIGHBOR_HOOD_ID
left join ic_property_management e on d.PROPERTY_ID = e.ID
left join customer_grid c on a.GRID_ID = c.ID and c.DEL_FLAG='0'
left join ic_neighbor_hood_property d on a.ID = d.NEIGHBOR_HOOD_ID and d.DEL_FLAG='0'
left join ic_property_management e on d.PROPERTY_ID = e.ID and e.DEL_FLAG='0'
<where>
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND a.GRID_ID = #{neighbor.id}
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND a.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND (a.AGENCY_ID = #{neighbor.agencyId} or CONCAT(':',a.PIDS, ':') like CONCAT('%:',#{neighbor.agencyId},':%'))
</if>
<if test="neighbor.delFlag != null and neighbor.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
AND a.DEL_FLAG = #{neighbor.delFlag}
</if>
</where>
</select>
@ -142,15 +156,15 @@
ic_neighbor_hood a
INNER JOIN customer_agency b on a.AGENCY_ID = b.ID and b.ORGANIZATION_NAME in
<foreach collection="agencyNameList" open="(" separator="," close=")" item="val">
${val}
#{val}
</foreach>
INNER JOIN customer_grid c on a.GRID_ID = c.ID and c.PID = b.ID and b.GRID_NAME in
INNER JOIN customer_grid c on a.GRID_ID = c.ID and c.PID = b.ID and c.GRID_NAME in
<foreach collection="gridNameList" open="(" separator="," close=")" item="val">
${val}
#{val}
</foreach>
where a.DEL_FLAG= '0'and a.NEIGHBOR_HOOD_NAME in
<foreach collection="neighborNameList" open="(" separator="," close=")" item="val">
${val}
#{val}
</foreach>
</select>

Loading…
Cancel
Save