提交代码

yy_dev
胡锐 1 year ago
parent 92f9167b26
commit b71c6eb311
  1. 26
      cweb/src/main/java/com/cweb/controller/TestController.java
  2. 1
      service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java
  3. 250
      service/src/main/java/com/hfkj/channel/lakala/LaKaLaWalletService.java

@ -8,10 +8,7 @@ import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.hfkj.channel.alipay.utils.AlipayRequest;
import com.hfkj.channel.alipay.utils.AlipayUtils;
import com.hfkj.channel.lakala.LaKaLaLedgerService;
import com.hfkj.channel.lakala.LaKaLaMerService;
import com.hfkj.channel.lakala.LaKaLaTradeSeparateService;
import com.hfkj.channel.lakala.LaKaLaTradeService;
import com.hfkj.channel.lakala.*;
import com.hfkj.channel.lakala.config.LaKaLaConfig;
import com.hfkj.channel.saas.SaasActivityService;
import com.hfkj.channel.saas.SaasMerService;
@ -106,6 +103,9 @@ public class TestController {
@Resource
private LaKaLaLedgerService laKaLaLedgerService;
@Resource
private LaKaLaWalletService laKaLaWalletService;
@RequestMapping(value="/refreshMerStatus",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "refreshMerStatus")
@ -202,6 +202,24 @@ public class TestController {
}
}
@RequestMapping(value="/lklWithdraw",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "lklWithdraw")
public ResponseData lklWithdraw() {
try {
// return ResponseMsgUtil.success(laKaLaWalletService.ewalletBalanceQuery("8221210701101SB", null,null));
// return ResponseMsgUtil.success(laKaLaWalletService.ewalletWithdrawD1("8221210701101SB", new BigDecimal("0.01"),"测试提现功能"));
// return ResponseMsgUtil.success(laKaLaWalletService.ewalletSettleProfile("8221210701101SB", "02","08"));
// return ResponseMsgUtil.success(laKaLaWalletService.ewalletSettleQuery("8221210701101SB"));
return ResponseMsgUtil.success(laKaLaWalletService.activeSettleApply("8221210701101SB"));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/saasGetToken",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "saasGetToken")

@ -10,6 +10,7 @@ import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.config.CommonSysConst;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
/**

@ -0,0 +1,250 @@
package com.hfkj.channel.lakala;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.lakala.config.LaKaLaConfig;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.GenerateUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.config.CommonSysConst;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 拉卡拉钱包
* @author hurui
*/
@Service("laKaLaWalletService")
public class LaKaLaWalletService {
/**
* 商户开通主动结算业务
* @param merCupNo
* @return
*/
public JSONObject activeSettleApply(String merCupNo) {
// 请求参数
Map<String, Object> param = new HashMap<>();
param.put("timestamp", new Date().getTime());
param.put("rnd", GenerateUtil.generateRandomString(18));
param.put("ver", "1.0.0");
param.put("reqId", new Date().getTime());
Map<String, Object> map = new HashMap<>();
map.put("version", "1.0");
map.put("orderNo", System.currentTimeMillis()+"");
map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code());
map.put("merCupNo", merCupNo);
param.put("reqData", map);
// 生成签名
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param)));
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", reqParam.get("Authorization"));
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/mms/openApi/activeSettle/apply", param, heard);
System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization")));
System.out.println("request:" + JSONObject.toJSONString(param));
System.out.println("response:" + responseBody.toJSONString());
if (!responseBody.getString("retCode").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg"));
}
return responseBody.getJSONObject("respData");
}
/**
* 账管家提现D1
* @param merCupNo
* @return
*/
public JSONObject ewalletWithdrawD1(String merCupNo, BigDecimal drawAmt, String remark) {
// 请求参数
Map<String, Object> param = new HashMap<>();
param.put("timestamp", new Date().getTime());
param.put("rnd", GenerateUtil.generateRandomString(18));
param.put("ver", "1.0.0");
param.put("reqId", new Date().getTime());
Map<String, Object> map = new HashMap<>();
map.put("orgNo", CommonSysConst.getSysConfig().getLkl_org_code());
map.put("merchantNo", merCupNo);
map.put("drawAmt", drawAmt);
map.put("notifyUrl", "");
map.put("remark", remark);
param.put("reqData", map);
// 生成签名
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param)));
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", reqParam.get("Authorization"));
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/laep/industry/ewalletWithdrawD1", param, heard);
System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization")));
System.out.println("request:" + JSONObject.toJSONString(param));
System.out.println("response:" + responseBody.toJSONString());
if (!responseBody.getString("retCode").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg"));
}
return responseBody.getJSONObject("respData");
}
/**
* 账管家余额查询
* @param merCupNo 商户号
* @param payNo 账号
* @param payType 账号类型01收款账户02付款账户03分账商户账户04分账接收方账户05充值代付账户06结算代付账户- 未上送则默认为01
* @return
*/
public JSONObject ewalletBalanceQuery(String merCupNo, String payNo, String payType) {
// 请求参数
Map<String, Object> param = new HashMap<>();
param.put("timestamp", new Date().getTime());
param.put("rnd", GenerateUtil.generateRandomString(18));
param.put("ver", "1.0.0");
param.put("reqId", new Date().getTime());
Map<String, Object> map = new HashMap<>();
map.put("orgNo", CommonSysConst.getSysConfig().getLkl_org_code());
map.put("merchantNo", merCupNo);
map.put("payNo", payNo);
map.put("payType", payType);
param.put("reqData", map);
// 生成签名
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param)));
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", reqParam.get("Authorization"));
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/laep/industry/ewalletBalanceQuery", param, heard);
System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization")));
System.out.println("request:" + JSONObject.toJSONString(param));
System.out.println("response:" + responseBody.toJSONString());
if (!responseBody.getString("retCode").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg"));
}
return responseBody.getJSONObject("respData");
}
/**
* 账管家提现结果查询
* @param merCupNo
* @return
*/
public JSONObject ewalletWithdrawQuery(String merCupNo,String merOrderNo) {
// 请求参数
Map<String, Object> param = new HashMap<>();
param.put("timestamp", new Date().getTime());
param.put("rnd", GenerateUtil.generateRandomString(18));
param.put("ver", "1.0.0");
param.put("reqId", new Date().getTime());
Map<String, Object> map = new HashMap<>();
map.put("orgNo", CommonSysConst.getSysConfig().getLkl_org_code());
map.put("merchantNo", merCupNo);
map.put("drawJnl", merOrderNo);
param.put("reqData", map);
// 生成签名
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param)));
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", reqParam.get("Authorization"));
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/laep/industry/ewalletWithdrawQuery", param, heard);
System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization")));
System.out.println("request:" + JSONObject.toJSONString(param));
System.out.println("response:" + responseBody.toJSONString());
if (!responseBody.getString("retCode").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg"));
}
return responseBody.getJSONObject("respData");
}
/**
* 账管家提款模式设置
* @param merCupNo 商户号
* @param settleType 提款模式01主动提款 02自动结算
* @param settleTime 结算时间小时- 默认值06如08:00-09:00到账则传入08
* @return
*/
public JSONObject ewalletSettleProfile(String merCupNo, String settleType, String settleTime) {
// 请求参数
Map<String, Object> param = new HashMap<>();
param.put("timestamp", new Date().getTime());
param.put("rnd", GenerateUtil.generateRandomString(18));
param.put("ver", "1.0.0");
param.put("reqId", new Date().getTime());
Map<String, Object> map = new HashMap<>();
map.put("bmcpNo", CommonSysConst.getSysConfig().getLkl_org_code());
map.put("mercId", merCupNo);
map.put("settleType", settleType);
map.put("settleTime", settleTime);
map.put("notifyUrl", null);
param.put("reqData", map);
// 生成签名
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param)));
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", reqParam.get("Authorization"));
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/laep/industry/ewallet/settleProfile", param, heard);
System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization")));
System.out.println("request:" + JSONObject.toJSONString(param));
System.out.println("response:" + responseBody.toJSONString());
if (!responseBody.getString("retCode").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg"));
}
return responseBody.getJSONObject("respData");
}
/**
* 账管家提款模式查询
* @param merCupNo 商户号
* @return
*/
public JSONObject ewalletSettleQuery(String merCupNo) {
// 请求参数
Map<String, Object> param = new HashMap<>();
param.put("timestamp", new Date().getTime());
param.put("rnd", GenerateUtil.generateRandomString(18));
param.put("ver", "1.0.0");
param.put("reqId", new Date().getTime());
Map<String, Object> map = new HashMap<>();
map.put("bmcpNo", CommonSysConst.getSysConfig().getLkl_org_code());
map.put("mercId", merCupNo);
param.put("reqData", map);
// 生成签名
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(param)));
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", reqParam.get("Authorization"));
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/laep/industry/ewallet/settleQuery", param, heard);
System.out.println("Authorization" + JSONObject.toJSONString(reqParam.get("Authorization")));
System.out.println("request:" + JSONObject.toJSONString(param));
System.out.println("response:" + responseBody.toJSONString());
if (!responseBody.getString("retCode").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg"));
}
return responseBody.getJSONObject("respData");
}
}
Loading…
Cancel
Save