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
1e4618be
authored
Jun 21, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
5371a058
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
92 additions
and
23 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/LogService.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierContactService.php
app/Http/Validators/ReceiptValidator.php
app/Http/Validators/SupplierContactValidator.php
app/Http/routes.php
config/fixed.php
resources/views/script/SupplierListScript.blade.php
resources/views/script/UpdateSupplierScript.blade.php
resources/views/web/AddSupplierReceipt.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
1e4618be
...
...
@@ -306,6 +306,9 @@ class SupplierApiController extends Controller
$supplierIds
=
$request
->
get
(
'supplier_ids'
);
$supplierIds
=
explode
(
','
,
$supplierIds
);
$supplierService
=
new
SupplierService
();
if
(
empty
(
$purchaseUid
))
{
$this
->
response
(
-
1
,
'请选择渠道开发员'
);
}
$supplierService
->
batchAllocatePurchaseUser
(
$supplierIds
,
$purchaseUid
);
$this
->
response
(
0
,
'批量分配渠道员成功'
);
}
...
...
@@ -398,7 +401,7 @@ class SupplierApiController extends Controller
if
(
$check
)
{
$this
->
response
(
0
,
'可以审核'
);
}
else
{
$this
->
response
(
-
1
,
'无法进行审核操作,因为该供应商最后
修改人
和您不属于同一个部门'
);
$this
->
response
(
-
1
,
'无法进行审核操作,因为该供应商最后
(修改人/创建人)
和您不属于同一个部门'
);
}
}
}
app/Http/Services/LogService.php
View file @
1e4618be
...
...
@@ -150,7 +150,7 @@ class LogService
// $diffCols = array_diff($contact['old_contact'], $contact['new_contact']);
$oldContent
=
$this
->
contactDesc
(
$contact
[
'old_contact'
]);
$newContent
=
$this
->
contactDesc
(
$contact
[
'new_contact'
]);
return
$oldContent
.
' 修改为
=>
'
.
$newContent
;
return
$oldContent
.
' 修改为 '
.
$newContent
;
}
//新增
if
(
empty
(
$contact
[
'old_contact'
])
&&
!
empty
(
$contact
[
'new_contact'
]))
{
...
...
app/Http/Services/SupplierAuditService.php
View file @
1e4618be
...
...
@@ -17,6 +17,8 @@ class SupplierAuditService
{
$model
=
new
SupplierChannelModel
();
//判断当前要审核的供应商是不是想要被禁用的
//因为想要禁用,需要审核后才能禁用的,不能直接修改成禁用
//我要找个地方存起来是不是想要禁用
$redis
=
new
RedisModel
();
$disableExist
=
$redis
->
hget
(
'audit_disable_supplier_list'
,
$supplierId
);
if
(
$disableExist
)
{
...
...
@@ -27,14 +29,21 @@ class SupplierAuditService
}
}
//先找出原来供应商的状态
$supplierModel
=
new
SupplierChannelModel
();
$originStatus
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'status'
);
//如果原来的状态是-1,就是第一次新增的待审核,审核通过状态是变成1(待复审)
$dbStatus
=
$originStatus
==
-
1
?
1
:
$status
;
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
$
s
tatus
,
'status'
=>
$
dbS
tatus
,
'reject_reason'
=>
$rejectReason
,
]);
if
(
$disableExist
)
{
$redis
->
hdel
(
'audit_disable_supplier_list'
,
$supplierId
);
}
$action
=
'审核供应商'
;
if
(
$result
)
{
//记录日志
if
(
$disableExist
)
{
...
...
@@ -45,11 +54,17 @@ class SupplierAuditService
$service
->
syncSupplierToErp
(
$supplierId
);
}
}
else
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'审核通过'
:
'审核不通过,原因是 : '
.
$rejectReason
;
//如果原来的状态是-1,就是第一次新增的待审核,审核通过状态是变成1(待复审)
if
(
$originStatus
==
-
1
)
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'初审通过'
:
'初审不通过,原因是 : '
.
$rejectReason
;
$action
=
'初审供应商'
;
}
else
{
$auditStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
'审核通过'
:
'审核不通过,原因是 : '
.
$rejectReason
;
}
}
$logService
=
new
LogService
();
$content
=
$auditStatus
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'审核供应商'
,
$content
);
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
$action
,
$content
);
}
//审核状态为待审核(即第一次新增)时,不需要推送到金蝶
...
...
@@ -65,17 +80,27 @@ class SupplierAuditService
//要判断审核供应商的最后修改人,是不是属于当前审批人的部门或者部下,是才能让他审核
public
function
CheckCanAuditSupplier
(
$supplierId
)
{
//忽略上面所说的限制(权限)
if
(
checkPerm
(
'IgnoreAuditCheck'
))
{
return
true
;
}
$supplierModel
=
new
SupplierChannelModel
();
$supplier
=
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$auditUserId
=
request
()
->
user
->
userId
;
$logModel
=
new
LogModel
();
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$lastUpdateUserId
=
$log
[
'admin_id'
];
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
()
->
toArray
();
//判断供应商,如果是第一次新增的供应商,要去判断创建人是否属于审核人相关的部门
//别问我为啥不加多一个状态,这个审核流程是突然改成这样子的,没法加...
if
(
$log
[
'action'
]
==
'初审供应商'
)
{
$lastUpdateUserId
=
$supplier
[
'create_uid'
];
}
else
{
$lastUpdateUserId
=
$log
[
'admin_id'
];
}
//审批人只能审批自己的部下修改的供应商
$departmentService
=
new
DepartmentService
();
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
$auditUserId
);
if
(
in_array
(
$lastUpdateUserId
,
$subordinateUserIds
))
{
return
true
;
}
...
...
app/Http/Services/SupplierContactService.php
View file @
1e4618be
...
...
@@ -103,7 +103,7 @@ class SupplierContactService
'supplier_qq'
,
'supplier_fax'
,
];
$diff
=
array_
diff
(
$oldContact
,
$newContact
);
$diff
=
array_
merge
(
array_diff
(
$oldContact
,
$newContact
),
array_diff
(
$newContact
,
$oldContact
)
);
unset
(
$diff
[
'update_time'
]);
$changeField
=
array_keys
(
$diff
);
foreach
(
$changeField
as
$filed
)
{
...
...
app/Http/Validators/ReceiptValidator.php
View file @
1e4618be
...
...
@@ -18,7 +18,7 @@ class ReceiptValidator
"bank_name"
=>
"required"
,
"bank_adderss"
=>
"required"
,
"account_no"
=>
"required"
,
"receipt_type"
=>
'required'
,
// "account_name" => "required",
"certificate"
=>
"required"
,
];
...
...
@@ -37,7 +37,8 @@ class ReceiptValidator
private
function
messages
()
{
return
[
'bank_name.required'
=>
'开户名称不能为空'
,
'receipt_type.required'
=>
'开户名称不能为空'
,
'bank_name.required'
=>
'类型不能为空'
,
'bank_adderss.required'
=>
'开户行不能为空'
,
'swift_code.required'
=>
'电汇号码 Swift Code 不能为空'
,
'account_no.required'
=>
'银行账号不能为空'
,
...
...
app/Http/Validators/SupplierContactValidator.php
View file @
1e4618be
...
...
@@ -24,6 +24,11 @@ class SupplierContactValidator
$messages
=
$this
->
messages
();
$validator
=
Validator
::
make
(
$data
,
$rules
,
$messages
);
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
return
$validator
->
errors
()
->
first
();
}
$contactModel
=
new
SupplierContactModel
();
//如果是原厂或者代理商性质的供应商,联系人不能重复
$supplierModel
=
new
SupplierChannelModel
();
...
...
@@ -46,10 +51,6 @@ class SupplierContactValidator
}
}
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
return
$validator
->
errors
()
->
first
();
}
}
private
function
messages
()
...
...
app/Http/routes.php
View file @
1e4618be
...
...
@@ -40,6 +40,40 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_account/{key}'
,
'SupplierAccountApiController@Entrance'
);
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$a
=
[
"contact_id"
=>
1717
,
"supplier_id"
=>
12253
,
"supplier_consignee"
=>
""
,
"supplier_telephone"
=>
""
,
"supplier_fax"
=>
""
,
"supplier_qq"
=>
""
,
"supplier_mobile"
=>
""
,
"supplier_email"
=>
""
,
"supplier_position"
=>
""
,
"can_check_uids"
=>
"10105"
,
"add_time"
=>
0
,
"update_time"
=>
0
,
"admin_id"
=>
0
,
];
$b
=
[
"contact_id"
=>
1717
,
"supplier_id"
=>
12253
,
"supplier_consignee"
=>
"延寿观呼吸"
,
"supplier_telephone"
=>
"1221"
,
"supplier_fax"
=>
""
,
"supplier_qq"
=>
""
,
"supplier_mobile"
=>
"18825159814"
,
"supplier_email"
=>
"123@qq.com"
,
"supplier_position"
=>
"测试员"
,
"can_check_uids"
=>
"10105"
,
"add_time"
=>
0
,
"update_time"
=>
1623998098
,
"admin_id"
=>
0
,
];
$diff
=
array_diff
(
$b
,
$a
);
$diff2
=
array_diff
(
$a
,
$b
);
dd
(
$diff
,
$diff2
);
// set_time_limit(0);
// sleep(30);
// echo 123;
...
...
config/fixed.php
View file @
1e4618be
...
...
@@ -87,12 +87,11 @@ return [
'SupplierStatus'
=>
[
// -3 => '已拉黑',
-
2
=>
'禁止交易'
,
-
1
=>
'待审核'
,
1
=>
'待复审'
,
3
=>
'未通过'
,
2
=>
'已通过'
,
3
=>
'未通过'
-
2
=>
'禁止交易'
,
],
'Currency'
=>
[
...
...
resources/views/script/SupplierListScript.blade.php
View file @
1e4618be
...
...
@@ -223,10 +223,10 @@
layer
.
msg
(
'该供应商已经被审核'
,
{
icon
:
5
})
return
}
if
(
status
===
-
1
)
{
layer
.
msg
(
'要待复审的供应商才可以审核'
,
{
icon
:
5
});
return
}
//
if (status === -1) {
//
layer.msg('要待复审的供应商才可以审核', {icon: 5});
//
return
//
}
let
checkAuditMsg
=
checkCanAudit
(
supplierId
);
if
(
checkAuditMsg
!==
''
)
{
layer
.
msg
(
checkAuditMsg
,
{
icon
:
5
});
...
...
@@ -299,6 +299,12 @@
layer
.
msg
(
'选择的供应商里,存在审核状态的供应商,无法分配渠道员'
,
{
icon
:
5
})
return
}
let
is_type
=
Array
.
from
(
data
,
({
is_type
})
=>
is_type
);
//分配采购员的多选操作,需要先去判断是否存在审核中的供应商,存在的话,要提示
if
(
is_type
.
indexOf
(
1
)
!==
-
1
)
{
layer
.
msg
(
'选择的供应商里,存在非正式供应商,请先将其转正'
,
{
icon
:
5
})
return
}
layer
.
open
({
type
:
2
,
content
:
'/supplier/BatchAllocatePurchaseUser?view=iframe&supplier_ids='
+
supplierIds
,
...
...
resources/views/script/UpdateSupplierScript.blade.php
View file @
1e4618be
...
...
@@ -19,7 +19,7 @@
}
else
if
(
data
.
field
.
status
===
'-1'
)
{
confirmMessage
=
'确定要提交新增供应商信息吗?一旦提交,该供应商就会进入待复审阶段,审核过程中无法进行信息修改'
}
else
{
confirmMessage
=
'确定要修改供应商信息吗?一旦修改,该供应商就会再次进入待复审阶段,审核过程中无法进行信息修改'
confirmMessage
=
'确定要修改供应商信息吗?一旦修改
关键字段
,该供应商就会再次进入待复审阶段,审核过程中无法进行信息修改'
}
layer
.
confirm
(
confirmMessage
,
function
(
index
)
{
let
res
=
ajax
(
'/api/supplier/UpdateSupplier'
,
data
.
field
)
...
...
resources/views/web/AddSupplierReceipt.blade.php
View file @
1e4618be
...
...
@@ -12,7 +12,7 @@
<label
class=
"layui-form-label"
>
银行类型 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"radio"
name=
"receipt_type"
lay-filter=
"receipt_type"
value=
"1"
title=
"国内"
@
if
(
!
empty
($
receipt
['
receipt_type
'])&&$
receipt
['
receipt_type
']==
1
)
@
if
(
(!
empty
($
receipt
['
receipt_type
'])&&$
receipt
['
receipt_type
']==
1
)||
empty
($
receipt
)
)
checked
@
endif
>
...
...
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