|
@ -2,12 +2,15 @@ package com.epmet.excel.handler; |
|
|
|
|
|
|
|
|
import com.alibaba.excel.context.AnalysisContext; |
|
|
import com.alibaba.excel.context.AnalysisContext; |
|
|
import com.alibaba.excel.read.listener.ReadListener; |
|
|
import com.alibaba.excel.read.listener.ReadListener; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
import com.epmet.commons.tools.exception.ValidateException; |
|
|
import com.epmet.commons.tools.exception.ValidateException; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
|
|
|
import com.epmet.dto.result.ResiAndLocalResiResultDTO; |
|
|
import com.epmet.entity.IcNatEntity; |
|
|
import com.epmet.entity.IcNatEntity; |
|
|
import com.epmet.excel.data.IcNatImportExcelData; |
|
|
import com.epmet.excel.data.IcNatImportExcelData; |
|
|
import com.epmet.service.impl.IcNatServiceImpl; |
|
|
import com.epmet.service.impl.IcNatServiceImpl; |
|
@ -53,8 +56,9 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa |
|
|
private List<IcNatImportExcelData.RowRemarkMessage> otherRows = new ArrayList<>(); |
|
|
private List<IcNatImportExcelData.RowRemarkMessage> otherRows = new ArrayList<>(); |
|
|
|
|
|
|
|
|
private IcNatServiceImpl icNatService; |
|
|
private IcNatServiceImpl icNatService; |
|
|
|
|
|
private IcResiUserDao icResiUserDao; |
|
|
|
|
|
|
|
|
public IcNatExcelImportListener(String currentUserId, String currentAgencyId, String currentAgencyPids, IcNatServiceImpl icNatService) { |
|
|
public IcNatExcelImportListener(String currentUserId, String currentAgencyId, String currentAgencyPids, IcNatServiceImpl icNatService, IcResiUserDao icResiUserDao) { |
|
|
this.currentUserId = currentUserId; |
|
|
this.currentUserId = currentUserId; |
|
|
this.currentAgencyId = currentAgencyId; |
|
|
this.currentAgencyId = currentAgencyId; |
|
|
this.currentAgencyPids = currentAgencyPids; |
|
|
this.currentAgencyPids = currentAgencyPids; |
|
@ -101,7 +105,16 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa |
|
|
IcNatEntity icNatEntity = ConvertUtils.sourceToTarget(data, IcNatEntity.class); |
|
|
IcNatEntity icNatEntity = ConvertUtils.sourceToTarget(data, IcNatEntity.class); |
|
|
//icNatEntity.setAgencyId(currentAgencyId);
|
|
|
//icNatEntity.setAgencyId(currentAgencyId);
|
|
|
//icNatEntity.setPids(currentAgencyPids);
|
|
|
//icNatEntity.setPids(currentAgencyPids);
|
|
|
icNatEntity.setUserId(currentUserId); |
|
|
ResiAndLocalResiResultDTO resiCount = icResiUserDao.getResiCount(currentAgencyId, icNatEntity.getIdCard(), icNatEntity.getCustomerId()); |
|
|
|
|
|
if (null == resiCount){ |
|
|
|
|
|
icNatEntity.setUserId(currentUserId); |
|
|
|
|
|
icNatEntity.setIsLocalResiUser(NumConstant.ZERO_STR); |
|
|
|
|
|
icNatEntity.setIsResiUser(NumConstant.ZERO_STR); |
|
|
|
|
|
}else { |
|
|
|
|
|
icNatEntity.setUserId(StringUtils.isBlank(resiCount.getUserId()) ? currentUserId : resiCount.getUserId()); |
|
|
|
|
|
icNatEntity.setIsLocalResiUser(resiCount.getIsLocal() == NumConstant.ZERO ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
|
|
|
icNatEntity.setIsResiUser(resiCount.getIsResi() == NumConstant.ZERO ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
|
|
|
} |
|
|
icNatEntity.setUserType("import"); |
|
|
icNatEntity.setUserType("import"); |
|
|
icNatEntity.setNatResult(natResult); |
|
|
icNatEntity.setNatResult(natResult); |
|
|
icNatEntity.setAttachmentType(""); |
|
|
icNatEntity.setAttachmentType(""); |
|
|