Browse Source

Merge branch 'dev_jcet' into dev_temp

# Conflicts:
#	epmet-auth/src/main/java/com/epmet/controller/SsoController.java
#	epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
#	epmet-auth/src/main/resources/bootstrap.yml
dev_shibei_match
wxz 5 years ago
parent
commit
c3ca93250d
  1. 8
      epmet-auth/pom.xml
  2. 4
      epmet-auth/src/main/java/com/epmet/controller/SsoController.java
  3. 2
      epmet-auth/src/main/java/com/epmet/service/SsoService.java
  4. 14
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  5. 7
      epmet-auth/src/main/resources/bootstrap.yml

8
epmet-auth/pom.xml

@ -207,6 +207,8 @@
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
<profile>
@ -260,6 +262,8 @@
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
<profile>
@ -308,6 +312,8 @@
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
@ -356,6 +362,8 @@
<thirdplat.jcet.c.domain>https://jcytc.lzjczl.com:21009</thirdplat.jcet.c.domain>
<thirdplat.jcet.c.appkey>2cy0a9lA</thirdplat.jcet.c.appkey>
<thirdplat.jcet.c.appsecret>6hU3PQgxLcXr27SE</thirdplat.jcet.c.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
</profiles>

4
epmet-auth/src/main/java/com/epmet/controller/SsoController.java

@ -38,9 +38,9 @@ public class SsoController {
* @date 2021/1/18 下午4:59
*/
@PostMapping("resi/login")
public Result<SsoLoginResultDTO> ssoLogin(@RequestBody SsoLoginFormDTO formDTO) {
public Result<SsoLoginResultDTO> ssoResiLogin(@RequestBody SsoLoginFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoLogin(formDTO));
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoResiLogin(formDTO));
}
/**

2
epmet-auth/src/main/java/com/epmet/service/SsoService.java

@ -19,7 +19,7 @@ public interface SsoService {
* @author zxc
* @date 2021/1/18 下午4:59
*/
SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO);
SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO);
/**
* @param formDTO

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

@ -30,6 +30,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -74,6 +75,9 @@ public class SsoServiceImpl implements SsoService {
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Value("${epmet.third.urlPrefix}")
private String epmetThirdUrlPrefix;
/**
* @Description 0入口得到token
* @Param formDTO
@ -81,7 +85,7 @@ public class SsoServiceImpl implements SsoService {
* @date 2021/1/18 下午4:59
*/
@Override
public SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO) {
public SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO) {
String customerId = getCustomerId(formDTO.getAppId());
//String customerId = "3a4f923665a7a07701bcb311aac9a156";
String userId = "";
@ -230,7 +234,7 @@ public class SsoServiceImpl implements SsoService {
*/
public String getCustomerId(String appId){
JSONObject jsonObject = new JSONObject();
String customerMsgUrl = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/";
String customerMsgUrl = epmetThirdUrlPrefix + "/api/third/customermp/getcustomermsg/";
String data = HttpClientManager.getInstance().sendPostByJSON(customerMsgUrl + appId, JSON.toJSONString(jsonObject)).getData();
log.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data);
JSONObject toResult = JSON.parseObject(data);
@ -481,10 +485,10 @@ public class SsoServiceImpl implements SsoService {
//2.客户Id换取第三方apiService,根据ticket换取华为Id
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(formDTO.getCustomerId()));
if (!apiServiceResult.success()) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg());
throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg());
}
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
}
ThirdPlatUserInfo userInfo;
try {
@ -495,7 +499,7 @@ public class SsoServiceImpl implements SsoService {
}
if (null == userInfo){
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空");
"【SSO enterOrg】调用第三方平台查询用户信息失败,用户信息为空");
}
//3、记录staff_wechat,并记录用户激活状态,激活时间

7
epmet-auth/src/main/resources/bootstrap.yml

@ -147,4 +147,9 @@ thirdplat:
domain: https://epmet-ext9.elinkservice.cn/platform
appId: 7a5aec009ba4eba8e254ee64fe3775e1
appKey: 14faef9af508d1c253b720ea5a43f9de
appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595
appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595
epmet:
# third服务的相关配置
third:
urlPrefix: @epmet.third.urlprefix@
Loading…
Cancel
Save