|
@@ -0,0 +1,80 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\api\business;
|
|
|
+
|
|
|
+use app\api\model\Ccjc;
|
|
|
+use app\api\model\Jgry;
|
|
|
+use app\api\model\TestModel;
|
|
|
+use app\api\model\Undertake;
|
|
|
+use app\common\lib\auth\JwtAuth;
|
|
|
+
|
|
|
+class TaskInformationBus
|
|
|
+{
|
|
|
+
|
|
|
+ private $uid;
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $jwtAuth= JwtAuth::getInstance(); //实例化jwtAuth
|
|
|
+ $this->uid = $jwtAuth->getUid(); //setRybh是在middleware/jwtAuth中完成的
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getTaskDetail($task_id,$pageNum=1,$pageSize=null)
|
|
|
+ {
|
|
|
+ //任务信息
|
|
|
+ $task_info = (new Ccjc())->getTaskInfoByTaskID($task_id);
|
|
|
+ $task_releaser_info = (new Jgry())->getJgryInfoByRymc($task_info['releaser']);
|
|
|
+ //获取uid下创建的所有模型信息
|
|
|
+ if (isset($task_info['test_model_id'])) {
|
|
|
+ $task_product_info = (new TestModel())->getProductInfo($task_info['test_model_id']);
|
|
|
+ $task_pesticides_info = (new TestModel())->getPesticidesInfo($task_info['test_model_id']);
|
|
|
+ $task_model_info=(new TestModel())->getModelInfoByModelID($task_info['test_model_id']);
|
|
|
+
|
|
|
+ }else{
|
|
|
+ $task_product_info ='';
|
|
|
+ $task_pesticides_info='';
|
|
|
+ $task_model_info='';
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = [
|
|
|
+ 'taskInfo'=>$task_info,
|
|
|
+ 'releaserInfo'=>$task_releaser_info,
|
|
|
+ 'product'=>$task_product_info,
|
|
|
+ 'pesticides'=>$task_pesticides_info,
|
|
|
+ 'modelInfo'=>$task_model_info,
|
|
|
+
|
|
|
+ ];
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取抽样任务列表
|
|
|
+ public function getSampleTaskList($task_id,$pageNum=1,$pageSize=null)
|
|
|
+ {
|
|
|
+ $uid = $this->uid;
|
|
|
+ $where = ['bear_id', '=', $uid];
|
|
|
+ $sample_task_list = (new Undertake())->selectByTaskIdAndWhere($task_id,$where,$pageNum,$pageSize);
|
|
|
+ $count = (new Undertake())->countByTaskIdAndWhere($task_id,$where);
|
|
|
+ return ['rows'=>$sample_task_list,'count'=>$count];
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取检测任务列表
|
|
|
+ public function getCheckTaskList($task_id,$pageNum=1,$pageSize=null)
|
|
|
+ {
|
|
|
+ $uid = $this->uid;
|
|
|
+ $where = ['check_id', '=', $uid];
|
|
|
+ $sample_task_list = (new Undertake())->selectByTaskIdAndWhere($task_id,$where,$pageNum,$pageSize);
|
|
|
+ $count = (new Undertake())->countByTaskIdAndWhere($task_id,$where);
|
|
|
+ return ['rows'=>$sample_task_list,'count'=>$count];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取报告上传任务列表
|
|
|
+ public function getReportTaskList($task_id,$pageNum=1,$pageSize=null)
|
|
|
+ {
|
|
|
+ $uid = $this->uid;
|
|
|
+ $where = ['report_id', '=', $uid];
|
|
|
+ $sample_task_list = (new Undertake())->selectByTaskIdAndWhere($task_id,$where,$pageNum,$pageSize);
|
|
|
+ $count = (new Undertake())->countByTaskIdAndWhere($task_id,$where);
|
|
|
+ return ['rows'=>$sample_task_list,'count'=>$count];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|