Commit 04bf6a69 by zero

诊断、需求相关接口

parent 5ae23020
...@@ -7,30 +7,51 @@ class diagnosisNeedBus extends WEBBase { ...@@ -7,30 +7,51 @@ class diagnosisNeedBus extends WEBBase {
this.unSve = system.getObject('service.utilsSve.utilsNdbSve') this.unSve = system.getObject('service.utilsSve.utilsNdbSve')
} }
async springBoard (pobj, qobj, req) { async springBoard(pobj, qobj, req) {
var result = await this.opActionProcess(pobj, pobj.actionType, req); var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result; return result;
} }
async opActionProcess (pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
case "test"://测试 case "test"://测试
opResult = system.getResultSuccess(null, "测试成功"); opResult = system.getResultSuccess(null, "测试成功");
break; break;
case "getDnList":// 精确检索 case "getDnList":// 精确检索
if (Object.keys(pobj.actionBody).length < 1) {
return system.getResult(null, `参数不能为空`)
}
opResult = await this.unSve.getList(pobj); opResult = await this.unSve.getList(pobj);
break; break;
case 'getDnListPending': // 获取详情 case 'getDnListPending': // 获取列表
pobj.actionBody.status = 'dcl' pobj.actionBody.status = 'dcl';
opResult = await this.unSve.getList(pobj); opResult = await this.unSve.getList(pobj);
break; break;
case 'getDnDetail': // 获取列表 case 'getDnDetail': // 获取详情
if (!pobj.actionBody.id) {
return system.getResult(null, `id不能为空`)
}
opResult = await this.unSve.getDetail(pobj); opResult = await this.unSve.getDetail(pobj);
break; break;
case 'doDnEAV': case 'doDnEAV': //认证
if (!pobj.actionBody.id) {
return system.getResult(null, `id不能为空`)
}
if (!pobj.actionBody.diagnosisResult) {
return system.getResult(null, `诊断结果不能为空`)
}
opResult = await this.unSve.doEAV(pobj); opResult = await this.unSve.doEAV(pobj);
break; break;
case 'getDnNeedList': //获取需求列表
opResult = await this.unSve.getNeedList(pobj);
break;
case 'getDnNeedDetail': //获取需求详情
if (!pobj.actionBody.needNo) {
return system.getResult(null, `needNo不能为空`)
}
opResult = await this.unSve.getNeedDetail(pobj);
break;
default: default:
opResult = system.getResult(null, "actionType参数错误"); opResult = system.getResult(null, "actionType参数错误");
break; break;
...@@ -38,4 +59,5 @@ class diagnosisNeedBus extends WEBBase { ...@@ -38,4 +59,5 @@ class diagnosisNeedBus extends WEBBase {
return opResult; return opResult;
} }
} }
module.exports = diagnosisNeedBus; module.exports = diagnosisNeedBus;
\ No newline at end of file
const System = require("../../../system"); const system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
class FblicenseService extends AppServiceBase { class FblicenseService extends AppServiceBase {
constructor () { constructor() {
super(); super();
this.centerOrderUrl = settings.centerOrderUrl() this.centerOrderUrl = settings.centerOrderUrl()
this.restClient = System.getObject("util.restClient") this.restClient = system.getObject("util.restClient")
}; };
async getList (data) { //获取列表、检索
async getList(pobj) {
try { try {
let url = `${this.centerOrderUrl}action/diagnosisneedbus/springBoard` let url = `${this.centerOrderUrl}action/diagnosisneedbus/springBoard`
console.log(url) console.log(url)
data.actionType = 'getList' pobj.actionType = 'getList'
let result = await this.restClient.execPost(data, url) let result = await this.restClient.execPost(pobj, url)
return result return JSON.parse(result.stdout)
} catch (error) {
return system.getResultFail(-1, error.message || 'failed')
}
}
// 获取详情
async getDetail(pobj) {
try {
let url = `${this.centerOrderUrl}action/diagnosisneedbus/springBoard`
pobj.actionType = 'getDetail'
let result = await this.restClient.execPost(pobj, url)
let data = JSON.parse(result.stdout)
if (data.status != 0)
return system.getResultFail(-1, error.message || 'failed')
return data;
} catch (error) {
return system.getResultFail(-1, error.message || 'failed')
}
}
// 认证
async doEAV(pobj) {
try {
let url = `${this.centerOrderUrl}action/diagnosisneedbus/springBoard`
pobj.actionType = 'doEAV'
let result = await this.restClient.execPost(pobj, url)
return JSON.parse(result.stdout)
} catch (error) {
return system.getResultFail(-1, error.message || 'failed')
}
}
// 获取需求列表
async getNeedList(pobj) {
try {
let url = `${this.centerOrderUrl}action/diagnosisneedbus/springBoard`
pobj.actionType = 'getNeedList'
let result = await this.restClient.execPost(pobj, url)
return JSON.parse(result.stdout)
} catch (error) { } catch (error) {
return { return system.getResultFail(-1, error.message || 'failed')
code: -1, }
msg: error.message || 'failed',
} }
// 获取需求详情
async getNeedDetail(pobj) {
try {
let url = `${this.centerOrderUrl}action/diagnosisneedbus/springBoard`
pobj.actionType = 'getNeedDetail'
let result = await this.restClient.execPost(pobj, url)
return JSON.parse(result.stdout)
} catch (error) {
return system.getResultFail(-1, error.message || 'failed')
} }
} }
} }
module.exports = FblicenseService; module.exports = FblicenseService;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment