Commit 04bf6a69 by zero

诊断、需求相关接口

parent 5ae23020
......@@ -7,30 +7,51 @@ class diagnosisNeedBus extends WEBBase {
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);
return result;
}
async opActionProcess (pobj, action_type, req) {
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "getDnList":// 精确检索
if (Object.keys(pobj.actionBody).length < 1) {
return system.getResult(null, `参数不能为空`)
}
opResult = await this.unSve.getList(pobj);
break;
case 'getDnListPending': // 获取详情
pobj.actionBody.status = 'dcl'
case 'getDnListPending': // 获取列表
pobj.actionBody.status = 'dcl';
opResult = await this.unSve.getList(pobj);
break;
case 'getDnDetail': // 获取列表
case 'getDnDetail': // 获取详情
if (!pobj.actionBody.id) {
return system.getResult(null, `id不能为空`)
}
opResult = await this.unSve.getDetail(pobj);
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);
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:
opResult = system.getResult(null, "actionType参数错误");
break;
......@@ -38,4 +59,5 @@ class diagnosisNeedBus extends WEBBase {
return opResult;
}
}
module.exports = diagnosisNeedBus;
\ No newline at end of file
const System = require("../../../system");
const system = require("../../../system");
var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
class FblicenseService extends AppServiceBase {
constructor () {
constructor() {
super();
this.centerOrderUrl = settings.centerOrderUrl()
this.restClient = System.getObject("util.restClient")
this.restClient = system.getObject("util.restClient")
};
async getList (data) {
//获取列表、检索
async getList(pobj) {
try {
let url = `${this.centerOrderUrl}action/diagnosisneedbus/springBoard`
console.log(url)
data.actionType = 'getList'
let result = await this.restClient.execPost(data, url)
return result
pobj.actionType = 'getList'
let result = await this.restClient.execPost(pobj, url)
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) {
return {
code: -1,
msg: error.message || 'failed',
return system.getResultFail(-1, 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;
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