赠券修改
This commit is contained in:
@@ -201,7 +201,7 @@ public class ACouponController {
|
||||
*/
|
||||
@PostMapping("/grant")
|
||||
public CzgResult<Boolean> rewardCoupon(@Validated @RequestBody MkRewardCouponDTO rewardCouponDTO) {
|
||||
return CzgResult.success(couponRecordService.grant(rewardCouponDTO.getShopId() != null ? rewardCouponDTO.getShopId() : StpKit.USER.getShopId(), rewardCouponDTO));
|
||||
return CzgResult.success(couponRecordService.grant(rewardCouponDTO.getShopId() != null ? rewardCouponDTO.getShopId() : StpKit.USER.getShopId(), rewardCouponDTO, "管理员赠送"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,6 +63,6 @@ public interface MkShopCouponRecordService extends IService<MkShopCouponRecord>
|
||||
*/
|
||||
void deleteRecord(Long id);
|
||||
|
||||
Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO);
|
||||
Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO, String source);
|
||||
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||
shopCouponRecordService.grant(birthdayGift.getMainShopId(), new MkRewardCouponDTO().setCouponId(couponInfo.getId())
|
||||
.setNum(couponInfo.getNum())
|
||||
.setUserId(shopUser.getUserId())
|
||||
.setShopId(birthdayGift.getMainShopId()));
|
||||
.setShopId(birthdayGift.getMainShopId()), "生日赠券");
|
||||
MkBirthdayGiftRecordCoupon recordCoupon = new MkBirthdayGiftRecordCoupon().setCouponName(shopCoupon.getTitle()).setNum(couponInfo.getNum())
|
||||
.setType(TableValueConstant.BirthdayGiftRecordCoupon.Type.GIVE.getCode())
|
||||
.setRecordId(giftRecord.getId()).setUserId(shopUser.getUserId()).setShopUserId(shopUser.getId());
|
||||
|
||||
@@ -500,14 +500,14 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO) {
|
||||
public Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO, String source) {
|
||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getMainShopId, mainIdByShopId).eq(ShopUser::getUserId, rewardCouponDTO.getUserId()));
|
||||
MkShopCouponGiftDTO giftDTO = new MkShopCouponGiftDTO().setCouponId(rewardCouponDTO.getCouponId())
|
||||
.setShopId(shopId)
|
||||
.setSourceId(rewardCouponDTO.getUserId())
|
||||
.setShopUserId(shopUser == null ? null : shopUser.getId())
|
||||
.setSource("后台发放");
|
||||
.setSource(source);
|
||||
receiveCoupon(giftDTO, rewardCouponDTO.getNum(), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getId())
|
||||
.setNum(item.getNum())
|
||||
.setUserId(shopUser.getUserId())
|
||||
.setShopId(shopId));
|
||||
.setShopId(shopId), "充值赠券");
|
||||
}catch (Exception e) {
|
||||
log.warn("发放优惠券失败", e);
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
||||
shopCouponRecordService.grant(shopUser.getMainShopId(), new MkRewardCouponDTO().setCouponId(item.getCoupon().getId())
|
||||
.setNum(item.getNum())
|
||||
.setUserId(shopUser.getUserId())
|
||||
.setShopId(shopUser.getMainShopId()));
|
||||
.setShopId(shopUser.getMainShopId()), "会员任务赠券");
|
||||
|
||||
});
|
||||
// couponGiftService.addCouponGift(memberOrderId, "会员开通赠券", 1, giftDTOS);
|
||||
@@ -505,7 +505,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
||||
shopCouponRecordService.grant(shopId, new MkRewardCouponDTO().setCouponId(item.getCoupon().getId())
|
||||
.setNum(item.getNum())
|
||||
.setUserId(shopUser.getUserId())
|
||||
.setShopId(shopId));
|
||||
.setShopId(shopId), "购买会员赠券");
|
||||
} catch (Exception e) {
|
||||
log.error("发券失败", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user