<?php
/**
 *
 *User:Administrator
 *Date:2021/10/12
 */

namespace app\api\controller\v1;

//承担单位
use app\api\business\UndertakerTaskBus;

class Undertaker
{
    private $UndertakerTaskBus;

    public function __construct()
    {
        $this->UndertakerTaskBus = new UndertakerTaskBus();
    }
    public function createUnderTaker()
    {
        $data = [
            'task_id' => request()->param('task_id','','int'),
            'bear_id' => request()->param('bear_id','','int'),//抽样机构
            'check_id' => request()->param('check_id','','int'),//检测机构
            'report_id' => request()->param('report_id','','int'),//报告上传单位
            'address' => request()->param('address','','trim'),//抽样地址
            'upload_time' => request()->param('uploadtime'),//报告上传时间
            'sample_number' => request()->param('sample_number'),//样本数量
        ];
        $result = $this->UndertakerTaskBus->createUnderTakerInfo($data);
        return showSuccess($result);
    }

    public function deleteUnderTaskList()
    {
        $del_arr = request()->param('delarr', '', 'trim');
        $result = $this->UndertakerTaskBus->deleteUnderTaker($del_arr);
        return showSuccess($result);
    }

    public function selectUndertakerTaskList()
    {
        $task_class = request()->param('task_class','例行监测','trim');
        $pageNum = request()->param('pageNum',1,'int');
        $pageSize = request()->param('pageSize',10,'int');
        $data=[
            'year'=>request()->param('year','','trim'),//年度
            'ispublic'=>request()->param('ispublic','','trim'),//任务状态：0：未发布，1：执行中，2：已结束未完成，3：已结束已完成
            'starttime' => request()->param('starttime','','trim'),//任务开始时间
            'endtime' => request()->param('endtime','','trim'),//任务结束时间
            'task_name' => request()->param('task_name','','trim'),//任务名称
        ];
        $result = $this->UndertakerTaskBus->selectUndertakerTaskList($task_class,$pageNum,$pageSize,$data);
        return showSuccess($result);
    }
}