update 镇农科公司任务改为镇合伙人公司任务
This commit is contained in:
parent
3f791f3134
commit
f327cfa298
@ -56,8 +56,8 @@ class TaskTemplateController extends BaseAdminController
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('add');
|
||||
$params['admin_id'] = $this->adminId;
|
||||
$company = Company::find($params['company_id']);
|
||||
if ($company->company_type == 41) {
|
||||
// 创建 镇农科公司 任务模板
|
||||
if ($company->company_type == 16) {
|
||||
// 创建 镇合伙人公司 任务模板
|
||||
$result = TaskTemplateLogic::addTownTaskTemplate($params);
|
||||
} else if ($company->company_type == 17) {
|
||||
$result = TaskTemplateLogic::addVillageTaskTemplate($params);
|
||||
|
@ -135,7 +135,7 @@ class CronController extends BaseApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务下发
|
||||
* 镇合伙人公司任务下发
|
||||
*/
|
||||
public function town_task_add()
|
||||
{
|
||||
@ -144,7 +144,7 @@ class CronController extends BaseApiController
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)
|
||||
->where('status', 1)
|
||||
->where('company_type', 41)
|
||||
->where('company_type', 16)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
|
@ -532,7 +532,7 @@ class TaskController extends BaseApiController
|
||||
// 没有则创建审批任务
|
||||
$approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty();
|
||||
if ($approveModel->isEmpty()) {
|
||||
$approveModel->type = Approve::APPROVE_TYPE_5;
|
||||
$approveModel->type = Approve::APPROVE_TYPE_6;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
|
@ -103,10 +103,10 @@ class CompanyLogic extends BaseLogic
|
||||
$admin['password'] = create_password(123456, $passwordSalt);
|
||||
|
||||
$admin_id=Admin::strict(false)->insertGetId($admin);
|
||||
//镇/街公司
|
||||
// 镇合伙人公司
|
||||
if($params['company_type']==16){
|
||||
AdminLogic::insertRole($admin_id, [3]);
|
||||
$admin['group_id']=4;
|
||||
$admin['group_id']=15;
|
||||
}elseif($params['company_type']==17){
|
||||
//村管理公司
|
||||
AdminLogic::insertRole($admin_id, [4]);
|
||||
@ -117,9 +117,9 @@ class CompanyLogic extends BaseLogic
|
||||
AdminLogic::insertRole($admin_id, [6]);
|
||||
$admin['group_id']=5;
|
||||
} elseif ($params['company_type']==41) {
|
||||
//镇农科公司 总负责人
|
||||
//镇农科公司
|
||||
AdminLogic::insertRole($admin_id, [7]); //后台角色
|
||||
$admin['group_id']=15; // 前台角色
|
||||
$admin['group_id']=4; // 前台角色
|
||||
}
|
||||
$userSn = User::createUserSn();
|
||||
$admin['admin_id']=$admin_id;
|
||||
|
@ -425,7 +425,7 @@ class TaskLogic extends BaseLogic
|
||||
public static function TownCronAdd(array $taskTemplate)
|
||||
{
|
||||
try {
|
||||
Log::info(['镇农科公司定时任务下发-任务模板', $taskTemplate]);
|
||||
Log::info(['镇合伙人公司定时任务下发-任务模板', $taskTemplate]);
|
||||
// 单次任务不重复下发,在结算时刷新任务时间
|
||||
if ($taskTemplate['types'] == 3) {
|
||||
$task = Task::where('template_id', $taskTemplate['id'])->find();
|
||||
@ -441,28 +441,28 @@ class TaskLogic extends BaseLogic
|
||||
$directorUid = 0; // 指派给
|
||||
if ($taskTemplate['extend']['task_role'] == 1) {
|
||||
$marketingManagerUser = (new User())->searchMaster($taskTemplate['company_id']);
|
||||
Log::info(['镇农科公司定时任务下发-负责人user信息', $marketingManagerUser]);
|
||||
Log::info(['镇合伙人公司定时任务下发-负责人user信息', $marketingManagerUser]);
|
||||
$directorUid = $marketingManagerUser['id'];
|
||||
}
|
||||
if ($taskTemplate['extend']['task_role'] == 2) {
|
||||
$marketingManagerUser = (new User())->searchMarketingManager($taskTemplate['company_id']);
|
||||
Log::info(['镇农科公司定时任务下发-市场部长user信息', $marketingManagerUser]);
|
||||
Log::info(['镇合伙人公司定时任务下发-市场部长user信息', $marketingManagerUser]);
|
||||
$directorUid = $marketingManagerUser['id'];
|
||||
}
|
||||
|
||||
if ($taskTemplate['extend']['task_role'] == 3) {
|
||||
$serviceManagerUser = (new User())->searchServiceManager($taskTemplate['company_id']);
|
||||
Log::info(['镇农科公司定时任务下发-服务部长user信息', $serviceManagerUser]);
|
||||
Log::info(['镇合伙人公司定时任务下发-服务部长user信息', $serviceManagerUser]);
|
||||
$directorUid = $serviceManagerUser['id'];
|
||||
}
|
||||
|
||||
// 添加任务计划
|
||||
$TaskSchedulingPlan = self::addTaskSchedulePlan($taskTemplate, $time);
|
||||
Log::info(['镇农科公司定时任务下发-添加plan结果', $TaskSchedulingPlan]);
|
||||
Log::info(['镇合伙人公司定时任务下发-添加plan结果', $TaskSchedulingPlan]);
|
||||
|
||||
// 添加任务
|
||||
$task_id = self::addTask($taskTemplate, $TaskSchedulingPlan, $time, $directorUid);
|
||||
Log::info(['镇农科公司定时任务下发-添加task结果', $task_id]);
|
||||
Log::info(['镇合伙人公司定时任务下发-添加task结果', $task_id]);
|
||||
|
||||
// 关联任务计划和任务
|
||||
TaskSchedulingPlan::where('id', $TaskSchedulingPlan['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
||||
@ -473,7 +473,7 @@ class TaskLogic extends BaseLogic
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error(['镇农科公司定时任务添加失败', $e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
Log::error(['镇合伙人公司定时任务添加失败', $e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -678,7 +678,7 @@ class TaskLogic extends BaseLogic
|
||||
public static function townTaskSettlement($taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Log::info(['镇农科公司定时任务结算执行-任务计划', $taskSchedulePlan]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-任务计划', $taskSchedulePlan]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
// 负责人任务结算
|
||||
if ($taskTemplateInfo['extend']['task_role'] == 1) {
|
||||
@ -694,13 +694,13 @@ class TaskLogic extends BaseLogic
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
Log::error(['镇农科任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
Log::error(['镇合伙人任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科负责人任务结算
|
||||
* 镇合伙人负责人任务结算
|
||||
*/
|
||||
private static function masterTaskSettlement($taskSchedulePlan)
|
||||
{
|
||||
@ -727,7 +727,7 @@ class TaskLogic extends BaseLogic
|
||||
break;
|
||||
// 促成村联络员入股甲方
|
||||
case 'town_task_type_master_6':
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
// 任务累计天数 <= 任务天数 刷新任务
|
||||
@ -741,11 +741,9 @@ class TaskLogic extends BaseLogic
|
||||
break;
|
||||
// 政策补贴申请
|
||||
case 'town_task_type_master_7':
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
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();
|
||||
if($dayCount < $taskTemplateInfo['stage_day_one']) {
|
||||
self::flushTaskTime($taskSchedulePlan);
|
||||
return true;
|
||||
@ -765,7 +763,7 @@ class TaskLogic extends BaseLogic
|
||||
return true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Log::error(['镇农科任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
Log::error(['镇合伙人任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,7 +773,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function masterTask2Settlement($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
@ -836,7 +834,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function masterTask3Settlement($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$stageDayTwoCount = bcadd($taskTemplateInfo['stage_day_one'],$taskTemplateInfo['stage_day_two']);
|
||||
@ -952,10 +950,11 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function masterTask4Settlement($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
$townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
// 任务交易池,用于叠加交易额
|
||||
$townTransactionPool = $taskTemplateInfo['transaction_pool'];
|
||||
@ -967,7 +966,7 @@ class TaskLogic extends BaseLogic
|
||||
$param = [
|
||||
'start_time' => strtotime(date('Y-m-d', time())),
|
||||
'end_time' => strtotime(date('Y-m-d', time())) + 86399,
|
||||
'responsible_area' => $townCompany['responsible_area'],
|
||||
'responsible_area' => $townPlatformCompany['responsible_area'],
|
||||
'type' => 'street',
|
||||
];
|
||||
$result = ShopRequestLogic::getTownTradeAmount($param);
|
||||
@ -989,18 +988,20 @@ class TaskLogic extends BaseLogic
|
||||
|
||||
private static function masterTask5Settlement($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
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();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
// 行政村数量
|
||||
$villageCount = Db::name('geo_village')->where(['street_code' => $townCompany['street']])->count();
|
||||
if ($villageCount == 0) {
|
||||
throw new Exception('没有找到对应的行政村'.__FILE__.__LINE__);
|
||||
}
|
||||
// 村公司
|
||||
$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);
|
||||
$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'=>$townPlatformCompany['responsible_area']], true);
|
||||
$ids = array_column($villageCompanyList, 'id');
|
||||
// 村联络员数量
|
||||
$liaisonManCount = User::where(['group_id'=>17])->whereIn('company_id', $ids)->count();
|
||||
@ -1045,15 +1046,17 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
public static function masterTask6Settlement($taskSchedulePlan, $approve)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
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();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
// 行政村数量
|
||||
$villageCount = Db::name('geo_village')->where(['street_code' => $townCompany['street']])->count();
|
||||
$villageCount = Db::name('geo_village')->whereIn('street_code', explode(',', $townPlatformCompany['responsible_area']))->count();
|
||||
// 小组服务公司总数
|
||||
$groupServiceCompanyList = Company::where(['company_type'=> 18])->whereIn('street', $townCompany['responsible_area'])->select()->toArray();
|
||||
$groupServiceCompanyList = Company::where(['company_type'=> 18])->whereIn('street', $townPlatformCompany['responsible_area'])->select()->toArray();
|
||||
$groupServiceCompanyCount = count($groupServiceCompanyList);
|
||||
|
||||
// 任务累计天数 = 第一阶段 任务期限内才结算
|
||||
@ -1084,7 +1087,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
public static function masterTask7Settlement($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
@ -1180,7 +1183,7 @@ class TaskLogic extends BaseLogic
|
||||
return true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Log::error(['镇农科任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
Log::error(['镇合伙人任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1191,7 +1194,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function dealTaskMarketingDirector1($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
$townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||
@ -1216,7 +1219,7 @@ class TaskLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
|
||||
// 查询 镇农科公司负责人是否有对应的每日任务安排
|
||||
// 查询 镇合伙人公司负责人是否有对应的每日任务安排
|
||||
$templateList = TaskTemplate::where(['company_id'=>$townCompany['id']])->whereIn('type', $typeIds)->select()->toArray();
|
||||
// 未做任务安排的小组服务公司不在判定范围内,跳出本次循环
|
||||
if(count($templateList) === 3) {
|
||||
@ -1230,7 +1233,7 @@ class TaskLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
}
|
||||
// 镇农科公司负责人有任务安排,也完成了任务
|
||||
// 镇合伙人公司负责人有任务安排,也完成了任务
|
||||
if ($isDone === 1 && $isTaskSchedule === 1) {
|
||||
// 做任务结算,分润
|
||||
(new TownShareProfit())->dealTaskSettlementMarketingDirector1($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
@ -1252,6 +1255,8 @@ class TaskLogic extends BaseLogic
|
||||
$templateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $templateInfo['day_count'];
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
// 当前任务进行天数 < 第一阶段天数 只刷新任务时间
|
||||
if ($dayCount < $templateInfo['stage_day_one']) {
|
||||
@ -1264,7 +1269,7 @@ class TaskLogic extends BaseLogic
|
||||
// 请求商城接口,获取完成几家
|
||||
$param['start_time'] = strtotime(date('Y-m-d', strtotime($templateInfo['create_time']))) + 86400;
|
||||
$param['end_time'] = time();
|
||||
$param['responsible_area'] = $townCompany['responsible_area'];
|
||||
$param['responsible_area'] = $townPlatformCompany['responsible_area'];
|
||||
$param['type'] = 'street';
|
||||
$param['type_id'] = 17;
|
||||
|
||||
@ -1305,9 +1310,11 @@ class TaskLogic extends BaseLogic
|
||||
{
|
||||
$templateInfo = $taskSchedulePlan['template_info'];
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
// 商城商户入驻申请id 与商户已关联
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townCompany['id']])->select()->toArray();
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townPlatformCompany['id']])->select()->toArray();
|
||||
|
||||
// 遍历农科公司区域下的商户,对每个商户进行判定
|
||||
foreach ($shopMerchantSettleinLogList as $item) {
|
||||
@ -1389,9 +1396,11 @@ class TaskLogic extends BaseLogic
|
||||
{
|
||||
$templateInfo = $taskSchedulePlan['template_info'];
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
// 商城商户入驻申请id 与商户已关联
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townCompany['id']])->select()->toArray();
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townPlatformCompany['id']])->select()->toArray();
|
||||
|
||||
// 遍历农科公司区域下的商户,对每个商户进行判定
|
||||
foreach ($shopMerchantSettleinLogList as $item) {
|
||||
@ -1543,9 +1552,11 @@ class TaskLogic extends BaseLogic
|
||||
{
|
||||
$templateInfo = $taskSchedulePlan['template_info'];
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
// 商城商户入驻申请id 与商户已关联
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townCompany['id']])->select()->toArray();
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townPlatformCompany['id']])->select()->toArray();
|
||||
|
||||
// 遍历农科公司区域下的商户,对每个商户进行判定
|
||||
foreach ($shopMerchantSettleinLogList as $item) {
|
||||
@ -1709,12 +1720,14 @@ class TaskLogic extends BaseLogic
|
||||
$totalMoney = bcmul($templateInfo['stage_day_one'], $templateInfo['money']); // 任务最多可得金额
|
||||
$target = $templateInfo['extend']['target'];
|
||||
$taskMoney = 0;
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
if ($dayCount == $templateInfo['stage_day_one']) {
|
||||
$taskMoney = -1;
|
||||
// 15 自任务下发第15天
|
||||
$startTime = strtotime($templateInfo['create_time']);
|
||||
$endTime = strtotime("+15 day", $startTime);
|
||||
$responsibleArea = $townCompany['responsible_area'];
|
||||
$responsibleArea = $townPlatformCompany['responsible_area'];
|
||||
$param = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
@ -1737,7 +1750,7 @@ class TaskLogic extends BaseLogic
|
||||
// 30 自任务下发第30天
|
||||
$startTime = strtotime($templateInfo['create_time']);
|
||||
$endTime = strtotime("+30 day", $startTime);
|
||||
$responsibleArea = $townCompany['responsible_area'];
|
||||
$responsibleArea = $townPlatformCompany['responsible_area'];
|
||||
$param = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
@ -1756,7 +1769,7 @@ class TaskLogic extends BaseLogic
|
||||
// 60 自任务下发第60天
|
||||
$startTime = strtotime($templateInfo['create_time']);
|
||||
$endTime = strtotime("+60 day", $startTime);
|
||||
$responsibleArea = $townCompany['responsible_area'];
|
||||
$responsibleArea = $townPlatformCompany['responsible_area'];
|
||||
$param = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
@ -1875,9 +1888,11 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function judgeTaskMarketingDirector7($townCompany)
|
||||
{
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$taskIsDone = true;
|
||||
// 商城商户入驻申请id 与商户已关联
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townCompany['id']])->select()->toArray();
|
||||
$shopMerchantSettleinLogList= ShopMerchantSettleinLog::where(['town_company_id'=>$townPlatformCompany['id']])->select()->toArray();
|
||||
// 遍历农科公司区域下的商户,对每个商户进行判定
|
||||
foreach ($shopMerchantSettleinLogList as $item) {
|
||||
// 商品上架
|
||||
@ -1918,6 +1933,8 @@ class TaskLogic extends BaseLogic
|
||||
$dayCount = $templateInfo['day_count'];
|
||||
$stageDayOne = $templateInfo['stage_day_one'];
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
// 任务累计天数 < 第一阶段 关闭任务
|
||||
if ($dayCount < $stageDayOne) {
|
||||
@ -1959,7 +1976,7 @@ class TaskLogic extends BaseLogic
|
||||
$param = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'responsible_area' => $townCompany['responsible_area'], // 镇农科管理区域
|
||||
'responsible_area' => $townPlatformCompany['responsible_area'], // 镇农科管理区域
|
||||
'goods_id' => $templateInfo['extend']['goods_id'],
|
||||
'type'=>200
|
||||
];
|
||||
@ -1989,10 +2006,12 @@ class TaskLogic extends BaseLogic
|
||||
private static function countMonthTaskMoney($templateInfo, $townCompany, $targetProcureAmount, $startTime, $endTime)
|
||||
{
|
||||
$totalMoney = bcmul(30, $templateInfo['money']);
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$param = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'responsible_area' => $townCompany['responsible_area'], // 镇农科管理区域
|
||||
'responsible_area' => $townPlatformCompany['responsible_area'], // 镇农科管理区域
|
||||
'goods_id' => $templateInfo['extend']['goods_id'],
|
||||
'type'=>200
|
||||
];
|
||||
@ -2047,6 +2066,8 @@ class TaskLogic extends BaseLogic
|
||||
$dayCount = $templateInfo['day_count'];
|
||||
$stageDayOne = $templateInfo['stage_day_one'];
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
|
||||
// 任务累计天数 < 第一阶段 关闭任务
|
||||
@ -2088,7 +2109,7 @@ class TaskLogic extends BaseLogic
|
||||
$param = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'responsible_area' => $townCompany['responsible_area'], // 镇农科管理区域
|
||||
'responsible_area' => $townPlatformCompany['responsible_area'], // 镇农科管理区域
|
||||
'goods_id' => $templateInfo['extend']['goods_id'],
|
||||
'type'=>200
|
||||
];
|
||||
@ -2118,10 +2139,12 @@ class TaskLogic extends BaseLogic
|
||||
private static function countTradeAmountMonthTaskMoney($templateInfo, $townCompany, $targetProcureAmount, $startTime, $endTime)
|
||||
{
|
||||
$totalMoney = bcmul(30, $templateInfo['money']);
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$param = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'responsible_area' => $townCompany['responsible_area'], // 镇农科管理区域
|
||||
'responsible_area' => $townPlatformCompany['responsible_area'], // 镇农科管理区域
|
||||
'goods_id' => $templateInfo['extend']['goods_id'],
|
||||
'type'=>300
|
||||
];
|
||||
@ -2259,7 +2282,7 @@ class TaskLogic extends BaseLogic
|
||||
case 'town_task_type_6':
|
||||
// 督促小组服务团队入股村联络员所成立的公司任务
|
||||
// 后台手动审核 只判断任务是否超时
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$taskDayCount = $taskTemplateInfo['day_count']; // 任务累计进行天数
|
||||
$stageDayTwoAccumulative = intval(bcadd($taskTemplateInfo['stage_day_one'], $taskTemplateInfo['stage_day_two'])); // 第二阶段累计天数 第一+第二
|
||||
@ -2282,11 +2305,11 @@ class TaskLogic extends BaseLogic
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统自动判定镇农科公司下属小组服务公司 是否100%完成每日任务:三轮车任务,档案更新任务,平台交易任务
|
||||
* 系统自动判定镇合伙人公司负责人是否完成每日循环任务
|
||||
*/
|
||||
private static function dealTownTask1($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$taskInfo = Task::where(['id' => $taskSchedulePlan['task_id']])->find();
|
||||
$townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||
@ -2310,7 +2333,7 @@ class TaskLogic extends BaseLogic
|
||||
$typeIds[] = $k;
|
||||
}
|
||||
}
|
||||
// 查询 镇农科公司负责人是否有对应的每日任务安排
|
||||
// 查询 镇合伙人公司负责人是否有对应的每日任务安排
|
||||
$templateList = TaskTemplate::where(['company_id'=>$townCompany['id']])->whereIn('type', $typeIds)->select()->toArray();
|
||||
// 未做任务安排的小组服务公司不在判定范围内,跳出本次循环
|
||||
if(count($templateList) === 3) {
|
||||
@ -2345,7 +2368,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function dealTownTask2($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||
$day = $taskTemplateInfo['stage_day_one'] + $taskTemplateInfo['stage_day_two'];
|
||||
@ -2444,10 +2467,12 @@ class TaskLogic extends BaseLogic
|
||||
|
||||
private static function dealTownTask3($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$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);
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$groupServiceCompanyList = Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(street,:responsible_area)", ['company_type' => 18,'responsible_area'=>$townPlatformCompany['responsible_area']], true);
|
||||
// $groupServiceCompanyList = Company::where(['street' => $townCompany['street'], 'company_type' => 18])->select()->toArray();
|
||||
$task = Task::where('id', $taskSchedulePlan['task_id'])->with('director_info')->find();
|
||||
// 完成任务情况
|
||||
@ -2497,7 +2522,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function dealTownTask4($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||
$taskDayCount = $taskTemplateInfo['day_count']; // 任务累计进行天数
|
||||
@ -2597,9 +2622,11 @@ class TaskLogic extends BaseLogic
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$townCompany = Company::where(['id' => $taskTemplateInfo['company_id']])->find();
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$townTask = Task::where('id', $taskSchedulePlan['task_id'])->find();
|
||||
// $groupServiceCompanyList = Company::where(['street' => $townCompany['street'], 'company_type'=> 18])->select()->toArray();
|
||||
$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 = Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(street,:responsible_area)", ['company_type' => 18,'responsible_area'=>$townPlatformCompany['responsible_area']], true);
|
||||
|
||||
$townTransactionPool = $taskTemplateInfo['transaction_pool']; // 镇交易池
|
||||
$townTotalTradeAmount = 0; // 镇下属小组服务公司 每日实际总交易额
|
||||
@ -2619,7 +2646,7 @@ class TaskLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
|
||||
// 完成条件: 查镇所属小组服务公司当日实际完成金额总和+镇农科公司的资金池 > 查镇所属小组服务公司当日任务目标金额总和
|
||||
// 完成条件: 查镇所属小组服务公司当日实际完成金额总和+公司任务资金池 > 查镇所属小组服务公司当日任务目标金额总和
|
||||
if($targetAmount != 0 && bcadd($townTransactionPool, $townTotalTradeAmount, 2) >= $targetAmount) {
|
||||
// 将余下金额放入镇交易池
|
||||
$leftTransactionPool = bcsub(bcadd($townTransactionPool, $townTotalTradeAmount, 2), $targetAmount, 2);
|
||||
@ -2637,14 +2664,13 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
public static function dealTownTask6($taskSchedulePlan, $approve)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$taskDayCount = $taskTemplateInfo['day_count']; // 任务累计进行天数
|
||||
$task = Task::where('id', $taskSchedulePlan['task_id'])->find();
|
||||
$stageDayTwoAccumulative = intval(bcadd($taskTemplateInfo['stage_day_one'], $taskTemplateInfo['stage_day_two'])); // 第二阶段累计天数 第一+第二
|
||||
$townCompany = Company::where('id', $taskTemplateInfo['company_id'])->find(); // 镇农科公司
|
||||
$townCompany = Company::where('id', $taskTemplateInfo['company_id'])->find(); // 镇合伙人公司
|
||||
|
||||
dd($taskDayCount, $stageDayTwoAccumulative);
|
||||
// 当前任务进行天数 <= 第一+第二阶段天数 判定任务是否完成 结算 分润
|
||||
if($taskDayCount <= $stageDayTwoAccumulative) {
|
||||
// 小组服务公司总数
|
||||
@ -2693,15 +2719,17 @@ class TaskLogic extends BaseLogic
|
||||
// 安全任务结算
|
||||
private static function dealTownTask7($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['镇合伙人公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
|
||||
$townCompany = Company::where('id', $taskTemplateInfo['company_id'])->find(); // 镇农科公司
|
||||
$townCompany = Company::where('id', $taskTemplateInfo['company_id'])->find(); // 镇合伙人公司
|
||||
$townPlatformCompany = Db::query("select id from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$townCompany['street']], true)[0];
|
||||
|
||||
$task = Task::where('id', $taskSchedulePlan['task_id'])->find();
|
||||
|
||||
// 片区下公司有任一投诉都判定为未完成
|
||||
$isDone = 1;
|
||||
$companyList = Company::where('street', $townCompany['street'])->select()->toArray();
|
||||
$companyList = Company::whereIn('street', explode(',', $townPlatformCompany['responsible_area']))->select()->toArray();
|
||||
foreach ($companyList as $company) {
|
||||
$complain = CompanyComplaintFeedback::where(['company_id'=>$company['id']])->whereDay('create_time', 'today')->find();
|
||||
if (!empty($complain)) {
|
||||
@ -2728,8 +2756,8 @@ class TaskLogic extends BaseLogic
|
||||
Log::info(['存管理公司定时任务结算执行-任务计划', $taskSchedulePlan]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
// 任务类型用的数据字典主键id,将id和value作映射,避免测试和正式环境数据字典数据不一致时出问题
|
||||
$townTaskTypeList = DictData::where(['type_value' => 'village_task_type', 'status' => 1])->column('value', 'id');
|
||||
switch ($townTaskTypeList[$taskTemplateInfo['type']]){
|
||||
$villageTaskTypeList = DictData::where(['type_value' => 'village_task_type', 'status' => 1])->column('value', 'id');
|
||||
switch ($villageTaskTypeList[$taskTemplateInfo['type']]){
|
||||
// 组建小组服务团队
|
||||
case 'village_task_type_1':
|
||||
self::dealVillageTask1($taskSchedulePlan);
|
||||
@ -2810,7 +2838,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function dealVillageTask1($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['村管理公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$target = $taskTemplateInfo['extend']['target'];
|
||||
@ -2930,7 +2958,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
public static function dealVillageTask4($taskSchedulePlan, $approve)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['村管理公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$target = $taskTemplateInfo['extend']['target'];
|
||||
@ -2993,7 +3021,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
public static function dealVillageTask5($taskSchedulePlan, $approve)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['村管理公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$target = $taskTemplateInfo['extend']['target'];
|
||||
@ -3045,7 +3073,7 @@ class TaskLogic extends BaseLogic
|
||||
*/
|
||||
private static function dealVillageTask7($taskSchedulePlan)
|
||||
{
|
||||
Log::info(['镇农科公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
Log::info(['村管理公司定时任务结算执行-'.$taskSchedulePlan['template_info']['title']]);
|
||||
$taskTemplateInfo = $taskSchedulePlan['template_info'];
|
||||
$dayCount = $taskTemplateInfo['day_count'];
|
||||
$stageDayOne = $taskTemplateInfo['stage_day_one'];
|
||||
|
@ -221,19 +221,19 @@ class User extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
// 查询镇农科服务部长
|
||||
// 查询镇合伙人服务部长
|
||||
public function searchServiceManager($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 14])->find();
|
||||
}
|
||||
|
||||
// 查询镇农科负责人
|
||||
// 查询镇合伙人负责人
|
||||
public function searchMaster($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 15])->find();
|
||||
}
|
||||
|
||||
// 查询镇农科市场部长
|
||||
// 查询镇合伙人市场部长
|
||||
public function searchMarketingManager($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 16])->find();
|
||||
|
Loading…
x
Reference in New Issue
Block a user