StrategyModelTestTaskSigned.java 1.79 KB
package com.ruoyi.service.impl;

import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.web.response.ModelTestTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class StrategyModelTestTaskSigned implements StrategyModelTestTask, InitializingBean {

    @Autowired
    private ApplicationContext applicationContext;

    @Autowired
    private StrategyModelTestTaskContext strategyModelTestTaskContext;

    @Override
    public List<ModelTestTaskViewResponse> doView(ModelTestTask modelTestTask) {
        throw new ServiceException("能查看一个已确认的任务", HttpStatus.ERROR);
    }

    @Override
    public void doStartTest(ModelTestTask modelTestTask) {
        throw new ServiceException("不能开始一个已确认的任务", HttpStatus.ERROR);
    }

    @Override
    public void doConfirmTest(ModelTestTask modelTestTask) {
        throw new ServiceException("不能确认一个已确认的任务", HttpStatus.ERROR);
    }

    @Override
    public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl, List<Long> testScenarioList) {
        throw new ServiceException("能提交一个已确认的任务", HttpStatus.ERROR);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        strategyModelTestTaskContext.putResource(ModelTestTask.TASK_STATUS_SIGNED, applicationContext.getBean(this.getClass()));
    }
}