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
edad517f
authored
Jul 01, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改限制
parent
6a8a14a7
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
49 additions
and
23 deletions
app/Http/Controllers/Api/CommonApiController.php
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SyncSupplierService.php
app/Http/Transformers/SupplierTransformer.php
app/Http/Validators/SupplierValidator.php
app/Model/SupplierChannelModel.php
config/field.php
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/web/AddSupplier.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Controllers/Api/CommonApiController.php
View file @
edad517f
...
...
@@ -7,6 +7,7 @@ use App\Http\Services\AdminUserService;
use
App\Http\Services\CompanyService
;
use
App\Model\BrandModel
;
use
App\Model\StandardBrandModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Http\Request
;
use
GuzzleHttp\Client
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -73,11 +74,17 @@ class CommonApiController extends Controller
$supplierName
=
$request
->
get
(
'supplier_name'
);
$taxNumber
=
$request
->
get
(
'tax_number'
);
$region
=
$request
->
get
(
'region'
);
$regionType
=
$region
==
2
?
1
:
2
;
$company
=
[];
if
(
in_array
(
$region
,
config
(
'field.NeedCheckCompanyRegion'
)))
{
$regionType
=
$region
==
SupplierChannelModel
::
REGION_CN
?
1
:
2
;
$company
=
(
new
CompanyService
())
->
getCompanyInfo
(
$supplierName
,
$taxNumber
,
$regionType
);
if
(
!
$company
)
{
$this
->
response
(
-
1
,
'获取不到公司'
);
}
}
else
{
$this
->
response
(
-
3
,
'供应商跳过天眼查校验'
);
}
$this
->
response
(
0
,
'ok'
,
$company
);
}
...
...
app/Http/Controllers/Api/SupplierApiController.php
View file @
edad517f
...
...
@@ -295,7 +295,7 @@ class SupplierApiController extends Controller
//如果是编辑操作,则要忽略非当前
if
(
$supplierId
)
{
if
(
in_array
(
$supplierId
,
[
195
,
12263
]
))
{
if
(
in_array
(
$supplierId
,
config
(
'field.NeedSkipSupplierNameCheckIds'
)
))
{
$this
->
response
(
0
,
'供应商名称合理'
);
}
$originSupplierName
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'supplier_name'
);
...
...
@@ -312,20 +312,21 @@ class SupplierApiController extends Controller
->
value
(
'supplier_name'
);
if
(
$existedSupplierName
)
{
$this
->
response
(
-
1
,
'供应商已存在,请重新输入或者咨询审批人'
);
}
else
{
// $supplierName = $model->where('supplier_name', 'like',
// "%$supplierName%")->limit(1)->value('supplier_name');
// if (!empty($supplierName)) {
// $this->response(-2, '存在类似的供应商名称', $supplierName);
// }
}
}
$regionType
=
$region
==
2
?
1
:
2
;
$company
=
[];
//判断用户选的地区是不是需要校验的,不需要直接返回即可
if
(
in_array
(
$region
,
config
(
'field.NeedCheckCompanyRegion'
)))
{
$regionType
=
$region
==
SupplierChannelModel
::
REGION_CN
?
1
:
2
;
//还要去请求天眼查获取资料
$company
=
(
new
CompanyService
())
->
getCompanyInfo
(
$supplierName
,
$taxNumber
,
$regionType
);
if
(
!
$company
)
{
$this
->
response
(
-
2
,
'公司未进行工商注册,请修改后重新提交'
);
}
}
else
{
$this
->
response
(
-
3
,
'供应商跳过天眼查校验'
);
}
$this
->
response
(
0
,
'供应商名称合理'
,
$company
);
}
...
...
@@ -446,7 +447,7 @@ class SupplierApiController extends Controller
$supplierId
=
$request
->
get
(
'supplier_id'
);
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
if
(
in_array
(
$supplier
[
'supplier_name'
],
config
(
'field.SkipChangeSupplierTypeNames'
)))
{
if
(
in_array
(
$supplier
[
'supplier_name'
],
config
(
'field.SkipChangeSupplierTypeNames'
)))
{
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToUnited
(
$supplierId
);
...
...
@@ -455,14 +456,14 @@ class SupplierApiController extends Controller
//去调取天眼查数据,有数据的话,更新
$companyInfo
=
(
new
CompanyService
())
->
getCompanyInfo
(
$supplier
[
'supplier_name'
],
''
);
//先判断是否是标准添加,如果标准添加,国内地区,但是没有税号的,不允许同步
if
(
$supplier
[
'is_standard_add'
]
==
1
&&
$supplier
[
'region'
]
==
2
&&
!
$supplier
[
'tax_number'
]
&&
$companyInfo
)
{
if
(
$supplier
[
'is_standard_add'
]
==
1
&&
$supplier
[
'region'
]
==
SupplierChannelModel
::
REGION_CN
&&
!
$supplier
[
'tax_number'
]
&&
$companyInfo
)
{
$taxNumber
=
$companyInfo
[
'tax_number'
];
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'tax_number'
=>
$taxNumber
,
]);
// $this->response(-1, '该供应商属于国内,但是没有税号,不允许同步');
}
if
(
$supplier
[
'is_standard_add'
]
==
1
&&
$supplier
[
'region'
]
!=
2
)
{
if
(
$supplier
[
'is_standard_add'
]
==
1
&&
$supplier
[
'region'
]
!=
SupplierChannelModel
::
REGION_CN
)
{
// if (empty($companyInfo)) {
// $this->response(-1, '该供应商属于海外,但是无法查询公司信息,不允许同步');
// }
...
...
app/Http/Services/SupplierAuditService.php
View file @
edad517f
...
...
@@ -82,7 +82,7 @@ class SupplierAuditService
if
(
$status
==
SupplierChannelModel
::
STATUS_PASSED
)
{
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
{
//判断有公司信息才允许同步给一体化
$regionType
=
$supplier
[
'region'
]
==
2
?
1
:
2
;
$regionType
=
$supplier
[
'region'
]
==
SupplierChannelModel
::
REGION_CN
?
1
:
2
;
if
(
$regionType
==
2
)
{
(
new
SyncSupplierService
())
->
syncSupplierToUnited
(
$supplierId
);
}
else
{
...
...
app/Http/Services/SyncSupplierService.php
View file @
edad517f
...
...
@@ -130,7 +130,7 @@ class SyncSupplierService
'company_name'
=>
$supplier
[
'supplier_name'
],
'company_tax_no'
=>
$supplier
[
'tax_number'
],
'init_nature'
=>
Arr
::
get
(
config
(
'fixed.SupplierGroup'
),
$supplier
[
'supplier_group'
]),
'region'
=>
$supplier
[
'region'
]
==
2
?
1
:
2
,
'region'
=>
$supplier
[
'region'
]
==
SupplierChannelModel
::
REGION_CN
?
1
:
2
,
'pi_file_url'
=>
$fileUrl
?:
''
,
];
(
new
QueueDeliveryService
())
->
push
(
QueueDeliveryService
::
PUSH_TYPE_SYNC_HTTP
,
'/sync/Company/syncCompany'
,
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
edad517f
...
...
@@ -13,6 +13,7 @@ use App\Http\Services\ViewCheckService;
use
App\Model\IntracodeModel
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierExtendModel
;
...
...
@@ -255,7 +256,7 @@ class SupplierTransformer
$channel
[
'city_id'
]
=
!
empty
(
$regionData
[
1
])
?
$regionData
[
1
]
:
0
;
}
//判断所在区域,如果不是中国,则要把省市去掉
if
(
$channel
[
'region'
]
!=
2
)
{
if
(
$channel
[
'region'
]
!=
SupplierChannelModel
::
REGION_CN
)
{
$channel
[
'province_id'
]
=
$channel
[
'city_id'
]
=
0
;
}
unset
(
$channel
[
'province_city'
]);
...
...
@@ -271,6 +272,12 @@ class SupplierTransformer
unset
(
$channel
[
$key
]);
}
}
//国内才有税号
if
(
$channel
[
'region'
]
!=
SupplierChannelModel
::
REGION_CN
)
{
$channel
[
'tax_number'
]
=
''
;
}
$channel
[
'attachment'
]
=
$attachment
;
return
$channel
;
}
...
...
app/Http/Validators/SupplierValidator.php
View file @
edad517f
...
...
@@ -20,10 +20,11 @@ class SupplierValidator
//整理下请求数据
$validateData
=
$this
->
transformRequestData
(
$validateData
);
//这个要优先判断
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
{
//没有忽略校验的权限并且供应商地区属于内地和港台才会去校验天眼查
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
)
&&
in_array
(
$validateData
[
'supplier_group'
],
config
(
'field.NeedCheckCompanyRegion'
)))
{
$needCheckFlag
=
false
;
//新增的
,都要去
校验,然后修改的话,如果没有集团编码,并且是标准添加(非标准添加,即是特殊权限添加,不需要校验),也要去校验
//新增的校验,然后修改的话,如果没有集团编码,并且是标准添加(非标准添加,即是特殊权限添加,不需要校验),也要去校验
if
(
empty
(
$validateData
[
'supplier_id'
]))
{
$needCheckFlag
=
true
;
}
...
...
@@ -36,7 +37,7 @@ class SupplierValidator
}
}
if
(
$needCheckFlag
)
{
$regionType
=
$validateData
[
'region'
]
==
2
?
1
:
2
;
$regionType
=
$validateData
[
'region'
]
==
SupplierChannelModel
::
REGION_CN
?
1
:
2
;
//还要校验提交上来的公司是否有合法信息
$companyInfo
=
(
new
CompanyService
())
->
getCompanyInfo
(
$validateData
[
'supplier_name'
],
$validateData
[
'tax_number'
],
...
...
app/Model/SupplierChannelModel.php
View file @
edad517f
...
...
@@ -37,6 +37,9 @@ class SupplierChannelModel extends Model
const
SUPPLIER_GROUP_ORIGINAL
=
1
;
//原厂
const
SUPPLIER_GROUP_PROXY
=
4
;
//代理
//供应商地区
const
REGION_CN
=
2
;
//国内
//黑名单信息
public
function
blacklist
()
...
...
config/field.php
View file @
edad517f
...
...
@@ -182,5 +182,6 @@ return [
'NeedSkipSupplierNameCheckIds'
=>
[
195
,
12263
]
],
'NeedCheckCompanyRegion'
=>
[
2
,
4
]
];
\ No newline at end of file
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
edad517f
...
...
@@ -57,6 +57,8 @@
self
.
next
(
'#supplier_check_tip'
).
find
(
'p'
).
text
(
res
.
err_msg
);
$
(
'#supplier_name'
).
prop
(
'disabled'
,
false
);
}
}
else
if
(
res
.
err_code
===
-
3
)
{
//跳过天眼查校验
}
else
{
//这个code代表供应商名称已经存在,自然要检测
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
...
...
@@ -77,6 +79,7 @@
$
(
'#supplier_address'
).
val
(
companyInfo
.
supplier_address
);
$
(
'#registered_capital'
).
val
(
companyInfo
.
registered_capital
);
layer
.
msg
(
'校验公司信息通过,自动补全相关数据'
,
{
icon
:
6
})
if
(
!
ignoreCompanyCheck
)
{
if
(
self
.
attr
(
'id'
)
===
'supplier_name'
)
{
$
(
'#tax_number'
).
attr
(
'disabled'
,
true
);
...
...
@@ -135,9 +138,11 @@
@
endif
if
(
data
.
value
===
'2'
)
{
$
(
'#tax_number_required_span'
).
show
();
$
(
'#tax_number_div'
).
show
();
$
(
'.city-div'
).
show
();
}
else
{
$
(
'#tax_number_required_span'
).
hide
();
$
(
'#tax_number_div'
).
hide
();
$
(
'.city-div'
).
hide
();
}
});
...
...
@@ -311,7 +316,7 @@
$
(
'#registered_capital'
).
val
(
companyInfo
.
registered_capital
);
form
.
render
();
layer
.
msg
(
'验证成功,校验公司信息通过,自动补全相关数据'
,
{
icon
:
6
})
}
else
{
}
else
if
(
res
.
err_code
===
-
1
)
{
if
(
ignoreCompanyCheck
)
{
layer
.
msg
(
'公司未进行工商注册'
,
{
icon
:
5
})
}
else
{
...
...
resources/views/web/AddSupplier.blade.php
View file @
edad517f
...
...
@@ -73,7 +73,7 @@
</div>
</div>
</div>
<div
class=
"layui-col-md2"
style=
"padding-left:
2
0px"
>
<div
class=
"layui-col-md2"
style=
"padding-left:
4
0px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"recheck_company_info"
>
重新查验公司信息
</button>
</div>
</div>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
edad517f
...
...
@@ -76,7 +76,7 @@
</div>
</div>
</div>
<div
class=
"layui-col-md2"
style=
"padding-left:
2
0px"
>
<div
class=
"layui-col-md2"
style=
"padding-left:
4
0px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"recheck_company_info"
>
重新查验公司信息
</button>
</div>
</div>
...
...
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