Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a0e1ef8d
authored
Jun 29, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
天眼查校验提前
parent
0a76ff65
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
app/Http/Services/SupplierService.php
app/Http/Validators/SupplierValidator.php
app/Http/Services/SupplierService.php
View file @
a0e1ef8d
...
...
@@ -161,7 +161,6 @@ class SupplierService
//添加附件
SupplierAttachmentService
::
addAttachmentFromAddPage
(
$supplierId
,
$attachmentData
);
}
//添加银行信息,也是有填一个表单域也要新增,排除receipt_type字段,因为这个肯定有的
if
(
!
checkArrayAllValueNull
(
$receiptData
,
[
'receipt_type'
]))
{
$receiptData
[
'supplier_id'
]
=
$supplierId
;
...
...
app/Http/Validators/SupplierValidator.php
View file @
a0e1ef8d
...
...
@@ -19,6 +19,19 @@ class SupplierValidator
{
//整理下请求数据
$validateData
=
$this
->
transformRequestData
(
$validateData
);
//这个要优先判断
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
{
$regionType
=
$validateData
[
'region'
]
==
2
?
1
:
2
;
//还要校验提交上来的公司是否有合法信息
$companyInfo
=
(
new
CompanyService
())
->
getCompanyInfo
(
$validateData
[
'supplier_name'
],
$validateData
[
'tax_number'
],
$regionType
);
if
(
empty
(
$companyInfo
))
{
return
'公司未进行工商注册,请修改后重新提交'
;
}
}
//这个supplierId是用来判断是新增还是修改的
$supplierId
=
array_get
(
$validateData
,
'supplier_id'
);
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称和采购员是否完整即可
...
...
@@ -101,18 +114,20 @@ class SupplierValidator
* 供应商类型为代理商的,需要上传代理证才能成为正式供应商,没有上传代理证的只能为临时供应商。
* 非国内的供应商,商业登记证不能为空
**/
//只有在提交供应商是正式的时候,才会去校验附件
//校验附件这块,新增和修改判断的逻辑不一样
if
(
empty
(
$supplierId
))
{
$attachmentFields
=
array_unique
(
$validateData
[
'field_name'
]
);
$attachmentFields
=
array_unique
(
array_get
(
$validateData
,
'field_name'
,
[])
);
}
else
{
$attachmentFields
=
SupplierAttachmentsModel
::
where
(
'supplier_id'
,
$supplierId
)
->
get
()
->
pluck
(
'field_name'
)
->
toArray
();
}
if
(
!
$attachmentFields
)
{
$errorMessageList
[]
=
'请上传附件'
;
}
}
else
{
$attachmentFields
=
array_unique
(
$attachmentFields
);
//fixed.php FileNameMapping 可以知道所有对应关系
if
(
!
in_array
(
'business_license'
,
$attachmentFields
))
{
...
...
@@ -163,6 +178,9 @@ class SupplierValidator
}
}
}
//银行信息校验
$receiptValidator
=
new
ReceiptValidator
();
if
(
empty
(
$supplierId
))
{
...
...
@@ -262,16 +280,7 @@ class SupplierValidator
$errorMessageList
[]
=
"存在和你相关的联系人没有完善,请先去完善相关联系人"
;
}
}
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
{
$regionType
=
$validateData
[
'region'
]
==
2
?
1
:
2
;
//还要校验提交上来的公司是否有合法信息
$companyInfo
=
(
new
CompanyService
())
->
getCompanyInfo
(
$validateData
[
'supplier_name'
],
$validateData
[
'tax_number'
],
$regionType
);
if
(
empty
(
$companyInfo
))
{
$errorMessageList
[]
=
'公司未进行工商注册,请修改后重新提交'
;
}
}
return
implode
(
'|'
,
$errorMessageList
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment