Commit 2997c710 by 王勇飞

add bizopt api

parent 21ce1b8e
...@@ -9,6 +9,9 @@ class BizOptCtl extends CtlBase { ...@@ -9,6 +9,9 @@ class BizOptCtl extends CtlBase {
constructor() { constructor() {
super("bizchance", CtlBase.getServiceName(BizOptCtl)); super("bizchance", CtlBase.getServiceName(BizOptCtl));
this.schemeService = system.getObject("service.bizchance.schemeSve"); this.schemeService = system.getObject("service.bizchance.schemeSve");
this.schemeSve = system.getObject("service.bizchance.fitaxschemeSve");//财税-方案信息
this.fitaxcompanySve = system.getObject("service.bizchance.fitaxcompanySve");//财税-企业信息
this.operationrecordSve = system.getObject("service.bizchance.operationrecordSve");//财税-需求分配记录
this.logService = system.getObject("service.bizchance.statuslogSve"); this.logService = system.getObject("service.bizchance.statuslogSve");
this.shisService = system.getObject("service.bizchance.salesmanhisSve"); this.shisService = system.getObject("service.bizchance.salesmanhisSve");
this.receiveUrl = settings.receiveUrl(); this.receiveUrl = settings.receiveUrl();
...@@ -111,7 +114,58 @@ class BizOptCtl extends CtlBase { ...@@ -111,7 +114,58 @@ class BizOptCtl extends CtlBase {
} }
/** /**
* 根据需求编号获取需求详情 * 获取跟进详情页所有信息
* @param {*} mobj
* {
demand_code: "",//需求编号
}
*/
async getFollowUpInfo(mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.demand_code && pobj.demand_code != 'undefined') {
try {
var bizoptInfo = await this.service.findInfoByDemandCode(pobj);
var companyInfo = await this.fitaxcompanySve.findInfo(pobj);
pobj.operation_type = "followUp";
var followUpinfos = await this.operationrecordSve.findAllInfo(pobj);
var followUpinfo = {};
if (followUpinfos.length > 0) {
followUpinfo = followUpinfos[0];
}
return system.getResult({ bizoptInfo: bizoptInfo, companyInfo: companyInfo, followUpinfo: followUpinfo });
} catch (error) {
console.log("bizopt/getFollowUpInfo err: " + error);
return system.getResultError("bizoptCtl/closeBizopt 获取跟进详情页信息出错!");
}
}
}
/**
* 获取记录详情页所有信息
* @param {*} mobj
* {
demand_code: "",//需求编号
}
*/
async getRecordInfo(mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.demand_code && pobj.demand_code != 'undefined') {
try {
var bizoptInfo = await this.service.findInfoByDemandCode(pobj);//需求信息
var companyInfo = await this.fitaxcompanySve.findInfo(pobj);//企业信息
var schemeInfo = await this.schemeSve.findInfo(pobj);//方案详情
var followUpinfos = await this.operationrecordSve.findAllInfo(pobj);//线索记录
return system.getResult({ bizoptInfo: bizoptInfo, companyInfo: companyInfo, schemeInfo: schemeInfo, followUpinfos: followUpinfos });
} catch (error) {
console.log("bizopt/getFollowUpInfo err: " + error);
return system.getResultError("bizoptCtl/closeBizopt 获取跟进详情页信息出错!");
}
}
}
/**
* @param {*} mobj * @param {*} mobj
*/ */
async findInfoByDemandCode(mobj, qobj, req) { async findInfoByDemandCode(mobj, qobj, req) {
...@@ -171,6 +225,7 @@ class BizOptCtl extends CtlBase { ...@@ -171,6 +225,7 @@ class BizOptCtl extends CtlBase {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
/*更新业务员信息*/ /*更新业务员信息*/
async updateSalesmanInfoByDemandCode(mobj, qobj, req) { async updateSalesmanInfoByDemandCode(mobj, qobj, req) {
var pobj = mobj.d; var pobj = mobj.d;
......
...@@ -11,8 +11,8 @@ class OperationrecordCtl extends CtlBase { ...@@ -11,8 +11,8 @@ class OperationrecordCtl extends CtlBase {
* 查询记录信息 * 查询记录信息
* @param {*} mobj * @param {*} mobj
* { * {
demand_code: "",//需求编号 demand_code: "",//必须,需求编号
operation_type: ""//操作类型 operation_type: ""//可选,操作类型
} }
*/ */
async findAllInfo(mobj, qobj, req) { async findAllInfo(mobj, qobj, req) {
......
...@@ -35,7 +35,7 @@ class BizoptDao extends Dao { ...@@ -35,7 +35,7 @@ class BizoptDao extends Dao {
/*根据商机编号获取商机详情*/ /*根据商机编号获取商机详情*/
async findInfoByDemandCode(qobj) { async findInfoByDemandCode(qobj) {
var qcwhere = { "demand_code": qobj.businessMode }; var qcwhere = { "demand_code": qobj.demand_code };
return await this.findOne(qcwhere); return await this.findOne(qcwhere);
} }
......
...@@ -10,9 +10,8 @@ class OperationrecordDao extends Dao { ...@@ -10,9 +10,8 @@ class OperationrecordDao extends Dao {
*@param {*} qobj *@param {*} qobj
*/ */
async findAllInfo(qobj) { async findAllInfo(qobj) {
qobj.order_type = "BIZ",//数据类型需求|订单 qobj.order_type = "BIZ";//数据类型需求|订单
qobj.raw = true; return await this.model.findAll({ where: qobj, order: [["created_at","DESC"]] });
return await this.model.findAll(qobj);
} }
/** /**
...@@ -38,3 +37,14 @@ class OperationrecordDao extends Dao { ...@@ -38,3 +37,14 @@ class OperationrecordDao extends Dao {
} }
} }
module.exports = OperationrecordDao; module.exports = OperationrecordDao;
// let test = new OperationrecordDao();
// let a = {
// "demand_code": "111"
// }
// start(a);
// async function start(a) {
// let res = await test.findAllInfo(a);
// console.log("结果:" + JSON.stringify(res));
// }
\ No newline at end of file
...@@ -91,7 +91,7 @@ class BizOptService extends ServiceBase { ...@@ -91,7 +91,7 @@ class BizOptService extends ServiceBase {
} }
/*更新业务员信息*/ /*更新业务员信息*/
async updateSalesmanInfoByDemandCode(qobj){ async updateSalesmanInfoByDemandCode(qobj) {
var self = this; var self = this;
return self.db.transaction(async function (t) { return self.db.transaction(async function (t) {
return await self.dao.updateSalesmanInfoByDemandCode(qobj, t); return await self.dao.updateSalesmanInfoByDemandCode(qobj, t);
...@@ -108,3 +108,13 @@ class BizOptService extends ServiceBase { ...@@ -108,3 +108,13 @@ class BizOptService extends ServiceBase {
} }
module.exports = BizOptService; module.exports = BizOptService;
// let test = new BizOptService();
// let a = {
// "demand_code": "111"
// }
// start(a);
// async function start(a) {
// let res = await test.findInfoByDemandCode(a);
// console.log("结果:" + JSON.stringify(res));
// }
\ No newline at end of file
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