重复依赖
This commit is contained in:
@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import com.czg.CzgPayUtils;
|
import com.czg.CzgPayUtils;
|
||||||
import com.czg.entity.CzgBaseRespParams;
|
import com.czg.entity.CzgBaseRespParams;
|
||||||
import com.czg.market.service.MkDistributionConfigService;
|
import com.czg.market.service.MkDistributionConfigService;
|
||||||
|
import com.czg.market.service.MkDistributionUserService;
|
||||||
import com.czg.mq.PrintMqListener;
|
import com.czg.mq.PrintMqListener;
|
||||||
import com.czg.order.entity.OrderPayment;
|
import com.czg.order.entity.OrderPayment;
|
||||||
import com.czg.order.service.OrderInfoService;
|
import com.czg.order.service.OrderInfoService;
|
||||||
@@ -51,7 +52,7 @@ public class NotifyController {
|
|||||||
@Resource
|
@Resource
|
||||||
private WxService wxService;
|
private WxService wxService;
|
||||||
@Resource
|
@Resource
|
||||||
private MkDistributionConfigService distributionConfigService;
|
private MkDistributionUserService distributionUserService;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderPaymentService paymentService;
|
private OrderPaymentService paymentService;
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ public class NotifyController {
|
|||||||
payment.setPayTime(DateUtil.date().toLocalDateTime());
|
payment.setPayTime(DateUtil.date().toLocalDateTime());
|
||||||
payment.setRespJson(plainTextJson.toJSONString());
|
payment.setRespJson(plainTextJson.toJSONString());
|
||||||
paymentService.updateById(payment);
|
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";
|
return "SUCCESS";
|
||||||
|
|||||||
@@ -19,18 +19,4 @@ public interface MkDistributionConfigService extends IService<MkDistributionConf
|
|||||||
MkDistributionConfigVO detail(Long mainShopId);
|
MkDistributionConfigVO detail(Long mainShopId);
|
||||||
|
|
||||||
Boolean edit(Long shopId, MkDistributionConfigDTO dto);
|
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);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,4 +54,6 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
|||||||
*/
|
*/
|
||||||
void open(Long userId, BigDecimal amount, Long shopId, Long sourceId);
|
void open(Long userId, BigDecimal amount, Long shopId, Long sourceId);
|
||||||
|
|
||||||
|
void rechargeCallBack(Long userId, Long shopId, BigDecimal amount, Long paymentId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,15 +49,6 @@ public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionC
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MkDistributionLevelConfigService levelConfigService;
|
private MkDistributionLevelConfigService levelConfigService;
|
||||||
@Resource
|
|
||||||
private MkDistributionAmountFlowService distributionAmountFlowService;
|
|
||||||
@Resource
|
|
||||||
private MkDistributionUserService distributionUserService;
|
|
||||||
@Resource
|
|
||||||
private ShopUserService shopUserService;
|
|
||||||
|
|
||||||
@DubboReference
|
|
||||||
private OrderPaymentService orderPaymentService;
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopInfoService shopInfoService;
|
private ShopInfoService shopInfoService;
|
||||||
|
|
||||||
@@ -89,58 +80,4 @@ public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionC
|
|||||||
|
|
||||||
return updateById(config);
|
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)
|
addDistributionUser(new MkDistributionUser().setParentId(null).setShopId(shopId)
|
||||||
.setShopUserId(shopUserInfo.getId()).setOpeningMethod("付费开通"));
|
.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