This commit is contained in:
weiz 2024-02-19 14:30:52 +08:00
parent a56c8537d9
commit 4049eae84a
3 changed files with 30 additions and 19 deletions

View File

@ -98,7 +98,7 @@ class BidDocumentExaminationLogic extends BaseLogic
*/
public static function detail($params): array
{
$field = 'id,code,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';
$field = 'id,code,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,approve_id';
$data = BidDocumentExamination::field($field)->findOrEmpty($params['id']);
$project = Project::field('custom_id,name')->where('id',$data['project_id'])->findOrEmpty();
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
@ -124,26 +124,35 @@ class BidDocumentExaminationLogic extends BaseLogic
$data['project_desc'] = $bid_decision['project_desc'];
$data['annex'] = $bid_decision['annex'];
$data['total_amount'] = BidDocumentExaminationDetail::where('bid_document_examination_id',$data['id'])->sum('sale_amount');
$approve_info = FlowApprove::field('id,check_status')->where('content_id',$params['id'])
->where('content_model','app\common\model\bid\BidDocumentExamination')
->where('content_id',$params['id'])->order('id desc')->findOrEmpty();
$data['approve_id'] = $approve_info['id'];
$data['approve_check_status'] = $approve_info['check_status'];
return $data->toArray();
}
public static function approve($params,$admin_id): bool{
$res = addApprove(
'标书审查',
$params['id'],
'app\common\model\bid\BidDocumentExamination',
$params['path'],
$params['flow_id'],
$admin_id
);
if($res){
$data = BidDocumentExamination::where('id',$params['id'])->findOrEmpty();
if(!empty($data['approve_id'])){
self::setError('当前内容存在审核信息,请勿重复提交');
return false;
}
Db::startTrans();
try {
$res = addApprove(
'标书审查',
$params['id'],
'app\common\model\bid\BidDocumentExamination',
$params['path'],
$params['flow_id'],
$admin_id
);
if($res){
BidDocumentExamination::where('id',$params['id'])->update([
'approve_id' => $res,
]);
}
Db::commit();
return true;
}else{
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}

View File

@ -104,6 +104,9 @@ class FlowApproveLogic extends BaseLogic
'content' => $params['revoke_reason'],
'is_invalid' => 0
]);
$approve_data['content_model']::where('id',$approve_data['content_id'])->update([
'approve_id' => 0
]);
Db::commit();
return true;
} catch (\Exception $e) {

View File

@ -360,7 +360,7 @@ function daysBetweenDates($start_date,$end_date): bool|int
return $interval->days;
}
function addApprove($title,$content_id,$content_model,$path,$flow_id,$create_user_id): bool
function addApprove($title,$content_id,$content_model,$path,$flow_id,$create_user_id)
{
$createUser = Admin::field('name,dept_id')->where('id',$create_user_id)->findOrEmpty();
//获取审批流程信息
@ -412,10 +412,9 @@ function addApprove($title,$content_id,$content_model,$path,$flow_id,$create_use
'is_invalid' => 0
]);
Db::commit();
return true;
return $approveRes->id;
} catch (\Exception $e) {
Db::rollback();
dump($e->getMessage());
return false;
}
}