Commit 7b6b6b93 by linboxuan

lin pannong

parent c8be2f9c
var system = require("../../../system"); var system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
const md5 = require('md5') const md5 = require('md5');
const { sign } = require("crypto");
//阿里支付类 //阿里支付类
class utils360Sve extends AppServiceBase { class utils360Sve extends AppServiceBase {
constructor() { constructor() {
super(); super();
this.centerAppUrl = settings.centerAppUrl(); this.centerAppUrl = settings.centerAppUrl();
this.pannongServiceConfig = settings.pannongServiceConfig();
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve") this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve")
this.pushlogSve = system.getObject("service.common.pushlogSve"); this.pushlogSve = system.getObject("service.common.pushlogSve");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve"); this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.signSve = system.getObject("service.common.signSve");
} }
/** /**
...@@ -65,12 +68,15 @@ class utils360Sve extends AppServiceBase { ...@@ -65,12 +68,15 @@ class utils360Sve extends AppServiceBase {
orderStatus: 2 orderStatus: 2
} }
var orderrtn = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody); var orderrtn = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/submitService",
content: "参数=" + JSON.stringify(pobj) + " 返回值=" + JSON.stringify(orderrtn),
clientIp: req.client_ip || "",
optitle: "服务单创建接口"
});
if (orderrtn.status != 0 && orderrtn.status != -1) { if (orderrtn.status != 0 && orderrtn.status != -1) {
return system.getResultFail(-5012, "订单创建失败"); return system.getResultFail(-5012, "订单创建失败");
} }
console.log("创建服务单 order信息 start");
console.log(orderrtn);
console.log("创建服务单 order信息 end");
if (orderrtn.data) { if (orderrtn.data) {
pobj.actionBody.orderNo = orderrtn.data.orderNo; pobj.actionBody.orderNo = orderrtn.data.orderNo;
} }
...@@ -78,6 +84,7 @@ class utils360Sve extends AppServiceBase { ...@@ -78,6 +84,7 @@ class utils360Sve extends AppServiceBase {
var deliveryObj = { var deliveryObj = {
actionBody: { actionBody: {
"bizId":pobj.actionBody.bizId, "bizId":pobj.actionBody.bizId,
"orderNo":pobj.actionBody.orderNo,
"contactName":pobj.actionBody.contactName, "contactName":pobj.actionBody.contactName,
"contactMobile":pobj.actionBody.contactMobile, "contactMobile":pobj.actionBody.contactMobile,
"timeUnit":pobj.actionBody.timeUnit, "timeUnit":pobj.actionBody.timeUnit,
...@@ -98,6 +105,118 @@ class utils360Sve extends AppServiceBase { ...@@ -98,6 +105,118 @@ class utils360Sve extends AppServiceBase {
return system.getResultSuccess(); return system.getResultSuccess();
} }
async notifyService(pobj, actionBody,req) {
// 根据渠道订单号查出订单 判断订单状态是否可以变更
pobj.actionBody.channelOrderNo = pobj.bizId;
var sobj = {
actionType: "getOrderByChannelOrderNo",
actionBody: pobj.actionBody,
appInfo: pobj.appInfo,
userInfo: {
channelUerId: ""// 获取不到userpin 模拟
}
}
var url = settings.centerOrderUrl() + "action/order/springBoard";
var orderInfoResult = await this.restPostUrl(sobj, url);
if(orderInfoResult.status != 0) {
return system.getResult(null, "order data is empty");
}
var orderInfo = orderInfoResult.data;
// 2020 1106 lin 这里为什么要查出订单 再去修改 不直接修改?
// 因为先暂时不做状态判断是否可以修改 后面优化
pobj.actionBody.orderId = orderInfo.id;
if(actionBody.status == 16) {// 2020 1106 lin 这里转换一下已关闭为16不合适 换为已作废
var orderStatus = 32
} else {
var orderStatus = actionBody.status;
}
var sobj = {
actionType: "updateOrderStatusById",
actionBody: {
orderStatus: orderStatus,
orderId: orderInfo.id
},
appInfo: pobj.appInfo,
userInfo: {
channelUerId: ""// 获取不到userpin 模拟
}
}
var url = settings.centerOrderUrl() + "action/order/springBoard";
var orderInfoResult = await this.restPostUrl(sobj, url);
if(orderInfoResult.status != 0) {
return system.getResult(null, "order data is empty");
}
var deliveryObj = {
actionBody: {
"bizId": actionBody.bizId,
"status": actionBody.status
},
appInfo: pobj.appInfo
}
if(actionBody.serviceStartTime && actionBody.serviceEndTime ) {
deliveryObj.actionBody.serviceStartTime = actionBody.serviceStartTime,
deliveryObj.actionBody.serviceEndTime = actionBody.serviceEndTime
}
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "notifyService");
return system.getResultSuccess();
}
async noticeService(pobj, actionBody,req) {
var obj = {
appid: this.pannongServiceConfig.appid,
noncestr: this.getUUID(),
timestamp: new Date().getTime(),
body: {
"bizId":actionBody.bizId,
"auditResult":actionBody.auditResult,
"serviceStartTime":actionBody.serviceStartTime,
"serviceEndTime":actionBody.serviceEndTime,
}
}
var signResult = await this.signSve.createSign(obj, this.pannongServiceConfig.appkey);
if(signResult.status != 0) {
return system.getResult(null, "create sign fail");
}
obj.sign = signResult.data;
switch(pobj.actionType) {
case "feedback":
var url = settings.pannongUrl() + "pas-api/v1/gsb/service/feedback";
var result = await this.restPostUrl(obj, url);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/feedback",
content: "参数=" + JSON.stringify(obj) + " 返回值=" + JSON.stringify(result),
clientIp: req.client_ip || "",
optitle: "服务单处理反馈接收接口"
});
return result;
case "accountingInfo":
var url = settings.pannongUrl() + "pas-api/v1/gsb/service/accountingInfo";
var result = await this.restPostUrl(obj, url);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/feedback",
content: "参数=" + JSON.stringify(obj) + " 返回值=" + JSON.stringify(result),
clientIp: req.client_ip || "",
optitle: "服务单处理反馈接收接口"
});
return result;
case "booksInfo":
var url = settings.pannongUrl() + "pas-api/v1/gsb/service/booksInfo";
var result = await this.restPostUrl(obj, url);
this.logCtl.info({
op: "service/impl/utilsSve/utilsServiceSve.js/feedback",
content: "参数=" + JSON.stringify(obj) + " 返回值=" + JSON.stringify(result),
clientIp: req.client_ip || "",
optitle: "服务单处理反馈接收接口"
});
return result;
default:
return system.getResult(null, "actionType参数错误");
}
}
} }
module.exports = utils360Sve; module.exports = utils360Sve;
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