From 5d9534da94c4bfd8158fdbb7f595a9c29b0f1650 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 2 Mar 2022 10:19:18 +0800 Subject: [PATCH 1/5] error code --- .../java/com/epmet/commons/tools/exception/EpmetErrorCode.java | 3 +++ 1 file changed, 3 insertions(+) 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 7992a0049a..1a965a2d74 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 @@ -250,6 +250,9 @@ public enum EpmetErrorCode { ORG_ADD_FAILED(8919,"添加失败"), ORG_EDIT_FAILED(8920,"编辑失败"), ORG_DEL_FAILED(8921,"删除失败"), + NEIGHBORHOOD_DEL_FAILED(8922,"%s内包含楼宇信息,暂无法删除"), + BUILDING_DEL_FAILED(8923,"%s内包含房屋信息,暂无法删除"), + HOUSE_DEL_FAILED(8924,"%s内包含居民信息,暂无法删除"), //通用错误码 start From 391b37ed9dac7ea77a153168482d1f1ec1f0def5 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 2 Mar 2022 11:08:08 +0800 Subject: [PATCH 2/5] del --- .../form/NeighborHoodManageDelFormDTO.java | 30 +++++++ .../NeighborHoodManageDelResultDTO.java | 22 +++++ .../epmet/constant/CustomerGridConstant.java | 1 + .../com/epmet/controller/HouseController.java | 13 +++ .../main/java/com/epmet/dao/IcHouseDao.java | 26 ++++++ .../java/com/epmet/service/HouseService.java | 9 +++ .../epmet/service/impl/HouseServiceImpl.java | 81 +++++++++++++++++++ .../src/main/resources/mapper/IcHouseDao.xml | 43 ++++++++++ .../epmet/dto/form/DelIcResiUserFormDTO.java | 8 +- .../epmet/feign/EpmetUserOpenFeignClient.java | 9 +++ .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../controller/IcResiUserController.java | 33 +++++--- .../java/com/epmet/dao/IcResiUserDao.java | 9 +++ .../com/epmet/service/IcResiUserService.java | 7 ++ .../service/impl/IcResiUserServiceImpl.java | 11 +++ .../main/resources/mapper/IcResiUserDao.xml | 13 +++ 16 files changed, 310 insertions(+), 10 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/NeighborHoodManageDelFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodManageDelResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/NeighborHoodManageDelFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/NeighborHoodManageDelFormDTO.java new file mode 100644 index 0000000000..22d913ee32 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/NeighborHoodManageDelFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/3/1 4:35 下午 + * @DESC + */ +@Data +public class NeighborHoodManageDelFormDTO implements Serializable { + + private static final long serialVersionUID = 405799151478155056L; + + public interface NeighborHoodManageDelForm{} + + @NotNull(message = "ids不能为空" , groups = NeighborHoodManageDelForm.class) + private List ids; + + /** + * 小区:neighborHood,楼栋:building,房屋:house + */ + @NotBlank(message = "type不能为空" , groups = NeighborHoodManageDelForm.class) + private String type; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodManageDelResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodManageDelResultDTO.java new file mode 100644 index 0000000000..bec9a06639 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodManageDelResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/3/2 10:05 上午 + * @DESC + */ +@Data +public class NeighborHoodManageDelResultDTO implements Serializable { + + private static final long serialVersionUID = -4248802585738319974L; + + private String neighborHoodId; + private String buildingId; + private String houseId; + + private String name; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerGridConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerGridConstant.java index bfe1fbe93c..409ec696db 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerGridConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerGridConstant.java @@ -19,4 +19,5 @@ public interface CustomerGridConstant { String NEIGHBORHOOD = "neighborHood"; String BUILDING = "building"; + String HOUSE = "house"; } 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 017da95fd9..f4c3fce570 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 @@ -292,4 +292,17 @@ public class HouseController implements ResultDataResolver { return new Result<>().error(9999,String.format(s,num,num)); } + /** + * Desc 小区管理中批量删除 + * @param formDTO + * @author zxc + * @date 2022/3/1 4:57 下午 + */ + @PostMapping("delete") + public Result allDelete(@RequestBody NeighborHoodManageDelFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, NeighborHoodManageDelFormDTO.NeighborHoodManageDelForm.class); + houseService.allDelete(formDTO); + return new Result(); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index a394aaaef5..28c0014f19 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.result.HouseInfoDTO; +import com.epmet.dto.result.NeighborHoodManageDelResultDTO; import com.epmet.entity.IcHouseEntity; import com.epmet.excel.IcHouseExcel; import org.apache.ibatis.annotations.Mapper; @@ -74,4 +75,29 @@ public interface IcHouseDao extends BaseDao { @Param("buildingUnitId")String buildingUnitId, @Param("doorName")String doorName, @Param("houseId")String houseId); + + /** + * Desc: 根据小区IDs查询小区下是否有存在楼栋的 + * @param ids + * @author zxc + * @date 2022/3/2 9:51 上午 + */ + List selectExistBuildingByNeighborHoodIds(@Param("ids")List ids); + + /** + * Desc: 根据楼栋IDs查询楼栋下是否有存在房屋的 + * @param ids + * @author zxc + * @date 2022/3/2 9:53 上午 + */ + List selectExistHouseByBuildingIds(@Param("ids")List ids); + + /** + * Desc: 根据房屋ID查询名字 + * @param ids + * @author zxc + * @date 2022/3/2 11:00 上午 + */ + List selectHouseNames(@Param("ids")List ids); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index ad5d1d69cb..14dec2f1a9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -19,6 +19,7 @@ package com.epmet.service; import com.epmet.dto.form.IcHouseFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.form.NeighborHoodManageDelFormDTO; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; import com.epmet.excel.IcHouseExcel; @@ -62,4 +63,12 @@ public interface HouseService { void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception; List queryListHouseInfo(Set houseIds, String customerId); + + /** + * Desc 小区管理中批量删除 + * @param formDTO + * @author zxc + * @date 2022/3/1 4:57 下午 + */ + void allDelete(NeighborHoodManageDelFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index 4c809cb812..3c9269c53d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -14,6 +14,8 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerGridConstant; import com.epmet.dao.IcBuildingDao; import com.epmet.dao.IcBuildingUnitDao; import com.epmet.dao.IcHouseDao; @@ -24,13 +26,16 @@ import com.epmet.dto.IcBuildingUnitDTO; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.form.IcHouseFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.form.NeighborHoodManageDelFormDTO; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; +import com.epmet.dto.result.NeighborHoodManageDelResultDTO; import com.epmet.entity.IcHouseEntity; import com.epmet.enums.HousePurposeEnums; import com.epmet.enums.HouseRentFlagEnums; import com.epmet.enums.HouseTypeEnums; import com.epmet.excel.IcHouseExcel; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.redis.IcHouseRedis; import com.epmet.service.HouseService; @@ -77,6 +82,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { private IcHouseRedis icHouseRedis; @Autowired private AgencyService agencyservice; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Override @@ -329,4 +336,78 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { }); return result; } + + /** + * Desc 小区管理中批量删除 + * @param formDTO + * @author zxc + * @date 2022/3/1 4:57 下午 + */ + @Override + public void allDelete(NeighborHoodManageDelFormDTO formDTO) { + if (CollectionUtils.isEmpty(formDTO.getIds())){ + return; + } + List ids = formDTO.getIds(); + if (formDTO.getType().equals(CustomerGridConstant.NEIGHBORHOOD)){ + List exists = icHouseDao.selectExistBuildingByNeighborHoodIds(ids); + if (!CollectionUtils.isEmpty(exists)){ + exists.forEach(e -> { + for (int i = NumConstant.ZERO; i < ids.size(); i++) { + if (ids.get(i).equals(e.getNeighborHoodId())){ + ids.remove(i); + continue; + } + } + }); + } + icNeighborHoodDao.deleteBatchIds(ids); + if (!CollectionUtils.isEmpty(exists)){ + String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining("、")); + EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getMsg(),collect)); + throw new EpmetException(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getCode()); + } + }else if (formDTO.getType().equals(CustomerGridConstant.BUILDING)){ + List exists = icHouseDao.selectExistHouseByBuildingIds(ids); + if (!CollectionUtils.isEmpty(exists)){ + exists.forEach(e -> { + for (int i = NumConstant.ZERO; i < ids.size(); i++) { + if (ids.get(i).equals(e.getBuildingId())){ + ids.remove(i); + continue; + } + } + }); + } + icBuildingDao.deleteBatchIds(ids); + if (!CollectionUtils.isEmpty(exists)){ + String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining("、")); + EpmetErrorCode.BUILDING_DEL_FAILED.setMsg(String.format(EpmetErrorCode.BUILDING_DEL_FAILED.getMsg(),collect)); + throw new EpmetException(EpmetErrorCode.BUILDING_DEL_FAILED.getCode()); + } + }else if (formDTO.getType().equals(CustomerGridConstant.HOUSE)){ + Result> existUsers = epmetUserOpenFeignClient.getExistUserByHouseIds(ids); + if (!existUsers.success()){ + throw new EpmetException("根据房屋IDs查询房屋下是否有存在居民失败..."); + } + List exists = existUsers.getData(); + if (!CollectionUtils.isEmpty(exists)){ + exists.forEach(e -> { + for (int i = NumConstant.ZERO; i < ids.size(); i++) { + if (ids.get(i).equals(e)){ + ids.remove(i); + continue; + } + } + }); + } + icHouseDao.deleteBatchIds(ids); + if (!CollectionUtils.isEmpty(exists)){ + List list = icHouseDao.selectHouseNames(exists); + String collect = list.stream().collect(Collectors.joining("、")); + EpmetErrorCode.HOUSE_DEL_FAILED.setMsg(String.format(EpmetErrorCode.HOUSE_DEL_FAILED.getMsg(),collect)); + throw new EpmetException(EpmetErrorCode.HOUSE_DEL_FAILED.getCode()); + } + } + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 08adc876d0..9647aa4a70 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -329,4 +329,47 @@ ih.DEL_FLAG = '0' AND ih.ID = #{houseId} + + + + + + + + + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java index 558bb88b7f..98526ad993 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java @@ -4,7 +4,9 @@ import com.epmet.commons.tools.enums.IcFormCodeEnum; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.util.List; /** * @Description 删除居民 @@ -18,10 +20,14 @@ public class DelIcResiUserFormDTO implements Serializable { public interface IdGroup { } - @NotBlank(message = "icResiUserId不能为空", groups = IdGroup.class) private String icResiUserId; + + @NotNull(message = "userIds不能为空", groups = IdGroup.class) + private List userIds; + @NotBlank(message = "token获取的customerId不能为空", groups = IdGroup.class) private String customerId; + private String formCode= IcFormCodeEnum.RESI_BASE_INFO.getCode(); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 9cfd689cfc..1d55f30f87 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -712,4 +712,13 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/statsresiwarn/list2") Result> getPersonCategoryList(@RequestBody StatsResiListFormDTO formDTO); + /** + * Desc: 根据房屋IDs查询房屋下是否有存在居民的 + * @param ids + * @author zxc + * @date 2022/3/2 10:32 上午 + */ + @PostMapping("/epmetuser/icresiuser/getexistuserbyhouseids") + Result> getExistUserByHouseIds(@RequestBody List ids); + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index bde8bf2e8c..0f9f38ea5c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -527,4 +527,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> getPersonCategoryList(StatsResiListFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getPersonCategoryList", formDTO); } + + @Override + public Result> getExistUserByHouseIds(List ids) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getExistUserByHouseIds", ids); + } } 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 67c1aabd7e..8e37bc0958 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 @@ -181,15 +181,19 @@ public class IcResiUserController { public Result delete(@LoginUser TokenDto tokenDto, @RequestBody DelIcResiUserFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO, DelIcResiUserFormDTO.IdGroup.class); - icResiUserService.delete(formDTO); - //推送MQ事件 - IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); - mqMsg.setCustomerId(tokenDto.getCustomerId()); - mqMsg.setIcResiUser(formDTO.getIcResiUserId()); - SystemMsgFormDTO form = new SystemMsgFormDTO(); - form.setMessageType(SystemMessageType.IC_RESI_USER_DEL); - form.setContent(mqMsg); - epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); +// icResiUserService.delete(formDTO); + icResiUserService.deleteBatchIds(formDTO.getUserIds()); + formDTO.getUserIds().forEach(userId -> { + //推送MQ事件 + IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); + mqMsg.setCustomerId(tokenDto.getCustomerId()); + mqMsg.setIcResiUser(userId); + SystemMsgFormDTO form = new SystemMsgFormDTO(); + form.setMessageType(SystemMessageType.IC_RESI_USER_DEL); + form.setContent(mqMsg); + epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); + }); + return new Result(); } @@ -712,4 +716,15 @@ public class IcResiUserController { ValidatorUtils.validateEntity(formDTO, PersonWarnRightListFormDTO.PersonWarnRightListForm.class); return new Result().ok(icResiUserService.personWarnRightList(formDTO,tokenDto)); } + + /** + * Desc: 根据房屋IDs查询房屋下是否有存在居民的 + * @param ids + * @author zxc + * @date 2022/3/2 10:32 上午 + */ + @PostMapping("getexistuserbyhouseids") + public Result> getExistUserByHouseIds(@RequestBody List ids){ + return new Result>().ok(icResiUserService.getExistUserByHouseIds(ids)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index d152fc3776..cdb0a0be13 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -261,4 +261,13 @@ public interface IcResiUserDao extends BaseDao { */ Map getDataAnalyseCount(@Param("customerId") String customerId, @Param("tableName") String tableName, @Param("columnList") List columnList, @Param("id") String id, @Param("level") String level); + + /** + * Desc: 根据房屋IDs查询房屋下是否有存在居民的 + * @param ids + * @author zxc + * @date 2022/3/2 10:32 上午 + */ + List getExistUserByHouseIds(@Param("ids") List ids); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index dc2c2a76d5..59ec56519b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -209,4 +209,11 @@ public interface IcResiUserService extends BaseService { */ PersonWarnRightListResultDTO personWarnRightList(PersonWarnRightListFormDTO formDTO, TokenDto tokenDto); + /** + * Desc: 根据房屋IDs查询房屋下是否有存在居民的 + * @param ids + * @author zxc + * @date 2022/3/2 10:32 上午 + */ + List getExistUserByHouseIds(List ids); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index f912200041..9601599fc4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -1201,6 +1201,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl getExistUserByHouseIds(List ids) { + return baseDao.getExistUserByHouseIds(ids); + } + /** * @Description 居民分类 和 网格名 处理 * @param list diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 28396dd34e..c34664ed92 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -624,4 +624,17 @@ ) + + + From 49cde60fb04609c68026da7547930f7fa8d7976d Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 2 Mar 2022 13:30:46 +0800 Subject: [PATCH 3/5] del --- .../com/epmet/service/impl/HouseServiceImpl.java | 12 +++++++++--- .../src/main/resources/mapper/IcHouseDao.xml | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index 3c9269c53d..f0923f1129 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -361,7 +361,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { } }); } - icNeighborHoodDao.deleteBatchIds(ids); + if (!CollectionUtils.isEmpty(ids)){ + icNeighborHoodDao.deleteBatchIds(ids); + } if (!CollectionUtils.isEmpty(exists)){ String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining("、")); EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getMsg(),collect)); @@ -379,7 +381,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { } }); } - icBuildingDao.deleteBatchIds(ids); + if (!CollectionUtils.isEmpty(ids)){ + icBuildingDao.deleteBatchIds(ids); + } if (!CollectionUtils.isEmpty(exists)){ String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining("、")); EpmetErrorCode.BUILDING_DEL_FAILED.setMsg(String.format(EpmetErrorCode.BUILDING_DEL_FAILED.getMsg(),collect)); @@ -401,7 +405,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { } }); } - icHouseDao.deleteBatchIds(ids); + if (!CollectionUtils.isEmpty(ids)){ + icHouseDao.deleteBatchIds(ids); + } if (!CollectionUtils.isEmpty(exists)){ List list = icHouseDao.selectHouseNames(exists); String collect = list.stream().collect(Collectors.joining("、")); diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 9647aa4a70..40984e17f1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -343,7 +343,7 @@ #{id} ) - GROUP BY id + GROUP BY nh.id @@ -359,7 +359,7 @@ #{id} ) - GROUP BY id + GROUP BY b.id From 4e22972fe483236548e1b357302363f2d815117e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 2 Mar 2022 13:46:16 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IcPartymemberStyleServiceImpl.java | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java index 77caf1bede..4abeba9207 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java @@ -326,44 +326,45 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl imageList = new ArrayList<>(); - List list = result.stream().map(item -> { - IcPartymemberStyleEntity entity = new IcPartymemberStyleEntity(); - entity.setId(UUID.randomUUID().toString().replace("-", "")); - entity.setCustomerId(tokenDto.getCustomerId()); - entity.setAgencyId(staffInfoCache.getAgencyId()); - entity.setGridId(gridMap.get(item.getGridName())); - GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(entity.getGridId()); - if (null != gridInfo) { - entity.setGridPids(gridInfo.getPids()); - } - entity.setName(item.getName()); - entity.setMainDeed(item.getMainDeed()); - IcPartymemberStyleCategoryDictEntity dictEntity=categoryDictMap.get(item.getCategoryName()); - entity.setCategoryId(null == dictEntity ? StrConstant.EPMETY_STR : dictEntity.getId()); - entity.setCategoryCode(null == dictEntity ? StrConstant.EPMETY_STR : dictEntity.getCategoryCode()); - AtomicInteger i = new AtomicInteger(); - return entity; - }).collect(Collectors.toList()); + /*if (CollectionUtils.isEmpty(result)) { + Collections.sort(numList); + String subList = numList.stream().map(String::valueOf).collect(Collectors.joining("、")); + return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "第" + subList + "行未成功!"); + }*/ + if (!CollectionUtils.isEmpty(result)) { + List imageList = new ArrayList<>(); + List list = result.stream().map(item -> { + IcPartymemberStyleEntity entity = new IcPartymemberStyleEntity(); + entity.setId(UUID.randomUUID().toString().replace("-", "")); + entity.setCustomerId(tokenDto.getCustomerId()); + entity.setAgencyId(staffInfoCache.getAgencyId()); + entity.setGridId(gridMap.get(item.getGridName())); + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(entity.getGridId()); + if (null != gridInfo) { + entity.setGridPids(gridInfo.getPids()); + } + entity.setName(item.getName()); + entity.setMainDeed(item.getMainDeed()); + IcPartymemberStyleCategoryDictEntity dictEntity=categoryDictMap.get(item.getCategoryName()); + entity.setCategoryId(null == dictEntity ? StrConstant.EPMETY_STR : dictEntity.getId()); + entity.setCategoryCode(null == dictEntity ? StrConstant.EPMETY_STR : dictEntity.getCategoryCode()); + AtomicInteger i = new AtomicInteger(); + return entity; + }).collect(Collectors.toList()); - insertBatch(list); - icPartymemberStyleImageService.insertBatch(imageList); + insertBatch(list); + icPartymemberStyleImageService.insertBatch(imageList); - /*String str = String.format("共%s条,成功导入%s条。", numList.size() + result.size(), numList.size() + result.size() - numList.size()); - if (numList.size() > NumConstant.ZERO) { - Collections.sort(numList); - String subList = numList.stream().map(String::valueOf).collect(Collectors.joining("、")); - log.warn(str + "第" + subList + "行未成功!"); - return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str + "第" + subList + "行未成功!"); - } - return new Result().ok(str);*/ + /*String str = String.format("共%s条,成功导入%s条。", numList.size() + result.size(), numList.size() + result.size() - numList.size()); + if (numList.size() > NumConstant.ZERO) { + Collections.sort(numList); + String subList = numList.stream().map(String::valueOf).collect(Collectors.joining("、")); + log.warn(str + "第" + subList + "行未成功!"); + return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str + "第" + subList + "行未成功!"); + } + return new Result().ok(str);*/ + } + //生成导入失败数据对应的文件,修改任务状态 String url = erroeImport(fileList); upImportTask(url, taskId, tokenDto.getUserId(), true); } catch (Exception e) { From e6f1298f4e4eb0a30e8814b6a4aae6ff2ae1d866 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 2 Mar 2022 13:46:37 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=A1=BF=E5=8F=B7=E6=94=B9=E9=80=97?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/HouseServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index f0923f1129..5dee8cd9b6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -365,7 +365,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { icNeighborHoodDao.deleteBatchIds(ids); } if (!CollectionUtils.isEmpty(exists)){ - String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining("、")); + String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining(",")); EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getMsg(),collect)); throw new EpmetException(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getCode()); } @@ -385,7 +385,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { icBuildingDao.deleteBatchIds(ids); } if (!CollectionUtils.isEmpty(exists)){ - String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining("、")); + String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining(",")); EpmetErrorCode.BUILDING_DEL_FAILED.setMsg(String.format(EpmetErrorCode.BUILDING_DEL_FAILED.getMsg(),collect)); throw new EpmetException(EpmetErrorCode.BUILDING_DEL_FAILED.getCode()); } @@ -410,7 +410,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { } if (!CollectionUtils.isEmpty(exists)){ List list = icHouseDao.selectHouseNames(exists); - String collect = list.stream().collect(Collectors.joining("、")); + String collect = list.stream().collect(Collectors.joining(",")); EpmetErrorCode.HOUSE_DEL_FAILED.setMsg(String.format(EpmetErrorCode.HOUSE_DEL_FAILED.getMsg(),collect)); throw new EpmetException(EpmetErrorCode.HOUSE_DEL_FAILED.getCode()); }