Merge branch 'dev' of https://gitea.lihaink.cn/mkm/TaskSystem into dev
This commit is contained in:
commit
1bc49b39fa
@ -38,7 +38,7 @@ class ApproveController extends BaseAdminController
|
|||||||
return $this->success('审核成功');
|
return $this->success('审核成功');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollback();
|
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) {
|
if ($approve->type == Approve::APPROVE_TYPE_4) {
|
||||||
$taskSchedulePlan = TaskSchedulingPlan::where(['id', $task['scheduling_plan_id']])
|
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||||
->withJoin(['scheduling'], 'left')
|
|
||||||
->where('scheduling.company_type', 41)
|
|
||||||
->where('is_pay',0)
|
->where('is_pay',0)
|
||||||
->with(['template_info'])
|
->with(['template_info'])
|
||||||
->find();
|
->withJoin(['scheduling'], 'left')
|
||||||
|
->where('scheduling.company_type', 41)
|
||||||
|
->find()
|
||||||
|
->toArray();
|
||||||
TaskLogic::dealTaskMarketingDirector10($taskSchedulePlan, $approve);
|
TaskLogic::dealTaskMarketingDirector10($taskSchedulePlan, $approve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,11 @@ class TaskController extends BaseApiController
|
|||||||
$is_captain = User::where('id', $this->userId)->value('is_captain');
|
$is_captain = User::where('id', $this->userId)->value('is_captain');
|
||||||
if ($is_captain == 1) {
|
if ($is_captain == 1) {
|
||||||
$where[] = ['type', 'in', [31,33]];
|
$where[] = ['type', 'in', [31,33]];
|
||||||
} else {
|
|
||||||
$where[] = ['type', '=', 33];
|
|
||||||
$where[] = ['director_uid', '=', $this->userId];
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// $where[] = ['type', '=', 33];
|
||||||
|
// $where[] = ['director_uid', '=', $this->userId];
|
||||||
|
// }
|
||||||
// $where[] = ['company_id', '=', $this->userInfo['company_id']];
|
// $where[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +300,7 @@ class TaskController extends BaseApiController
|
|||||||
$parmas = $this->request->param();
|
$parmas = $this->request->param();
|
||||||
$task = TaskLogic::detail($parmas);
|
$task = TaskLogic::detail($parmas);
|
||||||
$extend = $task['extend'];
|
$extend = $task['extend'];
|
||||||
if ($extend['other']['is_commit'] == 1) {
|
if (isset($extend['other']) && $extend['other']['is_commit'] == 1) {
|
||||||
$approve = Approve::where(['task_id' =>$task['id']])->find();
|
$approve = Approve::where(['task_id' =>$task['id']])->find();
|
||||||
$task['approve_status'] = $approve['check_status']; //审核状态
|
$task['approve_status'] = $approve['check_status']; //审核状态
|
||||||
$task['deny_notes'] = $approve['remark']; // 拒绝原因
|
$task['deny_notes'] = $approve['remark']; // 拒绝原因
|
||||||
@ -340,7 +341,7 @@ class TaskController extends BaseApiController
|
|||||||
$approveModel->other_type = 6;
|
$approveModel->other_type = 6;
|
||||||
$approveModel->create_time = time();
|
$approveModel->create_time = time();
|
||||||
$approveModel->update_time = time();
|
$approveModel->update_time = time();
|
||||||
$approveModel->strict(false)->save();
|
$re = $approveModel->save();
|
||||||
} else {
|
} else {
|
||||||
// 有则更新状态
|
// 有则更新状态
|
||||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||||
@ -404,24 +405,23 @@ class TaskController extends BaseApiController
|
|||||||
}
|
}
|
||||||
$extend = [];
|
$extend = [];
|
||||||
$stage = $parmas['stage']; // 当前做的是任务第几阶段
|
$stage = $parmas['stage']; // 当前做的是任务第几阶段
|
||||||
$extend['stage'] = $stage;
|
|
||||||
if ($stage == 1) {
|
if ($stage == 1) {
|
||||||
$extend = $parmas['stage1'];
|
$parmas['stage1']['is_commit'] = 1;
|
||||||
$extend['stage1']['is_commit'] = 1;
|
$extend['stage1'] = $parmas['stage1'];
|
||||||
}
|
}
|
||||||
if ($stage == 2) {
|
if ($stage == 2) {
|
||||||
$extend = $parmas['stage2'];
|
|
||||||
$extend['stage2']['is_commit'] = 1;
|
$extend['stage2']['is_commit'] = 1;
|
||||||
|
$extend['stage2'] = $parmas['stage2'];
|
||||||
}
|
}
|
||||||
if ($stage == 3) {
|
if ($stage == 3) {
|
||||||
$extend = $parmas['stage3'];
|
|
||||||
$extend['stage3']['is_commit'] = 1;
|
$extend['stage3']['is_commit'] = 1;
|
||||||
|
$extend['stage3'] = $parmas['stage3'];
|
||||||
}
|
}
|
||||||
if ($stage == 4) {
|
if ($stage == 4) {
|
||||||
$extend = $parmas['stage4'];
|
|
||||||
$extend['stage4']['is_commit'] = 1;
|
$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 指派人
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
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 {
|
try {
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
|
@ -699,12 +699,13 @@ class TaskLogic extends BaseLogic
|
|||||||
// 请求商城接口,获取完成几家 todo
|
// 请求商城接口,获取完成几家 todo
|
||||||
$param['start_time'] = strtotime(date('Y-m-d', $templateInfo['cretate_time'])) + 86400;
|
$param['start_time'] = strtotime(date('Y-m-d', $templateInfo['cretate_time'])) + 86400;
|
||||||
$param['end_time'] = time();
|
$param['end_time'] = time();
|
||||||
|
$param['responsible_area'] = $townCompany['responsible_area'];
|
||||||
$result = ShopRequestLogic::getSupplyChainMerchantCount($param);
|
$result = ShopRequestLogic::getSupplyChainMerchantCount($param);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
Log::error('查询供应链商户统计接口失败'.ShopRequestLogic::getError());
|
Log::error('查询供应链商户统计接口失败'.ShopRequestLogic::getError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$count = 0; // todo 从$result取值
|
$count = $result['count']; // todo 从$result取值
|
||||||
|
|
||||||
// 完成数小于3,关闭任务,不做结算
|
// 完成数小于3,关闭任务,不做结算
|
||||||
if ($count < 3){
|
if ($count < 3){
|
||||||
@ -752,8 +753,8 @@ class TaskLogic extends BaseLogic
|
|||||||
];
|
];
|
||||||
$result = ShopRequestLogic::getProductListing($param);
|
$result = ShopRequestLogic::getProductListing($param);
|
||||||
Log::info(['4.市场部长-供应链商户完成商品上架和库存更新任务-查询商城接口结果', json_encode($result)]);
|
Log::info(['4.市场部长-供应链商户完成商品上架和库存更新任务-查询商城接口结果', json_encode($result)]);
|
||||||
// 完成则结算 todo 返回字段要对接
|
// 达到目标数 完成则结算 todo 返回字段要对接
|
||||||
if ($result['is_done'] == 1){
|
if ($result['count'] >= $templateInfo['extend']['target']){
|
||||||
// 结算金额 任务金额/目标数 * 天数
|
// 结算金额 任务金额/目标数 * 天数
|
||||||
$taskInfo['money'] = bcmul($templateInfo['stage_day_one'], bcdiv($templateInfo['money'], $templateInfo['extend']['target']));
|
$taskInfo['money'] = bcmul($templateInfo['stage_day_one'], bcdiv($templateInfo['money'], $templateInfo['extend']['target']));
|
||||||
Log::info(['5.市场部长-供应链商户完成商品上架任务-$taskSchedulePlan', json_encode($taskSchedulePlan)]);
|
Log::info(['5.市场部长-供应链商户完成商品上架任务-$taskSchedulePlan', json_encode($taskSchedulePlan)]);
|
||||||
@ -1278,10 +1279,10 @@ class TaskLogic extends BaseLogic
|
|||||||
|
|
||||||
// todo 返回字段要对接
|
// todo 返回字段要对接
|
||||||
$result = ShopRequestLogic::getGeneralMerchantProductListing($param);
|
$result = ShopRequestLogic::getGeneralMerchantProductListing($param);
|
||||||
$isDone = $result['is_done'];
|
$count = $result['count'];
|
||||||
Log::info(['4.市场部长-一般商户完成商品上架任务-查询商城接口结果', json_encode($result)]);
|
Log::info(['4.市场部长-一般商户完成商品上架任务-查询商城接口结果', json_encode($result)]);
|
||||||
// 任一商户未完成,判定为未完成
|
// 任一商户未完成,判定为未完成
|
||||||
if (!$isDone) {
|
if ($count < 200) {
|
||||||
$taskIsDone = false;
|
$taskIsDone = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1511,13 +1512,13 @@ class TaskLogic extends BaseLogic
|
|||||||
];
|
];
|
||||||
// todo 对接接口实际返回参数
|
// todo 对接接口实际返回参数
|
||||||
$result = ShopRequestLogic::getGeneralMerchantTradeAmount($param);
|
$result = ShopRequestLogic::getGeneralMerchantTradeAmount($param);
|
||||||
$procureAmount = $result['procure_amount'];
|
$tradeAmount = $result['trade_amount'];
|
||||||
$rate = bcdiv($procureAmount, $targetProcureAmount, 1);
|
$rate = bcdiv($tradeAmount, $targetProcureAmount, 1);
|
||||||
if (bccomp($rate, 0.5, 1) == -1) {
|
if (bccomp($rate, 0.5, 1) == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$taskMoney = 0;
|
$taskMoney = 0;
|
||||||
if ($procureAmount >= 100000) {
|
if ($tradeAmount >= 100000) {
|
||||||
$taskMoney = $totalMoney;
|
$taskMoney = $totalMoney;
|
||||||
} else {
|
} else {
|
||||||
// 计算结算金额 周期天数*(money/目标数)*实际完成率*对应发放比例
|
// 计算结算金额 周期天数*(money/目标数)*实际完成率*对应发放比例
|
||||||
@ -2074,6 +2075,47 @@ class TaskLogic extends BaseLogic
|
|||||||
// 关闭任务
|
// 关闭任务
|
||||||
(new Task())->closeTask($task['id']);
|
(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()]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,20 +10,20 @@ require_once __DIR__ . '/../../vendor/autoload.php';
|
|||||||
$gateway = new Gateway("Websocket://0.0.0.0:8282");
|
$gateway = new Gateway("Websocket://0.0.0.0:8282");
|
||||||
|
|
||||||
// gateway名称,status方便查看
|
// gateway名称,status方便查看
|
||||||
$gateway->name = 'worker_im';
|
$gateway->name = 'worker_task_im';
|
||||||
|
|
||||||
// gateway进程数,一般设置2个就足够
|
// gateway进程数,一般设置2个就足够
|
||||||
$gateway->count = 4;
|
$gateway->count = 4;
|
||||||
|
|
||||||
// 本机ip,分布式部署时使用内网ip
|
// 本机ip,分布式部署时使用内网ip
|
||||||
$gateway->lanIp = '127.0.0.1';
|
$gateway->lanIp = '172.19.97.179';
|
||||||
|
|
||||||
// 内部通讯起始端口,假如$gateway->count=2,起始端口为2900
|
// 内部通讯起始端口,假如$gateway->count=2,起始端口为2900
|
||||||
// 则一般会使用2900 2901 2902 2903 4个端口作为内部通讯端口
|
// 则一般会使用3900 3901 3902 3903 4个端口作为内部通讯端口
|
||||||
$gateway->startPort = 2900;
|
$gateway->startPort = 3900;
|
||||||
|
|
||||||
// 服务注册地址
|
// 服务注册地址
|
||||||
$gateway->registerAddress = '127.0.0.1:1236';
|
$gateway->registerAddress = '172.19.97.179:1236';
|
||||||
|
|
||||||
// 心跳间隔
|
// 心跳间隔
|
||||||
$gateway->pingInterval = 20;
|
$gateway->pingInterval = 20;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user