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.UserSystemCouponGiveRecord;
|
import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
|
import com.yeshi.fanli.util.Constant;
|
|
@Component
|
public class UserSystemCouponJob {
|
|
@Resource
|
private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
|
|
|
/**
|
* 每天00:10 赠送退回已过期淘礼金
|
*/
|
@Scheduled(cron = "0 10 0 * * ? ")
|
public void giveSendBack() {
|
if (!Constant.IS_TASK)
|
return;
|
|
for (int i = 0; i < 100; i++) {
|
List<UserSystemCouponGiveRecord> overdueList = userSystemCouponGiveRecordService.overdueList(500);
|
if (overdueList == null || overdueList.size() == 0) {
|
break;
|
}
|
|
for (UserSystemCouponGiveRecord record: overdueList) {
|
|
UserSystemCouponGiveRecord updateRecord = new UserSystemCouponGiveRecord();
|
updateRecord.setId(record.getId());
|
updateRecord.setState(UserSystemCouponGiveRecord.STATE_OVERDUE);
|
userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateRecord);
|
}
|
}
|
}
|
}
|