public Object execStore1(String timestamp,String seqNo,String transNo,String businessType) {
//设置一下时间戳
SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
//给时间戳赋值
timestamp = df2.format(new Date());
seqNo = "4635768786756";
transNo = "234567845678";
businessType = "HOTEL";
//调用UUIDUtils获取一个reqId
String reqString = UUIDUtils.creatUUID();
//这个Map是存的URL参数,请求头Header(sign除外)
Map<String, Object> params = new HashMap<String, Object>();
params.put("requestId", "WAC");
params.put("targetId", "MMS");
params.put("serviceId", "QueryStoreList");
params.put("timestamp", "2020-12-14 17:27:04");
params.put("seqNo", seqNo);
params.put("transNo", transNo);
params.put("businessType", businessType);
//这个是调用签名方法 然后用code接收一下签名串
String code = SignUtil.signToRequestGet(params,"BE266D8CC0","5924e0cfeb5b4214b4e448613e55bcf3");
try {
//获取拼接的参数
String pinjie = SignUtil.signToRequestmap(params);
Request req =Request.create("http://183.63.76.163:9880/operation-service/v1/operation/item/queryStoreList?"+pinjie, METHOD.GET);
Header header = Header.create();
header.set("Content-Type", "application/json; charset=utf-8");
header.set("x-dtyunxi-instanceId", "1260634217255523340");
header.set("x-dtyunxi-reqId", "5924e0cfeb5b4214b4e448613e55bcf3");
header.set("x-dtyunxi-sign", code);
req.setHeader(header);
Response response = Sender.create(req).setTimeout(10000).send();
response.getContent();
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
}
return result;
}
这个是我写的方法,但是他好像是不太可行