package com.ruoyi.framework.task;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.file.ExcelUtils;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.project.production.domain.TAlarmstatisticsDay;
import com.ruoyi.project.production.service.ITAlarmstatisticsDayService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.project.system.service.ISysDeptService;
import com.ruoyi.project.system.service.ISysDictTypeService;
import com.ruoyi.project.training.domain.TTrainingCompanylevel;
import com.ruoyi.project.training.domain.TTrainingHisparticipants;
import com.ruoyi.project.training.domain.TTrainingParticipants;
import com.ruoyi.project.training.mapper.TTrainingHisparticipantsMapper;
import com.ruoyi.project.training.mapper.TTrainingParticipantsMapper;
import com.ruoyi.project.training.service.ITTrainingCompanylevelService;
import com.ruoyi.project.training.service.ITTrainingHisparticipantsService;
import com.ruoyi.project.training.service.ITTrainingParticipantsService;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * 定时任务
 *
 * @author ruoyi
 */
@Component
public class CompanyLevelTask extends BaseController
{
    @Autowired
    private ITTrainingCompanylevelService tTrainingCompanylevelService;
    @Autowired
    private ITTrainingParticipantsService tTrainingParticipantsService;
    @Autowired
    private ITTrainingHisparticipantsService tTrainingHisparticipantsService;
    @Resource
    private TTrainingParticipantsMapper tTrainingParticipantsMapper;
    @Resource
    private TTrainingHisparticipantsMapper tTrainingHisparticipantsMapper;
    /**
     *
     */
    public void companyLevelTask()
    {
//        logger.info("CompanyLevelTask start============");
//        List<TTrainingParticipants> list = tTrainingParticipantsMapper.selectTTrainingParticipantsListTask(new TTrainingParticipants());
//        for (TTrainingParticipants t : list
//             ) {
//                TTrainingHisparticipants th = new TTrainingHisparticipants();
//                th.setCompanyId(t.getCompanyId());
//                th.setStaffId(t.getStaffId());
//                List<TTrainingHisparticipants> hislist = tTrainingHisparticipantsMapper.selectTTrainingHisparticipantsListTask(th);
//                if (hislist!= null && hislist.size() > 0){
//                    TTrainingHisparticipants hisparticipant = hislist.get(0);
//                    t.setBudget(hisparticipant.getBudget());
//                    t.setEndDate(hisparticipant.getEndDate());
//                    t.setStartDate(hisparticipant.getStartDate());
//                    t.setOperationScore(hisparticipant.getOperationScore());
//                    t.setScore(hisparticipant.getScore());
//                    t.setRemarks(hisparticipant.getRemarks());
//                    t.setTrainingCost(hisparticipant.getTrainingCost());
//                    t.setTrainingDuration(hisparticipant.getTrainingDuration());
//                    t.setTrainingPlace(hisparticipant.getTrainingPlace());
//                    tTrainingParticipantsService.updateTTrainingParticipants(t);
//                }
//        }

    }
}
