Commit 8f12e877 by Sxy

合并冲突

parents e8e019fd 3ade885b
...@@ -123,7 +123,7 @@ class BizOptCtl extends CtlBase { ...@@ -123,7 +123,7 @@ class BizOptCtl extends CtlBase {
//根据需求编号去更新该条需求的状态为已关闭 //根据需求编号去更新该条需求的状态为已关闭
try { try {
let res = await this.service.updateStatusByDemandCode(pobj); let res = await this.service.updateStatusByDemandCode(pobj);
//TODO 同步该需求关闭信息到其他系统 //TODO 同步该需求关闭信息到其他系统(走队列,直接扔到队列里面)
//添加到记录表 //添加到记录表
pobj.operator = { pobj.operator = {
......
...@@ -8,6 +8,8 @@ const moment = require('moment'); ...@@ -8,6 +8,8 @@ const moment = require('moment');
const System = require("../../../system"); const System = require("../../../system");
const toFtClient = require("../../../utils/toFtClient"); const toFtClient = require("../../../utils/toFtClient");
const appconfig = system.getSysConfig(); const appconfig = system.getSysConfig();
const sha235 = require("sha256");
const { getResult } = require("../../../system");
class DeliverybillCtl extends CtlBase { class DeliverybillCtl extends CtlBase {
constructor() { constructor() {
super("bizchance", CtlBase.getServiceName(DeliverybillCtl)); super("bizchance", CtlBase.getServiceName(DeliverybillCtl));
...@@ -291,6 +293,8 @@ class DeliverybillCtl extends CtlBase { ...@@ -291,6 +293,8 @@ class DeliverybillCtl extends CtlBase {
} }
} }
//根据bizId查询deliverybill表中的所有信息 //根据bizId查询deliverybill表中的所有信息
async getInfo(pobj, qobj, req) { async getInfo(pobj, qobj, req) {
try { try {
...@@ -305,55 +309,86 @@ class DeliverybillCtl extends CtlBase { ...@@ -305,55 +309,86 @@ class DeliverybillCtl extends CtlBase {
} }
} }
async portog() { //服务状态变更通知
console.log(settings.port); async notifyServiceStatusChange(pobj, qobj, req) {
let ab = pobj.actionBody;
if (!ab.requestId || ab.requestId == "undefined") {
return system.getResultFail(-1, "请求id不能为空");
}
if (!ab.bizId || ab.bizId == "undefined") {
return system.getResultFail(-1, "服务实例编号不能为空");
}
if (!ab.status || ab.status == "undefined") {
return system.getResultFail(-1, "服务状态不能为空");
}
try {
let cacheStr = sha235(JSON.stringify(ab));
let cacheInfo = await this.cacheManager["TxCache"].getCache(cacheStr);
if (cacheInfo && cacheInfo !== "undefined") {
return {
"status": 1,
"msg": "已处理成功",
"data": cacheInfo,
"requestId": ab.requestId,
};
} else {
// 变更服务状态
let whereObj = { biz_id: ab.bizId };
let rtn = await this.service.findOne(whereObj);
if (!rtn) {
return system.getResultFail(-1, "未知服务信息");
}
let deliveryInfo = {};
Object.assign(deliveryInfo, rtn.delivery_info, {
"serviceStartTime": ab.serviceStartTime,
"serviceEndTime": ab.serviceEndTime,
});
let upObj = {
delivery_status: ab.status,
delivery_info: deliveryInfo,
};
await rtn.update(upObj, { where: whereObj });
// 将变更结果插入到redis中
await this.cacheManager["TxCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);
return {
"status": 1,
"msg": "处理成功",
"data": rtn,
"requestId": ab.requestId
};
}
}
catch (err) {
return system.getResultError(err);
}
} }
} }
module.exports = DeliverybillCtl; module.exports = DeliverybillCtl;
var task = new DeliverybillCtl(); var task = new DeliverybillCtl();
var obj = { var obj = {
"actionType": "produceData", "requestId": "1111111",
"actionBody": { "bizId": 2592748677,
"pushUrl": "http://ic.com:8000/web/bizchance/deliverybillCtl", "status": "inservice",
"actionType": "insertInfo", "serviceStartTime": "today",
"identifyCode": "book-manage", "serviceEndTime": "tomorrow",
"messageBody": {
"requestId": "825da0a74432-738f-4bed-468d-d51aa880",
"bizId": "2292748809",
"userId": "24173452443103825",
"orderId": "235184456620496",
"areatype": "city",
"area": "100010",
"topOrgCode": "rong_yi_suan",
"taxpayerType": 1,
"contactMobile": "18510669321"
}
}
} }
task.portog().then(d => { task.notifyServiceStatusChange({ actionBody: obj }, {}, {}).then(d => {
console.log(JSON.stringify(d)); console.log(JSON.stringify(d));
}) })
// var obj = { // (async () => {
// "actionType": "produceData", // var task = new DeliverybillCtl();
// "actionBody": { // var obj = {
// "pushUrl": "http://ic.com:8000/web/bizchance/deliverybillCtl", // "deliverId":"1111111",
// "actionType": "insertInfo", // "company1": "华为技术有限公司",
// "identifyCode": "book-manage", // "company2": "中兴通讯股份有限公司",
// "messageBody": { // "keyword1":"用户设备,通信领域,通信技术,设备发送,指示信息,通信系统,通信方法,设备接收,对应关系,基站发送,终端发送,用户体验,配置信息,请求消息,数据传输方法,用户终端,网络侧,移动终端,通信设备,传输方法",
// "requestId": "825da0a74432-738f-4bed-468d-d51aa880", // "keyword2":"用户体验,移动终端,用户设备,相关技术,网络侧,终端发送,用户终端,配置信息,指示信息,请求消息,对应关系,传输方法,基站发送,通信系统,数据传输方法,通信领域,通信技术,设备发送,响应消息,发送方法"
// "bizId": "2292748809", // };
// "orderId": "235184456620496", // var d = await task.deliverInfo(obj,{},{})
// "companyName": "北京融易算", // console.log("dddddd---------" + JSON.stringify(d));
// "contactName": "JAMES7", // })()
// "taxpayerType": 5,
// "contactMobile": "18510669367",
// "companyBizType": 1,
// "uscc": "911101053516460817K"
// }
// }
// }
// task.updateServer(obj, {}, {}).then(d => {
// console.log(JSON.stringify(d));
// })
...@@ -18,6 +18,7 @@ class FitaxschemeDao extends Dao { ...@@ -18,6 +18,7 @@ class FitaxschemeDao extends Dao {
/** /**
* 插入方案信息 * 插入方案信息
* TODO 同步方案信息,获取方案编号(走队列,再写一个接收队列方案编号的方法,将方案编号更新到数据库)
* @param {*} qobj * @param {*} qobj
* @param {*} t * @param {*} t
*/ */
......
...@@ -367,6 +367,59 @@ class System { ...@@ -367,6 +367,59 @@ class System {
} }
return svrSign; return svrSign;
} }
/**
* 队列操作
* @param {json}
pushUrl string 推送URL地址
actionType string 推送地址接收时的功能名称
notifyUrl string 推送成功后通知的Url
messageBody json 推送的业务消息,必须有一项对象属性值
headData json 请求头信息
requestId string 请求id
*/
static queueOper(obj) {
if (obj.pushUrl && obj.actionType && obj.messageBody) {
try {
var exec = this.getObject("util.execClient");
var reqUrl = settings.queueUrl;
var param = {
actionType: "produceData",
actionBody: {
pushUrl: obj.pushUrl,
actionType: obj.actionType,
identifyCode: "book-manage",
messageBody: obj.messageBody
}
}
if (obj.notifyUrl) {
param.actionBody.notifyUrl = obj.notifyUrl;
}
if (obj.headData) {
param.actionBody.headData;
}
if (obj.requestId) {
param.requestId = obj.requestId;
}
var result = await exec.execPost(param, reqUrl);
var j = JSON.parse(result.stdout);
if (j.status == 1){
return this.getResult(j);
}
else{
return this.getResultError("队列返回失败");
}
}
catch (error) {
return this.getResultError(error);
}
}
else {
return this.getResultError("参数错误");
}
}
} }
Date.prototype.Format = function (fmt) { //author: meizz Date.prototype.Format = function (fmt) { //author: meizz
......
...@@ -40,7 +40,7 @@ var settings = { ...@@ -40,7 +40,7 @@ var settings = {
}, },
queueUrl: function () { queueUrl: function () {
if (this.env == "localhost") { if (this.env == "localhost") {
return "http://192.168.1.128:4018/api/queueAction/producer/springBoard"; return "http://192.168.1.9:4018/api/queueAction/producer/springBoard";
} else { } else {
return "http://sytxpublic-msgq-service/api/queueAction/producer/springBoard"; return "http://sytxpublic-msgq-service/api/queueAction/producer/springBoard";
} }
......
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