Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
231cb456
Commit
231cb456
authored
Aug 28, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gyq
parent
64431ec3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
164 additions
and
81 deletions
+164
-81
center-manage/app/base/service/impl/common/channelhandlers/tx.js
+88
-81
center-manage/app/base/system.js
+76
-0
No files found.
center-manage/app/base/service/impl/common/channelhandlers/tx.js
View file @
231cb456
...
@@ -527,97 +527,104 @@ class TxHandler {
...
@@ -527,97 +527,104 @@ class TxHandler {
}
}
async
ServiceCreate
(
datajson
)
{
//获取融易算服务实例到队列
async
ServiceCreate
(
datajson
)
{
//获取融易算服务实例到队列
try
{
var
obj
=
{
var
rc
=
system
.
getObject
(
"util.execClient"
);
"pushUrl"
:
this
.
bookUrl
+
"/deliverybillCtl/insertInfo"
,
var
requrl
=
this
.
queueUrl
;
"actionType"
:
"insertInfo"
,
var
params
=
{
"messageBody"
:
datajson
,
"actionType"
:
"produceData"
,
"requestId"
:
datajson
.
requestId
,
"actionBody"
:
{
"headData"
:
{
"pushUrl"
:
this
.
bookUrl
+
"/deliverybillCtl/insertInfo"
,
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
"actionType"
:
"insertInfo"
,
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
"identifyCode"
:
"book-manage"
,
"messageBody"
:
datajson
,
"headData"
:
{
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
}
}
}
}
var
rtn
=
await
rc
.
execPost
(
params
,
requrl
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
}
if
(
j
.
status
==
1
)
{
return
systetm
.
rysQueueOper
(
obj
);
return
{
}
"requestId"
:
datajson
.
requestId
,
"success"
:
true
,
async
ServiceUpdate
(
datajson
)
{
//更新融易算服务信息到队列
"errorCode"
:
0
,
var
obj
=
{
"errorMsg"
:
"ok"
,
"pushUrl"
:
this
.
bookUrl
+
"/deliverybillCtl/updateServer"
,
"data"
:
null
"actionType"
:
"updateServer"
,
}
"messageBody"
:
datajson
,
}
else
{
"requestId"
:
datajson
.
requestId
,
return
{
"headData"
:
{
"requestId"
:
datajson
.
requestId
,
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
"success"
:
false
,
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
"errorCode"
:
-
1
,
"errorMsg"
:
rtn
.
stderr
,
"data"
:
null
}
}
}
}
catch
(
error
)
{
return
{
}
"requestId"
:
datajson
.
requestId
,
return
systetm
.
rysQueueOper
(
obj
);
"success"
:
false
,
}
"errorCode"
:
-
1
,
"errorMsg"
:
error
,
//融易算创建需求
"data"
:
null
async
LeadsCreate
(
datajson
)
{
var
obj
=
{
"pushUrl"
:
this
.
bookUrl
+
"/bizOptCtl/insertInfo"
,
"actionType"
:
"insertInfo"
,
"messageBody"
:
datajson
,
//"requestId":datajson.requestId,
"headData"
:
{
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
}
}
}
}
return
systetm
.
rysQueueOper
(
obj
);
}
}
async
ServiceUpdate
(
datajson
)
{
//更新服务信息到队列
try
{
//融易算更新需求状态
var
rc
=
system
.
getObject
(
"util.execClient"
);
async
UpdateLeads
(
datajson
)
{
var
requrl
=
this
.
queueUrl
;
var
obj
=
{
var
params
=
{
"pushUrl"
:
this
.
bookUrl
+
"/bizoptCtl/updatepayStatusByDemandCode"
,
"actionType"
:
"produceData"
,
"actionType"
:
"updatepayStatusByDemandCode"
,
"actionBody"
:
{
"messageBody"
:
datajson
,
"pushUrl"
:
this
.
bookUrl
+
"/deliverybillCtl/updateServer"
,
//"requestId":datajson.requestId,
"actionType"
:
"updateServer"
,
"headData"
:
{
"identifyCode"
:
"book-manage"
,
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
"messageBody"
:
datajson
,
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
"headData"
:
{
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
}
}
}
}
var
rtn
=
await
rc
.
execPost
(
params
,
requrl
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
}
if
(
j
.
status
==
1
)
{
return
systetm
.
rysQueueOper
(
obj
);
return
{
"requestId"
:
datajson
.
requestId
,
}
"success"
:
true
,
"errorCode"
:
0
,
// 融易算服务状态变更通知
"errorMsg"
:
"ok"
,
async
ServiceStatusNotify
(
datajson
)
{
"data"
:
null
let
ab
=
Object
.
assign
({},
datajson
);
}
ab
.
status
=
ab
.
status
===
6
?
"inserivice"
:
"closed"
;
}
else
{
var
obj
=
{
return
{
"pushUrl"
:
this
.
bookUrl
+
"/deliverybillCtl/notifyServiceStatusChange"
,
"requestId"
:
datajson
.
requestId
,
"actionType"
:
"notifyServiceStatusChange"
,
"success"
:
false
,
"messageBody"
:
ab
,
"errorCode"
:
-
1
,
"requestId"
:
ab
.
requestId
,
"errorMsg"
:
rtn
.
stderr
,
"headData"
:
{
"data"
:
null
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
}
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
}
}
}
catch
(
error
)
{
return
{
}
"requestId"
:
datajson
.
requestId
,
return
systetm
.
rysQueueOper
(
obj
);
"success"
:
false
,
}
"errorCode"
:
-
1
,
"errorMsg"
:
error
,
//融易算报表确认
"data"
:
null
async
ConfirmReport
(
datajson
){
var
obj
=
{
"pushUrl"
:
this
.
bookUrl
+
"/deliverybillCtl/"
,
"actionType"
:
"insertInfo"
,
"messageBody"
:
datajson
,
//"requestId":datajson.requestId,
"headData"
:
{
'Authorization'
:
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ'
,
'XAPPKEY'
:
'f6b59b74-f943-4735-bb86-e05d6b7fd78e'
}
}
}
}
return
systetm
.
rysQueueOper
(
obj
);
}
}
}
}
module
.
exports
=
new
TxHandler
();
module
.
exports
=
new
TxHandler
();
...
...
center-manage/app/base/system.js
View file @
231cb456
var
fs
=
require
(
"fs"
);
var
fs
=
require
(
"fs"
);
var
objsettings
=
require
(
"../config/objsettings"
);
var
objsettings
=
require
(
"../config/objsettings"
);
var
settings
=
require
(
"../config/settings"
);
var
settings
=
require
(
"../config/settings"
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
request
=
require
(
'request'
);
const
request
=
require
(
'request'
);
const
cryptoJS
=
require
(
'crypto-js'
);
const
cryptoJS
=
require
(
'crypto-js'
);
class
System
{
class
System
{
...
@@ -328,6 +329,81 @@ class System {
...
@@ -328,6 +329,81 @@ class System {
return
plaintext
;
return
plaintext
;
}
}
static
getRysResult
(
reqId
,
err
=
"not err"
)
{
if
(
err
===
"not err"
)
{
return
{
"requestId"
:
reqId
,
"success"
:
true
,
"errorCode"
:
0
,
"errorMsg"
:
"ok"
,
"data"
:
null
}
}
else
{
return
{
"requestId"
:
reqId
,
"success"
:
false
,
"errorCode"
:
-
1
,
"errorMsg"
:
err
,
"data"
:
null
}
}
}
/**
* 队列操作
* @param {json}
pushUrl string 推送URL地址
actionType string 推送地址接收时的功能名称
notifyUrl string 推送成功后通知的Url
messageBody json 推送的业务消息,必须有一项对象属性值
headData json 请求头信息
requestId string 请求id
*/
static
async
rysQueueOper
(
obj
)
{
if
(
obj
.
pushUrl
&&
obj
.
actionType
&&
obj
.
messageBody
)
{
try
{
var
rc
=
this
.
getObject
(
"util.execClient"
);
var
reqUrl
=
settings
.
queueUrl
;
var
reqId
=
uuidv4
()
var
param
=
{
actionType
:
"produceData"
,
actionBody
:
{
pushUrl
:
obj
.
pushUrl
,
actionType
:
obj
.
actionType
,
identifyCode
:
"book-manage"
,
messageBody
:
obj
.
messageBody
}
}
if
(
obj
.
notifyUrl
)
{
param
.
actionBody
.
notifyUrl
=
obj
.
notifyUrl
;
}
if
(
obj
.
headData
)
{
param
.
actionBody
.
headData
;
}
if
(
obj
.
requestId
)
{
param
.
requestId
=
obj
.
requestId
;
reqId
=
obj
.
requestId
;
}
var
result
=
await
rc
.
execPost
(
param
,
reqUrl
);
var
j
=
JSON
.
parse
(
result
.
stdout
);
if
(
j
.
status
===
1
)
{
return
this
.
getRysResult
(
reqId
);
}
else
{
return
this
.
getRysResult
(
reqId
,
result
.
stderr
);
}
}
catch
(
error
)
{
return
this
.
getRysResult
(
reqId
,
error
);
}
}
else
{
return
this
.
getRysResult
(
reqId
,
"参数错误!"
);
}
}
}
}
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
var
o
=
{
var
o
=
{
...
...
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