app获取任务列表数据结构改造-协助总负责人开展工作任务
This commit is contained in:
parent
6258be966b
commit
a21da460c2
@ -6,6 +6,7 @@ use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\Approve;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyProperty;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\flow\Flow;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\task\Task;
|
||||
@ -54,11 +55,13 @@ class TaskController extends BaseApiController
|
||||
if (isset($param['status']) && $param['status'] > 0) {
|
||||
$where[] = ['status', '=', $param['status']];
|
||||
}
|
||||
$townTaskTypeList = DictData::where(['type_value' => 'town_task_type', 'status' => 1])->column('value', 'id');
|
||||
$res = Task::where($where)
|
||||
->field(['id', 'title', 'money', 'template_id', 'director_uid', 'company_id', 'start_time', 'end_time', 'director_uid', 'type', 'status', 'content', 'extend'])
|
||||
->page($page, 25)
|
||||
->order(['id' => 'desc', 'status' => 'asc'])
|
||||
->select()->toArray();
|
||||
|
||||
foreach ($res as $k => $item) {
|
||||
if ($item['type'] == 33) {
|
||||
$company = Company::where('id', $item['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade,responsible_area')->find(); // 可能要判断预存金是否满足
|
||||
@ -78,7 +81,58 @@ class TaskController extends BaseApiController
|
||||
$res[$k]['extend']['transaction'] = '';
|
||||
}
|
||||
}
|
||||
switch ($townTaskTypeList[$item['type']]){
|
||||
case 'town_task_type_1':
|
||||
// 协助总负责人开展工作任务
|
||||
$groupServiceCompanyCount = 0; // 已安排任务的小组服务公司总数
|
||||
$notDoneTaskGroupServiceCompanyCount = 0; // 未完成每日任务的小组服务公司总数
|
||||
|
||||
$townCompany = Company::where(['id' => $item['company_id']])->find();
|
||||
$groupServiceCompanyList = Company::where(['street' => $townCompany['street'], 'company_type' => 18])->select()->toArray();
|
||||
foreach ($groupServiceCompanyList as $groupServiceCompany) {
|
||||
// 小组服务公司是否有对应的每日任务安排
|
||||
$templateList = TaskTemplate::where(['company_id' => $groupServiceCompany['id']])->whereIn('type', [31, 32, 33])->select()->toArray();
|
||||
|
||||
if(count($templateList) === 3) {
|
||||
$groupServiceCompanyCount += 1;
|
||||
foreach ($templateList as $template) {
|
||||
$task = Task::where(['template_id' => $template['id'], 'status' => 3])->find();
|
||||
if (empty($task)) {
|
||||
$notDoneTaskGroupServiceCompanyCount += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$res[$k]['extend'] = ['total_group_service_company_count' => $groupServiceCompanyCount, 'not_done_task_group_service_company_count' => $notDoneTaskGroupServiceCompanyCount];
|
||||
break;
|
||||
case 'town_task_type_2':
|
||||
// 拓展小组服务团队工作任务
|
||||
|
||||
break;
|
||||
case 'town_task_type_3':
|
||||
// 督促小组服务团队完成任务,协助开展工作,解决问题任务
|
||||
|
||||
break;
|
||||
case 'town_task_type_4':
|
||||
// 督促小组服务团队学习任务
|
||||
|
||||
break;
|
||||
case 'town_task_type_5':
|
||||
// 督促小组服务团队完成需求手机和交易任务
|
||||
|
||||
break;
|
||||
case 'town_task_type_6':
|
||||
// 督促小组服务团队入股村联络员所成立的公司任务
|
||||
|
||||
break;
|
||||
case 'town_task_type_7':
|
||||
// 安全工作任务
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user