Commit 9ca660cc by 宋毅

tj

parent 0dda07ae
......@@ -62,7 +62,7 @@ class TmOrderAPI extends APIBase {
opResult = await this.toolSve.decryptStr(req.app, action_body.opStr);
break;
case "op1688ChannelPushOrder"://处理渠道订单信息
opResult = await this.orderSve.op1688ChannelPushOrderTest(action_body, pobj, req);
opResult = await this.orderSve.op1688ChannelPushOrder(action_body, pobj, req);
if (opResult.status == 0) {
opResult.data = null;
var encryptResult = await this.toolSve.encryptStr(req.app, action_body.channelUserId);
......@@ -112,8 +112,8 @@ class TmOrderAPI extends APIBase {
await this.pushData2(opResult, req, pobj, url);
}
break;
case "getTmOrderList"://商标交付列表
opResult = await this.ordertmproductSve.getTmOrderList(action_body);
case "getTmOrderList"://商标交付列表
opResult = await this.ordertmproductSve.getTmOrderList(action_body, req);
break;
case "getTmOrderInfo"://商标交付信息
opResult = await this.ordertmproductSve.getTmOrder(action_body);
......
......@@ -21,5 +21,40 @@ class OrderTmProductDao extends Dao {
raw: true
});
}
async getItemByChannelServiceNo(channelServiceNo, appId, t) {
var sqlWhere = {
where: {
channelServiceNo: channelServiceNo,
app_id: appId
}
};
if (t) {
sqlWhere.transaction = t;
}
return this.model.findOne({
sqlWhere,
attributes: ["id",
"deliveryOrderNo",
"needNo",
"sourceOrderNo",
"tmName",
"tmType",
"tmFormType",
"nclOneCodes",
"deliveryStatus",
"picUrl",
"colorizedPicUrl",
"sywjUrl",
"gzwtsUrl",
"nclCount",
"smwjUrl",
"updateuser_id",
"updateuser",
"notes",
"nclOneCount"
],
raw: true
});
}
}
module.exports = OrderTmProductDao;
......@@ -54,7 +54,7 @@ class OrderService extends ServiceBase {
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "W171200000000_33",
"orderItemNum": "ZQ3120025200_01",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [],
......@@ -70,7 +70,87 @@ class OrderService extends ServiceBase {
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "W171200000000_44",
"orderItemNum": "ZQ3120025200_02",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [],
"payCustomerUid": "12345678990000",
"signCustomerUid": "12345678990000"
},
{
"bizStatusExt": "service",
"memberId": "b2b-****02",
"productName": "商机**",
"gmtCreate": "20171231200252000+0800",
"gmtServiceEnd": "20190101000000000+0800",
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "ZQ3120025200_03",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [],
"payCustomerUid": "12345678990000",
"signCustomerUid": "12345678990000"
},
{
"bizStatusExt": "service",
"memberId": "b2b-****02",
"productName": "商机**",
"gmtCreate": "20171231200252000+0800",
"gmtServiceEnd": "20190101000000000+0800",
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "ZQ3120025200_04",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [],
"payCustomerUid": "12345678990000",
"signCustomerUid": "12345678990000"
},
{
"bizStatusExt": "service",
"memberId": "b2b-****02",
"productName": "商机**",
"gmtCreate": "20171231200252000+0800",
"gmtServiceEnd": "20190101000000000+0800",
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "ZQ3120025200_05",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [],
"payCustomerUid": "12345678990000",
"signCustomerUid": "12345678990000"
},
{
"bizStatusExt": "service",
"memberId": "b2b-****02",
"productName": "商机**",
"gmtCreate": "20171231200252000+0800",
"gmtServiceEnd": "20190101000000000+0800",
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "ZQ3120025200_06",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [],
"payCustomerUid": "12345678990000",
"signCustomerUid": "12345678990000"
},
{
"bizStatusExt": "service",
"memberId": "b2b-****02",
"productName": "商机**",
"gmtCreate": "20171231200252000+0800",
"gmtServiceEnd": "20190101000000000+0800",
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "ZQ3120025200_07",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [],
......
......@@ -66,12 +66,14 @@ class OrderTmProductService extends ServiceBase {
tm["name"] = "图形";
}
return await self.db.transaction(async function (t) {
//创建订单
var ordercode = await self.getBusUid("tm");
var orderTm = await self.dao.getItemByChannelServiceNo(channelOrder.channelServiceNo, app.id, t);
if (!orderTm) {
return system.getResult(null, "交付单数据不存在");
}
var orderAmount = tm;
orderAmount.salesNum = tm.nclOneCodes.length;
orderAmount.minitermNum = tm.nclCount;
var orderResult = await self.orderDao.addOrder(ordercode, orderType, user, app, productItem, channelOrder, channelUser, apply, orderAmount, t);
var orderResult = await self.orderDao.addOrder(orderTm.sourceOrderNo, orderType, user, app, productItem, channelOrder, channelUser, apply, orderAmount, t);
if (orderResult.status != 0) {
return orderResult;
}
......@@ -92,6 +94,7 @@ class OrderTmProductService extends ServiceBase {
notes: tm.notes || "", // 备注信息
nclOneCount: tm.nclOneCodes.length,
nclCount: tm.nclCount,
deliveryOrderNo: orderTm.deliveryOrderNo
};
var flowContent = "";
if (apply.customerType == "person") {
......@@ -116,17 +119,16 @@ class OrderTmProductService extends ServiceBase {
await self.opCustomerInfo(user, apply, orderProductObj, t);
//创建服务单
var putWhere = { where: { channelServiceNo: channelOrder.channelServiceNo } };
var orderTm = await self.dao.updateByWhere(orderProductObj, putWhere, t);//创建商标订单--------put
await self.dao.updateByWhere(orderProductObj, putWhere, t);//创建商标订单--------put
var flowObj = {
app_id: user.app_id,
createuser_id: user.id,
sourceOrderNo: ordercode,
sourceOrderNo: orderTm.sourceOrderNo,
opContent: flowContent
};
await self.orderflowDao.create(flowObj, t);//创建订单流程
flowObj.sourceOrderNo = orderProductObj.deliveryOrderNo;
await self.orderflowDao.create(flowObj, t);//创建交付流程
orderTm.needNo = channelOrder.needNo || null;//需求单号
await self.orderflowDao.create(flowObj, t);//创建交付流程
var returnTm = await self.opTmInfo(user, tm, apply, nclones, orderTm, JSON.stringify(productItem), t);
return system.getResultSuccess({
deliveryOrderNo: orderProductObj.deliveryOrderNo,
......@@ -517,7 +519,7 @@ class OrderTmProductService extends ServiceBase {
* 商标交付列表
* @param {*} params 格式:{channelServiceNo:XX, app:{ appId:XX}}
*/
async getTmOrderList(params) {//商标交付列表
async getTmOrderList(params, req) {//商标交付列表
var pageSize = Number(params.pageSize || 10);
var pageInde = Number(params.pageInde || 1);
var from = pageInde == 1 ? 0 : Number((pageInde - 1) * pageSize);
......@@ -525,10 +527,14 @@ class OrderTmProductService extends ServiceBase {
pageSize = 50;
}
var sql = "SELECT tm.`channelServiceNo`,tm.`deliveryOrderNo`,tm.`tmName`,tm.`nclOneCount`,tm.`nclOneCodes`,tm.itemCode,tm.itemName," +
"o.`totalSum`,c.`name`,tm.`deliveryStatus`,tm.`deliveryStatusName`,tm.payStatus,tm.payStatusName,o.created_at AS CreateDate,tm.submitTime" +
"o.`totalSum`,c.`name`,tm.`deliveryStatus`,tm.`deliveryStatusName`,tm.payStatus,tm.payStatusName,o.payTime AS CreateDate,tm.submitTime" +
" FROM `b_order_tm_product` AS tm LEFT JOIN `b_order` AS o ON tm.`sourceOrderNo`=o.`orderNo` LEFT JOIN" +
" `b_customerinfo` AS c ON tm.`deliveryOrderNo`=c.`deliveryOrderNo` where tm.deleted_at is null ";
var paramWhere = {};
if (req.user) {
sql += " and tm.createuser_id=:createuser_id";
paramWhere.createuser_id = req.user.id;
}
if (params.channelServiceNo) {
sql += " and tm.channelServiceNo like :channelServiceNo";
paramWhere.channelServiceNo = "%" + params.channelServiceNo.trim() + "%";
......
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