|
@ -2,6 +2,7 @@ package com.yihu.jw.base.service.a3service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
|
import com.yihu.jw.entity.util.AesEncryptUtils;
|
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
|
|
@ -37,7 +38,7 @@ public class YlzService {
|
|
|
@Value("${spring.profiles}")
|
|
|
private String springProfiles;
|
|
|
|
|
|
private final String entranceUrl="http://10.90.32.3:22174/cityihealth/base/";
|
|
|
private final String entranceUrl="https://zb.xmtyw.cn/medicine/cityihealth/base";
|
|
|
|
|
|
/**
|
|
|
*药柜预缴金充值--易慧
|
|
@ -137,23 +138,36 @@ public class YlzService {
|
|
|
|
|
|
String url = "http://"+deviceIp+":9000/api/Mi";
|
|
|
String result = httpClientUtil.get(url,params,"UTF-8");
|
|
|
WlyyHttpLogDO logDO = new WlyyHttpLogDO();
|
|
|
logDO.setCode(apiStr);
|
|
|
logDO.setName("药柜医保接口");
|
|
|
logDO.setRequest(url+JSONObject.toJSONString(params));
|
|
|
logDO.setResponse(result);
|
|
|
httpLogDao.save(logDO);
|
|
|
return result;
|
|
|
}else {
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("apiStr", apiStr));
|
|
|
params.add(new BasicNameValuePair("orgCode",orgCode));
|
|
|
params.add(new BasicNameValuePair("apiStr", dataInfo));
|
|
|
|
|
|
String url = entranceUrl+"/common/test/open/deviceYBApi";
|
|
|
String resultStr = httpClientUtil.get(url,params,"UTF-8");
|
|
|
// String resultStr="{\"message\":\"success\",\"status\":200,\"obj\":\"\\\"{\\\\\\\"func\\\\\\\":\\\\\\\"fsi.terminal.readcard\\\\\\\",\\\\\\\"retCode\\\\\\\":\\\\\\\"-4\\\\\\\",\\\\\\\"retMsg\\\\\\\":\\\\\\\"服务器连接失败。\\\\\\\"}\\\"\"}";
|
|
|
JSONObject resultObj = JSONObject.parseObject(resultStr);
|
|
|
if (200==resultObj.getInteger("status")){
|
|
|
return resultObj.getString("obj");
|
|
|
Map map = new HashMap<String, String>();
|
|
|
map.put("apiStr", apiStr);
|
|
|
map.put("orgCode", orgCode);
|
|
|
map.put("dataInfo",dataInfo);
|
|
|
String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
|
|
|
String params = AesEncryptUtils.agEncrypt(content);
|
|
|
|
|
|
String resultStr = httpClientUtil.getBodyRawForm(url,params);
|
|
|
JSONObject resultObject = com.alibaba.fastjson.JSONObject.parseObject(resultStr);
|
|
|
if (resultObject.get("status").equals("200")) {
|
|
|
JSONObject jsonObjectData = JSONObject.parseObject(AesEncryptUtils.agDecrypt(resultObject.get("data").toString()));
|
|
|
logger.info(jsonObjectData.toJSONString());
|
|
|
// String resultStr="{\"message\":\"success\",\"status\":200,\"obj\":\"\\\"{\\\\\\\"func\\\\\\\":\\\\\\\"fsi.terminal.readcard\\\\\\\",\\\\\\\"retCode\\\\\\\":\\\\\\\"-4\\\\\\\",\\\\\\\"retMsg\\\\\\\":\\\\\\\"服务器连接失败。\\\\\\\"}\\\"\"}";
|
|
|
if (200==jsonObjectData.getInteger("status")){
|
|
|
return jsonObjectData.getString("obj");
|
|
|
}else {
|
|
|
throw new Exception(jsonObjectData.getString("message"));
|
|
|
}
|
|
|
}else {
|
|
|
return resultObj.getString("message");
|
|
|
throw new Exception("请求失败");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|