update
This commit is contained in:
parent
b3fb80f05b
commit
2fd3e6ba5f
@ -52,45 +52,13 @@ class BidDocumentExaminationController extends BaseAdminController
|
||||
public function add()
|
||||
{
|
||||
$params = (new BidDocumentExaminationValidate())->post()->goCheck('add');
|
||||
$result = BidDocumentExaminationLogic::add($params);
|
||||
$result = BidDocumentExaminationLogic::add($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidDocumentExaminationLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑标书审查
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new BidDocumentExaminationValidate())->post()->goCheck('edit');
|
||||
$result = BidDocumentExaminationLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidDocumentExaminationLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除标书审查
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new BidDocumentExaminationValidate())->post()->goCheck('delete');
|
||||
BidDocumentExaminationLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查详情
|
||||
* @return \think\response\Json
|
||||
|
@ -17,6 +17,7 @@ namespace app\adminapi\lists\bid;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\custom\Custom;
|
||||
@ -70,21 +71,20 @@ class BidBuyBiddingDocumentLists extends BaseAdminDataLists implements ListsSear
|
||||
$project_ids = Project::where('custom_id','in',$custom_ids)->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return BidBuyBiddingDocument::field('id,org_id,dept_id,project_id,code,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,amount,project_fund_source,bid_date,buy_date,invite_tenders_type,bid_address,is_margin,margin_amount,bid_project_overview,project_desc,annex')
|
||||
return BidBuyBiddingDocument::field('id,org_id,dept_id,project_id,bid_decision_id,code,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,amount,buy_date,bid_address')
|
||||
->where($this->searchWhere)->where($where)
|
||||
->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_decision = BidBiddingDecision::field('code')->where('id',$item['bid_decision_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$item['buyer'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['bid_decision_code'] = $bid_decision['code'];
|
||||
$item['buyer'] = $admin['name'];
|
||||
$item['project_fund_source'] = $item->project_fund_source_text;
|
||||
$item['invite_tenders_type'] = $item->invite_tenders_type_text;
|
||||
$item['is_margin'] = $item->is_margin_text;
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
@ -16,9 +16,12 @@ namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
@ -40,7 +43,8 @@ class BidDocumentExaminationLists extends BaseAdminDataLists implements ListsSea
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['buy_bidding_document_id', 'is_need_deposit'],
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['code']
|
||||
];
|
||||
}
|
||||
|
||||
@ -56,16 +60,37 @@ class BidDocumentExaminationLists extends BaseAdminDataLists implements ListsSea
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return BidDocumentExamination::where($this->searchWhere)
|
||||
->field(['*'])->limit($this->limitOffset, $this->limitLength)
|
||||
$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){
|
||||
$bidBuy = BidBuyBiddingDocument::field('bid_document_no,bid_date,project_id')->where('id',$item['buy_bidding_document_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id',$bidBuy['project_id'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['bid_document_no'] = $bidBuy['bid_document_no'];
|
||||
$item['bid_date'] = $bidBuy['bid_date'];
|
||||
$project = Project::field('custom_id,name')->where('id',$item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_buy_doc = BidBuyBiddingDocument::field('bid_decision_id,invite_tenders_company_name,bid_company_name,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();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$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['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();
|
||||
@ -80,7 +105,17 @@ class BidDocumentExaminationLists extends BaseAdminDataLists implements ListsSea
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return BidDocumentExamination::where($this->searchWhere)->count();
|
||||
$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();
|
||||
}
|
||||
|
||||
}
|
@ -52,7 +52,6 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
'project_estimation' => $params['project_estimation'],
|
||||
'bidding_project_fund_source' => $params['bidding_project_fund_source'] ?? 0,
|
||||
'bidding_time' => !empty($params['bidding_time']) ? strtotime($params['bidding_time']) : 0,
|
||||
'buy_bid_document_date' => !empty($params['buy_bid_document_date']) ? strtotime($params['buy_bid_document_date']) : 0,
|
||||
'bid_type' => $params['bid_type'] ?? 0,
|
||||
'competitor' => $params['competitor'] ?? '',
|
||||
'is_margin' => $params['is_margin'] ?? 0,
|
||||
@ -97,7 +96,6 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
'project_estimation' => $params['project_estimation'],
|
||||
'bidding_project_fund_source' => $params['bidding_project_fund_source'] ?? 0,
|
||||
'bidding_time' => !empty($params['bidding_time']) ? strtotime($params['bidding_time']) : 0,
|
||||
'buy_bid_document_date' => !empty($params['buy_bid_document_date']) ? strtotime($params['buy_bid_document_date']) : 0,
|
||||
'bid_type' => $params['bid_type'] ?? 0,
|
||||
'competitor' => $params['competitor'] ?? '',
|
||||
'is_margin' => $params['is_margin'] ?? 0,
|
||||
|
@ -16,6 +16,7 @@ namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
@ -50,21 +51,14 @@ class BidBuyBiddingDocumentLogic extends BaseLogic
|
||||
'dept_id' => $params['dept_id'],
|
||||
'code' => data_unique_code('购买标书'),
|
||||
'project_id' => $params['project_id'],
|
||||
'bid_decision_id' => $params['bid_decision_id'],
|
||||
'bid_document_no' => $params['bid_document_no'],
|
||||
'invite_tenders_company_name' => $params['invite_tenders_company_name'],
|
||||
'bid_company_name' => $params['bid_company_name'],
|
||||
'buyer' => $params['buyer'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'project_fund_source' => $params['project_fund_source'] ?? 0,
|
||||
'bid_date' => !empty($params['bid_date']) ? strtotime($params['bid_date']) : 0,
|
||||
'buy_date' => !empty($params['buy_date']) ? strtotime($params['buy_date']) : 0,
|
||||
'invite_tenders_type' => $params['invite_tenders_type'] ?? 0,
|
||||
'bid_address' => $params['bid_address'] ?? '',
|
||||
'is_margin' => $params['is_margin'] ?? 0,
|
||||
'margin_amount' => $params['margin_amount'] ?? 0,
|
||||
'bid_project_overview' => $params['bid_project_overview'] ?? '',
|
||||
'project_desc' => $params['project_desc'] ?? '',
|
||||
'annex' => !empty($params['annex']) ? $params['annex'] : null,
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
@ -91,21 +85,14 @@ class BidBuyBiddingDocumentLogic extends BaseLogic
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'bid_decision_id' => $params['bid_decision_id'],
|
||||
'bid_document_no' => $params['bid_document_no'],
|
||||
'invite_tenders_company_name' => $params['invite_tenders_company_name'],
|
||||
'bid_company_name' => $params['bid_company_name'],
|
||||
'buyer' => $params['buyer'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'project_fund_source' => $params['project_fund_source'] ?? 0,
|
||||
'bid_date' => !empty($params['bid_date']) ? strtotime($params['bid_date']) : 0,
|
||||
'buy_date' => !empty($params['buy_date']) ? strtotime($params['buy_date']) : 0,
|
||||
'invite_tenders_type' => $params['invite_tenders_type'] ?? 0,
|
||||
'bid_address' => $params['bid_address'] ?? '',
|
||||
'is_margin' => $params['is_margin'] ?? 0,
|
||||
'margin_amount' => $params['margin_amount'] ?? 0,
|
||||
'bid_project_overview' => $params['bid_project_overview'] ?? '',
|
||||
'project_desc' => $params['project_desc'] ?? '',
|
||||
'annex' => !empty($params['annex']) ? $params['annex'] : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
Db::commit();
|
||||
@ -140,21 +127,29 @@ class BidBuyBiddingDocumentLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidBuyBiddingDocument::field('id,org_id,dept_id,project_id,code,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,amount,project_fund_source,bid_date,buy_date,invite_tenders_type,bid_address,is_margin,margin_amount,bid_project_overview,project_desc,annex')->findOrEmpty($params['id']);
|
||||
$data = BidBuyBiddingDocument::field('id,org_id,dept_id,project_id,bid_decision_id,code,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,amount,buy_date,bid_address')->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
|
||||
$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_decision = BidBiddingDecision::field('code,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date,margin_amount_return_date,bid_project_overview,project_desc,annex')->where('id',$data['bid_decision_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$data['buyer'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_decision_code'] = $bid_decision['code'];
|
||||
$data['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$data['bid_type'] = $bid_decision->bid_type_text;
|
||||
$data['is_margin'] = $bid_decision->is_margin_text;
|
||||
$data['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$data['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$data['margin_amount_return_date'] = $bid_decision['margin_amount_return_date'];
|
||||
$data['bid_project_overview'] = $bid_decision['bid_project_overview'];
|
||||
$data['project_desc'] = $bid_decision['project_desc'];
|
||||
$data['annex'] = $bid_decision['annex'];
|
||||
$data['buyer'] = $admin['name'];
|
||||
$data['project_fund_source'] = $data->project_fund_source_text;
|
||||
$data['invite_tenders_type'] = $data->invite_tenders_type_text;
|
||||
$data['is_margin'] = $data->is_margin_text;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -15,9 +15,16 @@
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -37,43 +44,45 @@ class BidDocumentExaminationLogic extends BaseLogic
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$bidDocumentExamination = BidDocumentExamination::create([
|
||||
'approve_id' => $params['approve_id'] ?? 0,
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'] ?? 0,
|
||||
'is_need_deposit' => $params['is_need_deposit'] ?? 0,
|
||||
'bid_opening_date' => strtotime($params['bid_opening_date']),
|
||||
'deposit_refund_time' => strtotime($params['deposit_refund_time']),
|
||||
'bidding_project_overview' => $params['bidding_project_overview'] ?? '',
|
||||
'project_introduction' => $params['project_introduction'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
'code' => data_unique_code('标书审查'),
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => $params['technical_review_annex'] ?? '',
|
||||
'business_review_total_amount' => $params['business_review_total_amount'] ?? 0,
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'pay_rate' => $params['pay_rate'] ?? '',
|
||||
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
|
||||
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
|
||||
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => !empty($params['technical_review_annex']) ? $params['technical_review_annex'] : null,
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'pay_rate' => $params['pay_rate'] ?? '',
|
||||
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
|
||||
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
|
||||
'business_contract_deviation_annex' => !empty($params['business_contract_deviation_annex']) ? $params['business_contract_deviation_annex'] : null,
|
||||
]);
|
||||
foreach ($params['product'] ?? [] as $item)
|
||||
{
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $bidDocumentExamination->id,
|
||||
'product_id' => $item['product_id'] ?? 0,
|
||||
'product_num' => $item['product_num'] ?? 0,
|
||||
'cost_unit_price' => $item['cost_unit_price'] ?? 0,
|
||||
'amount' => $item['amount'] ?? '',
|
||||
'rate' => $item['rate'] ?? '',
|
||||
'unit_price' => $item['unit_price'] ?? 0,
|
||||
'total_amount' => $item['total_amount'] ?? 0
|
||||
]);
|
||||
}
|
||||
if(!empty($params['quotation_detail'])){
|
||||
$quotation_detail = json_decode($params['quotation_detail'],true);
|
||||
foreach ($quotation_detail as $item)
|
||||
{
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $bidDocumentExamination->id,
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
'cost_price' => $item['cost_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cost_amount' => $item['cost_price'] * $item['num'],
|
||||
'sale_amount' => $item['sale_price'] * $item['num'],
|
||||
'add_user' => $admin_id,
|
||||
'update_user' => $admin_id
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -84,75 +93,6 @@ class BidDocumentExaminationLogic extends BaseLogic
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑标书审查
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidDocumentExamination::where('id', $params['id'])->update([
|
||||
'approve_id' => $params['approve_id'] ?? 0,
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'] ?? 0,
|
||||
'is_need_deposit' => $params['is_need_deposit'] ?? 0,
|
||||
'bid_opening_date' => strtotime($params['bid_opening_date']),
|
||||
'deposit_refund_time' => strtotime($params['deposit_refund_time']),
|
||||
'bidding_project_overview' => $params['bidding_project_overview'] ?? '',
|
||||
'project_introduction' => $params['project_introduction'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => $params['technical_review_annex'] ?? '',
|
||||
'business_review_total_amount' => $params['business_review_total_amount'] ?? 0,
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'pay_rate' => $params['pay_rate'] ?? '',
|
||||
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
|
||||
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
|
||||
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ?? '',
|
||||
]);
|
||||
BidDocumentExaminationDetail::where('bid_document_examination_id', $params['id'])->update(['delete_time' =>time()]);
|
||||
foreach ($params['product'] ?? [] as $item)
|
||||
{
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $params['id'],
|
||||
'product_id' => $item['product_id'] ?? 0,
|
||||
'product_num' => $item['product_num'] ?? 0,
|
||||
'cost_unit_price' => $item['cost_unit_price'] ?? 0,
|
||||
'amount' => $item['amount'] ?? '',
|
||||
'rate' => $item['rate'] ?? '',
|
||||
'unit_price' => $item['unit_price'] ?? 0,
|
||||
'total_amount' => $item['total_amount'] ?? 0
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除标书审查
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
BidDocumentExaminationDetail::where('bid_document_examination_id', $params['id'])->update(['delete_time' =>time()]);
|
||||
return BidDocumentExamination::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查详情
|
||||
* @param $params
|
||||
@ -162,11 +102,36 @@ class BidDocumentExaminationLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$bidDocumentExamination = BidDocumentExamination::findOrEmpty($params['id']);
|
||||
$bidDocumentExamination->document;
|
||||
$bidDocumentExamination->annex = json_decode($bidDocumentExamination->annex, true);
|
||||
$bidDocumentExamination->technical_review_annex = json_decode($bidDocumentExamination->technical_review_annex, true);
|
||||
$bidDocumentExamination->business_contract_deviation_annex = json_decode($bidDocumentExamination->business_contract_deviation_annex, true);
|
||||
return $bidDocumentExamination->toArray();
|
||||
$field = 'id,code,org_id,dept_id,project_id,buy_bidding_document_id,technical_protocol_deviation,protocol_deviation_handling_plan,technical_review_annex,tax_rate,pay_type,pay_rate,business_contract_deviation,business_contract_deviation_handling_plan,business_contract_deviation_annex';
|
||||
$data = BidDocumentExamination::field($field)->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
|
||||
$project = Project::field('custom_id,name')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_buy_doc = BidBuyBiddingDocument::field('bid_decision_id,bid_document_no,buyer,invite_tenders_company_name,bid_company_name,amount,buy_date,bid_address')->where('id',$data['buy_bidding_document_id'])->findOrEmpty();
|
||||
$buyer = Admin::field('name')->where('id',$bid_buy_doc['buyer'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date,margin_amount_return_date,bid_project_overview,project_desc,annex')->where('id',$bid_buy_doc['bid_decision_id'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_document_no'] = $bid_buy_doc['bid_document_no'];
|
||||
$data['buyer'] = $buyer['name'];
|
||||
$data['invite_tenders_company_name'] = $bid_buy_doc['invite_tenders_company_name'];
|
||||
$data['bid_company_name'] = $bid_buy_doc['bid_company_name'];
|
||||
$data['bid_document_amount'] = $bid_buy_doc['amount'];
|
||||
$data['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$data['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$data['buy_date'] = $bid_buy_doc['buy_date'];
|
||||
$data['bid_type'] = $bid_decision->bid_type_text;
|
||||
$data['bid_address'] = $bid_buy_doc['bid_address'];
|
||||
$data['is_margin'] = $bid_decision->is_margin_text;
|
||||
$data['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$data['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$data['margin_amount_return_date'] = $bid_decision['margin_amount_return_date'];
|
||||
$data['bid_project_overview'] = $bid_decision['bid_project_overview'];
|
||||
$data['project_desc'] = $bid_decision['project_desc'];
|
||||
$data['annex'] = $bid_decision['annex'];
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -42,7 +42,6 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
'project_estimation' => 'require|float|egt:0',
|
||||
'bidding_project_fund_source' => 'checkBiddingProjectFundSource',
|
||||
'bidding_time' => 'dateFormat:Y-m-d',
|
||||
'buy_bid_document_date' => 'dateFormat:Y-m-d',
|
||||
'bid_type' => 'checkBidType',
|
||||
'is_margin' => 'in:0,1',
|
||||
'margin_amount' => 'float|egt:0',
|
||||
@ -62,7 +61,6 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
'project_estimation.float' => '项目估算值必须是数字',
|
||||
'project_estimation.egt' => '项目估算值必须大于等于0',
|
||||
'bidding_time.dateFormat' => '投标时间数据格式错误',
|
||||
'buy_bid_document_date.dateFormat' => '购买标书时间数据格式错误',
|
||||
'is_margin.in' => '是否需要保证金选项值错误',
|
||||
'margin_amount.float' => '保证金金额值必须是数字',
|
||||
'margin_amount.egt' => '保证金金额值必须大于等于0',
|
||||
|
@ -16,6 +16,7 @@ namespace app\adminapi\validate\bid;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\dict\DictData;
|
||||
@ -40,18 +41,14 @@ class BidBuyBiddingDocumentValidate extends BaseValidate
|
||||
'org_id' => 'require|checkOrg',
|
||||
'dept_id' => 'require|checkDept',
|
||||
'project_id' => 'require|checkProject',
|
||||
'bid_decision_id' => 'require|checkBidDecision',
|
||||
'bid_document_no' => 'require',
|
||||
'invite_tenders_company_name' => 'require',
|
||||
'bid_company_name' => 'require',
|
||||
'buyer' => 'checkBuyer',
|
||||
'amount' => 'float|egt:0',
|
||||
'project_fund_source' => 'checkProjectFundSource',
|
||||
'bid_date' => 'dateFormat:Y-m-d',
|
||||
'buy_date' => 'dateFormat:Y-m-d',
|
||||
'invite_tenders_type' => 'checkInviteTendersType',
|
||||
'is_margin' => 'in:0,1',
|
||||
'margin_amount' => 'float|egt:0',
|
||||
'annex' => 'checkAnnex',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
@ -59,16 +56,13 @@ class BidBuyBiddingDocumentValidate extends BaseValidate
|
||||
'org_id.require' => '请选择组织',
|
||||
'dept_id.require' => '请选择部门',
|
||||
'project_id.require' => '请选择项目',
|
||||
'bid_decision_id.require' => '请选择投标决策',
|
||||
'bid_document_no.require' => '请填写标书编号',
|
||||
'invite_tenders_company_name.require' => '请填写招标公司名称',
|
||||
'bid_company_name.require' => '请填写投标公司名称',
|
||||
'amount.float' => '购买标书金额值必须是数字',
|
||||
'amount.egt' => '购买标书金额值必须大于等于0',
|
||||
'bid_date.dateFormat' => '投标时间数据格式错误',
|
||||
'buy_date.dateFormat' => '购买标书时间数据格式错误',
|
||||
'is_margin.in' => '是否需要保证金选项数据错误',
|
||||
'margin_amount.float' => '保证金金额值必须是数字',
|
||||
'margin_amount.egt' => '保证金金额值必须大于等于0',
|
||||
];
|
||||
|
||||
|
||||
@ -147,6 +141,18 @@ class BidBuyBiddingDocumentValidate extends BaseValidate
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkBidDecision($value,$rule,$data): bool|string
|
||||
{
|
||||
$bid_decision = BidBiddingDecision::where('id',$value)->findOrEmpty();
|
||||
if($bid_decision->isEmpty()){
|
||||
return '投标决策信息不存在';
|
||||
}
|
||||
if($bid_decision['project_id'] != $data['project_id']){
|
||||
return '投标决策信息无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkBuyer($value): bool|string
|
||||
{
|
||||
$admin = Admin::where('id',$value)->findOrEmpty();
|
||||
@ -155,34 +161,5 @@ class BidBuyBiddingDocumentValidate extends BaseValidate
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkProjectFundSource($value): bool|string
|
||||
{
|
||||
$dictData = DictData::where('type_value','construction_funds_sources')->column('value');
|
||||
if(!in_array($value,$dictData)){
|
||||
return '招标项目资金来源无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkInviteTendersType($value): bool|string
|
||||
{
|
||||
$dictData = DictData::where('type_value','bidding_method')->column('value');
|
||||
if(!in_array($value,$dictData)){
|
||||
return '招标方式无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkAnnex($value): bool|string
|
||||
{
|
||||
if(!empty($value) && $value != ''){
|
||||
$annex = json_decode($value,true);
|
||||
if(empty($annex) || !is_array($annex)){
|
||||
return '附件格式错误';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -15,6 +15,11 @@
|
||||
namespace app\adminapi\validate\bid;
|
||||
|
||||
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\material\Material;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
@ -32,19 +37,23 @@ class BidDocumentExaminationValidate extends BaseValidate
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
// 'approve_id' => 'require',
|
||||
'buy_bidding_document_id' => 'require',
|
||||
'product' => 'array|checkProduct',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'org_id' => 'require|checkOrg',
|
||||
'dept_id' => 'require|checkDept',
|
||||
'buy_bidding_document_id' => 'require|checkBuyBiddingDocument',
|
||||
'technical_review_annex' => 'checkAnnex',
|
||||
'business_contract_deviation_annex' => 'checkAnnex',
|
||||
'tax_rate' => 'checkTaxRate',
|
||||
'pay_type' => 'checkPayType',
|
||||
'quotation_detail' => 'checkQuotationDetail',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '缺少必要参数',
|
||||
'org_id.require' => '请选择组织',
|
||||
'dept_id.require' => '请选择部门',
|
||||
'buy_bidding_document_id.require' => '请选择标书编号',
|
||||
'quotation_detail' => 'checkQuotationDetail',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
@ -66,9 +75,7 @@ class BidDocumentExaminationValidate extends BaseValidate
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'buy_bidding_document_id', 'product']);
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
@ -93,36 +100,111 @@ class BidDocumentExaminationValidate extends BaseValidate
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkProduct($value, $rule, $data)
|
||||
{
|
||||
$firstData = $value[0] ?? [];
|
||||
if (empty($firstData)) {
|
||||
return true;
|
||||
} else {
|
||||
if (empty($firstData['product_id'])) {
|
||||
return '产品ID不能为空!';
|
||||
}
|
||||
if (empty($firstData['product_num'])) {
|
||||
return '产品数量不能为空!';
|
||||
}
|
||||
if (empty($firstData['cost_unit_price'])) {
|
||||
return '成本单价不能为空!';
|
||||
}
|
||||
if (empty($firstData['amount'])) {
|
||||
return '金额不能为空!';
|
||||
}
|
||||
if (empty($firstData['rate'])) {
|
||||
return '点数不能为空!';
|
||||
}
|
||||
if (empty($firstData['unit_price'])) {
|
||||
return '报价单价不能为空!';
|
||||
}
|
||||
if (empty($firstData['total_amount'])) {
|
||||
return '报价金额不能为空!';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkOrg($value): bool|string
|
||||
{
|
||||
$org = Orgs::where('id',$value)->findOrEmpty();
|
||||
if($org->isEmpty()){
|
||||
return '组织不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkDept($value,$rule,$data): bool|string
|
||||
{
|
||||
$dept = Dept::where('id',$value)->findOrEmpty();
|
||||
if($dept->isEmpty()){
|
||||
return '部门不存在';
|
||||
}
|
||||
if($dept['org_id'] != $data['org_id']){
|
||||
return '部门无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkBuyBiddingDocument($value): bool|string
|
||||
{
|
||||
$data = BidBuyBiddingDocument::where('id',$value)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return '标书信息不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkAnnex($value): bool|string
|
||||
{
|
||||
if(!empty($value) && $value != ''){
|
||||
$annex = json_decode($value,true);
|
||||
if(empty($annex) || !is_array($annex)){
|
||||
return '附件格式错误';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkTaxRate($value): bool|string
|
||||
{
|
||||
$dictDate = DictData::where('type_value','tax_rate')->column('value');
|
||||
if(!in_array($value,$dictDate)){
|
||||
return '税率无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkPayType($value): bool|string
|
||||
{
|
||||
$dictDate = DictData::where('type_value','pay_type')->column('value');
|
||||
if(!in_array($value,$dictDate)){
|
||||
return '付款方式无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkQuotationDetail($value,$rule,$data): bool|string
|
||||
{
|
||||
$quotation_detail = json_decode($value,true);
|
||||
if(empty($quotation_detail) || !is_array($quotation_detail)){
|
||||
return '审查明细数据格式错误';
|
||||
}
|
||||
foreach($quotation_detail as $v) {
|
||||
if(empty($v['product_id'])){
|
||||
return '请选择产品';
|
||||
}else{
|
||||
$product = Material::where('id',$v['product_id'])->findOrEmpty();
|
||||
if($product->isEmpty()){
|
||||
return '产品信息不存在';
|
||||
}
|
||||
}
|
||||
if(empty($v['num'])){
|
||||
return '数量不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['num']) || $v['num'] < 0){
|
||||
return '数量必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
if(empty($v['cost_price'])){
|
||||
return '成本单价不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['cost_price']) || $v['cost_price'] < 0){
|
||||
return '成本单价必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
if(empty($v['sale_price'])){
|
||||
return '报价单价不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['sale_price']) || $v['sale_price'] < 0){
|
||||
return '报价单价必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
if(empty($v['points'])){
|
||||
return '点数不能为空';
|
||||
}else{
|
||||
if(!is_numeric($v['points']) || $v['points'] < 0){
|
||||
return '点数必须是大于0的数字';
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -36,11 +36,6 @@ class BidBiddingDecision extends BaseModel
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
public function getBuyBidDocumentDateAttr($value): string
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
public function getBidOpeningDateAttr($value): string
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
|
@ -30,36 +30,9 @@ class BidBuyBiddingDocument extends BaseModel
|
||||
use SoftDelete;
|
||||
protected $name = 'bid_buy_bidding_document';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getAnnexAttr($value)
|
||||
{
|
||||
return empty($value) ? null : json_decode($value,true);
|
||||
}
|
||||
|
||||
public function getBidDateAttr($value): string
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
public function getBuyDateAttr($value): string
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
public function getIsMarginTextAttr($value,$data): string
|
||||
{
|
||||
$is_margin = [0=>'否', 1=>'是'];
|
||||
return $is_margin[$data['is_margin']];
|
||||
}
|
||||
|
||||
public function getProjectFundSourceTextAttr($value,$data){
|
||||
$dictData = DictData::where('type_value','construction_funds_sources')->column('name','value');
|
||||
return $dictData[$data['project_fund_source']];
|
||||
}
|
||||
|
||||
public function getInviteTendersTypeTextAttr($value,$data){
|
||||
$dictData = DictData::where('type_value','bidding_method')->column('name','value');
|
||||
return $dictData[$data['invite_tenders_type']];
|
||||
}
|
||||
|
||||
}
|
@ -16,6 +16,7 @@ namespace app\common\model\bid;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\dict\DictData;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
@ -29,20 +30,23 @@ class BidDocumentExamination extends BaseModel
|
||||
use SoftDelete;
|
||||
protected $name = 'bid_document_examination';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function document()
|
||||
{
|
||||
return $this->belongsTo(\app\common\model\bid\BidBuyBiddingDocument::class, 'buy_bidding_document_id');
|
||||
}
|
||||
|
||||
public function getBidOpeningDateAttr($value)
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
public function getDepositRefundTimeAttr($value)
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
public function getTechnicalReviewAnnexAttr($value){
|
||||
return !empty($value) ? json_decode($value) : '';
|
||||
}
|
||||
|
||||
public function getBusinessContractDeviationAnnexAttr($value){
|
||||
return !empty($value) ? json_decode($value) : '';
|
||||
}
|
||||
|
||||
public function getTaxRateTextAttr($value,$data){
|
||||
$dictDate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
return $dictDate[$data['tax_rate']];
|
||||
}
|
||||
|
||||
public function getPayTypeTextAttr($value,$data){
|
||||
$dictDate = DictData::where('type_value','pay_type')->column('name','value');
|
||||
return $dictDate[$data['pay_type']];
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user