Commit 449b0a7cc4e6b5a0ba789cca3787f7a6544c34e5
1 parent
584b2672
Exists in
master
and in
1 other branch
fix bug vizcard
Showing
3 changed files
with
20 additions
and
38 deletions
Show diff stats
ais-structure/src/modules/helper/connection.js
... | ... | @@ -42,28 +42,6 @@ connection.requestSoapToSACF = async function (soap,cmd,myMethod) { |
42 | 42 | |
43 | 43 | var result = await asyncRequest(params,objectData,funStats); |
44 | 44 | |
45 | - // if(result.err) | |
46 | - // { | |
47 | - // // result.response = {}; | |
48 | - // // result.response.resultCode = constants.RESPONSERESULT.ERROR; | |
49 | - | |
50 | - | |
51 | - // if(result.err.code == constants.RESPONSECONN.STATS.ETIMEDOUT){ | |
52 | - // result.response = constants.RESPONSECONN.MESSAGE.ETIMEDOUT; | |
53 | - // // result.response.resultCode = "50003"; | |
54 | - // // result.response.resultDescription = "Timeout"; | |
55 | - // } else if(result.err.code == constants.RESPONSECONN.STATS.ECONNREFUSED){ | |
56 | - // result.response = constants.RESPONSECONN.MESSAGE.ECONNREFUSED; | |
57 | - // // result.response.resultCode = "50002"; | |
58 | - // // result.response.resultDescription = "Reject"; | |
59 | - // } else { | |
60 | - // result.response = constants.RESPONSECONN.MESSAGE.ERROR; | |
61 | - // // result.response.resultCode = "50000"; | |
62 | - // // result.response.resultDescription = "System error"; | |
63 | - // } | |
64 | - // stats.receiveResponse(service.Name,cmd,constants.ERROR); | |
65 | - // } | |
66 | - | |
67 | 45 | return checkResponse(result,funStats); |
68 | 46 | }; |
69 | 47 | |
... | ... | @@ -107,11 +85,10 @@ connection.requestJsonToD01 = async function (obj,cmd,myMethod) { |
107 | 85 | |
108 | 86 | if(params.method == constants.METHOD.GET) |
109 | 87 | { |
110 | - var genUrl = getUrl(params,service[myMethod+"_Limit"]); | |
111 | - // genUrl.push(genUrl[0].replace("8080","8081")); | |
88 | + var genUrl = getUrl(params,service["searchRecordLimit"]); | |
112 | 89 | if(genUrl.length > 1) |
113 | 90 | { |
114 | - // console.log("multi Send"); | |
91 | + console.log("multi Send"); | |
115 | 92 | var multiSend = []; |
116 | 93 | for(var i=0;i<genUrl.length;i++) |
117 | 94 | multiSend.push({url:genUrl[i],method:params.method}); |
... | ... | @@ -470,6 +447,7 @@ function checkResponse(result,funStats) |
470 | 447 | { |
471 | 448 | if(result.err) |
472 | 449 | { |
450 | + log.log(result.err,'error'); | |
473 | 451 | if(result.err.code == constants.RESPONSECONN.STATS.ETIMEDOUT){ |
474 | 452 | result.response = constants.RESPONSECONN.MESSAGE.ETIMEDOUT; |
475 | 453 | // result.response.resultCode = "50003"; |
... | ... | @@ -478,19 +456,19 @@ function checkResponse(result,funStats) |
478 | 456 | result.response = constants.RESPONSECONN.MESSAGE.ECONNREFUSED; |
479 | 457 | // result.response.resultCode = "50002"; |
480 | 458 | // result.response.resultDescription = "Reject"; |
459 | + } else if(result.err.code == constants.RESPONSECONN.STATS.ESOCKETTIMEDOUT){ | |
460 | + result.response = constants.RESPONSECONN.MESSAGE.ESOCKETTIMEDOUT; | |
481 | 461 | } else { |
482 | - | |
483 | - if(result.err.indexOf(constants.RESPONSECONN.STATS.MISSING) != -1){ | |
462 | + if(result.err.resultDescription && result.err.resultDescription.indexOf(constants.RESPONSECONN.STATS.MISSING) != -1){ | |
484 | 463 | result.response.resultCode = constants.RESPONSERESULT.MISSING_INVALID.resultCode; |
485 | 464 | result.response.resultDescription = result.err; |
486 | 465 | } else { |
487 | 466 | result.response = constants.RESPONSECONN.MESSAGE.ERROR; |
488 | 467 | } |
489 | 468 | } |
469 | + funStats.error(result.response) | |
490 | 470 | } |
491 | 471 | |
492 | - funStats.error(result.response) | |
493 | - | |
494 | 472 | return result; |
495 | 473 | } |
496 | 474 | ... | ... |
ais-structure/src/modules/helper/constants.js
... | ... | @@ -14,7 +14,8 @@ module.exports = Object.freeze({ |
14 | 14 | STATS:{ |
15 | 15 | ETIMEDOUT:'ETIMEDOUT', |
16 | 16 | ECONNREFUSED : 'ECONNREFUSED', |
17 | - MISSING : 'Missing', | |
17 | + ESOCKETTIMEDOUT : 'ESOCKETTIMEDOUT', | |
18 | + MISSING : 'Missing' | |
18 | 19 | }, |
19 | 20 | MESSAGE:{ |
20 | 21 | ETIMEDOUT:{ |
... | ... | @@ -25,6 +26,10 @@ module.exports = Object.freeze({ |
25 | 26 | resultCode : '50002', |
26 | 27 | resultDescription : 'Reject' |
27 | 28 | }, |
29 | + ESOCKETTIMEDOUT:{ | |
30 | + resultCode : '50003', | |
31 | + resultDescription : 'Timeout' | |
32 | + }, | |
28 | 33 | ERROR:{ |
29 | 34 | resultCode : '50000', |
30 | 35 | resultDescription : 'System error' | ... | ... |
ais-structure/src/modules/vizcard/vizCard.ctrl.js
... | ... | @@ -14,8 +14,9 @@ exports.vizcard = async function (req, res, next) { |
14 | 14 | var sacf = "SACF"; |
15 | 15 | var method = constant.METHOD.GET; |
16 | 16 | |
17 | - var customerId = req.query.clientName+"@"+req.query.commandId; | |
18 | - | |
17 | + if(req.query.clientName && req.query.commandId){ | |
18 | + var customerId = req.query.clientName+"@"+req.query.commandId; | |
19 | + } | |
19 | 20 | log.startlog(method+"_"+getCmd,req.query.commandId,customerId); |
20 | 21 | log.logDetail.addInput(req.query.clientName,method+"_"+getCmd,constant.REQUEST,req,req.body); |
21 | 22 | |
... | ... | @@ -59,18 +60,16 @@ exports.vizcard = async function (req, res, next) { |
59 | 60 | log.addSuccessSummary(sacf,method+"_"+sendCmd,response.resultCode,response.developerMessage); |
60 | 61 | } |
61 | 62 | catch(error) { |
62 | - result.response = constant.RESPONSERESULT.ERROR | |
63 | - | |
63 | + log.log(error,'error') | |
64 | 64 | stats.receiveSACFBadResponse(sacf,sendCmd); |
65 | - response = responseMsg.direct(req,getCmd,result.response); | |
65 | + response = responseMsg.error(req,getCmd,50000); | |
66 | 66 | log.addErrorSummary(sacf,method+"_"+sendCmd,response.resultCode,response.developerMessage); |
67 | - | |
68 | 67 | var resultSet = {rawDataJson : ""} |
69 | 68 | } |
70 | 69 | |
71 | 70 | } else { |
72 | 71 | stats.receiveSACFResponse(sacf,sendCmd,"Error"); |
73 | - response = responseMsg.direct(req,getCmd,result.response); | |
72 | + response = responseMsg.error(req,getCmd,50000); | |
74 | 73 | // log.addErrorSummary(sacf,method+"_"+sendCmd,response.resultCode,response.developerMessage); |
75 | 74 | var resultSet = {rawDataJson : ""} |
76 | 75 | } |
... | ... | @@ -88,7 +87,7 @@ exports.vizcard = async function (req, res, next) { |
88 | 87 | function validator(req,cmd) |
89 | 88 | { |
90 | 89 | var list = []; |
91 | - list.push([true,"queryStr","commandId","int"]); | |
90 | + list.push([true,"queryStr","commandId","string"]); | |
92 | 91 | list.push([true,"queryStr","clientName","string"]); |
93 | 92 | // list.push([true,"queryStr","lastName","string"]); |
94 | 93 | // list.push([true,"queryStr","emailAddress","string"]); | ... | ... |