Commit 87382b23 by 宋毅

处理渠道退款

parent c7065bd9
const system = require("../../../system");
const Dao = require("../../dao.base");
const { Op } = require("sequelize");
const {Op} = require("sequelize");
class OrderInfoDao extends Dao {
constructor() {
super(Dao.getModelName(OrderInfoDao));
}
async getItemStatusByOrderNo(orderNo, uapp_id) {
var sqlWhere = {
where: {
orderNo: orderNo
},
attributes: [
"id",
"uapp_id",
"orderNo",
"channelServiceNo",
"channelOrderNo",
"orderServiceNo",
"channelUserId",
"ownerUserId",
"payTime",
"quantity",
"serviceQuantity",
"orderStatusName",
"orderStatus",
"totalSum",
"payTotalSum",
"refundSum",
"invoiceApplyStatus",
"created_at"],
raw: true
};
if (uapp_id) {
sqlWhere.where.uapp_id = uapp_id;
constructor() {
super(Dao.getModelName(OrderInfoDao));
}
return await this.model.findOne(sqlWhere);
}
async getItemStatusByChannelOrderNo(channelOrderNo, uapp_id) {
var sqlWhere = {
where: {
channelOrderNo: channelOrderNo
},
attributes: [
"id",
"uapp_id",
"orderNo",
"channelServiceNo",
"channelOrderNo",
"orderServiceNo",
"channelUserId",
"ownerUserId",
"payTime",
"quantity",
"serviceQuantity",
"orderStatusName",
"orderStatus",
"totalSum",
"payTotalSum",
"refundSum",
"invoiceApplyStatus",
"created_at"],
raw: true
};
if (uapp_id) {
sqlWhere.where.uapp_id = uapp_id;
/**
* 更新订单
* @param status
* @param statusName
* @param channelOrderNo
* @param uapp_id
* @returns {Promise<*>}
*/
async updateStatus(status, statusName, channelOrderNo, uapp_id) {
let result = await this.updateByWhere({orderStatus: status, orderStatusName: statusName}, {
where: {
channelOrderNo: channelOrderNo,
uapp_id: uapp_id,
}
});
return result;
}
return await this.model.findOne(sqlWhere);
}
async delOrderByOrderNo(orderNo, uapp_id, channelUserId) {
var sqlWhere = {
orderNo: orderNo,
uapp_id: uapp_id,
channelUserId: channelUserId
};
return await this.delete(sqlWhere);
}
async delOrderByOrderNoEname(orderNo) {
var sqlWhere = {
orderNo: orderNo
};
return await this.delete(sqlWhere);
}
async channeldelOrder(channelOrderNo, uapp_id) {
var sqlWhere = {
channelOrderNo: channelOrderNo,
uapp_id: uapp_id,
};
return await this.delete(sqlWhere);
}
async addOrderDelivery(data, orderNo, t) {//新增交付信息
const sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
await this.customInsert(sql, null, t);
return system.getResultSuccess()
}
async getItemStatusByOrderNo(orderNo, uapp_id) {
var sqlWhere = {
where: {
orderNo: orderNo
},
attributes: [
"id",
"uapp_id",
"orderNo",
"channelServiceNo",
"channelOrderNo",
"orderServiceNo",
"channelUserId",
"ownerUserId",
"payTime",
"quantity",
"serviceQuantity",
"orderStatusName",
"orderStatus",
"totalSum",
"payTotalSum",
"refundSum",
"invoiceApplyStatus",
"created_at"],
raw: true
};
if (uapp_id) {
sqlWhere.where.uapp_id = uapp_id;
}
return await this.model.findOne(sqlWhere);
}
/**
* 根据ids 获取需求
* @param ids
* @returns {Promise<void>}
*/
async getOrdersByIds(ids) {
let orders = await this.findAll({
where: {
channelOrderNo: {
[Op.in]: ids
async getItemStatusByChannelOrderNo(channelOrderNo, uapp_id) {
var sqlWhere = {
where: {
channelOrderNo: channelOrderNo
},
attributes: [
"id",
"uapp_id",
"orderNo",
"channelServiceNo",
"channelOrderNo",
"orderServiceNo",
"channelUserId",
"ownerUserId",
"payTime",
"quantity",
"serviceQuantity",
"orderStatusName",
"orderStatus",
"totalSum",
"payTotalSum",
"refundSum",
"invoiceApplyStatus",
"created_at"],
raw: true
};
if (uapp_id) {
sqlWhere.where.uapp_id = uapp_id;
}
}
})
return orders;
}
return await this.model.findOne(sqlWhere);
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async bulkUpdate(orders) {
let result = await this.bulkCreate(orders, {
fields: ["id", "status", "statusName"],
updateOnDuplicate: ["status", "statusName"]
});
return result;
}
async delOrderByOrderNo(orderNo, uapp_id, channelUserId) {
var sqlWhere = {
orderNo: orderNo,
uapp_id: uapp_id,
channelUserId: channelUserId
};
return await this.delete(sqlWhere);
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async bulkUpdateStatus(status, statusName, ids) {
let result = await this.updateByWhere({ orderStatus: status, orderStatusName: statusName }, {
where: {
channelOrderNo: {
[Op.in]: ids
}
}
});
return result;
}
async delOrderByOrderNoEname(orderNo) {
var sqlWhere = {
orderNo: orderNo
};
return await this.delete(sqlWhere);
}
async channeldelOrder(channelOrderNo, uapp_id) {
var sqlWhere = {
channelOrderNo: channelOrderNo,
uapp_id: uapp_id,
};
return await this.delete(sqlWhere);
}
async addOrderDelivery(data, orderNo, t) {//新增交付信息
const sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
await this.customInsert(sql, null, t);
return system.getResultSuccess()
}
/**
* 根据ids 获取需求
* @param ids
* @returns {Promise<void>}
*/
async getOrdersByIds(ids) {
let orders = await this.findAll({
where: {
channelOrderNo: {
[Op.in]: ids
}
}
})
return orders;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async bulkUpdate(orders) {
let result = await this.bulkCreate(orders, {
fields: ["id", "status", "statusName"],
updateOnDuplicate: ["status", "statusName"]
});
return result;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async bulkUpdateStatus(status, statusName, ids) {
let result = await this.updateByWhere({orderStatus: status, orderStatusName: statusName}, {
where: {
channelOrderNo: {
[Op.in]: ids
}
}
});
return result;
}
}
module.exports = OrderInfoDao;
......@@ -35,7 +35,7 @@ class OrderInfoService extends ServiceBase {
delivery_content: null,//包含订单联系人orderContact
product_info: null
};
var deliveryInfoResult = await this.getOrderDeliveryInfo(null, { orderNo: item.orderNo });
var deliveryInfoResult = await this.getOrderDeliveryInfo(null, {orderNo: item.orderNo});
if (deliveryInfoResult && deliveryInfoResult.status == 0) {
resultParams.delivery_content = deliveryInfoResult.data;
}
......@@ -509,7 +509,7 @@ class OrderInfoService extends ServiceBase {
let self = this;
return await self.db.transaction(async function (t) {
if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) {
let rtn = await self.dao.findOne({ channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo }, t);
let rtn = await self.dao.findOne({channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo}, t);
if (rtn) {
return system.getResultSuccess({
orderNo: rtn.orderNo,
......@@ -604,7 +604,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id);
if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) {
var rtn = await self.dao.findOne({ channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo }, t);
var rtn = await self.dao.findOne({channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo}, t);
if (rtn) {
return system.getResultSuccess({
orderNo: rtn.orderNo,
......@@ -636,7 +636,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id);
if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) {
var count = await self.dao.findCount({ where: { channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo } });
var count = await self.dao.findCount({where: {channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo}});
if (count > 0) {
return system.getResultFail(-1, "订单不能重复创建s");
}
......@@ -704,7 +704,7 @@ class OrderInfoService extends ServiceBase {
var self = this;
return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ic" + pobj.appInfo.uapp_id);
var needsolutioninfo = await self.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.solutionBizId }, t)
var needsolutioninfo = await self.needsolutionDao.findOne({channelSolutionNo: pobj.actionBody.solutionBizId}, t)
pobj.actionBody.channelOrder = {
channelServiceNo: pobj.actionBody.orderNo,
channelOrderNo: pobj.actionBody.orderNo,
......@@ -713,7 +713,7 @@ class OrderInfoService extends ServiceBase {
}
var item = await self.createOrder(pobj, orderNo, t);
// needsolutioninfo.status = "ywc";
await self.needsolutionDao.update({ id: needsolutioninfo.id, status: "dqr" }, t);
await self.needsolutionDao.update({id: needsolutioninfo.id, status: "dqr"}, t);
self.dao.addOrderDelivery(pobj.actionBody.deliveryData, orderNo, t);
return system.getResultSuccess({
orderNo: orderNo,
......@@ -728,7 +728,7 @@ class OrderInfoService extends ServiceBase {
//接收方案状态及支付信息
async receiveSolutionPayInfo(channelSolutionNo, status, orderPrice, self, t) {
var needsolutioninfo = await self.needsolutionDao.findOne({ channelSolutionNo: channelSolutionNo }, t);
var needsolutioninfo = await self.needsolutionDao.findOne({channelSolutionNo: channelSolutionNo}, t);
if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案");
}
......@@ -788,7 +788,7 @@ class OrderInfoService extends ServiceBase {
if (actionBody.orderContact.fax) {
updateFields['fax'] = actionBody.orderContact.fax
}
this.ordercontactsDao.updateByWhere(updateFields, { where: { sourceOrderNo: actionBody.orderNo } });
this.ordercontactsDao.updateByWhere(updateFields, {where: {sourceOrderNo: actionBody.orderNo}});
if (actionBody.notes) {
actionBody.isGetContact = 0;
var itemResult = await this.getOrderDeliveryInfo(pobj, actionBody);
......@@ -799,7 +799,7 @@ class OrderInfoService extends ServiceBase {
}
}
}//修改备注
var resultParams = { orderStatus: orderItem.orderStatus };
var resultParams = {orderStatus: orderItem.orderStatus};
if (orderItem.orderStatus < 4) {
var orderProductItem = await this.orderproductDao.getItemInfoByOrderNo(actionBody.orderNo);
if (orderProductItem) {
......@@ -913,7 +913,7 @@ class OrderInfoService extends ServiceBase {
}
if (putOrderProductItem.channelItemAppendName) {
self.orderproductDao.updateByWhere(putOrderProductItem, { where: { sourceOrderNo: actionBody.orderNo } });
self.orderproductDao.updateByWhere(putOrderProductItem, {where: {sourceOrderNo: actionBody.orderNo}});
}
}
if (tipsMsg) {
......@@ -1011,11 +1011,11 @@ class OrderInfoService extends ServiceBase {
pfProfitSum: pfProfitSum,//decimal(12,2) //订单平台毛利润总额((100-渠道利润分成比例)/100 * 订单毛利润总额)
channelProfitSum: channelProfitSum//decimal(12,2) //订单渠道分成毛利润总额(订单毛利润总额-平台毛利润总额)
}
self.updateByWhere(putOrderFields, { where: { orderNo: actionBody.orderNo } }, t);
self.orderReceiptVoucherDao.updateByWhere({ totalSum: totalSum }, { where: { sourceOrderNo: actionBody.orderNo } }, t);
self.updateByWhere(putOrderFields, {where: {orderNo: actionBody.orderNo}}, t);
self.orderReceiptVoucherDao.updateByWhere({totalSum: totalSum}, {where: {sourceOrderNo: actionBody.orderNo}}, t);
}
if (isUpdateProduct > 0) {
self.orderproductDao.updateByWhere({ serviceItemSnapshot: JSON.stringify(product_info) }, { where: { sourceOrderNo: actionBody.orderNo } }, t);
self.orderproductDao.updateByWhere({serviceItemSnapshot: JSON.stringify(product_info)}, {where: {sourceOrderNo: actionBody.orderNo}}, t);
}
});
}//未付款进行订单金额修改
......@@ -1074,6 +1074,7 @@ class OrderInfoService extends ServiceBase {
console.log("delENameOrder res----", system.getResultSuccess(res))
return system.getResultSuccess(res);
}
//baidureg关闭订单 2020-12-20
async delOrders(pobj, actionBody) {//删除订单
var i;
......@@ -1112,7 +1113,7 @@ class OrderInfoService extends ServiceBase {
// 2020 0923 lin 新增 根据id修改orderStatus,目前用来商标交易更新订单状态
async updateOrderStatusById(pobj, actionBody) {
var orderInfo = await this.dao.model.update({ orderStatus: actionBody.orderStatus }, { where: { id: actionBody.orderId } })
var orderInfo = await this.dao.model.update({orderStatus: actionBody.orderStatus}, {where: {id: actionBody.orderId}})
if (!orderInfo) {
return system.getResult(null, "修改失败");
}
......@@ -1154,7 +1155,7 @@ class OrderInfoService extends ServiceBase {
async putReceiptVoucherInfo(pobj, actionBody) {
var isPut = actionBody.isPut || "";
if (isPut > 0) {
await this.orderReceiptVoucherDao.updateByWhere(actionBody.setField, { where: { id: actionBody.receiptVoucherId } });
await this.orderReceiptVoucherDao.updateByWhere(actionBody.setField, {where: {id: actionBody.receiptVoucherId}});
}
return system.getResultSuccess();
}
......@@ -1165,15 +1166,15 @@ class OrderInfoService extends ServiceBase {
var result = system.getResultSuccess();
result.data = {
actionBody:
{
delivery_content: {},
order_info: { orderStatus: 2 },
product_info: {}
}
{
delivery_content: {},
order_info: {orderStatus: 2},
product_info: {}
}
};
var sql = "select * from c_order_delivery where sourceOrderNo=:sourceOrderNo";
var paramWhere = { sourceOrderNo: actionBody.orderNo };
var paramWhere = {sourceOrderNo: actionBody.orderNo};
var list = await this.customQuery(sql, paramWhere);
if (list && list.length > 0) {
if (list[0].deliveryContent) {
......@@ -1474,7 +1475,7 @@ class OrderInfoService extends ServiceBase {
async getOrderServiceNoByOrderNo(pobj, actionBody) {//根据订单号获取订单信息
var sql = "select `orderNo`,orderServiceNo from v_order where orderNo=:orderNo LIMIT 1";
var paramWhere = { orderNo: actionBody.orderNo };
var paramWhere = {orderNo: actionBody.orderNo};
var list = await this.customQuery(sql, paramWhere);
if (!list || list.length == 0) {
return system.getResult(null, "订单数据为空,30200");
......@@ -1487,7 +1488,7 @@ class OrderInfoService extends ServiceBase {
var sql = "select `orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`," +
" `invoiceApplyStatus`,`opNotes`,`notes`,`channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,channelItemAppendName,`serviceItemCode`,`picUrl`,`serviceItemSnapshot`,`orderSnapshot`,created_at from " +
" v_order where uapp_id=:uapp_id and orderNo=:orderNo LIMIT 1";
var paramWhere = { uapp_id: pobj.appInfo.uapp_id, orderNo: actionBody.orderNo };
var paramWhere = {uapp_id: pobj.appInfo.uapp_id, orderNo: actionBody.orderNo};
var list = await this.customQuery(sql, paramWhere);
if (!list || list.length == 0) {
return system.getResult(null, "订单数据为空,30200");
......@@ -1507,7 +1508,7 @@ class OrderInfoService extends ServiceBase {
async getOrderByChannelOrderNo(pobj, actionBody) {// 根据渠道订单号获取订单
var app = pobj.appInfo;
let orderItem = await this.findOne({ channelOrderNo: actionBody.bizId, uapp_id: app.uapp_id });
let orderItem = await this.findOne({channelOrderNo: actionBody.bizId, uapp_id: app.uapp_id});
if (!orderItem) {
return system.getResult(null, "order data is empty");
}
......@@ -1517,7 +1518,7 @@ class OrderInfoService extends ServiceBase {
async getOrderDeliveryInfo(pobj, actionBody) {//获取订单交付信息
var sql = "select * from c_order_delivery where sourceOrderNo=:sourceOrderNo";
var paramWhere = { sourceOrderNo: actionBody.orderNo };
var paramWhere = {sourceOrderNo: actionBody.orderNo};
var list = await this.customQuery(sql, paramWhere);
var result = system.getResultSuccess();
result.data = {};
......@@ -1538,7 +1539,7 @@ class OrderInfoService extends ServiceBase {
async getOrderDeliveryFlowInfo(pobj, actionBody) {//获取订单交付流程信息
var sql = "select * from c_delivery_official_flow where sourceOrderNo=:sourceOrderNo";
var paramWhere = { sourceOrderNo: actionBody.sourceOrderNo };
var paramWhere = {sourceOrderNo: actionBody.sourceOrderNo};
var list = await this.customQuery(sql, paramWhere);
var result = system.getResultSuccess();
if (list && list.length > 0) {
......@@ -1551,7 +1552,7 @@ class OrderInfoService extends ServiceBase {
async getOrderDeliveryFlowList(pobj, actionBody) {//获取订单交付流程列表信息
var sql = "select * from c_delivery_official_flow where sourceOrderNo IN(:sourceOrderNo)";
var paramWhere = { sourceOrderNo: actionBody.sourceOrderNoList };
var paramWhere = {sourceOrderNo: actionBody.sourceOrderNoList};
var list = await this.customQuery(sql, paramWhere);
var tmpList = [];
if (list && list.length > 0) {
......@@ -1634,12 +1635,12 @@ class OrderInfoService extends ServiceBase {
await this.flowlogDao.create(orderLog);
var sql = null;
if (addi > 0) {
await this.dao.updateByWhere({ orderStatus: 4 }, { where: { id: item.id } });
await this.dao.updateByWhere({orderStatus: 4}, {where: {id: item.id}});
sql = "INSERT INTO `c_delivery_official_flow` (`sourceOrderNo`,`officialFlow`) VALUE('" +
actionBody.orderNo + "','" + JSON.stringify(updateDeliveryInfo) + "')";
} else {
if (updateDeliveryInfo.orderDeliveryStatusName == "证件邮寄环节") {
await this.dao.updateByWhere({ orderStatus: 8 }, { where: { id: item.id } });
await this.dao.updateByWhere({orderStatus: 8}, {where: {id: item.id}});
}
sql = "UPDATE `c_delivery_official_flow` SET officialFlow ='" + JSON.stringify(updateDeliveryInfo) + "' where sourceOrderNo='" + actionBody.orderNo + "'";
sql = sql.replace('\n', '');
......@@ -1739,7 +1740,7 @@ class OrderInfoService extends ServiceBase {
try {
await self.db.transaction(async function (t) {
if (Object.keys(updateOrderFields).length > 0) {
self.updateByWhere(updateOrderFields, { where: { orderNo: actionBody.orderNo } }, t);
self.updateByWhere(updateOrderFields, {where: {orderNo: actionBody.orderNo}}, t);
}
await self.flowlogDao.create(orderLog, t);
});
......@@ -1816,7 +1817,7 @@ class OrderInfoService extends ServiceBase {
}
var self = this;
await self.db.transaction(async function (t) {
await self.dao.updateByWhere({ orderStatus: 2, payTime: new Date() }, { where: { orderNo: parmas.orderNo } }, t);
await self.dao.updateByWhere({orderStatus: 2, payTime: new Date()}, {where: {orderNo: parmas.orderNo}}, t);
var putFields = {
auditStatus: "tg",
accountType: parmas.pay_type,
......@@ -1827,7 +1828,7 @@ class OrderInfoService extends ServiceBase {
buyerAliLogonId: parmas.buyer_logon_id || "",//买家支付宝账号
notes: parmas.paytime || ""//备注下支付时间
};
await self.orderReceiptVoucherDao.updateByWhere(putFields, { where: { sourceOrderNo: parmas.orderNo } }, t);
await self.orderReceiptVoucherDao.updateByWhere(putFields, {where: {sourceOrderNo: parmas.orderNo}}, t);
var orderLog = {
uapp_id: appInfo.uapp_id,
sourceOrderNo: parmas.orderNo,
......@@ -1879,7 +1880,7 @@ class OrderInfoService extends ServiceBase {
await self.dao.updateByWhere({
orderStatus: 2,
payTime: parmas.gmt_payment
}, { where: { orderNo: parmas.orderNo } }, t);
}, {where: {orderNo: parmas.orderNo}}, t);
var putFields = {
auditStatus: "tg",
accountType: parmas.pay_type,
......@@ -1891,7 +1892,7 @@ class OrderInfoService extends ServiceBase {
updated_at: parmas.gmt_payment,//该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss。
notes: parmas.gmt_create || ""//该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss。
};
await self.orderReceiptVoucherDao.updateByWhere(putFields, { where: { sourceOrderNo: parmas.orderNo } }, t);
await self.orderReceiptVoucherDao.updateByWhere(putFields, {where: {sourceOrderNo: parmas.orderNo}}, t);
var orderLog = {
uapp_id: appInfo.uapp_id,
sourceOrderNo: parmas.orderNo,
......@@ -1933,7 +1934,7 @@ class OrderInfoService extends ServiceBase {
if (applyAddr.indexOf(addArr[i]) >= 0) {
var sql = "update c_order_region set count=count+1 where province=:province";
// 修改条件 省名字相同,appid相同
var paramWhere = { where: { province: addArr[i], uapp_id: item.uapp_id } };
var paramWhere = {where: {province: addArr[i], uapp_id: item.uapp_id}};
var updateFields = {
count: sequelize.literal('count+1')
}
......@@ -1964,7 +1965,7 @@ class OrderInfoService extends ServiceBase {
await self.dao.updateByWhere({
orderStatus: 2,
payTime: parmas.time_end
}, { where: { orderNo: parmas.orderNo } }, t);
}, {where: {orderNo: parmas.orderNo}}, t);
var putFields = {
auditStatus: "tg",
accountType: parmas.pay_type,
......@@ -1976,7 +1977,7 @@ class OrderInfoService extends ServiceBase {
updated_at: parmas.time_end,//该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss。
notes: parmas.gmt_create || ""//该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss。
};
await self.orderReceiptVoucherDao.updateByWhere(putFields, { where: { sourceOrderNo: parmas.orderNo } }, t);
await self.orderReceiptVoucherDao.updateByWhere(putFields, {where: {sourceOrderNo: parmas.orderNo}}, t);
var orderLog = {
uapp_id: appInfo.uapp_id,
sourceOrderNo: parmas.orderNo,
......@@ -2031,7 +2032,7 @@ class OrderInfoService extends ServiceBase {
await self.dao.updateByWhere({
orderStatus: 2,
payTime: parmas.time_end
}, { where: { orderNo: parmas.orderNo } }, t);
}, {where: {orderNo: parmas.orderNo}}, t);
var putFields = {
auditStatus: "tg",
accountType: parmas.pay_type,
......@@ -2043,7 +2044,7 @@ class OrderInfoService extends ServiceBase {
updated_at: new Date(),//该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss。
notes: parmas.gmt_create || ""//该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss。
};
await self.orderReceiptVoucherDao.updateByWhere(putFields, { where: { sourceOrderNo: parmas.orderNo } }, t);
await self.orderReceiptVoucherDao.updateByWhere(putFields, {where: {sourceOrderNo: parmas.orderNo}}, t);
var orderLog = {
uapp_id: appInfo.uapp_id,
sourceOrderNo: parmas.orderNo,
......@@ -2109,7 +2110,7 @@ class OrderInfoService extends ServiceBase {
}
//获取订单信息
var orderinfo = await this.dao.model.findOne({
where: { orderNo: orderNo, uapp_id: app.uapp_id }, raw: true
where: {orderNo: orderNo, uapp_id: app.uapp_id}, raw: true
});
if (!orderinfo || !orderinfo.id) {
return system.getResultFail(-110, "未知订单信息");
......@@ -2192,7 +2193,7 @@ class OrderInfoService extends ServiceBase {
async tmRefuse(pobj) {
var ab = pobj.actionBody;
var app = pobj.appInfo;
var orderinfo = await this.findOne({ channelOrderNo: ab.bizId, uapp_id: app.uapp_id });
var orderinfo = await this.findOne({channelOrderNo: ab.bizId, uapp_id: app.uapp_id});
if (!orderinfo) {
return system.getResultFail(-6001, "订单不存在");
}
......@@ -2209,7 +2210,7 @@ class OrderInfoService extends ServiceBase {
//智能选择 尼斯类获取
async getNclByCode(pobj) {
var sql = "select `business_code`,`ncl_content` from b_business_ncl where business_code=:business_code LIMIT 1";
var paramWhere = { business_code: pobj.actionBody.businessCode };
var paramWhere = {business_code: pobj.actionBody.businessCode};
var result = await this.customQuery(sql, paramWhere);
if (Object.keys(result).length == 0) {
return system.getResultFail(-1, 'find err');
......@@ -2519,7 +2520,7 @@ class OrderInfoService extends ServiceBase {
/**
* 接收阿里云商标订单信息
* @param {*} pobj
* @param {*} pobj
*/
async receiveAliTmOrder(pobj) {
var res = await this.checkAndPackageAliTmOrderParams(pobj);
......@@ -2564,7 +2565,7 @@ class OrderInfoService extends ServiceBase {
/**
* 检查封装阿里商标订单参数
* @param {*} pobj
* @param {*} pobj
*/
async checkAndPackageAliTmOrderParams(pobj) {
if (!pobj || !pobj.actionBody) {
......@@ -2592,7 +2593,7 @@ class OrderInfoService extends ServiceBase {
return system.getResult(null, "阿里需求号不能为空,100110");
}
var orderInfo = await this.dao.model.findOne({
where: { channelOrderNo: pobj.actionBody.channelOrderNo, uapp_id: pobj.appInfo.uapp_id }, raw: true
where: {channelOrderNo: pobj.actionBody.channelOrderNo, uapp_id: pobj.appInfo.uapp_id}, raw: true
});
if (orderInfo && orderInfo.id) {
return system.getResult(null, "阿里订单号:" + pobj.actionBody.channelOrderNo + "的订单已存在,100140");
......@@ -2613,7 +2614,7 @@ class OrderInfoService extends ServiceBase {
/**
* 接收阿里商标订单退款信息
* @param {*} pobj
* @param {*} pobj
*/
async receiveAliTmOrderRefund(pobj) {
if (!pobj || !pobj.actionBody) {
......@@ -2630,7 +2631,7 @@ class OrderInfoService extends ServiceBase {
}
var orderInfo = await this.dao.model.findOne({
attributes: ["id", "channelOrderNo", "payTotalSum"],
where: { channelOrderNo: pobj.actionBody.channelOrderNo, uapp_id: pobj.appInfo.uapp_id }, raw: true
where: {channelOrderNo: pobj.actionBody.channelOrderNo, uapp_id: pobj.appInfo.uapp_id}, raw: true
});
if (!orderInfo || !orderInfo.id) {
return system.getResult(null, "阿里订单号:" + pobj.actionBody.channelOrderNo + "的订单不存在,100140");
......@@ -2642,6 +2643,19 @@ class OrderInfoService extends ServiceBase {
return system.getResultSuccess();
}
/***
* 处理渠道退款
* @param pobj
* @param actionBody
* @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/
async channeldelOrder(pobj, actionBody) {
let status = actionBody.status || 16;
let statusName = actionBody.statusName || "已退款";
await this.dao.updateStatus(status, statusName, actionBody.orderNo, pobj.appInfo.uapp_id);
return system.getResultSuccess();
}
}
module.exports = OrderInfoService;
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