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
ef4cf926
authored
Aug 12, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
ok
parent
b926420a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
12 deletions
app/Http/Services/DataService.php
app/Http/Services/SupplierService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
ef4cf926
...
...
@@ -86,17 +86,17 @@ class DataService
$cooperation_agreement
=
array_get
(
$files
,
'cooperation_agreement'
);
$other_attachment
=
array_get
(
$files
,
'other_attachment'
);
$attachment
=
[
'business_license'
=>
$business_license
?
[
$business_license
]
:
''
,
'billing_information'
=>
$billing_information
?
[
$billing_information
]
:
''
,
'registration_certificate'
=>
$registration_certificate
?
[
$registration_certificate
]
:
''
,
'incorporation_certificate'
=>
$incorporation_certificate
?
[
$incorporation_certificate
]
:
''
,
'certification_notice'
=>
$certification_notice
?
[
$certification_notice
]
:
''
,
'supplier_survey'
=>
$supplier_survey
?
[
$supplier_survey
]
:
''
,
'proxy_certificate'
=>
$proxy_certificate
?
[
$proxy_certificate
]
:
''
,
'quality_assurance_agreement'
=>
$quality_assurance_agreement
?
[
$quality_assurance_agreement
]
:
''
,
'confidentiality_agreement'
=>
$confidentiality_agreement
?
[
$confidentiality_agreement
]
:
''
,
'cooperation_agreement'
=>
$cooperation_agreement
?
[
$cooperation_agreement
]
:
''
,
'other_attachment'
=>
$other_attachment
?
[
$other_attachment
]
:
''
,
'business_license'
=>
$business_license
?
[
$business_license
]
:
''
,
'billing_information'
=>
$billing_information
?
[
$billing_information
]
:
''
,
'registration_certificate'
=>
$registration_certificate
?
[
$registration_certificate
]
:
''
,
'incorporation_certificate'
=>
$incorporation_certificate
?
[
$incorporation_certificate
]
:
''
,
'certification_notice'
=>
$certification_notice
?
[
$certification_notice
]
:
''
,
'supplier_survey'
=>
$supplier_survey
?
[
$supplier_survey
]
:
''
,
'proxy_certificate'
=>
$proxy_certificate
?
[
$proxy_certificate
]
:
''
,
'quality_assurance_agreement'
=>
$quality_assurance_agreement
?
[
$quality_assurance_agreement
]
:
''
,
'confidentiality_agreement'
=>
$confidentiality_agreement
?
[
$confidentiality_agreement
]
:
''
,
'cooperation_agreement'
=>
$cooperation_agreement
?
[
$cooperation_agreement
]
:
''
,
'other_attachment'
=>
$other_attachment
?
[
$other_attachment
]
:
''
,
'create_time'
=>
time
(),
'update_time'
=>
time
(),
'supplier_id'
=>
$supplierId
,
...
...
@@ -175,6 +175,67 @@ class DataService
}
}
//导入黑名单供应商(前提是不存在)
public
function
importBlockSupplier
()
{
$supplierNames
=
[
'Electronics Depot'
,
'Assured Electronics Corp.'
,
'深圳市力特电子有限公司'
,
'深圳市铭盛微电子科技有限公司'
,
'Aegis Components Inc'
,
'深圳市亿博创电子公司'
,
];
//构建插入数据
$supplierModel
=
new
SupplierChannelModel
();
foreach
(
$supplierNames
as
$supplierName
)
{
$supplierName
=
trim
(
$supplierName
);
$exist
=
$supplierModel
->
where
(
'supplier_name'
,
$supplierName
)
->
count
();
if
(
!
$exist
)
{
$insertData
=
[
'supplier_name'
=>
$supplierName
,
'create_uid'
=>
1000
,
'create_time'
=>
time
(),
'status'
=>
$supplierModel
::
STATUS_BLOCK
,
'is_type'
=>
0
,
'create_name'
=>
'admin'
,
'block_reason'
=>
'系统拉黑'
,
];
$supplierId
=
$supplierModel
->
insertGetId
(
$insertData
);
$supplierService
=
new
SupplierService
();
$supplierService
->
saveSupplierCode
(
$supplierId
);
}
}
}
//给特定类型的供应商打上标签
//找出 国内/港台 + 贸易商性质的,而且没有上传品质协议的供应商,自动打上临时供应商标签
public
function
makeSupplierSystemTag
()
{
$channelModel
=
new
SupplierChannelModel
();
$suppliers
=
$channelModel
->
leftjoin
(
'supplier_attachment'
,
'supplier_channel.supplier_id'
,
'='
,
'supplier_attachment.supplier_id'
)
->
whereIn
(
'region'
,
[
2
,
4
])
->
where
(
'supplier_group'
,
2
)
->
where
(
'quality_assurance_agreement'
,
''
)
->
where
(
'system_tags'
,
'not like'
,
'%临时供应商%'
)
->
get
()
->
toArray
();
$tagService
=
new
SupplierTagService
();
//找到后打上标签
foreach
(
$suppliers
as
$supplier
)
{
$supplierId
=
$supplier
[
'supplier_id'
];
$oldTags
=
$supplier
[
'system_tags'
];
$newTags
=
$supplier
[
'system_tags'
]
?
rtrim
(
$supplier
[
'system_tags'
],
','
)
.
',临时供应商'
:
'临时供应商'
;
if
(
$tagService
->
saveTags
(
$supplierId
,
14
,
$newTags
,
$oldTags
))
{
$channelModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'system_tags'
=>
$newTags
]);
}
}
}
}
app/Http/Services/SupplierService.php
View file @
ef4cf926
...
...
@@ -201,7 +201,7 @@ class SupplierService
}
//报错供应商编码,包括系统生成的和自定义规则生成的
p
rivate
function
saveSupplierCode
(
$supplierId
)
p
ublic
function
saveSupplierCode
(
$supplierId
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
...
...
app/Http/routes.php
View file @
ef4cf926
...
...
@@ -44,6 +44,8 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$service
=
new
\App\Http\Services\DataService
();
$service
->
importBlockSupplier
();
// $service->makeSupplierSystemTag();
// $service->initSystemTag();
// $service->transferFileData();
// $service->changeSupplierIsTypeByCheckChannelUidOrPurchaseUid();
...
...
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