重复依赖

This commit is contained in:
2025-10-27 14:22:27 +08:00
parent 00cbb7bc4f
commit 5b9ddbe91c
5 changed files with 16 additions and 79 deletions

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.czg.CzgPayUtils;
import com.czg.entity.CzgBaseRespParams;
import com.czg.market.service.MkDistributionConfigService;
import com.czg.market.service.MkDistributionUserService;
import com.czg.mq.PrintMqListener;
import com.czg.order.entity.OrderPayment;
import com.czg.order.service.OrderInfoService;
@@ -51,7 +52,7 @@ public class NotifyController {
@Resource
private WxService wxService;
@Resource
private MkDistributionConfigService distributionConfigService;
private MkDistributionUserService distributionUserService;
@Resource
private OrderPaymentService paymentService;
@@ -98,7 +99,7 @@ public class NotifyController {
payment.setPayTime(DateUtil.date().toLocalDateTime());
payment.setRespJson(plainTextJson.toJSONString());
paymentService.updateById(payment);
distributionConfigService.rechargeCallBack(payment.getSourceId(), payment.getShopId(), payment.getAmount(), payment.getId());
distributionUserService.rechargeCallBack(payment.getSourceId(), payment.getShopId(), payment.getAmount(), payment.getId());
}
return "SUCCESS";

View File

@@ -19,18 +19,4 @@ public interface MkDistributionConfigService extends IService<MkDistributionConf
MkDistributionConfigVO detail(Long mainShopId);
Boolean edit(Long shopId, MkDistributionConfigDTO dto);
Map<String, Object> pay(long userId, MkDistributionPayDTO payDTO);
Boolean cashPayOrder(long adminId, MkDistributionPayDTO payParam);
/**
* 分销员开通
* @param userId 用户
* @param amount 金额
* @param shopId 店铺id
*/
void open(Long userId, BigDecimal amount, Long shopId, Long sourceId);
void rechargeCallBack(Long userId, Long shopId, BigDecimal amount, Long paymentId);
}

View File

@@ -54,4 +54,6 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
*/
void open(Long userId, BigDecimal amount, Long shopId, Long sourceId);
void rechargeCallBack(Long userId, Long shopId, BigDecimal amount, Long paymentId);
}

View File

@@ -49,15 +49,6 @@ public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionC
@Resource
private MkDistributionLevelConfigService levelConfigService;
@Resource
private MkDistributionAmountFlowService distributionAmountFlowService;
@Resource
private MkDistributionUserService distributionUserService;
@Resource
private ShopUserService shopUserService;
@DubboReference
private OrderPaymentService orderPaymentService;
@DubboReference
private ShopInfoService shopInfoService;
@@ -89,58 +80,4 @@ public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionC
return updateById(config);
}
@Override
public Map<String, Object> pay(long userId, MkDistributionPayDTO payDTO) {
MkDistributionConfigVO detail = detail(payDTO.getShopId());
AssertUtil.isTrue(detail.getIsEnable() != 1, "分销未开启");
if (!TableValueConstant.DistributionConfig.OpenType.PAY.getCode().equals(detail.getOpenType())) {
throw new CzgException("当前未开启购买分销配置");
}
OrderPayment orderPayment = new OrderPayment().setShopId(payDTO.getShopId()).setSourceId(userId)
.setPayType("distribution").setOrderNo(payDTO.getPlatformType() + IdUtil.getSnowflakeNextId()).setAmount(detail.getPayAmount());
orderPaymentService.save(orderPayment);
return Map.of();
}
@Override
public Boolean cashPayOrder(long adminId, MkDistributionPayDTO payParam) {
ShopInfo shopInfo = shopInfoService.getById(payParam.getShopId());
AssertUtil.isNull(shopInfo, "店铺不存在");
BigDecimal amount = shopInfoService.updateAmount(shopInfo.getId(), payParam.getAmount());
Long mainShopId = shopInfoService.getMainIdByShopId(shopInfo.getId());
distributionAmountFlowService.save(new MkDistributionAmountFlow()
.setType(payParam.getAmount().compareTo(BigDecimal.ZERO) < 0 ? TableValueConstant.DistributionAmountFlow.Type.MANUAL_SUB.getCode() :
TableValueConstant.DistributionAmountFlow.Type.MANUAL_RECHARGE.getCode())
.setMainShopId(mainShopId).setShopId(shopInfo.getId()).setAmount(amount).setChangeAmount(payParam.getAmount())
.setRemark(payParam.getRemark()).setOpAccount(StpKit.USER.getAccount()));
return true;
}
@Override
public void open(Long userId, BigDecimal amount, Long shopId, Long sourceId) {
ShopUser shopUserInfo = shopUserService.getShopUserInfo(shopId, userId);
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
BigDecimal finalAmount = shopInfoService.updateAmount(shopId, amount);
distributionAmountFlowService.save(new MkDistributionAmountFlow()
.setType(TableValueConstant.DistributionAmountFlow.Type.OPEN.getCode())
.setMainShopId(mainShopId).setShopId(shopId).setAmount(finalAmount).setChangeAmount(amount).setSourceId(sourceId)
.setRemark("分销员购买").setOpAccount(StpKit.USER.getAccount()));
distributionUserService.addDistributionUser(new MkDistributionUser().setParentId(null).setShopId(shopId)
.setShopUserId(shopUserInfo.getId()).setOpeningMethod("付费开通"));
}
@Override
public void rechargeCallBack(Long userId, Long shopId, BigDecimal amount, Long paymentId) {
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
BigDecimal finalAmount = shopInfoService.updateAmount(shopId, amount);
distributionAmountFlowService.save(new MkDistributionAmountFlow()
.setType(TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode())
.setMainShopId(mainShopId).setShopId(shopId).setAmount(finalAmount).setChangeAmount(amount).setSourceId(paymentId)
.setRemark("自助充值").setOpAccount(StpKit.USER.getAccount()));
}
}

View File

@@ -177,4 +177,15 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
addDistributionUser(new MkDistributionUser().setParentId(null).setShopId(shopId)
.setShopUserId(shopUserInfo.getId()).setOpeningMethod("付费开通"));
}
@Override
public void rechargeCallBack(Long userId, Long shopId, BigDecimal amount, Long paymentId) {
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
BigDecimal finalAmount = shopInfoService.updateAmount(shopId, amount);
distributionAmountFlowService.save(new MkDistributionAmountFlow()
.setType(TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode())
.setMainShopId(mainShopId).setShopId(shopId).setAmount(finalAmount).setChangeAmount(amount).setSourceId(paymentId)
.setRemark("自助充值").setOpAccount(StpKit.USER.getAccount()));
}
}