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
f665e1ec
authored
Oct 15, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp
parent
d2ee5a8a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
170 additions
and
1 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/AuditCenterService.php
app/Http/Services/SupplierAuditService.php
config/website.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
f665e1ec
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Http\Controllers\Api
;
namespace
App\Http\Controllers\Api
;
use
Cookie
;
use
Cookie
;
use
Exception
;
use
App\Model\LogModel
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\RedisModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
...
@@ -412,11 +413,15 @@ class SupplierApiController extends Controller
...
@@ -412,11 +413,15 @@ class SupplierApiController extends Controller
$this
->
response
(
-
1
,
'不同意时必须填写原因'
);
$this
->
response
(
-
1
,
'不同意时必须填写原因'
);
}
}
$supplierId
=
$request
->
get
(
'supplier_id'
);
$supplierId
=
$request
->
get
(
'supplier_id'
);
try
{
$service
=
new
SupplierAuditService
();
$service
=
new
SupplierAuditService
();
$result
=
$service
->
auditSupplier
(
$supplierId
,
$status
,
$rejectReason
);
$result
=
$service
->
auditSupplier
(
$supplierId
,
$status
,
$rejectReason
);
if
(
!
$result
)
{
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'审核失败'
);
$this
->
response
(
-
1
,
'审核失败'
);
}
}
}
catch
(
Exception
$e
)
{
$this
->
response
(
-
1
,
$e
->
getMessage
());
}
$this
->
response
(
0
,
'审核成功'
);
$this
->
response
(
0
,
'审核成功'
);
}
}
...
...
app/Http/Services/AuditCenterService.php
0 → 100644
View file @
f665e1ec
<?php
namespace
App\Http\Services
;
use
Exception
;
use
GuzzleHttp\Client
;
use
Illuminate\Support\Facades\Log
;
class
AuditCenterService
{
const
SYSTEM_ID
=
1
;
//审批状态 0-待审核 1-审核中 2-审核完成 -1-审核拒绝 -2-审核撤销
const
APPROVAL_STATUS_WAIT
=
0
;
const
APPROVAL_STATUS_ING
=
1
;
const
APPROVAL_STATUS_FINISH
=
2
;
const
APPROVAL_STATUS_REFUSE
=
-
1
;
const
APPROVAL_STATUS_CANCEL
=
-
2
;
const
TYPE_SUPPLIER_AUDIT
=
'supplier_audit'
;
public
static
function
getAuditInfoByIdAndType
(
$id
,
$type
)
{
$requestData
=
[
'bill_type'
=>
$type
,
'source_id'
=>
$id
,
'system_id'
=>
self
::
SYSTEM_ID
,
];
$response
=
self
::
requestAudit
(
"/sync/bill/getBillInfo"
,
$requestData
);
if
(
$response
[
'code'
]
!=
0
)
{
throw
new
Exception
(
$response
[
'msg'
]);
}
return
$response
[
'data'
];
}
public
static
function
getAuditInfoByBillId
(
$billId
)
{
$requestData
=
[
'bill_id'
=>
$billId
,
];
$response
=
self
::
requestAudit
(
"/sync/bill/getBillInfo"
,
$requestData
);
if
(
$response
[
'code'
]
!=
0
)
{
throw
new
Exception
(
$response
[
'msg'
]);
}
return
$response
[
'data'
];
}
public
static
function
audit
(
$billId
,
$approvalUid
,
$approvalStatus
,
$remark
)
{
$requestData
=
[
'bill_id'
=>
$billId
,
'approval_uid'
=>
$approvalUid
,
'approval_status'
=>
$approvalStatus
,
'remark'
=>
$remark
,
];
$response
=
self
::
requestAudit
(
"/sync/bill/audit"
,
$requestData
);
if
(
$response
[
'code'
]
!=
0
)
{
throw
new
Exception
(
$response
[
'msg'
]);
}
return
$response
[
'data'
];
}
public
static
function
getAuditFlowInfo
(
$type
,
$userId
,
$orgId
=
null
)
{
$requestData
=
[
"system_id"
=>
self
::
SYSTEM_ID
,
"bill_type"
=>
$type
,
"apply_uid"
=>
$userId
,
"org_id"
=>
$orgId
,
];
$response
=
self
::
requestAudit
(
"/sync/flow/getFlowInfo"
,
$requestData
);
if
(
$response
[
'code'
]
!=
0
)
{
throw
new
Exception
(
$response
[
'msg'
]);
}
return
$response
[
'data'
];
}
public
static
function
getAuditList
(
$billType
,
$params
)
{
//page
//limit
//source_id
//source_sn
//org_id
//system_id
//bill_type
//approval_status
//apply_uids
//apply_dept_ids
//apply_time
//update_time
$requestData
=
$params
;
$requestData
[
'system_id'
]
=
self
::
SYSTEM_ID
;
$response
=
self
::
requestAudit
(
"/sync/bill/getBillList"
,
$requestData
);
if
(
$response
[
'code'
]
!=
0
)
{
throw
new
Exception
(
$response
[
'msg'
]);
}
return
$response
[
'data'
];
}
public
static
function
addAudit
(
$params
,
$applyUid
,
$createUid
)
{
//{
// "flow_id": "6",
// "source_id": "1",
// "source_sn": "1",
// "org_id": "1",
// "system_id": "5",
// "trigger_reason": "测试触发",
// "current_node": "null",
// "apply_uid": "1580",
// "create_uid": "1580",
// "apply_node_ids": "41,42"
//}
$requestData
=
[
'flow_id'
=>
$params
[
'flow_id'
],
'source_id'
=>
$params
[
'source_id'
],
'source_sn'
=>
$params
[
'source_sn'
],
'org_id'
=>
$params
[
'org_id'
],
'system_id'
=>
self
::
SYSTEM_ID
,
'trigger_reason'
=>
array_get
(
$params
,
'trigger_reason'
,
''
),
'current_node'
=>
array_get
(
$params
,
'current_node'
,
''
),
'apply_uid'
=>
$applyUid
,
'create_uid'
=>
$createUid
,
'apply_node_ids'
=>
array_get
(
$params
,
'apply_node_ids'
,
''
),
];
$response
=
self
::
requestAudit
(
"/sync/bill/addBill"
,
$requestData
);
if
(
$response
[
'code'
]
!=
0
)
{
throw
new
Exception
(
$response
[
'msg'
]);
}
return
$response
[
'data'
];
}
public
static
function
requestAudit
(
$route
,
$data
)
{
$url
=
config
(
"website.AuditCenterUrl"
);
$url
=
$url
.
$route
;
try
{
Log
::
info
(
"---------------同步请求audit接口
{
$route
}
------------------"
);
Log
::
info
(
json_encode
(
$data
));
$client
=
new
Client
([
'headers'
=>
[
'Content-Type'
=>
'application/json'
]]);
$response
=
$client
->
post
(
$url
,
[
'json'
=>
$data
]);
$result
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
if
(
$result
[
'code'
]
!=
0
)
{
throw
new
Exception
(
$result
[
'msg'
]);
}
Log
::
info
(
"---------------同步请求audit接口
{
$route
}
-----audit返回结果-------------"
);
return
$result
;
}
catch
(
\Throwable
$e
)
{
throw
$e
;
}
}
}
app/Http/Services/SupplierAuditService.php
View file @
f665e1ec
...
@@ -12,6 +12,15 @@ class SupplierAuditService
...
@@ -12,6 +12,15 @@ class SupplierAuditService
{
{
public
function
auditSupplier
(
$supplierId
,
$status
,
$rejectReason
)
public
function
auditSupplier
(
$supplierId
,
$status
,
$rejectReason
)
{
{
//先去获取审核流信息
$auditFlowInfo
=
AuditCenterService
::
getAuditFlowInfo
(
AuditCenterService
::
TYPE_SUPPLIER_AUDIT
,
request
()
->
user
->
userId
);
//再去判断当前是否有审核单据
$auditBillInfo
=
AuditCenterService
::
getAuditInfoByIdAndType
(
$supplierId
,
AuditCenterService
::
TYPE_SUPPLIER_AUDIT
);
dd
(
$auditFlowInfo
);
$model
=
new
SupplierChannelModel
();
$model
=
new
SupplierChannelModel
();
//先找出原来供应商的状态
//先找出原来供应商的状态
...
...
config/website.php
View file @
f665e1ec
...
@@ -46,5 +46,6 @@ return [
...
@@ -46,5 +46,6 @@ return [
'SkipSendEmail'
=>
env
(
'skip_send_email'
),
'SkipSendEmail'
=>
env
(
'skip_send_email'
),
'CubeUrl'
=>
env
(
'CUBE_URL'
),
'CubeUrl'
=>
env
(
'CUBE_URL'
),
'FootstoneCurlUrl'
=>
'http://footstone.liexindev.net/open/curl?url='
,
'FootstoneCurlUrl'
=>
'http://footstone.liexindev.net/open/curl?url='
,
'GoodsServerUrl'
=>
'http://192.168.1.237:60014'
'GoodsServerUrl'
=>
'http://192.168.1.237:60014'
,
'AuditCenterUrl'
=>
'http://audit_center.liexindev.net'
,
];
];
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