2 changed files with 67 additions and 37 deletions
@ -0,0 +1,66 @@ |
|||||
|
package com.yxt.yyth.biz.scheduled; |
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag; |
||||
|
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard; |
||||
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo; |
||||
|
import com.yxt.yyth.biz.lpkgiftbag.LpkGiftBagService; |
||||
|
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
|
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/20 10:44 |
||||
|
*/ |
||||
|
|
||||
|
public class scheduledRest { |
||||
|
@Autowired |
||||
|
LpkGiftBagService lpkGiftBagService; |
||||
|
@Autowired |
||||
|
LpkGiftCardService lpkGiftCardService; |
||||
|
// @Scheduled(cron = "0 0 1 * * ? ")
|
||||
|
public void updateIsItInvalid(String customerSid) { |
||||
|
// ResultBean rb = new ResultBean();
|
||||
|
// List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>());
|
||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
// for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
|
||||
|
// int in = DateUtil.parse(sdf.format(lpkGiftBag.getDateEnd())).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
|
// if (String.valueOf(in).equals("-1")) {
|
||||
|
// Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
|
// if (i != 0) {
|
||||
|
// baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
|
// }
|
||||
|
// } else {
|
||||
|
// List<LpkGiftCard> list = baseMapper.selectList(new QueryWrapper<LpkGiftCard>().eq("customerSid", customerSid).eq("giftbagSid", lpkGiftBag.getSid()));
|
||||
|
// for (LpkGiftCard card : list) {
|
||||
|
// LpkReserveOrderVo LpkReserveOrderVo = lpkReserveOrderService.selByCardSid(card.getSid()).getData();
|
||||
|
// if (null != LpkReserveOrderVo) {
|
||||
|
// int c = DateUtil.parse(sdf.format(LpkReserveOrderVo.getReserveDate())).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
|
//// LpkGiftCard card1 = baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("sid", card.getSid()));
|
||||
|
// if (String.valueOf(c).equals("-1")) {
|
||||
|
// card.setIsReservation("1");
|
||||
|
// baseMapper.updateById(card);
|
||||
|
// }
|
||||
|
// }
|
||||
|
// }
|
||||
|
// }
|
||||
|
// }
|
||||
|
//
|
||||
|
//// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
//// List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>().lt("dateEnd", sdf.format(new Date())));
|
||||
|
//// for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
|
||||
|
//// Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
|
//// if (i != 0) {
|
||||
|
//// baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
|
//// }
|
||||
|
//// }
|
||||
|
// return rb.success();
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue