Browse Source

远程获商品

master
xyiege 4 years ago
parent
commit
f371a5e48a
  1. 3
      conf/szwh.properties
  2. 16
      src/main/java/cn/chjyj/szwh/utils/SzwhApiUtils.java
  3. 15
      src/test/java/cn/chjyj/szwh/ApiTest.java

3
conf/szwh.properties

@ -16,7 +16,8 @@ distribute.pem.pubkey.path=/conf/cert/distribute/public_key.pem
distribute.pem.token=4b4858543056374e564c4f4650533942
# 分发系统地址
ENTRUST_URL = http://10.24.4.14:51317
# ENTRUST_URL = http://10.24.4.14:51317
ENTRUST_URL = http://10.14.1.173:9528
# 交易系统地址
TIANLANG_ENTRUST_URL =http://10.24.4.90:11030
# 用户地址

16
src/main/java/cn/chjyj/szwh/utils/SzwhApiUtils.java

@ -55,4 +55,20 @@ public class SzwhApiUtils {
JSONObject json = RequestUtils.GetData(url,hmap);
return json;
}
/**
* 远程获取产品
* @return
*/
public static JSONObject apiGoods(){
String entHost= ProperUtils.getSzwhProp("ENTRUST_URL");//委托系统主机
String url=entHost+"/consign/exchange/v1/selectEntrustSource/exchange";
// 使用的token
String sign=SignUtils.createSign("entrust");
System.out.println("token :"+sign);
Map hmap = new HashMap();
hmap.put("entrust_token",sign);
JSONObject json = RequestUtils.GetData(url,hmap);
return json;
}
}

15
src/test/java/cn/chjyj/szwh/ApiTest.java

@ -0,0 +1,15 @@
package cn.chjyj.szwh;
import cn.chjyj.szwh.utils.SzwhApiUtils;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class ApiTest {
@Test
public void apigoods(){
JSONObject json = SzwhApiUtils.apiGoods();
System.out.println(json);
}
}
Loading…
Cancel
Save