添加拼团分账订单

This commit is contained in:
DB 2024-04-24 18:53:09 +08:00
parent 94c94dd1be
commit b3346765e4
6 changed files with 21 additions and 14 deletions

View File

@ -14,7 +14,7 @@ public enum OrderSource {
MALL("Mall",0.002), MALL("Mall",0.002),
/** /**
* 一次性支付 * 放心学
*/ */
EASY_LEARN("EasyLearn",0.002), EASY_LEARN("EasyLearn",0.002),

View File

@ -65,7 +65,7 @@ public class EasyLearnUnionPayBo {
* 订单类型 * 订单类型
*/ */
@NotBlank(message = "联合支付类型不能为空") @NotBlank(message = "联合支付类型不能为空")
@ApiModelProperty(value = "联合支付类型(WX_PAY:微信支付;PREPAYMENT:预付;REPAYMENT:还款;MEMBER:会员)",required = true) @ApiModelProperty(value = "联合支付类型(WX_PAY:微信支付;PREPAYMENT:预付;REPAYMENT:还款;MEMBER:会员;GROUP_BOOKING:拼团)",required = true)
private String easyLearnUnionPay; private String easyLearnUnionPay;
/** /**

View File

@ -615,7 +615,7 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
.setBody("联合支付") .setBody("联合支付")
.setOutTradeNo(easyLearnOrder.getId()) .setOutTradeNo(easyLearnOrder.getId())
//元转分 //元转分
.setTotalFee(easyLearnOrder.getTotalAmount().scaleByPowerOfTen(2).intValue()) .setTotalFee(StringUtils.equals(SpringUtils.getActiveProfile(), "prod") ? easyLearnOrder.getTotalAmount().scaleByPowerOfTen(2).intValue() : 1)
.setTradeType("JSAPI"); .setTradeType("JSAPI");
return wxPayService.createOrder(orderRequest); return wxPayService.createOrder(orderRequest);
} }
@ -667,7 +667,8 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
//需要分账 //需要分账
String subMchId = wxPayHandler.getSubMchId(easyLearnOrder.getBrandId(), easyLearnOrder.getStoreId()); String subMchId = wxPayHandler.getSubMchId(easyLearnOrder.getBrandId(), easyLearnOrder.getStoreId());
config.setSubMchId(subMchId); config.setSubMchId(subMchId);
wxPayAsyncTask.asyncWxPayProfitSharing(orderId, notifyResult, wxPayService, OrderSource.EASY_LEARN, easyLearnOrder.getRate()); wxPayAsyncTask.asyncWxPayProfitSharing(orderId, notifyResult, wxPayService,
easyLearnOrder.getOrderType().equals(EasyLearnPayPayEnum.GROUP_BOOKING.getOrderType()) ? OrderSource.MALL : OrderSource.EASY_LEARN, easyLearnOrder.getRate());
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
EasyLearnPayPayEnum easyLearnPayPayEnum = EasyLearnPayPayEnum.getEasyLearnPayPayEnum(easyLearnOrder.getOrderType()); EasyLearnPayPayEnum easyLearnPayPayEnum = EasyLearnPayPayEnum.getEasyLearnPayPayEnum(easyLearnOrder.getOrderType());

View File

@ -43,7 +43,13 @@ public enum EasyLearnPayPayEnum {
/** /**
* 会员 * 会员
*/ */
MEMBER("MEMBER",7); MEMBER("MEMBER",7),
/**
* 拼团
*/
GROUP_BOOKING("GROUP_BOOKING",8);
EasyLearnPayPayEnum(String name, Integer orderType) { EasyLearnPayPayEnum(String name, Integer orderType) {
this.orderType = orderType; this.orderType = orderType;

View File

@ -56,14 +56,14 @@ public class CpopWxPayTests {
amount.setRefund(refund) amount.setRefund(refund)
.setTotal(refund) .setTotal(refund)
.setCurrency("CNY"); .setCurrency("CNY");
request.setTransactionId("4200002123202402194880609914") request.setTransactionId("4200002176202404245283534577")
//.setOutTradeNo("1000000000202401121937112562856") //.setOutTradeNo("1000000000202401121937112562856")
//.setTransactionId(order.getOutOrderNo()) //.setTransactionId(order.getOutOrderNo())
//.setOutTradeNo(order.getId()) //.setOutTradeNo(order.getId())
.setNotifyUrl(wxPayProperties.getNotifyRefund()) .setNotifyUrl(wxPayProperties.getNotifyRefund())
.setOutRefundNo(IdUtil.getSnowflakeNextIdStr()) .setOutRefundNo(IdUtil.getSnowflakeNextIdStr())
.setSubMchid("1618925571") .setSubMchid("1670749045")
.setReason("先学后付测试退款") .setReason("拼团测试退款")
.setAmount(amount); .setAmount(amount);
WxPayRefundV3Result result = wxPayService.refundV3(request); WxPayRefundV3Result result = wxPayService.refundV3(request);
System.out.println(result); System.out.println(result);
@ -136,8 +136,8 @@ public class CpopWxPayTests {
@Test @Test
public void getOrderInfo() throws WxPayException { public void getOrderInfo() throws WxPayException {
WxPayConfig config = wxPayService.getConfig(); WxPayConfig config = wxPayService.getConfig();
config.setSubMchId("1661323640"); config.setSubMchId("1670749045");
WxPayOrderQueryResult wxPayOrderQueryResult = wxPayService.queryOrder("4200002096202401188599394121", null); WxPayOrderQueryResult wxPayOrderQueryResult = wxPayService.queryOrder("4200002205202404240308986697", null);
System.out.println(JSONObject.toJSONString(wxPayOrderQueryResult)); System.out.println(JSONObject.toJSONString(wxPayOrderQueryResult));
} }
@ -175,10 +175,10 @@ public class CpopWxPayTests {
@Test @Test
public void profitSharingFinish() throws WxPayException { public void profitSharingFinish() throws WxPayException {
ProfitSharingUnfreezeRequest profitSharingFinishRequest = new ProfitSharingUnfreezeRequest(); ProfitSharingUnfreezeRequest profitSharingFinishRequest = new ProfitSharingUnfreezeRequest();
profitSharingFinishRequest.setTransactionId("4200002122202401129346519359"); profitSharingFinishRequest.setTransactionId("4200002205202404240308986697");
profitSharingFinishRequest.setOutOrderNo("1745820005743910912"); profitSharingFinishRequest.setOutOrderNo("140678614679425024");
profitSharingFinishRequest.setDescription("结束分账"); profitSharingFinishRequest.setDescription("结束分账");
profitSharingFinishRequest.setSubMchId("1661323640"); profitSharingFinishRequest.setSubMchId("1670749045");
wxPayService.getProfitSharingService().profitSharingFinish(profitSharingFinishRequest); wxPayService.getProfitSharingService().profitSharingFinish(profitSharingFinishRequest);
} }

View File

@ -51,7 +51,7 @@ public class CpopEasyLearnDataAnalyseTest{
.select("out_order_no") .select("out_order_no")
.select("create_time") .select("create_time")
.from("j_wx_pay_profit_sharing") .from("j_wx_pay_profit_sharing")
.where("create_time >= ?", "2024-04-08 19:00:00") .where("create_time >= ?", "2024-04-16 00:00:00")
//.between("create_time", "2023-04-23 00:00:00","2023-11-13 22:00:00") //.between("create_time", "2023-04-23 00:00:00","2023-11-13 22:00:00")
.list(); .list();
List<Row> insertList = new ArrayList<>(); List<Row> insertList = new ArrayList<>();