package com.ruoyi.quartz.task;

import com.ruoyi.bid.domain.BidInfo;
import com.ruoyi.bid.service.IBidInfoService;
import com.ruoyi.bid.util.BidSystemMVP3;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

import static com.ruoyi.common.utils.SecurityUtils.getUsername;

@Component("bidTask")
public class BidTask {
    @Autowired
    private IBidInfoService bidInfoService;

    public void GetBidInfo(List<String> urls)
    {
        List<BidInfo> bidInfos = BidSystemMVP3.getBidInfos("http://www.ccgp.gov.cn/cggg/zygg/index%s.htm", null);
        for (BidInfo bidInfo : bidInfos) {
            bidInfo.setCreateBy(getUsername());
            bidInfo.setCreateTime(new Date());
            bidInfoService.insertBidInfo(bidInfo);
        }

        System.out.println("执行GetBidInfo方法：" );
    }
}
