Commit 8bdc0d80 by 宋毅

tj

parent c442ea95
......@@ -61,7 +61,7 @@ class OrderAPI extends APIBase {
async addOrder(pobj, actionBody) {
if (!actionBody.product_info) {
return system.getResult(null, "产品信息有误,20010");
return system.getResult(null, "产品信息有误,20000");
}
var interface_info = null;
var interface_list = actionBody.product_info.interface_info;
......@@ -80,13 +80,13 @@ class OrderAPI extends APIBase {
}//使用默认的其他订单
if (!interface_info) {
return system.getResult(null, "产品接口信息有误,20030");
return system.getResult(null, "产品接口信息有误,20010");
}
if (!interface_info.interface_type) {
return system.getResult(null, "产品接口类型信息有误,20050");
return system.getResult(null, "产品接口类型信息有误,20020");
}
if (!interface_info.interface_url) {
return system.getResult(null, "产品接口地址信息有误,20080");
return system.getResult(null, "产品接口地址信息有误,20030");
}
var refOpResult = await this.reflexAction(interface_info, pobj);
return refOpResult;
......@@ -95,11 +95,11 @@ class OrderAPI extends APIBase {
var refResult = null;
if (interface_info.interface_type == "bd") {
if (!interface_info.method_name) {
return system.getResult(null, "产品接口参数信息有误,20110");
return system.getResult(null, "产品接口参数信息有误,20040");
}//操作的方法名称
var invokeObj = system.getObject(interface_info.interface_url);
if (!invokeObj[interface_info.method_name]) {
return system.getResult(null, "产品接口参数方法信息有误,20130");
return system.getResult(null, "产品接口参数方法信息有误,20050");
}
pobj.interface_params = interface_info.params;
var params = [pobj];
......
......@@ -116,7 +116,7 @@ class OrderInfoService extends ServiceBase {
var customerContactObj = {
uapp_id: pobj.appInfo.uapp_id,//int(11) //
sourceOrderNo: orderNo,//交付订单号
contacts: orderContact.contacts || "",//手机号
contactName: orderContact.contacts || "",//手机号
mobile: orderContact.mobile,//手机号
email: orderContact.email || ""
};
......@@ -148,10 +148,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("tm" + pobj.appInfo.uapp_id);
var item = await self.createOrder(pobj, orderNo, t);
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(pobj.actionBody.deliveryData) + "')";
self.customQuery(sql);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo);
return system.getResultSuccess({
orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
......@@ -323,21 +320,12 @@ class OrderInfoService extends ServiceBase {
// }
var self = this;
return await self.db.transaction(async function (t) {
var sql = "";
var orderNo = "";
if (pobj.actionBody.orderNo) {
orderNo = pobj.actionBody.orderNo;
sql = "update c_order_delivery set deliveryContent='" + JSON.stringify(pobj.actionBody.deliveryData) + "' where sourceOrderNo='" +
orderNo + "'";
self.putOrderDelivery(pobj.actionBody.deliveryData, pobj.actionBody.orderNo);
} else {
var orderNo = await self.getBusUid("icp" + pobj.appInfo.uapp_id);
var item = await self.createOrder(pobj, orderNo, t);
sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(pobj.actionBody.deliveryData) + "')";
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo);
}
self.customQuery(sql);
return system.getResultSuccess({
orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
......@@ -453,15 +441,137 @@ class OrderInfoService extends ServiceBase {
//----------------------订单创建-----------end----------------------
//=================================修改订单信息==============start======================================
//=================================修改订单信息==============end======================================
async updateContacts(pobj, actionBody) {//修改订单联系人
var orderItem = await this.dao.getItemStatusByOrderNo(actionBody.orderNo, pobj.appInfo.uapp_id);
if (!orderItem) {
return system.getResult(null, "修改失败,修改的数据为空,30100");
}
if (orderItem.orderStatus == 4) {
return system.getResult(null, "服务中的订单不能进行修改,30110");
}
if (orderItem.orderStatus == 8) {
return system.getResult(null, "已完成的订单不能进行修改,30120");
}
if (!actionBody.orderContact) {
return system.getResult(null, "联系人信息不能为空,30130");
}
if (!actionBody.orderContact.contacts) {
return system.getResult(null, "联系人不能为空,30140");
}
if (!actionBody.orderContact.mobile) {
return system.getResult(null, "手机号不能为空,30150");
}
var updateFields = {
contactName: actionBody.orderContact.contacts || "",
mobile: actionBody.orderContact.mobile,//手机号
email: actionBody.orderContact.email || ""
};
this.ordercontactsDao.updateByWhere(updateFields, { where: { sourceOrderNo: actionBody.orderNo } });
if (actionBody.notes) {
actionBody.isGetContact = 0;
var itemResult = await this.getOrderDeliveryInfo(pobj, actionBody);
if (itemResult.status == 0) {
if (actionBody.notes != itemResult.data.notes) {
itemResult.data.notes = actionBody.notes;
this.putOrderDelivery(itemResult.data, actionBody.orderNo);
}
}
}//修改备注
return system.getResultSuccess();
}
async updateTmOrder(pobj, actionBody) {//修改商标订单信息
var orderItem = await this.dao.getItemStatusByOrderNo(actionBody.orderNo, pobj.appInfo.uapp_id);
if (!orderItem) {
return system.getResult(null, "修改失败,修改的数据为空,30100");
}
if (orderItem.orderStatus == 4) {
return system.getResult(null, "服务中的订单不能进行修改,30110");
}
if (orderItem.orderStatus == 8) {
return system.getResult(null, "已完成的订单不能进行修改,30120");
}
actionBody.isGetContact = 0;
var itemResult = await this.getOrderDeliveryInfo(pobj, actionBody);
if (itemResult.status != 0) {
return itemResult;
}
if (!itemResult.data || Object.keys(itemResult.data).length == 0) {
return system.getResult(null, "修改失败,修改的数据为空,30020");
}
var tipsMsg = "";
var apply = actionBody.apply;
if (apply) {
var dbApply = itemResult.data.apply;
var applyKeys = Object.keys(apply);
if (apply && dbApply && applyKeys.length > 0) {
for (let index = 0; index < applyKeys.length; index++) {
const aKey = applyKeys[index];
if (apply[aKey] && apply[aKey] != dbApply[aKey]) {
itemResult.data.apply[aKey] = apply[aKey];
}
}
}
}
var tm = actionBody.tm;
if (tm) {
var dbTm = itemResult.data.tm;
var tmKeys = Object.keys(tm);
if (tm && dbTm && tmKeys.length > 0) {
for (let index = 0; index < tmKeys.length; index++) {
const aKey = tmKeys[index];
if (!tm[aKey]) {
tipsMsg = "修改失败," + aKey + "不能为空,30030";
}
if (tm[aKey] && tm[aKey] != dbTm[aKey]) {
itemResult.data.tm[aKey] = tm[aKey];
}
}
}
}
if (tipsMsg) {
return system.getResult(null, tipsMsg);
}
var nclThree = actionBody.nclThree;
if (nclThree && nclThree.length > 0) {
var dbNclList = itemResult.data.nclList;
if (!actionBody.tbCode) {
return system.getResult(null, "修改失败,tbCode不能为空,30040");
}
if (!actionBody.ncloneCode) {
return system.getResult(null, "修改失败,ncloneCode不能为空,30050");
}
if (!actionBody.ncloneName) {
return system.getResult(null, "修改失败,ncloneName不能为空,30060");
}
var dataIndex = dbNclList.findIndex(f => f.tbCode == actionBody.tbCode);
if (dataIndex < 0) {
return system.getResult(null, "修改失败,tbCode有误,30070");
}
var putItemData = dbNclList[dataIndex];
if (putItemData.nclThree.length < nclThree.length) {
return system.getResult(null, "尼斯小项数量有误,数量应小于等于" + putItemData.nclThree.length + ",30080");
}
itemResult.data.nclList[dataIndex].nclThree = nclThree;
itemResult.data.nclList[dataIndex].ncloneCode = actionBody.ncloneCode;
itemResult.data.nclList[dataIndex].ncloneName = actionBody.ncloneName;
itemResult.data.nclList[dataIndex].nclCount = nclThree.length;
}
this.putOrderDelivery(itemResult.data, actionBody.orderNo);
return system.getResultSuccess();
}
putOrderDelivery(data, orderNo) {//修改交付信息
var sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + JSON.stringify(data) + "' where sourceOrderNo='" + orderNo + "'";
this.customQuery(sql);
}
addOrderDelivery(data, orderNo) {//新增交付信息
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
this.customQuery(sql);
}
//=================================修改订单信息==============end======================================
......@@ -473,11 +583,11 @@ class OrderInfoService extends ServiceBase {
async getPayOrderInfo(pobj, actionBody) {
var productItem = await this.orderproductDao.getItemByOrderNo(actionBody.orderNo, pobj.appInfo.uapp_id);
if (!productItem) {
return system.getResult(null, "订单产品数据异常,30050");
return system.getResult(null, "订单产品数据异常,30090");
}
var item = await this.orderReceiptVoucherDao.getItemByOrderNo(actionBody.orderNo, pobj.appInfo.uapp_id);
if (!item) {
return system.getResult(null, "订单已经付款成功,请勿重复支付,30010");
return system.getResult(null, "订单已经付款成功,请勿重复支付,30000");
}
var param = {
receiptVoucher: item,
......@@ -566,10 +676,12 @@ class OrderInfoService extends ServiceBase {
}
}
result.data.orderContact = null;
var item = await this.ordercontactsDao.getItemByOrderNo(actionBody.orderNo);
if (item) {
result.data.orderContact = item;
}
if (!actionBody.isGetContact) {
var item = await this.ordercontactsDao.getItemByOrderNo(actionBody.orderNo);
if (item) {
result.data.orderContact = item;
}
}//是否获取联系人,isGetContact有值则不获取
return result;
}
async getOrderDeliveryFlowInfo(pobj, actionBody) {//获取订单交付流程信息
......@@ -616,7 +728,7 @@ class OrderInfoService extends ServiceBase {
if (!item) {
return system.getResult(null, "order data is empty!");
}
if (Number(item.orderStatus) == 1) {
if (item.orderStatus == 1) {
return system.getResult(null, "order status is unpay!");
}
var updateDeliveryInfo = {
......@@ -646,7 +758,7 @@ class OrderInfoService extends ServiceBase {
updateDeliveryInfo.updated = actionBody.updated;
updateDeliveryInfo.orderDeliveryStatus = actionBody.orderDeliveryStatus;
var tempList = actionBody.orderDeliveryStatusName.split('-');
updateDeliveryInfo.orderDeliveryStatusName = tempList[tempList.length - 1];
updateDeliveryInfo.orderDeliveryStatusName = tempList[tempList.l修改ength - 1];
var dataIndex = updateDeliveryInfo.flowList.findIndex(f => f.orderDeliveryStatus == actionBody.orderDeliveryStatus);
if (dataIndex > -1) {
......
已经使用的编码汇总:
已经使用的编码汇总:
1.对订单操作修改
30000
30010
30020
30030
30040
30050
30060
30070
30080
30090
30100
30110
30120
30130
30140
30150
========================================================
2.添加订单操作
20000
20010
20020
20030
20040
20050
\ 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