This commit is contained in:
weiz 2024-02-19 16:59:01 +08:00
parent 1f940dd8fa
commit b0da07a99b
6 changed files with 154 additions and 8 deletions

View File

@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\bid\BidSecurityApplyLists;
use app\adminapi\logic\bid\BidSecurityApplyLogic;
use app\adminapi\validate\bid\BidSecurityApplyValidate;
use app\common\model\oa\Flow;
use app\common\model\oa\FlowType;
/**
@ -103,6 +105,24 @@ class BidSecurityApplyController extends BaseAdminController
$result = BidSecurityApplyLogic::detail($params);
return $this->data($result);
}
public function flows(): \think\response\Json
{
$flow_type = FlowType::where('type',3)->where('name','tbbzj')->findOrEmpty();
$data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select();
return $this->success('请求成功',$data->toArray());
}
//添加审批
public function approve(): \think\response\Json
{
$params = (new BidSecurityApplyValidate())->post()->goCheck('approve');
$result = BidSecurityApplyLogic::approve($params,$this->adminId);
if (true === $result) {
return $this->success('提交审核信息成功', [], 1, 1);
}
return $this->fail(BidSecurityApplyLogic::getError());
}
}

View File

@ -20,6 +20,8 @@ use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\bid\BidSecurityRefundLists;
use app\adminapi\logic\bid\BidSecurityRefundLogic;
use app\adminapi\validate\bid\BidSecurityRefundValidate;
use app\common\model\oa\Flow;
use app\common\model\oa\FlowType;
/**
@ -103,6 +105,24 @@ class BidSecurityRefundController extends BaseAdminController
$result = BidSecurityRefundLogic::detail($params);
return $this->data($result);
}
public function flows(): \think\response\Json
{
$flow_type = FlowType::where('type',3)->where('name','ttbbzj')->findOrEmpty();
$data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select();
return $this->success('请求成功',$data->toArray());
}
//添加审批
public function approve(): \think\response\Json
{
$params = (new BidSecurityRefundValidate())->post()->goCheck('approve');
$result = BidSecurityRefundLogic::approve($params,$this->adminId);
if (true === $result) {
return $this->success('提交审核信息成功', [], 1, 1);
}
return $this->fail(BidSecurityRefundLogic::getError());
}
}

View File

@ -17,6 +17,7 @@ namespace app\adminapi\logic\bid;
use app\common\model\bid\BidBiddingDecision;
use app\common\model\bid\BidSecurityApply;
use app\common\model\oa\FlowApprove;
use app\common\model\project\Project;
use app\common\model\custom\Custom;
use app\common\logic\BaseLogic;
@ -124,7 +125,7 @@ class BidSecurityApplyLogic extends BaseLogic
*/
public static function detail($params): array
{
$data = BidSecurityApply::field('id,security_apply_code,project_id,bidding_decision_id,applier,pay_type,refund_date,remark,annex,deposit_bank,account_name,account')
$data = BidSecurityApply::field('id,security_apply_code,project_id,bidding_decision_id,applier,pay_type,refund_date,remark,annex,deposit_bank,account_name,account,approve_id')
->findOrEmpty($params['id']);
$bidding_decision = BidBiddingDecision::field('code,margin_amount,bidding_time')->where('id',$data['bidding_decision_id'])->findOrEmpty();
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
@ -137,6 +138,39 @@ class BidSecurityApplyLogic extends BaseLogic
$data['margin_amount'] = $bidding_decision['margin_amount'];
$data['bidding_time'] = $bidding_decision['bidding_time'];
$data['payment_account_info'] = [];
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
$data['approve_check_status'] = $approve_data['check_status'];
return $data->toArray();
}
public static function approve($params,$admin_id): bool{
$data = BidSecurityApply::where('id',$params['id'])->findOrEmpty();
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
self::setError('当前内容存在审核信息,请勿重复提交');
return false;
}
Db::startTrans();
try {
$res = addApprove(
'投标保证金',
$params['id'],
'app\common\model\bid\BidSecurityApply',
$params['path'],
$params['flow_id'],
$admin_id
);
if($res){
BidSecurityApply::where('id',$params['id'])->update([
'approve_id' => $res,
]);
}
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
}

View File

