engineering/app/adminapi/lists/bid/BidSecurityRefundLists.php
2024-01-30 16:41:25 +08:00

120 lines
4.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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\bid;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\model\bank\BankAccount;
use app\common\model\bid\BidBiddingDecision;
use app\common\model\bid\BidSecurityApply;
use app\common\model\bid\BidSecurityRefund;
use app\common\lists\ListsSearchInterface;
use app\common\model\custom\Custom;
use app\common\model\project\Project;
use think\facade\Db;
/**
* BidSecurityRefund列表
* Class BidSecurityRefundLists
* @package app\adminapi\listsbid
*/
class BidSecurityRefundLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/12/18 10:29
*/
public function setSearch(): array
{
return [
'=' => ['bid_security_apply_id', 'project_id', 'bank_account_id'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/12/18 10:29
*/
public function lists(): array
{
return BidSecurityRefund::where($this->searchWhere)
->field('id,project_id,bid_security_apply_id,refund_amount,refund_date,remark,annex,bank_account_id,create_time')
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
$bid_security_apply = BidSecurityApply::field('bidding_decision_id')->where('id',$data['bid_security_apply_id'])->findOrEmpty();
$bidding_decision = BidBiddingDecision::field('code,bidding_time')->where('id',$bid_security_apply['bidding_decision_id'])->findOrEmpty();
$data['bidding_decision_code'] = $bidding_decision['code'];
$data['custom_name'] = $custom['name'];
$data['project_name'] = $project['name'];
$data['project_code'] = $project['project_code'];
$data['bidding_time'] = $bidding_decision['bidding_time'];
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
return $data;
})
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2023/12/18 10:29
*/
public function count(): int
{
return BidSecurityRefund::where($this->searchWhere)->count();
}
public function setFileName(): string
{
return '投标保证金退还列表';
}
/**
* @notes 导出字段
* @return string[]
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setExcelFields(): array
{
return [
"id" => "id",
"bidding_decision_code" => "投标编号",
"custom_name" => "客户名称",
"project_code" => "项目编码",
"project_name" => "项目名称",
"bidding_time" => "投标时间",
"refund_amount" => "退款金额",
"refund_date" => "退款日期",
"remark" => "备注",
];
}
}