From b87922420561a35c1e99b67fb6caf3fe30bc8ccf Mon Sep 17 00:00:00 2001 From: nickchange <126672920+nickchange@users.noreply.github.com> Date: 星期四, 16 十一月 2023 08:57:00 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java | 1 cloud-server-course/src/main/resources/mapper/CoursePackageSchedulingMapper.xml | 2 cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOtherOne.js | 5 cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_three.html | 6 + cloud-server-management/src/main/webapp/static/modular/system/tShop/tShop_info.js | 3 cloud-server-competition/src/main/resources/mapper/ParticipantMapper.xml | 5 cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_two.html | 7 + cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java | 1 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponExamineController.java | 15 ++ cloud-server-management/src/main/webapp/WEB-INF/view/system/advertisement/advertisement_add.html | 6 + cloud-server-management/src/main/webapp/static/modular/system/tCompetition/tCompetitionUser.js | 1 cloud-server-management/src/main/webapp/static/modular/system/tCouponExamine/TCouponExamine.js | 5 + cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_three.html | 6 + cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java | 34 +++--- cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_two.html | 18 ++- cloud-server-management/src/main/webapp/WEB-INF/view/system/tDiscountAudit/coursePackageDiscount.html | 14 ++ cloud-server-competition/src/main/java/com/dsh/competition/util/TaskUtilCompetition.java | 54 ++++++++++ cloud-server-other/src/main/java/com/dsh/other/util/TaskUtilCompetition.java | 66 +++++++++++++ cloud-server-management/src/main/webapp/WEB-INF/view/system/tCouponExamine/TCouponExamineInfo.html | 28 +++++ 19 files changed, 243 insertions(+), 34 deletions(-) diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/util/TaskUtilCompetition.java b/cloud-server-competition/src/main/java/com/dsh/competition/util/TaskUtilCompetition.java new file mode 100644 index 0000000..69ed9aa --- /dev/null +++ b/cloud-server-competition/src/main/java/com/dsh/competition/util/TaskUtilCompetition.java @@ -0,0 +1,54 @@ +package com.dsh.competition.util; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.dsh.competition.entity.Competition; +import com.dsh.competition.model.TCompetition; +import com.dsh.competition.service.CompetitionService; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @author shaqian + * 定时任务修改赛事状态 + */ +@Component +public class TaskUtilCompetition { + + @Resource + private CompetitionService competitionService; + + /** + * 每秒去处理的定时任务 + */ + @Scheduled(fixedRate = 30000) + public void taskMinute(){ + try { + List<Competition> list = competitionService.list(new QueryWrapper<Competition>() + .ne("status",4).ne("state",3)); + for (Competition competition : list) { + // 当前时间小于开始时间 + if (competition.getStartTime().after(new Date())){ + competition.setStatus(1); + } + if (competition.getStartTime().before(new Date())){ + if (competition.getEndTime().after(new Date())){ + competition.setStatus(2); + }else{ + competition.setStatus(3); + } + } + competitionService.updateById(competition); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + diff --git a/cloud-server-competition/src/main/resources/mapper/ParticipantMapper.xml b/cloud-server-competition/src/main/resources/mapper/ParticipantMapper.xml index 6a0430d..1c578f1 100644 --- a/cloud-server-competition/src/main/resources/mapper/ParticipantMapper.xml +++ b/cloud-server-competition/src/main/resources/mapper/ParticipantMapper.xml @@ -3,8 +3,9 @@ <mapper namespace="com.dsh.competition.mapper.ParticipantMapper"> <select id="getPeopleFromId" resultType="com.dsh.competition.feignclient.model.CompetitionUser"> select t2.id, t2.name,t2.gender sex,t2.phone ,t2.idcard idCard ,t3.payStatus state - from t_user_competition t1 left join t_participant t2 on t1.participantId = t2.id - left join t_payment_competition t3 on t1.paymentCompetitionId = t3.id + from t_user_competition t1 + left join t_participant t2 on t1.participantId = t2.id + left join t_payment_competition t3 on t1.paymentCompetitionId = t3.id where t1.competitionId =#{id} and t2.id is not null and t3.id is not null <if test="state !=null and state !='' and state ==1"> and t3.payStatus in (1,2) diff --git a/cloud-server-course/src/main/resources/mapper/CoursePackageSchedulingMapper.xml b/cloud-server-course/src/main/resources/mapper/CoursePackageSchedulingMapper.xml index dd6e830..e42f73d 100644 --- a/cloud-server-course/src/main/resources/mapper/CoursePackageSchedulingMapper.xml +++ b/cloud-server-course/src/main/resources/mapper/CoursePackageSchedulingMapper.xml @@ -19,7 +19,7 @@ <select id="queryCoursePackageSchedulingList" resultType="map"> SELECT CAST(id AS CHAR(20)) AS id, - CONCAT(DATE_FORMAT(classDate, '%Y-%m-%d %H:%i'), '-20:00') AS classDate, + CONCAT(DATE_FORMAT(classDate, '%Y-%m-%d %H:%i'), DATE_FORMAT(endDate, '%H:%i')) AS classDate, courseId, `status`, cancelClasses, diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponExamineController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponExamineController.java index 7c6107a..d4ead04 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponExamineController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponExamineController.java @@ -193,12 +193,25 @@ for (String s : productImages.split(",")) { strings.add(s); } - + model.addAttribute("integral",coupon.getIntegral()); + model.addAttribute("cash",coupon.getCash()); model.addAttribute("img",strings); Integer objectType = UserExt.getUser().getObjectType(); System.out.println(objectType); model.addAttribute("item",coupon); model.addAttribute("objectType",objectType); + Integer auditStatus = coupon.getAuditStatus(); + switch (auditStatus){ + case 1: + model.addAttribute("state","待审核"); + break; + case 2: + model.addAttribute("state","已拒绝"); + break; + case 3: + model.addAttribute("state","未通过"); + break; + } return PREFIX + "TCouponExamineInfo.html"; } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java index 0de2b02..720a211 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TDiscountController.java @@ -234,6 +234,7 @@ model.addAttribute("reasons", ""); } model.addAttribute("coursePackagePaymentConfig", JSON.toJSONString(list)); + model.addAttribute("type2",tCoursePackage.getType()); return PREFIX1 + "coursePackageDiscount.html"; } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java index 25dac6b..4f9e5a3 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java @@ -538,23 +538,23 @@ storeConfigService.saveBatch(storeConfigs); - // 添加门店 - HashMap<String, String> map1 = new HashMap<>(); - map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); - map1.put("name",tStore.getName()); - map1.put("short_name",tStore.getName()); - map1.put("location",tStore.getCity()); - map1.put("address",tStore.getAddress()); - map1.put("telephone",tStore.getPhone()); - map1.put("linkman",userName); - map1.put("business_time","[{\"start_time\":\""+tStore.getStartTime()+"\",\"close_time\":\""+tStore.getEndTime()+"\"}]"); - map1.put("logo",tStore.getCoverDrawing()); - map1.put("remark",tStore.getIntroduce()); - map1.put("lat",tStore.getLat()); - map1.put("lng",tStore.getLon()); - map1.put("space_id",tStore.getId().toString()); - String result = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpace", map1); - System.out.println(result); +// // 添加门店 +// HashMap<String, String> map1 = new HashMap<>(); +// map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); +// map1.put("name",tStore.getName()); +// map1.put("short_name",tStore.getName()); +// map1.put("location",tStore.getCity()); +// map1.put("address",tStore.getAddress()); +// map1.put("telephone",tStore.getPhone()); +// map1.put("linkman",userName); +// map1.put("business_time","[{\"start_time\":\""+tStore.getStartTime()+"\",\"close_time\":\""+tStore.getEndTime()+"\"}]"); +// map1.put("logo",tStore.getCoverDrawing()); +// map1.put("remark",tStore.getIntroduce()); +// map1.put("lat",tStore.getLat()); +// map1.put("lng",tStore.getLon()); +// map1.put("space_id",tStore.getId().toString()); +// String result = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpace", map1); +// System.out.println(result); return new SuccessTip<>(); diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java index 18ce72b..826c55e 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java @@ -474,6 +474,7 @@ site.setOperatorId(UserExt.getUser().getObjectId()); Integer integer1 = siteClient.addSite(site); + // 添加场地 HashMap<String, String> map = new HashMap<>(); map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); map.put("name",site.getName()); diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/advertisement/advertisement_add.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/advertisement/advertisement_add.html index c469402..a5f9045 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/advertisement/advertisement_add.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/advertisement/advertisement_add.html @@ -224,6 +224,7 @@ } function updateT(e) { var oneId = $('#type option:selected').text(); + var page = $('#page option:selected').text(); console.log(oneId); if (oneId!="详情"&&oneId!="指定商品"&&oneId!="指定折扣"){ @@ -232,6 +233,11 @@ }else{ $("#t3").show() } + if (page=="线上课得积分" || page=="看视频得奖励"){ + if (oneId == "列表"){ + $("#t3").show() + } + } } </script> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCouponExamine/TCouponExamineInfo.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCouponExamine/TCouponExamineInfo.html index 4cb94ef..5958b29 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCouponExamine/TCouponExamineInfo.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCouponExamine/TCouponExamineInfo.html @@ -53,12 +53,32 @@ <div class="row"> <div class="col-sm-6"> <div class="form-group"> + <label class="col-sm-3 control-label">*当前状态: </label> + + <div class="col-sm-9"> + @if(state == "待审核"){ + <h3 style="color: yellowgreen">${state}</h3> + @} + @if(state == "已拒绝"){ + <h3 style="color: green">${state}</h3> + @} + @if(state == "未通过"){ + <h3 style="color: red">${state}</h3> + @} + </div> + + + </div> + </div> + </div> + <div class="row"> + <div class="col-sm-6"> + <div class="form-group"> <label class="col-sm-3 control-label">*优惠券名称: </label> <div class="col-sm-9"> <input class="form-control" id="name" name="name" autocomplete="off" placeholder="请输入优惠券名称" value="${item.name}" readonly> </div> </div> - </div> </div> @@ -155,7 +175,7 @@ </div> </div> - + @if(cash!=null){ <div class="row" id="needAmount" > <div class="col-sm-6"> <div class="form-group"> @@ -169,6 +189,8 @@ </div> </div> @} + @} + @if(integral!=null){ <div class="row" id="needIntegral" > <div class="col-sm-6"> <div class="form-group"> @@ -181,7 +203,7 @@ </div> </div> - + @} <div class="row"> <div class="col-sm-6"> <div class="form-group"> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tDiscountAudit/coursePackageDiscount.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tDiscountAudit/coursePackageDiscount.html index 7d76ce2..262c1bc 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tDiscountAudit/coursePackageDiscount.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tDiscountAudit/coursePackageDiscount.html @@ -4,6 +4,8 @@ <div class="form-horizontal"> <div class="row"> <input type="hidden" id="id" value="${item.id}"> + <input type="hidden" id="type2" value="${type2}"> + <input type="hidden" id="coursePackagePaymentConfig" value='${coursePackagePaymentConfig}'> <div class="form-group"> <div class="col-sm-2"></div> @@ -20,7 +22,7 @@ <div class="col-sm-10"> <label class="col-sm-2 control-label">拒绝理由:</label> <div class="col-sm-4" style="margin-top: 6px;"> - <span>拒绝理由:${reasons}</span> + <span>${reasons}</span> </div> </div> </div> @@ -34,11 +36,13 @@ </div> </div> </div> + <div class="form-group"> <div class="col-sm-2"></div> <div class="col-sm-10"> <div class="col-sm-2"> </div> + <div class="col-sm-6" id="classHours" style="margin-top: 6px;"> </div> </div> @@ -124,5 +128,13 @@ ,type: 'time' ,range: true }); + $(function() { + console.log($("#type2").val()) + if ($("#type2").val()==2){ + console.log("进入") + $("#classHours").hide() + } + + }); </script> @} diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_three.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_three.html index 1277173..0d8cf0c 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_three.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_three.html @@ -92,6 +92,12 @@ }else{ $("#t3").show() } + var page = $('#page option:selected').text(); + if (page=="线上课得积分" || page=="看视频得奖励"){ + if (oneId == "列表"){ + $("#t3").show() + } + } } function updateType(e) { diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_two.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_two.html index 50c9381..3502038 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_two.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_add_two.html @@ -81,6 +81,7 @@ function updateT(e) { var oneId = $('#type option:selected').text(); + console.log(oneId); if (oneId!="详情"&&oneId!="指定商品"&&oneId!="指定折扣"){ $("#t3").hide() @@ -88,6 +89,12 @@ }else{ $("#t3").show() } + var page = $('#page option:selected').text(); + if (page=="线上课得积分" || page=="看视频得奖励"){ + if (oneId == "列表"){ + $("#t3").show() + } + } } function updateType(e) { diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_three.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_three.html index 608cc38..ebdf427 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_three.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_three.html @@ -92,6 +92,12 @@ }else{ $("#t3").show() } + var page = $('#page option:selected').text(); + if (page=="线上课得积分" || page=="看视频得奖励"){ + if (oneId == "列表"){ + $("#t3").show() + } + } } function updateType(e) { diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_two.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_two.html index 0d4ecfd..8fb9ad7 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_two.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit_two.html @@ -4,11 +4,11 @@ <div class="form-horizontal" id="carInfoForm"> <input id="id" value="${item.id}" hidden> <input id="name1" value="${item.name}" hidden> - <#avatar id="url" name="图片(推荐像素宽度316px)" avatarImg="${item.url}"/> + <#avatar id="url" name="*图片(推荐像素宽度316px)" avatarImg="${item.url}"/> <div class="input-group" style="margin-left: 342px;"> <div class="input-group-btn"> <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button"> - 跳转模块 + *跳转模块 </button> </div> <select class="form-control" id="name" style="width: 400px;" onchange="updateType(this)"> @@ -23,7 +23,7 @@ <div class="input-group" style="margin-left: 342px;" id="t1" hidden > <div class="input-group-btn"> <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button"> - 跳转页面 + *跳转页面 </button> </div> <select class="form-control" id="page" style="width: 400px;" onchange="updateOne(this)"> @@ -36,7 +36,7 @@ <div class="input-group" style="margin-left: 342px;" id="t2" > <div class="input-group-btn"> <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button"> - 跳转类型 + *跳转类型 </button> </div> <select class="form-control" id="type" style="width: 400px;" onchange="updateT(this)"> @@ -47,14 +47,14 @@ </div> <div class="form-group" id="t3" > - <label class="col-sm-3 control-label">跳转ID:</label> + <label class="col-sm-3 control-label">*跳转ID:</label> <div class="col-sm-9"> <input class="form-control" id="turnId" name="turnId" type="text" style="width: 400px;" value="${item.turnId}"> </div> </div> <div class="form-group" id="t4" > - <label class="col-sm-3 control-label">排序:</label> + <label class="col-sm-3 control-label">*排序:</label> <div class="col-sm-9"> <input class="form-control" id="sort" name="sort" type="text" style="width: 400px;" value="${item.sort}"> @@ -131,6 +131,12 @@ $("#t3").show() $("#t3").val("") } + var page = $('#page option:selected').text(); + if (page=="线上课得积分" || page=="看视频得奖励"){ + if (oneId == "列表"){ + $("#t3").show() + } + } } function updateOne(e) { diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCompetition/tCompetitionUser.js b/cloud-server-management/src/main/webapp/static/modular/system/tCompetition/tCompetitionUser.js index 7ee5659..e1b3048 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/tCompetition/tCompetitionUser.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/tCompetition/tCompetitionUser.js @@ -334,6 +334,7 @@ var state=$("#state").val() var id=$("#id").val() var ajax = new $ax(Feng.ctxPath + "/tCompetition/export", function(data){ + Feng.success("导出成功"); }); ajax.set("state",state); ajax.set("id",id); diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCouponExamine/TCouponExamine.js b/cloud-server-management/src/main/webapp/static/modular/system/tCouponExamine/TCouponExamine.js index 0ebb893..8210af7 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/tCouponExamine/TCouponExamine.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/tCouponExamine/TCouponExamine.js @@ -78,6 +78,11 @@ TCouponExamine.openExamine = function () { if (this.check()) { + var auditStatus= TCouponExamine.seItem.auditStatus; + if (auditStatus == 3){ + Feng.error("当前状态不可再次审核!"); + return ; + } var index = layer.load(1,{ type: 1 , title: '优惠券审核' diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOtherOne.js b/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOtherOne.js index 6a4c19b..65edfc8 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOtherOne.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOtherOne.js @@ -35,7 +35,10 @@ }, {title: '操作', visible: role==1?true:false, align: 'center', valign: 'middle', formatter:function (value,row) { - return '<a href="javascript:void(0);" style="color: blue" onclick="TCompetition.delete1(' + row.id +')">删除 </a> <a href="javascript:void(0);" style="color: blue" onclick="TCompetition.openTCompetitionDetail(' + row.id +')">编辑</a>' + return '<a href="javascript:void(0);" style="color: blue" ' + + 'onclick="TCompetition.delete1(' + row.id +')">删除 </a> ' + + '<a href="javascript:void(0);" style="color: blue" ' + + 'onclick="TCompetition.openTCompetitionDetail(' + row.id +')">编辑</a>' } }, ]; diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShop_info.js b/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShop_info.js index 6a6779f..4403ce4 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShop_info.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShop_info.js @@ -408,8 +408,7 @@ } }); }); - -} +}; //地图点击事件 function showInfoClick(){ map.on('click', function (e) { diff --git a/cloud-server-other/src/main/java/com/dsh/other/util/TaskUtilCompetition.java b/cloud-server-other/src/main/java/com/dsh/other/util/TaskUtilCompetition.java new file mode 100644 index 0000000..58df362 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/util/TaskUtilCompetition.java @@ -0,0 +1,66 @@ +package com.dsh.other.util; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.dsh.other.entity.SiteBooking; +import com.dsh.other.mapper.SiteBookingMapper; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author shaqian + * 定时任务修改赛事状态 + */ +@Component +public class TaskUtilCompetition { + + @Resource + private SiteBookingMapper siteBookingMapper; + + /** + * 每隔一分钟去处理的定时任务 + */ + @Scheduled(fixedRate = 60000) + public void taskMinute(){ + try { + List<SiteBooking> siteBookings = siteBookingMapper.selectList(new LambdaQueryWrapper<SiteBooking>().eq(SiteBooking::getStatus, 0)); + for (SiteBooking siteBooking : siteBookings) { + long time = siteBooking.getInsertTime().getTime(); + long l = time + 1800 * 1000; + if(System.currentTimeMillis()>l){ + siteBooking.setStatus(5); + siteBookingMapper.updateById(siteBooking); + + } + } + //定时修改赛事状态 + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + //预约场地后,时间超过endTime,状态变为已过期 + @Scheduled(fixedRate = 60000) + public void taskMinute1(){ + try { + List<SiteBooking> siteBookings = siteBookingMapper.selectList(new LambdaQueryWrapper<SiteBooking>().eq(SiteBooking::getStatus, 1)); + for (SiteBooking siteBooking : siteBookings) { + long time = siteBooking.getEndTime().getTime(); + if (System.currentTimeMillis() > time) { + siteBooking.setStatus(4); + siteBookingMapper.updateById(siteBooking); + } + + } + //定时修改赛事状态 + } catch (Exception e) { + e.printStackTrace(); + } + } + + +} -- Gitblit v1.7.1