|
|
@ -478,6 +478,8 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void persisNat(IcNatEntity e, String customerId, String currentUserId, IcNatExcelImportListener listener) { |
|
|
|
List<IcNatImportExcelData.RowRemarkMessage> otherRows = listener.getOtherRows(); |
|
|
|
String agencyPids = listener.getCurrentAgencyPids(); |
|
|
|
String agencyId = listener.getCurrentAgencyId(); |
|
|
|
|
|
|
|
Date natTime = e.getNatTime(); |
|
|
|
String idCard = e.getIdCard(); |
|
|
@ -545,43 +547,50 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
resiNat.setUpdatedBy(currentUserId); |
|
|
|
resiNat.setUpdatedTime(new Date()); |
|
|
|
|
|
|
|
IcResiUserEntity resi = getResi(customerId, idCard); |
|
|
|
IcResiUserEntity resi = getResi(customerId, idCard, null); |
|
|
|
resiNat.setIsResiUser(resi != null ? "1" : "0"); |
|
|
|
resiNat.setUserId(resi != null ? resi.getId() : ""); |
|
|
|
|
|
|
|
baseDao.updateById(resiNat); |
|
|
|
} |
|
|
|
|
|
|
|
// 还要创建关系
|
|
|
|
createNatRelation(resiNat.getId(), listener.getCurrentAgencyId(), listener.getCurrentAgencyPids()); |
|
|
|
// 还要创建关系。只有本辖区及下级居民,才建立关系
|
|
|
|
if (getResi(customerId, idCard, String.join(":", Arrays.asList(agencyPids, agencyId))) != null) { |
|
|
|
createNatRelation(resiNat.getId(), listener.getCurrentAgencyId(), listener.getCurrentAgencyPids()); |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 执行新增操作
|
|
|
|
IcResiUserEntity resi = getResi(customerId, idCard); |
|
|
|
IcResiUserEntity resi = getResi(customerId, idCard, null); |
|
|
|
e.setIsResiUser(resi != null ? "1" : "0"); |
|
|
|
e.setUserId(resi != null ? resi.getId() : ""); |
|
|
|
e.setUserType("import"); |
|
|
|
|
|
|
|
baseDao.insert(e); |
|
|
|
|
|
|
|
// 还要创建关系
|
|
|
|
createNatRelation(e.getId(), listener.getCurrentAgencyId(), listener.getCurrentAgencyPids()); |
|
|
|
// 还要创建关系。只有本辖区及下级居民,才建立关系
|
|
|
|
if (getResi(customerId, idCard, String.join(":", Arrays.asList(agencyPids, agencyId))) != null) { |
|
|
|
createNatRelation(e.getId(), listener.getCurrentAgencyId(), listener.getCurrentAgencyPids()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 是否是客户下的居民; |
|
|
|
* 是否是指定条件下的居民; |
|
|
|
* 0:否 |
|
|
|
* 1:是 |
|
|
|
* @param customerId |
|
|
|
* @param idCard |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public IcResiUserEntity getResi(String customerId, String idCard) { |
|
|
|
public IcResiUserEntity getResi(String customerId, String idCard, String pids) { |
|
|
|
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper(); |
|
|
|
query.eq(IcResiUserEntity::getCustomerId, customerId); |
|
|
|
query.eq(IcResiUserEntity::getIdCard, idCard); |
|
|
|
if (StringUtils.isNotBlank(pids)) { |
|
|
|
query.likeRight(IcResiUserEntity::getPids, pids); |
|
|
|
} |
|
|
|
return icResiUserDao.selectOne(query); |
|
|
|
} |
|
|
|
|
|
|
|