Merge remote-tracking branch 'origin/upgrade' into upgrade
This commit is contained in:
commit
3ecd546459
@ -246,4 +246,11 @@ public class ResidentialController extends AbstractController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "房屋房主信息数据修复", notes = "房屋房主信息数据修复接口")
|
||||
@GetMapping("dataCover")
|
||||
public SuccessResult dataCover() {
|
||||
residentialService.dataCover();
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
}
|
@ -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<HouseDTO> listForAll(Map<String, Object> params);
|
||||
|
||||
List<HouseDTO> getBatch(Map<String, Object> params);
|
||||
|
||||
List<HouseDTO> getUserHouse(HashMap<Object, Object> objectObjectHashMap);
|
||||
}
|
@ -5,6 +5,8 @@ import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.exception.UpdateException;
|
||||
import com.cm.population.pojo.bos.residential.ResidentialBO;
|
||||
import com.cm.population.pojo.dtos.house.HouseDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO;
|
||||
import com.cm.population.pojo.dtos.residential.ResidentialDTO;
|
||||
import com.cm.population.pojo.pos.residential.ResidentialPO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@ -120,4 +122,10 @@ public interface IResidentialDao {
|
||||
String getCommunityId(String community);
|
||||
|
||||
String getStreetId(String street);
|
||||
|
||||
PopulationInfoBaseDTO getPopu(Map<String, Object> params);
|
||||
|
||||
PopulationInfoBaseDTO getPopu2(Map<String, Object> params);
|
||||
|
||||
void updateHouse(Map<String, Object> params);
|
||||
}
|
@ -188,4 +188,9 @@ public interface IResidentialService {
|
||||
String getCommunityId(String community);
|
||||
|
||||
String getStreetId(String street);
|
||||
|
||||
/**
|
||||
* 房屋房主信息数据修复
|
||||
*/
|
||||
void dataCover();
|
||||
}
|
@ -8,19 +8,25 @@ import com.cm.common.token.app.AppTokenManager;
|
||||
import com.cm.common.token.app.entity.AppTokenUser;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.population.dao.house.IHouseDao;
|
||||
import com.cm.population.dao.populationinfo.IPopulationInfoDao;
|
||||
import com.cm.population.dao.residential.IResidentialDao;
|
||||
import com.cm.population.pojo.bos.residential.ResidentialBO;
|
||||
import com.cm.population.pojo.dtos.house.HouseDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO;
|
||||
import com.cm.population.pojo.dtos.residential.ResidentialDTO;
|
||||
import com.cm.population.pojo.pos.residential.ResidentialPO;
|
||||
import com.cm.population.pojo.vos.residential.ResidentialVO;
|
||||
import com.cm.population.service.residential.IResidentialService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* @ClassName: ResidentialServiceImpl
|
||||
@ -34,6 +40,10 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
|
||||
|
||||
@Autowired
|
||||
private IResidentialDao residentialDao;
|
||||
@Autowired
|
||||
private IHouseDao houseDao;
|
||||
@Autowired
|
||||
private IPopulationInfoDao populationInfoDao;
|
||||
|
||||
@Override
|
||||
public void save(ResidentialVO residentialVO) {
|
||||
@ -153,7 +163,7 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
|
||||
|
||||
@Override
|
||||
public List<ResidentialDTO> list(Map<String, Object> params) {
|
||||
if(null != params.get("myself")) {
|
||||
if (null != params.get("myself")) {
|
||||
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
|
||||
params.put("creator", userInfoBO.getUserId());
|
||||
}
|
||||
@ -194,4 +204,198 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
|
||||
return residentialDao.getStreetId(street);
|
||||
}
|
||||
|
||||
/**
|
||||
* 房屋房主信息数据修复
|
||||
*/
|
||||
@Override
|
||||
public void dataCover() {
|
||||
// 获取所有房屋数据
|
||||
List<HouseDTO> houseDTOS = houseDao.getUserHouse(new HashMap<>());
|
||||
|
||||
/*for (HouseDTO houseDTO : houseDTOS) {
|
||||
if(StringUtils.isNotEmpty(houseDTO.getDocumentNum())) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
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) {
|
||||
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);
|
||||
params.put("houseId", houseDTO.getHouseId());
|
||||
residentialDao.updateHouse(params);
|
||||
}
|
||||
params.remove("idcard");
|
||||
params.remove("phone");
|
||||
params.remove("documentNum11");
|
||||
params.remove("phone11");
|
||||
}
|
||||
|
||||
if(StringUtils.isNotEmpty(houseDTO.getCustodianDocumentNum())) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
String documentNum = houseDTO.getCustodianDocumentNum();
|
||||
String phone = houseDTO.getCustodianPhone();
|
||||
|
||||
params.put("idcard", houseDTO.getCustodianDocumentNum());
|
||||
params.put("phone", houseDTO.getCustodianPhone());
|
||||
|
||||
PopulationInfoBaseDTO populationInfoBaseDTO;
|
||||
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);
|
||||
params.put("houseId", houseDTO.getHouseId());
|
||||
residentialDao.updateHouse(params);
|
||||
}
|
||||
params.remove("custodianDocumentNum11");
|
||||
params.remove("custodianPhone11");
|
||||
params.remove("idcard");
|
||||
params.remove("phone");
|
||||
}
|
||||
}*/
|
||||
|
||||
int size = houseDTOS.size();
|
||||
int numThreads = size / 500 + (size % 500 == 0 ? 0 : 1); // 计算需要的线程数
|
||||
numThreads = numThreads == 0 ? 1 : numThreads;
|
||||
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(numThreads);
|
||||
List<Future<List<PopulationInfoBaseDTO>>> futures = new ArrayList<>();
|
||||
|
||||
// 将populationInfoIds分割成多个子列表,每个子列表由一个任务处理
|
||||
int chunkSize = (int) Math.ceil((double) houseDTOS.size() / numThreads);
|
||||
chunkSize = chunkSize == 0 ? 1 : chunkSize;
|
||||
List<List<HouseDTO>> chunks = Lists.partition(houseDTOS, chunkSize);
|
||||
|
||||
for (List<HouseDTO> chunk : chunks) {
|
||||
Callable<List<PopulationInfoBaseDTO>> task = () -> {
|
||||
List<PopulationInfoBaseDTO> output = new ArrayList<>();
|
||||
for (HouseDTO houseDTO : chunk) {
|
||||
if (StringUtils.isNotEmpty(houseDTO.getDocumentNum())) {
|
||||
Map<String, Object> 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) {
|
||||
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);
|
||||
} else {
|
||||
params.remove("phone");
|
||||
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())) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
||||
params.put("houseId", houseDTO.getHouseId());
|
||||
|
||||
String documentNum = houseDTO.getCustodianDocumentNum();
|
||||
String phone = houseDTO.getCustodianPhone();
|
||||
|
||||
params.put("idcard", houseDTO.getCustodianDocumentNum());
|
||||
params.put("phone", houseDTO.getCustodianPhone());
|
||||
|
||||
PopulationInfoBaseDTO populationInfoBaseDTO;
|
||||
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);
|
||||
} 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;
|
||||
};
|
||||
futures.add(executorService.submit(task));
|
||||
}
|
||||
|
||||
executorService.shutdown(); // 关闭线程池
|
||||
}
|
||||
|
||||
}
|
@ -1208,4 +1208,62 @@
|
||||
</if>
|
||||
</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 <> '')
|
||||
OR (t1.custodian_document_num IS NOT NULL AND t1.custodian_document_num <> '')
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -2,6 +2,28 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cm.population.dao.residential.IResidentialDao">
|
||||
|
||||
<resultMap id="populationInfoBaseDTO" type="com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO">
|
||||
<result column="population_info_id" property="populationInfoId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="idcard" property="idcard"/>
|
||||
<result column="label" property="label"/>
|
||||
<result column="idcard_type" property="idcardType"/>
|
||||
<result column="birthday" property="birthday"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="nation" property="nation"/>
|
||||
<result column="education" property="education"/>
|
||||
<result column="health_status" property="healthStatus"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="is_oldage" property="isOldage"/>
|
||||
<result column="is_disability" property="isDisability"/>
|
||||
<result column="is_military" property="isMilitary"/>
|
||||
<result column="is_succour" property="isSuccour"/>
|
||||
<result column="is_party" property="isParty"/>
|
||||
<result column="creator_area1" property="creatorArea1"/>
|
||||
<result column="creator_area2" property="creatorArea2"/>
|
||||
<result column="creator" property="creator"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="residentialDTO" type="com.cm.population.pojo.dtos.residential.ResidentialDTO">
|
||||
<result column="residential_id" property="residentialId"/>
|
||||
<result column="name" property="name"/>
|
||||
@ -437,4 +459,131 @@
|
||||
SELECT community_id FROM d_community WHERE community_name = #{community} and is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="getPopu" parameterType="map" resultMap="populationInfoBaseDTO">
|
||||
SELECT t1.population_info_id,
|
||||
t1.name,
|
||||
t1.label,
|
||||
t1.idcard,
|
||||
t1.idcard_type,
|
||||
t1.health_status,
|
||||
t1.birthday,
|
||||
t1.sex,
|
||||
t1.nation,
|
||||
t1.education,
|
||||
t1.phone,
|
||||
t1.is_oldage,
|
||||
t1.is_disability,
|
||||
t1.is_military,
|
||||
t1.is_succour,
|
||||
t1.is_party,
|
||||
t1.creator,
|
||||
t1.creator_area1,
|
||||
t1.creator_area2
|
||||
FROM population_population_info t1
|
||||
WHERE 1 = 1
|
||||
<if test="idcard != null and idcard != ''">
|
||||
AND CONCAT(
|
||||
SUBSTRING(t1.idcard, 1, 6),
|
||||
'********',
|
||||
SUBSTRING(t1.idcard, 15)
|
||||
) = #{idcard}
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
AND CONCAT(
|
||||
SUBSTRING(t1.phone, 1, 3),
|
||||
'****',
|
||||
SUBSTRING(t1.phone, 8)
|
||||
) = #{phone}
|
||||
</if>
|
||||
LIMIT 0, 1
|
||||
</select>
|
||||
|
||||
<select id="getPopu2" parameterType="map" resultMap="populationInfoBaseDTO">
|
||||
SELECT t1.population_info_id,
|
||||
t1.name,
|
||||
t1.label,
|
||||
t1.idcard,
|
||||
t1.idcard_type,
|
||||
t1.health_status,
|
||||
t1.birthday,
|
||||
t1.sex,
|
||||
t1.nation,
|
||||
t1.education,
|
||||
t1.phone,
|
||||
t1.is_oldage,
|
||||
t1.is_disability,
|
||||
t1.is_military,
|
||||
t1.is_succour,
|
||||
t1.is_party,
|
||||
t1.creator,
|
||||
t1.creator_area1,
|
||||
t1.creator_area2
|
||||
FROM population_population_info t1
|
||||
WHERE 1 = 1
|
||||
<if test="idcard !=null and idcard != ''">
|
||||
AND t1.idcard = #{idcard}
|
||||
</if>
|
||||
<if test="phone !=null and phone != ''">
|
||||
AND t1.phone = #{phone}
|
||||
</if>
|
||||
LIMIT 0, 1
|
||||
</select>
|
||||
|
||||
<update id="updateHouse" parameterType="map">
|
||||
UPDATE
|
||||
house_house
|
||||
SET
|
||||
<if test="ownerPopulationId != null and ownerPopulationId != ''">
|
||||
owner_population_id = #{ownerPopulationId},
|
||||
</if>
|
||||
<if test="homeowner != null and homeowner != ''">
|
||||
homeowner = #{homeowner},
|
||||
</if>
|
||||
<if test="documentId != null and documentId != ''">
|
||||
document_id = #{documentId},
|
||||
</if>
|
||||
<if test="documentName != null and documentName != ''">
|
||||
document_name = #{documentName},
|
||||
</if>
|
||||
<if test="documentNum != null and documentNum != ''">
|
||||
document_num = #{documentNum},
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="custodianPopulationId != null and custodianPopulationId != ''">
|
||||
custodian_population_id = #{custodianPopulationId},
|
||||
</if>
|
||||
<if test="custodian != null and custodian != ''">
|
||||
custodian = #{custodian},
|
||||
</if>
|
||||
<if test="custodianDocumentId != null and custodianDocumentId != ''">
|
||||
custodian_document_id = #{custodianDocumentId},
|
||||
</if>
|
||||
<if test="custodianDocumentName != null and custodianDocumentName != ''">
|
||||
custodian_document_name = #{custodianDocumentName},
|
||||
</if>
|
||||
<if test="custodianDocumentNum != null and custodianDocumentNum != ''">
|
||||
custodian_document_num = #{custodianDocumentNum},
|
||||
</if>
|
||||
<if test="custodianPhone != null and custodianPhone != ''">
|
||||
custodian_phone = #{custodianPhone},
|
||||
</if>
|
||||
house_id = house_id
|
||||
where
|
||||
house_id = #{houseId}
|
||||
<!--<if test="documentNum11 != null and documentNum11 != ''">
|
||||
AND document_num = #{documentNum11}
|
||||
</if>
|
||||
<if test="phone11 != null and phone11 != ''">
|
||||
AND phone = #{phone11}
|
||||
</if>
|
||||
<if test="custodianDocumentNum11 != null and custodianDocumentNum11 != ''">
|
||||
AND custodian_document_num = #{custodianDocumentNum11}
|
||||
</if>
|
||||
<if test="custodianPhone11 != null and custodianPhone11 != ''">
|
||||
AND custodian_phone = #{custodianPhone11}
|
||||
</if>-->
|
||||
</update>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user