发展基金相关实现-增加发展基金 #5

Merged
zhanghb merged 1 commits from main-zhb into main 2025-02-17 16:00:49 +08:00
2 changed files with 24 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
package com.buy507.mall.mapper; package com.buy507.mall.mapper;
import com.buy507.mall.model.UmsDevelopmentFund; import com.buy507.mall.model.UmsDevelopmentFund;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -26,6 +27,20 @@ public interface UmsDevelopmentFundMapper {
*/ */
@Select("SELECT SUM(points_total) FROM ums_development_fund") @Select("SELECT SUM(points_total) FROM ums_development_fund")
Integer getTotalPoints(); Integer getTotalPoints();
/**
* 发展基金现金流水
* @param payAmount
*/
@Insert("INSERT INTO ums_development_fund (cash_total, updated_at) VALUES (#{payAmount}, NOW())")
void insertCash(BigDecimal payAmount);
/**
* 发展基金积分流水
* @param rewardPoints
*/
@Insert("INSERT INTO ums_development_fund (points_total, updated_at) VALUES (#{rewardPoints}, NOW())")
void insertPoints(BigDecimal rewardPoints);
} }

View File

@@ -140,6 +140,9 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
@Autowired @Autowired
private SmsHomeNewProductMapper homeNewProductMapper; private SmsHomeNewProductMapper homeNewProductMapper;
@Autowired
private UmsDevelopmentFundMapper umsDevelopmentFundMapper;
@Value("${kuaidi100.url}") @Value("${kuaidi100.url}")
@@ -1788,6 +1791,10 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
OmsOrder order = list.get(0); OmsOrder order = list.get(0);
//获取订单实付金额
BigDecimal payAmount = order.getPayAmount();
//增加基金现金流水
umsDevelopmentFundMapper.insertCash(payAmount);
//获取积分专区状态 //获取积分专区状态
int pointsAreaStatus = orderMapper.selectPointsAreaStatus(outTradeNo); int pointsAreaStatus = orderMapper.selectPointsAreaStatus(outTradeNo);
//如果是积分专区的商品则进行积分专区相对应的逻辑 //如果是积分专区的商品则进行积分专区相对应的逻辑
@@ -1807,7 +1814,8 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
// 更新用户积分 // 更新用户积分
memberMapper.updateByPrimaryKey(member); memberMapper.updateByPrimaryKey(member);
//增加基金积分流水
umsDevelopmentFundMapper.insertPoints(rewardPoints);
} }
//订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单 //订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单
if (order != null && order.getStatus() == 0) { if (order != null && order.getStatus() == 0) {