wangxianzhang 3 years ago
parent
commit
8e94a181b4
  1. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java
  2. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java

@ -1,6 +1,7 @@
package com.epmet.commons.tools.utils;
import com.alibaba.ttl.TransmittableThreadLocal;
import com.epmet.commons.tools.constant.StrConstant;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
@ -46,7 +47,11 @@ public class EpmetRequestHolder {
* @return
*/
public static String getHeader(String headerName) {
return requestHeaderTtl.get().get(headerName.toLowerCase());
Map<String, String> stringStringMap = requestHeaderTtl.get();
if (stringStringMap == null){
return StrConstant.EPMETY_STR;
}
return stringStringMap.get(headerName.toLowerCase());
}
/**

25
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -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);
}

Loading…
Cancel
Save