From 5832704b3938fd3da7525f6ff1e27509cc64f235 Mon Sep 17 00:00:00 2001 From: lzh Date: Sat, 30 Oct 2021 15:55:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E4=B8=9A=E7=AE=A1=E7=90=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=EF=BC=8C=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/IcBulidingFormDTO.java | 5 ++ .../com/epmet/dto/form/IcHouseFormDTO.java | 2 +- .../dto/form/IcPropertyManagementFormDTO.java | 51 +++++++++++ .../result/IcPropertyManagementResultDTO.java | 25 ++++++ .../epmet/controller/BuildingController.java | 4 +- .../controller/NeighborHoodController.java | 15 +--- .../PropertyManagementController.java | 88 +++++++++++++++++++ .../java/com/epmet/dao/IcBuildingDao.java | 5 +- .../java/com/epmet/dao/IcNeighborHoodDao.java | 5 +- .../service/PropertyManagementService.java | 44 ++++++++++ .../service/impl/BuildingServiceImpl.java | 26 +++--- .../epmet/service/impl/HouseServiceImpl.java | 4 +- .../service/impl/NeighborHoodServiceImpl.java | 7 +- .../impl/PropertyManagementServiceImpl.java | 67 ++++++++++++++ .../main/resources/mapper/IcBuildingDao.xml | 36 +++++++- .../resources/mapper/IcNeighborHoodDao.xml | 35 +++++++- 16 files changed, 381 insertions(+), 38 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcPropertyManagementResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java index 9026613dc1..592c5a4776 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java @@ -66,6 +66,11 @@ public class IcBulidingFormDTO implements Serializable { @Length(max=10,message = "楼栋名称不能超过10个字", groups = {AddGroup.class, UpdateGroup.class}) private String buildingName; + /** + * 楼栋类型 + */ + private String type=""; + /** * 客户id */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java index 14feda5200..2f28b22eee 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java @@ -46,7 +46,7 @@ public class IcHouseFormDTO implements Serializable { private String neighborHoodId; @NotBlank(message = "所属楼栋ID不能为空", groups = { UpdateGroup.class}) - private String belongBuildingId; + private String buildingId; /** * 所属单元id diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java new file mode 100644 index 0000000000..ae5f2f9903 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java @@ -0,0 +1,51 @@ +/** + * 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 java.io.Serializable; + + +@Data +public class IcPropertyManagementFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface DeleteGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "物业id不能为空", groups = { UpdateGroup.class,DeleteGroup.class}) + private String id; + + + /** + * 物业名称 + */ + @NotBlank(message = "物业名称不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @Length(max=10,message = "物业名称不能超过100个字", groups = {AddGroup.class, UpdateGroup.class}) + private String name; + + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcPropertyManagementResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcPropertyManagementResultDTO.java new file mode 100644 index 0000000000..6f2e058206 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcPropertyManagementResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * @Description 网格列表信息 + * @ClassName GridListInfoResultDTO + * @Author wangc + * @date 2020.04.23 14:21 + */ +@Data +public class IcPropertyManagementResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String propertyId; + + private String propertyName; + + +} 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 1763147e90..81fccb5087 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 @@ -160,8 +160,8 @@ public class BuildingController { */ @PostMapping("import") public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException { -// String customerId = tokenDTO.getCustomerId(); - String customerId = "123123"; + String customerId = tokenDTO.getCustomerId(); +// String customerId = "123123"; ExcelImportResult importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcBuildingExcel.class); 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 d9b38807e4..8d98ad3c8a 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 @@ -17,42 +17,35 @@ package com.epmet.controller; -import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; -import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.constant.NeighborhoodConstant; import com.epmet.dao.IcBuildingDao; import com.epmet.dto.form.IcNeighborHoodFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; import com.epmet.entity.IcBuildingEntity; -import com.epmet.excel.IcBuildingExcel; -import com.epmet.excel.IcHouseExcel; import com.epmet.excel.IcNeighborHoodExcel; -import com.epmet.service.*; +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.CollectionUtils; -import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java new file mode 100644 index 0000000000..6d35f9af68 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java @@ -0,0 +1,88 @@ +/** + * 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.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.IcPropertyManagementFormDTO; +import com.epmet.dto.result.IcPropertyManagementResultDTO; +import com.epmet.service.IcPropertyManagementService; +import com.epmet.service.PropertyManagementService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +/** + * 物业表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +@RestController +@RequestMapping("propertymanagement") +public class PropertyManagementController { + + @Autowired + private IcPropertyManagementService icPropertyManagementService; + + @Autowired + private PropertyManagementService propertyManagementService; + + + @PostMapping("list") + public Result> list(){ + return new Result>().ok(propertyManagementService.getList()); + } + + + @PostMapping("add") + public Result add(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + propertyManagementService.add(formDTO); + return new Result().ok("保存成功"); + } + + + + @PostMapping("update") + public Result update(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + propertyManagementService.update(formDTO); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(formDTO, IcPropertyManagementFormDTO.DeleteGroup.class); + propertyManagementService.delete(formDTO); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java index becb5ad1b8..511daa2fad 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java @@ -23,6 +23,7 @@ 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.IcHouseEntity; import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.excel.IcBuildingExcel; import org.apache.ibatis.annotations.Mapper; @@ -45,14 +46,14 @@ public interface IcBuildingDao extends BaseDao { // @Param("neighbor") IcNeighborHoodEntity neighbor, // @Param("building")IcBuildingEntity building); IPage> searchBuildingByPage(IPage page, - @Param("building")IcBuildingEntity building); + @Param("building")IcBuildingEntity building, @Param("house") IcHouseEntity house); // List searchAllBuilding(@Param(Constants.WRAPPER) QueryWrapper neighborHoodEntityQueryWrapper, // @Param("ew1") QueryWrapper buildingEntityQueryWrapper); // List searchAllBuilding(@Param("neighbor") IcNeighborHoodEntity neighbor, // @Param("building")IcBuildingEntity building); List searchAllBuilding( - @Param("building")IcBuildingEntity building); + @Param("building")IcBuildingEntity building, @Param("house")IcHouseEntity house); List selectAgencyChildrenList(@Param("agencyId") String agencyId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java index 919cd34707..4da3423f9d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java @@ -21,6 +21,7 @@ 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.IcHouseEntity; import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.excel.IcNeighborHoodExcel; import org.apache.ibatis.annotations.Mapper; @@ -40,10 +41,10 @@ import java.util.Set; public interface IcNeighborHoodDao extends BaseDao { // IPage> searchNeighborhoodByPage(IPage page,@Param(Constants.WRAPPER) QueryWrapper neighborHoodEntityQueryWrapper); - IPage> searchNeighborhoodByPage(IPage page,@Param("neighbor") IcNeighborHoodEntity neighbor); + IPage> searchNeighborhoodByPage(IPage page, @Param("neighbor") IcNeighborHoodEntity neighbor, @Param("house")IcHouseEntity house); // List searchAllNeighborhood(@Param(Constants.WRAPPER) QueryWrapper neighborHoodEntityQueryWrapper); - List searchAllNeighborhood(@Param("neighbor") IcNeighborHoodEntity neighbor); + List searchAllNeighborhood(@Param("neighbor") IcNeighborHoodEntity neighbor, @Param("house")IcHouseEntity house); List selectListByName(@Param("neighborNameList")List neighborNameList, @Param("agencyNameList") List agencyNameList, diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java new file mode 100644 index 0000000000..5fe43468e9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java @@ -0,0 +1,44 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcPropertyManagementDTO; +import com.epmet.dto.form.IcPropertyManagementFormDTO; +import com.epmet.dto.result.IcPropertyManagementResultDTO; +import com.epmet.entity.IcPropertyManagementEntity; + +import java.util.List; +import java.util.Map; + +/** + * 物业表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +public interface PropertyManagementService { + + List getList(); + + void add(IcPropertyManagementFormDTO formDTO); + + void update(IcPropertyManagementFormDTO formDTO); + void delete(IcPropertyManagementFormDTO formDTO); +} \ No newline at end of file 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 0eae07a286..d6b989fbd0 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 @@ -73,6 +73,7 @@ public class BuildingServiceImpl implements BuildingService { List unitList = new ArrayList<>(); for(int i =0 ;i> searchBuilding(ListIcNeighborHoodFormDTO formDTO) { @@ -305,8 +306,8 @@ public class BuildingServiceImpl implements BuildingService { // .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); + IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); + return icBuildingDao.searchBuildingByPage(page,building,house); } @@ -348,10 +349,14 @@ public class BuildingServiceImpl implements BuildingService { if(!icBuilding.getNeighborHoodId().equals(formDTO.getNeighborHoodId())){ //更新对应房屋小区id List icHouseEntities = icHouseDao.selectList(new QueryWrapper().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId())); - icHouseEntities.forEach(item->{ - item.setNeighborHoodId(formDTO.getNeighborHoodId()); - }); - icHouseService.updateBatchById(icHouseEntities); + if(!CollectionUtils.isEmpty(icHouseEntities)){ + // + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),"楼宇单元下存在房屋,无法更新"); +// icHouseEntities.forEach(item->{ +// item.setNeighborHoodId(formDTO.getNeighborHoodId()); +// }); +// icHouseService.updateBatchById(icHouseEntities); + } } IcBuildingDTO icBuildingDTO= ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class); icBuildingDTO.setId(formDTO.getBuildingId()); @@ -361,13 +366,14 @@ public class BuildingServiceImpl implements BuildingService { //如果楼宇单元大于之前的楼宇单元,新增单元 Integer nowUnit= formDTO.getTotalUnitNum(); Integer unit = icBuilding.getTotalUnitNum(); - if(nowUnit>unit){ + if(nowUnit>=unit){ //新增单元 List unitList = new ArrayList<>(); for(int i =unit ;iu.getBuildingName()).orElse(""); 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 bed3ac83ee..dc96ce0dd8 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 @@ -136,6 +136,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService { // neighborHoodEntityQueryWrapper.eq("a.DEL_FLAG","0"); IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class); + IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); neighbor.setDelFlag("0"); if(NeighborhoodConstant.GRID.equals(formDTO.getLevel())){ //根据网格过滤 @@ -144,7 +145,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService { //根据组织过滤 neighbor.setAgencyId(formDTO.getId()); } - return icNeighborHoodDao.searchNeighborhoodByPage(page, neighbor); + return icNeighborHoodDao.searchNeighborhoodByPage(page, neighbor,house); } /** @@ -292,8 +293,8 @@ public class NeighborHoodServiceImpl implements NeighborHoodService { // neighborHoodEntityQueryWrapper.eq("a.DEL_FLAG","0"); IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class); neighbor.setDelFlag("0"); - - return icNeighborHoodDao.searchAllNeighborhood(neighbor); + IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); + return icNeighborHoodDao.searchAllNeighborhood(neighbor,house); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java new file mode 100644 index 0000000000..4068fb710d --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java @@ -0,0 +1,67 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.IcNeighborHoodPropertyDao; +import com.epmet.dao.IcPropertyManagementDao; +import com.epmet.dto.form.IcPropertyManagementFormDTO; +import com.epmet.dto.result.IcPropertyManagementResultDTO; +import com.epmet.entity.IcNeighborHoodPropertyEntity; +import com.epmet.entity.IcPropertyManagementEntity; +import com.epmet.service.PropertyManagementService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Service +public class PropertyManagementServiceImpl implements PropertyManagementService { + + @Resource + private IcPropertyManagementDao icPropertyManagementDao; + @Resource + private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; + + @Override + public List getList() { + List propertyManagementEntityList = icPropertyManagementDao.selectList(null); + List list = new ArrayList<>(); + propertyManagementEntityList.forEach(item->{ + IcPropertyManagementResultDTO propertyManagementResultDTO = new IcPropertyManagementResultDTO(); + propertyManagementResultDTO.setPropertyId(item.getId()); + propertyManagementResultDTO.setPropertyName(item.getName()); + list.add(propertyManagementResultDTO); + }); + return list; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void add(IcPropertyManagementFormDTO formDTO) { + IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); + icPropertyManagementDao.insert(icPropertyManagementEntity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcPropertyManagementFormDTO formDTO) { + IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); + icPropertyManagementDao.updateById(icPropertyManagementEntity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(IcPropertyManagementFormDTO formDTO) { + List list = icNeighborHoodPropertyDao.selectList(new QueryWrapper().lambda().eq(IcNeighborHoodPropertyEntity::getPropertyId, formDTO.getId())); + if(!CollectionUtils.isEmpty(list)){ + throw new RenException("物业存在与小区关联,无法删除"); + } + icPropertyManagementDao.deleteById(formDTO.getId()); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml index 9951294477..1226c7ec74 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml @@ -51,12 +51,13 @@ select a.BUILDING_NAME as buildingName, b.NEIGHBOR_HOOD_NAME as neighbourHoodName, + b.ID as neighborHoodId, a.TOTAL_HOUSE_NUM as totalHouseNum, a.TOTAL_FLOOR_NUM as totalFloorNum, a.TOTAL_UNIT_NUM as totalUnitNum, a.TYPE as buildingType, a.ID as buildingId, - c.ID as agencyId. + c.ID as agencyId, c.ORGANIZATION_NAME as agencyName, d.ID as gridId, d.GRID_NAME as gridName, @@ -72,8 +73,23 @@ left join customer_grid d on b.GRID_ID = d.ID and d.DEL_FLAG='0' - AND a.NEIGHBOR_HOOD_ID = #{building.id} + AND a.NEIGHBOR_HOOD_ID = #{building.neighborHoodId} + + + AND a.ID in (select distinct BUILDING_ID from ic_house e + + + AND e.OWNER_NAME = #{house.ownerName} + + + AND e.OWNER_PHONE = #{house.ownerPhone} + + and e.DEL_FLAG='0' + + ) + + AND a.DEL_FLAG = #{building.delFlag} @@ -99,7 +115,21 @@ - AND a.NEIGHBOR_HOOD_ID = #{building.id} + AND a.NEIGHBOR_HOOD_ID = #{building.neighborHoodId} + + + + AND a.ID in (select distinct BUILDING_ID from ic_house e + + + AND e.OWNER_NAME = #{house.ownerName} + + + AND e.OWNER_PHONE = #{house.ownerPhone} + + and e.DEL_FLAG='0' + + ) AND a.DEL_FLAG = #{building.delFlag} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml index 9703c6b33c..8c00a943d6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml @@ -84,8 +84,24 @@ AND a.GRID_ID = #{neighbor.gridId} - AND (a.AGENCY_ID = #{neighbor.agencyId} or CONCAT(':',a.PIDS, ':') like CONCAT('%:',#{neighbor.agencyId},':%')) + AND (a.AGENCY_ID = #{neighbor.agencyId} or CONCAT(':',a.AGENCY_PIDS, ':') like CONCAT('%:',#{neighbor.agencyId},':%')) + + + AND a.ID in (select NEIGHBOR_HOOD_ID from ic_house e + + + AND e.OWNER_NAME = #{house.ownerName} + + + AND e.OWNER_PHONE = #{house.ownerPhone} + + and e.DEL_FLAG='0' + + ) + + + AND a.DEL_FLAG = #{neighbor.delFlag} @@ -111,8 +127,23 @@ AND a.GRID_ID = #{neighbor.gridId} - AND (a.AGENCY_ID = #{neighbor.agencyId} or CONCAT(':',a.PIDS, ':') like CONCAT('%:',#{neighbor.agencyId},':%')) + AND (a.AGENCY_ID = #{neighbor.agencyId} or CONCAT(':',a.AGENCY_PIDS, ':') like CONCAT('%:',#{neighbor.agencyId},':%')) + + + AND a.ID in (select distinct NEIGHBOR_HOOD_ID from ic_house e + + + AND e.OWNER_NAME = #{house.ownerName} + + + AND e.OWNER_PHONE = #{house.ownerPhone} + + and e.DEL_FLAG='0' + + ) + + AND a.DEL_FLAG = #{neighbor.delFlag}