房主数据修复

This commit is contained in:
Renpc-kilig 2024-01-11 12:26:32 +08:00
parent b060f7344f
commit 5e4039a31a
4 changed files with 144 additions and 39 deletions

View File

@ -10,6 +10,7 @@ import com.cm.population.pojo.dtos.population.PopulationDTO;
import com.cm.population.pojo.pos.house.HousePO; import com.cm.population.pojo.pos.house.HousePO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -128,4 +129,6 @@ public interface IHouseDao {
List<HouseDTO> listForAll(Map<String, Object> params); List<HouseDTO> listForAll(Map<String, Object> params);
List<HouseDTO> getBatch(Map<String, Object> params); List<HouseDTO> getBatch(Map<String, Object> params);
List<HouseDTO> getUserHouse(HashMap<Object, Object> objectObjectHashMap);
} }

View File

@ -163,7 +163,7 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
@Override @Override
public List<ResidentialDTO> list(Map<String, Object> params) { public List<ResidentialDTO> list(Map<String, Object> params) {
if(null != params.get("myself")) { if (null != params.get("myself")) {
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser(); UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
params.put("creator", userInfoBO.getUserId()); params.put("creator", userInfoBO.getUserId());
} }
@ -210,11 +210,11 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
@Override @Override
public void dataCover() { public void dataCover() {
// 获取所有房屋数据 // 获取所有房屋数据
List<HouseDTO> houseDTOS = houseDao.getBatch(new HashMap<>()); List<HouseDTO> houseDTOS = houseDao.getUserHouse(new HashMap<>());
Map<String, Object> params = new HashMap<>(); /*for (HouseDTO houseDTO : houseDTOS) {
for (HouseDTO houseDTO : houseDTOS) {
if(StringUtils.isNotEmpty(houseDTO.getDocumentNum())) { if(StringUtils.isNotEmpty(houseDTO.getDocumentNum())) {
Map<String, Object> params = new HashMap<>();
String documentNum = houseDTO.getDocumentNum(); String documentNum = houseDTO.getDocumentNum();
String phone = houseDTO.getPhone(); String phone = houseDTO.getPhone();
params.put("idcard", houseDTO.getDocumentNum()); params.put("idcard", houseDTO.getDocumentNum());
@ -234,16 +234,17 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
params.put("documentNum11", documentNum); params.put("documentNum11", documentNum);
params.put("phone11", phone); params.put("phone11", phone);
params.put("houseId", houseDTO.getHouseId());
residentialDao.updateHouse(params); 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())) { if(StringUtils.isNotEmpty(houseDTO.getCustodianDocumentNum())) {
Map<String, Object> params = new HashMap<>();
String documentNum = houseDTO.getCustodianDocumentNum(); String documentNum = houseDTO.getCustodianDocumentNum();
String phone = houseDTO.getCustodianPhone(); String phone = houseDTO.getCustodianPhone();
@ -251,7 +252,7 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
params.put("phone", houseDTO.getCustodianPhone()); params.put("phone", houseDTO.getCustodianPhone());
PopulationInfoBaseDTO populationInfoBaseDTO; PopulationInfoBaseDTO populationInfoBaseDTO;
if(houseDTO.getDocumentNum().indexOf('*') != -1) { if(houseDTO.getCustodianDocumentNum().indexOf('*') != -1) {
populationInfoBaseDTO = residentialDao.getPopu(params); populationInfoBaseDTO = residentialDao.getPopu(params);
}else { }else {
populationInfoBaseDTO = residentialDao.getPopu2(params); populationInfoBaseDTO = residentialDao.getPopu2(params);
@ -264,18 +265,18 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
params.put("custodianDocumentNum11", documentNum); params.put("custodianDocumentNum11", documentNum);
params.put("custodianPhone11", phone); params.put("custodianPhone11", phone);
params.put("houseId", houseDTO.getHouseId());
residentialDao.updateHouse(params); 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 size = houseDTOS.size();
int numThreads = size / 2 + (size % 10000 == 0 ? 0 : 1); // 计算需要的线程数 int numThreads = size / 500 + (size % 500 == 0 ? 0 : 1); // 计算需要的线程数
numThreads = numThreads == 0 ? 1 : numThreads; numThreads = numThreads == 0 ? 1 : numThreads;
ExecutorService executorService = Executors.newFixedThreadPool(numThreads); ExecutorService executorService = Executors.newFixedThreadPool(numThreads);
@ -286,24 +287,27 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
chunkSize = chunkSize == 0 ? 1 : chunkSize; chunkSize = chunkSize == 0 ? 1 : chunkSize;
List<List<HouseDTO>> chunks = Lists.partition(houseDTOS, chunkSize); List<List<HouseDTO>> chunks = Lists.partition(houseDTOS, chunkSize);
Map<String, Object> params = new HashMap<>();
for (List<HouseDTO> chunk : chunks) { for (List<HouseDTO> chunk : chunks) {
Callable<List<PopulationInfoBaseDTO>> task = () -> { Callable<List<PopulationInfoBaseDTO>> task = () -> {
List<PopulationInfoBaseDTO> output = new ArrayList<>(); List<PopulationInfoBaseDTO> output = new ArrayList<>();
for (HouseDTO houseDTO : chunk) { for (HouseDTO houseDTO : chunk) {
if(StringUtils.isNotEmpty(houseDTO.getDocumentNum())) { if (StringUtils.isNotEmpty(houseDTO.getDocumentNum())) {
Map<String, Object> params = new HashMap<>();
params.put("houseId", houseDTO.getHouseId());
String documentNum = houseDTO.getDocumentNum(); String documentNum = houseDTO.getDocumentNum();
String phone = houseDTO.getPhone(); String phone = houseDTO.getPhone();
params.put("idcard", houseDTO.getDocumentNum()); params.put("idcard", houseDTO.getDocumentNum());
params.put("phone", houseDTO.getPhone()); params.put("phone", houseDTO.getPhone());
PopulationInfoBaseDTO populationInfoBaseDTO; PopulationInfoBaseDTO populationInfoBaseDTO;
if(houseDTO.getDocumentNum().indexOf('*') != -1) { if (houseDTO.getDocumentNum().indexOf('*') != -1) {
populationInfoBaseDTO = residentialDao.getPopu(params); populationInfoBaseDTO = residentialDao.getPopu(params);
}else { } else {
populationInfoBaseDTO = residentialDao.getPopu2(params); populationInfoBaseDTO = residentialDao.getPopu2(params);
} }
if(null != populationInfoBaseDTO) { if (null != populationInfoBaseDTO) {
params.put("homeowner", populationInfoBaseDTO.getName()); params.put("homeowner", populationInfoBaseDTO.getName());
params.put("ownerPopulationId", populationInfoBaseDTO.getPopulationInfoId()); params.put("ownerPopulationId", populationInfoBaseDTO.getPopulationInfoId());
params.put("documentNum", populationInfoBaseDTO.getIdcard()); params.put("documentNum", populationInfoBaseDTO.getIdcard());
@ -312,15 +316,35 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
params.put("documentNum11", documentNum); params.put("documentNum11", documentNum);
params.put("phone11", phone); params.put("phone11", phone);
residentialDao.updateHouse(params); residentialDao.updateHouse(params);
} else {
params.remove("idcard");
params.remove("phone"); params.remove("phone");
params.remove("documentNum11"); if (houseDTO.getDocumentNum().indexOf('*') != -1) {
params.remove("phone11"); 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<String, Object> params = new HashMap<>();
params.put("houseId", houseDTO.getHouseId());
String documentNum = houseDTO.getCustodianDocumentNum(); String documentNum = houseDTO.getCustodianDocumentNum();
String phone = houseDTO.getCustodianPhone(); String phone = houseDTO.getCustodianPhone();
@ -328,12 +352,12 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
params.put("phone", houseDTO.getCustodianPhone()); params.put("phone", houseDTO.getCustodianPhone());
PopulationInfoBaseDTO populationInfoBaseDTO; PopulationInfoBaseDTO populationInfoBaseDTO;
if(houseDTO.getDocumentNum().indexOf('*') != -1) { if (houseDTO.getCustodianDocumentNum().indexOf('*') != -1) {
populationInfoBaseDTO = residentialDao.getPopu(params); populationInfoBaseDTO = residentialDao.getPopu(params);
}else { } else {
populationInfoBaseDTO = residentialDao.getPopu2(params); populationInfoBaseDTO = residentialDao.getPopu2(params);
} }
if(null != populationInfoBaseDTO) { if (null != populationInfoBaseDTO) {
params.put("custodian", populationInfoBaseDTO.getName()); params.put("custodian", populationInfoBaseDTO.getName());
params.put("custodianPopulationId", populationInfoBaseDTO.getPopulationInfoId()); params.put("custodianPopulationId", populationInfoBaseDTO.getPopulationInfoId());
params.put("custodianDocumentNum", populationInfoBaseDTO.getIdcard()); params.put("custodianDocumentNum", populationInfoBaseDTO.getIdcard());
@ -342,12 +366,28 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
params.put("custodianDocumentNum11", documentNum); params.put("custodianDocumentNum11", documentNum);
params.put("custodianPhone11", phone); params.put("custodianPhone11", phone);
residentialDao.updateHouse(params); residentialDao.updateHouse(params);
} else {
params.remove("custodianDocumentNum11");
params.remove("custodianPhone11");
params.remove("idcard");
params.remove("phone"); 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; return output;
@ -355,7 +395,7 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
futures.add(executorService.submit(task)); futures.add(executorService.submit(task));
} }
executorService.shutdown(); // 关闭线程池*/ executorService.shutdown(); // 关闭线程池
} }
} }

