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
95df392e
authored
Dec 13, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
对接一体化标签
parent
e03df99c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
74 additions
and
24 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/SupplierController.php
app/Http/Controllers/Sync/BaseSyncController.php
app/Http/Controllers/Sync/SupplierSyncController.php
app/Http/Services/CompanyService.php
app/Http/Services/SupplierTagService.php
app/Http/Services/SyncSupplierService.php
resources/views/script/supplier/SupplierBaseScript.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
95df392e
...
...
@@ -173,6 +173,14 @@ class SupplierApiController extends Controller
$this
->
response
(
-
1
,
'该供应商为实体名单,不允许建档'
);
}
if
(
$checkCompanyEntity
==
-
2
)
{
$this
->
response
(
-
1
,
'该供应商为黑名单,不允许建档'
);
}
if
(
$checkCompanyEntity
==
-
3
)
{
$this
->
response
(
-
1
,
'该供应商被驳回,不允许建档'
);
}
//如果是有直接新增权限的(绕过天眼查等校验)
if
(
checkPerm
(
'IgnoreCompanyCheck'
))
{
$channel
[
'is_standard_add'
]
=
-
1
;
...
...
app/Http/Controllers/SupplierController.php
View file @
95df392e
...
...
@@ -18,6 +18,7 @@ use App\Model\LogModel;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
function
foo
\func
;
class
SupplierController
extends
Controller
{
...
...
@@ -213,14 +214,18 @@ class SupplierController extends Controller
$this
->
data
[
'province_city'
]
=
[
$supplier
[
'province_id'
],
$supplier
[
'city_id'
]];
//获取标签情况
$tagService
=
new
SupplierTagService
();
$systemTags
=
$tagService
->
getTagsBySupplierId
(
$supplierId
,
1
);
$systemTags
=
$tagService
->
getSystemTagsBySupplierId
(
$supplierId
,
1
);
$supplier
[
'system_tags'
]
=
array_map
(
function
(
$value
)
{
return
[
'tag_name'
=>
$value
,
];
},
$systemTags
);
$customerTags
=
$tagService
->
getTagsBySupplierId
(
$supplierId
,
2
);
$supplier
[
'system_tags'
]
=
$systemTags
?
implode
(
','
,
$systemTags
)
:
''
;
$supplier
[
'customer_tags'
]
=
$customerTags
?
implode
(
','
,
$customerTags
)
:
''
;
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'customer_tags'
=>
$supplier
[
'customer_tags'
],
'system_tags'
=>
$supplier
[
'system_tags'
],
]);
$this
->
data
[
'supplier'
]
=
$supplier
;
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
...
...
@@ -403,4 +408,4 @@ class SupplierController extends Controller
return
$this
->
view
(
'查询供应商'
);
}
}
\ No newline at end of file
}
app/Http/Controllers/Sync/BaseSyncController.php
View file @
95df392e
...
...
@@ -14,7 +14,7 @@ class BaseSyncController extends Controller
{
public
function
syncResponse
(
$code
=
0
,
$msg
=
'成功'
,
$data
=
''
,
$count
=
0
)
{
header
(
'Content-Type: application/json'
);
echo
json_encode
([
'code'
=>
$code
,
'msg'
=>
$msg
,
...
...
app/Http/Controllers/Sync/SupplierSyncController.php
View file @
95df392e
...
...
@@ -56,8 +56,26 @@ class SupplierSyncController extends BaseSyncController
$resultData
=
$request
->
only
([
'company_name'
,
'result'
,
'result_map'
,
'tag_list'
]);
Log
::
error
(
json_encode
(
$resultData
));
$resultData
[
'result_map'
]
=
!
empty
(
$resultData
[
'result_map'
])
?
json_decode
(
$resultData
[
'result_map'
],
true
)
:
[];
$resultData
[
'tag_list'
]
=
!
empty
(
$resultData
[
'tag_list'
])
?
json_decode
(
$resultData
[
'tag_list'
],
true
)
:
[];
if
(
is_array
(
$resultData
[
'result_map'
]))
{
$resultData
[
'result'
]
=
(
int
)
$resultData
[
'result_map'
][
1
];
}
if
(
$resultData
[
'result'
]
!==
0
&&
empty
(
$resultData
))
{
$this
->
syncResponse
(
-
1
,
'没有获取到正确的类型'
);
}
if
(
!
in_array
(
$resultData
[
'result'
],
[
0
,
1
,
-
1
,
-
2
,
-
3
]))
{
$this
->
syncResponse
(
-
1
,
'非法公司分类'
);
}
$rules
=
[
"company_name"
=>
"required"
,
//"result" => "required",
...
...
@@ -69,7 +87,6 @@ class SupplierSyncController extends BaseSyncController
$error
=
$validator
->
errors
()
->
first
();
$this
->
syncResponse
(
-
1
,
$error
);
}
//这里还要去判断是是拉黑
if
(
$resultData
[
'result'
]
==
-
2
)
{
$data
[
'status'
]
=
SupplierChannelModel
::
STATUS_BLOCK
;
...
...
@@ -81,7 +98,7 @@ class SupplierSyncController extends BaseSyncController
$this
->
syncResponse
(
0
,
'获取审核结果广播成功'
);
}
(
new
SyncSupplierService
())
->
receiveEntityResult
(
$resultData
[
'company_name'
],
$resultData
[
'result'
]);
(
new
SyncSupplierService
())
->
receiveEntityResult
(
$resultData
[
'company_name'
],
$resultData
[
'result'
]
,
$resultData
[
'tag_list'
]
);
$this
->
syncResponse
(
0
,
'获取审核结果广播成功'
);
}
...
...
app/Http/Services/CompanyService.php
View file @
95df392e
...
...
@@ -88,6 +88,7 @@ class CompanyService
'company_name_en'
=>
$supplierNameEn
,
'register_address'
=>
$supplierAddress
,
'business_license'
=>
$businessLicense
,
'company_id'
=>
1
,
];
$url
=
config
(
'website.UnitedDataDomain'
)
.
'/sync/Company/checkCompanyEntity'
;
$result
=
curl
(
$url
,
$params
);
...
...
app/Http/Services/SupplierTagService.php
View file @
95df392e
...
...
@@ -54,6 +54,15 @@ class SupplierTagService
return
!
empty
(
$data
[
'data'
])
?
$data
[
'data'
]
:
[];
}
public
function
getSystemTagsBySupplierId
(
$supplierId
)
{
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
select
([
'system_tags'
,
'united_tags'
])
->
first
()
->
toArray
();
$systemTags
=
$supplier
[
'system_tags'
]
?
explode
(
','
,
$supplier
[
'system_tags'
])
:
[];
$unitedTags
=
$supplier
[
'united_tags'
]
?
explode
(
','
,
$supplier
[
'united_tags'
])
:
[];
return
array_merge
(
$systemTags
,
$unitedTags
);
}
//新增/修改标签和供应商id对应关系到标签系统
public
function
saveTags
(
$supplierId
,
$tagUse
,
$newTags
,
$oldTags
)
...
...
app/Http/Services/SyncSupplierService.php
View file @
95df392e
...
...
@@ -221,7 +221,7 @@ class SyncSupplierService
//接收一体化的广播信息,对供应商进行实体名单操作
//加入实体名单后,要做很多事情,比如禁用供应商,也要禁用供应商账号等等,还要记录禁用之前的状态,等到移除实体名单以后,要恢复之前的状态
public
function
receiveEntityResult
(
$supplierName
,
$result
)
public
function
receiveEntityResult
(
$supplierName
,
$result
,
$tagList
)
{
Log
::
warning
(
'一体化拉黑结果 : '
.
(
$supplierName
.
'---'
.
$result
));
//先找到对应的供应商(草稿的跳过),如果没有那跳过
...
...
@@ -245,10 +245,15 @@ class SyncSupplierService
if
(
$result
==
-
1
)
{
$isEntityResult
=
SupplierChannelModel
::
IS_ENTITY_TRUE
;
$logContent
=
$reason
=
'属于实体名单,系统自动拉入黑名单'
;
}
else
{
}
if
(
$result
==
0
)
{
$isEntityResult
=
SupplierChannelModel
::
IS_ENTITY_NEED_CONFIRM
;
$logContent
=
$reason
=
'待确认实体名单,系统自动拉入禁止交易,请联系“风控部门”进行确认'
;
}
if
(
$result
==
-
3
)
{
$isEntityResult
=
SupplierChannelModel
::
IS_ENTITY_REJECT
;
$logContent
=
$reason
=
'被驳回供应商,系统自动拉入禁止交易,请联系“风控部门”进行确认'
;
}
}
$preStatus
=
null
;
$redis
=
new
RedisModel
();
...
...
@@ -277,6 +282,7 @@ class SyncSupplierService
//这里的逻辑是,因为取消实体名单以后,如果之前的状态是黑名单的话,直接变成待提审
'status'
=>
$isEntity
?
SupplierChannelModel
::
STATUS_DISABLE
:
(
$preStatus
==
SupplierChannelModel
::
STATUS_BLOCK
?
SupplierChannelModel
::
STATUS_IN_REVIEW
:
$preStatus
),
'disable_reason'
=>
$reason
,
'united_tags'
=>
!
empty
(
$tagList
)
?
implode
(
','
,
$tagList
)
:
''
,
]);
$isYunxinSupplier
=
false
;
//还要去修改对应的供应商账号,也是要记录禁用前的状态
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
95df392e
...
...
@@ -356,26 +356,25 @@
},
pageSize
:
30
,
data
:
tagList
,
on
:
function
(
tagList
)
{
let
arr
=
tagList
.
arr
;
let
tagIds
=
''
;
for
(
let
i
in
arr
)
{
tagIds
+=
arr
[
i
].
tag_id
+
','
;
}
let
idName
=
'system_tags'
;
$
(
'#'
+
idName
).
val
(
tagIds
);
},
//
on: function (tagList) {
//
let arr = tagList.arr;
//
let tagIds = '';
//
for (let i in arr) {
//
tagIds += arr[i].tag_id + ',';
//
}
//
let idName = 'system_tags';
//
$('#' + idName).val(tagIds);
//
},
};
}
if
(
supplierId
)
{
@
if
(
checkPerm
(
'UpdateSupplierTags'
))
let
systemTagOption
=
getTagOption
(
'system_tags_selector'
,
2
);
let
systemTagOption
=
getTagOption
(
'system_tags_selector'
);
systemTagOption
.
disabled
=
true
;
let
tagSelector
=
xmSelect
.
render
(
systemTagOption
);
let
tagIds
=
$
(
'#system_tags'
).
attr
(
'value'
);
tagSelector
.
setValue
(
tagIds
.
split
(
','
));
// let tagIds = $('#system_tags').attr('value');
tagSelector
.
setValue
({
!!
json_encode
(
!
empty
(
$supplier
[
'system_tags'
])?
$supplier
[
'system_tags'
]:[])
!!
});
//自定义标签
$
(
'#customer_tags'
).
tagsInput
({});
@
endif
...
...
resources/views/web/SupplierDetail.blade.php
View file @
95df392e
...
...
@@ -269,6 +269,12 @@
@endif
<span
class=
"layui-btn layui-btn-xs"
>
{{$tag}}
</span>
@endforeach
@foreach (explode(',',$supplier['united_tags']) as $tag)
@if (empty($tag))
@continue
@endif
<span
class=
"layui-btn layui-btn-xs"
>
{{$tag}}
</span>
@endforeach
</div>
<div
class=
"layui-col-md12"
>
自定义标签 :
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
95df392e
...
...
@@ -310,7 +310,7 @@
<div
class=
"layui-input-block"
style=
"margin-top: 15px"
>
<div
id=
"system_tags_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
</div>
<input
type=
"hidden"
name=
"system_tags"
value=
"{{$supplier['system_tags'] or ''}}"
<input
type=
"hidden"
name=
"system_tags"
id=
"system_tags"
>
</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