From bae8f96514fd6ff25e0b319e922d1411667bf0d9 Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Fri, 5 Apr 2024 11:35:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketingBranchFilingController.php | 108 ++++++++++++ .../MarketingProjectFilingController.php | 111 ++++++++++++ ...MarketingProjectFilingDetailController.php | 108 ++++++++++++ .../marketing/MarketingBranchFilingLists.php | 78 +++++++++ .../MarketingProjectFilingDetailLists.php | 88 ++++++++++ .../marketing/MarketingProjectFilingLists.php | 84 ++++++++++ .../marketing/MarketingBranchFilingLogic.php | 155 +++++++++++++++++ .../MarketingProjectFilingDetailLogic.php | 123 ++++++++++++++ .../marketing/MarketingProjectFilingLogic.php | 158 ++++++++++++++++++ .../MarketingBranchFilingValidate.php | 143 ++++++++++++++++ .../MarketingProjectFilingDetailValidate.php | 131 +++++++++++++++ .../MarketingProjectFilingValidate.php | 152 +++++++++++++++++ .../model/marketing/MarketingBranchFiling.php | 60 +++++++ .../marketing/MarketingProjectFiling.php | 34 ++++ .../MarketingProjectFilingDetail.php | 52 ++++++ 15 files changed, 1585 insertions(+) create mode 100644 app/adminapi/controller/marketing/MarketingBranchFilingController.php create mode 100644 app/adminapi/controller/marketing/MarketingProjectFilingController.php create mode 100644 app/adminapi/controller/marketing/MarketingProjectFilingDetailController.php create mode 100644 app/adminapi/lists/marketing/MarketingBranchFilingLists.php create mode 100644 app/adminapi/lists/marketing/MarketingProjectFilingDetailLists.php create mode 100644 app/adminapi/lists/marketing/MarketingProjectFilingLists.php create mode 100644 app/adminapi/logic/marketing/MarketingBranchFilingLogic.php create mode 100644 app/adminapi/logic/marketing/MarketingProjectFilingDetailLogic.php create mode 100644 app/adminapi/logic/marketing/MarketingProjectFilingLogic.php create mode 100644 app/adminapi/validate/marketing/MarketingBranchFilingValidate.php create mode 100644 app/adminapi/validate/marketing/MarketingProjectFilingDetailValidate.php create mode 100644 app/adminapi/validate/marketing/MarketingProjectFilingValidate.php create mode 100644 app/common/model/marketing/MarketingBranchFiling.php create mode 100644 app/common/model/marketing/MarketingProjectFiling.php create mode 100644 app/common/model/marketing/MarketingProjectFilingDetail.php diff --git a/app/adminapi/controller/marketing/MarketingBranchFilingController.php b/app/adminapi/controller/marketing/MarketingBranchFilingController.php new file mode 100644 index 000000000..0fa61fce1 --- /dev/null +++ b/app/adminapi/controller/marketing/MarketingBranchFilingController.php @@ -0,0 +1,108 @@ +dataLists(new MarketingBranchFilingLists()); + } + + + /** + * @notes 添加市场经营--分支机构备案 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function add() + { + $params = (new MarketingBranchFilingValidate())->post()->goCheck('add'); + $result = MarketingBranchFilingLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(MarketingBranchFilingLogic::getError()); + } + + + /** + * @notes 编辑市场经营--分支机构备案 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function edit() + { + $params = (new MarketingBranchFilingValidate())->post()->goCheck('edit'); + $result = MarketingBranchFilingLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(MarketingBranchFilingLogic::getError()); + } + + + /** + * @notes 删除市场经营--分支机构备案 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function delete() + { + $params = (new MarketingBranchFilingValidate())->post()->goCheck('delete'); + MarketingBranchFilingLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取市场经营--分支机构备案详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function detail() + { + $params = (new MarketingBranchFilingValidate())->goCheck('detail'); + $result = MarketingBranchFilingLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/controller/marketing/MarketingProjectFilingController.php b/app/adminapi/controller/marketing/MarketingProjectFilingController.php new file mode 100644 index 000000000..97a8bf224 --- /dev/null +++ b/app/adminapi/controller/marketing/MarketingProjectFilingController.php @@ -0,0 +1,111 @@ +dataLists(new MarketingProjectFilingLists()); + } + + + /** + * @notes 添加市场经营--项目备案 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function add() + { + $params = (new MarketingProjectFilingValidate())->post()->goCheck('add'); + $result = MarketingProjectFilingLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(MarketingProjectFilingLogic::getError()); + } + + + /** + * @notes 编辑市场经营--项目备案 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function edit() + { + $params = (new MarketingProjectFilingValidate())->post()->goCheck('edit'); + $result = MarketingProjectFilingLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(MarketingProjectFilingLogic::getError()); + } + + + /** + * @notes 删除市场经营--项目备案 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function delete() + { + $params = (new MarketingProjectFilingValidate())->post()->goCheck('delete'); + $result = MarketingProjectFilingLogic::delete($params); + if (true === $result) { + return $this->success('删除成功', [], 1, 1); + } + return $this->fail(MarketingProjectFilingLogic::getError()); + } + + + /** + * @notes 获取市场经营--项目备案详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function detail() + { + $params = (new MarketingProjectFilingValidate())->goCheck('detail'); + $result = MarketingProjectFilingLogic::detail($params); + return $this->data($result); + } + + + } \ No newline at end of file diff --git a/app/adminapi/controller/marketing/MarketingProjectFilingDetailController.php b/app/adminapi/controller/marketing/MarketingProjectFilingDetailController.php new file mode 100644 index 000000000..ded9c323e --- /dev/null +++ b/app/adminapi/controller/marketing/MarketingProjectFilingDetailController.php @@ -0,0 +1,108 @@ +dataLists(new MarketingProjectFilingDetailLists()); + } + + + /** + * @notes 添加市场经营--项目备案明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function add() + { + $params = (new MarketingProjectFilingDetailValidate())->post()->goCheck('add'); + $result = MarketingProjectFilingDetailLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(MarketingProjectFilingDetailLogic::getError()); + } + + + /** + * @notes 编辑市场经营--项目备案明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function edit() + { + $params = (new MarketingProjectFilingDetailValidate())->post()->goCheck('edit'); + $result = MarketingProjectFilingDetailLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(MarketingProjectFilingDetailLogic::getError()); + } + + + /** + * @notes 删除市场经营--项目备案明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function delete() + { + $params = (new MarketingProjectFilingDetailValidate())->post()->goCheck('delete'); + MarketingProjectFilingDetailLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取市场经营--项目备案明细详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function detail() + { + $params = (new MarketingProjectFilingDetailValidate())->goCheck('detail'); + $result = MarketingProjectFilingDetailLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/lists/marketing/MarketingBranchFilingLists.php b/app/adminapi/lists/marketing/MarketingBranchFilingLists.php new file mode 100644 index 000000000..e06d9c44b --- /dev/null +++ b/app/adminapi/lists/marketing/MarketingBranchFilingLists.php @@ -0,0 +1,78 @@ + ['org_name', 'fddbr', 'telephone', 'jgzcdz'], + ]; + } + + + /** + * @notes 获取市场经营--分支机构备案列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function lists(): array + { + return MarketingBranchFiling::withoutField('create_time,update_time,delete_time')->where($this->searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function ($data) { + $data['filing_type_text'] = $data->filing_type; + }) + ->toArray(); + } + + + /** + * @notes 获取市场经营--分支机构备案数量 + * @return int + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function count(): int + { + return MarketingBranchFiling::where($this->searchWhere)->count(); + } + + } \ No newline at end of file diff --git a/app/adminapi/lists/marketing/MarketingProjectFilingDetailLists.php b/app/adminapi/lists/marketing/MarketingProjectFilingDetailLists.php new file mode 100644 index 000000000..b848562b3 --- /dev/null +++ b/app/adminapi/lists/marketing/MarketingProjectFilingDetailLists.php @@ -0,0 +1,88 @@ + ['project_filing_id', 'filing_role', 'status'], + '%like%' => ['filing_user'], + ]; + } + + + /** + * @notes 获取市场经营--项目备案明细列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function lists(): array + { + return MarketingProjectFilingDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function ($data) { + $project_filing = MarketingProjectFiling::field('contract_id')->where('id', $data['project_filing_id'])->findOrEmpty(); + $contract = MarketingContract::field('contract_name,contract_code,const_area,business_nature')->where('id', $project_filing['contract_id'])->findOrEmpty(); + $data['contract_name'] = $contract['contract_name']; + $data['contract_code'] = $contract['contract_code']; + $data['const_area'] = $contract->const_area_text; + $data['business_nature'] = $contract->business_nature_text; + $data['filing_role_text'] = $data->filing_role_text; + $data['status_text'] = $data->status_text; + }) + ->toArray(); + } + + + /** + * @notes 获取市场经营--项目备案明细数量 + * @return int + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function count(): int + { + return MarketingProjectFilingDetail::where($this->searchWhere)->count(); + } + + } \ No newline at end of file diff --git a/app/adminapi/lists/marketing/MarketingProjectFilingLists.php b/app/adminapi/lists/marketing/MarketingProjectFilingLists.php new file mode 100644 index 000000000..675b5ccb4 --- /dev/null +++ b/app/adminapi/lists/marketing/MarketingProjectFilingLists.php @@ -0,0 +1,84 @@ + ['contract_id', 'create_time'], + '%like%' => ['create_user'], + ]; + } + + + /** + * @notes 获取市场经营--项目备案列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function lists(): array + { + return MarketingProjectFiling::withoutField('update_time,delete_time')->where($this->searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function ($data) { + $contract = MarketingContract::field('contract_name,contract_code,const_area,business_nature')->where('id', $data['contract_id'])->findOrEmpty(); + $data['contract_name'] = $contract['contract_name']; + $data['contract_code'] = $contract['contract_code']; + $data['const_area'] = $contract->const_area_text; + $data['business_nature'] = $contract->business_nature_text; + }) + ->toArray(); + } + + + /** + * @notes 获取市场经营--项目备案数量 + * @return int + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function count(): int + { + return MarketingProjectFiling::where($this->searchWhere)->count(); + } + + } \ No newline at end of file diff --git a/app/adminapi/logic/marketing/MarketingBranchFilingLogic.php b/app/adminapi/logic/marketing/MarketingBranchFilingLogic.php new file mode 100644 index 000000000..4eb365755 --- /dev/null +++ b/app/adminapi/logic/marketing/MarketingBranchFilingLogic.php @@ -0,0 +1,155 @@ + $params['org_name'], + 'filing_type' => $params['filing_type'], + 'fddbr' => $params['fddbr'] ?? '', + 'telephone' => $params['telephone'] ?? '', + 'yyzzbh' => $params['yyzzbh'] ?? '', + 'zzzsbh' => $params['zzzsbh'] ?? '', + 'zzjgdmz' => $params['zzjgdmz'] ?? '', + 'zgslxdh' => $params['zgslxdh'] ?? '', + 'zyxjlfw' => $params['zyxjlfw'] ?? '', + 'zjxjlfw' => $params['zjxjlfw'] ?? '', + 'bdbgdz' => $params['bdbgdz'] ?? '', + 'bdgslxdh' => $params['bdgslxdh'] ?? '', + 'ryxx' => $params['ryxx'] ?? '', + 'jgzcdz' => $params['jgzcdz'], + 'baksq' => !empty($params['baksq']) ? strtotime($params['baksq']) : 0, + 'bajsq' => !empty($params['bajsq']) ? strtotime($params['bajsq']) : 0, + 'basj' => !empty($params['basj']) ? strtotime($params['basj']) : 0, + 'jbr' => $params['jbr'] ?? '', + 'njsj' => !empty($params['njsj']) ? strtotime($params['njsj']) : 0, + 'fzr' => $params['fzr'] ?? '', + 'fzrsj' => $params['fzrsj'] ?? '', + 'jsfzr' => $params['jsfzr'] ?? '', + 'jsfzrsj' => $params['jsfzrsj'] ?? '', + 'remark' => $params['remark'] ?? '', + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + ]); + 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/04/05 10:00 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + MarketingBranchFiling::where('id', $params['id'])->update([ + 'org_name' => $params['org_name'], + 'filing_type' => $params['filing_type'], + 'fddbr' => $params['fddbr'] ?? '', + 'telephone' => $params['telephone'] ?? '', + 'yyzzbh' => $params['yyzzbh'] ?? '', + 'zzzsbh' => $params['zzzsbh'] ?? '', + 'zzjgdmz' => $params['zzjgdmz'] ?? '', + 'zgslxdh' => $params['zgslxdh'] ?? '', + 'zyxjlfw' => $params['zyxjlfw'] ?? '', + 'zjxjlfw' => $params['zjxjlfw'] ?? '', + 'bdbgdz' => $params['bdbgdz'] ?? '', + 'bdgslxdh' => $params['bdgslxdh'] ?? '', + 'ryxx' => $params['ryxx'] ?? '', + 'jgzcdz' => $params['jgzcdz'], + 'baksq' => !empty($params['baksq']) ? strtotime($params['baksq']) : 0, + 'bajsq' => !empty($params['bajsq']) ? strtotime($params['bajsq']) : 0, + 'basj' => !empty($params['basj']) ? strtotime($params['basj']) : 0, + 'jbr' => $params['jbr'] ?? '', + 'njsj' => !empty($params['njsj']) ? strtotime($params['njsj']) : 0, + 'fzr' => $params['fzr'] ?? '', + 'fzrsj' => $params['fzrsj'] ?? '', + 'jsfzr' => $params['jsfzr'] ?? '', + 'jsfzrsj' => $params['jsfzrsj'] ?? '', + 'remark' => $params['remark'] ?? '', + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + ]); + + 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/04/05 10:00 + */ + public static function delete(array $params): bool + { + return MarketingBranchFiling::destroy($params['id']); + } + + + /** + * @notes 获取市场经营--分支机构备案详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public static function detail($params): array + { + $data = MarketingBranchFiling::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); + $data['filing_type_text'] = $data->filing_type; + return $data->toArray(); + } + } \ No newline at end of file diff --git a/app/adminapi/logic/marketing/MarketingProjectFilingDetailLogic.php b/app/adminapi/logic/marketing/MarketingProjectFilingDetailLogic.php new file mode 100644 index 000000000..2aad619ad --- /dev/null +++ b/app/adminapi/logic/marketing/MarketingProjectFilingDetailLogic.php @@ -0,0 +1,123 @@ + $params['project_filing_id'], + 'filing_user' => $params['filing_user'], + 'filing_role' => $params['filing_role'], + 'reg_time' => !empty($params['reg_time']) ? strtotime($params['reg_time']) : 0, + 'status' => $params['status'], + ]); + 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/04/05 10:36 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + MarketingProjectFilingDetail::where('id', $params['id'])->update([ + 'project_filing_id' => $params['project_filing_id'], + 'filing_user' => $params['filing_user'], + 'filing_role' => $params['filing_role'], + 'reg_time' => !empty($params['reg_time']) ? strtotime($params['reg_time']) : 0, + 'status' => $params['status'], + ]); + 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/04/05 10:36 + */ + public static function delete(array $params): bool + { + return MarketingProjectFilingDetail::destroy($params['id']); + } + + + /** + * @notes 获取市场经营--项目备案明细详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public static function detail($params): array + { + $data = MarketingProjectFilingDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); + $project_filing = MarketingProjectFiling::field('contract_id')->where('id', $data['project_filing_id'])->findOrEmpty(); + $contract = MarketingContract::field('contract_name,contract_code,const_area,business_nature')->where('id', $project_filing['contract_id'])->findOrEmpty(); + $data['contract_name'] = $contract['contract_name']; + $data['contract_code'] = $contract['contract_code']; + $data['const_area'] = $contract->const_area_text; + $data['business_nature'] = $contract->business_nature_text; + $data['filing_role_text'] = $data->filing_role_text; + $data['status_text'] = $data->status_text; + return $data->toArray(); + } + } \ No newline at end of file diff --git a/app/adminapi/logic/marketing/MarketingProjectFilingLogic.php b/app/adminapi/logic/marketing/MarketingProjectFilingLogic.php new file mode 100644 index 000000000..65c206270 --- /dev/null +++ b/app/adminapi/logic/marketing/MarketingProjectFilingLogic.php @@ -0,0 +1,158 @@ + $params['contract_id'], + 'remark' => $params['remark'] ?? '', + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + 'create_user' => $params['create_user'], + 'create_time' => !empty($params['create_time']) ? strtotime($params['create_time']) : time(), + ]); + if (!empty($params['detail'])) { + foreach ($params['detail'] as $v) { + MarketingProjectFilingDetail::create([ + 'project_filing_id' => $res->id, + 'filing_user' => $v['filing_user'], + 'filing_role' => $v['filing_role'], + 'reg_time' => !empty($v['reg_time']) ? strtotime($v['reg_time']) : 0, + 'status' => $v['status'], + ]); + } + } + 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/04/05 10:36 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + MarketingProjectFiling::where('id', $params['id'])->update([ + 'contract_id' => $params['contract_id'], + 'remark' => $params['remark'] ?? '', + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + 'create_user' => $params['create_user'], + 'create_time' => !empty($params['create_time']) ? strtotime($params['create_time']) : time(), + ]); + if (!empty($params['detail'])) { + foreach ($params['detail'] as $v) { + if (!empty($v['id'])) { + MarketingProjectFilingDetail::where('id', $v['id'])->update([ + 'project_filing_id' => $params['id'], + 'filing_user' => $v['filing_user'], + 'filing_role' => $v['filing_role'], + 'reg_time' => !empty($v['reg_time']) ? strtotime($v['reg_time']) : 0, + 'status' => $v['status'], + 'update_time' => time(), + ]); + } else { + MarketingProjectFilingDetail::create([ + 'project_filing_id' => $params['id'], + 'filing_user' => $v['filing_user'], + 'filing_role' => $v['filing_role'], + 'reg_time' => !empty($v['reg_time']) ? strtotime($v['reg_time']) : 0, + 'status' => $v['status'], + ]); + } + } + } + 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/04/05 10:36 + */ + public static function delete(array $params): bool + { + $detail = MarketingProjectFilingDetail::where('project_filing_id', 'in', $params['id'])->findOrEmpty(); + if (!$detail->isEmpty()) { + self::setError('此数据关联了备案人员信息信息,需删除备案人员信息信息'); + return false; + } + return MarketingProjectFiling::destroy($params['id']); + } + + + /** + * @notes 获取市场经营--项目备案详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public static function detail($params): array + { + $data = MarketingProjectFiling::withoutField('update_time,delete_time')->findOrEmpty($params['id']); + $contract = MarketingContract::field('contract_name,contract_code,const_area,business_nature')->where('id', $data['contract_id'])->findOrEmpty(); + $data['contract_name'] = $contract['contract_name']; + $data['contract_code'] = $contract['contract_code']; + $data['const_area'] = $contract->const_area_text; + $data['business_nature'] = $contract->business_nature_text; + return $data->toArray(); + } + } \ No newline at end of file diff --git a/app/adminapi/validate/marketing/MarketingBranchFilingValidate.php b/app/adminapi/validate/marketing/MarketingBranchFilingValidate.php new file mode 100644 index 000000000..cd8eea146 --- /dev/null +++ b/app/adminapi/validate/marketing/MarketingBranchFilingValidate.php @@ -0,0 +1,143 @@ + 'require|checkData', + 'org_name' => 'require', + 'filing_type' => 'require|checkFilingType', + 'jgzcdz' => 'require', + 'baksq' => 'require|dateFormat:Y-m-d', + 'bajsq' => 'require|dateFormat:Y-m-d', + 'basj' => 'dateFormat:Y-m-d', + 'njsj' => 'dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'org_name' => '机构名称', + 'filing_type' => '备案类型', + 'fddbr' => '法定代表人', + 'telephone' => '联系电话', + 'yyzzbh' => '营业执照编号', + 'zzzsbh' => '资质证书编号', + 'zzjgdmz' => '组织机构代码证', + 'zgslxdh' => '总公司联系电话', + 'zyxjlfw' => '主项监理范围', + 'zjxjlfw' => '增项监理范围', + 'bdbgdz' => '本地办公地址', + 'bdgslxdh' => '本地公司联系电话', + 'ryxx' => '人员信息', + 'jgzcdz' => '机构注册地址', + 'baksq' => '备案开始期', + 'bajsq' => '备案结束期', + 'basj' => '备案时间', + 'jbr' => '经办人', + 'njsj' => '年检时间', + 'fzr' => '负责人', + 'fzrsj' => '负责人手机', + 'jsfzr' => '技术负责人', + 'jsfzrsj' => '技术负责人手机', + 'remark' => '备注', + 'annex' => 'annex', + ]; + + + /** + * @notes 添加场景 + * @return MarketingBranchFilingValidate + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return MarketingBranchFilingValidate + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function sceneEdit() + { + } + + + /** + * @notes 删除场景 + * @return MarketingBranchFilingValidate + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return MarketingBranchFilingValidate + * @author likeadmin + * @date 2024/04/05 10:00 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = MarketingBranchFiling::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '数据不存在' : true; + } + + public function checkFilingType($value): bool|string + { + $dict = DictData::where('type_value', 'filing_type')->column('value'); + if (!in_array($value, $dict)) { + return '备案类型数据值无效'; + } + return true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/marketing/MarketingProjectFilingDetailValidate.php b/app/adminapi/validate/marketing/MarketingProjectFilingDetailValidate.php new file mode 100644 index 000000000..690217b55 --- /dev/null +++ b/app/adminapi/validate/marketing/MarketingProjectFilingDetailValidate.php @@ -0,0 +1,131 @@ + 'require|checkData', + 'project_filing_id' => 'require|checkProjectFiling', + 'filing_user' => 'require', + 'filing_role' => 'require|checkFilingRole', + 'reg_time' => 'require|dateFormat:Y-m-d', + 'status' => 'require|checkStatus', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_filing_id' => '项目备案id', + 'filing_user' => '备案人员', + 'filing_role' => '备案角色', + 'reg_time' => '登记时间', + 'status' => '状态', + ]; + + + /** + * @notes 添加场景 + * @return MarketingProjectFilingDetailValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneAdd() + { + return $this->only(['project_filing_id', 'filing_user', 'filing_role', 'reg_time', 'status']); + } + + + /** + * @notes 编辑场景 + * @return MarketingProjectFilingDetailValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_filing_id', 'filing_user', 'filing_role', 'reg_time', 'status']); + } + + + /** + * @notes 删除场景 + * @return MarketingProjectFilingDetailValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return MarketingProjectFilingDetailValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = MarketingProjectFilingDetail::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '数据不存在' : true; + } + + public function checkProjectFiling($value): bool|string + { + $data = MarketingProjectFiling::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '项目备案数据不存在' : true; + } + + public function checkFilingRole($value): bool|string + { + $dict = DictData::where('type_value', 'filing_role')->column('value'); + return !in_array($value, $dict) ? '备案角色数据值无效' : true; + } + + public function checkStatus($value): bool|string + { + $dict = DictData::where('type_value', 'filing_status')->column('value'); + return !in_array($value, $dict) ? '状态数据值无效' : true; + } + + } \ No newline at end of file diff --git a/app/adminapi/validate/marketing/MarketingProjectFilingValidate.php b/app/adminapi/validate/marketing/MarketingProjectFilingValidate.php new file mode 100644 index 000000000..c0d20fd15 --- /dev/null +++ b/app/adminapi/validate/marketing/MarketingProjectFilingValidate.php @@ -0,0 +1,152 @@ + 'require|checkData', + 'contract_id' => 'require|checkContract', + 'create_user' => 'require', + 'create_time' => 'require|dateFormat:Y-m-d H:i:s', + 'annex' => 'checkAnnex', + 'detail' => 'checkDetail' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'contract_id' => '合同id', + 'remark' => '备注', + 'create_user' => '录入人', + 'create_time' => '录入日期', + ]; + + + /** + * @notes 添加场景 + * @return MarketingProjectFilingValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneAdd() + { + return $this->only(['contract_id', 'remark', 'create_user', 'create_time', 'annex']); + } + + + /** + * @notes 编辑场景 + * @return MarketingProjectFilingValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneEdit() + { + return $this->only(['id', 'contract_id', 'remark', 'create_user', 'create_time', 'annex']); + } + + + /** + * @notes 删除场景 + * @return MarketingProjectFilingValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneDelete() + { + return $this->only(['id'])->remove('id', 'checkData'); + } + + + /** + * @notes 详情场景 + * @return MarketingProjectFilingValidate + * @author likeadmin + * @date 2024/04/05 10:36 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = MarketingProjectFiling::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '数据不存在' : true; + } + + public function checkContract($value): bool|string + { + $data = MarketingContract::where('id', $value)->findOrEmpty(); + return $data->isEmpty() ? '合同数据不存在' : true; + } + + public function checkDetail($value): bool|string + { + if (!isset($value) || $value == '') return true; + if (!is_array($value)) return '备案人员信息数据格式错误'; + foreach ($value as $k => $v) { + if (isset($v['id']) && !empty($v['id'])) { + $data = MarketingProjectFilingDetail::where('id', $v['id'])->findOrEmpty(); + if ($data->isEmpty()) { + return '第' . ($k + 1) . '行联系人信息不存在'; + } + } + if (empty($v['filing_user'])) { + return '备案人员信息列表第' . ($k + 1) . '行备案人员为空'; + } + if (empty($v['filing_role'])) { + return '备案人员信息列表第' . ($k + 1) . '行备案角色为空'; + } else { + $dict = DictData::where('type_value', 'filing_role')->column('value'); + if (!in_array($v['filing_role'], $dict)) return '备案人员信息列表第' . ($k + 1) . '行备案角色数据值无效'; + } + if (empty($v['reg_time'])) { + return '备案人员信息列表第' . ($k + 1) . '行登记时间为空'; + } + if (empty($v['status'])) { + return '备案人员信息列表第' . ($k + 1) . '行状态为空'; + } else { + $dict = DictData::where('type_value', 'filing_status')->column('value'); + if (!in_array($v['filing_role'], $dict)) return '备案人员信息列表第' . ($k + 1) . '行状态数据值无效'; + } + } + return true; + } + + } \ No newline at end of file diff --git a/app/common/model/marketing/MarketingBranchFiling.php b/app/common/model/marketing/MarketingBranchFiling.php new file mode 100644 index 000000000..ef89ac61e --- /dev/null +++ b/app/common/model/marketing/MarketingBranchFiling.php @@ -0,0 +1,60 @@ +column('name', 'value'); + return !empty($data['filing_type']) ? $dict[$data['filing_type']] : ''; + } + + public function getBaksqAttr($value): string + { + return !empty($value) ? date('Y-m-d', $value) : ''; + } + + public function getBajsqAttr($value): string + { + return !empty($value) ? date('Y-m-d', $value) : ''; + } + + public function getBasjAttr($value): string + { + return !empty($value) ? date('Y-m-d', $value) : ''; + } + + public function getNjsjAttr($value): string + { + return !empty($value) ? date('Y-m-d', $value) : ''; + } + } \ No newline at end of file diff --git a/app/common/model/marketing/MarketingProjectFiling.php b/app/common/model/marketing/MarketingProjectFiling.php new file mode 100644 index 000000000..04c7b6e81 --- /dev/null +++ b/app/common/model/marketing/MarketingProjectFiling.php @@ -0,0 +1,34 @@ +column('name', 'value'); + return !empty($data['filing_role']) ? $dict[$data['filing_role']] : ''; + } + + public function getStatusTextAttr($value, $data) + { + $dict = DictData::where('type_value', 'filing_status')->column('name', 'value'); + return !empty($data['status']) ? $dict[$data['status']] : ''; + } + + public function getRegTimeAttr($value): string + { + return !empty($value) ? date('Y-m-d', $value) : ''; + } + } \ No newline at end of file