update
This commit is contained in:
parent
7d192d0056
commit
faa0f56b27
@ -4,6 +4,9 @@
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\bid\BidResult;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\custom\CustomerDemand;
|
||||
use app\common\model\custom\CustomerDemandSolution;
|
||||
@ -81,6 +84,16 @@
|
||||
public function bidding() {
|
||||
//投标决策
|
||||
$decision = BidBiddingDecision::field('id')->count();
|
||||
halt($decision);
|
||||
//购买标书
|
||||
$document = BidBuyBiddingDocument::field('id')->count();
|
||||
//标书审查
|
||||
$examination = BidDocumentExamination::field('id')->count();
|
||||
//中标项目
|
||||
$successful = BidResult::field('id')->where('is_successful',1)->count();
|
||||
//中标率
|
||||
$bidding_rate = number_format($successful / $decision,2);
|
||||
//总的投标保证金金额
|
||||
$total_margin_amount = BidBiddingDecision::where('is_margin',1)->sum('margin_amount');
|
||||
halt($bidding_rate,$total_margin_amount);
|
||||
}
|
||||
}
|
@ -18,8 +18,6 @@ namespace app\adminapi\logic\bid;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -46,8 +44,6 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
try {
|
||||
BidBiddingDecision::create([
|
||||
'code' => data_unique_code('投标决策'),
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'project_estimation' => $params['project_estimation'],
|
||||
'bidding_project_fund_source' => $params['bidding_project_fund_source'] ?? 0,
|
||||
@ -90,8 +86,6 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidBiddingDecision::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'project_estimation' => $params['project_estimation'],
|
||||
'bidding_project_fund_source' => $params['bidding_project_fund_source'] ?? 0,
|
||||
@ -142,12 +136,8 @@ class BidBiddingDecisionLogic extends BaseLogic
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidBiddingDecision::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();
|
||||
$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'];
|
||||
|
@ -36,8 +36,6 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'org_id' => 'require|checkOrg',
|
||||
'dept_id' => 'require|checkDept',
|
||||
'project_id' => 'require|checkProject',
|
||||
'project_estimation' => 'require|float|egt:0',
|
||||
'bidding_project_fund_source' => 'checkBiddingProjectFundSource',
|
||||
@ -54,8 +52,6 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '缺少必要参数',
|
||||
'org_id.require' => '请选择组织',
|
||||
'dept_id.require' => '请选择部门',
|
||||
'project_id.require' => '请选择项目',
|
||||
'project_estimation.require' => '请填写项目估算',
|
||||
'project_estimation.float' => '项目估算值必须是数字',
|
||||
@ -117,27 +113,6 @@ class BidBiddingDecisionValidate extends BaseValidate
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
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 checkProject($value): bool|string
|
||||
{
|
||||
$project = Project::where('id',$value)->findOrEmpty();
|
||||
|
Loading…
x
Reference in New Issue
Block a user