|
@@ -39,8 +39,7 @@ import java.util.*;
|
|
|
public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoinpayMch> implements TJoinpayMchService {
|
|
|
@Autowired
|
|
|
PayFeign payFeign;
|
|
|
-// @Autowired
|
|
|
-// TShandeMchMapper shandeMchMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public String createMch(TJoinpayMch mch) {
|
|
|
|
|
@@ -606,6 +605,71 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
return back;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String updateApproveStatus(TJoinpayMch mch) {
|
|
|
+
|
|
|
+ String url = "https://www.joinpay.com/allocFunds";
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(mch.getAltMchNo())){
|
|
|
+ return "找不到商家编号";
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
+ requestData.put("alt_mch_no" , mch.getAltMchNo());
|
|
|
+
|
|
|
+ JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
+ requestJson.put("method", "altMchPics.queryPicsInfo");
|
|
|
+ requestJson.put("version", "1.0");
|
|
|
+ requestJson.put("data", requestData);
|
|
|
+ // 32位随机字符串
|
|
|
+ String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
|
|
|
+ requestJson.put("rand_str", uuid);
|
|
|
+ requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
+ requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
+
|
|
|
+ String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ requestJson.put("sign", sign.toUpperCase());
|
|
|
+// logger.info("请求参数:" + requestJson);
|
|
|
+ String back=null;
|
|
|
+ org.json.JSONObject jsonObject;
|
|
|
+ try {
|
|
|
+ jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
|
|
|
+ System.out.println(jsonObject.getJSONObject("data"));
|
|
|
+
|
|
|
+ // 判断请求是否正确,受理成功
|
|
|
+ if(jsonObject.has("resp_code")){
|
|
|
+ String resp_code = jsonObject.getString("resp_code");
|
|
|
+ mch.setRespCode(resp_code);
|
|
|
+ }else{
|
|
|
+ return "请求失败";
|
|
|
+ }
|
|
|
+ // 处理data
|
|
|
+ if(jsonObject.has("data")){
|
|
|
+ org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
+ String biz_code = data.getString("biz_code");
|
|
|
+ String approve_status = data.getString("approve_status");
|
|
|
+ String approve_note = data.getString("approve_note");
|
|
|
+ if(biz_code.equals("B100000")){
|
|
|
+ if(approve_status.equals("P1000")) {
|
|
|
+ mch.setApproveStatus("审核通过");
|
|
|
+ mch.setApproveNote("");
|
|
|
+ back = approve_status;
|
|
|
+ } else if (approve_status.equals("P2000")){
|
|
|
+ mch.setApproveStatus("审核不通过");
|
|
|
+ mch.setApproveNote(approve_note);
|
|
|
+ back = approve_status;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ updateById(mch);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return back;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取随机字符串
|