package com.ankaibei.workFlow.webadmin.ankaibei.api;

import com.ankaibei.workFlow.webadmin.ankaibei.entity.TaskInfoEntity;
import com.ankaibei.workFlow.webadmin.ankaibei.service.TaskInfoService;
import com.ankaibei.workFlow.webadmin.ankaibei.vo.ResMsg;
import com.ankaibei.workFlow.webadmin.ankaibei.vo.TaskInfoVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lwq
 * @version 1.0
 * @description:
 * @date 2022/9/14 17:17
 */
@Service
public class TaskInfoServiceApi implements TaskInfoApi{

    @Resource
    private TaskInfoService taskInfoService;

    @Override
    public ResMsg findTaskInfo(TaskInfoVo taskInfoVo) {
         TaskInfoEntity taskInfoEntity = this.copyProperties(taskInfoVo, TaskInfoEntity.class);
        return taskInfoService.findTaskInfo(taskInfoVo.getPageIndex(),taskInfoVo.getPageSize(),taskInfoEntity);
    }

    @Override
    public ResMsg addTaskInfo(TaskInfoVo taskInfoVo) {
        TaskInfoEntity taskInfoEntity = this.copyProperties(taskInfoVo, TaskInfoEntity.class);
        return taskInfoService.addTaskInfo(taskInfoEntity,taskInfoVo.getTaskParticipant());
    }

    @Override
    public ResMsg findTaskById(TaskInfoVo taskInfoVo) {
        return taskInfoService.findTaskById(taskInfoVo);
    }

    @Override
    public ResMsg performTask(TaskInfoVo taskInfoVo) {
        TaskInfoEntity taskInfoEntity = this.copyProperties(taskInfoVo, TaskInfoEntity.class);
        return taskInfoService.performTask(taskInfoEntity);
    }

    @Override
    public ResMsg deleteTask(List<TaskInfoVo> taskInfoVos) {
        return taskInfoService.deleteTask(taskInfoVos);
    }

}
