12/20
This commit is contained in:
@@ -146,7 +146,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
|||||||
return rb.setMsg("参数不能为空");
|
return rb.setMsg("参数不能为空");
|
||||||
}
|
}
|
||||||
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>();
|
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>();
|
||||||
updateIsItInvalid(query.getCustomerSid());
|
// updateIsItInvalid(query.getCustomerSid());
|
||||||
if (StringUtils.isNotBlank(query.getCustomerSid())) {
|
if (StringUtils.isNotBlank(query.getCustomerSid())) {
|
||||||
qw.eq("customerSid", query.getCustomerSid());
|
qw.eq("customerSid", query.getCustomerSid());
|
||||||
}
|
}
|
||||||
@@ -169,43 +169,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
|||||||
// }
|
// }
|
||||||
// return rb.success();
|
// return rb.success();
|
||||||
// }
|
// }
|
||||||
public ResultBean 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();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultBean<AppletVo> getGifCardBySid(String sid) {
|
public ResultBean<AppletVo> getGifCardBySid(String sid) {
|
||||||
ResultBean rb = new ResultBean().fail();
|
ResultBean rb = new ResultBean().fail();
|
||||||
|
|||||||
66
src/main/java/com/yxt/yyth/biz/scheduled/scheduledRest.java
Normal file
66
src/main/java/com/yxt/yyth/biz/scheduled/scheduledRest.java
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user