无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -97,10 +97,16 @@
    @Resource
    private CouponCityService cityService;
    @Autowired
    @Resource
    private AppUserClient appUserClient;
    @Autowired
    @Resource
    private StudentClient studentClient;
    /**
     * 查询注册赠送优惠券 判断当前优惠券限领数量
@@ -122,8 +128,7 @@
            // 优惠券已领取数量
            int couponId = ucService.count(new QueryWrapper<UserCoupon>().eq("couponId", coupon.getId()));
            // 用户已领取该优惠券数量
            int count = ucService.count(new QueryWrapper<UserCoupon>().eq("couponId", coupon.getId()
            ).eq("userId", userId));
            int count = ucService.count(new QueryWrapper<UserCoupon>().eq("couponId", coupon.getId()).eq("userId", userId));
            if (couponId >= quantityIssued) {
                continue;
            }
@@ -184,6 +189,17 @@
            return null;
        }
    }
    @ResponseBody
    @PostMapping("/coupon/queryUserCouponById")
    public Integer queryUserCouponById(@RequestBody Long id) {
        try {
            Integer couponId = userCouponService.getById(id).getCouponId();
            return couponId;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    @Autowired
@@ -228,7 +244,7 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<List<CouponPackageResp>> queryAppuserCouponList(CouponPackageReq req) {
    public ResultUtil<List<CouponPackageResp>> queryCouponPackage(CouponPackageReq req) {
        try {
            Integer uid = tokenUtil.getUserIdFormRedis();
            if (null == uid) {
@@ -320,11 +336,16 @@
        }
        if (ofSearch.getStoreId() != null || ofSearch.getStoreIds().size() != 0) {
            for (Map<String, Object> map : mapList1) {
                if (map.get("cityManagerId").equals(ofSearch.getOperatorId())){
                    mapList.add(map);
                    continue;
                }
                // 如果当前登陆人是运营商 只能查看平台添加的优惠券应只展示使用范围为全国通用、
                // 指定城市有运营商管辖的、指定门店有运营商旗下门店
                if (ofSearch.getObjType() == 2) {
                    if (Integer.parseInt(String.valueOf(map.get("useScope"))) == 1) {
                        mapList.add(map);
                        continue;
                    }
                    if (Integer.parseInt(String.valueOf(map.get("useScope"))) == 2) {
                        // 获取到优惠券id 查询这个优惠券指定了哪些城市
@@ -786,8 +807,7 @@
    @PostMapping("/base/coupon/listRecord")
    @ResponseBody
    public List<Map<String, Object>> listRecord(@RequestBody CouponRecordQuery ofSearch) {
        Page<Object> objectPage = new Page<>(ofSearch.getOffset(), ofSearch.getLimit());
        return couponService.listRecord(objectPage, ofSearch.getId(), ofSearch.getIds(), ofSearch.getType());
        return couponService.listRecord(ofSearch.getId(), ofSearch.getIds(), ofSearch.getType());
    }