Browse Source

Merge remote-tracking branch 'origin/master'

lt14 7 years ago
parent
commit
9a518bba50

+ 13 - 0
sql/cinema.sql

@@ -357,3 +357,16 @@ UNLOCK TABLES;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 
 -- Dump completed on 2019-04-24 21:20:52
 -- Dump completed on 2019-04-24 21:20:52
+
+-- 定时任务
+show variables like '%sche%';
+set global event_scheduler =1;
+CREATE PROCEDURE cancel ()
+  update ticket SET  state =2 WHERE minute(timediff(now(),time))>15 and state=0;
+create event if not exists e_cancel
+  on schedule every 30 second
+  on completion preserve
+do call cancel();
+
+alter event e_cancel ON
+COMPLETION PRESERVE ENABLE;

+ 1 - 0
src/main/java/com/example/cinema/blImpl/sales/TicketServiceImpl.java

@@ -136,6 +136,7 @@ public class TicketServiceImpl implements TicketService {
                 TicketWithScheduleVO vo=ticket.getWithScheduleVO();
                 TicketWithScheduleVO vo=ticket.getWithScheduleVO();
                 ScheduleItem scheduleItem=scheduleMapper.selectScheduleById(ticket.getScheduleId());
                 ScheduleItem scheduleItem=scheduleMapper.selectScheduleById(ticket.getScheduleId());
                 vo.setSchedule(scheduleItem);
                 vo.setSchedule(scheduleItem);
+                vo.setTime(ticket.getTime());
                 return vo;
                 return vo;
             }).collect(Collectors.toList());
             }).collect(Collectors.toList());
             return ResponseVO.buildSuccess(vos);
             return ResponseVO.buildSuccess(vos);

+ 13 - 0
src/main/java/com/example/cinema/po/Ticket.java

@@ -3,6 +3,8 @@ package com.example.cinema.po;
 import com.example.cinema.vo.TicketVO;
 import com.example.cinema.vo.TicketVO;
 import com.example.cinema.vo.TicketWithScheduleVO;
 import com.example.cinema.vo.TicketWithScheduleVO;
 
 
+import java.sql.Timestamp;
+
 /**
 /**
  * Created by liying on 2019/4/16.
  * Created by liying on 2019/4/16.
  */
  */
@@ -35,6 +37,16 @@ public class Ticket {
      */
      */
     private int state;
     private int state;
 
 
+    private Timestamp time;
+
+    public Timestamp getTime() {
+        return time;
+    }
+
+    public void setTime(Timestamp time) {
+        this.time = time;
+    }
+
     public Ticket() {
     public Ticket() {
     }
     }
 
 
@@ -61,6 +73,7 @@ public class Ticket {
                 stateString = "未完成";
                 stateString = "未完成";
         }
         }
         vo.setState(stateString);
         vo.setState(stateString);
+        vo.setTime(time);
         return vo;
         return vo;
 
 
     }
     }

+ 12 - 0
src/main/java/com/example/cinema/vo/TicketVO.java

@@ -1,5 +1,7 @@
 package com.example.cinema.vo;
 package com.example.cinema.vo;
 
 
+import java.sql.Timestamp;
+
 /**
 /**
  * Created by liying on 2019/4/16.
  * Created by liying on 2019/4/16.
  */
  */
@@ -31,6 +33,16 @@ public class TicketVO {
      */
      */
     private String state;
     private String state;
 
 
+    private Timestamp time;
+
+    public Timestamp getTime() {
+        return time;
+    }
+
+    public void setTime(Timestamp time) {
+        this.time = time;
+    }
+
     public TicketVO() {
     public TicketVO() {
     }
     }
 
 

+ 14 - 0
src/main/java/com/example/cinema/vo/TicketWithScheduleVO.java

@@ -1,5 +1,7 @@
 package com.example.cinema.vo;
 package com.example.cinema.vo;
 
 
+import java.sql.Timestamp;
+
 /**
 /**
  * Created by liying on 2019/4/16.
  * Created by liying on 2019/4/16.
  */
  */
@@ -31,9 +33,21 @@ public class TicketWithScheduleVO {
      */
      */
     private String state;
     private String state;
 
 
+    private Timestamp time;
+
+
+
     public TicketWithScheduleVO() {
     public TicketWithScheduleVO() {
     }
     }
 
 
+    public Timestamp getTime() {
+        return time;
+    }
+
+    public void setTime(Timestamp time) {
+        this.time = time;
+    }
+
     public int getId() {
     public int getId() {
         return id;
         return id;
     }
     }

+ 1 - 0
src/main/resources/dataImpl/sales/TicketMapper.xml

@@ -49,6 +49,7 @@
         <result column="column_index" property="columnIndex"></result>
         <result column="column_index" property="columnIndex"></result>
         <result column="row_index" property="rowIndex"></result>
         <result column="row_index" property="rowIndex"></result>
         <result column="state" property="state"></result>
         <result column="state" property="state"></result>
+        <result column="time" property="time"></result>
     </resultMap>
     </resultMap>
 
 
 </mapper>
 </mapper>