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
dd172f3b
Commit
dd172f3b
authored
Nov 03, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
service/create
parent
fd667996
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
314 additions
and
0 deletions
+314
-0
igirl-channel-gateway/app/base/api/impl/action/service.js
+47
-0
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsServiceSve.js
+265
-0
igirl-channel-gateway/app/config/settings.js
+2
-0
No files found.
igirl-channel-gateway/app/base/api/impl/action/service.js
View file @
dd172f3b
...
@@ -8,13 +8,60 @@ class TradetransferAPI extends APIBase {
...
@@ -8,13 +8,60 @@ class TradetransferAPI extends APIBase {
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
channelApiUrl
=
settings
.
channelApiUrl
();
this
.
channelApiUrl
=
settings
.
channelApiUrl
();
this
.
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
this
.
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
this
.
utilsServiceSve
=
system
.
getObject
(
"service.utilsSve.utilsServiceSve"
);
}
}
async
create
(
pobj
)
{
async
create
(
pobj
)
{
console
.
log
(
pobj
);
console
.
log
(
pobj
);
// 校验必填 pannong 2.1
var
checkResult
=
await
this
.
serviceCreateCheck
(
pobj
);
if
(
checkResult
.
status
!=
0
)
{
return
checkResult
;
}
var
result
=
await
this
.
utilsServiceSve
.
submitService
(
pobj
);
return
result
}
async
serviceCreateCheck
(
pobj
)
{
if
(
!
pobj
.
bizId
)
{
if
(
!
pobj
.
bizId
)
{
return
system
.
getResult
(
null
,
"bizId cannot be empty"
);
return
system
.
getResult
(
null
,
"bizId cannot be empty"
);
}
}
if
(
!
pobj
.
contactName
)
{
return
system
.
getResult
(
null
,
"contactName cannot be empty"
);
}
if
(
!
pobj
.
contactMobile
)
{
return
system
.
getResult
(
null
,
"contactName cannot be empty"
);
}
if
(
!
pobj
.
timeUnit
)
{
return
system
.
getResult
(
null
,
"contactName cannot be empty"
);
}
if
(
!
pobj
.
quantity
)
{
return
system
.
getResult
(
null
,
"contactName cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
)
{
return
system
.
getResult
(
null
,
"contactName cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
.
companyName
)
{
return
system
.
getResult
(
null
,
"companyName cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
.
taxpayerType
)
{
return
system
.
getResult
(
null
,
"taxpayerType cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
.
acctgSystemId
)
{
return
system
.
getResult
(
null
,
"acctgSystemId cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
.
companyForm
)
{
return
system
.
getResult
(
null
,
"companyForm cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
.
industry
)
{
return
system
.
getResult
(
null
,
"industry cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
.
taxpayerNumber
)
{
return
system
.
getResult
(
null
,
"taxpayerNumber cannot be empty"
);
}
if
(
!
pobj
.
companyInfo
.
companyArea
)
{
return
system
.
getResult
(
null
,
"companyArea cannot be empty"
);
}
return
system
.
getResultSuccess
()
return
system
.
getResultSuccess
()
}
}
}
}
...
...
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsServiceSve.js
0 → 100644
View file @
dd172f3b
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
//商标查询操作
class
UtilsNeedSve
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
channelApiUrl
=
settings
.
channelApiUrl
();
this
.
centerChannelUrl
=
settings
.
centerChannelUrl
();
this
.
appInfo
=
{
pannong
:
{
appkey
:
settings
.
pannongAppKey
,
secret
:
settings
.
pannongSecret
}
};
}
async
getCenterToken
()
{
var
self
=
this
;
var
reqTokenUrl
=
this
.
centerChannelUrl
+
"/api/opreceive/accessAuth/getAppTokenByAppKey"
;
var
reqParam
=
self
.
appInfo
[
"pannong"
];
if
(
!
reqParam
.
appkey
||
!
reqParam
.
secret
)
{
return
system
.
getResult
(
null
,
"reqType类型有误,请求失败"
);
}
var
param
=
{
"actionType"
:
"getAppTokenByAppKey"
,
"actionBody"
:
{
"appkey"
:
reqParam
.
appkey
,
"secret"
:
reqParam
.
secret
}
};
var
rtn
=
await
this
.
execlient
.
execPost
(
param
,
reqTokenUrl
);
if
(
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"获取token失败"
);
}
var
tokenResult
=
JSON
.
parse
(
rtn
.
stdout
);
return
tokenResult
;
}
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
// 2020 1103 lin 新增 磐农2.1 创建服务单
async
submitService
(
pobj
)
{
var
tokenInfo
=
await
this
.
getCenterToken
();
if
(
tokenInfo
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
"submitService get token fail"
)
}
var
token
=
tokenInfo
.
data
.
token
;
var
userpin
=
""
;
if
(
pobj
.
contactMobile
)
{
//获取用户userpin
var
userparam
=
{
actionType
:
"getLoginByUserName"
,
actionBody
:
{
// 为什么2.1 有userId 但是不用 还要用mobile。因为模式不支持
"channelUserId"
:
pobj
.
contactMobile
,
"mobile"
:
pobj
.
contactMobile
,
"userName"
:
pobj
.
contactName
?
pobj
.
contactName
:
pobj
.
contactMobile
}
};
var
url
=
settings
.
centerChannelUrl
()
+
"/api/auth/accessAuth/springBoard"
;
var
userpinResultTmp
=
await
this
.
execlient
.
execPostTK
(
userparam
,
url
,
tokenInfo
.
data
.
token
);
if
(
userpinResultTmp
.
status
!=
0
&&
userpinResultTmp
.
status
!=
2060
)
{
return
system
.
getResult
(
null
,
"submitService get userpin fail"
)
}
userpin
=
userpinResultTmp
.
data
.
userpin
;
if
(
!
userpin
)
{
return
system
.
getResult
(
null
,
"submitService get userpin fail"
)
}
}
//带userpin请求
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/service/springBoard"
;
var
sobj
=
{
// "actionType": pobj.action_type,
"actionType"
:
"submitService"
,
"actionBody"
:
pobj
}
var
rtn
=
rtn
=
await
this
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
userpin
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"submitService opreceive fail"
)
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
status
==
0
)
{
return
result
;
}
else
{
return
system
.
getResult
(
null
,
result
.
msg
)
}
}
// 2020 0926 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
async
needCloseAliEsp
(
pobj
)
{
var
tokenInfo
=
await
this
.
getCenterToken
();
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
var
token
=
tokenInfo
.
data
.
token
;
var
userpin
=
""
;
if
(
pobj
.
mobile
)
{
//获取用户userpin
var
userparam
=
{
actionType
:
"getLoginByUserName"
,
actionBody
:
{
"channelUserId"
:
pobj
.
mobile
,
"mobile"
:
pobj
.
mobile
,
"userName"
:
pobj
.
userName
?
pobj
.
userName
:
pobj
.
mobile
}
};
var
self
=
this
;
var
url
=
settings
.
centerChannelUrl
()
+
"/api/auth/accessAuth/springBoard"
;
var
userpinResultTmp
=
await
this
.
execlient
.
execPostTK
(
userparam
,
url
,
tokenInfo
.
data
.
token
);
if
(
userpinResultTmp
.
status
!=
0
&&
userpinResultTmp
.
status
!=
2060
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
userpin
=
userpinResultTmp
.
data
.
userpin
;
if
(
!
userpin
)
{
// return { "message": "网络错误", "data": {}, "code": -102 }
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
}
//带userpin请求
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/edi/springBoard"
;
var
sobj
=
{
"actionType"
:
pobj
.
action_type
,
"actionBody"
:
pobj
}
var
rtn
=
rtn
=
await
this
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
userpin
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
status
==
0
)
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
else
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
}
// 2020 0927 lin 新增 阿里文网文 服务商侧提供接口2.3 服务单通知服务商
async
produceNoticeAliEsp
(
pobj
)
{
var
tokenInfo
=
await
this
.
getCenterToken
();
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
this
.
getUUID
(),
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
var
token
=
tokenInfo
.
data
.
token
;
var
userpin
=
""
;
//带userpin请求
var
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/edi/springBoard"
;
var
sobj
=
{
"actionType"
:
pobj
.
action_type
,
"actionBody"
:
pobj
}
var
rtn
=
rtn
=
await
this
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
userpin
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
status
==
0
)
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
else
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
}
// 2020 0928 lin 新增 阿里文网文 服务商侧提供接口2.4 ⽤户⽅案反馈通知服务商
async
soulutionFeebackAliEsp
(
pobj
)
{
var
tokenInfo
=
await
this
.
getCenterToken
();
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
var
token
=
tokenInfo
.
data
.
token
;
var
userpin
=
""
;
//带userpin请求
var
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/edi/springBoard"
;
var
sobj
=
{
"actionType"
:
pobj
.
action_type
,
"actionBody"
:
pobj
}
var
rtn
=
rtn
=
await
this
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
userpin
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
status
==
0
)
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
else
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
}
}
module
.
exports
=
UtilsNeedSve
;
igirl-channel-gateway/app/config/settings.js
View file @
dd172f3b
...
@@ -20,6 +20,8 @@ var settings = {
...
@@ -20,6 +20,8 @@ var settings = {
secret
:
"7cbb846246874167b5c7e01cd0016c88"
,
secret
:
"7cbb846246874167b5c7e01cd0016c88"
,
salt
:
"%iatpD1gcxz7iF#B"
,
salt
:
"%iatpD1gcxz7iF#B"
,
cacheprefix
:
"channelgateway"
,
cacheprefix
:
"channelgateway"
,
pannongAppKey
:
"202011031523"
,
pannongSecret
:
"7cbb892450174167b5c7e01we4717z51"
,
usertimeout
:
3600
,
//单位秒
usertimeout
:
3600
,
//单位秒
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
4005
,
port
:
process
.
env
.
NODE_PORT
||
4005
,
...
...
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