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
c9e9d2fc
authored
Jul 05, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
忽略审核权限
parent
25bfdf2a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
15 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/Api/SupplierAttachmentApiController.php
app/Http/Controllers/Api/SupplierReceiptApiController.php
app/Http/Services/SupplierAttachmentService.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierContactService.php
app/Http/Services/SupplierService.php
resources/views/web/UpdateSupplier.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
c9e9d2fc
...
...
@@ -186,8 +186,8 @@ class SupplierApiController extends Controller
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'修改失败'
);
}
//如果是申请审核,还要去修改审核状态
if
(
$isAudit
)
{
//如果是申请审核,还要去修改审核状态
,如果是忽略更新审核的话,也没必要走下面的步骤
if
(
$isAudit
&&
!
checkPerm
(
'IgnoreUpdateAudit'
)
)
{
$supplierService
=
new
SupplierService
();
$auditData
[]
=
[
'supplier_id'
=>
$supplierId
,
...
...
app/Http/Controllers/Api/SupplierAttachmentApiController.php
View file @
c9e9d2fc
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\LogService
;
use
App\Http\Services\SupplierAttachmentService
;
use
App\Http\Services\SupplierAuditService
;
use
App\Http\Transformers\SupplierAttachmentTransformer
;
use
App\Http\Validators\SupplierAttachmentValidator
;
use
App\Model\LogModel
;
...
...
@@ -53,14 +54,18 @@ class SupplierAttachmentApiController extends Controller
'attachment_id'
,
]);
$attachmentService
=
new
SupplierAttachmentService
();
$
result
=
$attachmentService
->
saveAttachment
(
$attachment
);
if
(
!
$
result
)
{
$
supplierId
=
$attachmentService
->
saveAttachment
(
$attachment
);
if
(
!
$
supplierId
)
{
$this
->
response
(
-
1
,
'操作失败'
);
}
else
{
SupplierChannelModel
::
where
(
'supplier_id'
,
$attachment
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'status'
=>
SupplierChannelModel
::
STATUS_PENDING
,
]);
$canIgnoreAudit
=
(
new
SupplierAuditService
())
->
checkCanIgnoreSupplierAudit
(
$supplierId
);
if
(
!
$canIgnoreAudit
)
{
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
SupplierChannelModel
::
STATUS_PENDING
,
]);
}
$logService
=
new
LogService
();
$content
=
!
empty
(
$attachment
[
'attachment_id'
])
?
'修改附件信息'
:
'添加附件信息'
;
$remark
=
json_encode
(
$attachment
);
...
...
app/Http/Controllers/Api/SupplierReceiptApiController.php
View file @
c9e9d2fc
...
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\LogService
;
use
App\Http\Services\SupplierAuditService
;
use
App\Http\Transformers\LogTransformer
;
use
App\Http\Transformers\ReceiptTransformer
;
use
App\Http\Validators\ReceiptValidator
;
...
...
@@ -101,6 +102,13 @@ class SupplierReceiptApiController extends Controller
$notNeedAuditField
=
[
'remark'
,
];
//如果有忽略审核的权限并且不需要复审,那么状态就是不需要审核直接通过
$canIgnoreAudit
=
(
new
SupplierAuditService
())
->
checkCanIgnoreSupplierAudit
(
$oldReceipt
[
'supplier_id'
]);
if
(
$canIgnoreAudit
)
{
return
false
;
}
$diff
=
array_diff
(
$oldReceipt
,
$newReceipt
);
unset
(
$diff
[
'update_time'
]);
$changeField
=
array_keys
(
$diff
);
...
...
app/Http/Services/SupplierAttachmentService.php
View file @
c9e9d2fc
...
...
@@ -41,7 +41,7 @@ class SupplierAttachmentService
return
$attachmentModel
->
insertGetId
(
$attachment
);
}
else
{
$attachment
[
'update_time'
]
=
time
();
return
$attachmentModel
->
where
(
'attachment_id'
,
$attachmentId
)
->
update
(
$attachment
);
return
$attachmentModel
->
where
(
'attachment_id'
,
$attachmentId
)
->
update
(
$attachment
)
?
$attachment
[
'supplier_id'
]
:
0
;
}
}
...
...
app/Http/Services/SupplierAuditService.php
View file @
c9e9d2fc
...
...
@@ -236,6 +236,7 @@ class SupplierAuditService
'sku_tag'
,
'sku_upload_ruler'
,
'sku_audit_ruler'
,
'need_review'
];
//先找出目前数据库里面的数据
$selectField
=
array_keys
(
$channel
);
...
...
@@ -247,6 +248,12 @@ class SupplierAuditService
}
$supplier
=
$model
->
select
(
$selectField
)
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
//如果有忽略审核的权限并且不需要复审,那么状态就是不需要审核直接通过
if
(
checkPerm
(
'IgnoreUpdateAudit'
)
&&
!
$supplier
[
'need_review'
])
{
return
false
;
}
$changeField
=
[];
foreach
(
$supplier
as
$key
=>
$value
)
{
if
(
$value
!=
$channel
[
$key
])
{
...
...
@@ -261,4 +268,17 @@ class SupplierAuditService
}
return
false
;
}
//判断是否可以直接忽略修改审核
public
function
checkCanIgnoreSupplierAudit
(
$supplierId
)
{
$needReview
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'need_review'
);
//如果有忽略审核的权限并且不需要复审,那么状态就是不需要审核直接通过
if
(
!
checkPerm
(
'IgnoreUpdateAudit'
)
&&
!
$needReview
)
{
return
true
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
app/Http/Services/SupplierContactService.php
View file @
c9e9d2fc
...
...
@@ -131,6 +131,13 @@ class SupplierContactService
'supplier_qq'
,
'supplier_fax'
,
];
//如果有忽略审核的权限并且不需要复审,那么状态就是不需要审核直接通过
$canIgnoreAudit
=
(
new
SupplierAuditService
())
->
checkCanIgnoreSupplierAudit
(
$oldContact
[
'supplier_id'
]);
if
(
$canIgnoreAudit
)
{
return
false
;
}
$diff
=
array_merge
(
array_diff
(
$oldContact
,
$newContact
),
array_diff
(
$newContact
,
$oldContact
));
unset
(
$diff
[
'update_time'
]);
$changeField
=
array_keys
(
$diff
);
...
...
@@ -177,9 +184,10 @@ class SupplierContactService
$contact
[
'admin_id'
]
=
request
()
->
user
->
userId
;
$result
=
$contactModel
->
insert
(
$contact
);
if
(
$result
)
{
$channelUids
=
$contacts
=
$contactModel
->
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'can_check_uids'
)
->
toArray
();
$channelUids
=
$contacts
=
$contactModel
->
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'can_check_uids'
)
->
toArray
();
$supplierModel
=
new
SupplierChannelModel
();
$result
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
$result
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'channel_uid'
=>
implode
(
','
,
$channelUids
),
'update_time'
=>
time
(),
]);
...
...
app/Http/Services/SupplierService.php
View file @
c9e9d2fc
...
...
@@ -128,6 +128,7 @@ class SupplierService
}
else
{
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_PENDING
;
}
//第一次新增的供应商,都需要进行复审
$channel
[
'need_review'
]
=
1
;
...
...
@@ -184,7 +185,7 @@ class SupplierService
/**这里的是更新供应商的操作**/
$supplierId
=
$this
->
newSupplierId
=
$channel
[
'supplier_id'
];
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
//要做进一步判断,部分字段修改不需要审核
$auditService
=
new
SupplierAuditService
();
$needAudit
=
$auditService
->
checkNeedAudit
(
$supplierId
,
$channel
,
$attachment
);
...
...
resources/views/web/UpdateSupplier.blade.php
View file @
c9e9d2fc
...
...
@@ -81,9 +81,12 @@
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"updateSupplier"
>
确认修改供应商
</button>
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"applyAuditSupplier"
>
申请审核
</button>
@if (!checkPerm('IgnoreUpdateAudit'))
<button
type=
"button"
class=
"layui-btn layui-btn submit-loading"
lay-submit
lay-filter=
"applyAuditSupplier"
>
申请审核
</button>
@endif
@endif
<a
id=
"supplierDetailUrl"
href=
"/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
...
...
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