@ -20,6 +20,7 @@ use app\common\model\bid\BidBiddingDecision;
use app\common\model\bid\BidSecurityApply;
use app\common\model\bid\BidSecurityRefund;
use app\common\logic\BaseLogic;
use app\common\model\oa\FlowApprove;
use app\common\model\project\Project;
use app\common\model\custom\Custom;
use think\facade\Db;
@ -119,7 +120,7 @@ class BidSecurityRefundLogic extends BaseLogic
*/
public static function detail($params): array
{
$data = BidSecurityRefund::field('id,project_id,bid_security_apply_id,refund_amount,refund_date,remark,annex,bank_account_id')->findOrEmpty($params['id']);
$data = BidSecurityRefund::field('id,project_id,bid_security_apply_id,refund_amount,refund_date,remark,annex,bank_account_id,approve_id')->findOrEmpty($params['id']);
$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,deposit_bank,account_name,account')->where('id',$data['bid_security_apply_id'])->findOrEmpty();
@ -133,6 +134,39 @@ class BidSecurityRefundLogic extends BaseLogic
$data['account_name'] = $bid_security_apply['account_name'];
$data['account'] = $bid_security_apply['account'];
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
$data['approve_check_status'] = $approve_data['check_status'];
return $data->toArray();
}
public static function approve($params,$admin_id): bool{
$data = BidSecurityRefund::where('id',$params['id'])->findOrEmpty();
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
self::setError('当前内容存在审核信息,请勿重复提交');
return false;
}
Db::startTrans();
try {
$res = addApprove(
'退投标保证金',
$params['id'],
'app\common\model\bid\BidSecurityRefund',
$params['path'],
$params['flow_id'],
$admin_id
);
if($res){
BidSecurityRefund::where('id',$params['id'])->update([
'approve_id' => $res,
]);
}
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
}

View File

@ -16,6 +16,7 @@ namespace app\adminapi\validate\bid;
use app\common\model\bid\BidBiddingDecision;
use app\common\model\bid\BidSecurityApply;
use app\common\model\dict\DictData;
use app\common\validate\BaseValidate;
@ -33,7 +34,7 @@ class BidSecurityApplyValidate extends BaseValidate
* @var string[]
*/
protected $rule = [
'id' => 'require',
'id' => 'require|checkData',
'bidding_decision_id' => 'require|checkBiddingDecision',
'applier' => 'require',
'pay_type' => 'require|checkPayType',
@ -42,6 +43,8 @@ class BidSecurityApplyValidate extends BaseValidate
'deposit_bank' => 'require',
'account_name' => 'require',
'account' => 'require',
'flow_id' => 'require|checkFlow',
'path' => 'require',
];
@ -69,7 +72,7 @@ class BidSecurityApplyValidate extends BaseValidate
*/
public function sceneAdd()
{
return $this->remove('id',true);
return $this->remove('id',true)->remove('flow_id',true)->remove('path',true);
}
@ -80,7 +83,9 @@ class BidSecurityApplyValidate extends BaseValidate
* @date 2023/12/16 10:46
*/
public function sceneEdit()
{}
{
return $this->remove('flow_id',true)->remove('path',true);
}
/**
@ -106,6 +111,20 @@ class BidSecurityApplyValidate extends BaseValidate
return $this->only(['id']);
}
public function sceneApprove()
{
return $this->only(['id','flow_id','path']);
}
public function checkData($value): bool|string
{
$data = BidSecurityApply::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkBiddingDecision($value): bool|string
{
$data = BidBiddingDecision::where('id',$value)->findOrEmpty();

View File

@ -17,6 +17,7 @@ namespace app\adminapi\validate\bid;
use app\common\model\bank\BankAccount;
use app\common\model\bid\BidSecurityApply;
use app\common\model\bid\BidSecurityRefund;
use app\common\validate\BaseValidate;
@ -33,12 +34,14 @@ class BidSecurityRefundValidate extends BaseValidate
* @var string[]
*/
protected $rule = [
'id' => 'require',
'id' => 'require|checkData',
'bid_security_apply_id' => 'require|checkBidSecurityApply',
'refund_amount' => 'require|float|egt:0',
'refund_date' => 'require|dateFormat:Y-m-d',
'annex' => 'checkAnnex',
'bank_account_id' => 'require|checkBankAccount',
'flow_id' => 'require|checkFlow',
'path' => 'require',
];
@ -63,7 +66,7 @@ class BidSecurityRefundValidate extends BaseValidate
*/
public function sceneAdd()
{
return $this->remove('id',true);
return $this->remove('id',true)->remove('flow_id',true)->remove('path',true);
}
@ -74,7 +77,9 @@ class BidSecurityRefundValidate extends BaseValidate
* @date 2023/12/18 10:29
*/
public function sceneEdit()
{}
{
return $this->remove('flow_id',true)->remove('path',true);
}
/**
@ -100,6 +105,20 @@ class BidSecurityRefundValidate extends BaseValidate
return $this->only(['id']);
}
public function sceneApprove()
{
return $this->only(['id','flow_id','path']);
}
public function checkData($value): bool|string
{
$data = BidSecurityRefund::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkBidSecurityApply($value): bool|string
{
$data = BidSecurityApply::where('id',$value)->findOrEmpty();