| | |
| | | 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.bus.user.TokenRecord;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.TokenRecordService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | @Component
|
| | | public class TokenJob {
|
| | |
|
| | | @Resource
|
| | | private TokenRecordService tokenRecordService;
|
| | | |
| | | /**
|
| | | * 每天一个小时更新券
|
| | | */
|
| | | @Scheduled(cron = "0 0 0/1 * * ? ")
|
| | | public void updateCouponInfo() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | |
| | | try {
|
| | | for (int i = 0; i < 100; i++) {
|
| | | List<TokenRecord> overdueList = tokenRecordService.overdueList(500);
|
| | | if (overdueList == null || overdueList.size() == 0) {
|
| | | break;
|
| | | }
|
| | | tokenRecordService.overdue(overdueList);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | | 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.bus.user.TokenRecord; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.user.TokenRecordService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | |
| | | @Component |
| | | public class TokenJob { |
| | | |
| | | @Resource |
| | | private TokenRecordService tokenRecordService; |
| | | |
| | | /** |
| | | * 每天一个小时更新券 |
| | | */ |
| | | @Scheduled(cron = "0 0 0/1 * * ? ") |
| | | public void updateCouponInfo() { |
| | | if (!Constant.IS_TASK) |
| | | return; |
| | | |
| | | try { |
| | | for (int i = 0; i < 100; i++) { |
| | | List<TokenRecord> overdueList = tokenRecordService.overdueList(500); |
| | | if (overdueList == null || overdueList.size() == 0) { |
| | | break; |
| | | } |
| | | tokenRecordService.overdue(overdueList); |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | } |