Commit 9ca660cc by 宋毅

tj

parent 0dda07ae
...@@ -62,7 +62,7 @@ class TmOrderAPI extends APIBase { ...@@ -62,7 +62,7 @@ class TmOrderAPI extends APIBase {
opResult = await this.toolSve.decryptStr(req.app, action_body.opStr); opResult = await this.toolSve.decryptStr(req.app, action_body.opStr);
break; break;
case "op1688ChannelPushOrder"://处理渠道订单信息 case "op1688ChannelPushOrder"://处理渠道订单信息
opResult = await this.orderSve.op1688ChannelPushOrderTest(action_body, pobj, req); opResult = await this.orderSve.op1688ChannelPushOrder(action_body, pobj, req);
if (opResult.status == 0) { if (opResult.status == 0) {
opResult.data = null; opResult.data = null;
var encryptResult = await this.toolSve.encryptStr(req.app, action_body.channelUserId); var encryptResult = await this.toolSve.encryptStr(req.app, action_body.channelUserId);
...@@ -112,8 +112,8 @@ class TmOrderAPI extends APIBase { ...@@ -112,8 +112,8 @@ class TmOrderAPI extends APIBase {
await this.pushData2(opResult, req, pobj, url); await this.pushData2(opResult, req, pobj, url);
} }
break; break;
case "getTmOrderList"://商标交付列表 case "getTmOrderList"://商标交付列表
opResult = await this.ordertmproductSve.getTmOrderList(action_body); opResult = await this.ordertmproductSve.getTmOrderList(action_body, req);
break; break;
case "getTmOrderInfo"://商标交付信息 case "getTmOrderInfo"://商标交付信息
opResult = await this.ordertmproductSve.getTmOrder(action_body); opResult = await this.ordertmproductSve.getTmOrder(action_body);
......
...@@ -21,5 +21,40 @@ class OrderTmProductDao extends Dao { ...@@ -21,5 +21,40 @@ class OrderTmProductDao extends Dao {
raw: true 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; module.exports = OrderTmProductDao;
...@@ -54,7 +54,7 @@ class OrderService extends ServiceBase { ...@@ -54,7 +54,7 @@ class OrderService extends ServiceBase {
"bizStatus": "S", "bizStatus": "S",
"paymentAmount": 420, "paymentAmount": 420,
"executePrice": 420, "executePrice": 420,
"orderItemNum": "W171200000000_33", "orderItemNum": "ZQ3120025200_01",
"gmtServiceBegin": "20171231000000000+0800", "gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800", "gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [], "settleItemDtos": [],
...@@ -70,7 +70,87 @@ class OrderService extends ServiceBase { ...@@ -70,7 +70,87 @@ class OrderService extends ServiceBase {
"bizStatus": "S", "bizStatus": "S",
"paymentAmount": 420, "paymentAmount": 420,
"executePrice": 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", "gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800", "gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [], "settleItemDtos": [],
......
...@@ -66,12 +66,14 @@ class OrderTmProductService extends ServiceBase { ...@@ -66,12 +66,14 @@ class OrderTmProductService extends ServiceBase {
tm["name"] = "图形"; tm["name"] = "图形";
} }
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
//创建订单 var orderTm = await self.dao.getItemByChannelServiceNo(channelOrder.channelServiceNo, app.id, t);
var ordercode = await self.getBusUid("tm"); if (!orderTm) {
return system.getResult(null, "交付单数据不存在");
}
var orderAmount = tm; var orderAmount = tm;
orderAmount.salesNum = tm.nclOneCodes.length; orderAmount.salesNum = tm.nclOneCodes.length;
orderAmount.minitermNum = tm.nclCount; 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) { if (orderResult.status != 0) {
return orderResult; return orderResult;
} }
...@@ -92,6 +94,7 @@ class OrderTmProductService extends ServiceBase { ...@@ -92,6 +94,7 @@ class OrderTmProductService extends ServiceBase {
notes: tm.notes || "", // 备注信息 notes: tm.notes || "", // 备注信息
nclOneCount: tm.nclOneCodes.length, nclOneCount: tm.nclOneCodes.length,
nclCount: tm.nclCount, nclCount: tm.nclCount,
deliveryOrderNo: orderTm.deliveryOrderNo
}; };
var flowContent = ""; var flowContent = "";
if (apply.customerType == "person") { if (apply.customerType == "person") {
...@@ -116,17 +119,16 @@ class OrderTmProductService extends ServiceBase { ...@@ -116,17 +119,16 @@ class OrderTmProductService extends ServiceBase {
await self.opCustomerInfo(user, apply, orderProductObj, t); await self.opCustomerInfo(user, apply, orderProductObj, t);
//创建服务单 //创建服务单
var putWhere = { where: { channelServiceNo: channelOrder.channelServiceNo } }; 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 = { var flowObj = {
app_id: user.app_id, app_id: user.app_id,
createuser_id: user.id, createuser_id: user.id,
sourceOrderNo: ordercode, sourceOrderNo: orderTm.sourceOrderNo,
opContent: flowContent opContent: flowContent
}; };
await self.orderflowDao.create(flowObj, t);//创建订单流程 await self.orderflowDao.create(flowObj, t);//创建订单流程
flowObj.sourceOrderNo = orderProductObj.deliveryOrderNo; flowObj.sourceOrderNo = orderProductObj.deliveryOrderNo;
await self.orderflowDao.create(flowObj, t);//创建交付流程 await self.orderflowDao.create(flowObj, t);//创建交付流程
orderTm.needNo = channelOrder.needNo || null;//需求单号
var returnTm = await self.opTmInfo(user, tm, apply, nclones, orderTm, JSON.stringify(productItem), t); var returnTm = await self.opTmInfo(user, tm, apply, nclones, orderTm, JSON.stringify(productItem), t);
return system.getResultSuccess({ return system.getResultSuccess({
deliveryOrderNo: orderProductObj.deliveryOrderNo, deliveryOrderNo: orderProductObj.deliveryOrderNo,
...@@ -517,7 +519,7 @@ class OrderTmProductService extends ServiceBase { ...@@ -517,7 +519,7 @@ class OrderTmProductService extends ServiceBase {
* 商标交付列表 * 商标交付列表
* @param {*} params 格式:{channelServiceNo:XX, app:{ appId:XX}} * @param {*} params 格式:{channelServiceNo:XX, app:{ appId:XX}}
*/ */
async getTmOrderList(params) {//商标交付列表 async getTmOrderList(params, req) {//商标交付列表
var pageSize = Number(params.pageSize || 10); var pageSize = Number(params.pageSize || 10);
var pageInde = Number(params.pageInde || 1); var pageInde = Number(params.pageInde || 1);
var from = pageInde == 1 ? 0 : Number((pageInde - 1) * pageSize); var from = pageInde == 1 ? 0 : Number((pageInde - 1) * pageSize);
...@@ -525,10 +527,14 @@ class OrderTmProductService extends ServiceBase { ...@@ -525,10 +527,14 @@ class OrderTmProductService extends ServiceBase {
pageSize = 50; pageSize = 50;
} }
var sql = "SELECT tm.`channelServiceNo`,tm.`deliveryOrderNo`,tm.`tmName`,tm.`nclOneCount`,tm.`nclOneCodes`,tm.itemCode,tm.itemName," + 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" + " 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 "; " `b_customerinfo` AS c ON tm.`deliveryOrderNo`=c.`deliveryOrderNo` where tm.deleted_at is null ";
var paramWhere = {}; var paramWhere = {};
if (req.user) {
sql += " and tm.createuser_id=:createuser_id";
paramWhere.createuser_id = req.user.id;
}
if (params.channelServiceNo) { if (params.channelServiceNo) {
sql += " and tm.channelServiceNo like :channelServiceNo"; sql += " and tm.channelServiceNo like :channelServiceNo";
paramWhere.channelServiceNo = "%" + params.channelServiceNo.trim() + "%"; 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