Merge remote-tracking branch 'origin/dev' into test

This commit is contained in:
Tankaikai
2024-11-20 14:14:38 +08:00
6 changed files with 32 additions and 8 deletions

View File

@@ -24,4 +24,6 @@ public interface TbPointsExchangeRecordService extends IService<TbPointsExchange
void refund(TbPointsExchangeRecord record);
Map<String, Object> total(Map<String, Object> params);
void authCancel();
}

View File

@@ -243,4 +243,14 @@ public class TbPointsExchangeRecordServiceImpl extends ServiceImpl<TbPointsExcha
return result;
}
@Override
public void authCancel() {
baseMapper.update(Wrappers.<TbPointsExchangeRecord>lambdaUpdate()
.set(TbPointsExchangeRecord::getStatus, "cancel")
.set(TbPointsExchangeRecord::getCancelOrRefundTime, new Date())
.set(TbPointsExchangeRecord::getCancelOrRefundReason, "超时未支付,系统自动取消订单")
.eq(TbPointsExchangeRecord::getStatus, "unpaid")
.last("and TIMESTAMPDIFF(MINUTE, create_time, NOW()) >= 5"));
}
}

View File

@@ -122,6 +122,14 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
param.setLeftNumber(param.getNumber());
tbShopCouponmapper.insert(param);
} else {
if (param.getNumber() != null) {
TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(param.getId());
if (param.getNumber() < tbShopCoupon.getNumber()) {
throw new BadRequestException("修改失败 发放数量不可减少");
} else {
param.setLeftNumber(param.getLeftNumber() + param.getNumber() - tbShopCoupon.getNumber());
}
}
tbShopCouponmapper.updateById(param);
}
if (CollectionUtil.isNotEmpty(param.getProducts())) {

View File

@@ -1,6 +1,7 @@
package cn.ysk.cashier.quartz.task;
import cn.ysk.cashier.dto.product.StockCountDTO;
import cn.ysk.cashier.mybatis.service.TbPointsExchangeRecordService;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
import cn.ysk.cashier.repository.order.StockCountRepository;
@@ -9,21 +10,17 @@ import cn.ysk.cashier.repository.product.TbProductSkuRepository;
import cn.ysk.cashier.service.order.TbCashierCartService;
import cn.ysk.cashier.service.order.TbOrderInfoService;
import cn.ysk.cashier.service.shop.TbShopStorageService;
import cn.ysk.cashier.utils.CacheKey;
import cn.ysk.cashier.utils.DateUtil;
import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.criteria.Predicate;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 测试用
@@ -47,6 +44,8 @@ public class TestTask {
private RedisUtils redisUtils;
@Autowired
private EntityManager entityManager;
@Autowired
private TbPointsExchangeRecordService tbPointsExchangeRecordService;
private final TbCashierCartService tbCashierCartService;
private final TbOrderInfoService orderInfoService;
@@ -101,6 +100,11 @@ public class TestTask {
orderInfoService.cancelOrder();
}
public void cancelPointsExchangeOrder(){
log.info("积分商品订单取消定时任务执行");
tbPointsExchangeRecordService.authCancel();
}
@Transactional(rollbackFor = Exception.class)
public void countStock(String str) {
String startTime = "";

View File

@@ -2107,8 +2107,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
orderInfo.setProductCouponDiscountAmount(productDiscount);
// 更新订单信息
OrderPriceDTO priceDTO = createOrderDetailWithCoupon(activateCartInfo, orderInfo, payDTO.getShopId(), false, null);
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(orderInfo.getShopId(), orderInfo.getTableId());
OrderPriceDTO priceDTO = createOrderDetailWithCoupon(activateCartInfo, orderInfo, payDTO.getShopId(), false, shopEatTypeInfoDTO);
BigDecimal finalAmount = priceDTO.getTotalAmount().multiply(BigDecimal.valueOf(payDTO.getDiscount())).setScale(2, RoundingMode.HALF_UP);
orderInfo.setUpdatedAt(System.currentTimeMillis());

View File

@@ -11,8 +11,8 @@ public class QueryReceiveVo {
private Integer userId;
private String name;
private String phone;
private Date receiveTime;
private Date useTime;
private String receiveTime;
private String useTime;
private String num;
private String overNum;
private String source;