View File

@ -1208,4 +1208,62 @@
</if> </if>
</select> </select>
<select id="getUserHouse" parameterType="map" resultMap="houseDTO">
SELECT
t1.street,
t1.street_name,
t1.community,
t1.community_name,
t1.residential_id,
t1.residential_name,
t1.building_id,
t1.building_name,
t1.affiliation_unit,
t1.affiliation_floors,
t1.house_num,
t1.category_id,
t1.category_name,
t1.nature_id,
t1.nature_name,
t1.type_id,
t1.type_name,
t1.structure_id,
t1.structure_name,
t1.building_purpose_id,
t1.building_purpose_name,
t1.room_num,
t1.room_area,
t1.room_use_id,
t1.room_use_name,
t1.danger_id,
t1.danger_name,
t1.certificate_num,
t1.registration_date,
t1.affiliated_unit,
t1.is_rental,
t1.is_vacant,
t1.lodge_type_id,
t1.lodge_type_name,
t1.rental_purposes,
t1.homeowner,
t1.document_id,
t1.document_name,
t1.document_num,
t1.phone,
t1.custodian,
t1.custodian_document_id,
t1.custodian_document_name,
t1.custodian_document_num,
t1.custodian_phone,
t1.relationship_homeowner,
t1.house_id,
t1.creator
FROM
house_house t1
WHERE
t1.is_delete = 0
AND (t1.document_num IS NOT NULL AND t1.document_num &lt;&gt; '')
OR (t1.custodian_document_num IS NOT NULL AND t1.custodian_document_num &lt;&gt; '')
</select>
</mapper> </mapper>

