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
fcdc9302
authored
Jun 21, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
ysx-供应商二期-20210610
parent
7f34beaf
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
83 additions
and
38 deletions
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierService.php
app/Http/Services/SupplierStatisticsService.php
app/Model/SupplierChannelModel.php
config/fixed.php
resources/views/script/SupplierListScript.blade.php
resources/views/script/UpdateSupplierScript.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/UpdateSupplier.blade.php
app/Http/Controllers/Filter/SupplierFilter.php
View file @
fcdc9302
...
...
@@ -153,11 +153,11 @@ class SupplierFilter
case
"all"
:
break
;
case
"pending"
:
//待
审核供应商(其实就是没有提交审核申请的,默认是草稿
//待
复审供应商
$query
->
where
(
'status'
,
SupplierChannelModel
::
STATUS_PENDING
);
break
;
case
"in_review"
:
//待
复审
//待
审核
$query
->
where
(
'status'
,
SupplierChannelModel
::
STATUS_IN_REVIEW
);
break
;
case
"passed"
:
...
...
app/Http/Services/SupplierAuditService.php
View file @
fcdc9302
...
...
@@ -3,13 +3,10 @@
namespace
App\Http\Services
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
Illuminate\Support\Facades\DB
;
class
SupplierAuditService
{
...
...
@@ -18,28 +15,63 @@ class SupplierAuditService
$model
=
new
SupplierChannelModel
();
//判断当前要审核的供应商是不是想要被禁用的
//因为想要禁用,需要审核后才能禁用的,不能直接修改成禁用
//
我
要找个地方存起来是不是想要禁用
//要找个地方存起来是不是想要禁用
$redis
=
new
RedisModel
();
$disableExist
=
$redis
->
hget
(
'audit_disable_supplier_list'
,
$supplierId
);
if
(
$disableExist
)
{
if
(
$status
==
2
)
{
if
(
$status
==
SupplierChannelModel
::
STATUS_PASSED
)
{
$status
=
SupplierChannelModel
::
STATUS_DISABLE
;
}
else
{
$status
=
2
;
//因为只有通过状态的供应商才能发起禁用审核,所以拒绝禁用申请,自然会变回启用状态
$status
=
SupplierChannelModel
::
STATUS_PASSED
;
}
}
//先找出原来供应商的状态
$supplierModel
=
new
SupplierChannelModel
();
$originStatus
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'status'
);
//如果原来的状态是-1,就是第一次新增的待审核,审核通过状态是变成1(待复审)
$dbStatus
=
$originStatus
==
-
1
?
1
:
$status
;
$supplier
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
//如果需要复审并且审核状态为待审核,则代表这次审核为第一次审核
if
(
$supplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_IN_REVIEW
&&
$supplier
[
'need_review'
]
==
1
)
{
//第一次审核,通过是将审核状态置为待复审
//通过
if
(
$status
==
SupplierChannelModel
::
STATUS_PASSED
)
{
$dbStatus
=
SupplierChannelModel
::
STATUS_PENDING
;
}
else
{
//不通过
$dbStatus
=
$status
;
}
$update
=
[
'update_time'
=>
time
(),
'status'
=>
$dbStatus
,
'reject_reason'
=>
$rejectReason
,
];
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$update
);
//如果是待复审状态,通过的话还要将是否需要复审状态置为0
}
elseif
(
$supplier
[
'status'
]
===
SupplierChannelModel
::
STATUS_PENDING
)
{
if
(
$status
==
SupplierChannelModel
::
STATUS_PASSED
)
{
$update
[
'need_review'
]
=
0
;
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
$dbS
tatus
,
'status'
=>
$s
tatus
,
'reject_reason'
=>
$rejectReason
,
]);
}
else
{
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
$status
,
'reject_reason'
=>
$rejectReason
,
]);
}
//剩下的就是普通的审核
}
else
{
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
$status
,
'reject_reason'
=>
$rejectReason
,
]);
}
if
(
$disableExist
)
{
$redis
->
hdel
(
'audit_disable_supplier_list'
,
$supplierId
);
}
...
...
@@ -48,16 +80,11 @@ class SupplierAuditService
//记录日志
if
(
$disableExist
)
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_DISABLE
?
'审核通过,禁用供应商'
:
'审核不通过,原因是 : '
.
$rejectReason
;
if
(
$status
==
SupplierChannelModel
::
STATUS_DISABLE
)
{
//发送队列消息同步到金蝶
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToErp
(
$supplierId
);
}
}
else
{
//如果
原来的状态是-1,就是第一次新增的待审核,审核通过状态是变成1(待复审)
if
(
$
originStatus
==
-
1
)
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'
初审通过'
:
'初
审不通过,原因是 : '
.
$rejectReason
;
$action
=
'
初
审供应商'
;
//如果
状态是复审
if
(
$
supplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_PENDING
)
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'
复审通过'
:
'复
审不通过,原因是 : '
.
$rejectReason
;
$action
=
'
复
审供应商'
;
}
else
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'审核通过'
:
'审核不通过,原因是 : '
.
$rejectReason
;
}
...
...
@@ -67,8 +94,8 @@ class SupplierAuditService
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
$action
,
$content
);
}
//
审核状态为待审核(即第一次新增)时,不需要推送
到金蝶
if
(
$s
tatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
//
复审通过状态的供应商才会同步
到金蝶
if
(
$s
upplier
[
'need_review'
]
==
1
)
{
//发送队列消息同步到金蝶
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToErp
(
$supplierId
);
...
...
@@ -89,10 +116,12 @@ class SupplierAuditService
$auditUserId
=
request
()
->
user
->
userId
;
$logModel
=
new
LogModel
();
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
()
->
toArray
();
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$log
=
$log
?
$log
->
toArray
()
:
[];
//判断供应商,如果是第一次新增的供应商,要去判断创建人是否属于审核人相关的部门
//别问我为啥不加多一个状态,这个审核流程是突然改成这样子的,没法加...
if
(
$log
[
'action'
]
==
'初审供应商'
)
{
if
(
empty
(
$log
)
)
{
$lastUpdateUserId
=
$supplier
[
'create_uid'
];
}
else
{
$lastUpdateUserId
=
$log
[
'admin_id'
];
...
...
@@ -173,6 +202,12 @@ class SupplierAuditService
//先找出目前数据库里面的数据
$selectField
=
array_keys
(
$channel
);
$model
=
new
SupplierChannelModel
;
$status
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'status'
);
//只要是未通过的,都要进入审核
if
(
$status
==
SupplierChannelModel
::
STATUS_REJECT
)
{
return
true
;
}
$supplier
=
$model
->
select
(
$selectField
)
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$changeField
=
[];
foreach
(
$supplier
as
$key
=>
$value
)
{
...
...
app/Http/Services/SupplierService.php
View file @
fcdc9302
...
...
@@ -128,7 +128,9 @@ class SupplierService
}
return
$value
;
},
$channel
);
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_PENDING
;
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_IN_REVIEW
;
//第一次新增的供应商,都需要进行复审
$channel
[
'need_review'
]
=
1
;
$contactField
=
[
'supplier_consignee'
,
'supplier_position'
,
...
...
app/Http/Services/SupplierStatisticsService.php
View file @
fcdc9302
...
...
@@ -14,9 +14,9 @@ class SupplierStatisticsService
{
$total
=
$this
->
getStatisticsCount
(
'all'
);
//待审核,就是以前的草稿
$pending
=
$this
->
getStatisticsCount
(
'pending'
);
//待复审
$pending
=
$this
->
getStatisticsCount
(
'pending'
);
//待审核
$inReview
=
$this
->
getStatisticsCount
(
'in_review'
);
//通过
$passed
=
$this
->
getStatisticsCount
(
'passed'
);
...
...
app/Model/SupplierChannelModel.php
View file @
fcdc9302
...
...
@@ -10,9 +10,9 @@ class SupplierChannelModel extends Model
protected
$table
=
'supplier_channel'
;
public
$timestamps
=
false
;
//待
审核
(第一次新增)
//待
复审
(第一次新增)
const
STATUS_PENDING
=
-
1
;
//待
复审
//待
审核
const
STATUS_IN_REVIEW
=
1
;
//通过
const
STATUS_PASSED
=
2
;
...
...
config/fixed.php
View file @
fcdc9302
...
...
@@ -87,8 +87,8 @@ return [
'SupplierStatus'
=>
[
-
1
=>
'待
审核
'
,
1
=>
'待
复审
'
,
-
1
=>
'待
复审
'
,
1
=>
'待
审核
'
,
3
=>
'未通过'
,
2
=>
'已通过'
,
-
2
=>
'禁止交易'
,
...
...
@@ -204,8 +204,8 @@ return [
//罗盘菜单对应id
'CompassMenuMap'
=>
[
'total'
=>
'全部'
,
'pending'
=>
'待
审核
'
,
'in_review'
=>
'待
复审
'
,
'pending'
=>
'待
复审
'
,
'in_review'
=>
'待
审核
'
,
'passed'
=>
'已通过'
,
'rejected'
=>
'未通过'
,
'disable'
=>
'禁止交易'
,
...
...
resources/views/script/SupplierListScript.blade.php
View file @
fcdc9302
...
...
@@ -35,6 +35,8 @@
$
(
this
).
attr
(
'class'
,
'status_filter layui-badge layui-bg-green'
);
type
=
$
(
this
).
attr
(
'id'
);
whereCondition
.
source_type
=
type
//先清空状态
whereCondition
.
status
=
0
;
table
.
reload
(
'list'
,
{
page
:
{
curr
:
1
...
...
@@ -224,7 +226,7 @@
return
}
// if (status === -1) {
// layer.msg('要待
复审
的供应商才可以审核', {icon: 5});
// layer.msg('要待
审核
的供应商才可以审核', {icon: 5});
// return
// }
let
checkAuditMsg
=
checkCanAudit
(
supplierId
);
...
...
resources/views/script/UpdateSupplierScript.blade.php
View file @
fcdc9302
...
...
@@ -18,8 +18,10 @@
confirmMessage
=
'确定要重新入驻吗,该供应商就会再次进入审核阶段'
}
else
if
(
data
.
field
.
status
===
'-1'
)
{
confirmMessage
=
'确定要提交新增供应商信息吗?一旦提交,该供应商就会进入待复审阶段,审核过程中无法进行信息修改'
}
else
if
(
data
.
field
.
status
===
'3'
)
{
confirmMessage
=
'确定要重新提交审核吗?一旦提交,该供应商就会再次进入待审核阶段,审核过程中无法进行信息修改'
;
}
else
{
confirmMessage
=
'确定要修改供应商信息吗?一旦修改关键字段,该供应商就会再次进入待
复审阶段,审核过程中无法进行信息修改'
confirmMessage
=
'确定要修改供应商信息吗?一旦修改关键字段,该供应商就会再次进入待
审核阶段,审核过程中无法进行信息修改'
;
}
layer
.
confirm
(
confirmMessage
,
function
(
index
)
{
let
res
=
ajax
(
'/api/supplier/UpdateSupplier'
,
data
.
field
)
...
...
resources/views/web/SupplierDetail.blade.php
View file @
fcdc9302
...
...
@@ -58,7 +58,7 @@
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PENDING)
<div
class=
"layui-row"
>
<button
type=
"button"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn layui-btn-disabled"
>
待
审核
,不能修改
class=
"layui-btn layui-btn layui-btn-disabled"
>
待
复审
,不能修改
</button>
</div>
@elseif($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PASSED||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_REJECT)
...
...
@@ -77,7 +77,7 @@
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_IN_REVIEW)
<div
class=
"layui-row"
>
<button
type=
"button"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn layui-btn-disabled"
>
待
复审
,不能修改
class=
"layui-btn layui-btn layui-btn-disabled"
>
待
审核
,不能修改
</button>
</div>
@endif
...
...
resources/views/web/UpdateSupplier.blade.php
View file @
fcdc9302
...
...
@@ -74,6 +74,10 @@
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"updateSupplier"
>
确认新建供应商
</button>
@elseif($supplier['status']==\App\Model\SupplierChannelModel::STATUS_REJECT)
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"updateSupplier"
>
审核未通过,确认重新提交审核
</button>
@else
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"updateSupplier"
>
确认修改供应商
...
...
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