Commit b0471a51 by caiyt

周度提交

parent eb3d0943
......@@ -176,5 +176,4 @@ public class OrderController extends BaseController {
public AjaxResult cancel(Long orderId) {
return toAjax(orderService.cancel(orderId));
}
}
......@@ -52,7 +52,6 @@ public class CouponController extends BaseController {
* 查询优惠券列表
*/
@PreAuthorize("@ss.hasPermi('coupon:list')")
@Log(title = "查询优惠券列表", businessType = BusinessType.INSERT)
@PostMapping("list")
@ApiOperation("查询优惠券列表")
public TableDataInfo listCoupon(@RequestBody CouponListPo couponListPo) {
......@@ -105,7 +104,6 @@ public class CouponController extends BaseController {
* 获取优惠券详情
*/
@PreAuthorize("@ss.hasPermi('coupon:detail')")
@Log(title = "获取优惠券详情", businessType = BusinessType.INSERT)
@GetMapping("/detail/{id}")
@ApiOperation("获取优惠券详情")
public AjaxResult detail(@PathVariable Integer id) {
......@@ -136,7 +134,7 @@ public class CouponController extends BaseController {
* 更新优惠券
*/
@PreAuthorize("@ss.hasPermi('coupon:update')")
@Log(title = "更新优惠券", businessType = BusinessType.INSERT)
@Log(title = "更新优惠券", businessType = BusinessType.UPDATE)
@PostMapping
@ApiOperation("更新优惠券")
public AjaxResult update(@RequestBody CouponPo couponPo) {
......@@ -148,7 +146,6 @@ public class CouponController extends BaseController {
* 更新优惠券预校验
*/
@PreAuthorize("@ss.hasPermi('coupon:update:check')")
@Log(title = "更新优惠券预校验", businessType = BusinessType.INSERT)
@PostMapping("/update/check/{id}")
@ApiOperation("更新优惠券预校验")
public AjaxResult checkPreUpdate(@PathVariable Integer id) {
......@@ -160,7 +157,7 @@ public class CouponController extends BaseController {
* 上架优惠券
*/
@PreAuthorize("@ss.hasPermi('coupon:online')")
@Log(title = "上架优惠券", businessType = BusinessType.INSERT)
@Log(title = "上架优惠券", businessType = BusinessType.UPDATE)
@GetMapping("/online/{id}")
@ApiOperation("上架优惠券")
public AjaxResult onlineCoupon(@PathVariable Integer id) {
......@@ -172,7 +169,7 @@ public class CouponController extends BaseController {
* 下架优惠券
*/
@PreAuthorize("@ss.hasPermi('coupon:offline')")
@Log(title = "下架优惠券", businessType = BusinessType.INSERT)
@Log(title = "下架优惠券", businessType = BusinessType.UPDATE)
@GetMapping("/offline/{id}")
@ApiOperation("下架优惠券")
public AjaxResult offlineCoupon(@PathVariable Integer id) {
......@@ -184,7 +181,7 @@ public class CouponController extends BaseController {
* 删除优惠券
*/
@PreAuthorize("@ss.hasPermi('coupon:delete')")
@Log(title = "删除优惠券", businessType = BusinessType.INSERT)
@Log(title = "删除优惠券", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
@ApiOperation("删除优惠券")
public AjaxResult deleteCoupon(@PathVariable Integer id) {
......@@ -196,7 +193,6 @@ public class CouponController extends BaseController {
* 获取当前有效的规则集合
*/
@PreAuthorize("@ss.hasPermi('coupon:list:effective')")
@Log(title = "获取当前有效的规则集合", businessType = BusinessType.INSERT)
@GetMapping("/list/effective")
@ApiOperation("获取当前有效的规则集合")
public TableDataInfo listEffective() {
......
......@@ -61,7 +61,6 @@ public class CouponUserController extends BaseController {
* 查询用户领取优惠券列表
*/
@PreAuthorize("@ss.hasPermi('coupon:user:list')")
@Log(title = "查询用户领取优惠券列表", businessType = BusinessType.INSERT)
@PostMapping("list")
@ApiOperation("查询用户领取优惠券列表")
public TableDataInfo selectCouponUserList(@RequestBody CouponUser couponUser) {
......
......@@ -59,8 +59,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
*/
public static <T> T getBean(Class<T> clz) throws BeansException
{
T result = (T) beanFactory.getBean(clz);
return result;
return beanFactory.getBean(clz);
}
/**
......
......@@ -7,6 +7,7 @@ import com.soss.common.core.domain.model.LoginUser;
import com.soss.common.enums.CouponUserState;
import com.soss.common.enums.MachineState;
import com.soss.common.exception.ServiceException;
import com.soss.common.utils.DateUtils;
import com.soss.common.utils.StringUtils;
import com.soss.common.utils.spring.SpringUtils;
import com.soss.system.constants.OrderStatusConstant;
......@@ -32,7 +33,10 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -473,24 +477,19 @@ public class OrderServiceImpl implements IOrderService {
String format = simpleDateFormat.format(new Date());
String redisKey = "shopId" + format + shopId;
RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(redisKey, SpringUtils.getBean(StringRedisTemplate.class).getConnectionFactory());
int randomValue = (int) (9 * Math.random());
while (randomValue == 0) {
randomValue = (int) (9 * Math.random());
if (redisAtomicInteger.get() == 0) {
redisAtomicInteger.set((int) (1000 * Math.random()));
LocalDateTime now = LocalDateTime.now();
LocalDateTime expireTime = DateUtils.addDaysAndGetBegin(now, 1);
long seconds = Duration.between(now, expireTime).getSeconds();
redisAtomicInteger.expire(seconds, TimeUnit.SECONDS);
}
int orderNum = randomValue;
if (0 == redisAtomicInteger.get()) {
redisAtomicInteger.set(randomValue);
} else {
orderNum = redisAtomicInteger.getAndAdd(randomValue);
if (orderNum % 999 == 0) {
orderNum = redisAtomicInteger.getAndAdd(randomValue);
}
orderNum %= 999;
int orderNum = redisAtomicInteger.addAndGet(3);
if (orderNum % 999 == 0) {
orderNum = redisAtomicInteger.addAndGet(1);
}
int orderNumTail = (int) (Math.random() * 8);
// redisAtomicInteger.expire(1, TimeUnit.DAYS);
// int andIncrement = redisAtomicInteger.getAndAdd(3);
return key + String.format("%03d", orderNum) + (orderNumTail + 1);
orderNum %= 999;
return key + String.format("%03d", orderNum);
}
//获取订单号
......
......@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update goods_category
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="icon != null and icon != ''">icon = #{icon},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="turn != null and turn != ''">turn = #{turn},</if>
<if test="state != null and state != ''">state = #{state},</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment