This commit is contained in:
chenbo 2023-11-13 16:36:52 +08:00
parent 75d3818820
commit 4c39f93728

View File

@ -2726,15 +2726,13 @@ class TaskLogic extends BaseLogic
$stageDayCount = bcadd($taskTemplateInfo['stage_day_one'], $taskTemplateInfo['stage_day_two']);
$villageCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
$task = Task::where('id', $taskSchedulePlan['task_id'])->find();
// 村地区码与村管理公司一样且在村管理公司负责小队中
$groupServiceCompanyList = Company::where(['village' => $villageCompany['village'], 'company_type'=> 18])->whereIn('brigade', $villageCompany['responsible_area'])->select()->toArray();
// 村地区码与村管理公司一样
$groupServiceCompanyList = Company::where(['village' => $villageCompany['village'], 'company_type'=> 18, 'is_contract'=>1])->select()->toArray();
// 任务累计天数 < 第一阶段+第二阶段 刷新任务
if ($dayCount < $stageDayCount) {
self::flushTaskTime($taskSchedulePlan);
return true;
}
// 任务累计天数 = 第一阶段+第二阶段 任务判定,计算金额,结算分润
if ($dayCount == $stageDayCount) {
$totalMoney = bcadd(bcmul($taskTemplateInfo['stage_day_one'], $taskTemplateInfo['money'], 2), bcmul($taskTemplateInfo['stage_day_two'], $taskTemplateInfo['money_two'], 2), 2) ;
@ -2742,13 +2740,14 @@ class TaskLogic extends BaseLogic
$groupServiceCompanyCount = count($groupServiceCompanyList);
$rate = bcdiv($groupServiceCompanyCount, $target, 2);
if (bccomp($rate, 0.5, 2) == -1) {
self::flushTaskTime($taskSchedulePlan);
(new Task())->closeTask($taskSchedulePlan['task_id']);
return true;
}
if (bccomp($rate, 0.5, 2) == 0 || bccomp($rate, 0.5, 2) == 1 || bccomp(0.8, $rate, 2) == 1) {
$taskMoney = bcmul($totalMoney, bcmul($rate, 0.6, 2), 2);
}
if (bccomp($rate, 0.8, 2) == 0 || bccomp($rate, 0.8, 2)) {
if (bccomp($rate, 0.8, 2) == 0 || bccomp($rate, 0.8, 2) == 1) {
$taskMoney = bcmul($totalMoney, bcmul($rate, 1, 2), 2);
}
$task['money'] = $taskMoney;