分销关联id修改

This commit is contained in:
张松 2025-10-30 17:43:05 +08:00
parent 052f2c24f6
commit 84816c8a8c
4 changed files with 5 additions and 6 deletions

View File

@ -57,7 +57,6 @@ public class NotifyController {
@GetMapping("testOpen")
public JSONObject test1(String code) throws Exception {
distributionUserService.distribute(54664L, "WX1983735285514747904", BigDecimal.valueOf(1), 474L, 122L, "order");
return null;
}

View File

@ -116,7 +116,7 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
BigDecimal updateShopInfoAmount(Long shopId, BigDecimal changeAmount, Long sourceId, TableValueConstant.DistributionAmountFlow.Type type, String remark);
void refund(String orderNo);
void refund(Long orderId, String orderNo);
/**
* 发放分销奖励

View File

@ -609,7 +609,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
distributionFlowService.save(mkDistributionFlow);
log.info("即时分销开始");
try {
updateShopInfoAmount(currentDistributionUser.getShopId(), rewardAmount.negate(), mkDistributionFlow.getId(), TableValueConstant.DistributionAmountFlow.Type.SUB, "分销扣除");
updateShopInfoAmount(currentDistributionUser.getShopId(), rewardAmount.negate(), sourceId, TableValueConstant.DistributionAmountFlow.Type.SUB, "分销扣除");
updateIncome(BigDecimal.ZERO, rewardAmount, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
} catch (Exception e) {
mkDistributionFlow.setStatus(TableValueConstant.DistributionFlow.Status.PENDING.getCode());
@ -637,7 +637,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
@Override
@Transactional(rollbackFor = Exception.class)
public void refund(String orderNo) {
public void refund(Long orderId, String orderNo) {
long count = distributionFlowService.count(new QueryWrapper().eq(MkDistributionFlow::getOrderNo, orderNo).eq(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.PENDING.getCode()));
if (count >= 1) {
log.warn("此分销已经退款");
@ -657,7 +657,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
}else {
// 执行扣款
updateIncome(BigDecimal.ZERO, item.getRewardAmount().negate(), BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopId(), item.getLevel());
updateShopInfoAmount(item.getShopId(), item.getRewardAmount(), item.getId(), TableValueConstant.DistributionAmountFlow.Type.REFUND, "分销回退");
updateShopInfoAmount(item.getShopId(), item.getRewardAmount(), orderId, TableValueConstant.DistributionAmountFlow.Type.REFUND, "分销回退");
}
distributionFlowService.save(refundFlow);
});

View File

@ -792,7 +792,7 @@ public class PayServiceImpl implements PayService {
}
// 退款分销还原
distributionUserService.refund(orderInfo.getOrderNo());
distributionUserService.refund(orderInfo.getId(), orderInfo.getOrderNo());
return CzgResult.success();
}