Commit bfcf7496 authored by 黎博's avatar 黎博

新增多订单白名单mock

parent 668dd4c2
...@@ -31,6 +31,9 @@ public class RuleEngineInterceptor implements HandlerInterceptor { ...@@ -31,6 +31,9 @@ public class RuleEngineInterceptor implements HandlerInterceptor {
@Value("${early.settle.channel}") @Value("${early.settle.channel}")
private String earlySettleChannel; private String earlySettleChannel;
@Value("${xyqb.isInWhiteList}")
private String xyqbIsInWhiteList;
public Map<String, Object> convertParameterMap(Map<String, String[]> parameterMap) { public Map<String, Object> convertParameterMap(Map<String, String[]> parameterMap) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
for (Map.Entry<String, String[]> entry: parameterMap.entrySet()) { for (Map.Entry<String, String[]> entry: parameterMap.entrySet()) {
...@@ -64,6 +67,22 @@ public class RuleEngineInterceptor implements HandlerInterceptor { ...@@ -64,6 +67,22 @@ public class RuleEngineInterceptor implements HandlerInterceptor {
InterceptorUtils.constructResponse(response, JSON.toJSONString(responseMap), "application/json; charset=utf-8"); InterceptorUtils.constructResponse(response, JSON.toJSONString(responseMap), "application/json; charset=utf-8");
return false; return false;
} }
// 多订单白名单mock
if (uri.equals("/ex/isInWhiteList")) {
Map<String, Object> whiteListResult = new HashMap<>();
if (xyqbIsInWhiteList.equals("true")) {
whiteListResult.put("code", 0);
whiteListResult.put("businessCode", "0000");
whiteListResult.put("msg", "命中");
} else if (xyqbIsInWhiteList.equals("false")) {
whiteListResult.put("code", 0);
whiteListResult.put("businessCode", "0001");
whiteListResult.put("msg", "未命中");
}
whiteListResult.put("body", null);
InterceptorUtils.constructResponse(response, JSON.toJSONString(whiteListResult), "application/json; charset=utf-8");
return false;
}
log.info("{}的mock响应为:{}", uri, mockData); log.info("{}的mock响应为:{}", uri, mockData);
InterceptorUtils.constructResponse(response, mockData, "application/json; charset=utf-8"); InterceptorUtils.constructResponse(response, mockData, "application/json; charset=utf-8");
return false; return false;
......
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