优惠券

This commit is contained in:
wangw 2025-09-28 10:20:06 +08:00
parent 56a9728f28
commit 34089ce86d
1 changed files with 128 additions and 128 deletions

View File

@ -46,94 +46,94 @@ public class ACouponController {
/** /**
* 分页 * 分页
*/ */
// @GetMapping("page") @GetMapping("page")
//// @OperationLog("优惠券列表-分页") // @OperationLog("优惠券列表-分页")
//// @SaAdminCheckPermission("coupon:page") // @SaAdminCheckPermission("coupon:page")
// public CzgResult<Page<ShopCouponDTO>> getCouponPage(ShopCouponDTO param) { public CzgResult<Page<ShopCouponDTO>> getCouponPage(ShopCouponDTO param) {
// Long shopId = StpKit.USER.getShopId(0L); Long shopId = StpKit.USER.getShopId(0L);
// param.setShopId(shopId); param.setShopId(shopId);
// Page<ShopCouponDTO> data = shopCouponService.getCouponPage(param); Page<ShopCouponDTO> data = shopCouponService.getCouponPage(param);
// return CzgResult.success(data); return CzgResult.success(data);
// } }
//
// /** /**
// * 详情 * 详情
// * *
// * @param id 主键id * @param id 主键id
// */ */
// @GetMapping("{id}") @GetMapping("{id}")
//// @OperationLog("优惠券-详情") // @OperationLog("优惠券-详情")
//// @SaAdminCheckPermission("coupon:info") // @SaAdminCheckPermission("coupon:info")
// public CzgResult<ShopCouponDTO> getCouponById(@PathVariable("id") Long id) { public CzgResult<ShopCouponDTO> getCouponById(@PathVariable("id") Long id) {
// AssertUtil.isNull(id, "{}不能为空", "id"); AssertUtil.isNull(id, "{}不能为空", "id");
// ShopCouponDTO data = shopCouponService.getCouponById(id); ShopCouponDTO data = shopCouponService.getCouponById(id);
// return CzgResult.success(data); return CzgResult.success(data);
// } }
//
// /** /**
// * 新增 * 新增
// */ */
// @PostMapping @PostMapping
// @OperationLog("优惠券-新增") @OperationLog("优惠券-新增")
//// @SaAdminCheckPermission("coupon:add") // @SaAdminCheckPermission("coupon:add")
// public CzgResult<Void> addCoupon(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopCouponDTO dto) { public CzgResult<Void> addCoupon(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopCouponDTO dto) {
// Long shopId = StpKit.USER.getShopId(0L); Long shopId = StpKit.USER.getShopId(0L);
// dto.setShopId(shopId); dto.setShopId(shopId);
// dto.setLeftNum(dto.getGiveNum()); dto.setLeftNum(dto.getGiveNum());
// shopCouponService.addCoupon(dto); shopCouponService.addCoupon(dto);
// asyncToBranchShop(dto.getId(), 1); asyncToBranchShop(dto.getId(), 1);
// return CzgResult.success(); return CzgResult.success();
// } }
//
// /** /**
// * 修改 * 修改
// */ */
// @PutMapping @PutMapping
// @OperationLog("优惠券-修改") @OperationLog("优惠券-修改")
//// @SaAdminCheckPermission("coupon:update") // @SaAdminCheckPermission("coupon:update")
// public CzgResult<Void> updateCoupon(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopCouponDTO dto) { public CzgResult<Void> updateCoupon(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopCouponDTO dto) {
// Long shopId = StpKit.USER.getShopId(0L); Long shopId = StpKit.USER.getShopId(0L);
// dto.setShopId(shopId); dto.setShopId(shopId);
// shopCouponService.updateCouponById(dto); shopCouponService.updateCouponById(dto);
// couponGiftService.upCouponName(dto.getId(), dto.getTitle()); couponGiftService.upCouponName(dto.getId(), dto.getTitle());
// asyncToBranchShop(dto.getId(), 2); asyncToBranchShop(dto.getId(), 2);
// return CzgResult.success(); return CzgResult.success();
// } }
//
// /** /**
// * 删除 * 删除
// */ */
// @DeleteMapping @DeleteMapping
// @OperationLog("优惠券-删除") @OperationLog("优惠券-删除")
//// @SaAdminCheckPermission("prodGroup:delete") // @SaAdminCheckPermission("prodGroup:delete")
// public CzgResult<String> deleteCoupon(@RequestParam Long id, @RequestParam Integer type) { public CzgResult<String> deleteCoupon(@RequestParam Long id, @RequestParam Integer type) {
// AssertUtil.isNull(id, "{}不能为空", "id"); AssertUtil.isNull(id, "{}不能为空", "id");
// if (type != 1) { if (type != 1) {
// List<MkCouponGiftDTO> gifts = couponGiftService.getCouponGiftBySourceId(id, 3); List<MkCouponGiftDTO> gifts = couponGiftService.getCouponGiftBySourceId(id, 3);
// if (CollUtil.isNotEmpty(gifts)) { if (CollUtil.isNotEmpty(gifts)) {
// String collect = gifts.stream() String collect = gifts.stream()
// .map(MkCouponGiftDTO::getSourceName) .map(MkCouponGiftDTO::getSourceName)
// .filter(name -> name != null && !name.isEmpty()) .filter(name -> name != null && !name.isEmpty())
// .collect(Collectors.joining(",")); .collect(Collectors.joining(","));
// return CzgResult.success(collect); return CzgResult.success(collect);
// } }
// } }
// shopCouponService.deleteCoupon(id); shopCouponService.deleteCoupon(id);
// couponGiftService.deleteCoupon(id); couponGiftService.deleteCoupon(id);
// asyncToBranchShop(id, 3); asyncToBranchShop(id, 3);
// return CzgResult.success(); return CzgResult.success();
// } }
//
// /** /**
// * 获取该券关联的功能列表 * 获取该券关联的功能列表
// * *
// * @param couponId 如果syncId有值 则为syncId 否则为id * @param couponId 如果syncId有值 则为syncId 否则为id
// */ */
// @GetMapping("/gifts") @GetMapping("/gifts")
// public CzgResult<Page<MkCouponGiftDTO>> getCouponGiftPage(@RequestParam Long couponId, @RequestParam(required = false) Integer type) { public CzgResult<Page<MkCouponGiftDTO>> getCouponGiftPage(@RequestParam Long couponId, @RequestParam(required = false) Integer type) {
// Page<MkCouponGiftDTO> data = couponGiftService.getCouponGiftPage(couponId, type); Page<MkCouponGiftDTO> data = couponGiftService.getCouponGiftPage(couponId, type);
// return CzgResult.success(data); return CzgResult.success(data);
// } }
/** /**
* 优惠券列表/已领取详情 * 优惠券列表/已领取详情
@ -162,44 +162,44 @@ public class ACouponController {
return CzgResult.success(data); return CzgResult.success(data);
} }
// /** /**
// * 删除用户优惠券 失效 * 删除用户优惠券 失效
// * *
// * @param id 优惠券记录Id * @param id 优惠券记录Id
// */ */
// @DeleteMapping("/deleteRecord") @DeleteMapping("/deleteRecord")
// public CzgResult<Void> cancelRecord(Long id) { public CzgResult<Void> cancelRecord(Long id) {
// couponRecordService.deleteRecord(id); couponRecordService.deleteRecord(id);
// return CzgResult.success(); return CzgResult.success();
// } }
//
// private void asyncToBranchShop(Long id, Integer type) { private void asyncToBranchShop(Long id, Integer type) {
// long shopId = StpKit.USER.getShopId(0L); long shopId = StpKit.USER.getShopId(0L);
// log.info("优惠券同步,优惠券id:{},类型:{}", id, type); log.info("优惠券同步,优惠券id:{},类型:{}", id, type);
// ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
// shopSyncService.syncCouponBySourceShop(shopId, id, type); shopSyncService.syncCouponBySourceShop(shopId, id, type);
// }); });
// } }
//
// /** /**
// * 券发放 * 券发放
// * *
// * @return 是否发放成功 * @return 是否发放成功
// */ */
// @PostMapping("/grant") @PostMapping("/grant")
// public CzgResult<Boolean> rewardCoupon(@Validated @RequestBody MkRewardCouponDTO rewardCouponDTO) { 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));
// } }
//
//
// /** /**
// * 生成订单后使用 * 生成订单后使用
// * 通过用户Id 查找优惠券 * 通过用户Id 查找优惠券
// * *
// * @param shopUserId 店铺用户Id * @param shopUserId 店铺用户Id
// */ */
// @GetMapping("/findCoupon") @GetMapping("/findCoupon")
// public CzgResult<List<UserCouponVo>> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer isFood) { public CzgResult<List<UserCouponVo>> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer isFood) {
// return CzgResult.success(shopCouponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type, isFood)); return CzgResult.success(shopCouponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type, isFood));
// } }
} }