moonsflyer před 8 měsíci
rodič
revize
caddaae9b7

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

@@ -131,6 +131,16 @@ class AssetLeaseController extends BaseAdminController
         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);

+ 28 - 1
app/adminapi/lists/asset/AssetLeaseLists.php

@@ -136,7 +136,7 @@ class AssetLeaseLists extends BaseAdminDataLists implements ListsSearchInterface
             }
         }
         $lists = (new AssetLeaseInfo())->field('*')
-            ->append(['first_status_desc','second_status_desc','approval_status_desc'])
+            ->append(['first_status_desc','second_status_desc','approval_status_desc','is_pay_desc'])
 //            ->with('referee')
             ->with(['asset','referee'])
             ->where($where)
@@ -514,6 +514,33 @@ class AssetLeaseLists extends BaseAdminDataLists implements ListsSearchInterface
             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 = [] ;

+ 12 - 1
app/adminapi/validate/asset/AssetLeaseValidate.php

@@ -38,6 +38,7 @@ class AssetLeaseValidate extends BaseValidate
         '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 = [
@@ -52,6 +53,7 @@ class AssetLeaseValidate extends BaseValidate
         'lease_money.require' => '租赁金额必传',
         'referee_name.require' => '提审人不能为空',
         'approval_status.in' => '审批状态值错误',
+        'is_pay.require' => '缴费状态必传',
     ];
 
     /**
@@ -87,7 +89,16 @@ class AssetLeaseValidate extends BaseValidate
     {
         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()
     {
     }

+ 32 - 0
app/common/enum/asset/AssetEnum.php

@@ -20,6 +20,16 @@ namespace app\common\enum\asset;
  */
 class AssetEnum
 {
+
+    //是否缴费
+    const ISPAY =1;//缴费
+    const UNPAY = 0 ; //未缴费
+
+    const PAY_SCENE=[
+        self::ISPAY,
+        self::UNPAY
+    ];
+
     //显示状态类型
     const ENABLE = 1;//启用
     const DISABLE = 0;//禁用
@@ -139,6 +149,28 @@ class AssetEnum
         return $desc[$sceneId] ?? '';
     }
     /**
+     * @notes 获取审状态描述
+     * @param $sceneId
+     * @param false $flag
+     * @return string|string[]
+     * @author 段誉
+     * @date 2022/3/29 11:33
+     */
+    public static function getIsPayDesc($sceneId, $flag = false)
+    {
+        $desc = [
+            self::ISPAY => '已缴费',
+            self::UNPAY => '未缴费',
+        ];
+
+        if ($flag) {
+            return $desc;
+        }
+
+        return $desc[$sceneId] ?? '';
+    }
+
+    /**
      * @notes 获取一审状态描述
      * @param $sceneId
      * @param false $flag

+ 12 - 1
app/common/model/asset/AssetLeaseInfo.php

@@ -122,6 +122,17 @@ class AssetLeaseInfo extends BaseModel
     {
         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']);
+    }
 
 }