Browse Source

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

dev
lzh 4 years ago
parent
commit
e0b90c355f
  1. 52
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/BuildingTreeLevelDTO.java
  2. 1
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java
  3. 119
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java
  4. 101
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java
  5. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java
  6. 11
      epmet-module/gov-org/gov-org-server/pom.xml
  7. 115
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  8. 97
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  9. 113
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  10. 31
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java
  11. 26
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  12. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java
  13. 121
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcBuildingExcel.java
  14. 139
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcHouseExcel.java
  15. 123
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcNeighborHoodExcel.java
  16. 47
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcBuildingRedis.java
  17. 47
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcHouseRedis.java
  18. 47
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcNeighborHoodRedis.java
  19. 53
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  20. 47
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  21. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java
  22. 296
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  23. 152
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  24. 268
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  25. 276
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ExcelPoiUtils.java
  26. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml
  27. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx
  28. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx
  29. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/neighbor_template.xlsx
  30. 228
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  31. 196
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  32. 117
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

52
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/BuildingTreeLevelDTO.java

@ -0,0 +1,52 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 楼栋信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Data
public class BuildingTreeLevelDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String pId;
private String label;
private String level;
private List<BuildingTreeLevelDTO> children;
}

1
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java

@ -59,6 +59,7 @@ public class IcBuildingDTO implements Serializable {
*/
private String buildingName;
/**
* 楼栋类型这里存储字典编码就可以
*/

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

@ -0,0 +1,119 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
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 java.io.Serializable;
@Data
public class IcBulidingFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface DeleteGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "楼栋ID不能为空", groups = { UpdateGroup.class,DeleteGroup.class})
private String buildingId;
/**
* 组织id
*/
@NotBlank(message = "组织id不能为空", groups = {AddGroup.class})
private String agencyId;
/**
* 网格id
*/
private String gridId;
/**
* 小区id
*/
@NotBlank(message = "小区id不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String neighborHoodId;
/**
* 楼栋名称
*/
@NotBlank(message = "楼栋名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
@Length(max=10,message = "楼栋名称不能超过10个字", groups = {AddGroup.class, UpdateGroup.class})
private String buildingName;
/**
* 客户id
*/
/* @NotBlank(message = "客户id不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String customerId;*/
/**
* 排序
*/
@NotBlank(message = "排序不能为空", groups = { UpdateGroup.class})
private Integer sort = 0;
/**
* 总单元数
*/
@NotBlank(message = "总单元数不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer totalUnitNum=1;
/**
* 总楼层总数
*/
@NotBlank(message = "总楼层总数不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer totalFloorNum;
/**
* 总户数
*/
@NotBlank(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;
}

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

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
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 java.io.Serializable;
@Data
public class IcHouseFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface DeleteGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "房屋ID不能为空", groups = { UpdateGroup.class,DeleteGroup.class})
private String houseId;
/**
* 小区id
*/
@NotBlank(message = "小区id不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String neighborHoodId;
@NotBlank(message = "所属楼栋ID不能为空", groups = { UpdateGroup.class})
private String belongBuildingId;
/**
* 所属单元id
*/
@NotBlank(message = "所属单元id不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String buildingUnitId;
/**
* 门牌号
*/
@NotBlank(message = "门牌号不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String doorName;
/**
* 房屋类型这里存储字典value就可以
*/
@NotBlank(message = "房屋类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String houseType;
/**
* 存储字典value
*/
@NotBlank(message = "房屋用途不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String purpose;
/**
* 1出租0未出租
*/
@NotBlank(message = "是否出租不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Boolean rentFlag;
/**
* 房主姓名
*/
@NotBlank(message = "房主姓名不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String ownerName;
/**
* 房主电话
*/
@NotBlank(message = "房主电话不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String ownerPhone;
/**
* 房主身份证号
*/
@NotBlank(message = "房主身份证号不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String ownerIdCard;
}

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

@ -31,22 +31,29 @@ public class ListIcNeighborHoodFormDTO implements Serializable{
* */
private Integer pageSize = 20;
/**
* 组织类别
*/
private String level ;
private String id;
/**
* 组织ID
*/
private String agencyId;
// private String agencyId;
/**
* 网格ID
*/
private String gridId;
// private String gridId;
/**
* 小区名字
*/
private String neighborHoodName;
// private String neighborHoodName;
/**
* 楼栋名字
*/
private String buildingName;
// private String buildingName;
/**
* 房主姓名
*/
@ -59,15 +66,15 @@ public class ListIcNeighborHoodFormDTO implements Serializable{
* 数据类型小区neighbourHood楼栋building房屋house
*/
// @Pattern(regexp = "^(neighbourHood|building|house)?$",message = "数据类型选择错误")
private String dataType;
// private String dataType;
/**
* 楼栋ID
*/
private String buildingId;
// private String buildingId;
/**
* 小区ID
*/
private String neighborHoodId;
// private String neighborHoodId;
}

11
epmet-module/gov-org/gov-org-server/pom.xml

@ -129,8 +129,19 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>

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

@ -0,0 +1,115 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
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.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.IcNeighborHoodExcel;
import com.epmet.service.BuildingService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.IcNeighborHoodService;
import com.epmet.service.NeighborHoodService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 楼栋信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Slf4j
@RestController
@RequestMapping("building")
public class BuildingController {
@Autowired
private NeighborHoodService neighborHoodService;
@Autowired
private IcBuildingService icBuildingService;
@Autowired
private BuildingService buildingService;
@PostMapping("buildinglist")
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
}
@PostMapping("buildingadd")
public Result buildingAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
buildingService.AddBuilding(customerId,formDTO);
return new Result().ok("保存成功");
}
@PostMapping("buildingupdate")
public Result buildingUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
buildingService.UpdateBuilding(customerId,formDTO);
return new Result().ok("修改成功");
}
@PostMapping("buildingdel")
public Result buildingDel(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.DeleteGroup.class);
String buildingId = formDTO.getBuildingId();
buildingService.DelBuilding(buildingId);
return new Result();
}
@PostMapping("treelist")
public Result treeList(@LoginUser TokenDto tokenDTO){
List<BuildingTreeLevelDTO> buildingTreeLevelDTOS =buildingService.treeList(tokenDTO.getUserId());
return new Result().ok(buildingTreeLevelDTOS);
}
}

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

@ -0,0 +1,97 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
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.dto.form.IcHouseFormDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.service.HouseService;
import com.epmet.service.NeighborHoodService;
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;
/**
* 房屋表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Slf4j
@RestController
@RequestMapping("house")
public class HouseController {
@Autowired
private NeighborHoodService neighborHoodService;
@Autowired
private HouseService houseService;
@PostMapping("houselist")
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
}
@PostMapping("houseadd")
public Result houseAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
houseService.addHouse(customerId,formDTO);
return new Result();
}
@PostMapping("houseupdate")
public Result houseUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
houseService.updateHouse(customerId,formDTO);
return new Result();
}
@PostMapping("housedel")
public Result houseDel(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class);
houseService.delHouse(formDTO.getHouseId());
return new Result();
}
}

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

@ -17,24 +17,40 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
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.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.constant.NeighborhoodConstant;
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.HouseService;
import com.epmet.service.IcNeighborHoodService;
import com.epmet.service.NeighborHoodService;
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.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.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -44,6 +60,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Slf4j
@RestController
@RequestMapping("neighborhood")
public class NeighborHoodController {
@ -52,6 +69,10 @@ public class NeighborHoodController {
private IcNeighborHoodService icNeighborHoodService;
@Autowired
private NeighborHoodService neighborHoodService;
@Autowired
private BuildingService buildingService;
@Autowired
private HouseService houseService;
@ -70,6 +91,7 @@ public class NeighborHoodController {
//效验数据
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
neighborHoodService.AddNeighborhood(customerId,formDTO);
return new Result();
@ -80,6 +102,7 @@ public class NeighborHoodController {
//效验数据
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
neighborHoodService.UpdateNeighborhood(customerId,formDTO);
return new Result();
}
@ -94,40 +117,62 @@ public class NeighborHoodController {
}
@GetMapping("page")
public Result<PageData<IcNeighborHoodDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcNeighborHoodDTO> page = icNeighborHoodService.page(params);
return new Result<PageData<IcNeighborHoodDTO>>().ok(page);
}
/**
* 导出
* @param formDTO
* @param response
* @throws Exception
*/
@RequestMapping("exportneighborhoodinfo")
public void exportneighborhoodinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
neighborHoodService.exportNeighborhoodinfo(formDTO,response);
@GetMapping("{id}")
public Result<IcNeighborHoodDTO> get(@PathVariable("id") String id){
IcNeighborHoodDTO data = icNeighborHoodService.get(id);
return new Result<IcNeighborHoodDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody IcNeighborHoodDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icNeighborHoodService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody IcNeighborHoodDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icNeighborHoodService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
icNeighborHoodService.delete(ids);
return new Result();
// /**
// * 导入
// * @param params
// * @param response
// * @throws Exception
// */
// @PostMapping("importneighborhoodinfo")
// public void importneighborhoodinfo(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
// List<IcNeighborHoodDTO> list = icNeighborHoodService.list(params);
// ExcelUtils.exportExcelToTarget(response, "小区信息录入表", list, IcNeighborHoodExcel.class);
//// ExcelUtils.expor
// }
/**
* 导入数据
* @param file
* @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);
}
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);
}
return new Result().ok("导入成功");
}
}

31
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java

@ -17,9 +17,20 @@
package com.epmet.dao;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.excel.IcBuildingExcel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 楼栋信息
@ -29,5 +40,23 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcBuildingDao extends BaseDao<IcBuildingEntity> {
// IPage<Map<String, Object>> searchBuildingByPage(IPage<IcBuildingEntity> page,
// @Param("neighbor") IcNeighborHoodEntity neighbor,
// @Param("building")IcBuildingEntity building);
IPage<Map<String, Object>> searchBuildingByPage(IPage<IcBuildingEntity> page,
@Param("building")IcBuildingEntity building);
// List<IcBuildingExcel> searchAllBuilding(@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper,
// @Param("ew1") QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper);
// List<IcBuildingExcel> searchAllBuilding(@Param("neighbor") IcNeighborHoodEntity neighbor,
// @Param("building")IcBuildingEntity building);
List<IcBuildingExcel> searchAllBuilding(
@Param("building")IcBuildingEntity building);
List<CustomerAgencyEntity> selectAgencyChildrenList(@Param("agencyId") String agencyId);
List<Map<String, Object>> selectListByName(@Param("neighborNameList")ArrayList<String> strings,
@Param("buildingNameList") ArrayList<String> strings1,
@Param("buildingUnitList") ArrayList<Integer> integers);
}

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

@ -17,9 +17,19 @@
package com.epmet.dao;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcHouseEntity;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.excel.IcHouseExcel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 房屋信息
@ -29,5 +39,19 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcHouseDao extends BaseDao<IcHouseEntity> {
// IPage<Map<String, Object>> searchHouseByPage(IPage<IcHouseEntity> page,
// @Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper,
// @Param("ew1") QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper,
// @Param("ew2") QueryWrapper<IcHouseEntity> houseEntityQueryWrapper);
// IPage<Map<String, Object>> searchHouseByPage(IPage<IcHouseEntity> page,
// @Param("neighbor") IcNeighborHoodEntity neighbor,
// @Param("building") IcBuildingEntity building,
// @Param("house") IcHouseEntity house);
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);
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java

@ -22,10 +22,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.excel.IcNeighborHoodExcel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 小区表
@ -36,5 +39,13 @@ import java.util.Map;
@Mapper
public interface IcNeighborHoodDao extends BaseDao<IcNeighborHoodEntity> {
IPage<Map<String, Object>> searchNeighborhoodByPage(IPage<IcNeighborHoodEntity> page,@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper);
// IPage<Map<String, Object>> searchNeighborhoodByPage(IPage<IcNeighborHoodEntity> page,@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper);
IPage<Map<String, Object>> searchNeighborhoodByPage(IPage<IcNeighborHoodEntity> page,@Param("neighbor") IcNeighborHoodEntity neighbor);
// List<IcNeighborHoodExcel> searchAllNeighborhood(@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper);
List<IcNeighborHoodExcel> searchAllNeighborhood(@Param("neighbor") IcNeighborHoodEntity neighbor);
List<IcNeighborHoodEntity> selectListByName(@Param("neighborNameList")List<String> neighborNameList,
@Param("agencyNameList") List<String> agencyNameList,
@Param("gridNameList") List<String> gridNameList);
}

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

@ -0,0 +1,121 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 楼栋信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-27
*/
@Data
public class IcBuildingExcel {
/*@Excel(name = "楼栋主键")
private String id;
@Excel(name = "客户id")
private String customerId;
@Excel(name = "小区id")
private String neighborHoodId;
@Excel(name = "片区id,neighbor_hood_part.id,可为空。")
private String partId;
@Excel(name = "楼栋名称")
private String buildingName;
@Excel(name = "楼栋类型,这里存储字典编码就可以")
private String type;
@Excel(name = "排序")
private Integer sort;
@Excel(name = "总单元数")
private Integer totalUnitNum;
@Excel(name = "总楼层总数")
private Integer totalFloorNum;
@Excel(name = "总户数")
private Integer totalHouseNum;
@Excel(name = "中心点位:经度")
private String longitude;
@Excel(name = "中心点位:纬度")
private String latitude;
@Excel(name = "坐标位置")
private String coordinatePosition;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;*/
@Excel(name = "所属组织")
@NotBlank(message = "所属组织不能位空")
private String agencyName;
@Excel(name = "所属网格")
@NotBlank(message = "所属网格不能位空")
private String gridName;
@Excel(name = "小区名称")
@NotBlank(message = "小区名称不能位空")
@Length(max=50,message = "小区名称不能超过50个字")
private String neighborHoodName;
@Excel(name = "楼栋名称")
@NotBlank(message = "楼栋名称不能位空")
private String buildingName;
@Excel(name = "单元数")
@NotBlank(message = "单元数不能位空")
private Integer totalUnitNum;
@Excel(name = "层数")
@NotBlank(message = "层数不能位空")
private Integer totalFloorNum;
@Excel(name = "户数")
@NotBlank(message = "户数不能位空")
private Integer totalHouseNum;
}

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

@ -0,0 +1,139 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 房屋信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-27
*/
@Data
public class IcHouseExcel {
/*@Excel(name = "房屋主键")
private String id;
@Excel(name = "客户id")
private String customerId;
@Excel(name = "小区id")
private String neighborHoodId;
@Excel(name = "片区id,neighbor_hood_part.id,可为空。")
private String partId;
@Excel(name = "所属楼栋id")
private String buildingId;
@Excel(name = "所属单元id")
private String buildingUnitId;
@Excel(name = "房屋名字后台插入时生成")
private String houseName;
@Excel(name = "门牌号")
private String doorName;
@Excel(name = "房屋类型,这里存储字典value就可以")
private String houseType;
@Excel(name = "存储字典value")
private String purpose;
@Excel(name = "1出租;0未出租")
private Integer rentFlag;
@Excel(name = "房主姓名")
private String ownerName;
@Excel(name = "房主电话")
private String ownerPhone;
@Excel(name = "房主身份证号")
private String ownerIdCard;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;*/
@Excel(name = "小区名称")
@NotBlank(message = "小区名称不能位空")
@Length(max=50,message = "小区名称不能超过50个字")
private String neighborHoodName;
@Excel(name = "楼栋名称")
@NotBlank(message = "楼栋名称不能位空")
private String buildingName;
@Excel(name = "单元号")
@NotBlank(message = "单元号不能位空")
private Integer buildingUnit;
@Excel(name = "门牌号")
@NotBlank(message = "门牌号不能位空")
private String doorName;
@Excel(name = "房屋类型")
@NotBlank(message = "房屋类型不能位空")
private String houseType;
@Excel(name = "房屋用途")
@NotBlank(message = "房屋用途不能位空")
private String purpose;
@Excel(name = "出租")
@NotBlank(message = "出租不能位空")
private String rentFlag;
@Excel(name = "房主姓名")
@NotBlank(message = "房主姓名不能位空")
private String ownerName;
@Excel(name = "房主电话")
@NotBlank(message = "房主电话不能位空")
private String ownerPhone;
@Excel(name = "房主身份证号")
@NotBlank(message = "房主身份证号不能位空")
private String ownerIdCard;
}

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

@ -0,0 +1,123 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 小区表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-26
*/
@Data
public class IcNeighborHoodExcel {
/*@Excel(name = "小区主键")
private String id;
@Excel(name = "客户id")
private String customerId;
@Excel(name = "小区名称")
private String neighborHoodName;
@Excel(name = "组织id")
private String agencyId;
@Excel(name = "上级组织id")
private String parentAgencyId;
@Excel(name = "组织的所有上级组织id")
private String agencyPids;
@Excel(name = "网格id")
private String gridId;
@Excel(name = "详细地址")
private String address;
@Excel(name = "备注")
private String remark;
@Excel(name = "中心点位:经度")
private String longitude;
@Excel(name = "中心点位:纬度")
private String latitude;
@Excel(name = "坐标区域")
private String coordinates;
@Excel(name = "坐标位置")
private String location;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;*/
@Excel(name = "所属组织")
@NotBlank(message = "所属组织不能位空")
private String agencyName;
@Excel(name = "所属网格")
@NotBlank(message = "所属网格不能位空")
private String gridName;
@Excel(name = "小区名称")
@NotBlank(message = "小区名称不能位空")
@Length(max=50,message = "小区名称不能超过50个字")
private String neighborHoodName;
@Excel(name = "关联物业")
private String propertyName;
@Excel(name = "详细地址")
@NotBlank(message = "详细地址不能位空")
private String address;
@Excel(name = "备注")
@Length(max=500,message = "备注不能超过500个字")
private String remark;
}

47
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcBuildingRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 楼栋信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-27
*/
@Component
public class IcBuildingRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcHouseRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 房屋信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-27
*/
@Component
public class IcHouseRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcNeighborHoodRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 小区表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-26
*/
@Component
public class IcNeighborHoodRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

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

@ -0,0 +1,53 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import java.util.List;
/**
* 楼栋
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
public interface BuildingService {
void UpdateBuilding(String customerId, IcBulidingFormDTO formDTO);
/**
* 删除小区
* @param buildingId
*/
void DelBuilding(String buildingId);
void AddBuilding(String customerId, IcBulidingFormDTO formDTO);
List<BuildingTreeLevelDTO> treeList(String customerId);
void importExcel(String customerId, List<IcBuildingExcel> list);
}

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

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.excel.IcHouseExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import java.util.List;
/**
* 小区表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
public interface HouseService {
void addHouse(String customerId, IcHouseFormDTO formDTO);
void updateHouse(String customerId, IcHouseFormDTO formDTO);
/**
* 删除小区
* @param houseId
*/
void delHouse(String houseId);
void importExcel(String customerId, List<IcHouseExcel> list);
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java

@ -20,6 +20,10 @@ package com.epmet.service;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcNeighborHoodExcel;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 小区表
@ -40,4 +44,13 @@ public interface NeighborHoodService{
* @param neighborHoodId
*/
void DelNeighborhood(String neighborHoodId);
/**
* 导出数据
* @param formDTO
* @param response
*/
void exportNeighborhoodinfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception ;
void importExcel(String customerId,List<IcNeighborHoodExcel> list);
}

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

@ -0,0 +1,296 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.result.ExtStaffPermissionResultDTO;
import com.epmet.entity.*;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@Service
public class BuildingServiceImpl implements BuildingService {
@Autowired
private IcBuildingService icBuildingService;
@Resource
private IcBuildingDao icBuildingDao;
@Autowired
private IcBuildingUnitService icBuildingUnitService;
@Resource
private IcHouseDao icHouseDao;
@Autowired
private IcHouseService icHouseService;
@Resource
private CustomerAgencyDao customerAgencyDao;
@Resource
private CustomerGridDao customerGridDao;
@Resource
private IcNeighborHoodDao icNeighborHoodDao;
@Resource
private CustomerStaffAgencyDao customerStaffAgencyDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void AddBuilding(String customerId, IcBulidingFormDTO formDTO) {
IcBuildingDTO icBuildingDTO= ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class);
icBuildingDTO.setCustomerId(customerId);
IcBuildingEntity entity = ConvertUtils.sourceToTarget(icBuildingDTO, IcBuildingEntity.class);
icBuildingDao.insert(entity);
//设置楼宇单元
Integer totalUnitNum = formDTO.getTotalUnitNum();
List<IcBuildingUnitEntity> unitList = new ArrayList<>();
for(int i =0 ;i<totalUnitNum;i++){
IcBuildingUnitEntity icBuildingUnit= new IcBuildingUnitEntity();
icBuildingUnit.setBuildingId(entity.getId());
icBuildingUnit.setUnitName(String.valueOf(i+1));
icBuildingUnit.setUnitNum(String.valueOf(i+1));
unitList.add(icBuildingUnit);
}
icBuildingUnitService.insertBatch(unitList);
}
@Override
public List<BuildingTreeLevelDTO> treeList(String staffId) {
CustomerStaffAgencyDTO agency = customerStaffAgencyDao.selectLatestCustomerByStaff(staffId);
if(null == agency || StringUtils.isBlank(agency.getAgencyId())){
log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}",staffId);
return new ArrayList<>();
}
//1.获取所在组织及下级组织
CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(agency.getAgencyId());
List<CustomerAgencyEntity> customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId());
customerAgencyList.add(customerAgency);
if(CollectionUtils.isEmpty(customerAgencyList)){
return new ArrayList<>();
}
List<BuildingTreeLevelDTO> agencyList = customerAgencyList.stream().map(item -> {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(item.getId());
buildingTreeLevelDTO.setPId(item.getPid());
buildingTreeLevelDTO.setLabel(item.getOrganizationName());
buildingTreeLevelDTO.setLevel(item.getLevel());
buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO;
}).collect(Collectors.toList());
//2.获取组织所在网格
List<String> agencyIdList = customerAgencyList.stream().map(a->a.getId()).collect(Collectors.toList());
// agencyIdList.add(customerAgency.getId());
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getPid, agencyIdList));
if(CollectionUtils.isEmpty(customerGridList)){
return covertToTree(customerAgency,agencyList);
}
List<BuildingTreeLevelDTO> gridList = customerGridList.stream().map(item -> {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(item.getId());
buildingTreeLevelDTO.setLabel(item.getGridName());
buildingTreeLevelDTO.setLevel("grid");
buildingTreeLevelDTO.setPId(item.getPid());
buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO;
}).collect(Collectors.toList());
//3.获取网格下的所有小区
List<String> gridIdList = customerGridList.stream().map(a->a.getId()).collect(Collectors.toList());
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList));
if(CollectionUtils.isEmpty(customerGridList)){
agencyList.addAll(gridList);
return covertToTree(customerAgency,agencyList);
}
List<BuildingTreeLevelDTO> neighbourHoodList = icNeighborHoodList.stream().map(item -> {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(item.getId());
buildingTreeLevelDTO.setPId(item.getGridId());
buildingTreeLevelDTO.setLabel(item.getNeighborHoodName());
buildingTreeLevelDTO.setLevel("neighbourHood");
buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO;
}).collect(Collectors.toList());
//3.获取小区下的所有楼宇
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(a->a.getId()).collect(Collectors.toList());
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList));
if(CollectionUtils.isEmpty(neighborHoodIdList)){
agencyList.addAll(gridList);
agencyList.addAll(neighbourHoodList);
return covertToTree(customerAgency,agencyList);
}
//组合封装
List<BuildingTreeLevelDTO> buildingList = icBuildingList.stream().map(item -> {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(item.getId());
buildingTreeLevelDTO.setPId(item.getNeighborHoodId());
buildingTreeLevelDTO.setLabel(item.getBuildingName());
buildingTreeLevelDTO.setLevel("building");
buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO;
}).collect(Collectors.toList());
//组织
// gridList.stream()
// Map<String, List<BuildingTreeLevelDTO>> gridMap = gridList.stream().collect(Collectors.groupingBy(e -> e.getPId()));
// List<BuildingTreeLevelDTO> allList = agencyList.addAll(gridList)
agencyList.addAll(gridList);
agencyList.addAll(neighbourHoodList);
agencyList.addAll(buildingList);
return covertToTree(customerAgency,agencyList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void importExcel(String customerId, List<IcBuildingExcel> list) {
//导入
if(CollectionUtils.isEmpty(list)){
return ;
}
//查询所有组织和网格根据名字
//获取所有小区 list 根据组织和网格
Set<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toSet());
Set<String> agencyNameList = list.stream().map(item -> item.getAgencyName()).collect(Collectors.toSet());
Set<String> gridNameList = list.stream().map(item -> item.getGridName()).collect(Collectors.toSet());
List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectListByName(new ArrayList<String>(neighborNameList),new ArrayList<String>(agencyNameList),new ArrayList<String>(gridNameList));
// List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getNeighborHoodName, neighborNameList));
Map<String,IcNeighborHoodEntity> neighborHoodMap = neighborHoodList.stream().collect(Collectors.toMap(IcNeighborHoodEntity::getNeighborHoodName, Function.identity(),(key1, key2)->key1));
//2.获取小区数据
//封装数据
List<IcBuildingEntity> buildingEntityList = new ArrayList<>();
List<IcBuildingUnitEntity> icBuildingUnitEntityList = new ArrayList<>();
for (IcBuildingExcel icBuildingExcel : list) {
IcBuildingEntity entity = new IcBuildingEntity();
String uuid = UUID.randomUUID().toString().replace("-", "");
entity.setId(uuid);
entity.setCustomerId(customerId);
entity.setNeighborHoodId(neighborHoodMap.get(icBuildingExcel.getNeighborHoodName()).getId());
entity.setBuildingName(icBuildingExcel.getBuildingName());
entity.setTotalUnitNum(icBuildingExcel.getTotalUnitNum());
entity.setTotalFloorNum(icBuildingExcel.getTotalFloorNum());
entity.setTotalHouseNum(icBuildingExcel.getTotalHouseNum());
buildingEntityList.add(entity);
Integer totalUnitNum = icBuildingExcel.getTotalUnitNum();
//设置楼宇单元
List<IcBuildingUnitEntity> unitList = new ArrayList<>();
for(int i =0 ;i<totalUnitNum;i++){
IcBuildingUnitEntity icBuildingUnit= new IcBuildingUnitEntity();
icBuildingUnit.setBuildingId(uuid);
icBuildingUnit.setUnitName(String.valueOf(i+1));
icBuildingUnit.setUnitNum(String.valueOf(i+1));
unitList.add(icBuildingUnit);
}
icBuildingUnitEntityList.addAll(unitList);
}
//3.保存
//4.新增单元
icBuildingService.insertBatch(buildingEntityList);
icBuildingUnitService.insertBatch(icBuildingUnitEntityList);
}
private List<BuildingTreeLevelDTO> covertToTree(CustomerAgencyEntity customerAgency,List<BuildingTreeLevelDTO> agencyList) {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(customerAgency.getId());
buildingTreeLevelDTO.setLabel(customerAgency.getOrganizationName());
buildingTreeLevelDTO.setLevel(customerAgency.getLevel());
buildingTreeLevelDTO.setChildren(new ArrayList<>());
recursionCovertToTree(buildingTreeLevelDTO,agencyList);
List<BuildingTreeLevelDTO> result = new ArrayList<>();
result.add(buildingTreeLevelDTO);
return result;
}
private void recursionCovertToTree(BuildingTreeLevelDTO parent, List<BuildingTreeLevelDTO> customerAgencyList) {
//获取子节点
List<BuildingTreeLevelDTO> subList = customerAgencyList.stream().filter(item -> item.getPId().equals(parent.getId())).collect(Collectors.toList());
for(BuildingTreeLevelDTO agencyEntity :subList){
recursionCovertToTree(agencyEntity,customerAgencyList);
}
parent.setChildren(subList);
}
/**
* 更新
* @param customerId
* @param formDTO
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void UpdateBuilding(String customerId, IcBulidingFormDTO formDTO) {
IcBuildingDTO icBuilding= icBuildingService.get(formDTO.getBuildingId());
if(!icBuilding.getNeighborHoodId().equals(formDTO.getNeighborHoodId())){
//更新对应房屋小区名
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()));
icHouseEntities.forEach(item->{
item.setNeighborHoodId(formDTO.getNeighborHoodId());
});
icHouseService.updateBatchById(icHouseEntities);
}
IcBuildingDTO icBuildingDTO= ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class);
icBuildingDTO.setId(formDTO.getBuildingId());
icBuildingDTO.setCustomerId(customerId);
icBuildingService.update(icBuildingDTO);
//更新楼宇单元
//如果楼宇单元大于之前的楼宇单元,新增单元
//如果小于,判断是否存在房屋,如果存在就提示不能更改
}
/**
* 删除
* @param buildingId
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void DelBuilding(String buildingId) {
//删除小区
icBuildingService.deleteById(buildingId);
}
}

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

@ -0,0 +1,152 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dao.IcBuildingUnitDao;
import com.epmet.dao.IcHouseDao;
import com.epmet.dao.IcNeighborHoodDao;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.IcBuildingUnitDTO;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.entity.IcHouseEntity;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
public class HouseServiceImpl implements HouseService {
@Autowired
private IcHouseService icHouseService;
@Autowired
private IcBuildingService icBuildingService;
@Autowired
private IcBuildingUnitService icBuildingUnitService;
@Resource
private IcNeighborHoodDao icNeighborHoodDao;
@Resource
private IcBuildingDao icBuildingDao;
@Resource
private IcBuildingUnitDao icBuildingUnitDao;
@Resource
private IcHouseDao icHouseDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void addHouse(String customerId, IcHouseFormDTO formDTO) {
IcHouseDTO icHouseDTO= ConvertUtils.sourceToTarget(formDTO, IcHouseDTO.class);
icHouseDTO.setCustomerId(customerId);
icHouseDTO.setRentFlag(formDTO.getRentFlag()?1:0);
icHouseDTO.setHouseName(getHouseName(formDTO));
icHouseService.save(icHouseDTO);
}
private String getHouseName(IcHouseFormDTO formDTO){
//设置房间名 楼栋-单元号-门牌号
IcBuildingDTO icBuilding = icBuildingService.get(formDTO.getBuildingUnitId());
IcBuildingUnitDTO icBuildingUnit = icBuildingUnitService.get(formDTO.getBuildingUnitId());
String doorName = formDTO.getDoorName();
String buildingName = Optional.ofNullable(icBuilding).map(u->u.getBuildingName()).orElse("");
String unitName = Optional.ofNullable(icBuildingUnit).map(u->u.getUnitNum()).orElse("");
return new StringBuilder().append(buildingName).append("-").append(unitName).append("-").append(doorName).toString();
}
/**
* 更新
* @param customerId
* @param formDTO
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHouse(String customerId, IcHouseFormDTO formDTO) {
IcHouseDTO icHouseDTO = ConvertUtils.sourceToTarget(formDTO, IcHouseDTO.class);
icHouseDTO.setId(formDTO.getHouseId());
icHouseDTO.setCustomerId(customerId);
icHouseDTO.setRentFlag(formDTO.getRentFlag()?1:0);
//设置
icHouseDTO.setHouseName(getHouseName(formDTO));
icHouseService.update(icHouseDTO);
}
/**
* 删除
* @param houseId
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void delHouse(String houseId) {
//删除小区
icHouseService.deleteById(houseId);
}
@Override
public void importExcel(String customerId, List<IcHouseExcel> list) {
//导入
if(CollectionUtils.isEmpty(list)){
return ;
}
//获取所有小区 list
// List<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toList());
// List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getNeighborHoodName, neighborNameList));
// Map<String,IcNeighborHoodEntity> neighborHoodMap = neighborHoodList.stream().collect(Collectors.toMap(IcNeighborHoodEntity::getNeighborHoodName, Function.identity(),(key1, key2)->key1));
//获取所有楼宇 list
// List<String> buildingNameList = list.stream().map(item -> item.getBuildingName()).collect(Collectors.toList());
// icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().in(IcBuildingEntity::getBuildingName, buildingNameList).in();
Set<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toSet());
Set<String> buildingNameList = list.stream().map(item -> item.getBuildingName()).collect(Collectors.toSet());
Set<Integer> buildingUnitList = list.stream().map(item -> item.getBuildingUnit()).collect(Collectors.toSet());
List<Map<String,Object>> buildMapList = icBuildingDao.selectListByName(new ArrayList<String>(neighborNameList),new ArrayList<String>(buildingNameList),new ArrayList<Integer>(buildingUnitList));
//转Map
Map<String,Map<String,Object>> buildMap = new HashMap<>();
buildMapList.forEach(item->{
buildMap.put(item.get("neighborName")+","+item.get("buildingName")+","+item.get("unitNum"),item);
});
//封装数据
List<IcHouseEntity> houseEntityList = new ArrayList<>();
for (IcHouseExcel icHouseExcel : list) {
IcHouseEntity entity = new IcHouseEntity();
String uuid = UUID.randomUUID().toString().replace("-", "");
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.setDoorName(icHouseExcel.getDoorName());
entity.setHouseType(icHouseExcel.getHouseType());
entity.setPurpose(icHouseExcel.getPurpose());
entity.setRentFlag("是".equals(icHouseExcel.getRentFlag())?1:0);
entity.setOwnerName(icHouseExcel.getOwnerName());
entity.setOwnerPhone(icHouseExcel.getOwnerPhone());
entity.setOwnerIdCard(icHouseExcel.getOwnerIdCard());
houseEntityList.add(entity);
}
//3.保存
//4.新增单元
icHouseService.insertBatch(houseEntityList);
}
}

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

@ -1,37 +1,43 @@
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.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.NeighborhoodConstant;
import com.epmet.dao.IcNeighborHoodDao;
import com.epmet.dao.IcNeighborHoodPropertyDao;
import com.epmet.dao.*;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.IcNeighborHoodPropertyDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.entity.IcNeighborHoodPropertyEntity;
import com.epmet.entity.*;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcHouseExcel;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.IcNeighborHoodPropertyService;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -52,6 +58,16 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
@Resource
private IcNeighborHoodDao icNeighborHoodDao;
@Resource
private IcBuildingDao icBuildingDao;
@Resource
private IcHouseDao icHouseDao;
@Resource
private CustomerAgencyDao customerAgencyDao;
@Resource
private CustomerGridDao customerGridDao;
@Resource
private IcPropertyManagementDao icPropertyManagementDao;
@Override
@Transactional(rollbackFor = Exception.class)
@ -66,14 +82,15 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
CustomerAgencyDTO customerAgencyDTO = Optional.ofNullable(customerAgencyResult.getData()).orElse(new CustomerAgencyDTO());
icNeighborHoodDTO.setParentAgencyId(customerAgencyDTO.getPid());
icNeighborHoodDTO.setAgencyPids(customerAgencyDTO.getPids());
icNeighborHoodService.save(icNeighborHoodDTO);
IcNeighborHoodEntity entity = ConvertUtils.sourceToTarget(icNeighborHoodDTO, IcNeighborHoodEntity.class);
// icNeighborHoodService.save(icNeighborHoodDTO);
icNeighborHoodDao.insert(entity);
//设置物业关联
String propertyId = formDTO.getPropertyId();
if(!StringUtils.isEmpty(propertyId)){
//保存物业关系表
IcNeighborHoodPropertyDTO icNeighborHoodPropertyDTO = new IcNeighborHoodPropertyDTO();
icNeighborHoodPropertyDTO.setNeighborHoodId(icNeighborHoodDTO.getId());
icNeighborHoodPropertyDTO.setNeighborHoodId(entity.getId());
icNeighborHoodPropertyDTO.setPropertyId(propertyId);
icNeighborHoodPropertyService.save(icNeighborHoodPropertyDTO);
}
@ -85,7 +102,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
*/
@Override
public IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
String dataType = formDTO.getDataType();
String dataType = formDTO.getLevel();
Integer pageNo = formDTO.getPageNo();
Integer pageSize = formDTO.getPageSize();
@ -101,14 +118,93 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
result.setList(resultMap.getRecords());
}else if(NeighborhoodConstant.BUILDING.equals(dataType)){
//如果类型是building 查楼栋
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO);
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 = searchNeighborhood(formDTO);
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);
// 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) {
IPage<IcNeighborHoodEntity> page = new Page<IcNeighborHoodEntity>(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());
// neighborHoodEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
neighbor.setDelFlag("0");
return icNeighborHoodDao.searchNeighborhoodByPage(page, neighbor);
}
/**
* 更新
* @param customerId
@ -171,16 +267,148 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
}
private IPage<Map<String,Object>> searchNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
/**
* 导出数据
* @param formDTO
* @param response
*/
@Override
public void exportNeighborhoodinfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
String dataType = formDTO.getLevel();
IPage<IcNeighborHoodEntity> page = new Page<IcNeighborHoodEntity>(formDTO.getPageNo(),formDTO.getPageSize());
if(StringUtils.isEmpty(dataType)|| NeighborhoodConstant.NEIGHBOR_HOOD.equals(dataType)){
//如果类型是neighbourHood 查小区
//导出小区
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 ;
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void importExcel(String customerId,List<IcNeighborHoodExcel> list) {
//导入
if(CollectionUtils.isEmpty(list)){
return ;
}
//获取所有组织 list
List<String> agencyNameList = list.stream().map(item -> item.getAgencyName()).collect(Collectors.toList());
//获取所有网格 list
List<String> gridNameList = list.stream().map(item->item.getGridName()).collect(Collectors.toList());
//获取所有物业 list
List<String> propertyNameList = list.stream().map(item->item.getPropertyName()).collect(Collectors.toList());
//查询对应的id
List<CustomerAgencyEntity> customerAgencyList = customerAgencyDao.selectList(new QueryWrapper<CustomerAgencyEntity>().lambda().in(CustomerAgencyEntity::getOrganizationName, agencyNameList));
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getGridName, gridNameList));
List<IcPropertyManagementEntity> icPropertyManagementList = icPropertyManagementDao.selectList(new QueryWrapper<IcPropertyManagementEntity>().lambda().in(IcPropertyManagementEntity::getName, propertyNameList));
Map<String,CustomerAgencyEntity> agencyMap = customerAgencyList.stream().collect(Collectors.toMap(CustomerAgencyEntity::getOrganizationName, Function.identity(),(key1, key2)->key1));
Map<String,CustomerGridEntity> gridMap = customerGridList.stream().collect(Collectors.toMap(CustomerGridEntity::getGridName,Function.identity(),(key1,key2)->key1));
Map<String,IcPropertyManagementEntity> propertyMap = icPropertyManagementList.stream().collect(Collectors.toMap(IcPropertyManagementEntity::getName,Function.identity(),(key1,key2)->key1));
//封装数据
List<IcNeighborHoodEntity> neighborHoodEntityList = new ArrayList<>();
List<IcNeighborHoodPropertyEntity> icNeighborHoodPropertyEntityList = new ArrayList<>();
for (IcNeighborHoodExcel icNeighborHoodExcel : list) {
IcNeighborHoodEntity entity = new IcNeighborHoodEntity();
String uuid =UUID.randomUUID().toString().replace("-", "");
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.setAddress(icNeighborHoodExcel.getAddress());
entity.setRemark(icNeighborHoodExcel.getRemark());
neighborHoodEntityList.add(entity);
QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
neighborHoodEntityQueryWrapper.lambda()
.eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
.like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
IcNeighborHoodPropertyEntity entity1 = new IcNeighborHoodPropertyEntity();
entity1.setPropertyId(propertyMap.get(icNeighborHoodExcel.getPropertyName()).getId());
entity1.setNeighborHoodId(uuid);
icNeighborHoodPropertyEntityList.add(entity1);
}
// icNeighborHoodDao.
//保存
icNeighborHoodService.insertBatch(neighborHoodEntityList);
icNeighborHoodPropertyService.insertBatch(icNeighborHoodPropertyEntityList);
}
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<>();
// 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());
// neighborHoodEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
neighbor.setDelFlag("0");
return icNeighborHoodDao.searchAllNeighborhood(neighbor);
}
private List<IcHouseExcel> searchAllHouse(ListIcNeighborHoodFormDTO formDTO) {
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
return icNeighborHoodDao.searchNeighborhoodByPage(page, neighborHoodEntityQueryWrapper);
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0");
return icHouseDao.searchAllHouse(neighbor,building,house);
}
}

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

@ -0,0 +1,276 @@
package com.epmet.util;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
public class ExcelPoiUtils {
/**
* excel 导出
*
* @param list 数据列表
* @param fileName 导出时的excel名称
* @param response
*/
public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) throws IOException {
defaultExport(list, fileName, response);
}
/**
* 默认的 excel 导出
*
* @param list 数据列表
* @param fileName 导出时的excel名称
* @param response
*/
private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) throws IOException {
//把数据添加到excel表格中
Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF);
downLoadExcel(fileName, response, workbook);
}
/**
* excel 导出
*
* @param list 数据列表
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param response
* @param exportParams 导出参数标题sheet名称是否创建表头表格类型
*/
private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) throws IOException {
//把数据添加到excel表格中
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list);
downLoadExcel(fileName, response, workbook);
}
/**
* excel 导出
*
* @param list 数据列表
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param exportParams 导出参数标题sheet名称是否创建表头表格类型
* @param response
*/
public static void exportExcel(List<?> list, Class<?> pojoClass, String fileName, ExportParams exportParams, HttpServletResponse response) throws IOException {
defaultExport(list, pojoClass, fileName, response, exportParams);
}
/**
* excel 导出
*
* @param list 数据列表
* @param title 表格内数据标题
* @param sheetName sheet名称
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param response
*/
public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, HttpServletResponse response) throws IOException {
defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF));
}
/**
* excel 导出
*
* @param list 数据列表
* @param title 表格内数据标题
* @param sheetName sheet名称
* @param pojoClass pojo类型
* @param fileName 导出时的excel名称
* @param isCreateHeader 是否创建表头
* @param response
*/
public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, boolean isCreateHeader, HttpServletResponse response) throws IOException {
ExportParams exportParams = new ExportParams(title, sheetName, ExcelType.XSSF);
exportParams.setCreateHeadRows(isCreateHeader);
defaultExport(list, pojoClass, fileName, response, exportParams);
}
/**
* 根据模板生成excel后导出
* @param templatePath 模板路径
* @param map 数据集合
* @param fileName 文件名
* @param response
* @throws IOException
*/
public static void exportExcel(TemplateExportParams templatePath, Map<String, Object> map, String fileName, HttpServletResponse response) throws IOException {
Workbook workbook = ExcelExportUtil.exportExcel(templatePath, map);
downLoadExcel(fileName, response, workbook);
}
/**
* excel下载
*
* @param fileName 下载时的文件名称
* @param response
* @param workbook excel数据
*/
private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xlsx", "UTF-8"));
workbook.write(response.getOutputStream());
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param file excel文件
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(MultipartFile file, Class<T> pojoClass) throws IOException {
return importExcel(file, 1, 1, pojoClass);
}
/**
* excel 导入
*
* @param filePath excel文件路径
* @param titleRows 表格内数据标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (StringUtils.isBlank(filePath)) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
params.setNeedSave(true);
params.setSaveUrl("/excel/");
try {
return ExcelImportUtil.importExcel(new File(filePath), pojoClass, params);
} catch (NoSuchElementException e) {
throw new IOException("模板不能为空");
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param file 上传的文件
* @param titleRows 表格内数据标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (file == null) {
return null;
}
try {
return importExcel(file.getInputStream(), titleRows, headerRows, pojoClass);
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param inputStream 文件输入流
* @param titleRows 表格内数据标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(InputStream inputStream, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (inputStream == null) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
params.setSaveUrl("/excel/");
params.setNeedSave(true);
try {
return ExcelImportUtil.importExcel(inputStream, pojoClass, params);
} catch (NoSuchElementException e) {
throw new IOException("excel文件不能为空");
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入有错误信息
*
* @param file 上传的文件
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> ExcelImportResult<T> importExcelMore(MultipartFile file, Class<T> pojoClass) throws IOException {
if (file == null) {
return null;
}
try {
return importExcelMore(file.getInputStream(), pojoClass);
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* excel 导入
*
* @param inputStream 文件输入流
* @param pojoClass pojo类型
* @param <T>
* @return
*/
private static <T> ExcelImportResult<T> importExcelMore(InputStream inputStream, Class<T> pojoClass) throws IOException {
if (inputStream == null) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(1);//表格内数据标题行
params.setHeadRows(1);//表头行
params.setSaveUrl("/excel/");
params.setNeedSave(true);
params.setNeedVerify(true);
try {
return ExcelImportUtil.importExcelMore(inputStream, pojoClass, params);
} catch (NoSuchElementException e) {
throw new IOException("excel文件不能为空");
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
}

2
epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml

@ -108,6 +108,8 @@ mybatis-plus:
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
feign:
hystrix:

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

@ -25,5 +25,233 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!--<select id="searchBuildingByPage" resultType="map">
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
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
and b.ID in (
select c.id from ic_neighbor_hood c
INNER JOIN customer_agency d on c.AGENCY_ID = d.ID
INNER JOIN customer_grid e on c.GRID_ID = e.ID
${ew.customSqlSegment}
)
${ew1}
</select>-->
<select id="searchBuildingByPage" resultType="map">
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
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.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="searchBuildingByPage" resultType="map">
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
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND b.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND b.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND b.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND b.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<where>
<if test="building.id != null and building.id.trim() != ''">
AND a.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="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
select
a.BUILDING_NAME as buildingName,
a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName,
f.ORGANIZATION_NAME as agencyName,
g.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
and b.ID in (
select c.id from ic_neighbor_hood c
INNER JOIN customer_agency d on c.AGENCY_ID = d.ID
INNER JOIN customer_grid e on c.GRID_ID = e.ID
${ew.customSqlSegment}
)
LEFT JOIN customer_agency f on b.AGENCY_ID = f.ID
LEFT JOIN customer_grid g on b.GRID_ID = g.ID
${ew1.customSqlSegment}
</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
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND b.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND b.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND b.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND b.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<where>
<if test="building.id != null and building.id.trim() != ''">
AND a.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="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">
SELECT
ca.id AS Id,
ca.organization_name AS organizationName,
ca.LEVEL AS LEVEL,
ca.pid as pid,
ca.pids as pids
FROM
customer_agency ca
WHERE
ca.del_flag = '0'
and
CONCAT(':',ca.pids, ':') like CONCAT('%:',#{agencyId},':%')
</select>
<select id="selectListByName" resultType="map">
select
a.id as neighborId,
b.id as buildingId,
c.id as buildingUnitId,
a.NEIGHBOR_HOOD_NAME as neighborName,
b.BUILDING_NAME as buildingName,
c.UNIT_NUM as unitNum
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}
</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}
</foreach>
WHERE a.DEL_FLAG = '0' and a.NEIGHBOR_HOOD_NAME in
<foreach collection="neighborNameList" open="(" separator="," close=")" item="val">
${val}
</foreach>
</select>
</mapper>

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

