Commit 18840f22 by 孙亚楠

dd

parent ebdd3a6a
......@@ -4,6 +4,7 @@ class OrderCtl extends CtlBase {
constructor() {
super();
this.orderSve = system.getObject("service.order.orderSve");
this.deliverSve = system.getObject("service.common.deliverSve");
}
async processList(pobj, pobj2, req) {
......@@ -85,13 +86,12 @@ class OrderCtl extends CtlBase {
}
}
/**
* 分配业务员
* @param {*} pobj
* @param {*} pobj2
* @param {*} req
* @param {*} pobj
* @param {*} pobj2
* @param {*} req
*/
async deliverAssignSalesman(pobj, pobj2, req) {
if (!pobj.id) {
......@@ -103,7 +103,11 @@ class OrderCtl extends CtlBase {
if (!pobj.operator_id) {
return system.getResult(null, `参数错误 业务员ID不能为空`);
}
let user = await this.deliverSve.deliverUserById({id: pobj.operator_id});
if (!user || user.status != 0 || !user.data) {
return system.getResult(null, `业务员【${pobj.operator_id}】不存在`);
}
pobj.operator_path = user.data.org_path;
try {
return await this.orderSve.handleStatus(pobj);
} catch (error) {
......@@ -495,5 +499,82 @@ class OrderCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/***************************************************一下是阿里改版的接口*****************************************************************/
/**
* 新增订单
* @returns {Promise<void>}
* @params product_id 产品ID
* @params source_id 来源ID
* @params source_no 来源订单号
* @params desc 订单信息
* @params contact_mobile 联系电话
* @params customer_name 客户名称
*
* deliver_id:""
product_id:"10020000",
product_items: ["10020200","10020300","10020400","10020500","10020600",10020700],
customer_name: "",
contact_mobile:"",
*/
async addSourceOrder(pobj, pobj2, req) {
if (!pobj.product_id) {
return system.getResult(null, `参数错误 订单ID不能为空`);
}
if (!pobj.contact_mobile) {
return system.getResult(null, `参数错误 联系电话不能为空`);
}
if (!pobj.customer_name) {
return system.getResult(null, `参数错误 客户名称不能为空`);
}
if(!pobj.chooseItems){
pobj.chooseItems = ["10020200","10020300","10020400","10020500","10020600","10020700"];
}
if(!pobj.chooseItems.includes("10020200")){
pobj.chooseItems.push("10020200");
}
pobj.source_id = pobj.source_id || '1003';
pobj.notes = pobj.desc || "工商注册,刻章,银行卡户,税务报到,建账";
if(!pobj.deliverId){
return system.getResult(null,`请重新登录`);
}
pobj.deliver_id = pobj.deliverId;
pobj.deliver_name = pobj.deliverName || "";
try {
return await this.orderSve.addSourceOrder(pobj);
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
/**
* ali完善订单
* @param pobj
* @param pobj2
* @param req
* @returns {Promise<void>}
*/
async aliPerfectInformation(pobj, pobj2, req){
if(!pobj.id){
return system.getResult(null,`订单【${pobj.id}】不存在`)
}
if(!pobj.status){
return system.getResult(null,`订单状态不能为空`)
}
try {
return await this.orderSve.handleStatus(pobj);
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = OrderCtl;
\ No newline at end of file
......@@ -121,5 +121,21 @@ class OrderService extends ServiceBase {
var rs = await this.callms("order", "updateOBusinessmenProinvce", params);
return rs;
}
/*********************************************以下是阿里的接口****************************************************************/
/**
* 添加订单
* @param params
* @returns {Promise<{msg: string, data: (*|null), bizmsg: string, status: number}|{msg: string, data, bizmsg: *|string, status: number}|*|undefined>}
*/
async addSourceOrder(params) {
try {
return await this.callms("order", "addSourceOrder", params);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
module.exports = OrderService;
\ No newline at end of file
......@@ -194,7 +194,7 @@ class System {
// 订单服务
// order: domain2 + ":3103" + path,
order: domain2 + path,
order: domain + ":3103"+ path,
// 发票服务
invoice: domain2 + ":3105" + path,
......
......@@ -104,6 +104,7 @@ module.exports = function (app) {
req.body.saas_id = req.loginUser.saas_id;
req.body.deliverId = req.loginUser.deliver_id || "";
req.body.deliver_id = req.loginUser.deliver_id || "";
req.body.deliverName = req.loginUser.deliver.name ||"";
}
params.push(methodName);
......
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