|  |  | @ -2,12 +2,10 @@ package com.epmet.service.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.EasyExcel; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.toolkit.IdWorker; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.toolkit.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.AppClientConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.ServiceConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetException; | 
			
		
	
	
		
			
				
					|  |  | @ -26,7 +24,10 @@ import com.epmet.dao.IcResiUserDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.UserBaseInfoDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.IcNatDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.IcNoticeDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.AddIcNatFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.ImportTaskCommonFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.MyNatListFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.SendNoticeFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.IcNatEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.IcNatRelationEntity; | 
			
		
	
	
		
			
				
					|  |  | @ -38,6 +39,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.OssFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.IcNatService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.IcNoticeService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.UserService; | 
			
		
	
		
			
				
					|  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
			
				
					|  |  |  | import com.github.pagehelper.PageInfo; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
	
		
			
				
					|  |  | @ -83,6 +85,8 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp | 
			
		
	
		
			
				
					|  |  |  |     private IcNatRelationDao icNatRelationDao; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private IcResiUserDao icResiUserDao; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private UserService userService; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Author sun | 
			
		
	
	
		
			
				
					|  |  | @ -313,9 +317,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp | 
			
		
	
		
			
				
					|  |  |  |             String app = EpmetRequestHolder.getHeader(AppClientConstant.APP); | 
			
		
	
		
			
				
					|  |  |  |             String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             LoginUserDetailsFormDTO ludf = new LoginUserDetailsFormDTO(app, client, userId); | 
			
		
	
		
			
				
					|  |  |  |             LoginUserDetailsResultDTO loginUserDetails = getResultDataOrThrowsException(epmetUserOpenFeignClient.getLoginUserDetails(ludf), ServiceConstant.EPMET_USER_SERVER, | 
			
		
	
		
			
				
					|  |  |  |                     EpmetErrorCode.SERVER_ERROR.getCode(), "调用user出错", ""); | 
			
		
	
		
			
				
					|  |  |  |             LoginUserDetailsResultDTO loginUserDetails = userService.getLoginUserDetails(app, client, userId); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             String agencyId = loginUserDetails.getAgencyId(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -436,6 +438,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp | 
			
		
	
		
			
				
					|  |  |  |         }).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public Integer updateIsResiFlag(String customerId, String icResiUserId) { | 
			
		
	
		
			
				
					|  |  |  |         return baseDao.updateIsResiFlag(customerId,icResiUserId); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 批量持久化 | 
			
		
	
		
			
				
					|  |  |  |      * @param entities | 
			
		
	
	
		
			
				
					|  |  | @ -510,15 +517,15 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp | 
			
		
	
		
			
				
					|  |  |  |                 needUpdate = true; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             // 检测地点和手机号先不提示,说需要提示再提示
 | 
			
		
	
		
			
				
					|  |  |  |             if (!natAddress.equals(resiNat.getNatAddress())) { | 
			
		
	
		
			
				
					|  |  |  |                 changedFieldNames.add("检测地点"); | 
			
		
	
		
			
				
					|  |  |  |                 resiNat.setNatResult(natAddress); | 
			
		
	
		
			
				
					|  |  |  |             // 检测地点和手机号先不提示,说需要提示再提示。需要考虑两个都不为空&&不相等 || 两个中一个为空一个不为空
 | 
			
		
	
		
			
				
					|  |  |  |             if ((StringUtils.isBlank(natAddress) && StringUtils.isNotBlank(resiNat.getNatAddress())) | 
			
		
	
		
			
				
					|  |  |  |                     || (StringUtils.isNotBlank(natAddress) && StringUtils.isBlank(resiNat.getNatAddress())) | 
			
		
	
		
			
				
					|  |  |  |                     || (StringUtils.isNotBlank(natAddress) && StringUtils.isNotBlank(resiNat.getNatAddress()) && !natAddress.equals(resiNat.getNatAddress()))) { | 
			
		
	
		
			
				
					|  |  |  |                 resiNat.setNatAddress(natAddress); | 
			
		
	
		
			
				
					|  |  |  |                 needUpdate = true; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             if (!mobile.equals(resiNat.getMobile())) { | 
			
		
	
		
			
				
					|  |  |  |                 changedFieldNames.add("手机号"); | 
			
		
	
		
			
				
					|  |  |  |                 resiNat.setMobile(mobile); | 
			
		
	
		
			
				
					|  |  |  |                 needUpdate = true; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
	
		
			
				
					|  |  | @ -537,6 +544,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp | 
			
		
	
		
			
				
					|  |  |  |             if (needUpdate) { | 
			
		
	
		
			
				
					|  |  |  |                 resiNat.setUpdatedBy(currentUserId); | 
			
		
	
		
			
				
					|  |  |  |                 resiNat.setUpdatedTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 IcResiUserEntity resi = getResi(customerId, idCard); | 
			
		
	
		
			
				
					|  |  |  |                 resiNat.setIsResiUser(resi != null ? "1" : "0"); | 
			
		
	
		
			
				
					|  |  |  |                 resiNat.setUserId(resi != null ? resi.getId() : ""); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 baseDao.updateById(resiNat); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -547,7 +559,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 执行新增操作
 | 
			
		
	
		
			
				
					|  |  |  |         e.setIsResiUser(isResi(customerId, idCard)); | 
			
		
	
		
			
				
					|  |  |  |         IcResiUserEntity resi = getResi(customerId, idCard); | 
			
		
	
		
			
				
					|  |  |  |         e.setIsResiUser(resi != null ? "1" : "0"); | 
			
		
	
		
			
				
					|  |  |  |         e.setUserId(resi != null ? resi.getId() : ""); | 
			
		
	
		
			
				
					|  |  |  |         e.setUserType("import"); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         baseDao.insert(e); | 
			
		
	
	
		
			
				
					|  |  | @ -564,11 +578,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp | 
			
		
	
		
			
				
					|  |  |  |      * @param idCard | 
			
		
	
		
			
				
					|  |  |  |      * @return | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     public String isResi(String customerId, String idCard) { | 
			
		
	
		
			
				
					|  |  |  |     public IcResiUserEntity getResi(String customerId, String idCard) { | 
			
		
	
		
			
				
					|  |  |  |         LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper(); | 
			
		
	
		
			
				
					|  |  |  |         query.eq(IcResiUserEntity::getCustomerId, customerId); | 
			
		
	
		
			
				
					|  |  |  |         query.eq(IcResiUserEntity::getIdCard, idCard); | 
			
		
	
		
			
				
					|  |  |  |         return icResiUserDao.selectCount(query) > 0 ? "1" : "0"; | 
			
		
	
		
			
				
					|  |  |  |         return icResiUserDao.selectOne(query); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
	
		
			
				
					|  |  | 
 |