View File

@ -481,16 +481,20 @@
t1.creator_area2 t1.creator_area2
FROM population_population_info t1 FROM population_population_info t1
WHERE 1 = 1 WHERE 1 = 1
<if test="idcard != null and idcard != ''">
AND CONCAT( AND CONCAT(
SUBSTRING(t1.idcard, 1, 6), SUBSTRING(t1.idcard, 1, 6),
'********', '********',
SUBSTRING(t1.idcard, 15) SUBSTRING(t1.idcard, 15)
) = #{idcard} ) = #{idcard}
</if>
<if test="phone != null and phone != ''">
AND CONCAT( AND CONCAT(
SUBSTRING(t1.phone, 1, 3), SUBSTRING(t1.phone, 1, 3),
'****', '****',
SUBSTRING(t1.phone, 8) SUBSTRING(t1.phone, 8)
) = #{phone} ) = #{phone}
</if>
LIMIT 0, 1 LIMIT 0, 1
</select> </select>
@ -567,8 +571,8 @@
</if> </if>
house_id = house_id house_id = house_id
where where
1=1 house_id = #{houseId}
<if test="documentNum11 != null and documentNum11 != ''"> <!--<if test="documentNum11 != null and documentNum11 != ''">
AND document_num = #{documentNum11} AND document_num = #{documentNum11}
</if> </if>
<if test="phone11 != null and phone11 != ''"> <if test="phone11 != null and phone11 != ''">
@ -579,7 +583,7 @@
</if> </if>
<if test="custodianPhone11 != null and custodianPhone11 != ''"> <if test="custodianPhone11 != null and custodianPhone11 != ''">
AND custodian_phone = #{custodianPhone11} AND custodian_phone = #{custodianPhone11}
</if> </if>-->
</update> </update>
</mapper> </mapper>