Merge branch 'prod' into test
This commit is contained in:
@@ -68,7 +68,7 @@ public class NotifyController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping("/native/pay/{platform}")
|
@RequestMapping("/native/pay/{platform}")
|
||||||
public String pay(@PathVariable String platform, @RequestBody JSONObject json) {
|
public String pay(@PathVariable String platform, @RequestBody JSONObject json) {
|
||||||
if (PayCst.Platform.WECHAT.equalsIgnoreCase(platform)) {
|
if (PayCst.Type.WECHAT.equalsIgnoreCase(platform)) {
|
||||||
// 微信
|
// 微信
|
||||||
WechatNotifyReqDto reqDto = JSONObject.parseObject(json.toJSONString(), WechatNotifyReqDto.class);
|
WechatNotifyReqDto reqDto = JSONObject.parseObject(json.toJSONString(), WechatNotifyReqDto.class);
|
||||||
log.info("【微信支付回调】收到微信支付回调 data: {}", JSONObject.toJSONString(reqDto));
|
log.info("【微信支付回调】收到微信支付回调 data: {}", JSONObject.toJSONString(reqDto));
|
||||||
@@ -80,7 +80,7 @@ public class NotifyController {
|
|||||||
PayNotifyRespDTO respDTO = dataDto.convertToPayNotifyRespDTO();
|
PayNotifyRespDTO respDTO = dataDto.convertToPayNotifyRespDTO();
|
||||||
orderInfoCustomService.payCallBackOrder(respDTO.getMchOrderNo(), respDTO, PayChannelCst.NATIVE, 0);
|
orderInfoCustomService.payCallBackOrder(respDTO.getMchOrderNo(), respDTO, PayChannelCst.NATIVE, 0);
|
||||||
return "success";
|
return "success";
|
||||||
} else if (PayCst.Platform.ALIPAY.equalsIgnoreCase(platform)) {
|
} else if (PayCst.Type.ALIPAY.equalsIgnoreCase(platform)) {
|
||||||
// 支付宝
|
// 支付宝
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ public class NotifyController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping("/native/refund/{platform}")
|
@RequestMapping("/native/refund/{platform}")
|
||||||
public String refund(@PathVariable String platform, @RequestBody JSONObject json) {
|
public String refund(@PathVariable String platform, @RequestBody JSONObject json) {
|
||||||
if (PayCst.Platform.WECHAT.equalsIgnoreCase(platform)) {
|
if (PayCst.Type.WECHAT.equalsIgnoreCase(platform)) {
|
||||||
// 微信
|
// 微信
|
||||||
WechatNotifyReqDto reqDto = JSONObject.parseObject(json.toJSONString(), WechatNotifyReqDto.class);
|
WechatNotifyReqDto reqDto = JSONObject.parseObject(json.toJSONString(), WechatNotifyReqDto.class);
|
||||||
log.info("【微信退款回调】收到微信退款回调 data: {}", JSONObject.toJSONString(reqDto));
|
log.info("【微信退款回调】收到微信退款回调 data: {}", JSONObject.toJSONString(reqDto));
|
||||||
@@ -100,7 +100,7 @@ public class NotifyController {
|
|||||||
log.info("【微信退款回调】解密数据 {}", decrypted);
|
log.info("【微信退款回调】解密数据 {}", decrypted);
|
||||||
|
|
||||||
return "success";
|
return "success";
|
||||||
} else if (PayCst.Platform.ALIPAY.equalsIgnoreCase(platform)) {
|
} else if (PayCst.Type.ALIPAY.equalsIgnoreCase(platform)) {
|
||||||
// 支付宝
|
// 支付宝
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class DistributionPayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序支付
|
* 小程序支付
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ltPayOrder")
|
@PostMapping("/ltPayOrder")
|
||||||
@@ -42,7 +42,7 @@ public class DistributionPayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 运营端小程序余额充值
|
* 运营端小程序余额充值
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
*/
|
*/
|
||||||
@PostMapping("/mchRecharge")
|
@PostMapping("/mchRecharge")
|
||||||
@Debounce(value = "#payParam.userId")
|
@Debounce(value = "#payParam.userId")
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package com.czg.controller.pay;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.URLUtil;
|
import cn.hutool.core.util.URLUtil;
|
||||||
|
import com.czg.PayCst;
|
||||||
import com.czg.annotation.Debounce;
|
import com.czg.annotation.Debounce;
|
||||||
import com.czg.constants.ParamCodeCst;
|
import com.czg.constants.ParamCodeCst;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.market.service.OrderInfoService;
|
import com.czg.market.service.OrderInfoService;
|
||||||
import com.czg.order.dto.CheckOrderPay;
|
import com.czg.order.dto.CheckOrderPay;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
@@ -59,7 +61,7 @@ public class OrderPayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 充值并付款
|
* 充值并付款
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/rechargePayOrder")
|
@PostMapping("/rechargePayOrder")
|
||||||
@@ -99,7 +101,7 @@ public class OrderPayController {
|
|||||||
/**
|
/**
|
||||||
* js支付
|
* js支付
|
||||||
* <p>
|
* <p>
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/jsPay")
|
@PostMapping("/jsPay")
|
||||||
@@ -111,7 +113,7 @@ public class OrderPayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序支付
|
* 小程序支付
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ltPayOrder")
|
@PostMapping("/ltPayOrder")
|
||||||
@@ -167,13 +169,21 @@ public class OrderPayController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* 空订单支付/h5页面支付
|
||||||
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
* checkOrderPay.orderAmount 必填
|
* checkOrderPay.orderAmount 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/shopPayApi/js2Pay")
|
@PostMapping("/shopPayApi/js2Pay")
|
||||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||||
public CzgResult<Map<String, Object>> js2PayOrder(HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
|
public CzgResult<Map<String, Object>> js2PayOrder(HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
|
||||||
|
if ("alipay".equals(payParam.getPayType())) {
|
||||||
|
payParam.setPayType(PayCst.Type.ALIPAY);
|
||||||
|
} else if ("wechatPay".equals(payParam.getPayType())) {
|
||||||
|
payParam.setPayType(PayCst.Type.WECHAT);
|
||||||
|
} else {
|
||||||
|
throw new CzgException(payParam.getPayType() + "支付方式错误");
|
||||||
|
}
|
||||||
return orderPayService.js2PayOrder(ServletUtil.getClientIP(request), payParam);
|
return orderPayService.js2PayOrder(ServletUtil.getClientIP(request), payParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class VipPayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* js支付
|
* js支付
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/jsPayVip")
|
@PostMapping("/jsPayVip")
|
||||||
@@ -66,7 +66,7 @@ public class VipPayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序支付
|
* 小程序支付
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ltPayVip")
|
@PostMapping("/ltPayVip")
|
||||||
@@ -139,6 +139,7 @@ public class VipPayController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 会员退款
|
||||||
* cashRefund 是否是现金退款
|
* cashRefund 是否是现金退款
|
||||||
* 会员退款(先调用 退款前置接口 refundVipBefore)
|
* 会员退款(先调用 退款前置接口 refundVipBefore)
|
||||||
* 最大退款金额为 充值金额 inAmount
|
* 最大退款金额为 充值金额 inAmount
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class UGbOrderController {
|
|||||||
/**
|
/**
|
||||||
* 生成订单
|
* 生成订单
|
||||||
* 小程序支付
|
* 小程序支付
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/exchange")
|
@PostMapping("/exchange")
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class UPointGoodsController {
|
|||||||
/**
|
/**
|
||||||
* 生成订单
|
* 生成订单
|
||||||
* 小程序支付
|
* 小程序支付
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/exchange")
|
@PostMapping("/exchange")
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class UPpOrderController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序支付
|
* 小程序支付
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("/pay")
|
@PostMapping("/pay")
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ public class EntryManagerMqListener {
|
|||||||
channel.basicNack(deliveryTag, false, false);
|
channel.basicNack(deliveryTag, false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Long shopId = Long.valueOf(split[0]);
|
if (split[0]==null) {
|
||||||
if (shopId == null) {
|
|
||||||
channel.basicNack(deliveryTag, false, false);
|
channel.basicNack(deliveryTag, false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Long shopId = Long.valueOf(split[0]);
|
||||||
if (hasMessageId(msg)) {
|
if (hasMessageId(msg)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -81,10 +81,10 @@ public class EntryManagerMqListener {
|
|||||||
EntryManager.uploadParamImage(entry);
|
EntryManager.uploadParamImage(entry);
|
||||||
List<String> platform = new ArrayList<>();
|
List<String> platform = new ArrayList<>();
|
||||||
if (PayCst.EntryStatus.WAIT.equals(entry.getAlipayStatus())) {
|
if (PayCst.EntryStatus.WAIT.equals(entry.getAlipayStatus())) {
|
||||||
platform.add(PayCst.Platform.ALIPAY);
|
platform.add(PayCst.Type.ALIPAY);
|
||||||
}
|
}
|
||||||
if (PayCst.EntryStatus.WAIT.equals(entry.getWechatStatus())) {
|
if (PayCst.EntryStatus.WAIT.equals(entry.getWechatStatus())) {
|
||||||
platform.add(PayCst.Platform.WECHAT);
|
platform.add(PayCst.Type.WECHAT);
|
||||||
}
|
}
|
||||||
EntryRespDto resp = EntryManager.entryMerchant(entry, platform.toArray(new String[0]));
|
EntryRespDto resp = EntryManager.entryMerchant(entry, platform.toArray(new String[0]));
|
||||||
ShopDirectMerchant merchant = new ShopDirectMerchant();
|
ShopDirectMerchant merchant = new ShopDirectMerchant();
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public class RabbitPublisher {
|
|||||||
* @param orderId 订单id
|
* @param orderId 订单id
|
||||||
* @param printOrder 是否打印结算单
|
* @param printOrder 是否打印结算单
|
||||||
*/
|
*/
|
||||||
public void sendOrderPrintMsg(String orderId, boolean printOrder) {
|
public void sendOrderPrintMsg(String orderId, boolean printOrder, String source) {
|
||||||
log.info("开始发送打印mq消息, orderId: {}, printOrder: {}", orderId, printOrder);
|
log.info("开始发送打印mq消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
|
||||||
//厨房票
|
//厨房票
|
||||||
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
|
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
|
||||||
//前台票
|
//前台票
|
||||||
@@ -108,8 +108,9 @@ public class RabbitPublisher {
|
|||||||
* 1,2,sendMarkSms 发送营销短信 shop_id,sms_push_event.id,sendMarkSms
|
* 1,2,sendMarkSms 发送营销短信 shop_id,sms_push_event.id,sendMarkSms
|
||||||
* 1,2,sendWechatTemp 发送微信模版消息 shop_id,ac_push_event.id,sendWechatTemp
|
* 1,2,sendWechatTemp 发送微信模版消息 shop_id,ac_push_event.id,sendWechatTemp
|
||||||
* 1,2,groupBuyYes 发送微信模版消息 shop_id,gb_order.id,groupBuyYes
|
* 1,2,groupBuyYes 发送微信模版消息 shop_id,gb_order.id,groupBuyYes
|
||||||
|
*
|
||||||
* @param param 店铺Id,主键Id
|
* @param param 店铺Id,主键Id
|
||||||
* @param type applySmsTemp,sendMarkSms,sendWechatTemp,groupBuyYes
|
* @param type applySmsTemp,sendMarkSms,sendWechatTemp,groupBuyYes
|
||||||
*/
|
*/
|
||||||
public void sendApplySmsMsg(String param, String type) {
|
public void sendApplySmsMsg(String param, String type) {
|
||||||
sendMsg(RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE, param + "," + type);
|
sendMsg(RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE, param + "," + type);
|
||||||
|
|||||||
@@ -46,18 +46,9 @@ public interface SystemConstants {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 三方支付类型
|
* 小程序APPID
|
||||||
*/
|
*/
|
||||||
class PayType {
|
class PayAppId {
|
||||||
/**
|
|
||||||
* 微信支付
|
|
||||||
*/
|
|
||||||
public static final String WECHAT = "wechatPay";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付宝支付
|
|
||||||
*/
|
|
||||||
public static final String ALIPAY = "alipay";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信小程序支付
|
* 微信小程序支付
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序支付 其它类型
|
* 小程序支付 其它类型
|
||||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
* payType 必填 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
* openId 必填
|
* openId 必填
|
||||||
* @author ww
|
* @author ww
|
||||||
*/
|
*/
|
||||||
@@ -32,7 +32,7 @@ public class LtPayOtherDTO {
|
|||||||
@NotNull(message = "兑换数量不能为空")
|
@NotNull(message = "兑换数量不能为空")
|
||||||
private int number;
|
private int number;
|
||||||
/**
|
/**
|
||||||
* 支付方式 支付方式,aliPay 支付宝,wechatPay 微信
|
* 支付方式,ALIPAY 支付宝,WECHAT 微信
|
||||||
*/
|
*/
|
||||||
private String payType;
|
private String payType;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
package com.czg.order.dto;
|
package com.czg.order.dto;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -26,7 +25,7 @@ public class MkDistributionPayDTO implements Serializable {
|
|||||||
private Long userId;
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
* 支付类型
|
* 支付类型
|
||||||
* {@link com.czg.constants.SystemConstants.PayType}
|
* {@link com.czg.PayCst.Type}
|
||||||
*/
|
*/
|
||||||
private String payType;
|
private String payType;
|
||||||
private String returnUrl;
|
private String returnUrl;
|
||||||
|
|||||||
@@ -80,13 +80,13 @@ public class EntryManager {
|
|||||||
List<Supplier<EntryThirdRespDto>> tasks = new ArrayList<>();
|
List<Supplier<EntryThirdRespDto>> tasks = new ArrayList<>();
|
||||||
|
|
||||||
if (platform == null || platform.length == 0) {
|
if (platform == null || platform.length == 0) {
|
||||||
platform = new String[]{PayCst.Platform.WECHAT, PayCst.Platform.ALIPAY};
|
platform = new String[]{PayCst.Type.WECHAT, PayCst.Type.ALIPAY};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ArrayUtil.contains(platform, PayCst.Platform.WECHAT)) {
|
if (ArrayUtil.contains(platform, PayCst.Type.WECHAT)) {
|
||||||
tasks.add(() -> WechatEntryManager.entryMerchant(null, reqDto));
|
tasks.add(() -> WechatEntryManager.entryMerchant(null, reqDto));
|
||||||
}
|
}
|
||||||
if (ArrayUtil.contains(platform, PayCst.Platform.ALIPAY)) {
|
if (ArrayUtil.contains(platform, PayCst.Type.ALIPAY)) {
|
||||||
tasks.add(() -> AlipayIsvEntryManager.entryMerchant(null, reqDto));
|
tasks.add(() -> AlipayIsvEntryManager.entryMerchant(null, reqDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,11 +102,11 @@ public class EntryManager {
|
|||||||
for (AsyncTaskExecutor.TaskResult<EntryThirdRespDto> result : results) {
|
for (AsyncTaskExecutor.TaskResult<EntryThirdRespDto> result : results) {
|
||||||
// 合并两个进件结果
|
// 合并两个进件结果
|
||||||
EntryThirdRespDto respDto = result.result();
|
EntryThirdRespDto respDto = result.result();
|
||||||
if (PayCst.Platform.WECHAT.equals(respDto.getPlatform())) {
|
if (PayCst.Type.WECHAT.equals(respDto.getPlatform())) {
|
||||||
entryRespDto.setWechatApplyId(respDto.getEntryId());
|
entryRespDto.setWechatApplyId(respDto.getEntryId());
|
||||||
entryRespDto.setWechatStatus(respDto.getStatus());
|
entryRespDto.setWechatStatus(respDto.getStatus());
|
||||||
entryRespDto.setWechatErrorMsg(respDto.getErrorMsg());
|
entryRespDto.setWechatErrorMsg(respDto.getErrorMsg());
|
||||||
} else if (PayCst.Platform.ALIPAY.equals(respDto.getPlatform())) {
|
} else if (PayCst.Type.ALIPAY.equals(respDto.getPlatform())) {
|
||||||
entryRespDto.setAlipayOrderId(respDto.getEntryId());
|
entryRespDto.setAlipayOrderId(respDto.getEntryId());
|
||||||
entryRespDto.setAlipayStatus(respDto.getStatus());
|
entryRespDto.setAlipayStatus(respDto.getStatus());
|
||||||
entryRespDto.setAlipayErrorMsg(respDto.getErrorMsg());
|
entryRespDto.setAlipayErrorMsg(respDto.getErrorMsg());
|
||||||
@@ -384,9 +384,9 @@ public class EntryManager {
|
|||||||
// verifyEntryParam(merchantDto);
|
// verifyEntryParam(merchantDto);
|
||||||
// uploadParamImage(merchantDto);
|
// uploadParamImage(merchantDto);
|
||||||
//// System.out.println(merchantDto);
|
//// System.out.println(merchantDto);
|
||||||
EntryRespDto respDto = entryMerchant(merchantDto, PayCst.Platform.WECHAT);
|
EntryRespDto respDto = entryMerchant(merchantDto, PayCst.Type.WECHAT);
|
||||||
// entryMerchant(merchantDto, PayCst.Platform.ALIPAY);
|
// entryMerchant(merchantDto, PayCst.Type.ALIPAY);
|
||||||
// entryMerchant(merchantDto, PayCst.Platform.WECHAT, PayCst.Platform.ALIPAY);
|
// entryMerchant(merchantDto, PayCst.Type.WECHAT, PayCst.Type.ALIPAY);
|
||||||
System.out.println(respDto);
|
System.out.println(respDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,15 +21,16 @@ public interface PayCst {
|
|||||||
String ALIPAY_ERROR_MSG_KEY = "message";
|
String ALIPAY_ERROR_MSG_KEY = "message";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 平台
|
* 支付类型
|
||||||
*/
|
*/
|
||||||
class Platform {
|
class Type {
|
||||||
/**
|
/**
|
||||||
* 微信
|
* 微信支付
|
||||||
*/
|
*/
|
||||||
public static final String WECHAT = "WECHAT";
|
public static final String WECHAT = "WECHAT";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付宝
|
* 支付宝支付
|
||||||
*/
|
*/
|
||||||
public static final String ALIPAY = "ALIPAY";
|
public static final String ALIPAY = "ALIPAY";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.czg;
|
package com.czg;
|
||||||
|
|
||||||
import com.czg.constants.SystemConstants;
|
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.pay.*;
|
import com.czg.pay.*;
|
||||||
import com.czg.third.alipay.AlipayIsvPayManager;
|
import com.czg.third.alipay.AlipayIsvPayManager;
|
||||||
@@ -21,9 +20,9 @@ public class PayManager {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> jsapiPay(CzgPayBaseReq paramsDto, NativeMerchantDTO merchantDTO) {
|
public static Map<String, Object> jsapiPay(CzgPayBaseReq paramsDto, NativeMerchantDTO merchantDTO) {
|
||||||
if (SystemConstants.PayType.WECHAT.equals(paramsDto.getPayType())) {
|
if (PayCst.Type.WECHAT.equals(paramsDto.getPayType())) {
|
||||||
return WechatPayManager.jsapiPay(null, paramsDto, merchantDTO);
|
return WechatPayManager.jsapiPay(null, paramsDto, merchantDTO);
|
||||||
} else if (SystemConstants.PayType.ALIPAY.equals(paramsDto.getPayType())) {
|
} else if (PayCst.Type.ALIPAY.equals(paramsDto.getPayType())) {
|
||||||
return AlipayIsvPayManager.jsapiPay(null, paramsDto, merchantDTO);
|
return AlipayIsvPayManager.jsapiPay(null, paramsDto, merchantDTO);
|
||||||
} else {
|
} else {
|
||||||
throw new CzgException("不支持的支付平台");
|
throw new CzgException("不支持的支付平台");
|
||||||
@@ -37,9 +36,9 @@ public class PayManager {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> barPay(CzgPayBaseReq paramsDto, NativeMerchantDTO merchantDTO) {
|
public static Map<String, Object> barPay(CzgPayBaseReq paramsDto, NativeMerchantDTO merchantDTO) {
|
||||||
if (SystemConstants.PayType.WECHAT.equals(paramsDto.getPayType())) {
|
if (PayCst.Type.WECHAT.equals(paramsDto.getPayType())) {
|
||||||
return WechatPayManager.barPay(null, paramsDto, merchantDTO);
|
return WechatPayManager.barPay(null, paramsDto, merchantDTO);
|
||||||
} else if (SystemConstants.PayType.ALIPAY.equals(paramsDto.getPayType())) {
|
} else if (PayCst.Type.ALIPAY.equals(paramsDto.getPayType())) {
|
||||||
return AlipayIsvPayManager.barPay(null, paramsDto, merchantDTO);
|
return AlipayIsvPayManager.barPay(null, paramsDto, merchantDTO);
|
||||||
} else {
|
} else {
|
||||||
throw new CzgException("不支持的支付平台");
|
throw new CzgException("不支持的支付平台");
|
||||||
@@ -50,9 +49,9 @@ public class PayManager {
|
|||||||
* 查询订单状态
|
* 查询订单状态
|
||||||
*/
|
*/
|
||||||
public static QueryOrderRespDTO queryOrderStatus(String platform, String orderNo, NativeMerchantDTO merchantDTO) {
|
public static QueryOrderRespDTO queryOrderStatus(String platform, String orderNo, NativeMerchantDTO merchantDTO) {
|
||||||
if (SystemConstants.PayType.WECHAT.equals(platform)) {
|
if (PayCst.Type.WECHAT.equals(platform)) {
|
||||||
return WechatPayManager.queryOrder(null, orderNo, merchantDTO);
|
return WechatPayManager.queryOrder(null, orderNo, merchantDTO);
|
||||||
} else if (SystemConstants.PayType.ALIPAY.equals(platform)) {
|
} else if (PayCst.Type.ALIPAY.equals(platform)) {
|
||||||
return AlipayIsvPayManager.queryOrder(null, orderNo, merchantDTO);
|
return AlipayIsvPayManager.queryOrder(null, orderNo, merchantDTO);
|
||||||
} else {
|
} else {
|
||||||
throw new CzgException("不支持的支付平台");
|
throw new CzgException("不支持的支付平台");
|
||||||
@@ -63,9 +62,9 @@ public class PayManager {
|
|||||||
* 退款
|
* 退款
|
||||||
*/
|
*/
|
||||||
public static RefundRespDTO refund(CzgRefundReq paramsDto, String notifyUrl, NativeMerchantDTO merchantDTO) {
|
public static RefundRespDTO refund(CzgRefundReq paramsDto, String notifyUrl, NativeMerchantDTO merchantDTO) {
|
||||||
if (PayCst.Platform.WECHAT.equals(paramsDto.getPlatform())) {
|
if (PayCst.Type.WECHAT.equals(paramsDto.getPlatform())) {
|
||||||
return WechatPayManager.refundOrder(null, paramsDto, notifyUrl, merchantDTO);
|
return WechatPayManager.refundOrder(null, paramsDto, notifyUrl, merchantDTO);
|
||||||
} else if (PayCst.Platform.ALIPAY.equals(paramsDto.getPlatform())) {
|
} else if (PayCst.Type.ALIPAY.equals(paramsDto.getPlatform())) {
|
||||||
return AlipayIsvPayManager.refundOrder(null, paramsDto, notifyUrl, merchantDTO);
|
return AlipayIsvPayManager.refundOrder(null, paramsDto, notifyUrl, merchantDTO);
|
||||||
} else {
|
} else {
|
||||||
throw new CzgException("不支持的支付平台");
|
throw new CzgException("不支持的支付平台");
|
||||||
|
|||||||
@@ -106,9 +106,9 @@ public class PayParamsDto {
|
|||||||
AssertUtil.isBlank(appId, "appId不能为空");
|
AssertUtil.isBlank(appId, "appId不能为空");
|
||||||
AssertUtil.isBlank(openId, "用户唯一标识不能为空");
|
AssertUtil.isBlank(openId, "用户唯一标识不能为空");
|
||||||
|
|
||||||
if (PayCst.Platform.WECHAT.equals(platform)) {
|
if (PayCst.Type.WECHAT.equals(platform)) {
|
||||||
AssertUtil.isBlank(merchantId, "商户ID不能为空");
|
AssertUtil.isBlank(merchantId, "商户ID不能为空");
|
||||||
} else if (PayCst.Platform.ALIPAY.equals(platform)) {
|
} else if (PayCst.Type.ALIPAY.equals(platform)) {
|
||||||
AssertUtil.isBlank(payParams, "支付参数不能为空");
|
AssertUtil.isBlank(payParams, "支付参数不能为空");
|
||||||
alipayAuthInfo = JSONObject.parseObject(payParams, AlipayAuthInfoDto.class);
|
alipayAuthInfo = JSONObject.parseObject(payParams, AlipayAuthInfoDto.class);
|
||||||
AssertUtil.isNull(alipayAuthInfo, "支付参数错误");
|
AssertUtil.isNull(alipayAuthInfo, "支付参数错误");
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class WechatPayNotifyDataDto {
|
|||||||
.setMchOrderNo(outTradeNo)
|
.setMchOrderNo(outTradeNo)
|
||||||
.setThirdOrderNo(transactionId)
|
.setThirdOrderNo(transactionId)
|
||||||
.setAmount(getPayAmount())
|
.setAmount(getPayAmount())
|
||||||
.setPlatform(PayCst.Platform.WECHAT)
|
.setPlatform(PayCst.Type.WECHAT)
|
||||||
.setExtData(attach)
|
.setExtData(attach)
|
||||||
.setPaySuccessTime(time)
|
.setPaySuccessTime(time)
|
||||||
.setErrorMsg(tradeStateDesc);
|
.setErrorMsg(tradeStateDesc);
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import com.czg.dto.resp.EntryThirdRespDto;
|
|||||||
import com.czg.dto.resp.QueryStatusResp;
|
import com.czg.dto.resp.QueryStatusResp;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.third.alipay.dto.config.AlipayConfigDto;
|
import com.czg.third.alipay.dto.config.AlipayConfigDto;
|
||||||
import com.czg.third.wechat.dto.resp.WechatQueryStateResp;
|
|
||||||
import com.czg.utils.UploadFileUtil;
|
import com.czg.utils.UploadFileUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@@ -60,7 +59,7 @@ public class AlipayEntryManager {
|
|||||||
*/
|
*/
|
||||||
public static QueryStatusResp queryMerchantEntryStatus(AlipayConfigDto configDto, String merchantCode) {
|
public static QueryStatusResp queryMerchantEntryStatus(AlipayConfigDto configDto, String merchantCode) {
|
||||||
QueryStatusResp queryStatusResp = new QueryStatusResp();
|
QueryStatusResp queryStatusResp = new QueryStatusResp();
|
||||||
queryStatusResp.setPlatform(PayCst.Platform.ALIPAY);
|
queryStatusResp.setPlatform(PayCst.Type.ALIPAY);
|
||||||
queryStatusResp.setMerchantCode(merchantCode);
|
queryStatusResp.setMerchantCode(merchantCode);
|
||||||
|
|
||||||
AntMerchantExpandIndirectZftorderQueryRequest request = new AntMerchantExpandIndirectZftorderQueryRequest();
|
AntMerchantExpandIndirectZftorderQueryRequest request = new AntMerchantExpandIndirectZftorderQueryRequest();
|
||||||
@@ -158,7 +157,7 @@ public class AlipayEntryManager {
|
|||||||
public static EntryThirdRespDto entryMerchant(AlipayConfigDto configDto, AggregateMerchantDto reqDto) {
|
public static EntryThirdRespDto entryMerchant(AlipayConfigDto configDto, AggregateMerchantDto reqDto) {
|
||||||
AntMerchantExpandIndirectZftCreateModel entryReqDto = buildEntryParams(reqDto);
|
AntMerchantExpandIndirectZftCreateModel entryReqDto = buildEntryParams(reqDto);
|
||||||
EntryThirdRespDto respDto = new EntryThirdRespDto()
|
EntryThirdRespDto respDto = new EntryThirdRespDto()
|
||||||
.setPlatform(PayCst.Platform.ALIPAY);
|
.setPlatform(PayCst.Type.ALIPAY);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AntMerchantExpandIndirectZftCreateRequest request = new AntMerchantExpandIndirectZftCreateRequest();
|
AntMerchantExpandIndirectZftCreateRequest request = new AntMerchantExpandIndirectZftCreateRequest();
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class AlipayIsvEntryManager {
|
|||||||
configDto = AlipayConfigDto.getThirdDefaultConfig();
|
configDto = AlipayConfigDto.getThirdDefaultConfig();
|
||||||
}
|
}
|
||||||
QueryStatusResp respDto = new QueryStatusResp()
|
QueryStatusResp respDto = new QueryStatusResp()
|
||||||
.setPlatform(PayCst.Platform.ALIPAY);
|
.setPlatform(PayCst.Type.ALIPAY);
|
||||||
AlipayClient.setApiClient(configDto);
|
AlipayClient.setApiClient(configDto);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -104,7 +104,7 @@ public class AlipayIsvEntryManager {
|
|||||||
}
|
}
|
||||||
AlipayClient.setApiClient(configDto);
|
AlipayClient.setApiClient(configDto);
|
||||||
EntryThirdRespDto respDto = new EntryThirdRespDto()
|
EntryThirdRespDto respDto = new EntryThirdRespDto()
|
||||||
.setPlatform(PayCst.Platform.ALIPAY);
|
.setPlatform(PayCst.Type.ALIPAY);
|
||||||
try {
|
try {
|
||||||
String batchNo = createRequest(configDto, reqDto);
|
String batchNo = createRequest(configDto, reqDto);
|
||||||
respDto.setEntryId(batchNo);
|
respDto.setEntryId(batchNo);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class AlipayIsvPayManager {
|
|||||||
model.setTotalAmount(getYuanAmountByFen(paramsDto.getAmount()));
|
model.setTotalAmount(getYuanAmountByFen(paramsDto.getAmount()));
|
||||||
model.setSubject(paramsDto.getSubject());
|
model.setSubject(paramsDto.getSubject());
|
||||||
model.setBody(paramsDto.getBody());
|
model.setBody(paramsDto.getBody());
|
||||||
model.setNotifyUrl(paramsDto.getNotifyUrl() + "/" + PayCst.Platform.ALIPAY);
|
model.setNotifyUrl(paramsDto.getNotifyUrl() + "/" + PayCst.Type.ALIPAY);
|
||||||
|
|
||||||
model.setExtendParams(new ExtendParams());
|
model.setExtendParams(new ExtendParams());
|
||||||
CustomizedParams customizedParams = new CustomizedParams();
|
CustomizedParams customizedParams = new CustomizedParams();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.czg.third.wechat;
|
package com.czg.third.wechat;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.alibaba.fastjson2.JSONWriter;
|
import com.alibaba.fastjson2.JSONWriter;
|
||||||
import com.czg.PayCst;
|
import com.czg.PayCst;
|
||||||
@@ -15,7 +14,10 @@ import com.czg.third.wechat.dto.req.entry.*;
|
|||||||
import com.czg.third.wechat.dto.req.entry.business.WechatEntryBusinessReqDto;
|
import com.czg.third.wechat.dto.req.entry.business.WechatEntryBusinessReqDto;
|
||||||
import com.czg.third.wechat.dto.req.entry.business.WechatEntryIdentityReqDto;
|
import com.czg.third.wechat.dto.req.entry.business.WechatEntryIdentityReqDto;
|
||||||
import com.czg.third.wechat.dto.req.entry.business.WechatEntryLicenseReqDto;
|
import com.czg.third.wechat.dto.req.entry.business.WechatEntryLicenseReqDto;
|
||||||
import com.czg.third.wechat.dto.req.entry.business.sales.*;
|
import com.czg.third.wechat.dto.req.entry.business.sales.WechatEntryMiniProgramReqDto;
|
||||||
|
import com.czg.third.wechat.dto.req.entry.business.sales.WechatEntrySalesInfoReqDto;
|
||||||
|
import com.czg.third.wechat.dto.req.entry.business.sales.WechatEntryStoreInfoReqDto;
|
||||||
|
import com.czg.third.wechat.dto.req.entry.business.sales.WechatEntryWebInfoReqDto;
|
||||||
import com.czg.third.wechat.dto.req.entry.id.WechatEntryIdCardReqDto;
|
import com.czg.third.wechat.dto.req.entry.id.WechatEntryIdCardReqDto;
|
||||||
import com.czg.third.wechat.dto.resp.WechatAuditDetail;
|
import com.czg.third.wechat.dto.resp.WechatAuditDetail;
|
||||||
import com.czg.third.wechat.dto.resp.WechatQueryStateResp;
|
import com.czg.third.wechat.dto.resp.WechatQueryStateResp;
|
||||||
@@ -50,7 +52,7 @@ public class WechatEntryManager {
|
|||||||
*/
|
*/
|
||||||
public static QueryStatusResp queryMerchantEntryStatus(WechatPayConfigDto configDto, String applyId) {
|
public static QueryStatusResp queryMerchantEntryStatus(WechatPayConfigDto configDto, String applyId) {
|
||||||
QueryStatusResp queryStatusResp = new QueryStatusResp();
|
QueryStatusResp queryStatusResp = new QueryStatusResp();
|
||||||
queryStatusResp.setPlatform(PayCst.Platform.WECHAT);
|
queryStatusResp.setPlatform(PayCst.Type.WECHAT);
|
||||||
queryStatusResp.setMerchantCode(applyId);
|
queryStatusResp.setMerchantCode(applyId);
|
||||||
|
|
||||||
String resp = WechatReqUtils.getReq(configDto, "/v3/applyment4sub/applyment/applyment_id/" + applyId, Map.of());
|
String resp = WechatReqUtils.getReq(configDto, "/v3/applyment4sub/applyment/applyment_id/" + applyId, Map.of());
|
||||||
@@ -109,7 +111,7 @@ public class WechatEntryManager {
|
|||||||
*/
|
*/
|
||||||
public static EntryThirdRespDto entryMerchant(WechatPayConfigDto configDto, AggregateMerchantDto reqDto) {
|
public static EntryThirdRespDto entryMerchant(WechatPayConfigDto configDto, AggregateMerchantDto reqDto) {
|
||||||
EntryThirdRespDto respDto = new EntryThirdRespDto()
|
EntryThirdRespDto respDto = new EntryThirdRespDto()
|
||||||
.setPlatform(PayCst.Platform.WECHAT);
|
.setPlatform(PayCst.Type.WECHAT);
|
||||||
try {
|
try {
|
||||||
WechatEntryReqDto entryReqDto = buildEntryParams(configDto, reqDto);
|
WechatEntryReqDto entryReqDto = buildEntryParams(configDto, reqDto);
|
||||||
log.info("微信进件参数:{}", JSONObject.toJSONString(entryReqDto));
|
log.info("微信进件参数:{}", JSONObject.toJSONString(entryReqDto));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class WechatPayManager {
|
|||||||
reqData.put("sub_mchid", merchantDTO.getWechatMerchantId());
|
reqData.put("sub_mchid", merchantDTO.getWechatMerchantId());
|
||||||
reqData.put("description", paramsDto.getSubject());
|
reqData.put("description", paramsDto.getSubject());
|
||||||
reqData.put("out_trade_no", paramsDto.getMchOrderNo());
|
reqData.put("out_trade_no", paramsDto.getMchOrderNo());
|
||||||
reqData.put("notify_url", paramsDto.getNotifyUrl() + "/" + PayCst.Platform.WECHAT);
|
reqData.put("notify_url", paramsDto.getNotifyUrl() + "/" + PayCst.Type.WECHAT);
|
||||||
reqData.put("attach", paramsDto.getExtParam());
|
reqData.put("attach", paramsDto.getExtParam());
|
||||||
|
|
||||||
JSONObject amount = new JSONObject();
|
JSONObject amount = new JSONObject();
|
||||||
@@ -267,7 +267,7 @@ public class WechatPayManager {
|
|||||||
refundParam.put("out_trade_no", paramsDto.getMchOrderNo());
|
refundParam.put("out_trade_no", paramsDto.getMchOrderNo());
|
||||||
refundParam.put("out_refund_no", paramsDto.getMchRefundNo());
|
refundParam.put("out_refund_no", paramsDto.getMchRefundNo());
|
||||||
refundParam.put("reason", paramsDto.getRefundReason());
|
refundParam.put("reason", paramsDto.getRefundReason());
|
||||||
refundParam.put("notify_url", notifyUrl + "/" + PayCst.Platform.WECHAT);
|
refundParam.put("notify_url", notifyUrl + "/" + PayCst.Type.WECHAT);
|
||||||
|
|
||||||
JSONObject amount = new JSONObject();
|
JSONObject amount = new JSONObject();
|
||||||
amount.put("total", paramsDto.getOrderTotalAmount());
|
amount.put("total", paramsDto.getOrderTotalAmount());
|
||||||
@@ -291,7 +291,7 @@ public class WechatPayManager {
|
|||||||
.setThirdRefundNo(object.getString("refund_id"))
|
.setThirdRefundNo(object.getString("refund_id"))
|
||||||
.setRefundTime(object.getString("success_time"))
|
.setRefundTime(object.getString("success_time"))
|
||||||
.setOriginalData(resp)
|
.setOriginalData(resp)
|
||||||
.setPlatform(PayCst.Platform.WECHAT);
|
.setPlatform(PayCst.Type.WECHAT);
|
||||||
|
|
||||||
JSONObject resAmount = object.getJSONObject("amount");
|
JSONObject resAmount = object.getJSONObject("amount");
|
||||||
if (resAmount != null) {
|
if (resAmount != null) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.constants.ParamCodeCst;
|
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
import com.ijpay.core.IJPayHttpResponse;
|
import com.ijpay.core.IJPayHttpResponse;
|
||||||
@@ -35,7 +34,6 @@ import java.security.cert.X509Certificate;
|
|||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付相关
|
* 微信支付相关
|
||||||
@@ -139,12 +137,13 @@ public abstract class BaseWx {
|
|||||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||||
String prepayId = jsonObject.getString("prepay_id");
|
String prepayId = jsonObject.getString("prepay_id");
|
||||||
if (StrUtil.isBlank(prepayId)) {
|
if (StrUtil.isBlank(prepayId)) {
|
||||||
throw new RuntimeException(jsonObject.getString("message"));
|
throw new CzgException(jsonObject.getString("message"));
|
||||||
}
|
}
|
||||||
return WxPayKit.jsApiCreateSign(config.appId, prepayId, config.privateKey);
|
return WxPayKit.jsApiCreateSign(config.appId, prepayId, config.privateKey);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
log.error("微信V3原生支付失败", e);
|
||||||
|
throw new CzgException("暂无法支付,请联系管理员");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.czg.service.order.service.impl;
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.czg.PayCst;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
import com.czg.account.entity.UserInfo;
|
import com.czg.account.entity.UserInfo;
|
||||||
import com.czg.account.service.ShopUserService;
|
import com.czg.account.service.ShopUserService;
|
||||||
import com.czg.account.service.UserInfoService;
|
import com.czg.account.service.UserInfoService;
|
||||||
import com.czg.constant.TableValueConstant;
|
import com.czg.constant.TableValueConstant;
|
||||||
import com.czg.constants.PayTypeConstants;
|
import com.czg.constants.PayTypeConstants;
|
||||||
import com.czg.constants.SystemConstants;
|
|
||||||
import com.czg.enums.CzgPayEnum;
|
import com.czg.enums.CzgPayEnum;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.market.service.MkDistributionConfigService;
|
import com.czg.market.service.MkDistributionConfigService;
|
||||||
@@ -83,7 +83,7 @@ public class DistributionPayServiceImpl implements DistributionPayService {
|
|||||||
} else {
|
} else {
|
||||||
UserInfo userInfo = userInfoService.getById(userId);
|
UserInfo userInfo = userInfoService.getById(userId);
|
||||||
initInfo.setPayment(orderPayment).setShopUser(shopUserInfo)
|
initInfo.setPayment(orderPayment).setShopUser(shopUserInfo)
|
||||||
.setOpenId(SystemConstants.PayType.ALIPAY.equals(payParam.getPayType()) ? userInfo.getAlipayOpenId() : userInfo.getWechatOpenId());
|
.setOpenId(PayCst.Type.ALIPAY.equals(payParam.getPayType()) ? userInfo.getAlipayOpenId() : userInfo.getWechatOpenId());
|
||||||
}
|
}
|
||||||
return initInfo;
|
return initInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
//发送打票信息 后付费推送多次 需要处理
|
//发送打票信息 后付费推送多次 需要处理
|
||||||
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
||||||
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
||||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0", false);
|
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0", false, "后付费打印");
|
||||||
} else {
|
} else {
|
||||||
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
|
||||||
}
|
}
|
||||||
@@ -1182,6 +1182,10 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void upOrderInfo(OrderInfo orderInfo, BigDecimal payAmount, LocalDateTime payTime, Long payOrderId, PayEnums payType) {
|
public void upOrderInfo(OrderInfo orderInfo, BigDecimal payAmount, LocalDateTime payTime, Long payOrderId, PayEnums payType) {
|
||||||
|
if (orderInfo.getStatus().equals(OrderStatusEnums.DONE.getCode())) {
|
||||||
|
log.info("订单{}已完成,不再更新", orderInfo.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
OrderInfo upOrderInfo = new OrderInfo()
|
OrderInfo upOrderInfo = new OrderInfo()
|
||||||
.setId(orderInfo.getId())
|
.setId(orderInfo.getId())
|
||||||
.setPayAmount(payAmount)
|
.setPayAmount(payAmount)
|
||||||
@@ -1223,16 +1227,20 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
if (StrUtil.isNotBlank(orderInfo.getTableCode())) {
|
if (StrUtil.isNotBlank(orderInfo.getTableCode())) {
|
||||||
ThreadUtil.execAsync(() -> exTable(orderInfo));
|
ThreadUtil.execAsync(() -> exTable(orderInfo));
|
||||||
}
|
}
|
||||||
// 事务成功提交后执行消息发送
|
if (payType != PayEnums.BACK_SCAN) {
|
||||||
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
// 事务成功提交后执行消息发送
|
||||||
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint);
|
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
||||||
|
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "事务环境打印");
|
||||||
|
}
|
||||||
// log.info("订单{}事务提交后,发送打印消息", orderId);
|
// log.info("订单{}事务提交后,发送打印消息", orderId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 非事务环境下直接发送(兼容无事务场景)
|
if (payType != PayEnums.BACK_SCAN) {
|
||||||
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
// 非事务环境下直接发送(兼容无事务场景)
|
||||||
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint);
|
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
|
||||||
|
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "非事务环境打印");
|
||||||
|
}
|
||||||
// log.info("非事务环境下,直接发送订单{}打印消息", orderId);
|
// log.info("非事务环境下,直接发送订单{}打印消息", orderId);
|
||||||
}
|
}
|
||||||
rabbitPublisher.sendOrderDetailStatusMsg(orderInfo.getShopId().toString(), "bc");
|
rabbitPublisher.sendOrderDetailStatusMsg(orderInfo.getShopId().toString(), "bc");
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package com.czg.service.order.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import cn.hutool.crypto.digest.MD5;
|
import cn.hutool.crypto.digest.MD5;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.PayCst;
|
||||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
@@ -113,7 +115,8 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
//发送打票信息
|
//发送打票信息
|
||||||
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
|
||||||
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
|
||||||
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1", orderInfo.getIsPrint() == 1);
|
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
|
||||||
|
orderInfo.getIsPrint() == 1, "0元付款");
|
||||||
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||||
throw new PaySuccessException("支付成功");
|
throw new PaySuccessException("支付成功");
|
||||||
}
|
}
|
||||||
@@ -240,7 +243,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
CzgPayBaseReq.ltPayReq(
|
CzgPayBaseReq.ltPayReq(
|
||||||
payOrderNo, "充值并支付",
|
payOrderNo, "充值并支付",
|
||||||
rechargeDetail.getAmount().multiply(PayService.MONEY_RATE).longValue(), payParam.getPayType(),
|
rechargeDetail.getAmount().multiply(PayService.MONEY_RATE).longValue(), payParam.getPayType(),
|
||||||
"wechatPay".equals(payParam.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId(), clintIp));
|
PayCst.Type.WECHAT.equals(payParam.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId(), clintIp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -263,7 +266,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
||||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||||
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
||||||
upOrderPayInfo(orderInfo.getId(), "aliPay".equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayCst.Type.ALIPAY.equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
||||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||||
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
||||||
CzgPayBaseReq.jsPayReq(payOrderNo, "点餐支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
CzgPayBaseReq.jsPayReq(payOrderNo, "点餐支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
||||||
@@ -287,7 +290,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||||
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
||||||
upOrderPayInfo(orderInfo.getId(), "aliPay".equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayCst.Type.ALIPAY.equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
||||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||||
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
||||||
CzgPayBaseReq.jsPayReq(payOrderNo, "扫码支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
CzgPayBaseReq.jsPayReq(payOrderNo, "扫码支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
||||||
@@ -302,7 +305,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
||||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||||
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
||||||
upOrderPayInfo(orderInfo.getId(), "aliPay".equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayCst.Type.ALIPAY.equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
||||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||||
return payService.pay(payParam.getShopId(), CzgPayEnum.LT_PAY,
|
return payService.pay(payParam.getShopId(), CzgPayEnum.LT_PAY,
|
||||||
CzgPayBaseReq.ltPayReq(payOrderNo, "点餐支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
CzgPayBaseReq.ltPayReq(payOrderNo, "点餐支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
||||||
@@ -354,6 +357,9 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
if (mapCzgResult.getCode() == 200) {
|
if (mapCzgResult.getCode() == 200) {
|
||||||
orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
||||||
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
||||||
|
// 事务成功提交后执行消息发送
|
||||||
|
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals( orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
||||||
|
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
||||||
} else {
|
} else {
|
||||||
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
||||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||||
@@ -522,12 +528,11 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
throw new CzgException(refund.getMsg());
|
throw new CzgException(refund.getMsg());
|
||||||
} else {
|
} else {
|
||||||
paymentService.updateChain()
|
OrderPayment upPayment = new OrderPayment();
|
||||||
.eq(OrderPayment::getId, refundId)
|
upPayment.setPayTime(LocalDateTimeUtil.parse(refund.getData().getRefundTime()));
|
||||||
.set(OrderPayment::getPayTime, refund.getData().getRefundTime())
|
upPayment.setTradeNumber(refund.getData().getThirdRefundNo());
|
||||||
.set(OrderPayment::getTradeNumber, refund.getData().getThirdRefundNo())
|
upPayment.setRespJson(refund.getData().getOriginalData());
|
||||||
.set(OrderPayment::getRespJson, refund.getData().getOriginalData())
|
paymentService.update(upPayment, new QueryWrapper().eq(OrderPayment::getId, refundId));
|
||||||
.update();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.PayAdapter;
|
import com.czg.PayAdapter;
|
||||||
import com.czg.PayAdapterFactory;
|
import com.czg.PayAdapterFactory;
|
||||||
|
import com.czg.PayCst;
|
||||||
import com.czg.constant.PayChannelCst;
|
import com.czg.constant.PayChannelCst;
|
||||||
import com.czg.constants.ParamCodeCst;
|
import com.czg.constants.ParamCodeCst;
|
||||||
import com.czg.constants.PayTypeConstants;
|
import com.czg.constants.PayTypeConstants;
|
||||||
import com.czg.constants.SystemConstants;
|
|
||||||
import com.czg.enums.CzgPayEnum;
|
import com.czg.enums.CzgPayEnum;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.order.dto.LtPayOtherDTO;
|
import com.czg.order.dto.LtPayOtherDTO;
|
||||||
@@ -64,10 +64,13 @@ public class PayServiceImpl implements PayService {
|
|||||||
} else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) {
|
} else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) {
|
||||||
payData = shopMerchant.getPolyPayJson();
|
payData = shopMerchant.getPolyPayJson();
|
||||||
}
|
}
|
||||||
bizData.setSubAppid(SystemConstants.PayType.ALIPAY.equals(bizData.getPayType()) ? shopMerchant.getAlipayAppId() : shopMerchant.getWechatAppId());
|
|
||||||
if (payType.equals(CzgPayEnum.MICRO_PAY)) {
|
if (payType.equals(CzgPayEnum.MICRO_PAY)) {
|
||||||
checkMicroPay(bizData, shopMerchant);
|
checkMicroPay(bizData, shopMerchant);
|
||||||
}
|
}
|
||||||
|
if (!PayCst.Type.WECHAT.equals(bizData.getPayType()) && !PayCst.Type.ALIPAY.equals(bizData.getPayType())) {
|
||||||
|
throw new CzgException("支付方式错误");
|
||||||
|
}
|
||||||
|
bizData.setSubAppid(PayCst.Type.ALIPAY.equals(bizData.getPayType()) ? shopMerchant.getAlipayAppId() : shopMerchant.getWechatAppId());
|
||||||
return adapter.pay(payType, payData, getDomain(), getNotifyUrl(shopMerchant.getChannel()), bizData);
|
return adapter.pay(payType, payData, getDomain(), getNotifyUrl(shopMerchant.getChannel()), bizData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,11 +232,11 @@ public class PayServiceImpl implements PayService {
|
|||||||
if (firstTwoDigits >= 10 && firstTwoDigits <= 15) {
|
if (firstTwoDigits >= 10 && firstTwoDigits <= 15) {
|
||||||
//微信支付
|
//微信支付
|
||||||
bizData.setSubAppid(shopMerchant.getWechatAppId());
|
bizData.setSubAppid(shopMerchant.getWechatAppId());
|
||||||
bizData.setPayType(SystemConstants.PayType.WECHAT);
|
bizData.setPayType(PayCst.Type.WECHAT);
|
||||||
} else if (firstTwoDigits >= 25 && firstTwoDigits <= 30) {
|
} else if (firstTwoDigits >= 25 && firstTwoDigits <= 30) {
|
||||||
//支付宝支付
|
//支付宝支付
|
||||||
bizData.setSubAppid(shopMerchant.getAlipayAppId());
|
bizData.setSubAppid(shopMerchant.getAlipayAppId());
|
||||||
bizData.setPayType(SystemConstants.PayType.ALIPAY);
|
bizData.setPayType(PayCst.Type.ALIPAY);
|
||||||
} else {
|
} else {
|
||||||
throw new CzgException("扫描码非法或暂不支持");
|
throw new CzgException("扫描码非法或暂不支持");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ public class ShopMerchantServiceImpl extends ServiceImpl<ShopMerchantMapper, Sho
|
|||||||
ShopMerchant shopMerchant = getOne(query().eq(ShopMerchant::getShopId, shopMerchantParam.getShopId()));
|
ShopMerchant shopMerchant = getOne(query().eq(ShopMerchant::getShopId, shopMerchantParam.getShopId()));
|
||||||
if (shopMerchant == null) {
|
if (shopMerchant == null) {
|
||||||
shopMerchant = new ShopMerchant();
|
shopMerchant = new ShopMerchant();
|
||||||
shopMerchant.setAlipayAppId(SystemConstants.PayType.ALIPAY_APP_ID);
|
shopMerchant.setAlipayAppId(SystemConstants.PayAppId.ALIPAY_APP_ID);
|
||||||
shopMerchant.setWechatAppId(SystemConstants.PayType.WECHAT_APP_ID);
|
shopMerchant.setWechatAppId(SystemConstants.PayAppId.WECHAT_APP_ID);
|
||||||
shopMerchant.setRelatedId(shopMerchantParam.getShopId());
|
shopMerchant.setRelatedId(shopMerchantParam.getShopId());
|
||||||
}
|
}
|
||||||
shopMerchant.setShopId(shopMerchantParam.getShopId());
|
shopMerchant.setShopId(shopMerchantParam.getShopId());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.czg.service.order.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import com.czg.PayCst;
|
||||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||||
import com.czg.account.entity.*;
|
import com.czg.account.entity.*;
|
||||||
import com.czg.account.service.*;
|
import com.czg.account.service.*;
|
||||||
@@ -209,7 +210,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
|||||||
String payType = isFree ? PayTypeConstants.SourceType.FREE : PayTypeConstants.SourceType.MEMBER_IN;
|
String payType = isFree ? PayTypeConstants.SourceType.FREE : PayTypeConstants.SourceType.MEMBER_IN;
|
||||||
|
|
||||||
LtPayOtherDTO payParam = new LtPayOtherDTO()
|
LtPayOtherDTO payParam = new LtPayOtherDTO()
|
||||||
.setOpenId("wechatPay".equals(rechargeDTO.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId())
|
.setOpenId(PayCst.Type.WECHAT.equals(rechargeDTO.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId())
|
||||||
.setPayType(rechargeDTO.getPayType())
|
.setPayType(rechargeDTO.getPayType())
|
||||||
.setShopId(rechargeDTO.getShopId())
|
.setShopId(rechargeDTO.getShopId())
|
||||||
.setRecordId(shopUser.getId())
|
.setRecordId(shopUser.getId())
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package com.czg.impl;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.PayAdapter;
|
import com.czg.PayAdapter;
|
||||||
|
import com.czg.PayCst;
|
||||||
import com.czg.PolyPayUtils;
|
import com.czg.PolyPayUtils;
|
||||||
import com.czg.constant.PayChannelCst;
|
import com.czg.constant.PayChannelCst;
|
||||||
import com.czg.constants.SystemConstants;
|
|
||||||
import com.czg.entity.resp.CzgBaseResp;
|
import com.czg.entity.resp.CzgBaseResp;
|
||||||
import com.czg.entity.resp.CzgRefundResp;
|
import com.czg.entity.resp.CzgRefundResp;
|
||||||
import com.czg.enums.CzgPayEnum;
|
import com.czg.enums.CzgPayEnum;
|
||||||
@@ -84,15 +84,15 @@ public class PolyPayAdapter implements PayAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CzgResult<Map<String, Object>> jsPay(PolyMerchantDTO shopMerchant, String domain, String notifyUrl, CzgPayBaseReq bizData) {
|
private CzgResult<Map<String, Object>> jsPay(PolyMerchantDTO shopMerchant, String domain, String notifyUrl, CzgPayBaseReq bizData) {
|
||||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + (SystemConstants.PayType.ALIPAY.equals(bizData.getPayType()) ? "支付宝" : "微信") + "小程序");
|
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + (PayCst.Type.ALIPAY.equals(bizData.getPayType()) ? "支付宝" : "微信") + "小程序");
|
||||||
bizData.setPayType(SystemConstants.PayType.ALIPAY.equals(bizData.getPayType()) ? "ALIPAY" : "WECHAT");
|
bizData.setPayType(PayCst.Type.ALIPAY.equals(bizData.getPayType()) ? "ALIPAY" : "WECHAT");
|
||||||
bizData.polyBase(shopMerchant.getStoreId(), notifyUrl);
|
bizData.polyBase(shopMerchant.getStoreId(), notifyUrl);
|
||||||
return PolyPayUtils.jsPay(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
return PolyPayUtils.jsPay(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CzgResult<Map<String, Object>> ltPay(PolyMerchantDTO shopMerchant, String domain, String notifyUrl, CzgPayBaseReq bizData) {
|
private CzgResult<Map<String, Object>> ltPay(PolyMerchantDTO shopMerchant, String domain, String notifyUrl, CzgPayBaseReq bizData) {
|
||||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay".equals(bizData.getPayType()) ? "支付宝" : "微信") + "小程序");
|
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + (PayCst.Type.ALIPAY.equals(bizData.getPayType()) ? "支付宝" : "微信") + "小程序");
|
||||||
bizData.polyBase(shopMerchant.getStoreId(), notifyUrl);
|
bizData.polyBase(shopMerchant.getStoreId(), notifyUrl);
|
||||||
return PolyPayUtils.ltPay(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
return PolyPayUtils.ltPay(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user