Compare commits
2 Commits
5874571200
...
cd7d23d348
| Author | SHA1 | Date | |
|---|---|---|---|
| cd7d23d348 | |||
| 0f2ecc5b7d |
@@ -1,8 +1,11 @@
|
|||||||
package com.czg.task;
|
package com.czg.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.czg.account.service.ShopTableService;
|
||||||
import com.czg.config.RedisCst;
|
import com.czg.config.RedisCst;
|
||||||
import com.czg.enums.OrderNoPrefixEnum;
|
import com.czg.enums.OrderNoPrefixEnum;
|
||||||
|
import com.czg.enums.ShopTableStatusEnum;
|
||||||
import com.czg.market.service.OrderInfoService;
|
import com.czg.market.service.OrderInfoService;
|
||||||
import com.czg.order.entity.CashierCart;
|
import com.czg.order.entity.CashierCart;
|
||||||
import com.czg.order.entity.GbOrder;
|
import com.czg.order.entity.GbOrder;
|
||||||
@@ -19,6 +22,7 @@ import com.czg.utils.CzgRandomUtils;
|
|||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -47,17 +51,24 @@ public class OTimeTask {
|
|||||||
private PayService payService;
|
private PayService payService;
|
||||||
@Resource
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
@DubboReference
|
||||||
|
private ShopTableService shopTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* order 过期
|
* order 过期
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 1 * * ? ")
|
@Scheduled(cron = "0 0 1 * * ? ")
|
||||||
public void run() {
|
public void run() {
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode())
|
||||||
|
.lt(OrderInfo::getTradeDay, DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd"));
|
||||||
|
List<OrderInfo> list = orderInfoService.list(queryWrapper);
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
list.forEach(orderInfo -> shopTableService.updateStatus(orderInfo.getShopId(), null, orderInfo.getTableCode(), ShopTableStatusEnum.IDLE.getValue()));
|
||||||
OrderInfo orderInfo = new OrderInfo();
|
OrderInfo orderInfo = new OrderInfo();
|
||||||
orderInfo.setStatus(OrderStatusEnums.CANCELLED.getCode());
|
orderInfo.setStatus(OrderStatusEnums.CANCELLED.getCode());
|
||||||
orderInfoService.update(orderInfo, QueryWrapper.create()
|
orderInfoService.update(orderInfo, queryWrapper);
|
||||||
.eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode())
|
}
|
||||||
.lt(OrderInfo::getTradeDay, DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")));
|
|
||||||
|
|
||||||
QueryWrapper cartUpdateWrapper = new QueryWrapper();
|
QueryWrapper cartUpdateWrapper = new QueryWrapper();
|
||||||
cartUpdateWrapper.lt(CashierCart::getCreateTime, DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd HH:mm:ss"))
|
cartUpdateWrapper.lt(CashierCart::getCreateTime, DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd HH:mm:ss"))
|
||||||
|
|||||||
@@ -78,9 +78,7 @@ public class ProductRpcServiceImpl implements ProductRpcService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 商品未开启库存
|
// 商品未开启库存
|
||||||
if (product.getIsStock() == SystemConstants.OneZero.ZERO) {
|
if (product.getIsStock() == SystemConstants.OneZero.ONE) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
productMapper.updateProductStockNum(dto.getProductId(), dto.getShopId(), "sub", dto.getNum());
|
productMapper.updateProductStockNum(dto.getProductId(), dto.getShopId(), "sub", dto.getNum());
|
||||||
// 记录商品库存流水
|
// 记录商品库存流水
|
||||||
ProductStockFlow flow = new ProductStockFlow();
|
ProductStockFlow flow = new ProductStockFlow();
|
||||||
@@ -102,6 +100,8 @@ public class ProductRpcServiceImpl implements ProductRpcService {
|
|||||||
if (!isLowWarnLine && NumberUtil.isLess(flow.getAfterNumber(), Convert.toBigDecimal(warnLine))) {
|
if (!isLowWarnLine && NumberUtil.isLess(flow.getAfterNumber(), Convert.toBigDecimal(warnLine))) {
|
||||||
isLowWarnLine = true;
|
isLowWarnLine = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 查询商品绑定耗材信息
|
// 查询商品绑定耗材信息
|
||||||
List<ProdConsRelation> relationList = prodConsRelationMapper.selectListByQuery(QueryWrapper.create().eq(ProdConsRelation::getProductId, dto.getProductId()));
|
List<ProdConsRelation> relationList = prodConsRelationMapper.selectListByQuery(QueryWrapper.create().eq(ProdConsRelation::getProductId, dto.getProductId()));
|
||||||
if (CollUtil.isEmpty(relationList)) {
|
if (CollUtil.isEmpty(relationList)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user