Browse Source

增加申请合约编码

master
xyiege 3 years ago
parent
commit
69fe613f7b
  1. 42
      src/main/java/cn/chjyj/szwh/utils/SzwhApiUtils.java

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

@ -3,6 +3,7 @@ package cn.chjyj.szwh.utils;
import cn.chjyj.szwh.service.impl.UserServiceImpl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import jdk.nashorn.internal.scripts.JO;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -151,16 +152,51 @@ public class SzwhApiUtils {
* distribute 同步订单数据
* @return
*/
public static JSONObject synchInfo(){
public static JSONObject synchInfo(JSONObject postJson){
String entHost= ProperUtils.getSzwhProp("REAL_URL");//委托系统主机
String url=entHost+"/dist/api/v1/synchInfo";
// 使用的token
String sign=SignUtils.createSign("distribute");
System.out.println(sign);
Map hmap = new HashMap();
hmap.put("dist_token",sign);
hmap.put("Content-Type","application/json");
JSONObject json = RequestUtils.postData(url,"",hmap);
JSONObject json = RequestUtils.postData(url,postJson.toString(),hmap);
return json;
}
/**
* 请求申请合约关联编码 接口1.5
* @param goodsIsli
* @param buyIslicode
* @param ratio
* @param date
* @param batchcode
* @return
*/
public static JSONObject getApplyLinkCode(String goodsIsli,String buyIslicode,String ratio,
int count,String date,String batchcode){
//渠道用户
String channelUser=ProperUtils.getSzwhProp("CHANNEL_ISLI");
String tlangHost= ProperUtils.getSzwhProp("TIANLANG_ENTRUST_URL");
String url=tlangHost+"/consignation/v1/applylinkcode";
// 使用的token
String sign=SignUtils.createSign("apply_code");
Map hmap = new HashMap();
hmap.put("cloudhub_token",sign);
hmap.put("Content-Type","application/json");
hmap.put("channel_isli_flag",channelUser);
// 发送参数
Map postMap = new HashMap();
postMap.put("contractISLIFlag",goodsIsli);
postMap.put("buyerISLIFlag",buyIslicode);
postMap.put("shareProportion",ratio);
postMap.put("purchaseQuantity",count);
postMap.put("authorizationDate",date);
// convet to json string
JSONObject postJson = new JSONObject(postMap);
log.info(batchcode+"订单获取合约关联编码请求参数:"+postJson);
JSONObject json = RequestUtils.postData(url,postJson.toString(),hmap);
log.info(batchcode+"订单获取合约关联编码"+json);
return json;
}
}

Loading…
Cancel
Save