Commit 7ab5852c by 宋毅

tj

parent f1ef481e
......@@ -72,7 +72,7 @@ class APIBase {
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId,
op: pobj.classname + "/" + methodname,
op: req.classname + "/" + methodname,
content: e.stack,
clientIp: pobj.clientIp,
agent: req.uagent,
......
......@@ -71,7 +71,7 @@ class OrderAPI extends APIBase {
interface_info = interface_list_temp[0];
}
}
if (!interface_list) {
if (!interface_list || interface_list.length == 0) {
interface_info = {
interface_type: "bd",
interface_url: "service.dbcorder.orderinfoSve",
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class OpPayOrder extends APIBase {
constructor() {
super();
this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
}
async receivePayCallBackNotify(pobj, qobj, req) {
var result = await this.orderinfoSve.opOrderPayCallBackTl(pobj, pobj.appInfo);
return result;
}
}
module.exports = OpPayOrder;
\ No newline at end of file
......@@ -19,10 +19,18 @@ class OrderProductDao extends Dao {
"channelItemName",
"serviceItemCode",
"picUrl",
"proPrice",
"price",
"quantity"],
raw: true
});
}
async getItemInfoByOrderNo(orderNo) {
return await this.model.findOne({
where: {
sourceOrderNo: orderNo
},
raw: true
});
}
}
module.exports = OrderProductDao;
......@@ -11,9 +11,12 @@ module.exports = (db, DataTypes) => {
itemName :DataTypes.STRING(100),//产品名称
channelItemCode :DataTypes.STRING(100),// 渠道产品编码
channelItemName :DataTypes.STRING(100),// 渠道产品名称
channelItemAppendName :DataTypes.STRING(500),// 渠道产品附加名称 --如商标名称
serviceItemCode :DataTypes.STRING(100),// 服务商产品编码
picUrl :DataTypes.STRING(500),// 产品图片地址
proPrice :DataTypes.DOUBLE, // 产品价格
price :DataTypes.DOUBLE, // 产品价格
priceDesc :DataTypes.STRING, //定价描述
priceTypeName :DataTypes.STRING(10), //定价类型名称
quantity :DataTypes.INTEGER,// 订单数量(即产品的倍数,默认值为1)
opPayType :DataTypes.STRING(10),// 操作付款类型:00: 创建订单, 10: 补单
serviceItemSnapshot :DataTypes.TEXT('long'), //产品快照
......
......@@ -71,9 +71,12 @@ class OrderInfoService extends ServiceBase {
itemName: actionBody.product_info.item_name,//产品名称
channelItemCode: actionBody.product_info.channel_item_code,// 渠道产品编码
channelItemName: actionBody.product_info.channel_item_name,// 渠道产品名称
channelItemAppendName: actionBody.channelItemAppendName || "",//服务商产品附加名称
serviceItemCode: actionBody.product_info.service_item_code,// 服务商产品编码
picUrl: actionBody.product_info.pic_url,// 产品图片地址
proPrice: actionBody.totalSum, // 产品总价格
price: actionBody.product_info.price_item.price,//定价
priceDesc: actionBody.product_info.price_item.price_desc,//定价描述
priceTypeName: actionBody.product_info.price_item.price_type_name,//定价类型名称
quantity: actionBody.quantity,// 订单数量(即产品的倍数,默认值为1)
opPayType: "00",// 操作付款类型:00: 创建订单, 10: 补单
serviceItemSnapshot: JSON.stringify(actionBody.product_info), //产品快照
......@@ -620,7 +623,7 @@ class OrderInfoService extends ServiceBase {
var paramWhere = {};
var sql = "select `orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`,"
+ " `invoiceApplyStatus`,`opNotes`,`channelItemCode`,`channelItemName`,`serviceItemCode`,`picUrl`,created_at from v_order where uapp_id=:uapp_id";
+ " `invoiceApplyStatus`,`opNotes`,`channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,channelItemAppendName,`serviceItemCode`,`picUrl`,created_at from v_order where uapp_id=:uapp_id";
var sqlCount = "select count(1) as dataCount from v_order where uapp_id=:uapp_id";
paramWhere.uapp_id = pobj.appInfo.uapp_id;
......@@ -653,7 +656,7 @@ class OrderInfoService extends ServiceBase {
paramWhere.entTime = entTime;
}
sql += " LIMIT " + pageSize + " OFFSET " + from;
sql += " LIMIT " + pageSize + " OFFSET " + from + " order by id desc";
var list = await this.customQuery(sql, paramWhere);
var result = system.getResultSuccess(list);
......@@ -670,6 +673,7 @@ class OrderInfoService extends ServiceBase {
var paramWhere = { sourceOrderNo: actionBody.orderNo };
var list = await this.customQuery(sql, paramWhere);
var result = system.getResultSuccess();
result.data = {};
if (list && list.length > 0) {
if (list[0].deliveryContent) {
result.data = list[0].deliveryContent;
......@@ -729,7 +733,7 @@ class OrderInfoService extends ServiceBase {
return system.getResult(null, "order data is empty!");
}
if (item.orderStatus == 1) {
return system.getResult(null, "order status is unpay!");
return system.getResult(null, "order status is unpay!");
}
var updateDeliveryInfo = {
orderDeliveryStatus: actionBody.orderDeliveryStatus,
......@@ -795,6 +799,55 @@ class OrderInfoService extends ServiceBase {
return system.getResultSuccess();
}
async opOrderPayCallBackTl(parmas, appInfo) {//操作订单付款回调---通联
var item = await this.dao.getItemStatusByOrderNo(parmas.orderNo);
if (!item) {
return system.getResult(null, "order data is empty!");
}
if (item.orderStatus > 1) {
return system.getResult(null, "order status is pay!");
}
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.orderReceiptVoucherDao.updateByWhere({ auditStatus: "tg" }, { where: { sourceOrderNo: parmas.orderNo } }, t);
var orderLog = {
uapp_id: appInfo.uapp_id,
sourceOrderNo: parmas.orderNo,
opContent: "您成功支付了订单,请等待服务商服务",
isShow: 1
};
await self.flowlogDao.create(orderLog, t);
var moneyObj = {
uapp_id: appInfo.uapp_id,
sourceOrderNo: parmas.orderNo, // 来源单号
channelUserId: item.channelUserId,
ownerUserId: item.ownerUserId,
accountType: parmas.pay_type,//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它"
directionType: "sr",//凭单类型,"sr": "收","zc": "支"
voucherDate: new Date(),//凭单时间
recvAmount: item.totalSum,//收总额
sourceType: "orderinfo",//来源类型 "orderinfo": "订单","expensevoucher": "费用单"
auditStatus: "tg",//审核状态"dsh": "待审核", "btg": "不通过", "tg": "通过"
};
var moneyJourney = await self.moneyJourneyDao.create(moneyObj, t);
});
var resultParams = {
order_info: item,
delivery_content: null,//包含订单联系人orderContact
product_info: null
};
var deliveryInfoResult = await this.getOrderDeliveryInfo(null, parmas);
if (deliveryInfoResult && deliveryInfoResult.status == 0) {
resultParams.delivery_content = deliveryInfoResult.data;
}
var orderProductItem = await this.orderproductDao.getItemInfoByOrderNo(parmas.orderNo);
if (orderProductItem) {
resultParams.product_info = orderProductItem.serviceItemSnapshot;
}
return system.getResultSuccess(resultParams);
}
//-------------------------------服务商通知订单流程-------------end----------------
......
......@@ -37,7 +37,7 @@ var settings = {
},
apiconfig: {
opLogUrl: function () {
return settings.reqEsAddr() + "bigdata_zc_op_log/_doc?pretty";
return settings.reqEsAddr() + "center_order_log/_doc?pretty";
},
opLogEsIsAdd: function () {
return 1;
......
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