From 843f41c7cf93da5520bee5cd4b79a0058260fa69 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Sat, 18 Nov 2023 19:29:13 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=8D=8F=E5=8A=A9=E6=80=BB=E8=B4=9F?= =?UTF-8?q?=E8=B4=A3=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/task/TaskLogic.php | 90 +++++++++++++++++++---------- 1 file changed, 59 insertions(+), 31 deletions(-) diff --git a/app/common/logic/task/TaskLogic.php b/app/common/logic/task/TaskLogic.php index b196bdf02..a178a28b5 100644 --- a/app/common/logic/task/TaskLogic.php +++ b/app/common/logic/task/TaskLogic.php @@ -981,7 +981,7 @@ class TaskLogic extends BaseLogic // 任务累计天数第一个周期结算 if ($dayCount == $stageOneDayCount) { $rate = bcdiv($liaisonManCount, $villageCount, 2); - if (bccomp($rate, 0.5, 2) == 1) { + if (bccomp($rate, 0.5, 2) == 1 || bccomp($rate, 0.5, 2) == 0) { // 按个数结算 $taskInfo['money'] = bcmul($liaisonManCount, 120, 2); (new TownShareProfit())->dealTaskSettlementMaster5($taskInfo, $townCompany, $taskSchedulePlan); @@ -1164,24 +1164,38 @@ class TaskLogic extends BaseLogic $taskTemplateInfo = $taskSchedulePlan['template_info']; $taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find(); $townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find(); - $groupServiceCompanyList = Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(street,:responsible_area)", ['company_type' => 18,'responsible_area'=>$townCompany['responsible_area']], true); -// $groupServiceCompanyList = Company::where(['street' => $townCompany['street'], 'company_type' => 18])->select()->toArray(); $isDone = 1; // 任务是否完成标记 $isTaskSchedule = 0; // 下属小组服务公司是否有每日任务安排标记 - foreach ($groupServiceCompanyList as $groupServiceCompany) { - // 查询小组服务公司是否有对应的每日任务安排 - $templateList = TaskTemplate::where(['company_id' => $groupServiceCompany['id']])->whereIn('type', [31, 32, 33])->select()->toArray(); - // 未做任务安排的小组服务公司不在判定范围内,跳出本次循环 - if(count($templateList) === 3) { - $isTaskSchedule = 1; - // 查询小组服务公司的循环任务有没有全部做完 任意有一个任务没有做完,则判定为该小组服务公司没有完成每日任务,即协助总负责人开展工作任务也认定失败 - foreach ($templateList as $template) { - $task = Task::where(['template_id' => $template['id'], 'status' => 3])->find(); - if (empty($task)) { - $isDone = 0; - break; - } + // 负责人任务类型id列表 + $typeIds = []; + $townMasterTaskTypeList = DictData::where(['type_value' => 'town_task_type_master', 'status' => 1])->column('value', 'id'); + foreach ($townMasterTaskTypeList as $item) { + if ($item['value'] == 'town_task_type_master_3') { + $typeIds[] = $item['id']; + } + if ($item['value'] == 'town_task_type_master_4') { + $typeIds[] = $item['id']; + } + if ($item['value'] == 'town_task_type_master_5') { + $typeIds[] = $item['id']; + } + if ($item['value'] == 'town_task_type_master_8') { + $typeIds[] = $item['id']; + } + } + + // 查询 镇农科公司负责人是否有对应的每日任务安排 + $templateList = TaskTemplate::where(['company_id'=>$townCompany['id']])->whereIn('type', $typeIds)->select()->toArray(); + // 未做任务安排的小组服务公司不在判定范围内,跳出本次循环 + if(count($templateList) === 4) { + $isTaskSchedule = 1; + // 查询负责人的循环任务有没有全部做完 任意有一个任务没有做完,则判定为 协助总负责人开展工作任务 失败 + foreach ($templateList as $template) { + $task = Task::where(['template_id' => $template['id'], 'status' => 3])->find(); + if (empty($task)) { + $isDone = 0; + break; } } } @@ -2229,27 +2243,41 @@ class TaskLogic extends BaseLogic $taskTemplateInfo = $taskSchedulePlan['template_info']; $taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find(); $townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find(); - $groupServiceCompanyList = Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(street,:responsible_area)", ['company_type' => 18,'responsible_area'=>$townCompany['responsible_area']], true); -// $groupServiceCompanyList = Company::where(['street' => $townCompany['street'], 'company_type' => 18])->select()->toArray(); $isDone = 1; // 任务是否完成标记 $isTaskSchedule = 0; // 下属小组服务公司是否有每日任务安排标记 - foreach ($groupServiceCompanyList as $groupServiceCompany) { - // 查询小组服务公司是否有对应的每日任务安排 - $templateList = TaskTemplate::where(['company_id' => $groupServiceCompany['id']])->whereIn('type', [31, 32, 33])->select()->toArray(); - // 未做任务安排的小组服务公司不在判定范围内,跳出本次循环 - if(count($templateList) === 3) { - $isTaskSchedule = 1; - // 查询小组服务公司的循环任务有没有全部做完 任意有一个任务没有做完,则判定为该小组服务公司没有完成每日任务,即协助总负责人开展工作任务也认定失败 - foreach ($templateList as $template) { - $task = Task::where(['template_id' => $template['id'], 'status' => 3])->find(); - if (empty($task)) { - $isDone = 0; - break; - } + // 负责人任务类型id列表 + $typeIds = []; + $townMasterTaskTypeList = DictData::where(['type_value' => 'town_task_type_master', 'status' => 1])->column('value', 'id'); + foreach ($townMasterTaskTypeList as $item) { + if ($item['value'] == 'town_task_type_master_3') { + $typeIds[] = $item['id']; + } + if ($item['value'] == 'town_task_type_master_4') { + $typeIds[] = $item['id']; + } + if ($item['value'] == 'town_task_type_master_5') { + $typeIds[] = $item['id']; + } + if ($item['value'] == 'town_task_type_master_8') { + $typeIds[] = $item['id']; + } + } + // 查询 镇农科公司负责人是否有对应的每日任务安排 + $templateList = TaskTemplate::where(['company_id'=>$townCompany['id']])->whereIn('type', $typeIds)->select()->toArray(); + // 未做任务安排的小组服务公司不在判定范围内,跳出本次循环 + if(count($templateList) === 4) { + $isTaskSchedule = 1; + // 查询负责人的循环任务有没有全部做完 任意有一个任务没有做完,则判定为 协助总负责人开展工作任务 失败 + foreach ($templateList as $template) { + $task = Task::where(['template_id' => $template['id'], 'status' => 3])->find(); + if (empty($task)) { + $isDone = 0; + break; } } } + // 下属小组服务公司有任务安排,也完成了任务 if ($isDone === 1 && $isTaskSchedule === 1) { // 做任务结算,分润