Commit 1b552297 by 庄冰

pushFQ

parent 896f8ecd
...@@ -16,6 +16,10 @@ class OrderService extends ServiceBase { ...@@ -16,6 +16,10 @@ class OrderService extends ServiceBase {
this.restClient = system.getObject("util.restClient"); this.restClient = system.getObject("util.restClient");
this.appDao = system.getObject("db.dbapp.appDao"); this.appDao = system.getObject("db.dbapp.appDao");
this.orderReceiptVoucherDao = system.getObject("db.dbcpay.orderreceiptvoucherDao"); this.orderReceiptVoucherDao = system.getObject("db.dbcpay.orderreceiptvoucherDao");
this.appuserDao = system.getObject("db.dbapp.appuserDao");
this.pushlogDao = system.getObject("db.common.pushlogDao");
this.customerinfoDao = system.getObject("db.dborder.customerinfoDao");
this.trademarkDao = system.getObject("db.dbtrademark.trademarkDao");
} }
//订单线下支付(上传支付凭证) //订单线下支付(上传支付凭证)
async offlinePaymentOrder(obj) { async offlinePaymentOrder(obj) {
...@@ -1070,9 +1074,6 @@ class OrderService extends ServiceBase { ...@@ -1070,9 +1074,6 @@ class OrderService extends ServiceBase {
if (obj.req_accountType == "alipay") { if (obj.req_accountType == "alipay") {
accountType = "alipay"; accountType = "alipay";
} }
// var account_type_list = uiconfig.config.pdict.accountType;
// var account_type_name = account_type_list[obj.req_accountType];
// obj.account_type_name = account_type_name;
var sqlWheres = { orderNo: obj.out_trade_no, app_id: app.id }; var sqlWheres = { orderNo: obj.out_trade_no, app_id: app.id };
var orderItem = await this.dao.model.findOne({ var orderItem = await this.dao.model.findOne({
where: sqlWheres, where: sqlWheres,
...@@ -1135,10 +1136,210 @@ class OrderService extends ServiceBase { ...@@ -1135,10 +1136,210 @@ class OrderService extends ServiceBase {
"totalSum": orderItem.totalSum, "totalSum": orderItem.totalSum,
"orderPayStatus": "yfk", "orderPayStatus": "yfk",
} }
if(orderItem && orderItem.id && app && app.id && app.appSourceCode =='bw'){
self.pushDataToFq(orderItem,app);
}
return system.getResultSuccess(resdata); return system.getResultSuccess(resdata);
}); });
} }
// async testpushDataToFq(){
// var order= await this.dao.model.findOne({
// where:{id:501},raw:true
// });
// var app = await this.appDao.model.findOne({
// where:{id:6},raw:true
// });
// await this.pushDataToFq(order,app);
// }
//推送商标数据至fqboss(自助商标注册商标)
async pushDataToFq(order,app){
var rtn = null;
var logObj={
appid: app.id,
appkey: app.uappKey,
op: "orderSve.js/pushDataToFq",
content: "",
returnType: '0',
opTitle: "商标数据推送-付款成功调用",
};
var url ="";
var reqObj={};//请求参数
try {
if(order && order.itemCode=='zzsbzc'){//自助商标注册
url = settings.pushFqbossDataUrl() + "api/channelaccessApi/createChannelOrder";
if(!order.createuser_id){
logObj.content="订单用户id不存在";
await this.pushLog(logObj);
return;
}
var user = await this.appuserDao.model.findOne({//订单所属用户
where:{id:order.createuser_id},raw:true
});
if(!user){
logObj.content="订单用户不存在";
await this.pushLog(logObj);
return;
}
var channelUser={//渠道用户
"channelUserId": user.channelUserId,
"channelUserName": user.channelUserName,
"channelUserMoblie": user.userMoblie,
"nickname": user.nickname,
"orgName": user.orgName,
"orgPath": user.orgPath
};
var otmp = await this.ordertmproductDao.model.findOne({//订单交付单
where:{sourceOrderNo:order.orderNo,app_id:app.id},raw:true
});
if(!otmp){
logObj.content="订单交付单不存在";
await this.pushLog(logObj);
return;
}
var channelOrder={//渠道订单
"channelServiceNo": otmp.channelServiceNo,
"channelOrderNo": otmp.channelOrderNo,
"needNo": otmp.needNo,
"payStatus": "yfk",
"payTime": new Date()
};
var ci = await this.customerinfoDao.model.findOne({
where:{app_id:app.id,deliveryOrderNo:otmp.deliveryOrderNo},raw:true
});
if(!ci){
logObj.content="订单申请人信息为空";
await this.pushLog(logObj);
return;
}
var contacts = await this.customercontactsDao.model.findOne({
where:{app_id:app.id,deliveryOrderNo:otmp.deliveryOrderNo},raw:true
});
if(!contacts){
logObj.content="订单申请联系人信息为空";
await this.pushLog(logObj);
return;
}
var apply={//申请人信息
"applyAddr": ci.applyAddr,
"applyArea": ci.applyArea,
"businessLicensePic": ci.businessLicensePic,
"businessLicensePdf": ci.businessLicensePdf,
"code": ci.code,
"customerType":ci.customerType,
"contacts": contacts.name,
"email":contacts.email,
"fax":contacts.fax,
"identityCardNo":ci.identityCardNo,
"identityCardPic":ci.identityCardPic,
"identityCardPdf":ci.identityCardPdf,
"mobile":contacts.mobile,
"name":ci.name,
"notes":ci.notes,
"gzwtsUrl":otmp.gzwtsUrl,
"smwjUrl":otmp.smwjUrl,
"zipCode":ci.zipCode
};
var tm= {//商标信息
"colorizedPicUrl": otmp.colorizedPicUrl,
"tmName": otmp.tmName,
"picUrl": otmp.picUrl,
"tmFormType": otmp.tmFormType,
"totalPublicExpense": order.totalPublicExpense,
"totalServiceCharge": order.totalServiceCharge,
"totalSum": order.totalSum,
"totalTaxes": order.totalTaxes
};
var tms = await this.trademarkDao.model.findAll({
where:{app_id:app.id,deliveryOrderNo:otmp.deliveryOrderNo},raw:true
});
if(!tms || tms.length<1){
logObj.content="商标信息为空";
await this.pushLog(logObj);
return;
}
var nclones=[];
for(var i=0;i<tms.length;i++){
var nclone= {
"code": tms[i].nclOneCodes,
"name": tms[i].nclOneCodesName,
"nclThree": tms[i].nclSmallCodes?JSON.parse(tms[i].nclSmallCodes):"",
"tbCode":tms[i].tbCode
};
nclones.push(nclone);
}
reqObj={//请求参数汇总
itemCode:order.itemCode,channelUser:channelUser,channelOrder:channelOrder,tm:tm,apply:apply,
nclones:nclones,appid:"2e787bbaacda4c6488b9fae58fff30ba",channelCode:app.appSourceCode,
channelUserId:user.channelUserId,deliveryOrderNo:otmp.deliveryOrderNo
};
rtn = await this.execClient.execPost(reqObj, url);
var returnType = "0";
if (rtn.stdout) {
var j = JSON.parse(rtn.stdout);
if (j && j.code == 1) {
returnType = "1";
}
}
await this.pushLog({
appid: app.id,
appkey: app.uappKey,
op: url,
content: JSON.stringify(reqObj),
resultInfo: JSON.stringify(rtn),
returnType: returnType,
opTitle: "商标数据推送-付款成功调用",
});
return ;
}else if(order.itemCode=='fzsbzc' || order.itemCode=='dbsbzc'){//辅助/担保商标注册
var productItem = await this.appproductDao.findOneByChannelItemCode(order.channelItemCode, app.id);//获取产品
if (!productItem) {
logObj.content="订单产品信息为空";
await this.pushLog(logObj);
return;
}
await this.pushFqBusiness("tm_", order, productItem.pushServiceItemCode, {clientIp:""}, {app:app});
return;
}
} catch (e) {
await this.pushLog({
appid: app.id,
appkey: app.uappKey,
op: url,
content: JSON.stringify(reqObj),
resultInfo: JSON.stringify(e.stack),
returnType: '0',
opTitle: "商标数据推送-付款成功调用",
});
return ;
}
}
//日志
async pushLog(qobj) {
if (!qobj || !qobj.op || qobj.op.indexOf("metaCtl/getUiConfig") >= 0 ||
qobj.op.indexOf("userCtl/checkLogin") >= 0 ||
qobj.op.indexOf("getDicConfig") >= 0 ||
qobj.op.indexOf("getRouteConfig") >= 0 ||
qobj.op.indexOf("getRsConfig") >= 0) {
return null;
}
try {
qobj.optitle = (new Date()).Format("yyyy-MM-dd hh:mm:ss") + ":" + qobj.optitle;
//解决日志大于4000写入的问题
if (qobj.content.length > 4980) {
qobj.content = qobj.content.substring(0, 4980);
}
this.pushlogDao.create(qobj);
} catch (e) {
console.log(e.stack, "addLog------error-----------------------*****************");
qobj.content = e.stack;
//解决日志大于4000写入的问题
if (qobj.content.length > 4980) {
qobj.content = qobj.content.substring(0, 4980);
}
this.pushlogDao.create(qobj);
}
}
//-------------------------通联支付------end--------------------------------------------------------- //-------------------------通联支付------end---------------------------------------------------------
} }
......
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