From c4e27aaceb3fdc9f1b1937b8563669290804b9a9 Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Mon, 19 Feb 2024 17:49:52 +0800 Subject: [PATCH] update --- .../ProjectCostAdjustmentController.php | 20 ++++++++++ .../project/ProjectCostBudgetController.php | 20 ++++++++++ .../ProjectEquipmentBudgetController.php | 21 +++++++++- .../ProjectExpenseReimbursementController.php | 20 ++++++++++ .../project/ProjectLaborBudgetController.php | 22 ++++++++++- .../project/ProjectLoanApplyController.php | 20 ++++++++++ .../ProjectMaterialBudgetController.php | 20 ++++++++++ .../project/ProjectSettlementController.php | 20 ++++++++++ ...ProjectSubcontractSettlementController.php | 20 ++++++++++ .../ProjectSubpackageBudgetController.php | 20 ++++++++++ .../project/ProjectTotalBudgetController.php | 20 ++++++++++ .../ProjectTravelReimbursementController.php | 20 ++++++++++ .../project/ProjectTripApplyController.php | 20 ++++++++++ .../project/ProjectCostAdjustmentLogic.php | 39 ++++++++++++++++--- .../logic/project/ProjectCostBudgetLogic.php | 39 ++++++++++++++++--- .../project/ProjectEquipmentBudgetLogic.php | 39 ++++++++++++++++--- .../ProjectExpenseReimbursementLogic.php | 39 ++++++++++++++++--- .../logic/project/ProjectLaborBudgetLogic.php | 39 ++++++++++++++++--- .../logic/project/ProjectLoanApplyLogic.php | 39 ++++++++++++++++--- .../project/ProjectMaterialBudgetLogic.php | 39 ++++++++++++++++--- .../logic/project/ProjectSettlementLogic.php | 39 ++++++++++++++++--- .../ProjectSubcontractSettlementLogic.php | 39 ++++++++++++++++--- .../project/ProjectSubpackageBudgetLogic.php | 39 ++++++++++++++++--- .../logic/project/ProjectTotalBudgetLogic.php | 39 ++++++++++++++++--- .../ProjectTravelReimbursementLogic.php | 39 ++++++++++++++++--- .../logic/project/ProjectTripApplyLogic.php | 39 ++++++++++++++++--- .../project/ProjectCostAdjustmentValidate.php | 25 ++++++++++-- .../project/ProjectCostBudgetValidate.php | 25 ++++++++++-- .../ProjectEquipmentBudgetValidate.php | 25 ++++++++++-- .../ProjectExpenseReimbursementValidate.php | 25 ++++++++++-- .../project/ProjectLaborBudgetValidate.php | 25 ++++++++++-- .../project/ProjectLoanApplyValidate.php | 25 ++++++++++-- .../project/ProjectMaterialBudgetValidate.php | 24 ++++++++++-- .../project/ProjectSettlementValidate.php | 25 ++++++++++-- .../ProjectSubcontractSettlementValidate.php | 25 ++++++++++-- .../ProjectSubpackageBudgetValidate.php | 25 ++++++++++-- .../project/ProjectTotalBudgetValidate.php | 23 +++++++++-- .../ProjectTravelReimbursementValidate.php | 25 ++++++++++-- .../project/ProjectTripApplyValidate.php | 25 ++++++++++-- 39 files changed, 985 insertions(+), 107 deletions(-) diff --git a/app/adminapi/controller/project/ProjectCostAdjustmentController.php b/app/adminapi/controller/project/ProjectCostAdjustmentController.php index b01594dfa..1880f127b 100644 --- a/app/adminapi/controller/project/ProjectCostAdjustmentController.php +++ b/app/adminapi/controller/project/ProjectCostAdjustmentController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectCostAdjustmentLists; use app\adminapi\logic\project\ProjectCostAdjustmentLogic; use app\adminapi\validate\project\ProjectCostAdjustmentValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectCostAdjustmentController extends BaseAdminController $result = ProjectCostAdjustmentLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','cbtz')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectCostAdjustmentValidate())->post()->goCheck('approve'); + $result = ProjectCostAdjustmentLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectCostAdjustmentLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectCostBudgetController.php b/app/adminapi/controller/project/ProjectCostBudgetController.php index 616b80c97..c5cdabc68 100644 --- a/app/adminapi/controller/project/ProjectCostBudgetController.php +++ b/app/adminapi/controller/project/ProjectCostBudgetController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectCostBudgetLists; use app\adminapi\logic\project\ProjectCostBudgetLogic; use app\adminapi\validate\project\ProjectCostBudgetValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectCostBudgetController extends BaseAdminController $result = ProjectCostBudgetLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','fyys')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectCostBudgetValidate())->post()->goCheck('approve'); + $result = ProjectCostBudgetLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectCostBudgetLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectEquipmentBudgetController.php b/app/adminapi/controller/project/ProjectEquipmentBudgetController.php index 5596a198f..15db44cfe 100644 --- a/app/adminapi/controller/project/ProjectEquipmentBudgetController.php +++ b/app/adminapi/controller/project/ProjectEquipmentBudgetController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectEquipmentBudgetLists; use app\adminapi\logic\project\ProjectEquipmentBudgetLogic; use app\adminapi\validate\project\ProjectEquipmentBudgetValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,23 @@ class ProjectEquipmentBudgetController extends BaseAdminController $result = ProjectEquipmentBudgetLogic::detail($params); return $this->data($result); } - + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','jjys')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectEquipmentBudgetValidate())->post()->goCheck('approve'); + $result = ProjectEquipmentBudgetLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectEquipmentBudgetLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectExpenseReimbursementController.php b/app/adminapi/controller/project/ProjectExpenseReimbursementController.php index 8c5661836..fd1ffdd98 100644 --- a/app/adminapi/controller/project/ProjectExpenseReimbursementController.php +++ b/app/adminapi/controller/project/ProjectExpenseReimbursementController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectExpenseReimbursementLists; use app\adminapi\logic\project\ProjectExpenseReimbursementLogic; use app\adminapi\validate\project\ProjectExpenseReimbursementValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectExpenseReimbursementController extends BaseAdminController $result = ProjectExpenseReimbursementLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','fybx')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectExpenseReimbursementValidate())->post()->goCheck('approve'); + $result = ProjectExpenseReimbursementLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectExpenseReimbursementLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectLaborBudgetController.php b/app/adminapi/controller/project/ProjectLaborBudgetController.php index df4fc8cca..82f85ba05 100644 --- a/app/adminapi/controller/project/ProjectLaborBudgetController.php +++ b/app/adminapi/controller/project/ProjectLaborBudgetController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectLaborBudgetLists; use app\adminapi\logic\project\ProjectLaborBudgetLogic; use app\adminapi\validate\project\ProjectLaborBudgetValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,22 @@ class ProjectLaborBudgetController extends BaseAdminController $result = ProjectLaborBudgetLogic::detail($params); return $this->data($result); } - - + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','rgys')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectLaborBudgetValidate())->post()->goCheck('approve'); + $result = ProjectLaborBudgetLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectLaborBudgetLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectLoanApplyController.php b/app/adminapi/controller/project/ProjectLoanApplyController.php index d97992255..fa924a291 100644 --- a/app/adminapi/controller/project/ProjectLoanApplyController.php +++ b/app/adminapi/controller/project/ProjectLoanApplyController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectLoanApplyLists; use app\adminapi\logic\project\ProjectLoanApplyLogic; use app\adminapi\validate\project\ProjectLoanApplyValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectLoanApplyController extends BaseAdminController $result = ProjectLoanApplyLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','jksq')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectLoanApplyValidate())->post()->goCheck('approve'); + $result = ProjectLoanApplyLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectLoanApplyLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectMaterialBudgetController.php b/app/adminapi/controller/project/ProjectMaterialBudgetController.php index f0e142805..85bf42671 100644 --- a/app/adminapi/controller/project/ProjectMaterialBudgetController.php +++ b/app/adminapi/controller/project/ProjectMaterialBudgetController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectMaterialBudgetLists; use app\adminapi\logic\project\ProjectMaterialBudgetLogic; use app\adminapi\validate\project\ProjectMaterialBudgetValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectMaterialBudgetController extends BaseAdminController $result = ProjectMaterialBudgetLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','clys')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectMaterialBudgetValidate())->post()->goCheck('approve'); + $result = ProjectMaterialBudgetLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectMaterialBudgetLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectSettlementController.php b/app/adminapi/controller/project/ProjectSettlementController.php index 86bd31e18..3d1097e38 100644 --- a/app/adminapi/controller/project/ProjectSettlementController.php +++ b/app/adminapi/controller/project/ProjectSettlementController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectSettlementLists; use app\adminapi\logic\project\ProjectSettlementLogic; use app\adminapi\validate\project\ProjectSettlementValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -72,6 +74,24 @@ class ProjectSettlementController extends BaseAdminController $result = ProjectSettlementLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','jfjs')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectSettlementValidate())->post()->goCheck('approve'); + $result = ProjectSettlementLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectSettlementLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectSubcontractSettlementController.php b/app/adminapi/controller/project/ProjectSubcontractSettlementController.php index 5e4d93f37..df7579e17 100644 --- a/app/adminapi/controller/project/ProjectSubcontractSettlementController.php +++ b/app/adminapi/controller/project/ProjectSubcontractSettlementController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectSubcontractSettlementLists; use app\adminapi\logic\project\ProjectSubcontractSettlementLogic; use app\adminapi\validate\project\ProjectSubcontractSettlementValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -70,6 +72,24 @@ class ProjectSubcontractSettlementController extends BaseAdminController $result = ProjectSubcontractSettlementLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','fbjs')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectSubcontractSettlementValidate())->post()->goCheck('approve'); + $result = ProjectSubcontractSettlementLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectSubcontractSettlementLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectSubpackageBudgetController.php b/app/adminapi/controller/project/ProjectSubpackageBudgetController.php index f1ada8919..1c28a470f 100644 --- a/app/adminapi/controller/project/ProjectSubpackageBudgetController.php +++ b/app/adminapi/controller/project/ProjectSubpackageBudgetController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectSubpackageBudgetLists; use app\adminapi\logic\project\ProjectSubpackageBudgetLogic; use app\adminapi\validate\project\ProjectSubpackageBudgetValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectSubpackageBudgetController extends BaseAdminController $result = ProjectSubpackageBudgetLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','fbys')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectSubpackageBudgetValidate())->post()->goCheck('approve'); + $result = ProjectSubpackageBudgetLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectSubpackageBudgetLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectTotalBudgetController.php b/app/adminapi/controller/project/ProjectTotalBudgetController.php index d70dfddd7..e9bbf7295 100644 --- a/app/adminapi/controller/project/ProjectTotalBudgetController.php +++ b/app/adminapi/controller/project/ProjectTotalBudgetController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectTotalBudgetLists; use app\adminapi\logic\project\ProjectTotalBudgetLogic; use app\adminapi\validate\project\ProjectTotalBudgetValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectTotalBudgetController extends BaseAdminController $result = ProjectTotalBudgetLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','xmzys')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectTotalBudgetValidate())->post()->goCheck('approve'); + $result = ProjectTotalBudgetLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectTotalBudgetLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectTravelReimbursementController.php b/app/adminapi/controller/project/ProjectTravelReimbursementController.php index 623482d27..c5f530f98 100644 --- a/app/adminapi/controller/project/ProjectTravelReimbursementController.php +++ b/app/adminapi/controller/project/ProjectTravelReimbursementController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectTravelReimbursementLists; use app\adminapi\logic\project\ProjectTravelReimbursementLogic; use app\adminapi\validate\project\ProjectTravelReimbursementValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectTravelReimbursementController extends BaseAdminController $result = ProjectTravelReimbursementLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','clbx')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectTravelReimbursementValidate())->post()->goCheck('approve'); + $result = ProjectTravelReimbursementLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectTravelReimbursementLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/controller/project/ProjectTripApplyController.php b/app/adminapi/controller/project/ProjectTripApplyController.php index 4c1480a8d..2507fb19a 100644 --- a/app/adminapi/controller/project/ProjectTripApplyController.php +++ b/app/adminapi/controller/project/ProjectTripApplyController.php @@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\project\ProjectTripApplyLists; use app\adminapi\logic\project\ProjectTripApplyLogic; use app\adminapi\validate\project\ProjectTripApplyValidate; +use app\common\model\oa\Flow; +use app\common\model\oa\FlowType; /** @@ -103,6 +105,24 @@ class ProjectTripApplyController extends BaseAdminController $result = ProjectTripApplyLogic::detail($params); return $this->data($result); } + + public function flows(): \think\response\Json + { + $flow_type = FlowType::where('type',4)->where('name','ccsq')->findOrEmpty(); + $data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select(); + return $this->success('请求成功',$data->toArray()); + } + + //添加审批 + public function approve(): \think\response\Json + { + $params = (new ProjectTripApplyValidate())->post()->goCheck('approve'); + $result = ProjectTripApplyLogic::approve($params,$this->adminId); + if (true === $result) { + return $this->success('提交审核信息成功', [], 1, 1); + } + return $this->fail(ProjectTripApplyLogic::getError()); + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectCostAdjustmentLogic.php b/app/adminapi/logic/project/ProjectCostAdjustmentLogic.php index 91dcf89b5..ff37d3397 100644 --- a/app/adminapi/logic/project/ProjectCostAdjustmentLogic.php +++ b/app/adminapi/logic/project/ProjectCostAdjustmentLogic.php @@ -114,17 +114,46 @@ class ProjectCostAdjustmentLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectCostAdjustment::field('id,project_id,adjust_date,adjust_amount,remark,annex,add_user,update_user,create_time,update_time')->findOrEmpty($params['id']); + $data = ProjectCostAdjustment::field('id,project_id,adjust_date,adjust_amount,remark,annex,add_user,update_user,create_time,update_time,approve_id')->findOrEmpty($params['id']); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $admin = Admin::where('id','in',[$data['add_user'],$data['update_user']])->column('name','id'); $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['add_user'] = $admin[$data['add_user']]; $data['update_user'] = $admin[$data['update_user']]; - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectCostAdjustment') - ->where('content_logic','app\adminapi\logic\project\ProjectCostAdjustmentLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectCostAdjustment::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '成本调整', + $params['id'], + 'app\common\model\project\ProjectCostAdjustment', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectCostAdjustment::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectCostBudgetLogic.php b/app/adminapi/logic/project/ProjectCostBudgetLogic.php index 2c4d650a3..77b6cba69 100644 --- a/app/adminapi/logic/project/ProjectCostBudgetLogic.php +++ b/app/adminapi/logic/project/ProjectCostBudgetLogic.php @@ -150,7 +150,7 @@ class ProjectCostBudgetLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectCostBudget::field('id,org_id,dept_id,project_id,cost_budget_code,remark,annex')->findOrEmpty($params['id']); + $data = ProjectCostBudget::field('id,org_id,dept_id,project_id,cost_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']); $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); @@ -158,10 +158,39 @@ class ProjectCostBudgetLogic extends BaseLogic $data['dept_name'] = $dept['name']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectCostBudget') - ->where('content_logic','app\adminapi\logic\project\ProjectCostBudgetLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectCostBudget::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '费用预算', + $params['id'], + 'app\common\model\project\ProjectCostBudget', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectCostBudget::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectEquipmentBudgetLogic.php b/app/adminapi/logic/project/ProjectEquipmentBudgetLogic.php index fb46db33a..798ccc2ce 100644 --- a/app/adminapi/logic/project/ProjectEquipmentBudgetLogic.php +++ b/app/adminapi/logic/project/ProjectEquipmentBudgetLogic.php @@ -158,7 +158,7 @@ class ProjectEquipmentBudgetLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectEquipmentBudget::field('id,org_id,dept_id,project_id,equipment_budget_code,remark,annex')->findOrEmpty($params['id']); + $data = ProjectEquipmentBudget::field('id,org_id,dept_id,project_id,equipment_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']); $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); @@ -166,10 +166,39 @@ class ProjectEquipmentBudgetLogic extends BaseLogic $data['dept_name'] = $dept['name']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectEquipmentBudget') - ->where('content_logic','app\adminapi\logic\project\ProjectEquipmentBudgetLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectEquipmentBudget::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '机具预算', + $params['id'], + 'app\common\model\project\ProjectEquipmentBudget', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectEquipmentBudget::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectExpenseReimbursementLogic.php b/app/adminapi/logic/project/ProjectExpenseReimbursementLogic.php index 38191b4f6..0a995482f 100644 --- a/app/adminapi/logic/project/ProjectExpenseReimbursementLogic.php +++ b/app/adminapi/logic/project/ProjectExpenseReimbursementLogic.php @@ -214,7 +214,7 @@ class ProjectExpenseReimbursementLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectExpenseReimbursement::field('id,expense_reimbursement_code,project_id,apply_user,apply_date,reimbursement_type,loan_apply_id,offset_loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id') + $data = ProjectExpenseReimbursement::field('id,expense_reimbursement_code,project_id,apply_user,apply_date,reimbursement_type,loan_apply_id,offset_loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id') ->findOrEmpty($params['id']); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id',$data['loan_apply_id'])->findOrEmpty(); @@ -226,10 +226,39 @@ class ProjectExpenseReimbursementLogic extends BaseLogic $data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount']; $data['reimbursement_type_text'] = $data->reimbursement_type_text; $data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty(); - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectExpenseReimbursement') - ->where('content_logic','app\adminapi\logic\project\ProjectExpenseReimbursementLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectExpenseReimbursement::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '费用报销', + $params['id'], + 'app\common\model\project\ProjectExpenseReimbursement', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectExpenseReimbursement::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectLaborBudgetLogic.php b/app/adminapi/logic/project/ProjectLaborBudgetLogic.php index 6eebb8daf..7a7981409 100644 --- a/app/adminapi/logic/project/ProjectLaborBudgetLogic.php +++ b/app/adminapi/logic/project/ProjectLaborBudgetLogic.php @@ -154,7 +154,7 @@ class ProjectLaborBudgetLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectLaborBudget::field('id,org_id,dept_id,project_id,labor_budget_code,remark,annex')->findOrEmpty($params['id']); + $data = ProjectLaborBudget::field('id,org_id,dept_id,project_id,labor_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']); $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); @@ -162,10 +162,39 @@ class ProjectLaborBudgetLogic extends BaseLogic $data['dept_name'] = $dept['name']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectLaborBudget') - ->where('content_logic','app\adminapi\logic\project\ProjectLaborBudgetLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectLaborBudget::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '人工预算', + $params['id'], + 'app\common\model\project\ProjectLaborBudget', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectLaborBudget::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectLoanApplyLogic.php b/app/adminapi/logic/project/ProjectLoanApplyLogic.php index db7c4de55..3648c01dc 100644 --- a/app/adminapi/logic/project/ProjectLoanApplyLogic.php +++ b/app/adminapi/logic/project/ProjectLoanApplyLogic.php @@ -122,16 +122,45 @@ class ProjectLoanApplyLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectLoanApply::field('id,project_id,loan_apply_code,apply_user,loan_date,loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id') + $data = ProjectLoanApply::field('id,project_id,loan_apply_code,apply_user,loan_date,loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id') ->findOrEmpty($params['id']); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty(); - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectLoanApply') - ->where('content_logic','app\adminapi\logic\project\ProjectLoanApplyLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectLoanApply::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '借款申请', + $params['id'], + 'app\common\model\project\ProjectLoanApply', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectLoanApply::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectMaterialBudgetLogic.php b/app/adminapi/logic/project/ProjectMaterialBudgetLogic.php index a99262083..224d526c5 100644 --- a/app/adminapi/logic/project/ProjectMaterialBudgetLogic.php +++ b/app/adminapi/logic/project/ProjectMaterialBudgetLogic.php @@ -153,7 +153,7 @@ class ProjectMaterialBudgetLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectMaterialBudget::field('id,org_id,dept_id,project_id,material_budget_code,remark,annex')->findOrEmpty($params['id']); + $data = ProjectMaterialBudget::field('id,org_id,dept_id,project_id,material_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']); $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); @@ -161,10 +161,39 @@ class ProjectMaterialBudgetLogic extends BaseLogic $data['dept_name'] = $dept['name']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectMaterialBudget') - ->where('content_logic','app\adminapi\logic\project\ProjectMaterialBudgetLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectMaterialBudget::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '材料预算', + $params['id'], + 'app\common\model\project\ProjectMaterialBudget', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectMaterialBudget::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectSettlementLogic.php b/app/adminapi/logic/project/ProjectSettlementLogic.php index 5d2d4c09c..caf958ecb 100644 --- a/app/adminapi/logic/project/ProjectSettlementLogic.php +++ b/app/adminapi/logic/project/ProjectSettlementLogic.php @@ -117,7 +117,7 @@ class ProjectSettlementLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectSettlement::field('id,settlement_code,project_id,contract_id,settlement_amount,settlement_date,remark,annex')->findOrEmpty($params['id'])->toArray(); + $data = ProjectSettlement::field('id,settlement_code,project_id,contract_id,settlement_amount,settlement_date,remark,annex,approve_id')->findOrEmpty($params['id'])->toArray(); $project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $contract = Contract::field('contract_name,contract_code,amount')->where('id',$data['contract_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); @@ -132,10 +132,39 @@ class ProjectSettlementLogic extends BaseLogic $data['negotiation_amount'] = ContractNegotiation::where('contract_id',$data['contract_id'])->sum('negotiation_amount'); //结算差异 $data['settlement_difference'] = bcsub(($data['contract_amount']+$data['negotiation_amount']),$data['settlement_amount']); - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectSettlement') - ->where('content_logic','app\adminapi\logic\project\ProjectSettlementLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data; } + + public static function approve($params,$admin_id): bool{ + $data = ProjectSettlement::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '甲方结算', + $params['id'], + 'app\common\model\project\ProjectSettlement', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectSettlement::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectSubcontractSettlementLogic.php b/app/adminapi/logic/project/ProjectSubcontractSettlementLogic.php index 55bcfaa25..9ff62651f 100644 --- a/app/adminapi/logic/project/ProjectSubcontractSettlementLogic.php +++ b/app/adminapi/logic/project/ProjectSubcontractSettlementLogic.php @@ -118,7 +118,7 @@ class ProjectSubcontractSettlementLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectSubcontractSettlement::field('id,settlement_code,project_id,contract_id,settlement_amount,settlement_date,remark,annex')->findOrEmpty($params['id'])->toArray(); + $data = ProjectSubcontractSettlement::field('id,settlement_code,project_id,contract_id,settlement_amount,settlement_date,remark,annex,approve_id')->findOrEmpty($params['id'])->toArray(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $contract = SubcontractingContract::field('supplier_id,contract_no,contract_name')->where('id',$data['contract_id'])->findOrEmpty(); $supplier = Supplier::field('supplier_code,supplier_name')->where('id',$contract['supplier_id'])->findOrEmpty(); @@ -134,10 +134,39 @@ class ProjectSubcontractSettlementLogic extends BaseLogic $data['negotiation_amount'] = SubcontractingContractNegotiation::where('contract_id',$data['contract_id'])->sum('negotiation_amount'); //结算差异 $data['settlement_difference'] = bcsub(($data['contract_amount']+$data['negotiation_amount']),$data['settlement_amount']); - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectSubcontractSettlement') - ->where('content_logic','app\adminapi\logic\project\ProjectSubcontractSettlementLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data; } + + public static function approve($params,$admin_id): bool{ + $data = ProjectSubcontractSettlement::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '分包结算', + $params['id'], + 'app\common\model\project\ProjectSubcontractSettlement', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectSubcontractSettlement::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectSubpackageBudgetLogic.php b/app/adminapi/logic/project/ProjectSubpackageBudgetLogic.php index bbe8cb48b..54c90c900 100644 --- a/app/adminapi/logic/project/ProjectSubpackageBudgetLogic.php +++ b/app/adminapi/logic/project/ProjectSubpackageBudgetLogic.php @@ -160,7 +160,7 @@ class ProjectSubpackageBudgetLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectSubpackageBudget::field('id,org_id,dept_id,project_id,subpackage_budget_code,remark,annex')->findOrEmpty($params['id']); + $data = ProjectSubpackageBudget::field('id,org_id,dept_id,project_id,subpackage_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']); $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); @@ -168,10 +168,39 @@ class ProjectSubpackageBudgetLogic extends BaseLogic $data['dept_name'] = $dept['name']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectSubpackageBudget') - ->where('content_logic','app\adminapi\logic\project\ProjectSubpackageBudgetLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectSubpackageBudget::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '分包预算', + $params['id'], + 'app\common\model\project\ProjectSubpackageBudget', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectSubpackageBudget::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectTotalBudgetLogic.php b/app/adminapi/logic/project/ProjectTotalBudgetLogic.php index 51e5b48cc..52ab2c2e9 100644 --- a/app/adminapi/logic/project/ProjectTotalBudgetLogic.php +++ b/app/adminapi/logic/project/ProjectTotalBudgetLogic.php @@ -130,7 +130,7 @@ class ProjectTotalBudgetLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectTotalBudget::field('id,org_id,dept_id,project_id,total_budget_code,contract_amount,cl_cost,fb_cost,rg_cost,fy_cost,jj_cost,remark,budget_list,budget_date,project_manager') + $data = ProjectTotalBudget::field('id,org_id,dept_id,project_id,total_budget_code,contract_amount,cl_cost,fb_cost,rg_cost,fy_cost,jj_cost,remark,budget_list,budget_date,project_manager,approve_id') ->findOrEmpty($params['id']); $org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty(); $dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty(); @@ -155,10 +155,39 @@ class ProjectTotalBudgetLogic extends BaseLogic $data['fy_cost_ratio'] = number_format($data['fy_cost'] / $data['total_cost'],2); //机具成本占比 $data['jj_cost_ratio'] = number_format($data['jj_cost'] / $data['total_cost'],2); - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectTotalBudget') - ->where('content_logic','app\adminapi\logic\project\ProjectTotalBudgetLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectTotalBudget::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '项目总预算', + $params['id'], + 'app\common\model\project\ProjectTotalBudget', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectTotalBudget::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectTravelReimbursementLogic.php b/app/adminapi/logic/project/ProjectTravelReimbursementLogic.php index 42f67386d..117a8d56b 100644 --- a/app/adminapi/logic/project/ProjectTravelReimbursementLogic.php +++ b/app/adminapi/logic/project/ProjectTravelReimbursementLogic.php @@ -236,7 +236,7 @@ class ProjectTravelReimbursementLogic extends BaseLogic */ public static function detail($params): array { - $field = 'id,trip_apply_id,project_id,trip_reimbursement_code,reimbursement_type,loan_apply_id,offset_loan_amount,apply_user,apply_date,payee_name,payee_bank,payee_account,remark,annex,bank_account_id'; + $field = 'id,trip_apply_id,project_id,trip_reimbursement_code,reimbursement_type,loan_apply_id,offset_loan_amount,apply_user,apply_date,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id'; $data = ProjectTravelReimbursement::field($field) ->findOrEmpty($params['id']); $trip_apply = ProjectTripApply::field('trip_apply_code')->where('id',$data['trip_apply_id'])->findOrEmpty(); @@ -258,10 +258,39 @@ class ProjectTravelReimbursementLogic extends BaseLogic $data['total_amount'] = ProjectTravelReimbursementDetail::where('travel_reimbursement_id',$data['id'])->sum('total_amount'); $data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount']; $data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty(); - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectTravelReimbursement') - ->where('content_logic','app\adminapi\logic\project\ProjectTravelReimbursementLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectTravelReimbursement::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '差旅报销', + $params['id'], + 'app\common\model\project\ProjectTravelReimbursement', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectTravelReimbursement::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/logic/project/ProjectTripApplyLogic.php b/app/adminapi/logic/project/ProjectTripApplyLogic.php index 3cb26e6a1..f80a9a949 100644 --- a/app/adminapi/logic/project/ProjectTripApplyLogic.php +++ b/app/adminapi/logic/project/ProjectTripApplyLogic.php @@ -123,7 +123,7 @@ class ProjectTripApplyLogic extends BaseLogic */ public static function detail($params): array { - $data = ProjectTripApply::field('id,project_id,trip_apply_code,origin_address,target_address,traffic,start_date,end_date,reason,days,remark,annex') + $data = ProjectTripApply::field('id,project_id,trip_apply_code,origin_address,target_address,traffic,start_date,end_date,reason,days,remark,annex,approve_id') ->findOrEmpty($params['id']); $project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $manager = ProjectManagerAppointment::field('project_manager')->where('project_id',$data['project_id'])->findOrEmpty(); @@ -136,10 +136,39 @@ class ProjectTripApplyLogic extends BaseLogic $admin = Admin::field('name')->where('id',$manager['project_manager'])->findOrEmpty(); $data['project_manager'] = $admin['name']; } - $approve_info = FlowApprove::field('id')->where('content_id',$params['id']) - ->where('content_model','app\common\model\project\ProjectTripApply') - ->where('content_logic','app\adminapi\logic\project\ProjectTripApplyLogic')->findOrEmpty(); - $data['approve_id'] = $approve_info['id']; + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + $data['approve_check_status'] = $approve_data['check_status']; return $data->toArray(); } + + public static function approve($params,$admin_id): bool{ + $data = ProjectTripApply::where('id',$params['id'])->findOrEmpty(); + $approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty(); + if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){ + self::setError('当前内容存在审核信息,请勿重复提交'); + return false; + } + Db::startTrans(); + try { + $res = addApprove( + '出差申请', + $params['id'], + 'app\common\model\project\ProjectTripApply', + $params['path'], + $params['flow_id'], + $admin_id + ); + if($res){ + ProjectTripApply::where('id',$params['id'])->update([ + 'approve_id' => $res, + ]); + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } } \ No newline at end of file diff --git a/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php b/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php index 9591c9aea..a9761ccb0 100644 --- a/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php +++ b/app/adminapi/validate/project/ProjectCostAdjustmentValidate.php @@ -16,6 +16,7 @@ namespace app\adminapi\validate\project; use app\common\model\project\Project; +use app\common\model\project\ProjectCostAdjustment; use app\common\validate\BaseValidate; @@ -32,11 +33,13 @@ class ProjectCostAdjustmentValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'project_id' => 'require|checkProject', 'adjust_date' => 'require|dateFormat:Y-m-d', 'adjust_amount' => 'require|float|gt:0', 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; @@ -60,7 +63,7 @@ class ProjectCostAdjustmentValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -71,7 +74,9 @@ class ProjectCostAdjustmentValidate extends BaseValidate * @date 2024/01/17 13:43 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -97,6 +102,20 @@ class ProjectCostAdjustmentValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectCostAdjustment::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkProject($value): bool|string { $data = Project::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectCostBudgetValidate.php b/app/adminapi/validate/project/ProjectCostBudgetValidate.php index abbb09026..e0b262e74 100644 --- a/app/adminapi/validate/project/ProjectCostBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectCostBudgetValidate.php @@ -18,6 +18,7 @@ namespace app\adminapi\validate\project; use app\common\model\dept\Dept; use app\common\model\dept\Orgs; use app\common\model\project\Project; +use app\common\model\project\ProjectCostBudget; use app\common\model\project\ProjectCostBudgetDetail; use app\common\model\project\ProjectCostTempSet; use app\common\validate\BaseValidate; @@ -36,12 +37,14 @@ class ProjectCostBudgetValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'org_id' => 'require|checkOrg', 'dept_id' => 'require|checkDept', 'project_id' => 'require|checkProject', 'annex' => 'checkAnnex', 'cost_budget_detail' => 'require|checkCostBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; protected $message = [ @@ -61,7 +64,7 @@ class ProjectCostBudgetValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -72,7 +75,9 @@ class ProjectCostBudgetValidate extends BaseValidate * @date 2024/01/16 14:32 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -98,6 +103,20 @@ class ProjectCostBudgetValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectCostBudget::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkOrg($value): bool|string { $org = Orgs::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php b/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php index b8baaf170..7805855fc 100644 --- a/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectEquipmentBudgetValidate.php @@ -18,6 +18,7 @@ namespace app\adminapi\validate\project; use app\common\model\dept\Dept; use app\common\model\dept\Orgs; use app\common\model\project\Project; +use app\common\model\project\ProjectEquipmentBudget; use app\common\model\project\ProjectEquipmentBudgetDetail; use app\common\validate\BaseValidate; @@ -35,12 +36,14 @@ class ProjectEquipmentBudgetValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'org_id' => 'require|checkOrg', 'dept_id' => 'require|checkDept', 'project_id' => 'require|checkProject', 'annex' => 'checkAnnex', 'equipment_budget_detail' => 'require|checkEquipmentBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; protected $message = [ @@ -60,7 +63,7 @@ class ProjectEquipmentBudgetValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -71,7 +74,9 @@ class ProjectEquipmentBudgetValidate extends BaseValidate * @date 2024/01/16 11:40 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -97,6 +102,20 @@ class ProjectEquipmentBudgetValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectEquipmentBudget::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkOrg($value): bool|string { $org = Orgs::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php b/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php index 57ce16a12..aa6ff256c 100644 --- a/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php +++ b/app/adminapi/validate/project/ProjectExpenseReimbursementValidate.php @@ -19,6 +19,7 @@ use app\common\model\bank\BankAccount; use app\common\model\dict\DictData; use app\common\model\project\Project; use app\common\model\project\ProjectCostTempSet; +use app\common\model\project\ProjectExpenseReimbursement; use app\common\model\project\ProjectExpenseReimbursementDetail; use app\common\model\project\ProjectExpenseReimbursementInvoiceDetail; use app\common\model\project\ProjectLoanApply; @@ -38,7 +39,7 @@ class ProjectExpenseReimbursementValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'project_id' => 'require|checkProject', 'apply_user' => 'require', 'apply_date' => 'require|dateFormat:Y-m-d', @@ -52,6 +53,8 @@ class ProjectExpenseReimbursementValidate extends BaseValidate 'bank_account_id' => 'require|checkBankAccount', 'reimbursement_detail' => 'require|checkReimbursementDetail', 'invoice_detail' => 'require|checkInvoiceDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; @@ -84,7 +87,7 @@ class ProjectExpenseReimbursementValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -95,7 +98,9 @@ class ProjectExpenseReimbursementValidate extends BaseValidate * @date 2024/01/19 13:44 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -121,6 +126,20 @@ class ProjectExpenseReimbursementValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectExpenseReimbursement::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkProject($value): bool|string { $data = Project::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectLaborBudgetValidate.php b/app/adminapi/validate/project/ProjectLaborBudgetValidate.php index e3134ad63..66eb53643 100644 --- a/app/adminapi/validate/project/ProjectLaborBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectLaborBudgetValidate.php @@ -19,6 +19,7 @@ use app\common\model\dept\Dept; use app\common\model\dept\Orgs; use app\common\model\project\Project; use app\common\model\project\ProjectJobType; +use app\common\model\project\ProjectLaborBudget; use app\common\model\project\ProjectLaborBudgetDetail; use app\common\validate\BaseValidate; @@ -36,12 +37,14 @@ class ProjectLaborBudgetValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'org_id' => 'require|checkOrg', 'dept_id' => 'require|checkDept', 'project_id' => 'require|checkProject', 'annex' => 'checkAnnex', 'labor_budget_detail' => 'require|checkLaborBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; @@ -62,7 +65,7 @@ class ProjectLaborBudgetValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -73,7 +76,9 @@ class ProjectLaborBudgetValidate extends BaseValidate * @date 2024/01/16 09:26 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -99,6 +104,20 @@ class ProjectLaborBudgetValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectLaborBudget::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkOrg($value): bool|string { $org = Orgs::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectLoanApplyValidate.php b/app/adminapi/validate/project/ProjectLoanApplyValidate.php index 26c22fb09..95f6a7001 100644 --- a/app/adminapi/validate/project/ProjectLoanApplyValidate.php +++ b/app/adminapi/validate/project/ProjectLoanApplyValidate.php @@ -17,6 +17,7 @@ namespace app\adminapi\validate\project; use app\common\model\bank\BankAccount; use app\common\model\project\Project; +use app\common\model\project\ProjectLoanApply; use app\common\validate\BaseValidate; @@ -33,7 +34,7 @@ class ProjectLoanApplyValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'project_id' => 'require|checkProject', 'apply_user' => 'require', 'loan_date' => 'require|dateFormat:Y-m-d', @@ -43,6 +44,8 @@ class ProjectLoanApplyValidate extends BaseValidate 'payee_account' => 'require', 'annex' => 'checkAnnex', 'bank_account_id' => 'require|checkBankAccount', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; @@ -71,7 +74,7 @@ class ProjectLoanApplyValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -82,7 +85,9 @@ class ProjectLoanApplyValidate extends BaseValidate * @date 2024/01/17 11:05 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -108,6 +113,20 @@ class ProjectLoanApplyValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectLoanApply::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkProject($value): bool|string { $data = Project::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php b/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php index a73a6414b..eb776b447 100644 --- a/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectMaterialBudgetValidate.php @@ -35,12 +35,14 @@ class ProjectMaterialBudgetValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'org_id' => 'require|checkOrg', 'dept_id' => 'require|checkDept', 'project_id' => 'require|checkProject', 'annex' => 'checkAnnex', 'material_budget_detail' => 'require|checkMaterialBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; protected $message = [ @@ -60,7 +62,7 @@ class ProjectMaterialBudgetValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -71,7 +73,9 @@ class ProjectMaterialBudgetValidate extends BaseValidate * @date 2024/01/08 16:30 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -97,6 +101,20 @@ class ProjectMaterialBudgetValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectMaterialBudgetDetail::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkOrg($value): bool|string { $org = Orgs::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectSettlementValidate.php b/app/adminapi/validate/project/ProjectSettlementValidate.php index a96f6a59a..7ee4ec426 100644 --- a/app/adminapi/validate/project/ProjectSettlementValidate.php +++ b/app/adminapi/validate/project/ProjectSettlementValidate.php @@ -18,6 +18,7 @@ namespace app\adminapi\validate\project; use app\common\model\bid\BidBuyBiddingDocument; use app\common\model\contract\Contract; use app\common\model\project\Project; +use app\common\model\project\ProjectSettlement; use app\common\validate\BaseValidate; @@ -34,12 +35,14 @@ class ProjectSettlementValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'project_id' => 'require|checkProject', 'contract_id' => 'require|checkContract', 'settlement_amount' => 'require|float|egt:0', 'settlement_date' => 'require|dateFormat:Y-m-d', 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; protected $message = [ @@ -62,7 +65,7 @@ class ProjectSettlementValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -73,7 +76,9 @@ class ProjectSettlementValidate extends BaseValidate * @date 2023/12/29 10:22 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -99,6 +104,20 @@ class ProjectSettlementValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectSettlement::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkProject($value): bool|string { $data = Project::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php b/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php index 371f03fca..bbc4acde6 100644 --- a/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php +++ b/app/adminapi/validate/project/ProjectSubcontractSettlementValidate.php @@ -16,6 +16,7 @@ namespace app\adminapi\validate\project; use app\common\model\contract\SubcontractingContract; use app\common\model\project\Project; +use app\common\model\project\ProjectSubcontractSettlement; use app\common\validate\BaseValidate; @@ -32,12 +33,14 @@ class ProjectSubcontractSettlementValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'project_id' => 'require|checkProject', 'contract_id' => 'require|checkContract', 'settlement_amount' => 'require|float|egt:0', 'settlement_date' => 'require|dateFormat:Y-m-d', 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; protected $message = [ @@ -60,7 +63,7 @@ class ProjectSubcontractSettlementValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -71,7 +74,9 @@ class ProjectSubcontractSettlementValidate extends BaseValidate * @date 2023/12/29 13:59 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -97,6 +102,20 @@ class ProjectSubcontractSettlementValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectSubcontractSettlement::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkProject($value): bool|string { $data = Project::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php b/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php index fe06d4ee8..a74670c93 100644 --- a/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectSubpackageBudgetValidate.php @@ -18,6 +18,7 @@ namespace app\adminapi\validate\project; use app\common\model\dept\Dept; use app\common\model\dept\Orgs; use app\common\model\project\Project; +use app\common\model\project\ProjectSubpackageBudget; use app\common\model\project\ProjectSubpackageBudgetDetail; use app\common\validate\BaseValidate; @@ -35,12 +36,14 @@ class ProjectSubpackageBudgetValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'org_id' => 'require|checkOrg', 'dept_id' => 'require|checkDept', 'project_id' => 'require|checkProject', 'annex' => 'checkAnnex', 'subpackage_budget_detail' => 'require|checkSubpackageBudgetDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; /** @@ -64,7 +67,7 @@ class ProjectSubpackageBudgetValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -75,7 +78,9 @@ class ProjectSubpackageBudgetValidate extends BaseValidate * @date 2024/01/10 15:19 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -101,6 +106,20 @@ class ProjectSubpackageBudgetValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectSubpackageBudget::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkOrg($value): bool|string { $org = Orgs::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectTotalBudgetValidate.php b/app/adminapi/validate/project/ProjectTotalBudgetValidate.php index 1ade9674c..6072e6352 100644 --- a/app/adminapi/validate/project/ProjectTotalBudgetValidate.php +++ b/app/adminapi/validate/project/ProjectTotalBudgetValidate.php @@ -18,6 +18,7 @@ namespace app\adminapi\validate\project; use app\common\model\dept\Dept; use app\common\model\dept\Orgs; use app\common\model\project\Project; +use app\common\model\project\ProjectTotalBudget; use app\common\validate\BaseValidate; @@ -34,7 +35,7 @@ class ProjectTotalBudgetValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'org_id' => 'require|checkOrg', 'dept_id' => 'require|checkDept', 'project_id' => 'require|checkProject', @@ -47,6 +48,8 @@ class ProjectTotalBudgetValidate extends BaseValidate 'budget_list' => 'checkAnnex', 'budget_date' => 'require|dateFormat:Y-m-d', 'project_manager' => 'require', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; protected $message = [ @@ -80,7 +83,7 @@ class ProjectTotalBudgetValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -92,7 +95,7 @@ class ProjectTotalBudgetValidate extends BaseValidate */ public function sceneEdit() { - return $this->remove('org_id',true)->remove('dept_id',true)->remove('project_id',true); + return $this->remove('org_id',true)->remove('dept_id',true)->remove('project_id',true)->remove('flow_id',true)->remove('path',true); } @@ -119,6 +122,20 @@ class ProjectTotalBudgetValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectTotalBudget::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkOrg($value): bool|string { $org = Orgs::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php b/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php index e7a9607fc..52292f133 100644 --- a/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php +++ b/app/adminapi/validate/project/ProjectTravelReimbursementValidate.php @@ -19,6 +19,7 @@ use app\common\model\bank\BankAccount; use app\common\model\dict\DictData; use app\common\model\project\ProjectCostTempSet; use app\common\model\project\ProjectLoanApply; +use app\common\model\project\ProjectTravelReimbursement; use app\common\model\project\ProjectTravelReimbursementDetail; use app\common\model\project\ProjectTravelReimbursementInvoiceDetail; use app\common\model\project\ProjectTripApply; @@ -38,7 +39,7 @@ class ProjectTravelReimbursementValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'trip_apply_id' => 'require|checkTripApply', 'reimbursement_type' => 'require|checkReimbursementType', 'loan_apply_id' => 'requireCallback:check_require|checkLoanApply', @@ -52,6 +53,8 @@ class ProjectTravelReimbursementValidate extends BaseValidate 'bank_account_id' => 'require|checkBankAccount', 'reimbursement_detail' => 'require|checkReimbursementDetail', 'invoice_detail' => 'require|checkInvoiceDetail', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; @@ -84,7 +87,7 @@ class ProjectTravelReimbursementValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -95,7 +98,9 @@ class ProjectTravelReimbursementValidate extends BaseValidate * @date 2024/01/18 13:57 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -121,6 +126,20 @@ class ProjectTravelReimbursementValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectTravelReimbursement::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkTripApply($value): bool|string { $data = ProjectTripApply::where('id',$value)->findOrEmpty(); diff --git a/app/adminapi/validate/project/ProjectTripApplyValidate.php b/app/adminapi/validate/project/ProjectTripApplyValidate.php index 62124b659..28d2f5ff9 100644 --- a/app/adminapi/validate/project/ProjectTripApplyValidate.php +++ b/app/adminapi/validate/project/ProjectTripApplyValidate.php @@ -17,6 +17,7 @@ namespace app\adminapi\validate\project; use app\common\model\dict\DictData; use app\common\model\project\Project; +use app\common\model\project\ProjectTripApply; use app\common\validate\BaseValidate; @@ -33,7 +34,7 @@ class ProjectTripApplyValidate extends BaseValidate * @var string[] */ protected $rule = [ - 'id' => 'require', + 'id' => 'require|checkData', 'project_id' => 'require|checkProject', 'origin_address' => 'require', 'target_address' => 'require', @@ -41,6 +42,8 @@ class ProjectTripApplyValidate extends BaseValidate 'start_date' => 'require|dateFormat:Y-m-d', 'end_date' => 'require|dateFormat:Y-m-d|checkEndDate', 'annex' => 'checkAnnex', + 'flow_id' => 'require|checkFlow', + 'path' => 'require', ]; @@ -67,7 +70,7 @@ class ProjectTripApplyValidate extends BaseValidate */ public function sceneAdd() { - return $this->remove('id',true); + return $this->remove('id',true)->remove('flow_id',true)->remove('path',true); } @@ -78,7 +81,9 @@ class ProjectTripApplyValidate extends BaseValidate * @date 2024/01/17 09:22 */ public function sceneEdit() - {} + { + return $this->remove('flow_id',true)->remove('path',true); + } /** @@ -104,6 +109,20 @@ class ProjectTripApplyValidate extends BaseValidate return $this->only(['id']); } + public function sceneApprove() + { + return $this->only(['id','flow_id','path']); + } + + public function checkData($value): bool|string + { + $data = ProjectTripApply::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + public function checkProject($value): bool|string { $data = Project::where('id',$value)->findOrEmpty();