Commit 56785fc2 by 李智

更新商机表和服务单表所有信息查询接口

parent e044b590
......@@ -380,6 +380,19 @@ class BizOptCtl extends CtlBase {
localTime = moment(localTime).format("YYYY-MM-DD");
return localTime;
}
//根据bizId查询商机表中的所有信息
async getInfo(pobj,qobj,req){
try{
if(!pobj.bizId){
throw new Error("bizId 不能为空");
}
const rs=await this.service.getInfo(pobj);
//console.log("got message");
return system.getResult(rs);
}catch(err){
return system.getResult(null,err.message)
}
}
}
module.exports = BizOptCtl;
......
......@@ -201,6 +201,19 @@ class DeliverybillCtl extends CtlBase {
return system.getResult(null, err.message)
}
}
//根据bizId查询deliverybill表中的所有信息
async getInfo(pobj,qobj,req){
try{
if(!pobj.bizId){
throw new Error("bizId 不能为空");
}
const rs=await this.service.getInfo(pobj);
//console.log("got message");
return system.getResult(rs);
}catch(err){
return system.getResult(null,err.message)
}
}
}
module.exports = DeliverybillCtl;
......
......@@ -149,6 +149,13 @@ class BizoptDao extends Dao {
return await this.create(obj, t);
}
/**
* 根据服务实例id查找服务所有信息
*/
async findByBizId(pobj){
var oid=pobj.bizId;
return await this.findOne({biz_id:oid});
}
}
module.exports = BizoptDao;
\ No newline at end of file
......@@ -217,5 +217,12 @@ class DeliverybillDao extends Dao {
var qcwhere = { "delivery_code": qobj.orderId, "biz_id": qobj.bizId };
return await this.findOne(qcwhere);
}
/**
* 根据服务实例id查找服务所有信息
*/
async findByBizId(pobj){
var oid=pobj.bizId;
return await this.findOne({biz_id:oid});
}
}
module.exports = DeliverybillDao;
......@@ -106,6 +106,43 @@ class BizOptService extends ServiceBase {
});
}
/**
* 查询商机表信息
* @param pobj
* @returns {Promise<{}>}
*/
async getInfo(pobj){
let result={};
let bizOpInfo = await this.dao.findByBizId(pobj);
if(!bizOpInfo){
throw new Error("没有服务信息");
}
//封装deliverybill表数据
result.bizOpInfo={
demandCode:bizOpInfo.demand_code,//商机编码
business_type:bizOpInfo.business_type,//商机类型
businessStatus:bizOpInfo.business_status,//当前商机状态
businessInfo:bizOpInfo.business_info,//商机信息
vConame:bizOpInfo.v_coname,//联系人-虚拟字段
vCophone:bizOpInfo.v_cophone,//联系电话-虚拟字段
sourceNumber:bizOpInfo.source_number,//渠道来源编号
serviceAddress:bizOpInfo.service_address,//服务地区
closeReason:bizOpInfo.close_reason,//状态为关闭原因
facilitatorId:bizOpInfo.facilitator_id,//服务商id
facilitatorName:bizOpInfo.facilitator_name,//服务商名称
salesmanOpcode:bizOpInfo.salesman_opcode,//业务员opcode
salesmanId:bizOpInfo.salesman_id,//业务员id
salesmanName:bizOpInfo.salesman_name,//业务员名称
salesmanPhone:bizOpInfo.salesman_phone,//业务员联系方式
sourceName:bizOpInfo.source_name,//渠道名称
createdAt:bizOpInfo.created_at,//创建时间
updatedAt:bizOpInfo.updated_at,//更新时间
version:bizOpInfo.version,//o
bizId:pobj.bizId//融易算-服务实例id
}
return result;
}
}
module.exports = BizOptService;
......
......@@ -376,5 +376,51 @@ class DeliverybillService extends ServiceBase {
return await self.dao.updateServer(obj, whereobj, t);
});
}
//根据bizId查询deliverybill表中的所有信息
async getInfo(pobj){
let result={};
let deliveryBillInfo = await this.dao.findByBizId(pobj);
//console.log("gggg"+deliveryBillInfo+pobj.bizId)
if(!deliveryBillInfo){
throw new Error("没有服务信息");
}
//封装deliverybill表数据
result.deliveryBillInfo={
deliveryCode:deliveryBillInfo.delivery_code,//交付单编号
sourceNumber:deliveryBillInfo.source_number,//渠道来源编号
demandCode:deliveryBillInfo.demand_code,//商机编号
skuCode:deliveryBillInfo.sku_code,//sku编号
schemeNumber:deliveryBillInfo.scheme_number,//方案编号
productCode:deliveryBillInfo.product_code,//产品编码
productName:deliveryBillInfo.product_name,//产品名称
serviceAddress:deliveryBillInfo.service_address,//服务地区
deliveryInfo:deliveryBillInfo.delivery_info,//交付单详情
payStatus:deliveryBillInfo.pay_status,//交付状态-虚拟字段
vConame:deliveryBillInfo.v_coname,//联系人-虚拟字段
vCophone:deliveryBillInfo.v_cophone,//联系电话-虚拟字段
delivery_status:deliveryBillInfo.delivery_status,//交付单状态
sellingPrice:deliveryBillInfo.selling_price,//交付单价格
costPrice:deliveryBillInfo.cost_price,//成本价
closeReason:deliveryBillInfo.close_reason,//状态为关闭原因
facilitatorId:deliveryBillInfo.facilitator_id,//服务商id
facilitatorName:deliveryBillInfo.facilitator_name,//服务商名称
salesmanOpcode:deliveryBillInfo.salesman_opcode,//业务员opcode
salesmanId:deliveryBillInfo.salesman_id,//业务员id
salesmanName:deliveryBillInfo.salesman_name,//业务员名称
salesmanPhone:deliveryBillInfo.salesman_phone,//业务员联系方式
sourceName:deliveryBillInfo.source_name,//渠道名称
createdAt:deliveryBillInfo.created_at,//创建时间
updatedAt:deliveryBillInfo.updated_at,//更新时间
version:deliveryBillInfo.version,//o
masterSourceNumber:deliveryBillInfo.master_source_number,//主来源单
settleStatus:deliveryBillInfo.settle_status,//结算状态
settlebillId:deliveryBillInfo.settlebill_id,//结算单id
deliveryManId:deliveryBillInfo.delivery_man_id,//销售员id
deliveryManName:deliveryBillInfo.delivery_man_name,//销售员姓名
deliveryManOpcode:deliveryBillInfo.delivery_man_opcode,//销售员opcode
bizId:pobj.bizId//融易算-服务实例id
}
return result;
}
}
module.exports = DeliverybillService;
\ 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