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
95413a20
authored
Jun 16, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改联系人忽略审核字段
parent
efaacd21
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
28 deletions
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierContactService.php
app/Http/Services/SupplierService.php
app/Http/Validators/SupplierContactValidator.php
resources/views/script/supplier/SupplierBaseScript.blade.php
app/Http/Services/SupplierAuditService.php
View file @
95413a20
...
...
@@ -67,7 +67,6 @@ class SupplierAuditService
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$supplier
[
'last_update_'
]
=
$log
[
'admin_name'
]
?:
'无'
;
$lastUpdateUserId
=
$log
[
'admin_id'
];
}
//判断是否为待跟进供应商
...
...
@@ -97,7 +96,7 @@ class SupplierAuditService
public
function
checkHasAllRequireField
(
$supplier
)
{
//先检查基础字段
if
(
empty
(
$supplier
[
'supplier_name'
])
||
empty
(
$supplier
[
'regi
ster_company_name'
]
||
empty
(
$supplier
[
'region'
])
||
empty
(
$supplier
[
'legal_representative'
])
))
{
if
(
empty
(
$supplier
[
'supplier_name'
])
||
empty
(
$supplier
[
'regi
on'
])
||
empty
(
$supplier
[
'legal_representative'
]
))
{
return
false
;
}
if
(
empty
(
$supplier
[
'stockup_type'
])
||
empty
(
$supplier
[
'supplier_group'
])
||
empty
(
$supplier
[
'qualification_photos'
]))
{
...
...
@@ -121,4 +120,35 @@ class SupplierAuditService
}
return
true
;
}
//判断是否要进入待审核状态,因为部分字段修改是不需要走审核的
public
function
checkNeedAudit
(
$supplierId
,
$channel
)
{
$notNeedAuditField
=
[
'register_company_name'
,
'supplier_name_en'
,
'province_id'
,
'city_id'
,
'established_time'
,
'credit_investigation'
];
//先找出目前数据库里面的数据
$selectField
=
array_keys
(
$channel
);
$model
=
new
SupplierChannelModel
;
$supplier
=
$model
->
select
(
$selectField
)
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$changeField
=
[];
foreach
(
$supplier
as
$key
=>
$value
)
{
if
(
$value
!=
$channel
[
$key
])
{
$changeField
[]
=
$key
;
}
}
foreach
(
$changeField
as
$filed
)
{
//只要有一个不存在于不需要审核的字段,就返回需要审核
if
(
!
in_array
(
$filed
,
$notNeedAuditField
))
{
return
true
;
}
}
return
false
;
}
}
\ No newline at end of file
app/Http/Services/SupplierContactService.php
View file @
95413a20
...
...
@@ -46,16 +46,11 @@ class SupplierContactService
//还要将采购的数据整理重新写入
$supplierId
=
$contact
[
'supplier_id'
];
$supplierModel
=
new
SupplierChannelModel
();
$channelUid
=
$supplierModel
->
where
(
'supplier_Id'
,
$supplierId
)
->
value
(
'channel_uid'
);
$channelUid
=
explode
(
','
,
$channelUid
);
$channelUid
=
array_filter
(
$channelUid
,
function
(
$value
)
{
return
!
empty
(
$value
);
});
if
(
!
empty
(
$contact
[
'contact_id'
]))
{
$contact
[
'update_time'
]
=
time
();
$contactId
=
$contact
[
'contact_id'
];
$result
=
$model
->
where
(
'contact_id'
,
$contact
[
'contact_id'
])
->
update
(
$contact
);
$oldContact
=
$model
->
where
(
'contact_id'
,
$contact
[
'contact_id'
])
->
first
()
->
toArray
();
$result
=
$model
->
where
(
'contact_id'
,
$contact
[
'contact_id'
])
->
update
(
$contact
);
}
else
{
$oldContact
=
[];
$contact
[
'add_time'
]
=
time
();
...
...
@@ -68,7 +63,7 @@ class SupplierContactService
if
(
!
empty
(
$canCheckUids
))
{
$canCheckUids
=
array_unique
(
$canCheckUids
->
toArray
());
$canCheckUids
=
implode
(
','
,
$canCheckUids
);
}
else
{
}
else
{
$canCheckUids
=
''
;
}
...
...
@@ -77,31 +72,46 @@ class SupplierContactService
'update_time'
=>
time
(),
]);
$newContact
=
$model
->
where
(
'contact_id'
,
$contactId
)
->
first
()
->
toArray
();
if
(
$result
)
{
//修改供应商为审核状态
$supplierModel
=
new
SupplierChannelModel
();
$supplierStatus
=
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
value
(
'status'
);
//不等于-1的时候是第一次新增供应商,单独操作联系人,不需要修改状态
if
(
$supplierStatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
//如果修改的只是qq和传真,则不需要转成审核
$needAudit
=
$this
->
checkNeedAudit
(
$oldContact
,
$newContact
);
if
(
$needAudit
||
empty
(
$contact
[
'contact_id'
]))
{
//修改供应商为审核状态
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
}
//待审核(没有完善过联系人的,不需要记录日志,让其继续保持一条日志,就叫新增供应商)
if
(
$supplierStatus
!=
SupplierChannelModel
::
STATUS_PENDING
)
{
$logService
=
new
LogService
();
$content
=
!
empty
(
$contact
[
'contact_id'
])
?
'修改联系人'
:
'添加联系人'
;
$remark
=
json_encode
([
'old_contact'
=>
$oldContact
,
'new_contact'
=>
$newContact
,
]);
$logService
->
AddLog
(
$contact
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'修改供应商基本资料'
,
$content
,
$remark
);
}
$logService
=
new
LogService
();
$content
=
!
empty
(
$contact
[
'contact_id'
])
?
'修改联系人'
:
'添加联系人'
;
$remark
=
json_encode
([
'old_contact'
=>
$oldContact
,
'new_contact'
=>
$newContact
,
]);
$logService
->
AddLog
(
$contact
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'修改供应商基本资料'
,
$content
,
$remark
);
}
return
$result
;
}
//判断是否要进入待审核状态,因为部分字段修改是不需要走审核的
private
function
checkNeedAudit
(
$oldContact
,
$newContact
)
{
$notNeedAuditField
=
[
'supplier_qq'
,
'supplier_fax'
,
];
$diff
=
array_diff
(
$oldContact
,
$newContact
);
unset
(
$diff
[
'update_time'
]);
$changeField
=
array_keys
(
$diff
);
foreach
(
$changeField
as
$filed
)
{
//只要有一个不存在于不需要审核的字段,就返回需要审核
if
(
!
in_array
(
$filed
,
$notNeedAuditField
))
{
return
true
;
}
}
return
false
;
}
}
\ No newline at end of file
app/Http/Services/SupplierService.php
View file @
95413a20
...
...
@@ -148,7 +148,11 @@ class SupplierService
}
else
{
$supplierId
=
$this
->
newSupplierId
=
$channel
[
'supplier_id'
];
//要做进一步判断,部分字段修改不需要审核
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_IN_REVIEW
;
$auditService
=
new
SupplierAuditService
();
$needAudit
=
$auditService
->
checkNeedAudit
(
$supplierId
,
$channel
);
if
(
$needAudit
)
{
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_IN_REVIEW
;
}
$channel
[
'update_time'
]
=
time
();
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$channel
);
$this
->
saveSupplierCode
(
$supplierId
);
...
...
app/Http/Validators/SupplierContactValidator.php
View file @
95413a20
...
...
@@ -42,7 +42,7 @@ class SupplierContactValidator
$count
=
$query
->
where
(
'contact_id'
,
'!='
,
$data
[
'contact_id'
])
->
count
();
}
if
(
$count
)
{
return
'供应商已经存在手机号或者邮箱一样的联系人,请联系管理人员查看具体详情'
;
return
'
原厂或者代理商性质的供应商不允许重复的联系人,<br>该
供应商已经存在手机号或者邮箱一样的联系人,请联系管理人员查看具体详情'
;
}
}
...
...
resources/views/script/supplier/SupplierBaseScript.blade.php
View file @
95413a20
...
...
@@ -98,7 +98,7 @@
elem
:
'.city-selector'
,
data
:
{
!!
json_encode
(
$region_data
)
!!
},
title
:
'所在省市 : '
,
name
:
'region'
,
name
:
'region
_test
'
,
// primary_key: 'region_id', // 主键字段
// parent_key: 'parent_id', // 父级字段
// title_key: 'region_name', // 标题字段
...
...
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