From e4c15ba0a0411842dcee4af500e873d2280987b1 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 19 May 2025 10:30:23 +0800
Subject: [PATCH] feat(mall): 添加佣金修改功能并优化余额和积分修改
---
src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java | 137 ++++++++++++++++++++++++++-------------------
1 files changed, 78 insertions(+), 59 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java b/src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java
index 32b7304..b0d40a1 100644
--- a/src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java
+++ b/src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java
@@ -147,62 +147,72 @@
mallMoneyFlow.setStatus(2);
mallMoneyFlowMapper.updateById(mallMoneyFlow);
- /**
- * 充值赠送金额
- */
- DataDictionaryCustom giveStateDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
- DataDictionaryEnum.GIVE_STATE.getType(),
- DataDictionaryEnum.GIVE_STATE.getCode());
+ mallMoneyFlowService.addMoneyFlow(
+ memberId,
+ payMoney,
+ ScoreFlowTypeEnum.RECHARGE_ING.getValue(),
+ rechargeNo,
+ FlowTypeEnum.BALANCE.getValue(),
+ StrUtil.format(ScoreFlowTypeEnum.RECHARGE.getDesc(),payMoney),
+ 2
+ );
- DataDictionaryCustom giveAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
- DataDictionaryEnum.GIVE_AMOUNT.getType(),
- DataDictionaryEnum.GIVE_AMOUNT.getCode());
-
- DataDictionaryCustom chargeAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
- DataDictionaryEnum.CHARGE_AMOUNT.getType(),
- DataDictionaryEnum.CHARGE_AMOUNT.getCode());
- /**
- * 普通充值
- * 开启了充值赠送
- * 系统设置的赠送金额和充值金额不为空
- * 充值金额大于等于系统设置的充值金额
- */
- if(1 == type
- && ObjectUtil.isNotEmpty(giveStateDic)
- && "1".equals(giveStateDic.getValue())
- && ObjectUtil.isNotEmpty(giveAmountDic)
- && ObjectUtil.isNotEmpty(chargeAmountDic)){
- BigDecimal giveAmount = ObjectUtil.isEmpty(giveAmountDic.getValue()) ?
- BigDecimal.ZERO :
- new BigDecimal(giveAmountDic.getValue()).abs().setScale(2,BigDecimal.ROUND_DOWN);
- BigDecimal chargeAmount = ObjectUtil.isEmpty(chargeAmountDic.getValue()) ?
- BigDecimal.ZERO :
- new BigDecimal(chargeAmountDic.getValue()).abs().setScale(2,BigDecimal.ROUND_DOWN);
- if(payMoney.compareTo(chargeAmount) >= 0){
- mallMoneyFlowService.addMoneyFlow(
- memberId,
- giveAmount,
- MoneyFlowTypeEnum.RECHARGE_SEND.getValue(),
- rechargeNo+"ZS",
- FlowTypeEnum.BALANCE.getValue(),
- "充值赠送金额",
- 2);
-
- memberWalletService.addBalance(giveAmount,memberId);
- }
- }
-
- RechargeWalletMessageSendDto rechargeWalletMessageSendDto = new RechargeWalletMessageSendDto();
- rechargeWalletMessageSendDto.setRechargeNo(rechargeNo);
- rechargeWalletMessageSendDto.setRechargeAmount(payMoney.toString());
-
- MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
- rechargeWalletMessageSendDto.setBalance(mallMemberWallet.getBalance().toString());
- rechargeWalletMessageSendDto.setCreateTime(DateUtil.now());
- rechargeWalletMessageSendDto.setOpenId(mallMemberMapper.selectById(memberId).getOpenId());
- DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WX_TEMPLATE_ID_TWO.getType(), DataDictionaryEnum.WX_TEMPLATE_ID_TWO.getCode());
- rechargeWalletMessageSendDto.setTemplateId(dataDictionaryCustom.getValue());
- iXcxPayService.rechargeWalletMessageSend(rechargeWalletMessageSendDto);
+// /**
+// * 充值赠送金额
+// */
+// DataDictionaryCustom giveStateDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+// DataDictionaryEnum.GIVE_STATE.getType(),
+// DataDictionaryEnum.GIVE_STATE.getCode());
+//
+// DataDictionaryCustom giveAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+// DataDictionaryEnum.GIVE_AMOUNT.getType(),
+// DataDictionaryEnum.GIVE_AMOUNT.getCode());
+//
+// DataDictionaryCustom chargeAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+// DataDictionaryEnum.CHARGE_AMOUNT.getType(),
+// DataDictionaryEnum.CHARGE_AMOUNT.getCode());
+// /**
+// * 普通充值
+// * 开启了充值赠送
+// * 系统设置的赠送金额和充值金额不为空
+// * 充值金额大于等于系统设置的充值金额
+// */
+// if(1 == type
+// && ObjectUtil.isNotEmpty(giveStateDic)
+// && "1".equals(giveStateDic.getValue())
+// && ObjectUtil.isNotEmpty(giveAmountDic)
+// && ObjectUtil.isNotEmpty(chargeAmountDic)){
+// BigDecimal giveAmount = ObjectUtil.isEmpty(giveAmountDic.getValue()) ?
+// BigDecimal.ZERO :
+// new BigDecimal(giveAmountDic.getValue()).abs().setScale(2,BigDecimal.ROUND_DOWN);
+// BigDecimal chargeAmount = ObjectUtil.isEmpty(chargeAmountDic.getValue()) ?
+// BigDecimal.ZERO :
+// new BigDecimal(chargeAmountDic.getValue()).abs().setScale(2,BigDecimal.ROUND_DOWN);
+// if(payMoney.compareTo(chargeAmount) >= 0){
+// mallMoneyFlowService.addMoneyFlow(
+// memberId,
+// giveAmount,
+// MoneyFlowTypeEnum.RECHARGE_SEND.getValue(),
+// rechargeNo+"ZS",
+// FlowTypeEnum.BALANCE.getValue(),
+// "充值赠送金额",
+// 2);
+//
+// memberWalletService.addBalance(giveAmount,memberId);
+// }
+// }
+//
+// RechargeWalletMessageSendDto rechargeWalletMessageSendDto = new RechargeWalletMessageSendDto();
+// rechargeWalletMessageSendDto.setRechargeNo(rechargeNo);
+// rechargeWalletMessageSendDto.setRechargeAmount(payMoney.toString());
+//
+// MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
+// rechargeWalletMessageSendDto.setBalance(mallMemberWallet.getBalance().toString());
+// rechargeWalletMessageSendDto.setCreateTime(DateUtil.now());
+// rechargeWalletMessageSendDto.setOpenId(mallMemberMapper.selectById(memberId).getOpenId());
+// DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WX_TEMPLATE_ID_TWO.getType(), DataDictionaryEnum.WX_TEMPLATE_ID_TWO.getCode());
+// rechargeWalletMessageSendDto.setTemplateId(dataDictionaryCustom.getValue());
+// iXcxPayService.rechargeWalletMessageSend(rechargeWalletMessageSendDto);
threadResult.success().message("充值成功");
} else {
log.info("充值失败", attrStr);
@@ -342,11 +352,20 @@
mallMoneyFlowService.addMoneyFlow(
order.getMemberId(),
order.getAmount().negate(),
- MoneyFlowTypeEnum.WECHAT_PAY.getValue(),
+ ScoreFlowTypeEnum.WECHAT_PAY.getValue(),
order.getOrderNo(),
- FlowTypeEnum.WECHAT.getValue(),
- "微信支付",
- 2);
+ FlowTypeEnum.BALANCE.getValue(),
+ StrUtil.format(ScoreFlowTypeEnum.WECHAT_PAY.getDesc(),order.getAmount()),
+ 2
+ );
+// mallMoneyFlowService.addMoneyFlow(
+// order.getMemberId(),
+// order.getAmount().negate(),
+// MoneyFlowTypeEnum.WECHAT_PAY.getValue(),
+// order.getOrderNo(),
+// FlowTypeEnum.WECHAT.getValue(),
+// "微信支付",
+// 2);
threadResult.success().message("支付成功");
} else {
log.info("订单状态不为待付款,order status=", order.getStatus());
--
Gitblit v1.9.1