Commit 5c4e8847 by 宋毅

addOrderDelivery移到dao中进行调用

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