提交代码

yy_dev
胡锐 1 year ago
commit 0ec9c30a9d
  1. 1
      cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 59
      cweb/src/main/java/com/cweb/controller/BsTradeOrderController.java
  3. 39
      service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java

@ -111,6 +111,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/common/*")
.excludePathPatterns("/mer/*")
.excludePathPatterns("/tradeOrder/calculation")
.excludePathPatterns("/tradeOrder/getLkLUnionUserId")
.excludePathPatterns("/login/*")
.excludePathPatterns("/test/*")
.excludePathPatterns("/sms/*")

@ -3,6 +3,7 @@ package com.cweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.channel.lakala.LaKaLaTradeService;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
@ -62,6 +63,15 @@ public class BsTradeOrderController {
@Resource
private BsPayQrCodeService payQrCodeService;
@Resource
private BsMerPlatformNoService platformNoService;
@Resource
private BsMerPlatformTermService platformTermService;
@Resource
private LaKaLaTradeService laKaLaTradeService;
@RequestMapping(value="/calculation",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "计算支付金额")
@ -431,4 +441,53 @@ public class BsTradeOrderController {
}
}
@RequestMapping(value="/getLkLUnionUserId",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取拉卡拉银联用户id")
public ResponseData getLkLUnionUserId(@RequestBody JSONObject body) {
try {
if (body == null
|| StringUtils.isBlank(body.getString("serialNumber"))
|| StringUtils.isBlank(body.getString("userAuthCode"))
|| StringUtils.isBlank(body.getString("appUpIdentifier"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.PASSWORD_ERROR, "");
}
// 查询二维码
BsPayQrCode qrCode = payQrCodeService.getDetailBySN(body.getString("serialNumber"));
if (qrCode == null) {
log.error("BsPayQrCodeController error!","未找到支付码信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到支付码信息");
}
if (qrCode.getStoreId() == null) {
log.error("BsPayQrCodeController error!","支付码未绑定门店");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付码未绑定门店");
}
if (!qrCode.getStatus().equals(PayQrCodeStatusEnum.status1.getNumber())) {
log.error("BsPayQrCodeController error!","支付码已被停用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付码已被停用");
}
// 查询商户号
BsMerPlatformNo platformNo = platformNoService.getPlatformNo(qrCode.getMerId(), PlatformTypeEnum.type1);
if (platformNo == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户号");
}
// 查询终端号
BsMerPlatformTerm merPlatformTerm = platformTermService.getMerPlatformTerm(platformNo.getId(), "WECHAT_PAY");
if (merPlatformTerm == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户终端号");
}
return ResponseMsgUtil.success(laKaLaTradeService.openidQuery(
platformNo.getCupNo(),
merPlatformTerm.getTermNo(),
body.getString("userAuthCode"),
"030304",
null,
body.getString("appUpIdentifier")
));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -212,7 +212,7 @@ public class LaKaLaTradeService {
map.put("term_no", merPlatformTerm.getTermNo());
map.put("out_trade_no", order.getOutTradeNo());
map.put("account_type", order.getPayMode());
map.put("trans_type", "51");
map.put("trans_type", 51);
map.put("total_amount", order.getTradeActualAmount().multiply(new BigDecimal("100")).intValue());
map.put("settle_type", order.getProfitSharingStatus()==true?1:0);
if (StringUtils.isNotBlank(order.getSubject())) {
@ -582,4 +582,41 @@ public class LaKaLaTradeService {
return returnMap;
}
/**
* opendId查询
* @param mercId 商户号
* @param termNo 终端号
* @param authCode 微信付款码 微信付款码 银联二维码付款方返回的临时授权码一次有效
* @param tradeCode 交易码 微信010304 银联030304
* @param subAppid 微信子商户公众号id
* @param appUpIdentifier 银联支付标识,获取银联钱包userId时必传
*/
public Map<String, Object> openidQuery(String mercId,String termNo,String authCode, String tradeCode,String subAppid,String appUpIdentifier) {
Map<String, Object> commonParam = new HashMap<>();
commonParam.put("timestamp", DateUtil.format(new Date(), "yyyyMMddHHmmss"));
commonParam.put("ver", "1.0.0");
commonParam.put("reqId", LaKaLaConfig.makeNonStr());
Map<String, Object> map = new HashMap<>();
map.put("mercId", mercId);
map.put("termNo", termNo);
map.put("authCode", authCode);
map.put("tradeCode", tradeCode);
map.put("subAppid", subAppid);
map.put("appUpIdentifier", appUpIdentifier);
commonParam.put("reqData", map);
Map<String, Object> reqParam = LaKaLaConfig.generateSignParamsV2(JSONObject.parseObject(JSONObject.toJSONString(commonParam)));
System.out.println(JSONObject.toJSONString(commonParam));
// 头部参数
Map<String, Object> heard = new HashMap<>();
heard.put("Authorization", reqParam.get("Authorization"));
// 请求拉卡拉接口
JSONObject responseBody = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLkl_request_url() + "/api/v2/saas/query/wx_openid_query", commonParam, heard);
return responseBody;
}
}

Loading…
Cancel
Save