diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java index 9039cda6ef..fb2490aff2 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java @@ -138,6 +138,8 @@ public class ImportGeneralDTO implements Serializable { private Boolean existStatus = false; + private Boolean addStatus = false; + /** * 楼栋重复状态 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExistHouseInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExistHouseInfoResultDTO.java new file mode 100644 index 0000000000..561925a7c1 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExistHouseInfoResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/3/25 10:46 + * @DESC + */ +@Data +public class ExistHouseInfoResultDTO implements Serializable { + + private static final long serialVersionUID = -6350975846409029631L; + + private String name; + private String houseId; +} 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 87ee60fcd4..787bf47679 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 @@ -22,6 +22,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.result.BaseInfoFamilyBuildingResultDTO; import com.epmet.dto.result.BuildingResultDTO; +import com.epmet.dto.result.ExistHouseInfoResultDTO; import com.epmet.dto.result.UpdateBuildingHouseNumResultDTO; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.IcBuildingEntity; @@ -161,7 +162,7 @@ public interface IcBuildingDao extends BaseDao { * @author zxc * @date 2022/2/14 5:32 下午 */ - List selectExistHouse(@Param("ids")List ids); + List selectExistHouse(@Param("ids")List ids); /** * Desc: 查询客户下户数为空的 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 28c0014f19..f4b4a2c402 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 @@ -1,24 +1,8 @@ -/** - * 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.dao; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.NeighborHoodManageDelResultDTO; import com.epmet.entity.IcHouseEntity; @@ -100,4 +84,12 @@ public interface IcHouseDao extends BaseDao { */ List selectHouseNames(@Param("ids")List ids); + /** + * Desc: 批量更新房屋信息 + * @param houses + * @author zxc + * @date 2022/3/25 10:22 + */ + void houseUpdate(@Param("houses") List houses); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java index 60b609752c..b837534082 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java @@ -15,6 +15,7 @@ import com.epmet.dao.IcBuildingDao; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.result.ExistHouseInfoResultDTO; import com.epmet.dto.result.ImportResultDTO; import com.epmet.dto.result.UpdateBuildingHouseNumResultDTO; import com.epmet.entity.IcHouseEntity; @@ -48,6 +49,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener needDisposeList = new ArrayList<>(); List needInsertList = new ArrayList<>(); + List needUpdateList = new ArrayList<>(); String gridName = null; String agencyName = null; @@ -125,21 +127,6 @@ public class ImportHouseInfoListener extends AnalysisEventListener ids = needInsertList.stream().filter(n -> StringUtils.isNotBlank(n.getBuildingUnitId())).map(m -> m.getBuildingUnitId() + "_" + m.getDoorName()).distinct().collect(Collectors.toList()); + List existHouses = icBuildingDao.selectExistHouse(ids); Map collect = needInsertList.stream().collect(Collectors.groupingBy(n -> n.getBuildingUnitId() + "_" + n.getDoorName(), Collectors.counting())); collect.forEach((k,v) -> { - if (Integer.valueOf(v.toString()).compareTo(1) > 0){ + if (Integer.valueOf(v.toString()).compareTo(1) != 0){ for (ImportGeneralDTO r : needInsertList) { if (k.equals(r.getBuildingUnitId()+"_"+r.getDoorName())){ // 集合里重复的 - nums.add(r.getNum()); + /*nums.add(r.getNum()); disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); - r.setExistStatus(true); + r.setExistStatus(true);*/ + if (!r.getAddStatus()){ + for (ExistHouseInfoResultDTO existHouse : existHouses) { + if (existHouse.getName().equals(r.getBuildingUnitId()+"_"+r.getDoorName())){ + r.setHouseId(existHouse.getHouseId()); + break; + } + } + needUpdateList.add(r); + r.setAddStatus(true); + r.setExistStatus(true); + } } } } }); - // 根据单元ID_doorName查询已存在的 - List ids = needInsertList.stream().filter(n -> StringUtils.isNotBlank(n.getBuildingUnitId())).map(m -> m.getBuildingUnitId() + "_" + m.getDoorName()).distinct().collect(Collectors.toList()); - List existHouses = icBuildingDao.selectExistHouse(ids); existHouses.forEach(e -> { for (ImportGeneralDTO n : needInsertList) { - if ((n.getBuildingUnitId()+"_"+n.getDoorName()).equals(e)){ + if ((n.getBuildingUnitId()+"_"+n.getDoorName()).equals(e.getName())){ // 库里存在的 - nums.add(n.getNum()); - disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); - n.setExistStatus(true); +// nums.add(n.getNum()); +// disposeErrorMsg(info,ImportErrorMsgConstants.EXIST_ERROR); +// n.setExistStatus(true); + if (!n.getAddStatus()){ + n.setHouseId(e.getHouseId()); + needUpdateList.add(n); + n.setAddStatus(true); + n.setExistStatus(true); + } } } }); @@ -238,6 +242,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener> groupByExistStatus = needInsertList.stream().collect(Collectors.groupingBy(ImportGeneralDTO::getExistStatus)); List importGeneralDTOS = groupByExistStatus.get(false); houseInsert(importGeneralDTOS); + houseUpdate(needUpdateList); // 清除 needDisposeList = new ArrayList<>(); needInsertList = new ArrayList<>(); @@ -576,4 +581,11 @@ public class ImportHouseInfoListener extends AnalysisEventListener houses){ + if (!CollectionUtils.isEmpty(houses)){ + icHouseService.houseUpdate(houses); + } + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java index 66f02d80fa..e2110550bf 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java @@ -1,20 +1,3 @@ -/** - * 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; @@ -22,6 +5,7 @@ import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcHouseDTO; +import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.HouseFormDTO; import com.epmet.dto.result.HouseListResultDTO; import com.epmet.entity.IcHouseEntity; @@ -124,4 +108,12 @@ public interface IcHouseService extends BaseService { */ List getHouseList(TokenDto tokenDto, HouseFormDTO formDTO); + /** + * Desc: 批量更新房屋信息 + * @param houses + * @author zxc + * @date 2022/3/25 10:22 + */ + void houseUpdate(List houses); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index 0835d6604e..0e32dbef1e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java @@ -1,20 +1,3 @@ -/** - * 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.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -33,6 +16,7 @@ import com.epmet.dao.IcHouseDao; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcResiUserDTO; +import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.HouseFormDTO; import com.epmet.dto.result.HouseListResultDTO; import com.epmet.entity.IcHouseEntity; @@ -235,4 +219,16 @@ public class IcHouseServiceImpl extends BaseServiceImpl houses) { + baseDao.houseUpdate(houses); + } + } \ No newline at end of file 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 c2482d86af..190f93904a 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 @@ -335,8 +335,11 @@ - + SELECT + CONCAT(BUILDING_UNIT_ID,'_',DOOR_NAME) AS name, + ID AS houseId + FROM ic_house WHERE DEL_FLAG = '0' AND CONCAT(BUILDING_UNIT_ID,'_',DOOR_NAME) IN ( 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 4a53158d3e..b8f3bfef66 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 @@ -26,6 +26,50 @@ + + + UPDATE ic_house + + + + when id = #{h.houseId} then #{h.houseType} + + + + + when id = #{h.houseId} then #{h.purpose} + + + + + when id = #{h.houseId} then #{h.rentFlag} + + + + + when id = #{h.houseId} then #{h.ownerName} + + + + + when id = #{h.houseId} then #{h.ownerPhone} + + + + + when id = #{h.houseId} then #{h.ownerIdCard} + + + UPDATED_TIME = NOW() + + WHERE DEL_FLAG = '0' + AND ID IN ( + + #{h.houseId} + + ) + +