update 镇农科负责人-促成村联络员入股甲方任务改为手动审核,线下转账
This commit is contained in:
parent
43dc941e10
commit
617d69d34c
@ -223,7 +223,7 @@ class ApproveController extends BaseAdminController
|
||||
}
|
||||
|
||||
// 村管理公司股金上交 村联络员任务-入股甲方公司
|
||||
if ($approve->type == Approve::APPROVE_TYPE_12) {
|
||||
if ($approve->type == Approve::APPROVE_TYPE_12 || $approve->type == Approve::APPROVE_TYPE_14) {
|
||||
// 村公司
|
||||
$subordinateCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// 镇农科公司 负责区域包含有村公司的street码
|
||||
@ -289,6 +289,17 @@ class ApproveController extends BaseAdminController
|
||||
->toArray()[0];
|
||||
TaskLogic::dealTownTask6($taskSchedulingPaln, $approve);
|
||||
}
|
||||
// 镇农科负责人-促成村联络员入股甲方
|
||||
if ($approve->type == Approve::APPROVE_TYPE_14) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 41)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::masterTask6Settlement($taskSchedulingPaln, $approve);
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
|
@ -838,7 +838,7 @@ class TaskController extends BaseApiController
|
||||
}
|
||||
}
|
||||
|
||||
// 服务部长-督促小组服务团队入股村管理公司
|
||||
// 镇农科服务部长-督促小组服务团队入股村管理公司
|
||||
public function commit_town_service_manager_task_6()
|
||||
{
|
||||
try {
|
||||
@ -876,4 +876,44 @@ class TaskController extends BaseApiController
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 镇农科负责人-促成村联络员入股甲方
|
||||
public function commit_town_master_task_6()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex amount
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
$extend = $task['extend'];
|
||||
$extend['is_commit'] = 1;
|
||||
$extend['annex'] = $parmas['annex'];
|
||||
$extend['file_type'] = $parmas['file_type'];
|
||||
$extend['amount'] = $parmas['amount'];
|
||||
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time' => time(), 'director_uid' => $this->userId]); // director_uid 指派人
|
||||
|
||||
// 创建审批任务
|
||||
$approveModel = new Approve();
|
||||
$approveModel->type = Approve::APPROVE_TYPE_14;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = $this->userInfo['company_id']; // 公司id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->amount = $parmas['amount']; // 入股金额
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -727,7 +727,25 @@ class TaskLogic extends BaseLogic
|
||||
break;
|
||||
// 促成村联络员入股甲方
|
||||
case 'town_task_type_master_6':
|
||||
self::masterTask6Settlement($taskSchedulePlan);
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
$townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||
// 行政村数量
|
||||
$villageCount = Db::name('geo_village')->where(['street_code' => $townCompany['street']])->count();
|
||||
// 小组服务公司总数
|
||||
$groupServiceCompanyList = Company::where(['company_type'=> 18])->whereIn('street', $townCompany['responsible_area'])->select()->toArray();
|
||||
$groupServiceCompanyCount = count($groupServiceCompanyList);
|
||||
|
||||
// 任务累计天数 <= 任务天数 刷新任务
|
||||
if ($dayCount <= $taskTemplateInfo['stage_day_one']) {
|
||||
self::flushTaskTime($taskSchedulePlan);
|
||||
} else {
|
||||
// 超期关闭任务
|
||||
(new Task())->closeTask($taskSchedulePlan['task_id']);
|
||||
}
|
||||
// self::masterTask6Settlement($taskSchedulePlan);
|
||||
break;
|
||||
// 政策补贴申请
|
||||
case 'town_task_type_master_7':
|
||||
@ -999,7 +1017,7 @@ class TaskLogic extends BaseLogic
|
||||
* 任务累计天数 小于 第一阶段 刷新任务时间
|
||||
* 任务累计天数 = 第一阶段 结算
|
||||
*/
|
||||
private static function masterTask6Settlement($taskSchedulePlan)
|
||||
public static function masterTask6Settlement($taskSchedulePlan, $approve)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
@ -1012,33 +1030,15 @@ class TaskLogic extends BaseLogic
|
||||
$groupServiceCompanyList = Company::where(['company_type'=> 18])->whereIn('street', $townCompany['responsible_area'])->select()->toArray();
|
||||
$groupServiceCompanyCount = count($groupServiceCompanyList);
|
||||
|
||||
// 任务累计天数 小于 第一阶段 刷新任务时间
|
||||
if ($dayCount < $taskTemplateInfo['stage_day_one']) {
|
||||
self::flushTaskTime($taskSchedulePlan);
|
||||
}
|
||||
|
||||
// 任务累计天数 = 第一阶段 结算
|
||||
if ($dayCount == $taskTemplateInfo['stage_day_one']) {
|
||||
// 任务累计天数 = 第一阶段 任务期限内才结算
|
||||
if ($dayCount <= $taskTemplateInfo['stage_day_one']) {
|
||||
// 目标任务金额 行政村数量*6000 + 小组服务团队数量*3000
|
||||
$targetShareholderedMoney = bcadd(bcmul($villageCount, 6000, 2), bcmul($groupServiceCompanyCount, 3000, 2), 2);
|
||||
if ($targetShareholderedMoney == 0) {
|
||||
throw new Exception('目标任务金额为0异常'.__FILE__.__LINE__);
|
||||
}
|
||||
$companyIds = [];
|
||||
foreach ($groupServiceCompanyList as $groupServiceCompany) {
|
||||
$companyIds[] = $groupServiceCompany['id'];
|
||||
}
|
||||
|
||||
// 村公司
|
||||
$villageCompanyList = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(street,:responsible_area)", ['company_type' => 17,'responsible_area'=>$townCompany['responsible_area']], true);
|
||||
foreach ($villageCompanyList as $villageCompany) {
|
||||
$companyIds[] = $villageCompany['id'];
|
||||
}
|
||||
|
||||
// 已入股股金总额
|
||||
$shareholderedMoney = CompanyAccountLog::where(['change_object'=>CompanyAccountLog::SHAREHOLDER, 'change_type'=>CompanyAccountLog::TASK_INC_SHAREHOLDER_MONEY])
|
||||
->whereIn('company_id', $companyIds)
|
||||
->sum('change_amount');
|
||||
$shareholderedMoney = $approve->amount;
|
||||
|
||||
$rate = bcdiv($shareholderedMoney, $targetShareholderedMoney, 2);
|
||||
|
||||
|
@ -27,6 +27,7 @@ class Approve extends BaseModel
|
||||
const APPROVE_TYPE_11 = 11; // 村联络员任务-督促小组服务团队入股
|
||||
const APPROVE_TYPE_12 = 12; // 村联络员任务-入股甲方公司
|
||||
const APPROVE_TYPE_13 = 13; // 镇农科服务部长任务-督促入股村管理公司
|
||||
const APPROVE_TYPE_14 = 14; // 镇农科负责人任务-促成村联络员入股甲方
|
||||
|
||||
public function task()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user