Commit 5c4e8847 by 宋毅

addOrderDelivery移到dao中进行调用

parent 814bc6da
...@@ -49,5 +49,10 @@ class OrderInfoDao extends Dao { ...@@ -49,5 +49,10 @@ class OrderInfoDao extends Dao {
}; };
return await this.delete(sqlWhere); 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);
}
} }
module.exports = OrderInfoDao; module.exports = OrderInfoDao;
...@@ -4,67 +4,67 @@ const uuidv4 = require('uuid/v4'); ...@@ -4,67 +4,67 @@ const uuidv4 = require('uuid/v4');
class InternalCallsNotifyService { class InternalCallsNotifyService {
constructor() { constructor() {
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao"); this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.delivery_status={ this.delivery_status = {
"dqrfa": "待确认方案", "dqrfa": "待确认方案",
"fabtg": "方案不通过", "fabtg": "方案不通过",
"dfwsfw": "待服务", "dfwsfw": "待服务",
"dsccl": "待上传材料", "dsccl": "待上传材料",
"dsh": "待审核", "dsh": "待审核",
"ddj": "待递交", "ddj": "待递交",
"ydj": "已递交", "ydj": "已递交",
"ywc": "已完成" "ywc": "已完成"
}; };
this.statusContrast={ this.statusContrast = {
"WAITCONFIRM":{name:"待确认方案",value:"dqrfa"}, "WAITCONFIRM": { name: "待确认方案", value: "dqrfa" },
"CONFIRMFAIL":{name:"方案不通过",value:"fabtg"}, "CONFIRMFAIL": { name: "方案不通过", value: "fabtg" },
"READY":{name:"待上传材料",value:"dsccl"}, "READY": { name: "待上传材料", value: "dsccl" },
"WAITCOMMIT":{name:"待递交",value:"ddj"}, "WAITCOMMIT": { name: "待递交", value: "ddj" },
"WAITARTIFICIALEXAMINE":{name:"待审核",value:"dsh"}, "WAITARTIFICIALEXAMINE": { name: "待审核", value: "dsh" },
"DOCFINISH": {name:"待审核",value:"dsh"}, "DOCFINISH": { name: "待审核", value: "dsh" },
"AWAITCHECK": {name:"待审核",value:"dsh"}, "AWAITCHECK": { name: "待审核", value: "dsh" },
"COMMITED": {name:"已递交",value:"ydj"}, "COMMITED": { name: "已递交", value: "ydj" },
"ROBOT": {name:"已递交",value:"ydj"}, "ROBOT": { name: "已递交", value: "ydj" },
"ROBOTPAY": {name:"已递交",value:"ydj"}, "ROBOTPAY": { name: "已递交", value: "ydj" },
"RECVCOMMIT": {name:"已递交",value:"ydj"}, "RECVCOMMIT": { name: "已递交", value: "ydj" },
}; };
} }
//接收辅助、担保商标注册信息 //接收辅助、担保商标注册信息
async receiveAssistTmData(pobj){ async receiveAssistTmData(pobj) {
var checkRes = await this.checkParams(pobj); var checkRes = await this.checkParams(pobj);
if(checkRes.status==0){ if (checkRes.status == 0) {
var deliveryData = await this.packagingTmDeliveryData(pobj,null); var deliveryData = await this.packagingTmDeliveryData(pobj, null);
//获取交付信息 //获取交付信息
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo,pobj.serviceNo); var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo, pobj.serviceNo);
if(orderdeliveryRes && orderdeliveryRes.length>0){ if (orderdeliveryRes && orderdeliveryRes.length > 0) {
return system.getResult(null,"保存商标订单交付信息失败,存在重复交付信息,不能重复提交,10300"); return system.getResult(null, "保存商标订单交付信息失败,存在重复交付信息,不能重复提交,10300");
} }
this.addOrderDelivery(deliveryData,deliveryData.sourceOrderNo); await this.orderinfoDao.addOrderDelivery(deliveryData, deliveryData.sourceOrderNo);
await this.orderinfoDao.model.update({isSolution:1}, { where: { orderNo: pobj.sourceOrderNo }}); await this.orderinfoDao.model.update({ isSolution: 1 }, { where: { orderNo: pobj.sourceOrderNo } });
return system.getResultSuccess(); return system.getResultSuccess();
}else{ } else {
return checkRes; return checkRes;
} }
} }
//接收辅助、担保商标注册修改信息 //接收辅助、担保商标注册修改信息
async receiveEditAssistTmData(pobj){ async receiveEditAssistTmData(pobj) {
var checkRes = await this.checkParams(pobj); var checkRes = await this.checkParams(pobj);
if(checkRes.status==0){ if (checkRes.status == 0) {
//获取交付信息 //获取交付信息
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo,pobj.serviceNo); var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo, pobj.serviceNo);
if(!orderdeliveryRes || orderdeliveryRes.length<1){ if (!orderdeliveryRes || orderdeliveryRes.length < 1) {
return system.getResult(null,"未知交付信息,10150"); return system.getResult(null, "未知交付信息,10150");
} }
var orderdelivery = orderdeliveryRes[0]; var orderdelivery = orderdeliveryRes[0];
var deliveryData = await this.packagingTmDeliveryData(pobj,orderdelivery.deliveryContent); var deliveryData = await this.packagingTmDeliveryData(pobj, orderdelivery.deliveryContent);
this.putOrderDelivery(deliveryData,deliveryData.sourceOrderNo,deliveryData.serviceNo); this.putOrderDelivery(deliveryData, deliveryData.sourceOrderNo, deliveryData.serviceNo);
await this.orderinfoDao.model.update({isSolution:1}, { where: { orderNo: pobj.sourceOrderNo }}); await this.orderinfoDao.model.update({ isSolution: 1 }, { where: { orderNo: pobj.sourceOrderNo } });
return system.getResultSuccess(); return system.getResultSuccess();
}else{ } else {
return checkRes; return checkRes;
} }
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
async checkParams(pobj){//参数校验 async checkParams(pobj) {//参数校验
if (!pobj.serviceNo) { if (!pobj.serviceNo) {
return system.getResult(null, "业务单号不能为空不能为空,10100"); return system.getResult(null, "业务单号不能为空不能为空,10100");
} }
...@@ -72,9 +72,9 @@ class InternalCallsNotifyService { ...@@ -72,9 +72,9 @@ class InternalCallsNotifyService {
return system.getResult(null, "来源单号不能为空,10110"); return system.getResult(null, "来源单号不能为空,10110");
} }
var orderinfo = await this.orderinfoDao.model.findOne({ var orderinfo = await this.orderinfoDao.model.findOne({
where:{orderNo:pobj.sourceOrderNo},raw:true where: { orderNo: pobj.sourceOrderNo }, raw: true
}); });
if(!orderinfo || !orderinfo.id){ if (!orderinfo || !orderinfo.id) {
return system.getResult(null, "未知订单,10120"); return system.getResult(null, "未知订单,10120");
} }
if (!pobj.tm) { if (!pobj.tm) {
...@@ -124,15 +124,15 @@ class InternalCallsNotifyService { ...@@ -124,15 +124,15 @@ class InternalCallsNotifyService {
} }
return system.getResultSuccess(pobj); return system.getResultSuccess(pobj);
} }
async packagingTmDeliveryData(pobj,deliveryData) {//重新组装商标交付信息 async packagingTmDeliveryData(pobj, deliveryData) {//重新组装商标交付信息
var deliveryStatusList = []; var deliveryStatusList = [];
if(deliveryData && deliveryData.deliveryStatusList){ if (deliveryData && deliveryData.deliveryStatusList) {
deliveryStatusList = deliveryData.deliveryStatusList; deliveryStatusList = deliveryData.deliveryStatusList;
} }
var nclOne = pobj.nclones[0]; var nclOne = pobj.nclones[0];
if(nclOne.tmStatus){ if (nclOne.tmStatus) {
var deliveryStatusObj = this.statusContrast[nclOne.tmStatus]; var deliveryStatusObj = this.statusContrast[nclOne.tmStatus];
if(deliveryStatusObj && deliveryStatusObj.value){ if (deliveryStatusObj && deliveryStatusObj.value) {
var deliveryStatus = deliveryStatusObj.value; var deliveryStatus = deliveryStatusObj.value;
var deliveryStatusName = deliveryStatusObj.name; var deliveryStatusName = deliveryStatusObj.name;
deliveryStatusList.push({ deliveryStatusList.push({
...@@ -142,7 +142,7 @@ class InternalCallsNotifyService { ...@@ -142,7 +142,7 @@ class InternalCallsNotifyService {
}); });
pobj.deliveryStatus = deliveryStatus; pobj.deliveryStatus = deliveryStatus;
pobj.deliveryStatusName = deliveryStatusName; pobj.deliveryStatusName = deliveryStatusName;
}else{ } else {
deliveryStatusList.push({ deliveryStatusList.push({
deliveryStatus: nclOne.tmStatus, deliveryStatus: nclOne.tmStatus,
deliveryStatusName: nclOne.tmStatus, deliveryStatusName: nclOne.tmStatus,
...@@ -150,23 +150,23 @@ class InternalCallsNotifyService { ...@@ -150,23 +150,23 @@ class InternalCallsNotifyService {
}); });
} }
} }
pobj.deliveryStatusList = deliveryStatusList; pobj.deliveryStatusList = deliveryStatusList;
pobj.opNotes = ""; //操作备注 pobj.opNotes = ""; //操作备注
return pobj; return pobj;
} }
putOrderDelivery(data, orderNo, channelOrderNo) {//修改交付信息 putOrderDelivery(data, orderNo, channelOrderNo) {//修改交付信息
var sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + JSON.stringify(data) + "' where sourceOrderNo='" + orderNo + "'"; var sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + JSON.stringify(data) + "' where sourceOrderNo='" + orderNo + "'";
sql = sql + " and deliveryContent->'$.serviceNo' = '"+channelOrderNo+"'"; sql = sql + " and deliveryContent->'$.serviceNo' = '" + channelOrderNo + "'";
this.orderinfoDao.customUpdate(sql); this.orderinfoDao.customUpdate(sql);
} }
addOrderDelivery(data, orderNo) {//新增交付信息 addOrderDelivery(data, orderNo) {//新增交付信息--废弃,调用dao中的,20201102-sy
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" + var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')"; orderNo + "','" + JSON.stringify(data) + "')";
this.orderinfoDao.customQuery(sql); this.orderinfoDao.customQuery(sql);
} }
async getOrderDelivery(orderNo,channelOrderNo) {//查询交付信息 async getOrderDelivery(orderNo, channelOrderNo) {//查询交付信息
var sql = "select * from `c_order_delivery` where sourceOrderNo='" + orderNo + "'"; var sql = "select * from `c_order_delivery` where sourceOrderNo='" + orderNo + "'";
sql = sql + " and deliveryContent->'$.serviceNo' = '"+channelOrderNo+"'"; sql = sql + " and deliveryContent->'$.serviceNo' = '" + channelOrderNo + "'";
return await this.orderinfoDao.customQuery(sql); return await this.orderinfoDao.customQuery(sql);
} }
//---------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------
......
...@@ -6,6 +6,7 @@ class OrderInfoService extends ServiceBase { ...@@ -6,6 +6,7 @@ class OrderInfoService extends ServiceBase {
constructor() { constructor() {
super("dbcorder", ServiceBase.getDaoName(OrderInfoService)); super("dbcorder", ServiceBase.getDaoName(OrderInfoService));
this.flowlogDao = system.getObject("db.dbcorder.flowlogDao"); this.flowlogDao = system.getObject("db.dbcorder.flowlogDao");
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.orderproductDao = system.getObject("db.dbcorder.orderproductDao"); this.orderproductDao = system.getObject("db.dbcorder.orderproductDao");
this.ordercontactsDao = system.getObject("db.dbcorder.ordercontactsDao"); this.ordercontactsDao = system.getObject("db.dbcorder.ordercontactsDao");
this.orderReceiptVoucherDao = system.getObject("db.dbcpay.orderreceiptvoucherDao"); this.orderReceiptVoucherDao = system.getObject("db.dbcpay.orderreceiptvoucherDao");
...@@ -82,7 +83,7 @@ class OrderInfoService extends ServiceBase { ...@@ -82,7 +83,7 @@ class OrderInfoService extends ServiceBase {
quantity: actionBody.quantity,// 订单数量(即产品的倍数,默认值为1) quantity: actionBody.quantity,// 订单数量(即产品的倍数,默认值为1)
opPayType: "00",// 操作付款类型:00: 创建订单, 10: 补单 opPayType: "00",// 操作付款类型:00: 创建订单, 10: 补单
serviceItemSnapshot: JSON.stringify(actionBody.product_info), //产品快照 serviceItemSnapshot: JSON.stringify(actionBody.product_info), //产品快照
orderSnapshot:JSON.stringify(actionBody.deliveryData.apply) orderSnapshot: JSON.stringify(actionBody.deliveryData.apply)
}; };
var orderProduct = await this.orderproductDao.create(orderProductObj, t);//订单产品 var orderProduct = await this.orderproductDao.create(orderProductObj, t);//订单产品
var orderReceiptVoucherObj = { var orderReceiptVoucherObj = {
...@@ -118,7 +119,7 @@ class OrderInfoService extends ServiceBase { ...@@ -118,7 +119,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id); var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id);
if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) { 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) { if (count > 0) {
return system.getResultFail(-1, "订单不能重复创建s"); return system.getResultFail(-1, "订单不能重复创建s");
} }
...@@ -149,7 +150,7 @@ class OrderInfoService extends ServiceBase { ...@@ -149,7 +150,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("re" + pobj.appInfo.uapp_id); var orderNo = await self.getBusUid("re" + pobj.appInfo.uapp_id);
var item = await self.createOrder(pobj, orderNo, t); var item = await self.createOrder(pobj, orderNo, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo); await self.orderinfoDao.addOrderDelivery(pobj.actionBody.deliveryData, orderNo, t);
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: orderNo, orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo, channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
...@@ -202,17 +203,17 @@ class OrderInfoService extends ServiceBase { ...@@ -202,17 +203,17 @@ class OrderInfoService extends ServiceBase {
} }
/** /**
* 新增交付信息 * 新增交付信息--废弃,从dao中调用,20201102-sy
* @param data * @param data
* @param orderNo * @param orderNo
*/ */
addOrderDelivery(data, orderNo) { addOrderDelivery(data, orderNo, t) {
try{ try {
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" + var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')"; orderNo + "','" + JSON.stringify(data) + "')";
this.customQuery(sql); await this.customInsert(sql);
return system.getResultSuccess(); return system.getResultSuccess();
}catch (e) { } catch (e) {
return system.getResultFail(); return system.getResultFail();
} }
...@@ -225,7 +226,7 @@ class OrderInfoService extends ServiceBase { ...@@ -225,7 +226,7 @@ class OrderInfoService extends ServiceBase {
* @returns {Promise<{msg: *, data: (*|null), status: number}>} * @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/ */
async submitReview(pobj, actionBody) { async submitReview(pobj, actionBody) {
try{ try {
var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody); var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody);
if (packagingTmResult.status != 0) { if (packagingTmResult.status != 0) {
return packagingTmResult; return packagingTmResult;
...@@ -236,7 +237,7 @@ class OrderInfoService extends ServiceBase { ...@@ -236,7 +237,7 @@ class OrderInfoService extends ServiceBase {
sql = sql.replace('\n', ''); sql = sql.replace('\n', '');
const result = await this.customUpdate(sql); const result = await this.customUpdate(sql);
return system.getResultSuccess(); return system.getResultSuccess();
}catch (e) { } catch (e) {
return system.getResultFail(); return system.getResultFail();
} }
} }
...@@ -296,11 +297,11 @@ class OrderInfoService extends ServiceBase { ...@@ -296,11 +297,11 @@ class OrderInfoService extends ServiceBase {
sql += ` and json_extract(deliveryContent,'$.apply.askforId')='${actionBody.askforId}'`; sql += ` and json_extract(deliveryContent,'$.apply.askforId')='${actionBody.askforId}'`;
sqlCount += ` and json_extract(deliveryContent,'$.apply.askforId')='${actionBody.askforId}'`; sqlCount += ` and json_extract(deliveryContent,'$.apply.askforId')='${actionBody.askforId}'`;
} }
if(actionBody.applicantName){ if (actionBody.applicantName) {
sql += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`; sql += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`;
sqlCount += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`; sqlCount += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`;
} }
if(actionBody.status){ if (actionBody.status) {
sql += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`; sql += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`;
sqlCount += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`; sqlCount += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`;
} }
...@@ -332,7 +333,7 @@ class OrderInfoService extends ServiceBase { ...@@ -332,7 +333,7 @@ class OrderInfoService extends ServiceBase {
* @param actionBody * @param actionBody
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async getOfficialList(pobj,actionBody){ async getOfficialList(pobj, actionBody) {
let pageSize = Number(actionBody.pageSize || 20); let pageSize = Number(actionBody.pageSize || 20);
if (pageSize > 50) { if (pageSize > 50) {
pageSize = 50; pageSize = 50;
...@@ -355,11 +356,11 @@ class OrderInfoService extends ServiceBase { ...@@ -355,11 +356,11 @@ class OrderInfoService extends ServiceBase {
sql += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`; sql += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`;
sqlCount += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`; sqlCount += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`;
} }
if (actionBody.applicantName){ if (actionBody.applicantName) {
sql += ` and json_extract(officialInfo,'$.applicantName') like '%${actionBody.applicantName}%'`; sql += ` and json_extract(officialInfo,'$.applicantName') like '%${actionBody.applicantName}%'`;
sqlCount += ` and json_extract(officialInfo,'$.applicantName') like'%${actionBody.applicantName}%'`; sqlCount += ` and json_extract(officialInfo,'$.applicantName') like'%${actionBody.applicantName}%'`;
} }
if(actionBody.fileType){ if (actionBody.fileType) {
sql += ` and json_extract(officialInfo,'$.fileType')='${actionBody.fileType}'`; sql += ` and json_extract(officialInfo,'$.fileType')='${actionBody.fileType}'`;
sqlCount += ` and json_extract(officialInfo,'$.fileType')='${actionBody.fileType}'`; sqlCount += ` and json_extract(officialInfo,'$.fileType')='${actionBody.fileType}'`;
} }
...@@ -390,11 +391,11 @@ class OrderInfoService extends ServiceBase { ...@@ -390,11 +391,11 @@ class OrderInfoService extends ServiceBase {
* @param actionBody * @param actionBody
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async addOfficial(pobj,actionBody){ async addOfficial(pobj, actionBody) {
if(!actionBody.orderNo){ if (!actionBody.orderNo) {
return system.getResult(null,'orderNo can not be empty'); return system.getResult(null, 'orderNo can not be empty');
} }
try{ try {
let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`; let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`;
let list = await this.customQuery(orderSql); let list = await this.customQuery(orderSql);
if (!list || list.length == 0) { if (!list || list.length == 0) {
...@@ -403,14 +404,14 @@ class OrderInfoService extends ServiceBase { ...@@ -403,14 +404,14 @@ class OrderInfoService extends ServiceBase {
let orderItem = list[0]; let orderItem = list[0];
let data = { let data = {
serviceNo: actionBody.orderNo, serviceNo: actionBody.orderNo,
channelUserId:orderItem.channelUserId, channelUserId: orderItem.channelUserId,
officialInfo: actionBody.officialData, officialInfo: actionBody.officialData,
created_at: new Date(), created_at: new Date(),
updated_at: new Date() updated_at: new Date()
} }
await this.officialDao.create(data); await this.officialDao.create(data);
return system.getResultSuccess(); return system.getResultSuccess();
}catch (e) { } catch (e) {
return system.getResultFail(); return system.getResultFail();
} }
......
...@@ -140,8 +140,8 @@ class OrderInfoService extends ServiceBase { ...@@ -140,8 +140,8 @@ class OrderInfoService extends ServiceBase {
contactName: orderContact.contacts || "",//手机号 contactName: orderContact.contacts || "",//手机号
mobile: orderContact.mobile,//手机号 mobile: orderContact.mobile,//手机号
email: orderContact.email || "", email: orderContact.email || "",
tel:orderContact.tel ||"", //座机 tel: orderContact.tel || "", //座机
fax:orderContact.fax || "" //传真 fax: orderContact.fax || "" //传真
}; };
await this.ordercontactsDao.create(customerContactObj, t); await this.ordercontactsDao.create(customerContactObj, t);
}//渠道购买存在购买者手机号 }//渠道购买存在购买者手机号
...@@ -303,7 +303,7 @@ class OrderInfoService extends ServiceBase { ...@@ -303,7 +303,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("tm" + pobj.appInfo.uapp_id); var orderNo = await self.getBusUid("tm" + pobj.appInfo.uapp_id);
var item = await self.createOrder(pobj, orderNo, t); var item = await self.createOrder(pobj, orderNo, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo); await self.dao.addOrderDelivery(pobj.actionBody.deliveryData, orderNo, t);
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: orderNo, orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo, channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
...@@ -341,7 +341,7 @@ class OrderInfoService extends ServiceBase { ...@@ -341,7 +341,7 @@ class OrderInfoService extends ServiceBase {
if (!deliveryData.tm.picUrl) { if (!deliveryData.tm.picUrl) {
return system.getResult(null, "商标图样不能为空,20210"); return system.getResult(null, "商标图样不能为空,20210");
} }
if(pobj.appInfo.uapp_id != 22 ){ if (pobj.appInfo.uapp_id != 22) {
if (!deliveryData.apply) { if (!deliveryData.apply) {
return system.getResult(null, "申请信息不能为空,20230"); return system.getResult(null, "申请信息不能为空,20230");
} }
...@@ -451,9 +451,9 @@ class OrderInfoService extends ServiceBase { ...@@ -451,9 +451,9 @@ class OrderInfoService extends ServiceBase {
} }
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("tm" + pobj.appInfo.uapp_id); const orderNo = (await self.getBusUid((pobj.actionBody.quantity > 1 ? "cntm" : "tm") + pobj.appInfo.uapp_id)).toUpperCase();
var item = await self.createOrder(pobj, orderNo, t); await self.createOrder(pobj, orderNo, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo); await self.dao.addOrderDelivery(pobj.actionBody.deliveryData, orderNo, t);
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: orderNo, orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo, channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
...@@ -512,7 +512,7 @@ class OrderInfoService extends ServiceBase { ...@@ -512,7 +512,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("logo" + pobj.appInfo.uapp_id); var orderNo = await self.getBusUid("logo" + pobj.appInfo.uapp_id);
var item = await self.createOrder(pobj, orderNo, t); var item = await self.createOrder(pobj, orderNo, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo); await self.dao.addOrderDelivery(pobj.actionBody.deliveryData, orderNo, t);
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: orderNo, orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo, channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
...@@ -638,7 +638,7 @@ class OrderInfoService extends ServiceBase { ...@@ -638,7 +638,7 @@ class OrderInfoService extends ServiceBase {
var item = await self.createOrder(pobj, orderNo, t); var item = await self.createOrder(pobj, orderNo, t);
// needsolutioninfo.status = "ywc"; // needsolutioninfo.status = "ywc";
await self.needsolutionDao.update({ id: needsolutioninfo.id, status: "dqr" }, t); await self.needsolutionDao.update({ id: needsolutioninfo.id, status: "dqr" }, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo); self.dao.addOrderDelivery(pobj.actionBody.deliveryData, orderNo, t);
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: orderNo, orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo, channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
...@@ -706,10 +706,10 @@ class OrderInfoService extends ServiceBase { ...@@ -706,10 +706,10 @@ class OrderInfoService extends ServiceBase {
mobile: actionBody.orderContact.mobile,//手机号 mobile: actionBody.orderContact.mobile,//手机号
email: actionBody.orderContact.email || "" email: actionBody.orderContact.email || ""
}; };
if(actionBody.orderContact.tel){ if (actionBody.orderContact.tel) {
updateFields['tel'] = actionBody.orderContact.tel updateFields['tel'] = actionBody.orderContact.tel
} }
if(actionBody.orderContact.fax){ if (actionBody.orderContact.fax) {
updateFields['fax'] = actionBody.orderContact.fax updateFields['fax'] = actionBody.orderContact.fax
} }
this.ordercontactsDao.updateByWhere(updateFields, { where: { sourceOrderNo: actionBody.orderNo } }); this.ordercontactsDao.updateByWhere(updateFields, { where: { sourceOrderNo: actionBody.orderNo } });
...@@ -978,10 +978,8 @@ class OrderInfoService extends ServiceBase { ...@@ -978,10 +978,8 @@ class OrderInfoService extends ServiceBase {
sql = sql.replace('\n', ''); sql = sql.replace('\n', '');
this.customQuery(sql); this.customQuery(sql);
} }
addOrderDelivery(data, orderNo) {//新增交付信息 async addOrderDelivery(data, orderNo, t) {//新增交付信息
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" + await this.dao.addOrderDelivery(data, orderNo, t);
orderNo + "','" + JSON.stringify(data) + "')";
this.customQuery(sql);
} }
async getOrderDelivery(orderNo) {//查询交付信息 async getOrderDelivery(orderNo) {//查询交付信息
var sql = "select * from `c_order_delivery` where sourceOrderNo='" + orderNo + "'"; var sql = "select * from `c_order_delivery` where sourceOrderNo='" + orderNo + "'";
...@@ -1019,7 +1017,7 @@ class OrderInfoService extends ServiceBase { ...@@ -1019,7 +1017,7 @@ class OrderInfoService extends ServiceBase {
// 2020 0923 lin 新增 根据id修改orderStatus,目前用来商标交易更新订单状态 // 2020 0923 lin 新增 根据id修改orderStatus,目前用来商标交易更新订单状态
async updateOrderStatusById(pobj, actionBody) { 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) { if (!orderInfo) {
return system.getResult(null, "修改失败"); return system.getResult(null, "修改失败");
} }
...@@ -1185,15 +1183,15 @@ class OrderInfoService extends ServiceBase { ...@@ -1185,15 +1183,15 @@ class OrderInfoService extends ServiceBase {
} }
//根据合同号,获取子订单 //根据合同号,获取子订单
async getOrderListByOrderServiceNo(pobj){ async getOrderListByOrderServiceNo(pobj) {
let sql = "select `orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`," + let sql = "select `orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`," +
" `itemCode','invoiceApplyStatus`,`opNotes`,`notes`,`channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,channelItemAppendName,`serviceItemCode`,`picUrl`,`serviceItemSnapshot`,`orderSnapshot`,created_at" + " `itemCode','invoiceApplyStatus`,`opNotes`,`notes`,`channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,channelItemAppendName,`serviceItemCode`,`picUrl`,`serviceItemSnapshot`,`orderSnapshot`,created_at" +
" from v_order where uapp_id =:uapp_id and orderServiceNo =:orderServiceNo" " from v_order where uapp_id =:uapp_id and orderServiceNo =:orderServiceNo"
let paramWhere = { let paramWhere = {
uapp_id : pobj.appInfo.uapp_id, uapp_id: pobj.appInfo.uapp_id,
orderServiceNo : pobj.orderNo ? pobj.orderNo : pobj.actionBody.orderServiceNo orderServiceNo: pobj.orderNo ? pobj.orderNo : pobj.actionBody.orderServiceNo
} }
let list = await this.customQuery(sql,paramWhere); let list = await this.customQuery(sql, paramWhere);
if (!list || list.length == 0) { if (!list || list.length == 0) {
return system.getResult(null, "订单数据为空,30200"); return system.getResult(null, "订单数据为空,30200");
} }
...@@ -1422,7 +1420,7 @@ class OrderInfoService extends ServiceBase { ...@@ -1422,7 +1420,7 @@ class OrderInfoService extends ServiceBase {
deliveryInfo.nclones[tbCodeIndex].tmStatusName = "已递交"; deliveryInfo.nclones[tbCodeIndex].tmStatusName = "已递交";
orderLog.opContent = "尊敬的用户,您的商标:“" + deliveryInfo.tm.tmName + "”第" + deliveryInfo.nclones[tbCodeIndex].code + "类,办理状态更新为【已递交】"; orderLog.opContent = "尊敬的用户,您的商标:“" + deliveryInfo.tm.tmName + "”第" + deliveryInfo.nclones[tbCodeIndex].code + "类,办理状态更新为【已递交】";
}//已提交--自己系统中存在此状态(升级后不存在,目前没有升级) }//已提交--自己系统中存在此状态(升级后不存在,目前没有升级)
else if (actionBody.tmStatus == "FILLEXCEPTION" ) { else if (actionBody.tmStatus == "FILLEXCEPTION") {
actionBody.submitTime = actionBody.submitTime || new Date(); actionBody.submitTime = actionBody.submitTime || new Date();
deliveryInfo.deliveryStatus = "djyc"; deliveryInfo.deliveryStatus = "djyc";
deliveryInfo.deliveryStatusName = "递交异常"; deliveryInfo.deliveryStatusName = "递交异常";
...@@ -1473,7 +1471,7 @@ class OrderInfoService extends ServiceBase { ...@@ -1473,7 +1471,7 @@ class OrderInfoService extends ServiceBase {
this.putOrderDelivery(deliveryInfo, actionBody.orderNo); this.putOrderDelivery(deliveryInfo, actionBody.orderNo);
//商标状态推送 360 //商标状态推送 360
if(orderItem.uapp_id == 50){ if (orderItem.uapp_id == 50) {
actionBody.deliveryInfo = deliveryInfo; actionBody.deliveryInfo = deliveryInfo;
this.push360Sve.pushTmStatus(actionBody); this.push360Sve.pushTmStatus(actionBody);
this.push360Sve.sendMessage(actionBody) this.push360Sve.sendMessage(actionBody)
...@@ -1913,33 +1911,32 @@ class OrderInfoService extends ServiceBase { ...@@ -1913,33 +1911,32 @@ class OrderInfoService extends ServiceBase {
} }
//智能选择 尼斯类获取 //智能选择 尼斯类获取
async getNclByCode(pobj){ async getNclByCode(pobj) {
var sql = "select `business_code`,`ncl_content` from b_business_ncl where business_code=:business_code LIMIT 1"; 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); var result = await this.customQuery(sql, paramWhere);
if(Object.keys(result).length==0){ if (Object.keys(result).length == 0) {
return system.getResultFail(-1,'find err'); return system.getResultFail(-1, 'find err');
} }
return system.getResult(result[0].ncl_content); return system.getResult(result[0].ncl_content);
} }
//智能选择 尼斯类获取 //智能选择 尼斯类获取
async getAllNcl(pobj){ async getAllNcl(pobj) {
var sql = "select `ncl_content` from b_business_ncl where business_code like '%类%'"; var sql = "select `ncl_content` from b_business_ncl where business_code like '%类%'";
var result = await this.customQuery(sql); var result = await this.customQuery(sql);
if(Object.keys(result).length==0){ if (Object.keys(result).length == 0) {
return system.getResultFail(-1,'find err'); return system.getResultFail(-1, 'find err');
} }
let ret = [] let ret = []
result.forEach(item =>{ result.forEach(item => {
let Arr=item.ncl_content.nclThree; let Arr = item.ncl_content.nclThree;
let arrNew=[]; let arrNew = [];
for(var i=0;i<10;i++) for (var i = 0; i < 10; i++) {
{ var _num = Math.floor(Math.random() * Arr.length)
var _num = Math.floor(Math.random()*Arr.length)
var mm = Arr[_num]; var mm = Arr[_num];
Arr.splice(_num,1) Arr.splice(_num, 1)
arrNew.push(mm) arrNew.push(mm)
} }
item.ncl_content.nclThree = arrNew; item.ncl_content.nclThree = arrNew;
...@@ -1949,23 +1946,23 @@ class OrderInfoService extends ServiceBase { ...@@ -1949,23 +1946,23 @@ class OrderInfoService extends ServiceBase {
} }
//修改订单信息 更新IC订单号 //修改订单信息 更新IC订单号
async updateOrderById(pobj,actionBody){ async updateOrderById(pobj, actionBody) {
if(!actionBody.orderNo){ if (!actionBody.orderNo) {
return system.getResultFail(-1,'订单号不能为空'); return system.getResultFail(-1, '订单号不能为空');
} }
let sql = `update c_order_info set orderServiceNo = :orderServiceNo,channelOrderNo = :channelOrderNo,channelServiceNo=:channelServiceNo where orderNo = :orderNo` let sql = `update c_order_info set orderServiceNo = :orderServiceNo,channelOrderNo = :channelOrderNo,channelServiceNo=:channelServiceNo where orderNo = :orderNo`
let updateParams = { let updateParams = {
orderNo:actionBody.orderNo, orderNo: actionBody.orderNo,
orderServiceNo:actionBody.orderServiceNo, orderServiceNo: actionBody.orderServiceNo,
channelOrderNo:actionBody.channelOrderNo, channelOrderNo: actionBody.channelOrderNo,
channelServiceNo :actionBody.channelServiceNo channelServiceNo: actionBody.channelServiceNo
} }
let result = await this.customQuery(sql,updateParams) let result = await this.customQuery(sql, updateParams)
return system.getResult(result); return system.getResult(result);
} }
//获取支付记录 //获取支付记录
async getPayRecords(pobj){ async getPayRecords(pobj) {
const userInfo = pobj.userInfo; const userInfo = pobj.userInfo;
let sql = `select m.sourceOrderNo orderNo,json_extract(o.serviceItemSnapshot,'$.channel_item_name') productName,m.recvAmount totalSum,m.directionType directionType,m.updated_at payTime let sql = `select m.sourceOrderNo orderNo,json_extract(o.serviceItemSnapshot,'$.channel_item_name') productName,m.recvAmount totalSum,m.directionType directionType,m.updated_at payTime
from from
...@@ -1973,11 +1970,11 @@ class OrderInfoService extends ServiceBase { ...@@ -1973,11 +1970,11 @@ class OrderInfoService extends ServiceBase {
on m.sourceOrderNo = o.orderNo on m.sourceOrderNo = o.orderNo
where where
m.channelUserId = :channelUserId and m.uapp_id = :uapp_id` m.channelUserId = :channelUserId and m.uapp_id = :uapp_id`
const searchWhere ={ const searchWhere = {
channelUserId : userInfo.channel_userid, channelUserId: userInfo.channel_userid,
uapp_id:pobj.appInfo.uapp_id uapp_id: pobj.appInfo.uapp_id
} }
let seRet = await this.customQuery(sql,searchWhere); let seRet = await this.customQuery(sql, searchWhere);
return system.getResultSuccess(seRet) return system.getResultSuccess(seRet)
} }
} }
......
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