Commit d0954e9a authored by 李健华's avatar 李健华

修改渠道地址获取方式,通过Apollo配置获取

parent 074fe1a3
...@@ -13,6 +13,7 @@ import cn.quantgroup.xyqb.service.user.IUserDetailService; ...@@ -13,6 +13,7 @@ import cn.quantgroup.xyqb.service.user.IUserDetailService;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -31,17 +32,24 @@ public class PlatformApiController implements IBaseController { ...@@ -31,17 +32,24 @@ public class PlatformApiController implements IBaseController {
@Autowired @Autowired
private IUserDetailService userDetailService; private IUserDetailService userDetailService;
@Value("${merchant.config.returnUrl}")
private String merchantConfigReturnUrl;
@RequestMapping("/page/return_url") @RequestMapping("/page/return_url")
public JsonResult returnUrl(String key) { public JsonResult returnUrl(String key) {
Merchant merchant = merchantService.findMerchantByName(key); Merchant merchant = merchantService.findMerchantByName(key);
if (null == merchant) { if (null == merchant) {
return JsonResult.buildErrorStateResult("", null); return JsonResult.buildErrorStateResult("", null);
} }
MerchantConfig config = merchantService.findConfigByMerchantIdAndConfigName(merchant.getId(), "returnUrl"); // MerchantConfig config = merchantService.findConfigByMerchantIdAndConfigName(merchant.getId(), "returnUrl");
if (null == config) { if (merchantConfigReturnUrl == null) {
return JsonResult.buildSuccessResult("", null);
}
String configValue = merchantConfigReturnUrl.split(",")[4];
if (null == configValue) {
return JsonResult.buildSuccessResult("", null); return JsonResult.buildSuccessResult("", null);
} }
return JsonResult.buildSuccessResult("", config.getConfigValue()); return JsonResult.buildSuccessResult("", configValue);
} }
@RequestMapping("/page/next") @RequestMapping("/page/next")
...@@ -54,8 +62,12 @@ public class PlatformApiController implements IBaseController { ...@@ -54,8 +62,12 @@ public class PlatformApiController implements IBaseController {
Boolean isFinal = nextPageTuple.getValue(); Boolean isFinal = nextPageTuple.getValue();
String nextPage = nextPageTuple.getKey(); String nextPage = nextPageTuple.getKey();
if (Constants.PAGE_NEXT_KEY_XYQB.equals(key)) { if (Constants.PAGE_NEXT_KEY_XYQB.equals(key)) {
MerchantConfig merchantConfig = merchantService.findConfigByMerchantIdAndConfigName(4L, "returnUrl"); // MerchantConfig merchantConfig = merchantService.findConfigByMerchantIdAndConfigName(4L, "returnUrl");
return JsonResult.buildSuccessResult("", ImmutableMap.of("type", "external", "transition", merchantConfig.getConfigValue())); if (merchantConfigReturnUrl == null) {
return JsonResult.buildSuccessResult("", null);
}
String configValue = merchantConfigReturnUrl.split(",")[4];
return JsonResult.buildSuccessResult("", ImmutableMap.of("type", "external", "transition", configValue));
} }
if (isFinal) { if (isFinal) {
Merchant merchant = merchantService.findMerchantByName(key); Merchant merchant = merchantService.findMerchantByName(key);
...@@ -63,10 +75,11 @@ public class PlatformApiController implements IBaseController { ...@@ -63,10 +75,11 @@ public class PlatformApiController implements IBaseController {
return JsonResult.buildSuccessResult("", null); return JsonResult.buildSuccessResult("", null);
} }
MerchantConfig merchantConfig = merchantService.findConfigByMerchantIdAndConfigName(merchant.getId(), "returnUrl"); MerchantConfig merchantConfig = merchantService.findConfigByMerchantIdAndConfigName(merchant.getId(), "returnUrl");
if (merchantConfig == null) { if (merchantConfigReturnUrl == null) {
return JsonResult.buildSuccessResult("", null); return JsonResult.buildSuccessResult("", null);
} }
return JsonResult.buildSuccessResult("", ImmutableMap.of("type", "external", "transition", merchantConfig.getConfigValue())); String configValue = merchantConfigReturnUrl.split(",")[merchant.getId().intValue()];
return JsonResult.buildSuccessResult("", ImmutableMap.of("type", "external", "transition", configValue));
} }
if (StringUtils.isBlank(nextPage)) { if (StringUtils.isBlank(nextPage)) {
return JsonResult.buildErrorStateResult("", null); return JsonResult.buildErrorStateResult("", null);
......
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