嗨森逛服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hai-server/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java

49 lines
1.4 KiB

package com.hai.schedule;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGoldRec;
import com.hai.entity.HighOrder;
import com.hai.service.BsIntegralRebateService;
import com.hai.service.HighGoldRecService;
import com.hai.service.HighUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Configuration
public class HighIntegralSchedule {
private static final Logger log = LoggerFactory.getLogger(HighIntegralSchedule.class);
@Resource
private HighGoldRecService highGoldRecService;
@Resource
private HighUserService highUserService;
@Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次
public void integralRebateOrder() {
List<HighGoldRec> list = highGoldRecService.selectByExpiringSoonByAll(365);
for (HighGoldRec goldRec : list) {
highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(), 2, 5, goldRec.getResId() , "积分过期" );
goldRec.setStatus(9);
goldRec.setUpdateTime(new Date());
highGoldRecService.updateGoldRec(goldRec);
}
}
}