From 5ce0329659b47dd35f8f4188d012078d3c3c4901 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 23 Feb 2024 11:47:54 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E9=A1=B9=E7=9B=AE=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=B1=87=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JianliProjectProgressReportController.php | 108 ++++++++++++++ .../JianliProjectProgressReportLists.php | 77 ++++++++++ .../JianliProjectProgressReportLogic.php | 140 ++++++++++++++++++ .../JianliProjectProgressReportValidate.php | 94 ++++++++++++ .../JianliProjectProgressReport.php | 34 +++++ 5 files changed, 453 insertions(+) create mode 100644 app/adminapi/controller/project_process_management/JianliProjectProgressReportController.php create mode 100644 app/adminapi/lists/project_process_management/JianliProjectProgressReportLists.php create mode 100644 app/adminapi/logic/project_process_management/JianliProjectProgressReportLogic.php create mode 100644 app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php create mode 100644 app/common/model/project_process_management/JianliProjectProgressReport.php diff --git a/app/adminapi/controller/project_process_management/JianliProjectProgressReportController.php b/app/adminapi/controller/project_process_management/JianliProjectProgressReportController.php new file mode 100644 index 000000000..7d3eafc79 --- /dev/null +++ b/app/adminapi/controller/project_process_management/JianliProjectProgressReportController.php @@ -0,0 +1,108 @@ +dataLists(new JianliProjectProgressReportLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function add() + { + $params = (new JianliProjectProgressReportValidate())->post()->goCheck('add'); + $result = JianliProjectProgressReportLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(JianliProjectProgressReportLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function edit() + { + $params = (new JianliProjectProgressReportValidate())->post()->goCheck('edit'); + $result = JianliProjectProgressReportLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(JianliProjectProgressReportLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function delete() + { + $params = (new JianliProjectProgressReportValidate())->post()->goCheck('delete'); + JianliProjectProgressReportLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function detail() + { + $params = (new JianliProjectProgressReportValidate())->goCheck('detail'); + $result = JianliProjectProgressReportLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/lists/project_process_management/JianliProjectProgressReportLists.php b/app/adminapi/lists/project_process_management/JianliProjectProgressReportLists.php new file mode 100644 index 000000000..18ee5d176 --- /dev/null +++ b/app/adminapi/lists/project_process_management/JianliProjectProgressReportLists.php @@ -0,0 +1,77 @@ + ['num', 'project', 'project_num', 'datas'], + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function lists(): array + { + return JianliProjectProgressReport::where($this->searchWhere) + ->field(['id', 'dataid', 'num', 'project', 'project_num', 'bm_master', 'wt_unit', 'xm_master', 'start_date', 'end_date', 'duration', 'working_hours', 'done_progress', 'bjd_progress', 'djr', 'apptime', 'jdms']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function count(): int + { + return JianliProjectProgressReport::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/adminapi/logic/project_process_management/JianliProjectProgressReportLogic.php b/app/adminapi/logic/project_process_management/JianliProjectProgressReportLogic.php new file mode 100644 index 000000000..ade0dad22 --- /dev/null +++ b/app/adminapi/logic/project_process_management/JianliProjectProgressReportLogic.php @@ -0,0 +1,140 @@ + $params['dataid'], + 'num' => $params['num'], + 'project' => $params['project'], + 'project_num' => $params['project_num'], + 'bm_master' => $params['bm_master'], + 'wt_unit' => $params['wt_unit'], + 'xm_master' => $params['xm_master'], + 'start_date' => $params['start_date'], + 'end_date' => $params['end_date'], + 'duration' => $params['duration'], + 'working_hours' => $params['working_hours'], + 'done_progress' => $params['done_progress'], + 'bjd_progress' => $params['bjd_progress'], + 'djr' => $params['djr'], + 'apptime' => $params['apptime'], + 'jdms' => $params['jdms'], + 'datas' => $params['datas'], + 'fd_23' => $params['fd_23'], + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + JianliProjectProgressReport::where('id', $params['id'])->update([ + 'dataid' => $params['dataid'], + 'num' => $params['num'], + 'project' => $params['project'], + 'project_num' => $params['project_num'], + 'bm_master' => $params['bm_master'], + 'wt_unit' => $params['wt_unit'], + 'xm_master' => $params['xm_master'], + 'start_date' => $params['start_date'], + 'end_date' => $params['end_date'], + 'duration' => $params['duration'], + 'working_hours' => $params['working_hours'], + 'done_progress' => $params['done_progress'], + 'bjd_progress' => $params['bjd_progress'], + 'djr' => $params['djr'], + 'apptime' => $params['apptime'], + 'jdms' => $params['jdms'], + 'datas' => $params['datas'], + 'fd_23' => $params['fd_23'], + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public static function delete(array $params): bool + { + return JianliProjectProgressReport::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public static function detail($params): array + { + return JianliProjectProgressReport::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php b/app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php new file mode 100644 index 000000000..4df07591e --- /dev/null +++ b/app/adminapi/validate/project_process_management/JianliProjectProgressReportValidate.php @@ -0,0 +1,94 @@ + 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return JianliProjectProgressReportValidate + * @author likeadmin + * @date 2024/02/23 11:47 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/common/model/project_process_management/JianliProjectProgressReport.php b/app/common/model/project_process_management/JianliProjectProgressReport.php new file mode 100644 index 000000000..39efb8c44 --- /dev/null +++ b/app/common/model/project_process_management/JianliProjectProgressReport.php @@ -0,0 +1,34 @@ +