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
105b40a5
authored
Jul 26, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
自动转正
parent
6640143b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
69 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Services/SupplierService.php
config/field.php
resources/views/web/BatchApplyInReviewSupplier.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
105b40a5
...
...
@@ -298,6 +298,7 @@ class SupplierApiController extends Controller
}
//批量修改渠道开发员
//修改后自动触发转正,资料不完善,进入待审核
public
function
BatchAllocatePurchaseUser
(
$request
)
{
$purchaseUid
=
$request
->
get
(
'purchase_uid'
);
...
...
app/Http/Controllers/Filter/SupplierFilter.php
View file @
105b40a5
...
...
@@ -107,7 +107,7 @@ class SupplierFilter
$canViewAllSupplier
=
checkPerm
(
'ViewAllSupplier'
);
$canViewSubordinateSupplier
=
checkPerm
(
'ViewSubordinateSupplier'
);
$canViewFakeSupplier
=
checkPerm
(
'ViewFakeSupplier'
);
//现在普通采购也能看到竞调供应商了(与他有关的)
if
(
!
$canViewFakeSupplier
)
{
$query
->
where
(
'is_type'
,
0
);
}
...
...
@@ -189,11 +189,13 @@ class SupplierFilter
case
"no_purchase_uid"
:
//没有渠道开发
$query
->
where
(
'status'
,
'!='
,
SupplierChannelModel
::
STATUS_DISABLE
)
->
where
(
'status'
,
'!='
,
SupplierChannelModel
::
STATUS_BLOCK
)
->
where
(
'purchase_uid'
,
''
);
break
;
case
"no_channel_uid"
:
//没有
渠道开发
//没有
采购员
$query
->
where
(
'status'
,
'!='
,
SupplierChannelModel
::
STATUS_DISABLE
)
->
where
(
'status'
,
'!='
,
SupplierChannelModel
::
STATUS_BLOCK
)
->
where
(
'channel_uid'
,
''
);
break
;
case
"invalid_channel_uid"
:
...
...
@@ -250,11 +252,13 @@ class SupplierFilter
//联系人待完善
case
"contact_no_complete"
:
$query
->
whereHas
(
'contact'
,
function
(
$q
)
{
$q
->
where
(
'supplier_consignee'
,
''
)
->
orWhere
(
'supplier_position'
,
''
)
->
orWhere
(
'supplier_email'
,
''
)
->
orWhere
(
'supplier_mobile'
,
''
)
->
orWhere
(
'supplier_telephone'
,
''
);
$q
->
where
(
'can_check_uids'
,
request
()
->
user
->
codeId
)
->
where
(
function
(
$subQuery
)
{
$subQuery
->
where
(
'supplier_consignee'
,
''
)
->
orWhere
(
'supplier_position'
,
''
)
->
orWhere
(
'supplier_email'
,
''
)
->
orWhere
(
'supplier_mobile'
,
''
)
->
orWhere
(
'supplier_telephone'
,
''
);
});
});
break
;
}
...
...
app/Http/Services/SupplierService.php
View file @
105b40a5
...
...
@@ -251,37 +251,42 @@ class SupplierService
//分配开发员
public
function
allocatePurchaseUser
(
$supplierId
,
$purchaseUid
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
$supplier
?
$supplier
->
toArray
()
:
[];
$prePurchaseUid
=
$supplier
[
'purchase_uid'
];
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'purchase_uid'
=>
$purchaseUid
,
]);
if
(
$result
)
{
//重新分配渠道开发并且开发人员有变更的时候,就去检查是否需要跟进
if
(
$supplier
[
'purchase_uid'
]
!=
$purchaseUid
)
{
$auditService
=
new
SupplierAuditService
();
//还要判断是否为待跟进供应商
if
(
$auditService
->
checkIsNeedToFollowUpSupplier
(
$supplierId
))
{
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'to_follow_up'
=>
1
,
]);
$result
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
$purchaseUid
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
$supplier
?
$supplier
->
toArray
()
:
[];
$prePurchaseUid
=
$supplier
[
'purchase_uid'
];
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'purchase_uid'
=>
$purchaseUid
,
]);
if
(
$result
)
{
//重新分配渠道开发并且开发人员有变更的时候,就去检查是否需要跟进
if
(
$supplier
[
'purchase_uid'
]
!=
$purchaseUid
)
{
$auditService
=
new
SupplierAuditService
();
//还要判断是否为待跟进供应商
if
(
$auditService
->
checkIsNeedToFollowUpSupplier
(
$supplierId
))
{
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'to_follow_up'
=>
1
,
]);
}
//判断是否是非正式供应商,如果是,自动转正,并且修改为待审核状态
$this
->
autoChangeIsType
(
$supplier
);
}
}
//还要去记录日志
$adminUserService
=
new
AdminUserService
();
$prePurchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$prePurchaseUid
);
$prePurchaseUserName
=
array_get
(
$prePurchaseUser
,
'name'
,
' '
);
$purchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$purchaseUid
);
$purchaseUserName
=
array_get
(
$purchaseUser
,
'name'
,
''
);
$logService
=
new
LogService
();
$content
=
"将渠道开发员由 [${prePurchaseUserName}] 改为 [${purchaseUserName}]"
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'分配渠道开发员'
,
$content
);
//还要去记录日志
$adminUserService
=
new
AdminUserService
();
$prePurchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$prePurchaseUid
);
$prePurchaseUserName
=
array_get
(
$prePurchaseUser
,
'name'
,
' '
);
$purchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$purchaseUid
);
$purchaseUserName
=
array_get
(
$purchaseUser
,
'name'
,
''
);
$logService
=
new
LogService
();
$content
=
"将渠道开发员由 [${prePurchaseUserName}] 改为 [${purchaseUserName}]"
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'分配渠道开发员'
,
$content
);
}
});
}
return
$result
;
}
...
...
@@ -297,38 +302,43 @@ class SupplierService
//分配采购员
public
function
allocateChannelUser
(
$supplierId
,
$channelUid
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
$supplier
?
$supplier
->
toArray
()
:
[];
$preChannelUid
=
$supplier
[
'channel_uid'
];
$preChannelUid
=
explode
(
','
,
$preChannelUid
);
$preChannelUid
[]
=
$channelUid
;
$preChannelUid
=
implode
(
','
,
$preChannelUid
);
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'channel_uid'
=>
$preChannelUid
,
]);
$contactResult
=
false
;
if
(
$result
)
{
$contactModel
=
new
SupplierContactModel
();
$contact
=
[
'supplier_id'
=>
$supplierId
,
'can_check_uids'
=>
$channelUid
,
];
$contactResult
=
$contactModel
->
insert
(
$contact
);
}
if
(
$contactResult
)
{
//记录日志
$adminUserService
=
new
AdminUserService
();
$channelUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$channelUid
);
$channelUserName
=
array_get
(
$channelUser
,
'name'
,
' '
);
$logService
=
new
LogService
();
$content
=
"添加采购员 : "
.
$channelUserName
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'添加采购员'
,
$content
);
}
$result
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
$channelUid
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
$supplier
?
$supplier
->
toArray
()
:
[];
$preChannelUid
=
$supplier
[
'channel_uid'
];
$preChannelUid
=
explode
(
','
,
$preChannelUid
);
$preChannelUid
[]
=
$channelUid
;
$preChannelUid
=
implode
(
','
,
$preChannelUid
);
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'channel_uid'
=>
$preChannelUid
,
]);
$contactResult
=
false
;
if
(
$result
)
{
$contactModel
=
new
SupplierContactModel
();
$contact
=
[
'supplier_id'
=>
$supplierId
,
'can_check_uids'
=>
$channelUid
,
];
$contactResult
=
$contactModel
->
insert
(
$contact
);
}
if
(
$contactResult
)
{
//判断是否是非正式供应商,如果是,自动转正,并且修改为待审核状态
$this
->
autoChangeIsType
(
$supplier
);
//记录日志
$adminUserService
=
new
AdminUserService
();
$channelUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$channelUid
);
$channelUserName
=
array_get
(
$channelUser
,
'name'
,
' '
);
$logService
=
new
LogService
();
$content
=
"添加采购员 : "
.
$channelUserName
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'添加采购员'
,
$content
);
}
return
$contactResult
;
});
$syncService
=
new
SyncSupplierService
();
$syncService
->
syncSupplierToErp
(
$supplierId
);
return
$
contactR
esult
;
return
$
r
esult
;
}
//判断并且修改待跟进
...
...
@@ -403,4 +413,17 @@ class SupplierService
}
return
true
;
}
//判断是否自动转正,并且还要修改为待审核状态给相关人员进行补充资料
public
function
autoChangeIsType
(
$supplier
)
{
if
(
$supplier
[
'is_type'
]
==
1
)
{
$model
=
new
SupplierChannelModel
();
$model
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'status'
=>
0
,
'is_type'
=>
0
]);
}
}
}
\ No newline at end of file
config/field.php
View file @
105b40a5
...
...
@@ -52,6 +52,11 @@ return [
'SkuMode'
=>
[
1
=>
'原厂直供'
,
2
=>
'国内现货'
,
3
=>
'国际现货'
,
4
=>
'猎芯期货'
,
5
=>
'海外代购'
,
6
=>
'线下现货'
,
7
=>
'猎芯自营'
,
],
'SupplierAccountType'
=>
[
...
...
resources/views/web/BatchApplyInReviewSupplier.blade.php
View file @
105b40a5
...
...
@@ -10,21 +10,18 @@
</blockquote>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"300"
>
<col
width=
"100"
>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>
供应商名称
</th>
<th>
当前渠道开发员
</th>
</tr>
</thead>
<tbody>
@foreach($suppliers as $supplier)
<tr>
<td>
{{$supplier['supplier_name']}}
</td>
<td>
{{$supplier['purchase_username']}}
</td>
</tr>
@endforeach
</tbody>
...
...
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