diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
index fa30ff3a3c..92c190c7ec 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
@@ -214,8 +214,11 @@ public enum EpmetErrorCode {
SAME_RULE_NAME(8916,"该积分事件已存在,请重新调整保存"),
UP_LIMIT_POINT(8917,"积分上限需为单位积分倍数,请重新调整保存"),
- BADGE_CHECK(8918,"");
+ BADGE_CHECK(8918,""),
+ ORG_ADD_FAILED(8919,"添加失败"),
+ ORG_EDIT_FAILED(8920,"编辑失败"),
+ ORG_DEL_FAILED(8921,"删除失败");
private int code;
private String msg;
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingUnitFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingUnitFormDTO.java
new file mode 100644
index 0000000000..74a38b8e2b
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingUnitFormDTO.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+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 javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+
+@Data
+public class IcBulidingUnitFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @NotBlank(message = "楼栋ID不能为空")
+ private String buildingId;
+
+
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
index fa78b6f791..2e65729cab 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
@@ -19,6 +19,8 @@ package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto;
@@ -28,12 +30,15 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.NeighborhoodConstant;
+import com.epmet.dao.IcBuildingUnitDao;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
+import com.epmet.dto.form.IcBulidingUnitFormDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
+import com.epmet.entity.IcBuildingUnitEntity;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcHouseExcel;
import com.epmet.excel.IcNeighborHoodExcel;
@@ -77,13 +82,15 @@ public class BuildingController {
private IcBuildingService icBuildingService;
@Autowired
private BuildingService buildingService;
+ @Autowired
+ private IcBuildingUnitDao icBuildingUnitDao;
@PostMapping("buildinglist")
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ ValidatorUtils.validateEntity(formDTO);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = buildingService.listBuilding(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
@@ -126,13 +133,12 @@ public class BuildingController {
}
/**
* 导出模板
- * @param formDTO
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
- public void exportTemplate(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ public void exportTemplate( HttpServletResponse response) throws Exception {
+
TemplateExportParams templatePath = new TemplateExportParams("excel/building_template.xlsx");
Map map = new HashMap<>();
map.put("maplist",new ArrayList());
@@ -147,7 +153,7 @@ public class BuildingController {
*/
@RequestMapping("exportbuildinginfo")
public void exportbuildinginfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ ValidatorUtils.validateEntity(formDTO);
buildingService.exportBuildinginfo(formDTO,response);
}
@@ -161,7 +167,7 @@ public class BuildingController {
@GetMapping("export")
public void export(HttpServletResponse response) throws Exception {
ListIcNeighborHoodFormDTO formDTO = new ListIcNeighborHoodFormDTO();
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ ValidatorUtils.validateEntity(formDTO);
buildingService.exportBuildinginfo(formDTO,response);
}
@@ -186,7 +192,7 @@ public class BuildingController {
for ( IcBuildingExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
}
- return new Result().error(8000,failList.get(0).getErrorMsg());
+ return new Result().error(8001,failList.get(0).getErrorMsg());
}
List result =importResult.getList();
@@ -194,5 +200,25 @@ public class BuildingController {
return new Result().ok("导入成功");
}
+ /**
+ * 查看楼宇单元列表
+ * @param tokenDTO
+ * @return
+ * @throws IOException
+ */
+ @PostMapping("buildingunitlist")
+ public Result buildingunitlist(@LoginUser TokenDto tokenDTO,@RequestBody IcBulidingUnitFormDTO icBulidingUnitFormDTO ){
+ ValidatorUtils.validateEntity(icBulidingUnitFormDTO);
+ List icBuildingUnitEntityList = icBuildingUnitDao.selectList(new QueryWrapper().lambda().eq(IcBuildingUnitEntity::getBuildingId, icBulidingUnitFormDTO.getBuildingId()));
+ List result = new ArrayList<>();
+ icBuildingUnitEntityList.forEach(item->{
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("id",item.getId());
+ jsonObject.put("unitName",item.getUnitName());
+ jsonObject.put("unitNum",item.getUnitNum());
+ result.add(jsonObject);
+ });
+ return new Result().ok(result);
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
index 9f8f92188a..8bc4378e8f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
@@ -67,7 +67,7 @@ public class HouseController {
@PostMapping("houselist")
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ ValidatorUtils.validateEntity(formDTO);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = houseService.listNeighborhood(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
@@ -103,13 +103,12 @@ public class HouseController {
}
/**
* 导出模板
- * @param formDTO
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
- public void exportTemplate(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ public void exportTemplate(HttpServletResponse response) throws Exception {
+// ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/house_template.xlsx");
Map map = new HashMap<>();
map.put("maplist",new ArrayList());
@@ -124,7 +123,7 @@ public class HouseController {
*/
@RequestMapping("exporthouseinfo")
public void exporthouseinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ ValidatorUtils.validateEntity(formDTO);
houseService.exportBuildinginfo(formDTO,response);
}
@@ -149,7 +148,7 @@ public class HouseController {
for ( IcHouseExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
}
- return new Result().error(8000,failList.get(0).getErrorMsg());
+ return new Result().error(8001,failList.get(0).getErrorMsg());
}
List result =importResult.getList();
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
index 8d98ad3c8a..823363814a 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
@@ -80,7 +80,7 @@ public class NeighborHoodController {
@PostMapping("neighborhoodlist")
public Result neighborhoodlist(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ ValidatorUtils.validateEntity(formDTO);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
@@ -115,7 +115,7 @@ public class NeighborHoodController {
//判断是否存在楼宇,如果存在不能删除
List icBuildingEntities = icBuildingDao.selectList(new QueryWrapper().lambda().eq(IcBuildingEntity::getNeighborHoodId, neighborHoodId));
if(!CollectionUtils.isEmpty(icBuildingEntities)){
- return new Result().error(8000,"小区下已存在楼宇,无法删除");
+ return new Result().error(8001,"小区下已存在楼宇,无法删除");
}
neighborHoodService.DelNeighborhood(neighborHoodId);
return new Result().ok("删除成功");
@@ -130,19 +130,18 @@ public class NeighborHoodController {
*/
@PostMapping("exportneighborhoodinfo")
public void exportneighborhoodinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ ValidatorUtils.validateEntity(formDTO);
neighborHoodService.exportNeighborhoodinfo(formDTO,response);
}
/**
* 导出模板
- * @param formDTO
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
- public void exportTemplate(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
- ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
+ public void exportTemplate( HttpServletResponse response) throws Exception {
+// ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_template.xlsx");
Map map = new HashMap<>();
map.put("maplist",new ArrayList());
@@ -211,7 +210,7 @@ public class NeighborHoodController {
for ( IcNeighborHoodExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
}
- return new Result().error(8000,failList.get(0).getErrorMsg());
+ return new Result().error(8001,failList.get(0).getErrorMsg());
}
List result =importResult.getList();
// log.info(JSON.toJSONString(result));
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
index 7842454149..10371e3369 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
@@ -8,16 +8,19 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.*;
-import com.epmet.dto.*;
+import com.epmet.dto.BuildingTreeLevelDTO;
+import com.epmet.dto.CustomerStaffAgencyDTO;
+import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
-import com.epmet.dto.result.ExtStaffPermissionResultDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.*;
import com.epmet.enums.BuildingTypeEnums;
import com.epmet.excel.IcBuildingExcel;
-import com.epmet.excel.IcNeighborHoodExcel;
-import com.epmet.service.*;
+import com.epmet.service.BuildingService;
+import com.epmet.service.IcBuildingService;
+import com.epmet.service.IcBuildingUnitService;
+import com.epmet.service.IcHouseService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -374,7 +377,7 @@ public class BuildingServiceImpl implements BuildingService {
List icHouseEntities = icHouseDao.selectList(new QueryWrapper().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()));
if(!CollectionUtils.isEmpty(icHouseEntities)){
//
- throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),"楼宇单元下存在房屋,无法更新");
+ throw new RenException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(),"楼宇单元下存在房屋,无法更新");
// icHouseEntities.forEach(item->{
// item.setNeighborHoodId(formDTO.getNeighborHoodId());
// });
@@ -403,7 +406,7 @@ public class BuildingServiceImpl implements BuildingService {
icBuildingUnitService.insertBatch(unitList);
}else{
//如果小于,判断是否存在房屋,如果存在就提示不能更改
- throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),"楼宇单元下存在房屋,无法更新");
+ throw new RenException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(),"楼宇单元下存在房屋,无法更新");
}
@@ -420,7 +423,7 @@ public class BuildingServiceImpl implements BuildingService {
//如果存在房屋,无法删除
List icHouseEntities = icHouseDao.selectList(new QueryWrapper().lambda().eq(IcHouseEntity::getBuildingId, buildingId));
if(!CollectionUtils.isEmpty(icHouseEntities)){
- throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),"楼宇单元下存在房屋,无法删除");
+ throw new RenException(EpmetErrorCode.ORG_DEL_FAILED.getCode(),"楼宇单元下存在房屋,无法删除");
}
//删除楼宇
icBuildingService.deleteById(buildingId);
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
index 2d41fdc8fb..00d96f74f6 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
@@ -7,7 +7,6 @@ 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.*;
@@ -18,8 +17,6 @@ import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
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;
diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml
index a70950c101..c6417f095f 100644
--- a/epmet-user/epmet-user-server/pom.xml
+++ b/epmet-user/epmet-user-server/pom.xml
@@ -140,6 +140,16 @@
true
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ xls
+ xlsx
+
+
+
${project.basedir}/src/main/java
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
index 02b2068020..2aaeba1cb0 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
@@ -144,14 +144,7 @@ public class IcResiUserController {
@GetMapping("download/template")
public void downloadTemplate(@RequestParam String customerId) throws Exception {
- CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
- queryDTO.setFormCode("resi_base_info");
- queryDTO.setCustomerId(customerId);
- Result resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
- if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){
- throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
- }
- System.out.println(JSON.toJSONString(resultForm.getData()));
+ CustomerFormResultDTO resultForm = getResiFormItems(customerId);
XSSFWorkbook workbook = new XSSFWorkbook();
Map> sheetHeaderMap = buildHeaderByItem(resultForm);
@@ -175,11 +168,24 @@ public class IcResiUserController {
}
@NotNull
- private Map> buildHeaderByItem(Result resultForm) {
+ private CustomerFormResultDTO getResiFormItems(String customerId) {
+ CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
+ queryDTO.setFormCode("resi_base_info");
+ queryDTO.setCustomerId(customerId);
+ Result resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
+ if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ }
+ System.out.println(JSON.toJSONString(resultForm.getData()));
+ return resultForm.getData();
+ }
+
+ @NotNull
+ private Map> buildHeaderByItem(CustomerFormResultDTO resultForm) {
//form中的itemlist 为一级表头 但是要排除每个item中含有childGroup的
- List itemList = resultForm.getData().getItemList();
- List groupList = resultForm.getData().getGroupList();
+ List itemList = resultForm.getItemList();
+ List groupList = resultForm.getGroupList();
Map> everySheetHeaderMap = new LinkedHashMap<>();
@@ -196,7 +202,7 @@ public class IcResiUserController {
firstSheetHeaderList.add(header);
return;
}
- everySheetHeaderMap.putIfAbsent(resultForm.getData().getFormName(),firstSheetHeaderList);
+ everySheetHeaderMap.putIfAbsent(resultForm.getFormName(),firstSheetHeaderList);
//这些是动态的 formGroup
if (item.getChildGroup() != null){
@@ -326,29 +332,31 @@ public class IcResiUserController {
public void exportExcel(/*@LoginUser TokenDto tokenDto,*/ @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws IOException {
pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
pageFormDTO.setPageFlag(false);
- PageData