springboot对接上上签(五)-撤销合同

316 阅读1分钟

如何撤销合同

当我们在创建合同,发送合同后,发现合同还未签署,并且发现合同需要改动,那我们就需要把合同撤回,重现创建发送新的合同了,那么如何创建合同呢?

/** 撤销合同 */
public String cancleContract(String contractId) throws IOException {
  String host = serverHost;
  String method = "/contract/cancel/";
  String rtick = RSAUtils.getRtick();
  JSONObject requestBody = new JSONObject();
  requestBody.put("contractId", contractId); // 合同编号
  // 计算参数签名
  String paramsSign =
      RSAUtils.calcRsaSign(
          developerId, privateKey, host, method, rtick, null, requestBody.toJSONString());
  // 签名参数追加为url参数
  String urlParams = String.format(urlSignParams, developerId, rtick, paramsSign);
  String responseBody =
      HttpClientSender.sendHttpPost(host, method, urlParams, requestBody.toJSONString());
  System.out.println(responseBody);

  JSONObject result = JSONObject.parseObject(responseBody);
  return result.getString("errno");
}

这里主要把合同的编号参数传递,就可以将需要撤回的合同撤回了,希望可以帮到大家