fixed
This commit is contained in:
parent
132480a46e
commit
9b558bb32d
@ -2766,7 +2766,7 @@ class TaskLogic extends BaseLogic
|
|||||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||||
$villageCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
$villageCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||||
$task = Task::where('id', $taskSchedulePlan['task_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();
|
||||||
$villageTransactionPool = $taskTemplateInfo['transaction_pool']; // 村交易池
|
$villageTransactionPool = $taskTemplateInfo['transaction_pool']; // 村交易池
|
||||||
$villageTotalTradeAmount = 0; // 村下属小组服务公司 每日实际总交易额
|
$villageTotalTradeAmount = 0; // 村下属小组服务公司 每日实际总交易额
|
||||||
$targetAmount = 0; // 村下属小组服务公司每日 目标总交易额
|
$targetAmount = 0; // 村下属小组服务公司每日 目标总交易额
|
||||||
@ -2845,7 +2845,7 @@ class TaskLogic extends BaseLogic
|
|||||||
$villageCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
$villageCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||||
$task = Task::where('id', $taskSchedulePlan['task_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) {
|
if ($dayCount < $stageDayCount) {
|
||||||
@ -2855,13 +2855,24 @@ class TaskLogic extends BaseLogic
|
|||||||
|
|
||||||
// 任务累计天数 = 第一阶段+第二阶段 任务判定,计算金额,结算分润
|
// 任务累计天数 = 第一阶段+第二阶段 任务判定,计算金额,结算分润
|
||||||
if ($dayCount == $stageDayCount) {
|
if ($dayCount == $stageDayCount) {
|
||||||
$totalMoney = bcadd(bcmul($taskTemplateInfo['stage_day_one'], $taskTemplateInfo['money'], 2), bcmul($taskTemplateInfo['stage_day_two'], $taskTemplateInfo['money_two'], 2), 2) ;
|
// 目标入股金额
|
||||||
$groupServiceCompanyCount = count($groupServiceCompanyList);
|
$targetShareholderedMoney = bcmul($target, 3000, 2);
|
||||||
$rate = bcdiv($groupServiceCompanyCount, $target, 2);
|
$companyIds = [];
|
||||||
|
foreach ($groupServiceCompanyList as $company) {
|
||||||
|
$companyIds[] = $company['id'];
|
||||||
|
}
|
||||||
|
// 已入股股金总额
|
||||||
|
$shareholderedMoney = CompanyAccountLog::where(['change_object'=>CompanyAccountLog::SHAREHOLDER, 'change_type'=>CompanyAccountLog::TASK_INC_SHAREHOLDER_MONEY])
|
||||||
|
->whereIn('company_id', $companyIds)
|
||||||
|
->sum('change_amount');
|
||||||
|
|
||||||
|
$rate = bcdiv($shareholderedMoney, $targetShareholderedMoney, 2);
|
||||||
if (bccomp($rate, 0.5, 2) == -1) {
|
if (bccomp($rate, 0.5, 2) == -1) {
|
||||||
(new Task())->closeTask($task['id']);
|
(new Task())->closeTask($task['id']);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
$totalMoney = bcadd(bcmul($taskTemplateInfo['stage_day_one'], $taskTemplateInfo['money'], 2), bcmul($taskTemplateInfo['stage_day_two'], $taskTemplateInfo['money_two'], 2), 2) ;
|
||||||
|
|
||||||
$task['money'] = self::countSettelmentMoney($rate, $totalMoney);
|
$task['money'] = self::countSettelmentMoney($rate, $totalMoney);
|
||||||
(new VillageShareProfit())->dealVillageTaskSettlement4($task, $villageCompany, $taskSchedulePlan);
|
(new VillageShareProfit())->dealVillageTaskSettlement4($task, $villageCompany, $taskSchedulePlan);
|
||||||
}
|
}
|
||||||
@ -2921,7 +2932,7 @@ class TaskLogic extends BaseLogic
|
|||||||
$villageCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
$villageCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||||
$task = Task::where('id', $taskSchedulePlan['task_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();
|
||||||
$shareholderedMoney = 0; // 已入股股金总额
|
$shareholderedMoney = 0; // 已入股股金总额
|
||||||
// 查询公司股金变动流水记录
|
// 查询公司股金变动流水记录
|
||||||
$companyIds[] = $villageCompany['id'];
|
$companyIds[] = $villageCompany['id'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user