update:任务审批联调-市场部长数字农贸宣传业务、加工业务的建设和招商工作
This commit is contained in:
parent
9049b0784f
commit
18c7338903
@ -38,7 +38,7 @@ class ApproveController extends BaseAdminController
|
||||
return $this->success('审核成功');
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
return $this->fail($e->getMessage());
|
||||
return $this->fail($e->getFile().$e->getLine().$e->getMessage());
|
||||
}
|
||||
}
|
||||
// 通过
|
||||
@ -58,12 +58,13 @@ class ApproveController extends BaseAdminController
|
||||
|
||||
// 结算
|
||||
if ($approve->type == Approve::APPROVE_TYPE_4) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where(['id', $task['scheduling_plan_id']])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 41)
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->find();
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 41)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealTaskMarketingDirector10($taskSchedulePlan, $approve);
|
||||
}
|
||||
}
|
||||
|
@ -404,24 +404,23 @@ class TaskController extends BaseApiController
|
||||
}
|
||||
$extend = [];
|
||||
$stage = $parmas['stage']; // 当前做的是任务第几阶段
|
||||
$extend['stage'] = $stage;
|
||||
if ($stage == 1) {
|
||||
$extend = $parmas['stage1'];
|
||||
$extend['stage1']['is_commit'] = 1;
|
||||
$parmas['stage1']['is_commit'] = 1;
|
||||
$extend['stage1'] = $parmas['stage1'];
|
||||
}
|
||||
if ($stage == 2) {
|
||||
$extend = $parmas['stage2'];
|
||||
$extend['stage2']['is_commit'] = 1;
|
||||
$extend['stage2'] = $parmas['stage2'];
|
||||
}
|
||||
if ($stage == 3) {
|
||||
$extend = $parmas['stage3'];
|
||||
$extend['stage3']['is_commit'] = 1;
|
||||
$extend['stage3'] = $parmas['stage3'];
|
||||
}
|
||||
if ($stage == 4) {
|
||||
$extend = $parmas['stage4'];
|
||||
$extend['stage4']['is_commit'] = 1;
|
||||
$extend['stage4'] = $parmas['stage4'];
|
||||
}
|
||||
|
||||
$extend['stage'] = $stage;
|
||||
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time(), 'director_uid'=>$this->userId]); // director_uid 指派人
|
||||
|
||||
|
@ -249,7 +249,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector2(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector2(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -267,7 +267,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector3(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector3(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -285,7 +285,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector4(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector4(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -303,7 +303,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector5(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector5(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -321,7 +321,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector6(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector6(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -339,7 +339,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector7(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector7(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -357,7 +357,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector8(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector8(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -375,7 +375,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector9(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector9(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -393,7 +393,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector10(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector10(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
|
@ -699,12 +699,13 @@ class TaskLogic extends BaseLogic
|
||||
// 请求商城接口,获取完成几家 todo
|
||||
$param['start_time'] = strtotime(date('Y-m-d', $templateInfo['cretate_time'])) + 86400;
|
||||
$param['end_time'] = time();
|
||||
$param['responsible_area'] = $townCompany['responsible_area'];
|
||||
$result = ShopRequestLogic::getSupplyChainMerchantCount($param);
|
||||
if (!$result) {
|
||||
Log::error('查询供应链商户统计接口失败'.ShopRequestLogic::getError());
|
||||
return false;
|
||||
}
|
||||
$count = 0; // todo 从$result取值
|
||||
$count = $result['count']; // todo 从$result取值
|
||||
|
||||
// 完成数小于3,关闭任务,不做结算
|
||||
if ($count < 3){
|
||||
@ -752,8 +753,8 @@ class TaskLogic extends BaseLogic
|
||||
];
|
||||
$result = ShopRequestLogic::getProductListing($param);
|
||||
Log::info(['4.市场部长-供应链商户完成商品上架和库存更新任务-查询商城接口结果', json_encode($result)]);
|
||||
// 完成则结算 todo 返回字段要对接
|
||||
if ($result['is_done'] == 1){
|
||||
// 达到目标数 完成则结算 todo 返回字段要对接
|
||||
if ($result['count'] >= $templateInfo['extend']['target']){
|
||||
// 结算金额 任务金额/目标数 * 天数
|
||||
$taskInfo['money'] = bcmul($templateInfo['stage_day_one'], bcdiv($templateInfo['money'], $templateInfo['extend']['target']));
|
||||
Log::info(['5.市场部长-供应链商户完成商品上架任务-$taskSchedulePlan', json_encode($taskSchedulePlan)]);
|
||||
@ -1278,10 +1279,10 @@ class TaskLogic extends BaseLogic
|
||||
|
||||
// todo 返回字段要对接
|
||||
$result = ShopRequestLogic::getGeneralMerchantProductListing($param);
|
||||
$isDone = $result['is_done'];
|
||||
$count = $result['count'];
|
||||
Log::info(['4.市场部长-一般商户完成商品上架任务-查询商城接口结果', json_encode($result)]);
|
||||
// 任一商户未完成,判定为未完成
|
||||
if (!$isDone) {
|
||||
if ($count < 200) {
|
||||
$taskIsDone = false;
|
||||
}
|
||||
}
|
||||
@ -1511,13 +1512,13 @@ class TaskLogic extends BaseLogic
|
||||
];
|
||||
// todo 对接接口实际返回参数
|
||||
$result = ShopRequestLogic::getGeneralMerchantTradeAmount($param);
|
||||
$procureAmount = $result['procure_amount'];
|
||||
$rate = bcdiv($procureAmount, $targetProcureAmount, 1);
|
||||
$tradeAmount = $result['trade_amount'];
|
||||
$rate = bcdiv($tradeAmount, $targetProcureAmount, 1);
|
||||
if (bccomp($rate, 0.5, 1) == -1) {
|
||||
return 0;
|
||||
}
|
||||
$taskMoney = 0;
|
||||
if ($procureAmount >= 100000) {
|
||||
if ($tradeAmount >= 100000) {
|
||||
$taskMoney = $totalMoney;
|
||||
} else {
|
||||
// 计算结算金额 周期天数*(money/目标数)*实际完成率*对应发放比例
|
||||
@ -2074,6 +2075,47 @@ class TaskLogic extends BaseLogic
|
||||
// 关闭任务
|
||||
(new Task())->closeTask($task['id']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务结算
|
||||
*/
|
||||
public static function villageTaskSettlement($taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
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']]){
|
||||
// 组建小组服务团队
|
||||
case 'village_task_type_1':
|
||||
|
||||
break;
|
||||
// 协助小组服务团队完成辖区内的交易任务
|
||||
case 'village_task_type_2':
|
||||
break;
|
||||
// 负责辖区内农产品安检和溯源
|
||||
case 'village_task_type_3':
|
||||
break;
|
||||
// 督促小组服务团队入股
|
||||
case 'village_task_type_4':
|
||||
break;
|
||||
// 入股甲方公司
|
||||
case 'village_task_type_5':
|
||||
break;
|
||||
// 信息平台铺设工作
|
||||
case 'village_task_type_6':
|
||||
break;
|
||||
// 种养殖基地订单匹配
|
||||
case 'village_task_type_7':
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Log::error(['镇农科任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user