From c18883f498664bcef31f31bbb6e680ed0e930e10 Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期二, 23 一月 2024 17:12:14 +0800
Subject: [PATCH] zjh 2024/01/23--3

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/app/ReservationController.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/app/ReservationController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/app/ReservationController.java
index 17b0d98..19a01d9 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/app/ReservationController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/app/ReservationController.java
@@ -1,5 +1,6 @@
 package com.ltkj.web.controller.app;
 
+import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson2.JSON;
@@ -7,6 +8,7 @@
 import com.google.common.base.Joiner;
 import com.ltkj.common.core.controller.BaseController;
 import com.ltkj.common.core.domain.AjaxResult;
+import com.ltkj.common.task.TaskService;
 import com.ltkj.common.utils.StringUtils;
 import com.ltkj.framework.config.MatchUtils;
 import com.ltkj.framework.config.UserHoder;
@@ -16,6 +18,7 @@
 import com.ltkj.mall.service.IMallTimeConfigService;
 import com.ltkj.system.service.ISysConfigService;
 import com.ltkj.web.config.redis.OrderDelayService;
+import com.ltkj.web.config.task.TjReservationTask;
 import com.ltkj.web.wxUtils.WxUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -55,8 +58,10 @@
     private IMallTimeConfigService mallTimeConfigService;
     @Resource
     private ISysConfigService configService;
-    @Resource
-    private OrderDelayService delayService;
+//    @Resource
+//    private OrderDelayService delayService;
+    @Autowired
+    private TaskService taskService;
 
     @PostMapping
     @ApiOperation(value = "涓汉棰勭害")
@@ -105,7 +110,9 @@
             tjReservation.setProIds(join);
         }
         if (reservationService.save(tjReservation)) {
-            delayService.reservation(tjReservation.getId());
+
+            taskService.addTask(new TjReservationTask(tjReservation.getId(),
+                    DateUtil.between(new Date(),DateUtil.endOfDay(tjReservation.getReservationTime()), DateUnit.MS)));
 
             TjCustomer one = customerService.getOne(new LambdaQueryWrapper<TjCustomer>().eq(TjCustomer::getCusIdcard,tjReservation.getIdCard()));
             if(null !=one){
@@ -210,6 +217,7 @@
         if (reservation.getId()==null){
             return AjaxResult.success("鍑洪敊浜嗭紝璇疯仈绯诲伐浣滀汉鍛橈紒");
         }
+        taskService.removeTask(new TjReservationTask(reservation.getId()));
         TjReservation one = reservationService.getById(reservation.getId());
         if (null != one) {
             String isPays = configService.selectConfigByKey("isPay");
@@ -226,6 +234,7 @@
 
             transitionService.deletedTbTransitionByCusId(reservation.getIdCard());
             reservationService.removeById(one);
+
 
             //鍙戣鍗曚俊鎭粰wx璁㈤槄鏈嶅姟娑堟伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�攕tart鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��
             Map<String, Object> res = new HashMap<>();
@@ -333,7 +342,12 @@
             mallTimeConfigService.updateById(config1);
 
             one.setReservationTime(tjReservation.getReservationTime());
-            reservationService.updateById(one);
+            if (reservationService.updateById(one)) {
+                taskService.removeTask(new TjReservationTask(tjReservation.getId()));
+                taskService.addTask(new TjReservationTask(tjReservation.getId(),
+                        DateUtil.between(new Date(),DateUtil.endOfDay(tjReservation.getReservationTime()), DateUnit.MS)));
+            }
+
             return AjaxResult.success("鎿嶄綔鎴愬姛");
         }
         return AjaxResult.error("棰勭害涓嶅瓨鍦ㄦ垨宸茶秴鏃� 涓嶅彲淇敼!");

--
Gitblit v1.8.0