New file |
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackGiveRecordService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | @Component
|
| | | public class RedPackJob {
|
| | |
|
| | | @Resource
|
| | | private RedPackGiveRecordService redPackGiveRecordService;
|
| | | |
| | | /**
|
| | | * 每天一个小时更新退回
|
| | | */
|
| | | @Scheduled(cron = "0 0 0/1 * * ? ")
|
| | | public void overdue() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | |
| | | try {
|
| | | for (int i = 0; i < 100; i++) {
|
| | | List<RedPackGiveRecord> overdueList = redPackGiveRecordService.overdueList(500);
|
| | | if (overdueList == null || overdueList.size() == 0) {
|
| | | break;
|
| | | }
|
| | | redPackGiveRecordService.overdue(overdueList);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|