Browse Source

Merge remote-tracking branch 'origin/dev_jcet' into dev_temp

master
zxc 5 years ago
parent
commit
543a6cf536
  1. 3
      epmet-auth/src/main/java/com/epmet/constant/SsoConstant.java
  2. 10
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java

3
epmet-auth/src/main/java/com/epmet/constant/SsoConstant.java

@ -15,4 +15,7 @@ public interface SsoConstant {
String INSERT_UPDATE_USER_FAILURE = "新增或更新user_weChat失败......";
String USER_ID_IS_NULL = "userId为空,生成token失败......";
String CUSTOMER_ID_IS_NULL = "customerId为空,缓存放置token失败......";
}

10
epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java

@ -22,6 +22,7 @@ import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.SsoRedis;
import com.epmet.service.SsoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -79,10 +80,17 @@ public class SsoServiceImpl implements SsoService {
}
userId = userDTOResult.getData().getId();
}
if (StringUtils.isBlank(userId)){
throw new RenException(SsoConstant.USER_ID_IS_NULL);
}
//生成业务token
String token = this.generateToken(formDTO.getApp(),formDTO.getClient(), userId);
//存放Redis
this.disposeTokenDto(formDTO, userId, token, getCustomerId(formDTO.getAppId()));
String customerId = getCustomerId(formDTO.getAppId());
if (StringUtils.isBlank(customerId)){
throw new RenException(SsoConstant.CUSTOMER_ID_IS_NULL);
}
this.disposeTokenDto(formDTO, userId, token, customerId);
return new SsoLoginResultDTO(token);
}

Loading…
Cancel
Save