Browse Source

Merge remote-tracking branch 'remotes/origin/dev_fegin_concurrent' into pingyin_master

dev
jianjun 3 years ago
parent
commit
e5520edf63
  1. 14
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  2. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

14
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -11,6 +11,7 @@ import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
@ -620,6 +621,9 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
}
//2、密码是否正确
List<CustomerStaffDTO> customerStaffList=customerStaffResult.getData();
if (CollectionUtils.isEmpty(customerStaffList)){
throw new EpmetException(EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode());
}
//3、查询用户所有的组织信息
List<String> customerIdList = new ArrayList<>();
//是否设置过密码
@ -652,11 +656,19 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
logger.warn(String.format("根据当前账户(%s)密码未找到所属组织,密码错误",formDTO.getUserAccount()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
CustomerStaffDTO customerStaffDTO = customerStaffList.get(0);
String tempKey = RedisKeys.getCustomerStaffTempKey(customerStaffDTO.getUserId());
List<StaffOrgsResultDTO> redisTemp = (List<StaffOrgsResultDTO>)redisUtils.get(tempKey);
if (redisTemp != null){
return redisTemp;
}
StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();
staffOrgFormDTO.setCustomerIdList(customerIdList);
Result<List<StaffOrgsResultDTO>> result = govOrgOpenFeignClient.getStaffOrgList(staffOrgFormDTO);
if(result.success()&&null!=result.getData()){
return result.getData();
List<StaffOrgsResultDTO> data = result.getData();
redisUtils.set(tempKey,data,30*60);
return data;
}
logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参账户%s,密码%s,返回错误码%s,错误提示信息%s",
ServiceConstant.GOV_ORG_SERVER,

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -883,4 +883,11 @@ public class RedisKeys {
}
return rootPrefix.concat("third:customerInfo:appId:")+appId;
}
public static String getCustomerStaffTempKey(String staffId) {
if (StringUtils.isBlank(staffId)){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误");
}
return rootPrefix.concat("gov:staff:temp:staffId:")+staffId;
}
}

Loading…
Cancel
Save