Browse Source

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

master
lzh 4 years ago
parent
commit
2b7422da33
  1. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/BuildingTreeLevelDTO.java
  2. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java
  3. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java
  4. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java
  5. 57
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/BuildingTypeEnums.java
  6. 59
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HousePurposeEnums.java
  7. 58
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HouseRentFlagEnums.java
  8. 54
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HouseTypeEnums.java
  9. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  10. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcBuildingExcel.java
  11. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  12. 30
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  13. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  14. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_export.xlsx
  15. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx
  16. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx
  17. 16
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  18. 19
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

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

@ -47,6 +47,9 @@ public class BuildingTreeLevelDTO implements Serializable {
private List<BuildingTreeLevelDTO> children; private List<BuildingTreeLevelDTO> children;
private String longitude;
private String latitude;
} }

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

@ -42,14 +42,14 @@ public class IcBulidingFormDTO implements Serializable {
/** /**
* 组织id * 组织id
*/ */
@NotBlank(message = "组织id不能为空", groups = {AddGroup.class}) @NotBlank(message = "组织id不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String agencyId; private String agencyId;
/** /**
* 网格id * 网格id
*/ */
@NotBlank(message = "网格不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String gridId; private String gridId;
@ -69,6 +69,7 @@ public class IcBulidingFormDTO implements Serializable {
/** /**
* 楼栋类型 * 楼栋类型
*/ */
@NotBlank(message = "楼栋类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String type=""; private String type="";
/** /**

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

@ -45,7 +45,7 @@ public class IcHouseFormDTO implements Serializable {
@NotBlank(message = "小区id不能为空", groups = {AddGroup.class, UpdateGroup.class}) @NotBlank(message = "小区id不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String neighborHoodId; private String neighborHoodId;
@NotBlank(message = "所属楼栋ID不能为空", groups = { UpdateGroup.class}) @NotBlank(message = "所属楼栋ID不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String buildingId; private String buildingId;
/** /**

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

@ -1,6 +1,5 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -20,7 +19,8 @@ public class IcNeighborHoodResultDTO implements Serializable {
/** /**
* 总条数 * 总条数
* */ * */
private Long total;
private Integer total;
// /** // /**
// * 数据类型【小区:neighbourHood,楼栋:building,房屋:house】 // * 数据类型【小区:neighbourHood,楼栋:building,房屋:house】

57
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/BuildingTypeEnums.java

@ -0,0 +1,57 @@
package com.epmet.enums;
import org.springframework.util.StringUtils;
public enum BuildingTypeEnums {
SPF("1","商品房"),
ZJF("2","自建房"),
BS("3","别墅");
private String key;
private String value;
BuildingTypeEnums(String key, String value) {
this.key = key;
this.value=value;
}
public static String getTypeValue(Object key){
if(null == key){
return null;
}
BuildingTypeEnums buildingTypeEnums = getBuildType(String.valueOf(key));
return buildingTypeEnums == null ? null : buildingTypeEnums.getValue();
}
public static String getKeyByValue(String value){
if(StringUtils.isEmpty(value)){
return "";
}
for (BuildingTypeEnums e : BuildingTypeEnums.values()) {
if (e.getValue().equals(value)) {
return e.getKey();
}
}
return "";
}
private static BuildingTypeEnums getBuildType(String key) {
for (BuildingTypeEnums b :BuildingTypeEnums.values()) {
if (b.getKey().equals(key)) {
return b;
}
}
return null;
}
public String getValue() {
return value;
}
public String getKey() {
return key;
}
}

59
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HousePurposeEnums.java

@ -0,0 +1,59 @@
package com.epmet.enums;
import org.springframework.util.StringUtils;
public enum HousePurposeEnums {
ZZ("1","住宅"),
SY("2","商业"),
BG("3","办公"),
GY("4","工业"),
CC("5","仓储"),
SZHY("6","商住混用"),
QT("7","其他");
private String key;
private String value;
HousePurposeEnums(String key, String value) {
this.key = key;
this.value=value;
}
public static String getKeyByValue(String value){
if(StringUtils.isEmpty(value)){
return "";
}
for (HousePurposeEnums e : HousePurposeEnums.values()) {
if (e.getValue().equals(value)) {
return e.getKey();
}
}
return "";
}
public static String getTypeValue(Object key){
if(null == key){
return null;
}
HousePurposeEnums buildingTypeEnums = getValueByKey(String.valueOf(key));
return buildingTypeEnums == null ? null : buildingTypeEnums.getValue();
}
private static HousePurposeEnums getValueByKey(String key) {
for (HousePurposeEnums b : HousePurposeEnums.values()) {
if (b.getKey().equals(key)) {
return b;
}
}
return null;
}
public String getValue() {
return value;
}
public String getKey() {
return key;
}
}

58
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HouseRentFlagEnums.java

@ -0,0 +1,58 @@
package com.epmet.enums;
import org.springframework.util.StringUtils;
public enum HouseRentFlagEnums {
YES(1,"是"),
NO(0,"否");
private Integer code;
private String name;
HouseRentFlagEnums(Integer code, String name) {
this.code = code;
this.name=name;
}
public static String getTypeValue(Object code){
if(code == null){
return null;
}
HouseRentFlagEnums houseRentFlagEnums = getByKey(Integer.parseInt(code.toString()));
return houseRentFlagEnums == null ? null : houseRentFlagEnums.getName();
}
private static HouseRentFlagEnums getByKey(Integer code) {
for (HouseRentFlagEnums e : HouseRentFlagEnums.values()) {
if (e.getCode().equals(code)) {
return e;
}
}
return null;
}
public static Integer getCodeByName(String name){
if(StringUtils.isEmpty(name)){
return 0;
}
for (HouseRentFlagEnums e : HouseRentFlagEnums.values()) {
if (e.getName().equals(name)) {
return e.getCode();
}
}
return 0;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}

54
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HouseTypeEnums.java

@ -0,0 +1,54 @@
package com.epmet.enums;
import org.springframework.util.StringUtils;
public enum HouseTypeEnums {
SPF("1","楼房"),
ZJF("2","平房"),
BS("3","别墅");
private String key;
private String value;
HouseTypeEnums(String key, String value) {
this.key = key;
this.value=value;
}
public static String getKeyByValue(String value){
if(StringUtils.isEmpty(value)){
return "";
}
for (HouseTypeEnums e : HouseTypeEnums.values()) {
if (e.getValue().equals(value)) {
return e.getKey();
}
}
return "";
}
public static String getTypeValue(Object key){
if(null == key){
return null;
}
HouseTypeEnums buildingTypeEnums = getByKey(String.valueOf(key));
return buildingTypeEnums == null ? null : buildingTypeEnums.getValue();
}
private static HouseTypeEnums getByKey(String key) {
for (HouseTypeEnums b : HouseTypeEnums.values()) {
if (b.getKey().equals(key)) {
return b;
}
}
return null;
}
public String getValue() {
return value;
}
public String getKey() {
return key;
}
}

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

@ -152,6 +152,21 @@ public class BuildingController {
} }
/**
* 导出
* @param formDTO
* @param response
* @throws Exception
*/
@GetMapping("export")
public void export(HttpServletResponse response) throws Exception {
ListIcNeighborHoodFormDTO formDTO = new ListIcNeighborHoodFormDTO();
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
buildingService.exportBuildinginfo(formDTO,response);
}
/** /**
* 导入数据 * 导入数据
* @param file * @param file

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

@ -109,6 +109,10 @@ public class IcBuildingExcel extends ExcelVerifyInfo implements Serializable {
@NotBlank(message = "楼栋名称不能位空") @NotBlank(message = "楼栋名称不能位空")
private String buildingName; private String buildingName;
@Excel(name = "楼栋类型")
@NotBlank(message = "楼栋类型不能位空")
private String type;
@Excel(name = "单元数") @Excel(name = "单元数")
@NotNull(message = "单元数不能位空") @NotNull(message = "单元数不能位空")
private Integer totalUnitNum; private Integer totalUnitNum;

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

@ -14,6 +14,7 @@ import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.ExtStaffPermissionResultDTO; import com.epmet.dto.result.ExtStaffPermissionResultDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.enums.BuildingTypeEnums;
import com.epmet.excel.IcBuildingExcel; import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcNeighborHoodExcel; import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.service.*; import com.epmet.service.*;
@ -90,6 +91,9 @@ public class BuildingServiceImpl implements BuildingService {
log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}",staffId); log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}",staffId);
return new ArrayList<>(); return new ArrayList<>();
} }
// agency = new CustomerStaffAgencyDTO();
// agency.setAgencyId("77f6bc7f07064bf4c09ef848139a344c");
//1.获取所在组织及下级组织 //1.获取所在组织及下级组织
CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(agency.getAgencyId()); CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(agency.getAgencyId());
List<CustomerAgencyEntity> customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId()); List<CustomerAgencyEntity> customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId());
@ -105,6 +109,8 @@ public class BuildingServiceImpl implements BuildingService {
buildingTreeLevelDTO.setPId(item.getPid()); buildingTreeLevelDTO.setPId(item.getPid());
buildingTreeLevelDTO.setLabel(item.getOrganizationName()); buildingTreeLevelDTO.setLabel(item.getOrganizationName());
buildingTreeLevelDTO.setLevel(item.getLevel()); buildingTreeLevelDTO.setLevel(item.getLevel());
buildingTreeLevelDTO.setLongitude(item.getLongitude());
buildingTreeLevelDTO.setLatitude(item.getLatitude());
buildingTreeLevelDTO.setChildren(new ArrayList<>()); buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO; return buildingTreeLevelDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -126,6 +132,8 @@ public class BuildingServiceImpl implements BuildingService {
buildingTreeLevelDTO.setLabel(item.getGridName()); buildingTreeLevelDTO.setLabel(item.getGridName());
buildingTreeLevelDTO.setLevel("grid"); buildingTreeLevelDTO.setLevel("grid");
buildingTreeLevelDTO.setPId(item.getPid()); buildingTreeLevelDTO.setPId(item.getPid());
buildingTreeLevelDTO.setLongitude(item.getLongitude());
buildingTreeLevelDTO.setLatitude(item.getLatitude());
buildingTreeLevelDTO.setChildren(new ArrayList<>()); buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO; return buildingTreeLevelDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -134,7 +142,7 @@ public class BuildingServiceImpl implements BuildingService {
//3.获取网格下的所有小区 //3.获取网格下的所有小区
List<String> gridIdList = customerGridList.stream().map(a->a.getId()).collect(Collectors.toList()); 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)); List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getGridId, gridIdList));
if(CollectionUtils.isEmpty(customerGridList)){ if(CollectionUtils.isEmpty(icNeighborHoodList)){
agencyList.addAll(gridList); agencyList.addAll(gridList);
return covertToTree(customerAgency,agencyList); return covertToTree(customerAgency,agencyList);
} }
@ -144,6 +152,8 @@ public class BuildingServiceImpl implements BuildingService {
buildingTreeLevelDTO.setPId(item.getGridId()); buildingTreeLevelDTO.setPId(item.getGridId());
buildingTreeLevelDTO.setLabel(item.getNeighborHoodName()); buildingTreeLevelDTO.setLabel(item.getNeighborHoodName());
buildingTreeLevelDTO.setLevel("neighbourHood"); buildingTreeLevelDTO.setLevel("neighbourHood");
buildingTreeLevelDTO.setLongitude(item.getLongitude());
buildingTreeLevelDTO.setLatitude(item.getLatitude());
buildingTreeLevelDTO.setChildren(new ArrayList<>()); buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO; return buildingTreeLevelDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -165,6 +175,8 @@ public class BuildingServiceImpl implements BuildingService {
buildingTreeLevelDTO.setPId(item.getNeighborHoodId()); buildingTreeLevelDTO.setPId(item.getNeighborHoodId());
buildingTreeLevelDTO.setLabel(item.getBuildingName()); buildingTreeLevelDTO.setLabel(item.getBuildingName());
buildingTreeLevelDTO.setLevel("building"); buildingTreeLevelDTO.setLevel("building");
buildingTreeLevelDTO.setLongitude(item.getLongitude());
buildingTreeLevelDTO.setLatitude(item.getLatitude());
buildingTreeLevelDTO.setChildren(new ArrayList<>()); buildingTreeLevelDTO.setChildren(new ArrayList<>());
return buildingTreeLevelDTO; return buildingTreeLevelDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -215,7 +227,7 @@ public class BuildingServiceImpl implements BuildingService {
entity.setCustomerId(customerId); entity.setCustomerId(customerId);
entity.setNeighborHoodId(Optional.ofNullable(neighborHoodMap.get(icBuildingExcel.getNeighborHoodName())).map(u->u.getId()).orElse(""));//neighborHoodMap.get(icBuildingExcel.getNeighborHoodName()).getId() entity.setNeighborHoodId(Optional.ofNullable(neighborHoodMap.get(icBuildingExcel.getNeighborHoodName())).map(u->u.getId()).orElse(""));//neighborHoodMap.get(icBuildingExcel.getNeighborHoodName()).getId()
entity.setBuildingName(icBuildingExcel.getBuildingName()); entity.setBuildingName(icBuildingExcel.getBuildingName());
entity.setType(""); entity.setType(BuildingTypeEnums.getKeyByValue(icBuildingExcel.getType()));
entity.setSort(0); entity.setSort(0);
entity.setTotalUnitNum(icBuildingExcel.getTotalUnitNum()); entity.setTotalUnitNum(icBuildingExcel.getTotalUnitNum());
entity.setTotalFloorNum(icBuildingExcel.getTotalFloorNum()); entity.setTotalFloorNum(icBuildingExcel.getTotalFloorNum());
@ -247,7 +259,7 @@ public class BuildingServiceImpl implements BuildingService {
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO(); IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
IPage<Map<String, Object>> resultMap = searchBuilding(formDTO); IPage<Map<String, Object>> resultMap = searchBuilding(formDTO);
result.setTotal(resultMap.getTotal()); result.setTotal(Long.valueOf(resultMap.getTotal()).intValue());
result.setList(resultMap.getRecords()); result.setList(resultMap.getRecords());
return result; return result;
} }
@ -260,7 +272,7 @@ public class BuildingServiceImpl implements BuildingService {
TemplateExportParams templatePath = new TemplateExportParams("excel/building_export.xlsx"); TemplateExportParams templatePath = new TemplateExportParams("excel/building_export.xlsx");
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("maplist",icBuildingExcels); map.put("maplist",icBuildingExcels);
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"楼宇信息录入表",response); ExcelPoiUtils.exportExcel(templatePath ,map,"楼宇信息录入表",response);
return ; return ;
} }
private List<IcBuildingExcel> searchAllBuilding(ListIcNeighborHoodFormDTO formDTO) { private List<IcBuildingExcel> searchAllBuilding(ListIcNeighborHoodFormDTO formDTO) {
@ -281,7 +293,11 @@ public class BuildingServiceImpl implements BuildingService {
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class); IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0"); building.setDelFlag("0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
return icBuildingDao.searchAllBuilding(building,house); List<IcBuildingExcel> icBuildingExcels = icBuildingDao.searchAllBuilding(building, house);
icBuildingExcels.forEach(item->{
item.setType(BuildingTypeEnums.getTypeValue(item.getType()));
});
return icBuildingExcels;
} }
private IPage<Map<String, Object>> searchBuilding(ListIcNeighborHoodFormDTO formDTO) { private IPage<Map<String, Object>> searchBuilding(ListIcNeighborHoodFormDTO formDTO) {
@ -307,7 +323,12 @@ public class BuildingServiceImpl implements BuildingService {
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName()); // .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0"); // buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
return icBuildingDao.searchBuildingByPage(page,building,house); IPage<Map<String, Object>> mapIPage = icBuildingDao.searchBuildingByPage(page, building, house);
List<Map<String, Object>> records = mapIPage.getRecords();
records.forEach(item->{
item.put("buildingType", BuildingTypeEnums.getTypeValue(item.get("buildingTypeKey")));
});
return mapIPage;
} }
@ -316,6 +337,8 @@ public class BuildingServiceImpl implements BuildingService {
buildingTreeLevelDTO.setId(customerAgency.getId()); buildingTreeLevelDTO.setId(customerAgency.getId());
buildingTreeLevelDTO.setLabel(customerAgency.getOrganizationName()); buildingTreeLevelDTO.setLabel(customerAgency.getOrganizationName());
buildingTreeLevelDTO.setLevel(customerAgency.getLevel()); buildingTreeLevelDTO.setLevel(customerAgency.getLevel());
buildingTreeLevelDTO.setLongitude(customerAgency.getLongitude());
buildingTreeLevelDTO.setLatitude(customerAgency.getLatitude());
buildingTreeLevelDTO.setChildren(new ArrayList<>()); buildingTreeLevelDTO.setChildren(new ArrayList<>());
recursionCovertToTree(buildingTreeLevelDTO,agencyList); recursionCovertToTree(buildingTreeLevelDTO,agencyList);
List<BuildingTreeLevelDTO> result = new ArrayList<>(); List<BuildingTreeLevelDTO> result = new ArrayList<>();

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

@ -3,6 +3,7 @@ package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.tools.enums.HouseTypeEnum;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcBuildingDao; import com.epmet.dao.IcBuildingDao;
import com.epmet.dao.IcBuildingUnitDao; import com.epmet.dao.IcBuildingUnitDao;
@ -17,6 +18,9 @@ import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcBuildingEntity; import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcHouseEntity; import com.epmet.entity.IcHouseEntity;
import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.enums.HousePurposeEnums;
import com.epmet.enums.HouseRentFlagEnums;
import com.epmet.enums.HouseTypeEnums;
import com.epmet.excel.IcHouseExcel; import com.epmet.excel.IcHouseExcel;
import com.epmet.service.HouseService; import com.epmet.service.HouseService;
import com.epmet.service.IcBuildingService; import com.epmet.service.IcBuildingService;
@ -143,9 +147,9 @@ public class HouseServiceImpl implements HouseService {
entity.setHouseName(icHouseExcel.getBuildingName()+"-"+icHouseExcel.getBuildingUnit()+"-"+icHouseExcel.getDoorName()); entity.setHouseName(icHouseExcel.getBuildingName()+"-"+icHouseExcel.getBuildingUnit()+"-"+icHouseExcel.getDoorName());
entity.setDoorName(icHouseExcel.getDoorName()); entity.setDoorName(icHouseExcel.getDoorName());
entity.setHouseType(icHouseExcel.getHouseType()); entity.setHouseType(HouseTypeEnums.getKeyByValue(icHouseExcel.getHouseType()));
entity.setPurpose(icHouseExcel.getPurpose()); entity.setPurpose(HousePurposeEnums.getKeyByValue(icHouseExcel.getPurpose()));
entity.setRentFlag("是".equals(icHouseExcel.getRentFlag())?1:0); entity.setRentFlag(HouseRentFlagEnums.getCodeByName(icHouseExcel.getRentFlag()));
entity.setOwnerName(icHouseExcel.getOwnerName()); entity.setOwnerName(icHouseExcel.getOwnerName());
entity.setOwnerPhone(icHouseExcel.getOwnerPhone()); entity.setOwnerPhone(icHouseExcel.getOwnerPhone());
entity.setOwnerIdCard(icHouseExcel.getOwnerIdCard()); entity.setOwnerIdCard(icHouseExcel.getOwnerIdCard());
@ -161,7 +165,7 @@ public class HouseServiceImpl implements HouseService {
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO(); IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
//如果类型是house 查房屋 //如果类型是house 查房屋
IPage<Map<String, Object>> resultMap = searchHouse(formDTO); IPage<Map<String, Object>> resultMap = searchHouse(formDTO);
result.setTotal(resultMap.getTotal()); result.setTotal(Long.valueOf(resultMap.getTotal()).intValue());
result.setList(resultMap.getRecords()); result.setList(resultMap.getRecords());
return result; return result;
} }
@ -175,7 +179,7 @@ public class HouseServiceImpl implements HouseService {
TemplateExportParams templatePath = new TemplateExportParams("excel/house_export.xlsx"); TemplateExportParams templatePath = new TemplateExportParams("excel/house_export.xlsx");
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("maplist",icHouseExcels); map.put("maplist",icHouseExcels);
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"房屋信息录入表",response); ExcelPoiUtils.exportExcel(templatePath ,map,"房屋信息录入表",response);
return ; return ;
} }
@ -189,7 +193,12 @@ public class HouseServiceImpl implements HouseService {
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0"); house.setDelFlag("0");
return icHouseDao.searchAllHouse(house); List<IcHouseExcel> icHouseExcels = icHouseDao.searchAllHouse(house);
icHouseExcels.forEach(item->{
item.setHouseType(HouseTypeEnums.getTypeValue(item.getHouseType()));
item.setPurpose(HousePurposeEnums.getTypeValue(item.getPurpose()));
});
return icHouseExcels;
} }
private IPage<Map<String, Object>> searchHouse(ListIcNeighborHoodFormDTO formDTO) { private IPage<Map<String, Object>> searchHouse(ListIcNeighborHoodFormDTO formDTO) {
@ -220,7 +229,14 @@ public class HouseServiceImpl implements HouseService {
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0"); house.setDelFlag("0");
return icHouseDao.searchHouseByPage(page,house); IPage<Map<String, Object>> mapIPage = icHouseDao.searchHouseByPage(page, house);
List<Map<String, Object>> records = mapIPage.getRecords();
records.forEach(item->{
item.put("houseType", HouseTypeEnums.getTypeValue(item.get("houseTypeKey")));
// item.put("rentFlag", HouseRentFlagEnums.getTypeValue(item.get("rentFlagKey") ));
item.put("purpose", HousePurposeEnums.getTypeValue(item.get("purposeKey")));
});
return mapIPage;
} }

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

@ -111,7 +111,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO(); IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO); IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO);
result.setTotal(resultMap.getTotal()); result.setTotal(Long.valueOf(resultMap.getTotal()).intValue());
result.setList(resultMap.getRecords()); result.setList(resultMap.getRecords());
return result; return result;

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

Binary file not shown.

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/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.

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

@ -33,7 +33,7 @@
a.TOTAL_FLOOR_NUM as totalFloorNum, a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum, a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType, a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName b.NEIGHBOR_HOOD_NAME as neighborHoodName
from ic_building a from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
@ -50,12 +50,12 @@
<select id="searchBuildingByPage" resultType="map"> <select id="searchBuildingByPage" resultType="map">
select select
a.BUILDING_NAME as buildingName, a.BUILDING_NAME as buildingName,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName, b.NEIGHBOR_HOOD_NAME as neighborHoodName,
b.ID as neighborHoodId, b.ID as neighborHoodId,
a.TOTAL_HOUSE_NUM as totalHouseNum, a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum, a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum, a.TOTAL_UNIT_NUM as totalUnitNum,
a.TYPE as buildingType, /*a.TYPE as buildingType,*/
a.ID as buildingId, a.ID as buildingId,
c.ID as agencyId, c.ID as agencyId,
c.ORGANIZATION_NAME as agencyName, c.ORGANIZATION_NAME as agencyName,
@ -103,8 +103,8 @@
a.TOTAL_HOUSE_NUM as totalHouseNum, a.TOTAL_HOUSE_NUM as totalHouseNum,
a.TOTAL_FLOOR_NUM as totalFloorNum, a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum, a.TOTAL_UNIT_NUM as totalUnitNum,
a.TYPE as buildingType, a.TYPE as type,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName, b.NEIGHBOR_HOOD_NAME as neighborHoodName,
c.ORGANIZATION_NAME as agencyName, c.ORGANIZATION_NAME as agencyName,
d.GRID_NAME as gridName d.GRID_NAME as gridName
from ic_building a from ic_building a
@ -146,7 +146,7 @@
a.TOTAL_FLOOR_NUM as totalFloorNum, a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum, a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType, a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName b.NEIGHBOR_HOOD_NAME as neighborHoodName
from ic_building a from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID
@ -188,7 +188,7 @@
a.TOTAL_FLOOR_NUM as totalFloorNum, a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum, a.TOTAL_UNIT_NUM as totalUnitNum,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName, b.NEIGHBOR_HOOD_NAME as neighborHoodName,
f.ORGANIZATION_NAME as agencyName, f.ORGANIZATION_NAME as agencyName,
g.GRID_NAME as gridName g.GRID_NAME as gridName
from ic_building a from ic_building a
@ -212,7 +212,7 @@
a.TOTAL_FLOOR_NUM as totalFloorNum, a.TOTAL_FLOOR_NUM as totalFloorNum,
a.TOTAL_UNIT_NUM as totalUnitNum, a.TOTAL_UNIT_NUM as totalUnitNum,
a.BUILDING_NAME as buildingType, a.BUILDING_NAME as buildingType,
b.NEIGHBOR_HOOD_NAME as neighbourHoodName, b.NEIGHBOR_HOOD_NAME as neighborHoodName,
c.ORGANIZATION_NAME as agencyName, c.ORGANIZATION_NAME as agencyName,
d.GRID_NAME as gridName d.GRID_NAME as gridName
from ic_building a from ic_building a

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

@ -38,7 +38,7 @@
a.OWNER_PHONE as ownerPhone, a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard, a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName, b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName, c.NEIGHBOR_HOOD_NAME as neighborHoodName,
d.UNIT_NUM as unitName d.UNIT_NUM as unitName
from ic_house a from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID INNER JOIN ic_building b on a.BUILDING_ID = b.ID
@ -64,7 +64,7 @@
a.OWNER_PHONE as ownerPhone, a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard, a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName, b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName, c.NEIGHBOR_HOOD_NAME as neighborHoodName,
d.UNIT_NUM as unitName d.UNIT_NUM as unitName
from ic_house a from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID INNER JOIN ic_building b on a.BUILDING_ID = b.ID
@ -106,14 +106,14 @@
<select id="searchHouseByPage" resultType="map"> <select id="searchHouseByPage" resultType="map">
select select
a.HOUSE_NAME as houseName, a.HOUSE_NAME as houseName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName, c.NEIGHBOR_HOOD_NAME as neighborHoodName,
b.BUILDING_NAME as buildingName, b.BUILDING_NAME as buildingName,
d.UNIT_NUM as unitNum, d.UNIT_NUM as unitNum,
a.DOOR_NAME as doorName, a.DOOR_NAME as doorName,
a.HOUSE_TYPE as houseType, if(a.RENT_FLAG=1,'是','否') as rentFlag,
a.OWNER_NAME as ownerName, a.OWNER_NAME as ownerName,
a.RENT_FLAG as rentFlag, /*a.RENT_FLAG as rentFlag,
a.PURPOSE as purpose, a.PURPOSE as purpose,*/
a.OWNER_PHONE as ownerPhone, a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard, a.OWNER_ID_CARD as ownerIdCard,
@ -122,7 +122,8 @@
b.ID as buildingId, b.ID as buildingId,
a.BUILDING_UNIT_ID as unitNumKey, a.BUILDING_UNIT_ID as unitNumKey,
a.HOUSE_TYPE as houseTypeKey, a.HOUSE_TYPE as houseTypeKey,
a.PURPOSE as purposeKey a.PURPOSE as purposeKey,
a.RENT_FLAG as rentFlagKey
from ic_house a from ic_house a
LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0' LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0'
LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0' LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0'
@ -155,7 +156,7 @@
a.OWNER_PHONE as ownerPhone, a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard, a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName, b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName, c.NEIGHBOR_HOOD_NAME as neighborHoodName,
d.UNIT_NUM as unitName d.UNIT_NUM as unitName
from ic_house a from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0' INNER JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0'
@ -188,7 +189,7 @@
a.OWNER_PHONE as ownerPhone, a.OWNER_PHONE as ownerPhone,
a.OWNER_ID_CARD as ownerIdCard, a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName, b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighbourHoodName, c.NEIGHBOR_HOOD_NAME as neighborHoodName,
d.UNIT_NUM as unitName d.UNIT_NUM as unitName
from ic_house a from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID INNER JOIN ic_building b on a.BUILDING_ID = b.ID

Loading…
Cancel
Save