|  |  | @ -1,13 +1,21 @@ | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.service.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.common.token.constant.LoginConstant; | 
			
		
	
		
			
				
					|  |  |  | 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; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.RenException; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.feign.ResultDataResolver; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.security.dto.GovTokenDto; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.security.password.PasswordUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.CpUserDetailRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.CustomerStaffDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.CustomerStaffFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.GovWebLoginFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.GovWebOperLoginFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.GovWebOperLoginResultDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -32,7 +40,7 @@ import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | @Slf4j | 
			
		
	
		
			
				
					|  |  |  | @Service | 
			
		
	
		
			
				
					|  |  |  | public class GovWebServiceImpl implements GovWebService { | 
			
		
	
		
			
				
					|  |  |  | public class GovWebServiceImpl implements GovWebService, ResultDataResolver { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private static final Logger logger = LoggerFactory.getLogger(GovWebServiceImpl.class); | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
	
		
			
				
					|  |  | @ -131,5 +139,36 @@ public class GovWebServiceImpl implements GovWebService { | 
			
		
	
		
			
				
					|  |  |  |         return token; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public BlockChainStaffAuthResultDTO blockChainStaffAuthenticationByPwd(String customerId, String mobile, String password) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |         form.setCustomerId(customerId); | 
			
		
	
		
			
				
					|  |  |  |         form.setMobile(mobile); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 用户认证
 | 
			
		
	
		
			
				
					|  |  |  |         GovWebOperLoginResultDTO staff = getResultDataOrThrowsException(epmetUserFeignClient.getStaffIdAndPwd(form), ServiceConstant.EPMET_USER_SERVER, | 
			
		
	
		
			
				
					|  |  |  |                 EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), | 
			
		
	
		
			
				
					|  |  |  |                 String.format("【区块链用户认证】根据手机号%s和指定客户ID:%s认证用户失败", mobile, customerId), | 
			
		
	
		
			
				
					|  |  |  |                 "认证失败"); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         if (staff == null) { | 
			
		
	
		
			
				
					|  |  |  |             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), | 
			
		
	
		
			
				
					|  |  |  |                     String.format("【区块链用户认证】根据手机号%s和指定客户ID:%s认证用户失败", mobile, customerId)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         if (!PasswordUtils.matches(password, staff.getPassWord())) { | 
			
		
	
		
			
				
					|  |  |  |             // 密码不匹配
 | 
			
		
	
		
			
				
					|  |  |  |             throw new EpmetException(EpmetErrorCode.ERR10004.getCode(), String.format("【区块链用户认证】密码不匹配,手机号:%s", mobile)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 用户基础信息
 | 
			
		
	
		
			
				
					|  |  |  |         CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staff.getUserId()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         BlockChainStaffAuthResultDTO r = new BlockChainStaffAuthResultDTO(staff.getUserId(), staffInfo.getRealName(), | 
			
		
	
		
			
				
					|  |  |  |                 staffInfo.getMobile(), staffInfo.getHeadPhoto(), staffInfo.getAgencyId(), staffInfo.getAgencyName()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         return r; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |