重复依赖
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user