this is 3.24 update
This commit is contained in:
parent
8aa02ca97d
commit
b2eef9a436
|
@ -4,9 +4,11 @@ import cn.hutool.core.date.DateUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.cultural.heritage.annotation.AuthCheck;
|
import com.cultural.heritage.annotation.AuthCheck;
|
||||||
import com.cultural.heritage.common.BaseResponse;
|
import com.cultural.heritage.common.BaseResponse;
|
||||||
|
import com.cultural.heritage.common.ErrorCode;
|
||||||
import com.cultural.heritage.common.ResultUtils;
|
import com.cultural.heritage.common.ResultUtils;
|
||||||
import com.cultural.heritage.constant.OrderStatusConstant;
|
import com.cultural.heritage.constant.OrderStatusConstant;
|
||||||
import com.cultural.heritage.constant.UserConstant;
|
import com.cultural.heritage.constant.UserConstant;
|
||||||
|
import com.cultural.heritage.exception.ThrowUtils;
|
||||||
import com.cultural.heritage.model.entity.*;
|
import com.cultural.heritage.model.entity.*;
|
||||||
import com.cultural.heritage.model.vo.clothes.ClothesLabelVO;
|
import com.cultural.heritage.model.vo.clothes.ClothesLabelVO;
|
||||||
import com.cultural.heritage.model.vo.good.GoodLabelVO;
|
import com.cultural.heritage.model.vo.good.GoodLabelVO;
|
||||||
|
@ -27,12 +29,11 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -82,6 +83,12 @@ public class GlobalController {
|
||||||
private ClothesRentOrderService clothesRentOrderService;
|
private ClothesRentOrderService clothesRentOrderService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
// 节日集合的键
|
||||||
|
private static final String COUPON_PRICER_KEY = "couponPrice";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -292,4 +299,37 @@ public class GlobalController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web端管理员修改商品优惠价格参数
|
||||||
|
* @return 当前类别的商品列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/update/coupon/price")
|
||||||
|
@Operation(summary = "web端管理员修改商品优惠价格参数", description = "参数:无,方法名:updateCouponPrice")
|
||||||
|
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
|
public BaseResponse<Boolean> updateCouponPrice(@RequestParam BigDecimal bigDecimal) {
|
||||||
|
|
||||||
|
redisTemplate.opsForValue().set(COUPON_PRICER_KEY, bigDecimal.toString());
|
||||||
|
|
||||||
|
return ResultUtils.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web端(小程序端)查看商品优惠价格参数
|
||||||
|
* @return 当前类别的商品列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/query/coupon/price")
|
||||||
|
@Operation(summary = "web端(小程序端)查看商品优惠价格参数", description = "参数:无,方法名:queryCouponPrice")
|
||||||
|
public BaseResponse<Object> queryCouponPrice() {
|
||||||
|
|
||||||
|
String couponPrice = (String) redisTemplate.opsForValue().get(COUPON_PRICER_KEY);
|
||||||
|
ThrowUtils.throwIf(couponPrice == null, ErrorCode.OPERATION_ERROR, "参数不存在");
|
||||||
|
return ResultUtils.success(new BigDecimal(couponPrice).setScale(2, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user