@ -26,5 +26,201 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!--<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
and c.ID in (select e.ID from ic_building e ${ew1.customSqlSegment})
INNER JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID
and c.ID in (select f.ID from ic_neighbor_hood f
INNER JOIN customer_agency g on f.AGENCY_ID = g.ID
INNER JOIN customer_grid h on f.GRID_ID = h.ID
${ew2.customSqlSegment}
)
LEFT JOIN ic_building_unit d on a.BUILDING_UNIT_ID = d.ID
${ew.customSqlSegment}
</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
<if test="building.id != null and building.id.trim() != ''">
AND b.ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND b.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
</if>
INNER JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND c.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND c.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND c.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND c.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
LEFT JOIN ic_building_unit d on a.BUILDING_UNIT_ID = d.ID
<where>
<if test="house.ownerName != null and house.ownerName.trim() != ''">
AND a.OWNER_NAME = #{house.ownerName}
</if>
<if test="house.OWNER_PHONE != null and house.OWNER_PHONE.trim() != ''">
AND a.OWNER_PHONE = #{house.ownerPhone}
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</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>
<!-- <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
<if test="building.id != null and building.id.trim() != ''">
AND b.ID = #{building.id}
</if>
<if test="building.buildingName != null and building.buildingName.trim() != ''">
AND b.BUILDING_NAME like concat('%',trim(#{building.buildingName}),'%')
</if>
INNER JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND c.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND c.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND c.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND c.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
LEFT JOIN ic_building_unit d on a.BUILDING_UNIT_ID = d.ID
<where>
<if test="house.ownerName != null and house.ownerName.trim() != ''">
AND a.OWNER_NAME = #{house.ownerName}
</if>
<if test="house.OWNER_PHONE != null and house.OWNER_PHONE.trim() != ''">
AND a.OWNER_PHONE = #{house.ownerPhone}
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.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,
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>

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

@ -25,7 +25,7 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="searchNeighborhoodByPage" resultType="map">
<!--<select id="searchNeighborhoodByPage" resultType="map">
select
a.id as neighborHoodId,
a.NEIGHBOR_HOOD_NAME as neighborHoodName,
@ -39,8 +39,121 @@
left join customer_agency b on a.AGENCY_ID = b.ID
left join customer_grid c on a.GRID_ID = c.ID
${ew.customSqlSegment}
<where>
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND a.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND a.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND a.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND a.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>-->
<select id="searchNeighborhoodByPage" resultType="map">
select
a.id as neighborHoodId,
a.NEIGHBOR_HOOD_NAME as neighborHoodName,
a.ADDRESS as address,
a.REMARK as remark,
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_grid c on a.GRID_ID = c.ID
<where>
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND a.GRID_ID = #{neighbor.id}
</if>
<if test="neighbor.delFlag != null and neighbor.delFlag.trim() != ''">
AND a.DEL_FLAG = #{neighbor.delFlag}
</if>
</where>
</select>
<select id="searchAllNeighborhood" resultType="com.epmet.excel.IcNeighborHoodExcel">
select
a.NEIGHBOR_HOOD_NAME as neighborHoodName,
a.ADDRESS as address,
a.REMARK as remark,
e.NAME as propertyName,
b.ORGANIZATION_NAME as agencyName,
c.GRID_NAME as gridName
from ic_neighbor_hood a
left join customer_agency b on a.AGENCY_ID = b.ID
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
<where>
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND a.GRID_ID = #{neighbor.id}
</if>
<if test="neighbor.delFlag != null and neighbor.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>
<!--<select id="searchAllNeighborhood" resultType="com.epmet.excel.IcNeighborHoodExcel">
select
a.NEIGHBOR_HOOD_NAME as neighborHoodName,
a.ADDRESS as address,
a.REMARK as remark,
e.NAME as propertyName,
b.ORGANIZATION_NAME as agencyName,
c.GRID_NAME as gridName
from ic_neighbor_hood a
left join customer_agency b on a.AGENCY_ID = b.ID
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
<where>
<if test="neighbor.id != null and neighbor.id.trim() != ''">
AND a.ID = #{neighbor.id}
</if>
<if test="neighbor.agencyId != null and neighbor.agencyId.trim() != ''">
AND a.AGENCY_ID = #{neighbor.agencyId}
</if>
<if test="neighbor.gridId != null and neighbor.gridId.trim() != ''">
AND a.GRID_ID = #{neighbor.gridId}
</if>
<if test="neighbor.neighborHoodName != null and neighbor.neighborHoodName.trim() != ''">
AND a.NEIGHBOR_HOOD_NAME like concat('%',trim(#{neighbor.neighborHoodName}),'%')
</if>
<if test="house.delFlag != null and house.delFlag.trim() != ''">
AND a.DEL_FLAG = #{building.delFlag}
</if>
</where>
</select>-->
<select id="selectListByName" resultMap="icNeighborHoodMap">
select a.* from
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}
</foreach>
INNER JOIN customer_grid c on a.GRID_ID = c.ID and c.PID = b.ID and b.GRID_NAME in
<foreach collection="gridNameList" open="(" separator="," close=")" item="val">
${val}
</foreach>
where a.DEL_FLAG= '0'and a.NEIGHBOR_HOOD_NAME in
<foreach collection="neighborNameList" open="(" separator="," close=")" item="val">
${val}
</foreach>
</select>
</mapper>
Loading…
Cancel
Save