Commit e33fb70c authored by gaoyingwei's avatar gaoyingwei

修改 定时

parent bc9e1526
package org.rcisoft.core.schedule;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.cmsActivity.dao.CmsActivityRepository;
import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Component
@Slf4j
public class ActivitySyncSchedule {
@Autowired
private CmsActivityRepository activityInfoRepository;
//定时同步活动状态结束
// @Scheduled(cron = "0 0/10 * * * ?")
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public void execute() {
// 查询DB中的未删除的活动
QueryWrapper<CmsActivity> wrapper = new QueryWrapper<>();
wrapper.eq("del_flag",0);
List<CmsActivity> list = activityInfoRepository.selectList(wrapper);
for (CmsActivity activityInfo : list) {
//如果活动结束时间已过,改状态为已过期
if (activityInfo.getEndTime().before(new Date())) {
CmsActivity info = new CmsActivity();
info.setBusinessId(activityInfo.getBusinessId());
// info.setStatus(2);
// activityInfoRepository.updateById(info);
}
}
}
}
package org.rcisoft.core.schedule; package org.rcisoft.core.schedule;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jdom.JDOMException;
import org.rcisoft.business.cmsOrder.service.impl.CmsOrderServiceImpl;
import org.rcisoft.business.memInfo.bean.MemberInfoRedisBean; import org.rcisoft.business.memInfo.bean.MemberInfoRedisBean;
import org.rcisoft.business.memInfo.dao.MemInfoRepository; import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemLikeDTO; import org.rcisoft.business.memInfo.entity.MemLikeDTO;
...@@ -13,6 +15,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -13,6 +15,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -23,6 +27,8 @@ public class ScheduleTasks { ...@@ -23,6 +27,8 @@ public class ScheduleTasks {
@Autowired @Autowired
private MemInfoServiceImpl memInfoService; private MemInfoServiceImpl memInfoService;
@Autowired
private CmsOrderServiceImpl orderService;
/** /**
* 用户点赞数据定时任务 将点赞数据同步到对应的表中 * 用户点赞数据定时任务 将点赞数据同步到对应的表中
...@@ -32,4 +38,58 @@ public class ScheduleTasks { ...@@ -32,4 +38,58 @@ public class ScheduleTasks {
public void userLikeSchedule() { public void userLikeSchedule() {
memInfoService.userLikeSchedule(); memInfoService.userLikeSchedule();
} }
/**
* redis订单落库
*/
@Scheduled(cron = "0 0/1 * * * ?")
public void executeInsertOrder() throws NoSuchAlgorithmException {
orderService.executeInsertOrder();
}
/**
* redis订单关闭
*/
@Scheduled(cron = "0 0/1 * * * ?")
public void executeCloseOrder() throws NoSuchAlgorithmException {
orderService.executeCloseOrder();
}
/**
* 支付确认补救
*/
@Scheduled(cron = "0 0/15 * * * ?")
public void executePayOrder() throws IOException, JDOMException {
orderService.executePayOrder();
}
/**
* 退款接口调用补救
*/
@Scheduled(cron = "0 0/30 * * * ?")
public void executeRefundOrder() {
orderService.executeRefundOrder();
}
/**
* 退款确认补救
*/
@Scheduled(cron = "0 0/30 * * * ?")
public void executeRefundConfirmOrder() throws IOException, JDOMException {
orderService.executeRefundConfirmOrder();
}
/**
* 订单缓存清除
*/
@Scheduled(cron = "0 0 1 * * ?")
public void executeDeleteOrder() {
orderService.executeDeleteOrder();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment