Commit 74748e88 by 王勇飞

gyq

parent 849c0f22
......@@ -384,7 +384,8 @@ class BizOptCtl extends CtlBase {
/*插入数据信息 */
async insertInfo(nobj, qobj, req) {
var pobj = nobj.actionBody.messageBody;
console.log("融易算需求插入参数-------------------------------------------",JSON.stringify(nobj));
var pobj = nobj.actionBody;
if (pobj.intentionBizId && pobj.intentionBizId != 'undefined') {
try {
var cachestr = sha235(JSON.stringify(nobj));
......@@ -398,6 +399,7 @@ class BizOptCtl extends CtlBase {
"requestId": nobj.requestId
}
} else {
pobj.intentionBizId = pobj.intentionBizId + "_book";
pobj.businessStatus = 'received';
pobj.sourceNumber = 'tx';
pobj.facilitatorId = '10';
......@@ -406,6 +408,7 @@ class BizOptCtl extends CtlBase {
//插入操作
var buInfo = await this.service.insertInfo(pobj);
console.log("融易算需求插入结果-----------------------------------------",JSON.stringify(buInfo));
if (buInfo) {
await this.cacheManager["TxCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);
//日志
......@@ -428,26 +431,28 @@ class BizOptCtl extends CtlBase {
}
} catch (error) {
//异常处理
console.log("TTTTTTTTTTTTTTTTTTTTTTT");
console.log(error);
console.log("融易算需求插入异常-------------------------",error);
return system.getResultError(error);
}
} else {
//字段错误处理
console.log("-----------------------------融易算需求插入参数错误!");
return system.getResultError("参数错误!");
}
}
/*根据需求编号更新需求状态*/
async updatepayStatusByDemandCode(mobj, qobj, req) {
console.log("融易算更新需求状态参数-----------------------",JSON.stringify(mobj));
var pobj = mobj.actionBody;
if (pobj.solutionBizId && pobj.solutionBizId != 'undefined') {
try {
pobj.demand_code = pobj.solutionBizId;
pobj.demand_code = pobj.solutionBizId + "_book";
if (pobj.operateType == 'PAID') {
pobj.business_status = 'isFinished';
}
var res = await this.service.findInfoByDemandCode(pobj);
console.log("融易算更新需求返回结果-----------------------",JSON.stringify(res));
if (res) {
Object.assign(res.business_info, { "payStatus": "已支付" })
await res.update({ business_info: res.business_info })
......@@ -457,9 +462,11 @@ class BizOptCtl extends CtlBase {
return system.getResultError("更新需求状态出错");
}
} catch (error) {
console.log("融易算更新需求返回error-----------------------",error);
return system.getResultError(error);
}
} else {
console.log("融易算更新需求参数错误");
return system.getResultError("参数错误!");
}
}
......
......@@ -192,7 +192,7 @@ class DeliverybillCtl extends CtlBase {
obj.delivery_code = pobj.orderId + "_book";
obj.source_number = "tx";
if (pobj.solutionBizId) {
obj.scheme_number = pobj.solutionBizId;
obj.scheme_number = pobj.solutionBizId+"_book";
var scheme = await this.fitaxschemeService.findInfoByBizid({ "bizId": pobj.solutionBizId });
if (scheme) {
obj.demand_code = scheme.demand_code;
......@@ -253,6 +253,7 @@ class DeliverybillCtl extends CtlBase {
//更新融易算服务实例
async updateServer(mobj, qobj, req) {
console.log("更新融易算服务实例参数--------------------------",JSON.stringify(mobj));
try {
var pobj = mobj.actionBody;
var cachestr = sha235(JSON.stringify(pobj));
......@@ -290,6 +291,7 @@ class DeliverybillCtl extends CtlBase {
"biz_id": pobj.bizId
};
const rs = await this.service.updateServer(obj);
console.log("更新融易算服务返回结果--------------------------",JSON.stringify(rs));
if (rs) {
await this.cacheManager["TxCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);//插入redis缓存
return {
......@@ -299,11 +301,13 @@ class DeliverybillCtl extends CtlBase {
"requestId": ""
}
} else {
return system.getResultFail(rs);
console.log("更新融易算服务返回结果更新失败--------------------------");
return system.getResultFail("更新失败!");
}
}
}
catch (err) {
console.log("更新融易算服务返回错误结果--------------------------",error);
return system.getResult(null, err.message)
}
}
......@@ -326,6 +330,7 @@ class DeliverybillCtl extends CtlBase {
//服务状态变更通知
async notifyServiceStatusChange(pobj, qobj, req) {
console.log("融易算服务状态变更通知参数--------------------------",JSON.stringify(pobj));
let ab = pobj.actionBody;
if (!ab.requestId || ab.requestId == "undefined") {
return system.getResultFail(-1, "请求id不能为空");
......@@ -351,6 +356,7 @@ class DeliverybillCtl extends CtlBase {
// 变更服务状态
let whereObj = { biz_id: ab.bizId };
let rtn = await this.service.findOne(whereObj);
console.log("融易算服务状态变更通知返回结果--------------------------",JSON.stringify(rtn));
if (!rtn) {
return system.getResultFail(-1, "未知服务信息");
}
......@@ -375,12 +381,14 @@ class DeliverybillCtl extends CtlBase {
}
}
catch (err) {
console.log("融易算服务状态变更通知返回错误结果--------------------------",error);
return system.getResultError(err);
}
}
//接收票据快递单号
async receivePaperPost(pobj, qobj, req) {
console.log("融易算接收票据快递单号参数--------------------------",JSON.stringify(pobj));
var deliverInfo = await this.service.getInfo({ "bizId": pobj.bizNo });
if (deliverInfo) {
var param = {
......@@ -396,14 +404,17 @@ class DeliverybillCtl extends CtlBase {
var reqUrl = settings.ftConfig.url + "/customerReceiveBill/addCusReceiveBill";
var result = await rc.execPost(param, reqUrl);
var j = JSON.parse(result.stdout);
console.log("融易算接收票据快递单号返回结果--------------------------",JSON.stringify(j));
if (j.status == 1) {
return system.getResult(result);
}
else {
console.log("融易算接收票据快递单号错误------------------------");
return system.getResultError("接收票据快递单号错误!");
}
}
else {
console.log("融易算接收票据快递单号错误------------------------没有交付单信息");
return system.getResultError("没有交付单信息");
}
......@@ -414,6 +425,7 @@ class DeliverybillCtl extends CtlBase {
//票据快递情况反馈
async confirmPaperPost(pobj, qobj, req) {
console.log("融易算接收票据快递情况反馈参数--------------------------",JSON.stringify(pobj));
var deliverInfo = await this.service.findByClientId({ "vftClientId": pobj.customer_id });
if (deliverInfo) {
var param = {
......@@ -440,6 +452,7 @@ class DeliverybillCtl extends CtlBase {
return system.queueOper(pushObj);
}
else {
console.log("融易算接收票据快递情况反馈------------------------没有交付单信息");
return system.getResultError("没有交付单信息");
}
}
......
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