moonsflyer há 9 meses atrás
pai
commit
4b8a44eab4

+ 100 - 0
app/adminapi/controller/asset/AssetAreaController.php

@@ -0,0 +1,100 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\controller\asset;
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\asset\AssetLists;
+use app\adminapi\lists\asset\AssetAreaLists;
+use app\adminapi\logic\article\ArticleLogic;
+use app\adminapi\logic\notice\NoticeLogic;
+use app\adminapi\validate\article\ArticleValidate;
+use app\adminapi\validate\asset\AssetValidate;
+use app\adminapi\validate\asset\AssetAreaValidate;
+use app\adminapi\validate\notice\NoticeValidate;
+
+/**
+ * 地址控制器
+ * Class NoticeController
+ * @package app\adminapi\controller\notice
+ */
+class AssetAreaController extends BaseAdminController
+{
+//    public array $notNeedLogin = ['getAssetData'];
+    /**
+     * @notes 查看地址列表
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2021/12/29 9:55
+     */
+    public function lists()
+    {
+        return $this->dataLists(new AssetAreaLists());
+    }
+
+    /**
+     * @notes  添加地址
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public function add()
+    {
+        $params = (new AssetAreaValidate())->post()->goCheck('add');
+        AssetAreaLists::add($params);
+        return $this->success('添加成功', [], 1, 1);
+    }
+    /**
+     * @notes  编辑地址
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public function edit()
+    {
+        $params = (new AssetAreaValidate())->post()->goCheck('edit');
+        $result = AssetAreaLists::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(AssetAreaLists::getError());
+    }
+
+    /**
+     * @notes  删除地址
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public function delete()
+    {
+        $params = (new AssetAreaValidate())->post()->goCheck('delete');
+        AssetAreaLists::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+    /**
+     * @notes  地址详情
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public function detail()
+    {
+        $params = (new AssetAreaValidate())->goCheck('detail');
+        $result = AssetAreaLists::detail($params);
+        return $this->data($result);
+    }
+
+}

+ 109 - 0
app/adminapi/controller/asset/AssetController.php

@@ -0,0 +1,109 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\controller\asset;
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\asset\AssetLists;
+use app\adminapi\logic\article\ArticleLogic;
+use app\adminapi\logic\notice\NoticeLogic;
+use app\adminapi\validate\article\ArticleValidate;
+use app\adminapi\validate\asset\AssetValidate;
+use app\adminapi\validate\notice\NoticeValidate;
+
+/**
+ * 资产控制器
+ * Class NoticeController
+ * @package app\adminapi\controller\notice
+ */
+class AssetController extends BaseAdminController
+{
+    public array $notNeedLogin = ['getAssetData'];
+    /**
+     * @notes 查看资产列表
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2021/12/29 9:55
+     */
+    public function lists()
+    {
+        return $this->dataLists(new AssetLists());
+    }
+
+    /**
+     * @notes  添加资产
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public function add()
+    {
+        $params = (new AssetValidate())->post()->goCheck('add');
+        AssetLists::add($params);
+        return $this->success('添加成功', [], 1, 1);
+    }
+    /**
+     * @notes  编辑资产
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public function edit()
+    {
+        $params = (new AssetValidate())->post()->goCheck('edit');
+        $result = AssetLists::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(AssetLists::getError());
+    }
+
+    /**
+     * @notes  删除资讯
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public function delete()
+    {
+        $params = (new AssetValidate())->post()->goCheck('delete');
+        AssetLists::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+    /**
+     * @notes  资产详情
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public function detail()
+    {
+        $params = (new AssetValidate())->goCheck('detail');
+        $result = AssetLists::detail($params);
+        return $this->data($result);
+    }
+
+    /**
+     * @notes 获取资产数据
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2022/3/29 11:18
+     */
+    public function getAssetData()
+    {
+        $result = AssetLists::getAssetData();
+        return $this->success('查询成功', $result, 1, 1);
+    }
+}

+ 159 - 0
app/adminapi/controller/asset/AssetLeaseController.php

@@ -0,0 +1,159 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\controller\asset;
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\asset\AssetLists;
+use app\adminapi\lists\asset\AssetLeaseLists;
+use app\adminapi\logic\notice\NoticeLogic;
+use app\adminapi\validate\article\ArticleValidate;
+use app\adminapi\validate\asset\AssetValidate;
+use app\common\enum\asset\AssetEnum;
+use app\adminapi\validate\asset\AssetLeaseValidate;
+use app\adminapi\validate\notice\NoticeValidate;
+use app\common\logic\PaymentLogic;
+
+/**
+ * 资产租赁控制器
+ * Class NoticeController
+ * @package app\adminapi\controller\notice
+ */
+class AssetLeaseController extends BaseAdminController
+{
+    public array $notNeedLogin = ['autoUpdataLeaseStatus'];
+    /**
+     * @notes 查看资产列表
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2021/12/29 9:55
+     */
+    public function lists()
+    {
+        return $this->dataLists(new AssetLeaseLists());
+    }
+
+    /**
+     * @notes  添加资产
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public function add()
+    {
+
+        $params = (new AssetLeaseValidate())->post()->goCheck('add');
+        $params['referee_uid'] =$this->adminId;
+        $result =AssetLeaseLists::add($params);
+
+        if ($result['code'] <> 200) {
+            return $this->fail($result['msg']);
+        }
+        return $this->success($result['msg'], [], 1, 1);
+    }
+    /**
+     * @notes  编辑资产
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public function edit()
+    {
+        $params = (new AssetLeaseValidate())->post()->goCheck('edit');
+        $params['referee_uid'] =$this->adminId;
+        $result = AssetLeaseLists::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(AssetLeaseLists::getError());
+    }
+
+
+    /**
+     * @notes  租赁详情
+     * @return \think\response\Json
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public function detail()
+    {
+        $params = (new AssetLeaseValidate())->goCheck('detail');
+        $result = AssetLeaseLists::detail($params);
+        return $this->data($result);
+    }
+
+    /**
+     * @notes 获取可租赁房产
+     * @return \think\response\Json
+     * @author 段誉
+     * @date 2022/3/29 11:18
+     */
+    public function getAssetForRent()
+    {
+        $params = $this->request->get();
+        $result = AssetLists::getRentAssetList($params);
+        return $this->success('查询成功', $result, 1, 1);
+    }
+
+    public function getApprovalSattusDesc(){
+        $list = AssetEnum::APPROVAL_STATUS_SCENE;
+        $params = $this->request->get();
+        if(isset($params['flag'])){
+            if($params['flag']){
+                $lists =[ ['id'=>0,'status_desc'=>'全部']];
+                $list = array_merge($lists,$list);
+            }
+        }
+
+
+        return $this->success('查询成功',$list, 1, 1);
+    }
+
+    public function doApprove(){
+        $params = (new AssetLeaseValidate())->post()->goCheck('approve');
+        $params['approve_uid'] =$this->adminId;
+        $result = AssetLeaseLists::approve($params);
+
+        if (true === $result) {
+            return $this->success('审核完成!', [], 1, 1);
+        }
+        return $this->fail(AssetLeaseLists::getError());
+    }
+
+    public function updatePayStatus(){
+        $params = (new AssetLeaseValidate())->post()->goCheck('pay');
+        $result = AssetLeaseLists::updatePayStatus($params);
+
+        if (true === $result) {
+            return $this->success('修改成功!', [], 1, 1);
+        }
+        return $this->fail(AssetLeaseLists::getError());
+    }
+
+    public function autoUpdataLeaseStatus(){
+        $result = AssetLeaseLists::autoUpdateStatus();
+        return $this->success('更新成功',[], 1, 1);
+    }
+
+    public function setEnd(){
+        $params = (new AssetLeaseValidate())->post()->goCheck('end');
+        $params['approve_uid'] =$this->adminId;
+        $result = AssetLeaseLists::setEnd($params);
+
+        if (true === $result) {
+            return $this->success('终止成功', [], 1, 1);
+        }
+        return $this->fail(AssetLeaseLists::getError());
+    }
+}

+ 138 - 0
app/adminapi/lists/asset/AssetAreaLists.php

@@ -0,0 +1,138 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\asset;
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\enum\asset\AssetEnum;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\article\Article;
+use app\common\model\notice\NoticeSetting;
+use app\common\model\asset\AssetInfo;
+use app\common\model\asset\AssetArea;
+use app\common\service\FileService;
+
+/**
+ * 地址管理
+ * Class AssetLists
+ * @package app\adminapi\lists\asset
+ */
+class AssetAreaLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+    /**
+     * @notes 搜索条件
+     * @return \string[][]
+     * @author
+     * @date 2025/04/12 2:21 下午
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => [ 'status'],
+            '%like%'=>['title'],
+        ];
+    }
+
+    /**
+     * @notes 地址信息列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function lists(): array
+    {
+
+        $lists = (new AssetArea())->field('id,title,create_time')
+            ->where($this->searchWhere)
+            ->limit($this->limitOffset, $this->limitLength)
+            ->Order('id desc')
+            ->select()
+            ->toArray();
+
+        return $lists;
+    }
+
+    /**
+     * @notes 地址信息数量
+     * @return int
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function count(): int
+    {
+        return (new AssetArea())->where($this->searchWhere)->count();
+    }
+
+    /**
+     * @notes  添加地址
+     * @param array $params
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public static function add(array $params)
+    {
+        AssetArea::create([
+            'title' => $params['title'],
+            'sort' => $params['sort']??0
+        ]);
+    }
+
+    /**
+     * @notes  编辑地址
+     * @param array $params
+     * @return bool
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public static function edit(array $params) : bool
+    {
+        try {
+            AssetArea::update([
+                'id' => $params['id'],
+                'title' => $params['title'],
+            ]);
+            return true;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+    /**
+     * @notes  删除地址
+     * @param array $params
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public static function delete(array $params)
+    {
+        AssetArea::destroy($params['id']);
+    }
+
+    /**
+     * @notes  查看地址详情
+     * @param $params
+     * @return array
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public static function detail($params) : array
+    {
+        return AssetArea::findOrEmpty($params['id'])->toArray();
+    }
+
+}

+ 597 - 0
app/adminapi/lists/asset/AssetLeaseLists.php

@@ -0,0 +1,597 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\asset;
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\asset\AssetInfo;
+use app\common\model\asset\AssetLeaseInfo;
+use app\common\model\auth\Admin as adminModel ;
+use app\common\model\auth\AdminJobs;
+use app\common\service\FileService;
+use think\Exception;
+
+/**
+ * 资产租赁管理
+ * Class AssetLists
+ * @package app\adminapi\lists\asset
+ */
+class AssetLeaseLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+    /**
+     * @notes 搜索条件
+     * @return \string[][]
+     * @author
+     * @date 2025/04/12 2:21 下午
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['area_id','is_pay'],
+            '%like%'=>['tenant_name','tenant_mobile'],
+        ];
+    }
+
+    /**
+     * @notes 资产信息列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function lists(): array
+    {
+
+        $admin_info = $this->adminInfo;
+
+        $parms =  $this->request->get();
+        $where = [] ;
+        $flag = false;
+        if(!empty($parms))
+        {
+            if(isset($parms['name'])) {
+                if (!empty($parms['name'])) {
+                    $awhere = [];
+                    $awhere[] = ['name', 'like', '%' . $parms['name'] . '%'];
+                    $assetList = AssetInfo::where($awhere)->select()->toArray();
+                    $a_id_Arr = array_column($assetList, 'id');
+                    $where[] = ['a_id', 'in', $a_id_Arr];
+                }
+            }
+
+//            if(isset($parms['date_type'])) {
+                if (!empty($parms['create_time_start']) && !empty($parms['create_time_end'])) {
+//                    if($parms['date_type'] == 1){
+                        $where[] = ['create_time', 'between', [strtotime($parms['create_time_start']),strtotime($parms['create_time_end']. ' 23:59:59')]];
+//                    }else if($parms['date_type'] == 2){
+//                        $where[] = ['lease_start_time', '>=', $parms['start_time']];
+//                        $where[] = ['lease_end_time', '<=', $parms['end_time']];
+//                    }
+                }
+//            }
+            if(isset($parms['approval_status'])) {
+                if ($parms['approval_status']) {
+                    $where[] = ['approval_status', '=', $parms['approval_status']];
+                }
+            }
+
+            if(isset($parms['expiration_flag'])) {
+                $today = date('Y-m-d');
+                $expiration_date = date('Y-m-d', strtotime($today . ' +30 day'));
+                if ($parms['expiration_flag']) {
+                    $flag = true;
+                    $where[] = ['lease_end_time', '<=', $expiration_date];
+                    $where[] = ['approval_status','=','5'];
+                    $where[] = ['is_remind','=','1'];
+                }
+            }
+
+
+        }
+
+        if(!$admin_info['root']) {
+//            $where[] = ['lease_start_time', '>=', $parms['start_time']];
+            $jwhere = [];
+            $jwhere[] = ['admin_id', '=', $admin_info['admin_id']];
+            $jobs_list = AdminJobs::where($jwhere)->select()->toArray();
+            $all = false;
+            $first = false;
+            $second = false;
+            foreach ($jobs_list as $v) {
+                switch ($v['jobs_id']) {
+                    case 1:
+                        $all = true;
+                        break;
+                    case 2:
+                        $first = true;
+                        break;
+                    case 3:
+                        $second = true;
+                        break;
+                }
+            }
+            if (!$all) {
+                if(!($first && $second)){
+                    if($first){
+                        $where[] = ['approval_status','in',[1,2]];
+                    }
+                    if($second){
+                        $where[] = ['approval_status','in',[3,4,5]];
+                    }
+                }
+            }
+        }
+        $lists = (new AssetLeaseInfo())->field('*')
+            ->append(['first_status_desc','second_status_desc','approval_status_desc','is_pay_desc'])
+//            ->with('referee')
+            ->with(['asset','referee'])
+            ->where($where)
+            ->where($this->searchWhere)
+            ->limit($this->limitOffset, $this->limitLength)
+            ->Order('id desc')
+            ->select()
+            ->toArray();
+
+
+        foreach($lists as &$v){
+            $v['first_name'] = adminModel::where(['id'=>$v['first_uid']])->value('name') ?? '';
+            $v['second_name'] = adminModel::where(['id'=>$v['second_uid']])->value('name') ?? '' ;
+            if($flag){
+                $endTime = strtotime(date('Y-m-d'));
+                $startTime = strtotime($v['lease_end_time']);
+
+                $diff = $startTime-$endTime;
+                $day = $diff/86400;
+                $v['diff_day'] = $day;
+            }
+        }
+
+        return $lists;
+    }
+
+    /**
+     * @notes 资产信息数量
+     * @return int
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function count(): int
+    {
+        $admin_info = $this->adminInfo;
+
+        $parms =  $this->request->get();
+        $where = [] ;
+        if(!empty($parms))
+        {
+            if(isset($parms['asset_name'])) {
+                if (!empty($parms['asset_name'])) {
+                    $awhere = [];
+                    $awhere[] = ['name', 'like', '%' . $parms['asset_name'] . '%'];
+                    $assetList = AssetInfo::where($awhere)->select()->toArray();
+                    $a_id_Arr = array_column($assetList, 'id');
+                    $where[] = ['a_id', 'in', $a_id_Arr];
+                }
+            }
+            if(isset($parms['date_type'])) {
+                if (!empty($parms['start_time']) && !empty($parms['end_time'])) {
+                    if($parms['date_type'] == 1){
+                        $where[] = ['create_time', 'between', [strtotime($parms['start_time']),strtotime($parms['end_time']. ' 23:59:59')]];
+                    }else if($parms['date_type'] == 2){
+                        $where[] = ['lease_start_time', '>=', $parms['start_time']];
+                        $where[] = ['lease_end_time', '<=', $parms['end_time']];
+                    }
+                }
+            }
+            if(isset($parms['approval_status'])) {
+                if ($parms['approval_status']) {
+                    $where[] = ['approval_status', '=', $parms['approval_status']];
+                }
+            }
+
+            if(isset($parms['expiration_flag'])) {
+                $today = date('Y-m-d');
+                $expiration_date = date('Y-m-d', strtotime($today . ' +30 day'));
+                if ($parms['expiration_flag']) {
+                    $where[] = ['lease_end_time', '<=', $expiration_date];
+                    $where[] = ['approval_status','=','5'];
+                    $where[] = ['is_remind','=','1'];
+                }
+            }
+
+
+        }
+
+        if(!$admin_info['root']) {
+//            $where[] = ['lease_start_time', '>=', $parms['start_time']];
+            $jwhere = [];
+            $jwhere[] = ['admin_id', '=', $admin_info['admin_id']];
+            $jobs_list = AdminJobs::where($jwhere)->select()->toArray();
+            $all = false;
+            $first = false;
+            $second = false;
+            foreach ($jobs_list as $v) {
+                switch ($v['jobs_id']) {
+                    case 1:
+                        $all = true;
+                        break;
+                    case 2:
+                        $first = true;
+                        break;
+                    case 3:
+                        $second = true;
+                        break;
+                }
+            }
+            if (!$all) {
+                if(!($first && $second)){
+                    if($first){
+                        $where[] = ['approval_status','in',[1,2]];
+                    }
+                    if($second){
+                        $where[] = ['approval_status','in',[3,4,5]];
+                    }
+                }
+            }
+        }
+
+        return (new AssetLeaseInfo())->where($this->searchWhere)->where($where)->count();
+    }
+
+    /**
+     * @notes  添加租赁资产订单
+     * @param array $params
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public static function add(array $params)
+    {
+
+        if ($params['lease_end_time']<$params['lease_start_time']) {
+            return ['code' => 0, 'msg' => '租赁时间范围有误请检查!'];
+        }
+        $where = [];
+//        $where[] = ['lease_end_time', '>=', $params['lease_start_time']];
+        $where[] = ['a_id', '=', $params['a_id']];
+       $tswhere = "(lease_start_time <". $params['lease_end_time'].") or ( lease_start_time < ".$params['lease_start_time']." and lease_end_time >".$params['lease_start_time'].")";
+        $assetLeaseInfo = AssetLeaseInfo::where($where)->where($tswhere)->findOrEmpty();
+
+        if (!$assetLeaseInfo->isEmpty()) {
+            return ['code' => 0, 'msg' => '租赁期内有未到期的租赁信息!','data'=>$assetLeaseInfo];
+        }
+        $area_id = AssetInfo::where(['id'=>$params['a_id']])->value('area_id');
+
+        AssetLeaseInfo::create([
+            'a_id' => $params['a_id'],
+            'tenant_name' => $params['tenant_name'] ?? '',
+            'tenant_mobile' => $params['tenant_mobile'] ?? '',
+            'license_number' => $params['license_number'] ?? '',
+            'license_image' => $params['license_image'] ?? '',
+            'lease_contract_image' => $params['lease_contract_image'] ?? '',
+            'lease_money' => $params['lease_money'] ?? 0,
+            'lease_start_time' => $params['lease_start_time'] ?? '',
+            'lease_end_time' => $params['lease_end_time'] ?? '',
+            'purpose' => $params['purpose'] ?? '',
+            'referee_name' =>$params['referee_name'],
+            'referee_uid' =>$params['referee_uid'],
+            'approval_status'=>$params['approval_status']??1,
+            'remark' => $params['remark'] ?? '',
+            'area_id' => $area_id ?? 0,
+        ]);
+        if(isset($params['remind_id'])){
+            $remind_id = $params['remind_id'];
+            $remind_asset_lease_info = AssetLeaseInfo::find($remind_id);
+            if($remind_asset_lease_info){
+                $updateData['id'] = $remind_id;
+                $updateData['is_remind'] = 0;
+                AssetLeaseInfo::update($updateData);
+            }
+        }
+
+        return ['code' => 200, 'msg' => '新增租赁信息成功!'];
+
+    }
+
+    /**
+     * @notes  编辑租赁信息资产
+     * @param array $params
+     * @return bool
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public static function edit(array $params) : bool
+    {
+        try {
+            if ($params['lease_end_time']<$params['lease_start_time']) {
+                throw new \Exception('租赁时间范围有误请检查');
+            }
+            $where = [];
+//            $where[] = ['lease_end_time', '>=', $params['lease_start_time']];
+            $where[] = ['id', '<>', $params['id']];
+            $where[] = ['a_id', '=', $params['a_id']];
+//            $tswhere = "(lease_start_time <". $params['lease_end_time'].") or (lease_end_time >".$params['lease_start_time'].")";
+            $tswhere = "(lease_start_time <". $params['lease_end_time'].") or ( lease_start_time < ".$params['lease_start_time']." and lease_end_time >".$params['lease_start_time'].")";
+            $assetLeaseInfo = AssetLeaseInfo::where($where)->where($tswhere)->findOrEmpty();
+
+            if (!$assetLeaseInfo->isEmpty()) {
+                throw new \Exception('租赁期内有未到期的租赁信息');
+            }
+
+            $asset_lease_info = AssetLeaseInfo::find($params['id']);
+
+            $approval_status = $asset_lease_info['approval_status'];
+
+            //审核状态   1:等待初审  2 初审驳回  3:初审通过 4:等待终审  5:终审通过  6:终审驳回
+
+            $new_approval_status = 1;
+            switch ($approval_status){
+                case 1:
+                    $new_approval_status =1;
+                    break;
+                case 2:
+                    $new_approval_status =1;
+                    break;
+                case 3:
+                    $new_approval_status =4;
+                    break;
+                case 4:
+                    $new_approval_status =4;
+                    break;
+                case 5:
+                    $new_approval_status =5;
+                    break;
+                case 6:
+                    $new_approval_status =1;
+                    break;
+                default:
+                    $new_approval_status =1;
+                    break;
+            }
+
+            AssetLeaseInfo::update([
+                'id'=>$params['id'],
+                'a_id' => $params['a_id'],
+                'tenant_name' => $params['tenant_name'] ?? '',
+                'tenant_mobile' => $params['tenant_mobile'] ?? '',
+                'license_number' => $params['license_number'] ?? '',
+                'license_image' => $params['license_image'] ?? '',
+                'lease_contract_image' => $params['lease_contract_image'] ?? '',
+                'lease_money' => $params['lease_money'] ?? 0,
+                'lease_start_time' => $params['lease_start_time'] ?? '',
+                'lease_end_time' => $params['lease_end_time'] ?? '', // 联系人
+                'purpose' => $params['purpose'] ?? '',
+                'referee_name' =>$params['referee_name'],
+                'referee_uid' =>$params['referee_uid'],
+                'remark' => $params['remark'] ?? '',
+                'first_status'=>$params['first_status'] ?? 1,
+                'first_uid'=>$params['first_uid'] ?? 0,
+                'second_status'=>$params['second_status'] ?? 0,
+                'second_uid'=>$params['second_uid'] ?? 0,
+                'approval_status'=>$new_approval_status,
+            ]);
+
+
+            return true ;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+    /**
+     * @notes  删除资产
+     * @param array $params
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public static function delete(array $params)
+    {
+        AssetLeaseInfo::destroy($params['id']);
+    }
+
+    /**
+     * @notes  查看资产详情
+     * @param $params
+     * @return array
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public static function detail($params) : array
+    {
+        return AssetLeaseInfo::with(['asset','firstapproval','endapproval'])->findOrEmpty($params['id'])->append(['first_status_desc','second_status_desc'])->toArray();
+    }
+
+    /**
+     * @notes  租赁资产信息审核
+     * @param array $params
+     * @return bool
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public static function approve(array $params) : bool
+    {
+        try {
+
+            $id = $params['id'];
+            $leaseAssetInfo = AssetLeaseInfo::find($id);
+            $updateData['id'] = $id;
+            if(in_array($leaseAssetInfo['approval_status'],[1,2,3])){
+                if(in_array($params['approval_status'],[4,5,6])){
+                    throw new \Exception('请先进行初审操作!');
+                }
+                $approval_status = empty($params['approval_status'])?$leaseAssetInfo['approval_status']:$params['approval_status'];
+
+                $ramark = '';
+                if( $approval_status == 3){
+                    $approval_status = 4;
+                    $ramark = '';
+                    $updateData['remark'] = $ramark;
+                }elseif($approval_status == 2){
+                    if(isset($params['remark'])){
+                        if(empty($params['remark'])){
+                            throw new \Exception('请输入驳回原因!');
+                        }else{
+                            $remark = $params['remark'];
+                        }
+                    }else{
+                        throw new \Exception('请输入驳回原因!');
+                    }
+                }else{
+                    $updateData['remark'] = $ramark;
+                }
+
+                if(!empty($remark)){
+                    $updateData['remark'] = $remark;
+                }
+                $updateData['approval_status'] = $approval_status;
+                $updateData['first_uid'] = $params['approve_uid'];
+                $updateData['first_approval_time'] = time();
+            }else{
+                //终审
+                if(in_array($params['approval_status'],[1,2,3])){
+                    throw new \Exception('初审已完成无需再次操作');
+                }
+                $approval_status = $params['approval_status'];
+                $ramark = '';
+                if($approval_status == 6){
+                    if(isset($params['remark'])){
+                        if(empty($params['remark'])){
+                            throw new \Exception('请输入驳回原因!');
+                        }else{
+                            $remark = $params['remark'];
+                        }
+                    }else{
+                        throw new \Exception('请输入驳回原因!');
+                    }
+                }else{
+                    $updateData['remark'] = $ramark;
+                }
+
+                if(!empty($remark)){
+                    $updateData['remark'] = $remark;
+                }
+                $updateData['approval_status'] = $approval_status;
+                $updateData['second_uid'] = $params['approve_uid'];
+                $updateData['end_approval_time'] = time();
+            }
+
+            AssetLeaseInfo::update($updateData);
+
+            if($approval_status == 5){
+                $leaseAssetInfo = AssetLeaseInfo::find($id);
+                $assetInfo = AssetInfo::find($leaseAssetInfo['a_id']);
+                $updateAssetData['id'] = $assetInfo['id'];
+                $updateFlag = false ;
+                if($assetInfo['lease_status']==2){
+                    if(strtotime($leaseAssetInfo['lease_end_time']) > strtotime($assetInfo['lease_expiration_time'])){
+                        $updateAssetData['lease_expiration_time'] = $leaseAssetInfo['lease_end_time'];
+                        $updateFlag = true ;
+                    }
+                }else{
+                    $updateAssetData['lease_expiration_time'] = $leaseAssetInfo['lease_end_time'];
+                    $updateAssetData['lease_status'] = 2;
+                    $updateFlag = true ;
+                }
+
+                if($updateFlag){
+                    AssetInfo::update($updateAssetData);
+                }
+            }
+            return true ;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+    /**
+     * @notes  租赁资产信息缴费
+     * @param array $params
+     * @return bool
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public static function updatePayStatus(array $params) : bool
+    {
+        try {
+
+            $id = $params['id'];
+            $leaseAssetInfo = AssetLeaseInfo::find($id);
+            $updateData['id'] = $id;
+            if(empty($leaseAssetInfo)){
+                throw new \Exception('传入的资产租赁信息id错误!');
+            }
+
+            $updateData['is_pay'] = $params['is_pay'];
+
+            AssetLeaseInfo::update($updateData);
+            return true ;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+    public static function autoUpdateStatus():bool{
+        $where = [] ;
+        $where[] = ['auto_status','=',0] ;
+        $where[]= ['approval_status','=',5];
+        $assetLeaseList = AssetLeaseInfo::where($where)->select()->toArray();
+        $nowTime = time();
+        foreach($assetLeaseList as &$v){
+            $assetInfo = AssetInfo::find($v['a_id']);
+            $a_lease_expiration_time = $assetInfo['lease_expiration_time'];
+            if($nowTime >= strtotime($v['lease_end_time'])){
+                $updateLeaseData['id']=$v['id'];
+                $updateLeaseData['auto_status']=1;
+                AssetLeaseInfo::update($updateLeaseData);
+                if(strtotime($v['lease_end_time']) >= strtotime($a_lease_expiration_time)) {
+                    $updateAssetData['id'] = $assetInfo['id'];
+                    $updateAssetData['lease_status'] = 3;
+                    AssetInfo::update($updateAssetData);
+                }else{
+                    continue;
+                }
+            }else{
+                continue;
+            }
+        }
+       
+        return true;
+    }
+
+    public static function setEnd(array $params):bool
+    {
+        try {
+            $assListObj = new AssetLeaseInfo();
+            $id = $params['id'];
+            $leaseAssetInfo = $assListObj->find($id);
+            $saveData['id'] = $id;
+            $saveData['is_remind'] = 0;
+            $saveData['auto_status'] = 1;
+            $assListObj->update($saveData);
+
+            $updateAssetData['id'] = $leaseAssetInfo['a_id'];
+            $updateAssetData['lease_expiration_time'] = '';
+            $updateAssetData['lease_status'] = 1;
+            AssetInfo::update($updateAssetData);
+            return true;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+
+    }
+}

+ 210 - 0
app/adminapi/lists/asset/AssetLists.php

@@ -0,0 +1,210 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\asset;
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\enum\asset\AssetEnum;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\article\Article;
+use app\common\model\notice\NoticeSetting;
+use app\common\model\asset\AssetInfo;
+use app\common\service\FileService;
+
+/**
+ * 资产管理
+ * Class AssetLists
+ * @package app\adminapi\lists\asset
+ */
+class AssetLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+    /**
+     * @notes 搜索条件
+     * @return \string[][]
+     * @author
+     * @date 2025/04/12 2:21 下午
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['area_id', 'lease_status'],
+            '%like%'=>['name'],
+        ];
+    }
+
+    /**
+     * @notes 资产信息列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function lists(): array
+    {
+        $parms =  $this->request->get();
+        $where=[];
+        if (!empty($parms['create_time_start']) && !empty($parms['create_time_end'])) {
+            $where[] = ['create_time', 'between', [strtotime($parms['create_time_start']), strtotime($parms['create_time_end'] . ' 23:59:59')]];
+        }
+        $lists = (new AssetInfo())->field('id,name,address,images,contacts,mobile,area,content,status,lease_status,lease_expiration_time,create_time,sort')
+            ->append(['status_desc','lease_status_desc'])
+            ->where($this->searchWhere)
+            ->where($where)
+            ->limit($this->limitOffset, $this->limitLength)
+            ->Order('sort desc')
+            ->select()
+            ->toArray();
+
+        return $lists;
+    }
+
+    /**
+     * @notes 资产信息数量
+     * @return int
+     * @author ljj
+     * @date 2022/2/16 3:18 下午
+     */
+    public function count(): int
+    {
+        return (new AssetInfo())->where($this->searchWhere)->count();
+    }
+
+    /**
+     * @notes  添加资产
+     * @param array $params
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public static function add(array $params)
+    {
+        AssetInfo::create([
+            'name' => $params['name'],
+            'images' => $params['images'] ?? '',
+            'address' => $params['address'] ?? '',
+            'contacts' => $params['contacts']?? '', // 联系人
+            'mobile' => $params['mobile'] ?? '',
+            'area' => $params['area'] ?? '',
+            'content' => $params['content'] ?? '',
+//            'image' => $params['image'] ? FileService::setFileUrl($params['image']) : '',
+            'lease_expiration_time'=>$params['lease_expiration_time'] ?? '',
+            'status' => $params['status'] ?? 1,
+            'area_id' => $params['area_id'] ?? 0,
+            'sort' => $params['sort'] ?? 0, // 排序
+        ]);
+    }
+
+    /**
+     * @notes  编辑资产
+     * @param array $params
+     * @return bool
+     * @author heshihu
+     * @date 2022/2/22 10:12
+     */
+    public static function edit(array $params) : bool
+    {
+        try {
+            AssetInfo::update([
+                'id' => $params['id'],
+                'name' => $params['name'],
+                'images' => $params['images'],
+                'address' => $params['address'],
+                'contacts' => $params['contacts'],
+                'mobile' => $params['mobile'],
+                'area' => $params['area'] ?? '',
+                'content' => $params['content'] ?? '',
+                'status' => $params['status'] ?? 1,
+                'sort' => $params['sort'] ?? 0,
+                'content' => $params['content'] ?? '',
+                'area_id' => $params['area_id'] ?? 0,
+            ]);
+            return true;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+    /**
+     * @notes  删除资产
+     * @param array $params
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public static function delete(array $params)
+    {
+        AssetInfo::destroy($params['id']);
+    }
+
+    /**
+     * @notes  查看资产详情
+     * @param $params
+     * @return array
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public static function detail($params) : array
+    {
+        return AssetInfo::findOrEmpty($params['id'])->append(['status_desc','lease_status_desc'])->toArray();
+    }
+
+    public static function getRentAssetList($params) : array
+    {
+
+        $where = [] ;
+        if(!empty($params)){
+            $where[]=['name','like','%'.$params['name'].'%'];
+        }
+        $where[]=['status','=',1];
+        $where[]=['lease_status','in',[1,3]];
+        $assetList = AssetInfo::where($where)->field('id,name,area')->select()->toArray();
+
+        return $assetList;
+    }
+
+    public static function getAssetData():array
+    {
+        $where = [] ;
+
+        $where[]=['status','=',1];
+        $assetList = AssetInfo::where($where)->field('lease_status,count(id) total_number')->append(['lease_status_desc'])->group('lease_status')->select()->toArray();
+        $all_lease_status = AssetEnum::LEASE_STATTUS_SCENE;
+        $lease_satus = array_column($assetList,'lease_status');
+        $diff_lease_satus = array_diff($all_lease_status, $lease_satus);
+        if(!empty($diff_lease_satus)){
+            foreach($diff_lease_satus as $dv){
+                $pushData['lease_status_desc'] = AssetEnum::getLeaseStatusDesc($dv);
+                $pushData['lease_status'] = $dv;
+                $pushData['total_number'] = 0;
+
+                $assetList[]=$pushData;
+            }
+        }
+        $totalNumber = sumValues($assetList,'total_number');
+        $leave_unused = 0;
+        foreach($assetList as $av){
+            if($av['lease_status'] == 1){
+                $leave_unused = $av['total_number'];
+            }
+        }
+
+        $unused_rate = $totalNumber?round(($leave_unused/$totalNumber*100),2):100;
+        $return_data['leave_unused_num'] = $leave_unused;
+        $return_data['unused_rate'] = $unused_rate;
+        $return_data['asset_list'] = $assetList;
+
+        return $return_data;
+    }
+}

+ 91 - 0
app/adminapi/validate/asset/AssetAreaValidate.php

@@ -0,0 +1,91 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\asset;
+
+use app\common\validate\BaseValidate;
+use app\common\model\asset\AssetArea;
+/**
+ * 资产地址管理验证
+ * Class ArticleValidate
+ * @package app\adminapi\validate\article
+ */
+class AssetAreaValidate extends BaseValidate
+{
+    protected $rule = [
+        'id' => 'require|checkAssetInfo',
+        'title' => 'require|length:1,50',
+    ];
+
+    protected $message = [
+        'id.require' => '资产地址id必传',
+        'title.require' => '地址名称不能为空',
+        'title.length' => '地址名称长度须在1-55位字符',
+    ];
+
+    /**
+     * @notes  添加场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public function sceneAdd()
+    {
+        return $this->remove(['id'])
+            ->remove('id','require|checkAssetInfo');
+    }
+
+    /**
+     * @notes  详情场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+    public function sceneEdit()
+    {
+    }
+
+    /**
+     * @notes  删除场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+    /**
+     * @notes  检查指定地址是否存在
+     * @param $value
+     * @return bool|string
+     * @author heshihu
+     * @date 2022/2/22 10:11
+     */
+    public function checkAssetInfo($value)
+    {
+        $article = AssetArea::findOrEmpty($value);
+        if ($article->isEmpty()) {
+            return '地址不存在';
+        }
+        return true;
+    }
+
+}

+ 148 - 0
app/adminapi/validate/asset/AssetLeaseValidate.php

@@ -0,0 +1,148 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\asset;
+
+use app\common\validate\BaseValidate;
+use app\common\model\asset\AssetInfo;
+use app\common\model\asset\AssetLeaseInfo;
+/**
+ * 资产租赁管理验证
+ * Class ArticleValidate
+ * @package app\adminapi\validate\article
+ */
+class AssetLeaseValidate extends BaseValidate
+{
+    protected $rule = [
+        'id' => 'require|checkAssetInfo',
+        'a_id' => 'require|checkAssetDataInfo',
+        'tenant_name' => 'require|length:1,50',
+        'tenant_mobile' => 'require|length:1,13',
+        'license_number' => 'require',
+        'license_image' => 'require',
+        'lease_contract_image' => 'require',
+        'lease_money' => 'require',
+        'lease_start_time' => 'require',
+        'referee_name'=>'require',
+        'first_status' => 'in:1,2,3',
+        'second_status' => 'in:0,1,2,3',
+        'approval_status'=>'in:1,2,3,4,5,6',
+        'is_pay'=>'require|in:1,0',
+    ];
+
+    protected $message = [
+        'id.require' => '租赁资产订单信息id必传',
+        'tenant_name.require' => '租赁人姓名必传!',
+        'tenant_name.length' => '资产名称长度须在1-50位字符',
+        'tenant_mobile.require' => '租赁人联系方式必传!',
+        'tenant_mobile.length' => '租赁人联系方式长度须在1-13位字符',
+        'license_number.require' => '营业执照编号不能为空',
+        'license_image.require' => '营业执照照片必传',
+        'lease_contract_image.require' => '合同照片必传',
+        'lease_money.require' => '租赁金额必传',
+        'referee_name.require' => '提审人不能为空',
+        'approval_status.in' => '审批状态值错误',
+        'is_pay.require' => '缴费状态必传',
+    ];
+
+    /**
+     * @notes  添加场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public function sceneAdd()
+    {
+        return $this->remove(['id','is_pay'])
+            ->remove('id','require|checkAssetInfo')
+            ->remove('is_pay','require');
+    }
+
+    /**
+     * @notes  详情场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+    /**
+     * @notes  更改状态场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:18
+     */
+    public function sceneStatus()
+    {
+        return $this->only(['id', 'status']);
+    }
+    /**
+     * @notes  更改支付状态场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:18
+     */
+    public function scenePay()
+    {
+        return $this->only(['id', 'is_pay']);
+    }
+    public function sceneEdit()
+    {
+    }
+
+    /**
+     * @notes  删除场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+    public function sceneApprove(){
+        return $this->only(['id', 'approval_status']);
+    }
+    public function sceneEnd(){
+        return $this->only(['id']);
+    }
+    /**
+     * @notes  检查指定资讯是否存在
+     * @param $value
+     * @return bool|string
+     * @author heshihu
+     * @date 2022/2/22 10:11
+     */
+    public function checkAssetInfo($value)
+    {
+        $article = AssetLeaseInfo::findOrEmpty($value);
+        if ($article->isEmpty()) {
+            return '租赁资产订单信息不存在';
+        }
+        return true;
+    }
+
+    public function checkAssetDataInfo($value){
+        $article = AssetInfo::findOrEmpty($value);
+        if ($article->isEmpty()) {
+            return '资产不存在或已删除';
+        }
+        return true;
+    }
+
+}

+ 111 - 0
app/adminapi/validate/asset/AssetValidate.php

@@ -0,0 +1,111 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\asset;
+
+use app\common\validate\BaseValidate;
+use app\common\model\asset\AssetInfo;
+/**
+ * 资产管理验证
+ * Class ArticleValidate
+ * @package app\adminapi\validate\article
+ */
+class AssetValidate extends BaseValidate
+{
+    protected $rule = [
+        'id' => 'require|checkAssetInfo',
+        'name' => 'require|length:1,255',
+        'images' => 'require',
+        'address' => 'require',
+        'contacts' => 'require',
+        'mobile' => 'require',
+        'status' => 'in:0,1',
+    ];
+
+    protected $message = [
+        'id.require' => '资产id必传',
+        'name.require' => '资产名称不能为空',
+        'name.length' => '资产名称长度须在1-255位字符',
+        'images.require' => '资产图片不能为空',
+        'address.require' => '资产地址不能为空',
+        'contacts.require' => '资产联系人不能为空',
+        'mobile.require' => '联系方式不能为空',
+    ];
+
+    /**
+     * @notes  添加场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 9:57
+     */
+    public function sceneAdd()
+    {
+        return $this->remove(['id'])
+            ->remove('id','require|checkAssetInfo');
+    }
+
+    /**
+     * @notes  详情场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:15
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+    /**
+     * @notes  更改状态场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:18
+     */
+    public function sceneStatus()
+    {
+        return $this->only(['id', 'status']);
+    }
+
+    public function sceneEdit()
+    {
+    }
+
+    /**
+     * @notes  删除场景
+     * @return ArticleValidate
+     * @author heshihu
+     * @date 2022/2/22 10:17
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+    /**
+     * @notes  检查指定资讯是否存在
+     * @param $value
+     * @return bool|string
+     * @author heshihu
+     * @date 2022/2/22 10:11
+     */
+    public function checkAssetInfo($value)
+    {
+        $article = AssetInfo::findOrEmpty($value);
+        if ($article->isEmpty()) {
+            return '资产不存在';
+        }
+        return true;
+    }
+
+}

+ 28 - 0
app/common/model/asset/AssetArea.php

@@ -0,0 +1,28 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\asset;
+
+
+use app\common\enum\DefaultEnum;
+use app\common\model\BaseModel;
+use think\model\concern\SoftDelete;
+
+class AssetArea extends BaseModel
+{
+    use SoftDelete;
+
+    protected $deleteTime = 'delete_time';
+
+}

+ 54 - 0
app/common/model/asset/AssetInfo.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\asset;
+
+
+use app\common\enum\DefaultEnum;
+use app\common\enum\asset\AssetEnum;
+use app\common\model\BaseModel;
+use think\model\concern\SoftDelete;
+
+class AssetInfo extends BaseModel
+{
+    use SoftDelete;
+
+    protected $deleteTime = 'delete_time';
+
+    /**
+     * @notes 状态类型
+     * @param $value
+     * @param $data
+     * @return string|string[]
+     * @author ljj
+     * @date 2022/2/17 2:50 下午
+     */
+    public function getStatusDescAttr($value,$data)
+    {
+        return AssetEnum::getStatusDesc($data['status']);
+    }
+
+    /**
+     * @notes 租赁状态类型
+     * @param $value
+     * @param $data
+     * @return string|string[]
+     * @author ljj
+     * @date 2022/2/17 2:50 下午
+     */
+    public function getLeaseStatusDescAttr($value,$data)
+    {
+        return AssetEnum::getLeaseStatusDesc($data['lease_status']);
+    }
+}

+ 138 - 0
app/common/model/asset/AssetLeaseInfo.php

@@ -0,0 +1,138 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\asset;
+
+
+use app\common\enum\DefaultEnum;
+use app\common\enum\asset\AssetEnum;
+use app\common\model\auth\Admin;
+use app\common\model\asset\AssetInfo;
+use app\common\model\BaseModel;
+use think\model\concern\SoftDelete;
+
+class AssetLeaseInfo extends BaseModel
+{
+    use SoftDelete;
+
+    protected $deleteTime = 'delete_time';
+
+    /**
+     * @notes 关联资产表
+     * @return \think\model\relation\HasOne
+     * @author 令狐冲
+     * @date 2021/7/5 14:39
+     */
+    public function asset()
+    {
+        return $this->hasOne(AssetInfo::class, 'id', 'a_id')
+            ->field('id,name,images,address,contacts,mobile,area');
+    }
+    /**
+     * @notes 关联管理员表
+     * @return \think\model\relation\HasOne
+     * @author 令狐冲
+     * @date 2021/7/5 14:39
+     */
+    public function referee()
+    {
+        return $this->hasOne(Admin::class, 'id', 'referee_uid')
+            ->field('id,name');
+    }
+
+    /**
+     * @notes 关联管理员表
+     * @return \think\model\relation\HasOne
+     * @author 令狐冲
+     * @date 2021/7/5 14:39
+     */
+    public function firstapproval()
+    {
+        return $this->hasOne(Admin::class, 'id', 'first_uid')
+            ->field('id,name');
+    }
+
+    /**
+     * @notes 关联管理员表
+     * @return \think\model\relation\HasOne
+     * @author 令狐冲
+     * @date 2021/7/5 14:39
+     */
+    public function endapproval()
+    {
+        return $this->hasOne(Admin::class, 'id', 'second_uid')
+            ->field('id,name');
+    }
+    /**
+     * @notes 关联管理员表
+     * @return \think\model\relation\HasOne
+     * @author 令狐冲
+     * @date 2021/7/5 14:39
+     */
+    public function first()
+    {
+        return $this->hasOne(Admin::class, 'id', 'first_uid')
+            ->field('id,name');
+    }
+    /**
+     * @notes 一审状态类型
+     * @param $value
+     * @param $data
+     * @return string|string[]
+     * @author ljj
+     * @date 2022/2/17 2:50 下午
+     */
+    public function getFirstStatusDescAttr($value,$data)
+    {
+        return AssetEnum::getFirstStatusDesc($data['first_status']);
+    }
+
+    /**
+     * @notes 终审
+     * @param $value
+     * @param $data second_status
+     * @return string|string[]
+     * @author ljj
+     * @date 2022/2/17 2:50 下午
+     */
+    public function getSecondStatusDescAttr($value,$data)
+    {
+        return AssetEnum::getSecondStatusDesc($data['second_status']);
+    }
+    /**
+     * @notes 终审
+     * @param $value
+     * @param $data second_status
+     * @return string|string[]
+     * @author ljj
+     * @date 2022/2/17 2:50 下午
+     */
+    public function getApprovalStatusDescAttr($value,$data)
+    {
+        return AssetEnum::getApprovalStatusDesc($data['approval_status']);
+    }
+    /**
+     * @notes 是否缴费
+     * @param $value
+     * @param $data second_status
+     * @return string|string[]
+     * @author ljj
+     * @date 2022/2/17 2:50 下午
+     */
+    public function getIsPayDescAttr($value,$data)
+    {
+        return AssetEnum::getIsPayDesc($data['is_pay']);
+    }
+
+}