public String test() {
String methodStr = "CreateProfileForm";
String resultJson = "{\"SplashPage\":{\"PageInfo\":{\"Locale\":\"zh_CN\",\"ReadOnly\":\"false\",\"CurrencyRoundTo\":\"1\",\"ConversationID\":\"OJ1548071788914\",\"UserIP\":\"60.174.206.71\",\"skin\":\"hainan\",\"SessionPageRandom\":\"\",\"LayoutType\":\"\",\"NavSelect\":\"\",\"Language\":\"zh\",\"FromServicing\":\"false\",\"POS\":{\"CompanyCode\":\"\"},\"Currency\":\"CNY\",\"SessionID\":\"CD8BFD11D1AFA6D27375EAF307CB59F5.TVIBEServer4\"},\"CreateSessionForm\":{\"LanguageInput\":{\"name\":\"language\",\"type\":\"list\",\"value\":\"zh\"},\"method\":\"post\",\"RemoveLowPriceCacheQueryInput\":{\"name\":\"removeLowPriceCacheQuery\",\"type\":\"fixed\",\"value\":\"false\"},\"TestModeInput\":{\"name\":\"testMode\",\"type\":\"fixed\",\"value\":\"A\"},\"name\":\"CreateSessionForm\",\"action\":\"/common/homeRedirect.do\",\"RedirectedInput\":{\"name\":\"redirected\",\"type\":\"fixed\",\"value\":\"true\"},\"MarketInput\":{\"name\":\"market\",\"type\":\"list\",\"value\":\"CN\"},\"ChannelInput\":{\"name\":\"channel\",\"type\":\"fixed\",\"value\":\"IBE\"},\"RequestorIDInput\":{\"name\":\"requestorID\",\"Error\":{\"Param\":[{\"_text\":\"Unauthorised RequestorID\"}],\"Validator\":\"Error\"},\"type\":\"fixed\",\"value\":\"IBE\"},\"ShowLowPriceAirLineNumInput\":{\"name\":\"showLowPriceAirLineNum\",\"type\":\"fixed\",\"value\":\"\"}}}}";
// 处理一般错误
if (resultJson.contains("Error")) {
List<String> errorStrList = TribeCheckErrorUtils.checkedError(methodStr, resultJson);
if (errorStrList != null && errorStrList.size() > 0) {
String shortDiscription = "";
for (String str : errorStrList) {
shortDiscription = TribeCheckErrorUtils.getValidator(str);
handleSpecialError(str, shortDiscription);
}
throw new ServiceException("内部服务发生错误", shortDiscription);
}
}
return "test";
}
private void handleSpecialError(String specialErrorMessage, String shortDiscription){
String _text = "";
if (org.apache.commons.lang.StringUtils.equals(shortDiscription, "Error") && org.apache.commons.lang.StringUtils.startsWith(specialErrorMessage, "{")) {
JSONObject parseObject = JSONObject.parseObject(specialErrorMessage);
if (parseObject.containsKey("Param") && parseObject.get("Param") instanceof JSONArray) {
Object object = ((JSONArray) parseObject.get("Param")).get(0);
if (object instanceof JSONObject && ((JSONObject) object).containsKey("_text")) {
_text = ((JSONObject) object).getString("_text");
}
}
}
if(org.apache.commons.lang.StringUtils.isNotEmpty(_text)) {
KieServices kieServices = KieServices.Factory.get();
KieContainer kieContainer = kieServices.getKieClasspathContainer();
KieSession kieSession = kieContainer.newKieSession("spacialerrorSession");
SpecialErrorHandle errorHandle = new SpecialErrorHandle(_text,
"Unauthorised RequestorID",
"您的账户已被禁用,请联系客服进行处理!"
);
kieSession.insert(errorHandle);
kieSession.fireAllRules();
kieSession.dispose();
}
}