diff --git a/src/main/java/com/cm/population/dao/house/IHouseDao.java b/src/main/java/com/cm/population/dao/house/IHouseDao.java index 9517cd3..80b06d2 100644 --- a/src/main/java/com/cm/population/dao/house/IHouseDao.java +++ b/src/main/java/com/cm/population/dao/house/IHouseDao.java @@ -10,6 +10,7 @@ import com.cm.population.pojo.dtos.population.PopulationDTO; import com.cm.population.pojo.pos.house.HousePO; import org.springframework.stereotype.Repository; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -128,4 +129,6 @@ public interface IHouseDao { List listForAll(Map params); List getBatch(Map params); + + List getUserHouse(HashMap objectObjectHashMap); } \ No newline at end of file diff --git a/src/main/java/com/cm/population/service/residential/impl/ResidentialServiceImpl.java b/src/main/java/com/cm/population/service/residential/impl/ResidentialServiceImpl.java index 4ed99fd..a4e07cc 100644 --- a/src/main/java/com/cm/population/service/residential/impl/ResidentialServiceImpl.java +++ b/src/main/java/com/cm/population/service/residential/impl/ResidentialServiceImpl.java @@ -163,7 +163,7 @@ public class ResidentialServiceImpl extends AbstractService implements IResident @Override public List list(Map params) { - if(null != params.get("myself")) { + if (null != params.get("myself")) { UserInfoBO userInfoBO = this.securityComponent.getCurrentUser(); params.put("creator", userInfoBO.getUserId()); } @@ -210,11 +210,11 @@ public class ResidentialServiceImpl extends AbstractService implements IResident @Override public void dataCover() { // 获取所有房屋数据 - List houseDTOS = houseDao.getBatch(new HashMap<>()); + List houseDTOS = houseDao.getUserHouse(new HashMap<>()); - Map params = new HashMap<>(); - for (HouseDTO houseDTO : houseDTOS) { + /*for (HouseDTO houseDTO : houseDTOS) { if(StringUtils.isNotEmpty(houseDTO.getDocumentNum())) { + Map params = new HashMap<>(); String documentNum = houseDTO.getDocumentNum(); String phone = houseDTO.getPhone(); params.put("idcard", houseDTO.getDocumentNum()); @@ -234,16 +234,17 @@ public class ResidentialServiceImpl extends AbstractService implements IResident params.put("documentNum11", documentNum); params.put("phone11", phone); + params.put("houseId", houseDTO.getHouseId()); residentialDao.updateHouse(params); - - params.remove("idcard"); - params.remove("phone"); - params.remove("documentNum11"); - params.remove("phone11"); } + params.remove("idcard"); + params.remove("phone"); + params.remove("documentNum11"); + params.remove("phone11"); } if(StringUtils.isNotEmpty(houseDTO.getCustodianDocumentNum())) { + Map params = new HashMap<>(); String documentNum = houseDTO.getCustodianDocumentNum(); String phone = houseDTO.getCustodianPhone(); @@ -251,7 +252,7 @@ public class ResidentialServiceImpl extends AbstractService implements IResident params.put("phone", houseDTO.getCustodianPhone()); PopulationInfoBaseDTO populationInfoBaseDTO; - if(houseDTO.getDocumentNum().indexOf('*') != -1) { + if(houseDTO.getCustodianDocumentNum().indexOf('*') != -1) { populationInfoBaseDTO = residentialDao.getPopu(params); }else { populationInfoBaseDTO = residentialDao.getPopu2(params); @@ -264,18 +265,18 @@ public class ResidentialServiceImpl extends AbstractService implements IResident params.put("custodianDocumentNum11", documentNum); params.put("custodianPhone11", phone); + params.put("houseId", houseDTO.getHouseId()); residentialDao.updateHouse(params); - - params.remove("custodianDocumentNum11"); - params.remove("custodianPhone11"); - params.remove("idcard"); - params.remove("phone"); } + params.remove("custodianDocumentNum11"); + params.remove("custodianPhone11"); + params.remove("idcard"); + params.remove("phone"); } - } + }*/ - /*int size = houseDTOS.size(); - int numThreads = size / 2 + (size % 10000 == 0 ? 0 : 1); // 计算需要的线程数 + int size = houseDTOS.size(); + int numThreads = size / 500 + (size % 500 == 0 ? 0 : 1); // 计算需要的线程数 numThreads = numThreads == 0 ? 1 : numThreads; ExecutorService executorService = Executors.newFixedThreadPool(numThreads); @@ -286,24 +287,27 @@ public class ResidentialServiceImpl extends AbstractService implements IResident chunkSize = chunkSize == 0 ? 1 : chunkSize; List> chunks = Lists.partition(houseDTOS, chunkSize); - Map params = new HashMap<>(); for (List chunk : chunks) { Callable> task = () -> { List output = new ArrayList<>(); for (HouseDTO houseDTO : chunk) { - if(StringUtils.isNotEmpty(houseDTO.getDocumentNum())) { + if (StringUtils.isNotEmpty(houseDTO.getDocumentNum())) { + Map params = new HashMap<>(); + + params.put("houseId", houseDTO.getHouseId()); + String documentNum = houseDTO.getDocumentNum(); String phone = houseDTO.getPhone(); params.put("idcard", houseDTO.getDocumentNum()); params.put("phone", houseDTO.getPhone()); PopulationInfoBaseDTO populationInfoBaseDTO; - if(houseDTO.getDocumentNum().indexOf('*') != -1) { + if (houseDTO.getDocumentNum().indexOf('*') != -1) { populationInfoBaseDTO = residentialDao.getPopu(params); - }else { + } else { populationInfoBaseDTO = residentialDao.getPopu2(params); } - if(null != populationInfoBaseDTO) { + if (null != populationInfoBaseDTO) { params.put("homeowner", populationInfoBaseDTO.getName()); params.put("ownerPopulationId", populationInfoBaseDTO.getPopulationInfoId()); params.put("documentNum", populationInfoBaseDTO.getIdcard()); @@ -312,15 +316,35 @@ public class ResidentialServiceImpl extends AbstractService implements IResident params.put("documentNum11", documentNum); params.put("phone11", phone); residentialDao.updateHouse(params); - - params.remove("idcard"); + } else { params.remove("phone"); - params.remove("documentNum11"); - params.remove("phone11"); + if (houseDTO.getDocumentNum().indexOf('*') != -1) { + populationInfoBaseDTO = residentialDao.getPopu(params); + } else { + populationInfoBaseDTO = residentialDao.getPopu2(params); + } + if (null != populationInfoBaseDTO) { + params.put("homeowner", populationInfoBaseDTO.getName()); + params.put("ownerPopulationId", populationInfoBaseDTO.getPopulationInfoId()); + params.put("documentNum", populationInfoBaseDTO.getIdcard()); + params.put("phone", populationInfoBaseDTO.getPhone()); + + params.put("documentNum11", documentNum); + params.put("phone11", phone); + residentialDao.updateHouse(params); + } } + params.remove("idcard"); + params.remove("phone"); + params.remove("documentNum11"); + params.remove("phone11"); } - if(StringUtils.isNotEmpty(houseDTO.getCustodianDocumentNum())) { + if (StringUtils.isNotEmpty(houseDTO.getCustodianDocumentNum())) { + Map params = new HashMap<>(); + + params.put("houseId", houseDTO.getHouseId()); + String documentNum = houseDTO.getCustodianDocumentNum(); String phone = houseDTO.getCustodianPhone(); @@ -328,12 +352,12 @@ public class ResidentialServiceImpl extends AbstractService implements IResident params.put("phone", houseDTO.getCustodianPhone()); PopulationInfoBaseDTO populationInfoBaseDTO; - if(houseDTO.getDocumentNum().indexOf('*') != -1) { + if (houseDTO.getCustodianDocumentNum().indexOf('*') != -1) { populationInfoBaseDTO = residentialDao.getPopu(params); - }else { + } else { populationInfoBaseDTO = residentialDao.getPopu2(params); } - if(null != populationInfoBaseDTO) { + if (null != populationInfoBaseDTO) { params.put("custodian", populationInfoBaseDTO.getName()); params.put("custodianPopulationId", populationInfoBaseDTO.getPopulationInfoId()); params.put("custodianDocumentNum", populationInfoBaseDTO.getIdcard()); @@ -342,12 +366,28 @@ public class ResidentialServiceImpl extends AbstractService implements IResident params.put("custodianDocumentNum11", documentNum); params.put("custodianPhone11", phone); residentialDao.updateHouse(params); - - params.remove("custodianDocumentNum11"); - params.remove("custodianPhone11"); - params.remove("idcard"); + } else { params.remove("phone"); + if (houseDTO.getCustodianDocumentNum().indexOf('*') != -1) { + populationInfoBaseDTO = residentialDao.getPopu(params); + } else { + populationInfoBaseDTO = residentialDao.getPopu2(params); + } + if (null != populationInfoBaseDTO) { + params.put("custodian", populationInfoBaseDTO.getName()); + params.put("custodianPopulationId", populationInfoBaseDTO.getPopulationInfoId()); + params.put("custodianDocumentNum", populationInfoBaseDTO.getIdcard()); + params.put("custodianPhone", populationInfoBaseDTO.getPhone()); + + params.put("custodianDocumentNum11", documentNum); + params.put("custodianPhone11", phone); + residentialDao.updateHouse(params); + } } + params.remove("custodianDocumentNum11"); + params.remove("custodianPhone11"); + params.remove("idcard"); + params.remove("phone"); } } return output; @@ -355,7 +395,7 @@ public class ResidentialServiceImpl extends AbstractService implements IResident futures.add(executorService.submit(task)); } - executorService.shutdown(); // 关闭线程池*/ + executorService.shutdown(); // 关闭线程池 } } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/house/house-mapper.xml b/src/main/resources/mybatis/mapper/house/house-mapper.xml index 73cf3eb..5c4299d 100644 --- a/src/main/resources/mybatis/mapper/house/house-mapper.xml +++ b/src/main/resources/mybatis/mapper/house/house-mapper.xml @@ -1208,4 +1208,62 @@ + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/residential/residential-mapper.xml b/src/main/resources/mybatis/mapper/residential/residential-mapper.xml index e32ba72..0e3424c 100644 --- a/src/main/resources/mybatis/mapper/residential/residential-mapper.xml +++ b/src/main/resources/mybatis/mapper/residential/residential-mapper.xml @@ -481,16 +481,20 @@ t1.creator_area2 FROM population_population_info t1 WHERE 1 = 1 + AND CONCAT( SUBSTRING(t1.idcard, 1, 6), '********', SUBSTRING(t1.idcard, 15) ) = #{idcard} + + AND CONCAT( SUBSTRING(t1.phone, 1, 3), '****', SUBSTRING(t1.phone, 8) ) = #{phone} + LIMIT 0, 1 @@ -567,8 +571,8 @@ house_id = house_id where - 1=1 - + house_id = #{houseId} + \ No newline at end of file