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
f375a382
Commit
f375a382
authored
Feb 05, 2021
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 资质查询
parent
4c35ecc2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
13 deletions
+93
-13
center-channel/app/base/service/impl/trademark/icbcSve.js
+64
-12
center-channel/app/base/utils/execClient.js
+28
-0
center-channel/app/config/settings.js
+1
-1
No files found.
center-channel/app/base/service/impl/trademark/icbcSve.js
View file @
f375a382
...
@@ -35,6 +35,40 @@ class IcbcService extends AppServiceBase {
...
@@ -35,6 +35,40 @@ class IcbcService extends AppServiceBase {
}
}
//企业证书查询
//企业证书查询
// async searchCertification(queryobj, req) {
// if (!queryobj.companyName) {
// return system.getResultFail(-1, 'companyName can not be empty');
// }
// var hashValue = await this.restClient.hget(this.searchCertificationData, queryobj.companyName);
// if (hashValue) {
// return system.getResultSuccess(JSON.parse(hashValue));
// }
// let url = this.certificationUrl + "gsb/SearchCertification";
// let data = {
// "company_name": queryobj.companyName,
// "pageSize": 20,
// "pageIndex": 1,
// "isExactlySame": "True"
// }
// let result = await this.opReqResult(url, data, req);
// if (!result) {
// return system.getResultFail(-1, '查询失败!!!');
// }
// if (result.Status != 200) {
// return system.getResultFail(-1, '查询失败');
// }
// //对结果处理
// // "Tag": 1为qichacha,0为gsb
// var setValue = {};
// setValue[queryobj.companyName] = JSON.stringify(result.Result);
// if (result.Tag == 1) {
// this.restClient.hmset(this.disposeCertificationData, setValue);
// }
// this.restClient.hmset(this.searchCertificationData, setValue);
// return system.getResult(result.Result);
// }
//企业证书查询 用友数据源
async
searchCertification
(
queryobj
,
req
)
{
async
searchCertification
(
queryobj
,
req
)
{
if
(
!
queryobj
.
companyName
)
{
if
(
!
queryobj
.
companyName
)
{
return
system
.
getResultFail
(
-
1
,
'companyName can not be empty'
);
return
system
.
getResultFail
(
-
1
,
'companyName can not be empty'
);
...
@@ -43,32 +77,50 @@ class IcbcService extends AppServiceBase {
...
@@ -43,32 +77,50 @@ class IcbcService extends AppServiceBase {
if
(
hashValue
)
{
if
(
hashValue
)
{
return
system
.
getResultSuccess
(
JSON
.
parse
(
hashValue
));
return
system
.
getResultSuccess
(
JSON
.
parse
(
hashValue
));
}
}
let
url
=
this
.
certificationUrl
+
"gsb/SearchCertification"
;
//获取token
let
url
=
settings
.
icNameUrl
()
+
'openPlatform/platform/getToken'
;
let
params
=
{
"accessKey"
:
"111"
,
"accessSecret"
:
"222"
}
let
ret
=
await
this
.
opReqResult
(
url
,
params
,
req
);
if
(
ret
.
status
!=
1
){
system
.
getResultFail
(
-
1
,
'获取开放平台token失败'
);
}
let
token
=
ret
.
data
;
url
=
settings
.
icNameUrl
()
+
"openPlatform/busenterprise/cloudapi"
;
let
data
=
{
let
data
=
{
"company_name"
:
queryobj
.
companyName
,
"path"
:
"license"
,
"pageSize"
:
20
,
"name"
:
queryobj
.
companyName
"pageIndex"
:
1
,
}
"isExactlySame"
:
"True"
let
rtn
=
await
this
.
execClient
.
restGetWithHAuthorizationUrl
(
token
,
url
,
data
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"restPostWithHAuthorizationUrl data is empty"
);
}
}
let
result
=
await
this
.
opReqResult
(
url
,
data
,
req
);
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
!
result
)
{
if
(
!
result
)
{
return
system
.
getResultFail
(
-
1
,
'查询失败!!!'
);
return
system
.
getResultFail
(
-
1
,
'查询失败!!!'
);
}
}
if
(
result
.
Status
!=
20
0
)
{
if
(
result
.
error_code
!=
0
)
{
return
system
.
getResultFail
(
-
1
,
'查询失败'
);
return
system
.
getResultFail
(
-
1
,
'查询失败'
);
}
}
let
item
=
result
.
result
.
items
;
//对结果处理
//对结果处理
// "Tag": 1为qichacha,0为gsb
// "Tag": 1为qichacha,0为gsb
var
setValue
=
{};
var
setValue
=
{};
setValue
[
queryobj
.
companyName
]
=
JSON
.
stringify
(
result
.
Result
);
setValue
[
queryobj
.
companyName
]
=
JSON
.
stringify
(
item
);
if
(
result
.
Tag
==
1
)
{
//
if (result.Tag == 1) {
this
.
restClient
.
hmset
(
this
.
disposeCertificationData
,
setValue
);
//
this.restClient.hmset(this.disposeCertificationData, setValue);
}
//
}
this
.
restClient
.
hmset
(
this
.
searchCertificationData
,
setValue
);
this
.
restClient
.
hmset
(
this
.
searchCertificationData
,
setValue
);
return
system
.
getResult
(
result
.
Result
);
return
system
.
getResult
(
item
);
}
}
async
opReqResult
(
reqUrl
,
queryobj
,
req
)
{
async
opReqResult
(
reqUrl
,
queryobj
,
req
)
{
var
rtn
=
await
this
.
execClient
.
execPushDataPost
(
queryobj
,
reqUrl
,
req
.
headers
[
"token"
],
req
.
headers
[
"request-id"
]);
var
rtn
=
await
this
.
execClient
.
execPushDataPost
(
queryobj
,
reqUrl
,
req
.
headers
[
"token"
],
req
.
headers
[
"request-id"
]);
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
...
...
center-channel/app/base/utils/execClient.js
View file @
f375a382
...
@@ -3,6 +3,7 @@ const util = require('util');
...
@@ -3,6 +3,7 @@ const util = require('util');
const
exec
=
util
.
promisify
(
require
(
'child_process'
).
exec
);
const
exec
=
util
.
promisify
(
require
(
'child_process'
).
exec
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
uuidv4
=
require
(
'uuid/v4'
);
var
settings
=
require
(
"../../config/settings"
);
var
settings
=
require
(
"../../config/settings"
);
const
querystring
=
require
(
'querystring'
);
const
axios
=
require
(
'axios'
);
const
axios
=
require
(
'axios'
);
class
ExecClient
{
class
ExecClient
{
constructor
()
{
constructor
()
{
...
@@ -15,6 +16,8 @@ class ExecClient {
...
@@ -15,6 +16,8 @@ class ExecClient {
this
.
cmd360PostPattern
=
"curl -u gongsibao:qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx -d '{data}' -X POST {url}"
this
.
cmd360PostPattern
=
"curl -u gongsibao:qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx -d '{data}' -X POST {url}"
this
.
cmdBaiduPostPattern
=
"curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}"
;
this
.
cmdBaiduPostPattern
=
"curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}"
;
this
.
cmdGetpatternToken
=
"curl -G -k -H 'authorization:{token}' -d '{data}' {url}"
;
}
}
getUUID
()
{
getUUID
()
{
var
uuid
=
uuidv4
();
var
uuid
=
uuidv4
();
...
@@ -184,6 +187,31 @@ class ExecClient {
...
@@ -184,6 +187,31 @@ class ExecClient {
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
return
{
stdout
,
stderr
};
return
{
stdout
,
stderr
};
}
}
// 带token的url请求
async
restGetWithHAuthorizationUrl
(
userToken
,
url
,
subData
)
{
if
(
settings
.
env
==
'dev'
){
axios
.
defaults
.
headers
[
'authorization'
]
=
userToken
;
const
rs
=
await
axios
.
get
(
url
,{
params
:
subData
});
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
}
return
ret
;
}
var
data
=
querystring
.
stringify
(
subData
);
let
cmd
=
this
.
FetchrestGetWithHAuthorizationUrl
(
userToken
,
url
,
data
);
console
.
log
(
cmd
,
"cmd............"
);
var
result
=
await
this
.
exec
(
cmd
,
{
maxBuffer
:
1024
*
1024
*
15
});
return
result
;
}
FetchrestGetWithHAuthorizationUrl
(
userToken
,
url
,
subData
)
{
var
cmd
=
this
.
cmdGetpatternToken
.
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
token
\}
/g
,
userToken
).
replace
(
/
\{
data
\}
/g
,
subData
);
return
cmd
;
}
}
}
module
.
exports
=
ExecClient
;
module
.
exports
=
ExecClient
;
...
...
center-channel/app/config/settings.js
View file @
f375a382
...
@@ -316,7 +316,7 @@ var settings = {
...
@@ -316,7 +316,7 @@ var settings = {
},
},
icNameUrl
:
function
()
{
icNameUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
return
"https://fq.gongsibao.com/"
return
"https://fq
dev
.gongsibao.com/"
}
else
{
}
else
{
return
"https://fq.gongsibao.com/"
return
"https://fq.gongsibao.com/"
}
}
...
...
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