充值赠送问题
This commit is contained in:
@@ -178,7 +178,9 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
.setType(1)
|
||||
.setBizEnum(bizEnum)
|
||||
.setRelationId(paymentId);
|
||||
BigDecimal rechargeAmount = BigDecimal.ZERO;
|
||||
shopUserMoneyEditDTO.setMoney(amount);
|
||||
Long flowId = shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||
BigDecimal rechargeAmount = amount;
|
||||
BigDecimal giftAmount = BigDecimal.ZERO;
|
||||
BigDecimal giftPoints = BigDecimal.ZERO;
|
||||
Integer giftCoupon = 0;
|
||||
@@ -186,47 +188,45 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
// 标准充值
|
||||
if (rechargeDetailId != null) {
|
||||
MkShopRechargeDetail rechargeDetail = shopRechargeDetailService.getById(rechargeDetailId);
|
||||
shopUserMoneyEditDTO.setMoney(rechargeDetail.getAmount());
|
||||
rechargeAmount = rechargeDetail.getAmount();
|
||||
try {
|
||||
// 赠送金额
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditRewardDTO = new ShopUserMoneyEditDTO()
|
||||
.setId(shopUserId)
|
||||
.setType(1)
|
||||
.setBizEnum(ShopUserFlowBizEnum.AWARD_IN)
|
||||
.setRelationId(paymentId);
|
||||
shopUserMoneyEditRewardDTO.setMoney(rechargeDetail.getRewardAmount());
|
||||
Long editId = shopUserService.updateMoney(shopUserMoneyEditRewardDTO);
|
||||
giftAmount = rechargeDetail.getRewardAmount();
|
||||
// 发放积分
|
||||
if (rechargeDetail.getRewardPoints() != null) {
|
||||
giftPoints = BigDecimal.valueOf(rechargeDetail.getRewardPoints());
|
||||
pointsUserService.alterPoints(null, shopUserId, shopUser.getMainShopId(), PointsConstant.ADD, rechargeDetail.getRewardPoints(), editId, "充值赠送");
|
||||
}
|
||||
// 发放优惠券
|
||||
if (StrUtil.isNotBlank(rechargeDetail.getCouponInfoList())) {
|
||||
List<CouponInfoDTO> list = JSONArray.parseArray(rechargeDetail.getCouponInfoList()).toJavaList(CouponInfoDTO.class);
|
||||
for (CouponInfoDTO item : list) {
|
||||
if (item.getId() == null) {
|
||||
return;
|
||||
}
|
||||
giftCoupon = giftCoupon + item.getNum();
|
||||
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getId())
|
||||
.setNum(item.getNum())
|
||||
.setUserId(shopUser.getUserId())
|
||||
.setShopId(shopId), "充值赠券");
|
||||
if (rechargeDetail != null) {
|
||||
if (rechargeDetail.getRewardAmount() != null && rechargeDetail.getRewardAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
// 赠送金额
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditRewardDTO = new ShopUserMoneyEditDTO()
|
||||
.setId(shopUserId)
|
||||
.setType(1)
|
||||
.setRechargeId(flowId)
|
||||
.setBizEnum(ShopUserFlowBizEnum.AWARD_IN)
|
||||
.setRelationId(paymentId);
|
||||
shopUserMoneyEditRewardDTO.setMoney(rechargeDetail.getRewardAmount());
|
||||
shopUserService.updateMoney(shopUserMoneyEditRewardDTO);
|
||||
giftAmount = rechargeDetail.getRewardAmount();
|
||||
}
|
||||
// 发放积分
|
||||
if (rechargeDetail.getRewardPoints() != null && rechargeDetail.getRewardPoints() > 0) {
|
||||
giftPoints = BigDecimal.valueOf(rechargeDetail.getRewardPoints());
|
||||
pointsUserService.alterPoints(null, shopUserId, shopUser.getMainShopId(), PointsConstant.ADD, rechargeDetail.getRewardPoints(), flowId, "充值赠送");
|
||||
}
|
||||
// 发放优惠券
|
||||
if (StrUtil.isNotBlank(rechargeDetail.getCouponInfoList())) {
|
||||
List<CouponInfoDTO> list = JSONArray.parseArray(rechargeDetail.getCouponInfoList()).toJavaList(CouponInfoDTO.class);
|
||||
for (CouponInfoDTO item : list) {
|
||||
if (item.getId() == null) {
|
||||
return;
|
||||
}
|
||||
giftCoupon = giftCoupon + item.getNum();
|
||||
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getId())
|
||||
.setNum(item.getNum())
|
||||
.setUserId(shopUser.getUserId())
|
||||
.setShopId(shopId), "充值赠券");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("recharge充值有问题", e);
|
||||
}
|
||||
// 自定义金额
|
||||
} else {
|
||||
shopUserMoneyEditDTO.setMoney(amount);
|
||||
rechargeAmount = amount;
|
||||
}
|
||||
Long flowId = shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||
BigDecimal finalRechargeAmount = rechargeAmount;
|
||||
BigDecimal finalGiftAmount = giftAmount;
|
||||
BigDecimal finalGiftPoints = giftPoints;
|
||||
|
||||
Reference in New Issue
Block a user