Commit a0e1ef8d by 杨树贤

天眼查校验提前

parent 0a76ff65
...@@ -161,7 +161,6 @@ class SupplierService ...@@ -161,7 +161,6 @@ class SupplierService
//添加附件 //添加附件
SupplierAttachmentService::addAttachmentFromAddPage($supplierId, $attachmentData); SupplierAttachmentService::addAttachmentFromAddPage($supplierId, $attachmentData);
} }
//添加银行信息,也是有填一个表单域也要新增,排除receipt_type字段,因为这个肯定有的 //添加银行信息,也是有填一个表单域也要新增,排除receipt_type字段,因为这个肯定有的
if (!checkArrayAllValueNull($receiptData, ['receipt_type'])) { if (!checkArrayAllValueNull($receiptData, ['receipt_type'])) {
$receiptData['supplier_id'] = $supplierId; $receiptData['supplier_id'] = $supplierId;
......
...@@ -19,6 +19,19 @@ class SupplierValidator ...@@ -19,6 +19,19 @@ class SupplierValidator
{ {
//整理下请求数据 //整理下请求数据
$validateData = $this->transformRequestData($validateData); $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是用来判断是新增还是修改的
$supplierId = array_get($validateData, 'supplier_id'); $supplierId = array_get($validateData, 'supplier_id');
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称和采购员是否完整即可 //如果是修改直接提交,不是点申请审核的,只需要校验供应商名称和采购员是否完整即可
...@@ -101,18 +114,20 @@ class SupplierValidator ...@@ -101,18 +114,20 @@ class SupplierValidator
* 供应商类型为代理商的,需要上传代理证才能成为正式供应商,没有上传代理证的只能为临时供应商。 * 供应商类型为代理商的,需要上传代理证才能成为正式供应商,没有上传代理证的只能为临时供应商。
* 非国内的供应商,商业登记证不能为空 * 非国内的供应商,商业登记证不能为空
**/ **/
//只有在提交供应商是正式的时候,才会去校验附件 //只有在提交供应商是正式的时候,才会去校验附件
//校验附件这块,新增和修改判断的逻辑不一样 //校验附件这块,新增和修改判断的逻辑不一样
if (empty($supplierId)) { if (empty($supplierId)) {
$attachmentFields = array_unique($validateData['field_name']); $attachmentFields = array_unique(array_get($validateData, 'field_name', []));
} else { } else {
$attachmentFields = SupplierAttachmentsModel::where('supplier_id', $attachmentFields = SupplierAttachmentsModel::where('supplier_id',
$supplierId)->get()->pluck('field_name')->toArray(); $supplierId)->get()->pluck('field_name')->toArray();
} }
if (!$attachmentFields) { if (!$attachmentFields) {
$errorMessageList[] = '请上传附件'; $errorMessageList[] = '请上传附件';
} } else {
$attachmentFields = array_unique($attachmentFields); $attachmentFields = array_unique($attachmentFields);
//fixed.php FileNameMapping 可以知道所有对应关系 //fixed.php FileNameMapping 可以知道所有对应关系
if (!in_array('business_license', $attachmentFields)) { if (!in_array('business_license', $attachmentFields)) {
...@@ -163,6 +178,9 @@ class SupplierValidator ...@@ -163,6 +178,9 @@ class SupplierValidator
} }
} }
}
//银行信息校验 //银行信息校验
$receiptValidator = new ReceiptValidator(); $receiptValidator = new ReceiptValidator();
if (empty($supplierId)) { if (empty($supplierId)) {
...@@ -262,16 +280,7 @@ class SupplierValidator ...@@ -262,16 +280,7 @@ class SupplierValidator
$errorMessageList[] = "存在和你相关的联系人没有完善,请先去完善相关联系人"; $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); return implode('|', $errorMessageList);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment