|
@ -1,5 +1,6 @@
|
|
package com.yihu.wlyy.service.service.guahao;
|
|
package com.yihu.wlyy.service.service.guahao;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.wlyy.service.common.http.HttpApiException;
|
|
import com.yihu.wlyy.service.common.http.HttpApiException;
|
|
@ -1154,19 +1155,6 @@ public class GuahaoService {
|
|
* =============================计免预约挂号相关接口==========================================START
|
|
* =============================计免预约挂号相关接口==========================================START
|
|
*/
|
|
*/
|
|
|
|
|
|
/**
|
|
|
|
* 获取儿童信息
|
|
|
|
* @param credential 条形编码
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public String GetChildrenInfo(String credential)throws Exception {
|
|
|
|
String result = "";
|
|
|
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
params.put("BarCode", credential);
|
|
|
|
|
|
|
|
return immPostSecond("GetChildrenInfo","计免预约-获取儿童信息",params);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 计免预约Post接口
|
|
* 计免预约Post接口
|
|
@ -1174,24 +1162,37 @@ public class GuahaoService {
|
|
private String immPostSecond(String api,String content, Map<String,String> params) throws Exception
|
|
private String immPostSecond(String api,String content, Map<String,String> params) throws Exception
|
|
{
|
|
{
|
|
String re = "";
|
|
String re = "";
|
|
|
|
|
|
|
|
|
|
//新增日志
|
|
//新增日志
|
|
String method = "POST";
|
|
String method = "POST";
|
|
Boolean isSuccess = true;
|
|
Boolean isSuccess = true;
|
|
String error = "";
|
|
String error = "";
|
|
|
|
|
|
|
|
|
|
int times = 0;
|
|
int times = 0;
|
|
try {
|
|
try {
|
|
re = ZysoftApi.getSingleton().post("imm/"+api, params, null,openCrypto);
|
|
re = ZysoftApi.getSingleton().post("imm/"+api, params, null,openCrypto);
|
|
|
|
|
|
Map<String,String> map = objectMapper.readValue(re,Map.class);
|
|
|
|
String code = map.get("CODE");
|
|
|
|
|
|
|
|
if(!code.equals("1"))
|
|
|
|
{
|
|
|
|
throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
|
|
|
|
|
|
|
|
|
|
//---结果验证,并保存日志 ---START
|
|
|
|
if (StringUtils.isEmpty(re)) {
|
|
|
|
// 请求失败
|
|
|
|
//保存http日志
|
|
|
|
logService.saveHttpLog(isSuccess,api,content,method,api,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
|
|
throw new Exception(error);
|
|
|
|
} else if (StringUtils.startsWith(re, "System-Error")) {
|
|
|
|
// 调用失败
|
|
|
|
//保存http日志
|
|
|
|
error = re.substring(re.indexOf(":") + 1, re.length());
|
|
|
|
logService.saveHttpLog(isSuccess,api,content,method,api,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
|
|
throw new Exception(error);
|
|
|
|
} else if (StringUtils.startsWith(re, "Error")) {
|
|
|
|
// 调用失败
|
|
|
|
//保存http日志
|
|
|
|
error = re.substring(re.indexOf(":") + 1, re.length());
|
|
|
|
logService.saveHttpLog(isSuccess,api,content,method,api,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
|
|
throw new Exception(error);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//---结果验证,并保存日志 ---END
|
|
|
|
|
|
//保存http日志
|
|
//保存http日志
|
|
logService.saveHttpLog(isSuccess,api,content,method,api, net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
logService.saveHttpLog(isSuccess,api,content,method,api, net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
}
|
|
}
|
|
@ -1202,10 +1203,10 @@ public class GuahaoService {
|
|
ex.printStackTrace(pw);
|
|
ex.printStackTrace(pw);
|
|
error = sw.toString();
|
|
error = sw.toString();
|
|
isSuccess = false;
|
|
isSuccess = false;
|
|
|
|
|
|
|
|
|
|
//保存http日志
|
|
//保存http日志
|
|
logService.saveHttpLog(isSuccess,api,content,method,api,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
logService.saveHttpLog(isSuccess,api,content,method,api,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
|
|
|
|
|
|
|
|
if(ex instanceof ApiException)
|
|
if(ex instanceof ApiException)
|
|
{
|
|
{
|
|
ApiException apiEx = (ApiException) ex;
|
|
ApiException apiEx = (ApiException) ex;
|
|
@ -1215,7 +1216,61 @@ public class GuahaoService {
|
|
throw new HttpApiException(-1,ex.getMessage());
|
|
throw new HttpApiException(-1,ex.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
return re;
|
|
return re;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 计免请求结果验证,并保存日志
|
|
|
|
* @param url
|
|
|
|
* @param content
|
|
|
|
* @param method
|
|
|
|
* @param msgBody
|
|
|
|
* @param res
|
|
|
|
*/
|
|
|
|
private void verificationImmResult(String result,String title,String url,String content,String method,String msgBody,String res) throws Exception{
|
|
|
|
String error = "";
|
|
|
|
Boolean isSuccess = false;
|
|
|
|
if (StringUtils.isEmpty(result)) {
|
|
|
|
// 请求失败
|
|
|
|
//保存http日志
|
|
|
|
error = title;
|
|
|
|
logService.saveHttpLog(isSuccess,url,content,method,null,msgBody,res,error,logService.archiveType);
|
|
|
|
throw new Exception(error);
|
|
|
|
} else if (StringUtils.startsWith(result, "System-Error")) {
|
|
|
|
// 调用失败
|
|
|
|
//保存http日志
|
|
|
|
error = result.substring(result.indexOf(":") + 1, result.length());
|
|
|
|
logService.saveHttpLog(isSuccess,url,content,method,null,msgBody,res,error,logService.archiveType);
|
|
|
|
throw new Exception(error);
|
|
|
|
} else if (StringUtils.startsWith(result, "Error")) {
|
|
|
|
// 调用失败
|
|
|
|
//保存http日志
|
|
|
|
error = result.substring(result.indexOf(":") + 1, result.length());
|
|
|
|
logService.saveHttpLog(isSuccess,url,content,method,null,msgBody,res,error,logService.archiveType);
|
|
|
|
throw new Exception(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取儿童信息
|
|
|
|
* @param credential 条形编码
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public String GetChildrenInfo(String credential)throws Exception {
|
|
|
|
String result = "";
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
params.put("BarCode", credential);
|
|
|
|
result = immPostSecond("GetChildrenInfo","计免预约-获取儿童信息",params);
|
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject data = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
|
|
|
|
|
if(data.containsKey("OK")){
|
|
|
|
result = data.getString("OK");
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|