Commit 915485eb by 陶光胜

二维码

parent 5b10482b
......@@ -4,7 +4,7 @@ import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
//@Configuration
public class Config {
@Value("${host}")
private String host;
......
......@@ -5,7 +5,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gic.operation.web.config.Config;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -46,8 +47,7 @@ public class LoginController {
private UserApiService userApiService;
@Autowired
private MarketUserApiService marketUserApiService;
@Autowired
private Config config;
// private static final String URL = "https://four.gicdev.com";
......@@ -83,7 +83,9 @@ public class LoginController {
ServiceResponse<String> result = marketUserApiService.BindGicEnterprise(Long.valueOf(enterpriseId), null, null,
null);
if (result.isSuccess()) {
return RestResponse.success(config.getHost() + "/market/gic" + "?loginKey=" + result.getResult()
Config config = ConfigService.getConfig("COMMON.4.0-gic-properties");
String url = config.getProperty("service_host", "").replace("gic", "");
return RestResponse.success(url + "/market/gic" + "?loginKey=" + result.getResult()
+ "&enterpriseId=" + enterpriseId);
}
return EnterpriseRestResponse.failure(result);
......@@ -91,8 +93,10 @@ public class LoginController {
@RequestMapping("login-gic")
public RestResponse login(Integer enterpriseId, String redirectUrl) throws IOException {
Config config = ConfigService.getConfig("COMMON.4.0-gic-properties");
String url = config.getProperty("service_host", "").replace("gic", "");
if (StringUtils.isBlank(redirectUrl)) {
redirectUrl = config.getHost() + "/damo-system/overview/index";
redirectUrl = url + "/damo-system/overview/index";
// redirectUrl = "https://four.gicdev.com/cost-center/billing-center/overview";
}
String token;
......@@ -168,7 +172,7 @@ public class LoginController {
//塞缓存
token = UserDetailUtils.setUserDetail(userDetail);
String SSO_LOGIN_URL = config.getHost() + "/gic-auth-web/login-for-operation";
String SSO_LOGIN_URL = url + "/gic-auth-web/login-for-operation";
return RestResponse.success(SSO_LOGIN_URL + "?token=" + token + "&redirectUrl=" + redirectUrl);
}
return RestResponse.success();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment