['project_id'], '%like%' => ['code'] ]; } /** * @notes 获取标书审查列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/02 09:52 */ public function lists(): array { $params = $this->request->get(['bid_document_no','project_name']); $where = []; if(isset($params['bid_document_no']) && $params['bid_document_no'] != ''){ $bid_doc_ids = BidBuyBiddingDocument::where('bid_document_no','like','%'.$params['bid_document_no'].'%')->column('id'); $where[] = ['buy_bidding_document_id','in',$bid_doc_ids]; } if(isset($params['project_name']) && $params['project_name'] != ''){ $project_ids = Project::where('name','like','%'.$params['project_name'].'%')->column('id'); $where[] = ['project_id','in',$project_ids]; } $field = 'id,code,project_id,buy_bidding_document_id'; return BidDocumentExamination::where($this->searchWhere)->where($where) ->field($field)->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $project = Project::field('custom_id,name,project_code')->where('id',$item['project_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); $bid_buy_doc = BidBuyBiddingDocument::field('bid_decision_id,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,buy_date,bid_address')->where('id',$item['buy_bidding_document_id'])->findOrEmpty(); $bid_decision = BidBiddingDecision::field('bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date')->where('id',$bid_buy_doc['bid_decision_id'])->findOrEmpty(); $buyer = Admin::field('name')->where('id',$bid_buy_doc['buyer'])->findOrEmpty(); $item['project_name'] = $project['name']; $item['project_code'] = $project['project_code']; $item['custom_name'] = $custom['name']; $item['bid_document_no'] = $bid_buy_doc['bid_document_no']; $item['invite_tenders_company_name'] = $bid_buy_doc['invite_tenders_company_name']; $item['bid_company_name'] = $bid_buy_doc['bid_company_name']; $item['bid_address'] = $bid_buy_doc['bid_address']; $item['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text; $item['buyer'] = $buyer['name']; $item['bidding_time'] = $bid_decision['bidding_time']; $item['bid_type'] = $bid_decision->bid_type_text; $item['is_margin'] = $bid_decision->is_margin_text; $item['margin_amount'] = $bid_decision['margin_amount']; $item['bid_opening_date'] = $bid_decision['bid_opening_date']; $item['total_amount'] = BidDocumentExaminationDetail::where('bid_document_examination_id',$item['id'])->sum('sale_amount'); return $item; }) ->toArray(); } /** * @notes 获取标书审查数量 * @return int * @author likeadmin * @date 2023/12/02 09:52 */ public function count(): int { $params = $this->request->get(['bid_document_no','project_name']); $where = []; if(isset($params['bid_document_no']) && $params['bid_document_no'] != ''){ $bid_doc_ids = BidBuyBiddingDocument::where('bid_document_no','like','%'.$params['bid_document_no'].'%')->column('id'); $where[] = ['buy_bidding_document_id','in',$bid_doc_ids]; } if(isset($params['project_name']) && $params['project_name'] != ''){ $project_ids = Project::where('name','like','%'.$params['project_name'].'%')->column('id'); $where[] = ['project_id','in',$project_ids]; } return BidDocumentExamination::field('id')->where($this->searchWhere)->where($where)->count(); } }