原作废代码 删除

This commit is contained in:
2025-09-11 13:44:28 +08:00
parent e9fa387e02
commit 65ba0e18ce
16 changed files with 234 additions and 1280 deletions

View File

@@ -1,86 +0,0 @@
package com.czg.controller.admin;
import com.czg.account.dto.ShopActivateDTO;
import com.czg.account.service.ShopActivateService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.config.RedisCst;
import com.czg.exception.CzgException;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.service.RedisService;
import com.czg.service.account.util.WechatAuthUtil;
import jakarta.annotation.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 店铺充值活动管理
*
* @author ww
* @description
*/
@RestController
@RequestMapping("/admin/activate")
public class ShopActivateController {
@Resource
private ShopActivateService shopActivateService;
@Resource
private RedisService redisService;
@Resource
private WechatAuthUtil wechatUtil;
/**
* 店铺充值活动列表
* 权限标识: activate:list
*/
@SaAdminCheckPermission(value = "activate:list", name = "店铺充值活动列表")
@GetMapping
public CzgResult<List<ShopActivateDTO>> detail(@RequestParam(required = false) Long shopId) {
return CzgResult.success(shopActivateService.getList(shopId));
}
/**
* 店铺充值活动新增
* 权限标识: activate:add
*/
@SaAdminCheckPermission(value = "activate:add", name = "店铺充值活动新增")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopActivateDTO activateDTO) {
activateDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(shopActivateService.add(activateDTO));
}
/**
* 店铺充值活动修改
* 权限标识: activate:edit
*/
@SaAdminCheckPermission(value = "activate:edit", name = "店铺充值活动修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopActivateDTO activateDTO) {
return CzgResult.success(shopActivateService.edit(activateDTO));
}
/**
* 获取会员码
* @param params shopId 必填
* env_version 存在即生成体验版
*/
@PostMapping("/getVipCode")
public CzgResult<Object> getVipCode(@RequestBody Map<String, Object> params) throws Exception {
if (CollectionUtils.isEmpty(params) || !params.containsKey("shopId")) {
throw new CzgException("参数错误");
}
String redisKey = RedisCst.SHOP_VIP_CODE + params.get("shopId");
if (redisService.hasKey(redisKey)) {
return CzgResult.success(redisService.get(redisKey));
}
return CzgResult.success(wechatUtil.getFetchQrCode(params));
}
}

View File

@@ -1,86 +0,0 @@
package com.czg.controller.admin;
import com.czg.account.dto.QueryReceiveDto;
import com.czg.account.dto.ShopCouponDTO;
import com.czg.account.service.ShopCouponService;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺优惠券
*
* @author ww
* @description
*/
@RestController
@RequestMapping("/admin/coupon")
public class ShopCouponController {
@Resource
private ShopCouponService couponService;
/**
* 店铺优惠券列表
* 权限标识: coupon:list
* 状态 0 未使用 1已使用 2已过期
*/
@SaAdminCheckPermission(value = "coupon:list", name = "优惠券列表")
@GetMapping
public CzgResult<List<ShopCouponDTO>> detail(@RequestParam(required = false) Integer type,
@RequestParam(required = false) Integer status) {
return CzgResult.success(couponService.getList(StpKit.USER.getShopId(), type, status));
}
/**
* 店铺优惠券新增
* 权限标识: coupon:add
*/
@SaAdminCheckPermission(value = "coupon:add", name = "优惠券添加")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopCouponDTO couponDTO) {
couponDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(couponService.add(couponDTO));
}
/**
* 店铺优惠券修改
* 权限标识: coupon:edit
*/
@SaAdminCheckPermission(value = "coupon:edit", name = "优惠券修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopCouponDTO couponDTO) {
couponDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(couponService.edit(couponDTO));
}
/**
* 店铺优惠券获取记录
* 权限标识: coupon:delete
*/
@SaAdminCheckPermission(value = "coupon:queryReceive", name = "优惠券领取记录")
@GetMapping("/queryReceive")
public CzgResult<Page<CouponReceiveVo>> queryReceive(@Validated QueryReceiveDto param) {
return CzgResult.success(couponService.queryReceive(param));
}
/**
* 生成订单后使用
* 通过用户Id 查找优惠券
*
* @param shopUserId 店铺用户Id
*/
@GetMapping("/findCoupon")
public CzgResult<List<UserCouponVo>> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type) {
return CzgResult.success(couponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type));
}
}

View File

@@ -1,33 +0,0 @@
package com.czg.controller.user;
import com.czg.account.dto.ShopActivateDTO;
import com.czg.account.service.ShopActivateService;
import com.czg.resp.CzgResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 用户店铺充值活动管理
*
* @author ww
*/
@RestController
@RequestMapping("/user/activate")
public class UserShopActivateController {
@Resource
private ShopActivateService shopActivateService;
/**
* 店铺充值活动列表
*/
@GetMapping
public CzgResult<List<ShopActivateDTO>> detail(@RequestParam(required = false) Long shopId) {
return CzgResult.success(shopActivateService.getList(shopId));
}
}

View File

@@ -1,51 +0,0 @@
package com.czg.controller.user;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.service.ShopCouponService;
import com.czg.account.vo.UserCouponVo;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.AssertUtil;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺优惠券
*
* @author ww
* @description
*/
@RestController
@RequestMapping("/user/coupon")
public class UserShopCouponController {
@Resource
private ShopCouponService couponService;
/**
* 通过用户Id 查找优惠券
*
* @param status 0 未使用 1已使用 2已过期
*/
@GetMapping("/findByUserId")
public CzgResult<Page<ShopActivateCouponRecord>> findByUserId(
@RequestParam(required = false) Integer status,
@RequestParam(required = false) Long shopId) {
return CzgResult.success(couponService.find(StpKit.USER.getLoginIdAsLong(), shopId, status));
}
/**
* 生成订单后使用
* 通过用户Id 查找优惠券
*
* @param shopUserId 店铺用户Id
*/
@GetMapping("/findCoupon")
public CzgResult<List<UserCouponVo>> findCoupon(@RequestHeader String shopId, @RequestParam Long shopUserId, @RequestParam(required = false) Integer type) {
AssertUtil.isBlank(shopId, "店铺Id不能为空");
return CzgResult.success(couponService.findCoupon(Long.parseLong(shopId), shopUserId, type));
}
}