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
c088387d
authored
Jun 08, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改忽略审核
parent
2c8811a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
36 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierService.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
c088387d
...
...
@@ -161,27 +161,16 @@ class SupplierApiController extends Controller
if
(
!
$supplierId
)
{
$this
->
response
(
-
1
,
'操作失败'
);
}
//如果是申请审核,还要去修改审核状态
if
(
$isAudit
)
{
$supplierService
=
new
SupplierService
();
$auditData
[]
=
[
'supplier_id'
=>
$supplierId
,
//供应商类型为临时供应商,才会去存申请理由
'apply_audit_reason'
=>
$channel
[
'supplier_type'
]
==
2
?
$request
->
input
(
'apply_audit_reason'
)
:
''
,
];
$supplierService
->
batchApplyInReviewSupplier
(
$auditData
);
}
$this
->
response
(
0
,
'操作成功'
);
}
//
添加
供应商
//
更新
供应商
public
function
UpdateSupplier
(
$request
)
{
//先去表单验证
$validator
=
new
SupplierValidator
();
$data
=
$request
->
all
();
$isAudit
=
(
bool
)
$request
->
input
(
'is_audit'
);
$supplierId
=
$request
->
input
(
'supplier_id'
);
$validateResult
=
$validator
->
checkSave
(
$data
,
$isAudit
);
if
(
$validateResult
)
{
$this
->
response
(
-
1
,
$validateResult
);
...
...
@@ -193,16 +182,6 @@ class SupplierApiController extends Controller
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'修改失败'
);
}
//如果是申请审核,还要去修改审核状态,
if
(
$isAudit
)
{
$supplierService
=
new
SupplierService
();
$auditData
[]
=
[
'supplier_id'
=>
$supplierId
,
//供应商类型为临时供应商,才会去存申请理由
'apply_audit_reason'
=>
$channel
[
'supplier_type'
]
==
2
?
$request
->
input
(
'apply_audit_reason'
)
:
''
,
];
$supplierService
->
batchApplyInReviewSupplier
(
$auditData
);
}
$this
->
response
(
0
,
$isAudit
?
'申请审核成功'
:
'修改成功'
);
}
...
...
app/Http/Services/SupplierAuditService.php
View file @
c088387d
...
...
@@ -64,10 +64,10 @@ class SupplierAuditService
if
(
$result
)
{
//如果状态是复审
if
(
$supplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_NEED_REVIEW
)
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'复审通过 '
.
$rejectReason
:
'复审不通过,原因是 : '
.
$rejectReason
;
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'复审通过 '
.
$rejectReason
:
'复审不通过,原因是 : '
.
$rejectReason
;
$action
=
'复审供应商'
;
}
else
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'审核通过 '
.
$rejectReason
:
'审核不通过,原因是 : '
.
$rejectReason
;
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'审核通过 '
.
$rejectReason
:
'审核不通过,原因是 : '
.
$rejectReason
;
}
$logService
=
new
LogService
();
$content
=
$auditStatus
;
...
...
@@ -229,7 +229,7 @@ class SupplierAuditService
return
true
;
}
//判断是否要进入审核中状态,因为部分字段修改是不需要走审核的
//判断是否要进入审核中状态,因为部分字段修改是不需要走审核的
,这是更新之前的校验
public
function
checkNeedAudit
(
$supplierId
,
$channel
)
{
$notNeedAuditField
=
[
...
...
@@ -261,7 +261,6 @@ class SupplierAuditService
//如果有忽略审核的权限并且不需要复审,那么状态就是不需要审核直接通过
$canIgnoreAudit
=
$this
->
checkCanIgnoreSupplierAudit
(
$supplierId
);
if
(
$canIgnoreAudit
)
{
return
false
;
}
...
...
@@ -271,10 +270,24 @@ class SupplierAuditService
$changeField
[]
=
$key
;
}
}
foreach
(
$changeField
as
$fi
le
d
)
{
foreach
(
$changeField
as
$fi
el
d
)
{
//只要有一个不存在于不需要审核的字段,就返回需要审核
if
(
!
in_array
(
$fi
le
d
,
$notNeedAuditField
))
{
if
(
!
in_array
(
$fi
el
d
,
$notNeedAuditField
))
{
return
true
;
}
else
{
if
(
$field
===
'stockup_type'
)
{
//还要单独判断供应商的stockup_type,只有是操作云芯这个值的时候,才不去审核,真是服了
$oldStockupType
=
explode
(
','
,
trim
(
$supplier
[
'stockup_type'
],
''
));
$newStockupType
=
explode
(
','
,
trim
(
$channel
[
'stockup_type'
],
''
));
if
(
count
(
$oldStockupType
)
>
count
(
$newStockupType
))
{
$modifyStockupType
=
array_diff
(
$oldStockupType
,
$newStockupType
);
}
else
{
$modifyStockupType
=
array_diff
(
$newStockupType
,
$oldStockupType
);
}
if
(
array_values
(
$modifyStockupType
)
!=
[
'5'
])
{
return
true
;
}
}
}
}
return
false
;
...
...
app/Http/Services/SupplierService.php
View file @
c088387d
...
...
@@ -72,8 +72,10 @@ class SupplierService
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$channel
[
'supplier_id'
])
->
first
();
$oldSupplier
=
$supplierTransformer
->
transformInfo
(
$oldSupplier
);
}
$needAudit
=
true
;
//走事务
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
)
{
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
,
&
$needAudit
)
{
//是否直接申请审核
$isDirectApply
=
request
()
->
get
(
'direct_apply'
);
...
...
@@ -106,7 +108,6 @@ class SupplierService
$skuAuditRulerService
=
new
SupplierSkuAuditRulerService
();
$channel
[
'sku_audit_ruler'
]
=
$skuAuditRulerService
->
getSkuAuditRulerForDB
(
$channel
[
'sku_audit_ruler'
]);
//新增供应商操作
if
(
empty
(
$channel
[
'supplier_id'
]))
{
//处理附件信息,新增的时候才会有附件信息提交过来
...
...
@@ -212,7 +213,6 @@ class SupplierService
//要做进一步判断,部分字段修改不需要审核
$auditService
=
new
SupplierAuditService
();
$needAudit
=
$auditService
->
checkNeedAudit
(
$supplierId
,
$channel
);
if
(
$needAudit
)
{
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_PENDING
;
}
else
{
...
...
@@ -220,7 +220,6 @@ class SupplierService
$syncService
=
new
SyncSupplierService
();
$syncService
->
syncSupplierToErp
(
$supplierId
);
}
$channel
[
'update_time'
]
=
time
();
//这里有个逻辑,就是如果供应商类型是临时,那么要打上临时供应商的标签,如果不是,那么就要去掉这个标签
...
...
@@ -244,7 +243,6 @@ class SupplierService
}
$channel
[
'system_tags'
]
=
trim
(
implode
(
','
,
$channel
[
'system_tags'
]),
','
);
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$channel
);
//保存地址
$supplierAddressService
=
new
SupplierAddressService
();
...
...
@@ -280,7 +278,7 @@ class SupplierService
$mainBrands
=
explode
(
','
,
$mainBrands
);
$mainBrands
=
array_map
(
function
(
$value
)
{
return
(
int
)
$value
;
},
$mainBrands
);
},
$mainBrands
);
$supplierSkuCpTimeRuler
=
$redis
->
hget
(
'supplier_sku_upload_ruler_v2'
,
$supplierId
);
if
(
$supplierSkuCpTimeRuler
)
{
$supplierSkuCpTimeRuler
=
json_decode
(
$supplierSkuCpTimeRuler
,
true
);
...
...
@@ -327,6 +325,19 @@ class SupplierService
'old_supplier'
=>
$oldSupplier
,
'new_supplier'
=>
$newSupplier
]));
//这里有个申请审核的判断逻辑
//如果是申请审核,还要去修改审核状态
$isAudit
=
(
bool
)
request
()
->
input
(
'is_audit'
);
if
(
$isAudit
&&
$needAudit
)
{
$auditData
[]
=
[
'supplier_id'
=>
$supplierId
,
//供应商类型为临时供应商,才会去存申请理由
'apply_audit_reason'
=>
$channel
[
'supplier_type'
]
==
2
?
request
()
->
input
(
'apply_audit_reason'
)
:
''
,
];
$this
->
batchApplyInReviewSupplier
(
$auditData
);
}
return
$supplierId
;
}
...
...
@@ -653,8 +664,22 @@ class SupplierService
if
(
!
$result
)
{
return
$result
;
}
//新增一条申请审核的日志
// (new LogService())->AddLog($data['supplier_id'], LogModel::UPDATE_OPERATE, '申请审核', '申请审核供应商');
}
return
true
;
}
//申请审核供应商
public
function
applyInReviewSupplier
(
$supplierId
,
$channel
)
{
$model
=
new
SupplierChannelModel
();
$needAudit
=
(
new
SupplierAuditService
())
->
checkNeedAudit
(
$supplierId
,
$channel
);
$result
=
$model
->
where
(
'supplier_id'
,
$data
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'apply_audit_reason'
=>
$data
[
'apply_audit_reason'
],
'status'
=>
SupplierChannelModel
::
STATUS_IN_REVIEW
]);
if
(
!
$result
)
{
return
$result
;
}
return
true
;
}
...
...
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