|
@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.huifu.bspay.sdk.opps.core.exception.BasePayException;
|
|
import com.huifu.bspay.sdk.opps.core.exception.BasePayException;
|
|
import com.huifu.bspay.sdk.opps.core.utils.DateTools;
|
|
import com.huifu.bspay.sdk.opps.core.utils.DateTools;
|
|
import com.huifu.bspay.sdk.opps.core.utils.OkHttpClientTools;
|
|
import com.huifu.bspay.sdk.opps.core.utils.OkHttpClientTools;
|
|
@@ -705,4 +707,52 @@ public class THuifuMchServiceImpl extends ServiceImpl<THuifuMchMapper, THuifuMch
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String updateConStat(THuifuMchCheck tHuifuMchCheck) throws BasePayException {
|
|
|
|
+ // 请求接口
|
|
|
|
+ String url = "https://api.huifu.com/v2/merchant/basicdata/query";
|
|
|
|
+ // 请求参数:Data
|
|
|
|
+ JSONObject request = new JSONObject();
|
|
|
|
+ request.put("req_seq_id", SequenceTools.getReqSeqId32());
|
|
|
|
+ request.put("req_date", DateTools.getCurrentDateYYYYMMDD());
|
|
|
|
+ request.put("huifu_id", tHuifuMchCheck.getHuifuId());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 签名:sign
|
|
|
|
+ String s = JSON.toJSONString(request);
|
|
|
|
+ String s1 = JSON.toJSONString(JSONObject.parseObject(s, TreeMap.class));
|
|
|
|
+ String sign = HuifuUtils.sign(s1, HuifuConstant.RSA_PRIVATE_KEY);
|
|
|
|
+
|
|
|
|
+ // 公共参数
|
|
|
|
+ System.out.println("请求参数:"+ request);
|
|
|
|
+ JSONObject requestData = new JSONObject();
|
|
|
|
+ requestData.put("sys_id", HuifuConstant.SYS_ID);
|
|
|
|
+ requestData.put("product_id", HuifuConstant.PRODUCT_ID);
|
|
|
|
+ requestData.put("sign", sign);
|
|
|
|
+ requestData.put("data", request);
|
|
|
|
+ System.out.println("请求体:"+ requestData);
|
|
|
|
+
|
|
|
|
+ String success = OkHttpClientTools.httpPost(url, requestData.toString(), HuifuConstant.PRODUCT_ID);
|
|
|
|
+ JSONObject result = JSONObject.parseObject(success);
|
|
|
|
+ log.info("汇付返回参数:{}", result);
|
|
|
|
+ JSONObject data = result.getJSONObject("data");
|
|
|
|
+ String respCode = data.getString("resp_code");
|
|
|
|
+ if(respCode.equals("00000000") || respCode.equals("00000100")) {
|
|
|
|
+ try {
|
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
+ JsonNode rootNode = objectMapper.readTree(success);
|
|
|
|
+ JsonNode agreementInfoList = rootNode.path("data").path("agreement_info_list");
|
|
|
|
+ JsonNode agreementNode = objectMapper.readTree(agreementInfoList.asText()).get(0);
|
|
|
|
+ String conStatValue = agreementNode.path("con_stat").asText();
|
|
|
|
+ System.out.println("con_stat value: " + conStatValue);
|
|
|
|
+ tHuifuMchCheck.setConStat(conStatValue);
|
|
|
|
+ tHuifuMchCheckService.updateById(tHuifuMchCheck);
|
|
|
|
+ return conStatValue;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|