Commit 9393fdaf by 王勇飞

add rys api

parent fa903c92
......@@ -18,6 +18,7 @@ class BizOptCtl extends CtlBase {
this.shisService = system.getObject("service.bizchance.salesmanhisSve");
this.receiveUrl = settings.receiveUrl();
this.queueUrl = settings.queueUrl();
this.rysUrl = settings.rysUrl();
//this.wdyUrl = settings.wdyUrl();
this.dateUtil = system.getObject("util.dateClient");
}
......@@ -123,14 +124,21 @@ class BizOptCtl extends CtlBase {
//根据需求编号去更新该条需求的状态为已关闭
try {
let res = await this.service.updateStatusByDemandCode(pobj);
//TODO 同步该需求关闭信息到其他系统(走队列,直接扔到队列里面)
//添加到记录表
pobj.operator = {
id: mobj.userid ? mobj.userid : "",
name: mobj.username ? mobj.username : ""
}
let recordRes = await this.operationrecordSve.insertInfo(pobj);
//异步将该需求关闭信息同步到其他系统(走队列,融易算接口文档2.3)
//构造参数
let pushUrl = this.rysUrl + "leads/proposal/close";
let pushObj = {
pushUrl: pushUrl,
actionType: "close",
messageBody: pobj
}
system.queueOper(pushObj);
return system.getResult("关闭需求成功!");
} catch (error) {
return system.getResultError("bizoptCtl/closeBizopt 关闭需求出错!");
......@@ -344,16 +352,16 @@ class BizOptCtl extends CtlBase {
var pobj = nobj.actionBody.messageBody;
if (pobj.intentionBizId && pobj.intentionBizId != 'undefined') {
try {
var  cachestr  =  sha235(JSON.stringify(nobj));      
var  cacheInfo  =  await  this.cacheManager["TxCache"].getCache(cachestr); 
if  (cacheInfo  &&  cacheInfo  !=  'undefined')  {        
return  {          
"status":  1,
  //1代表成功,否则失败
var cachestr = sha235(JSON.stringify(nobj));
var cacheInfo = await this.cacheManager["TxCache"].getCache(cachestr);
if (cacheInfo && cacheInfo != 'undefined') {
return {
"status": 1,
//1代表成功,否则失败
"msg": "已处理成功!",
"data": cachestr ,
"data": cachestr,
"requestId": nobj.requestId
}      
}
} else {
pobj.businessStatus = 'received';
pobj.sourceNumber = 'tx';
......
......@@ -5,6 +5,8 @@ const appconfig = system.getSysConfig();
class FitaxschemeCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(FitaxschemeCtl));
this.kongUrl = settings.kongurl();
this.rysUrl = settings.rysUrl();
}
/**
* 新建方案信息
......@@ -17,6 +19,17 @@ class FitaxschemeCtl extends CtlBase {
return system.getResultError("fitaxschemeCtl/insertInfo 缺少需求编号!");
}
let res = await this.service.insertInfo(pobj);
//同步方案信息,获取方案编号(走队列,再写一个接收队列方案编号的方法,将方案编号更新到数据库 融易算接口文档2.2)
//构造参数
let pushUrl = this.rysUrl + "leads/proposal/create";
let notifyUrl = this.kongUrl + "web/fitaxschemeCtl/updateInfo";
let pushObj = {
pushUrl: pushUrl,
actionType: "create",
notifyUrl: notifyUrl,
messageBody: pobj
}
system.queueOper(pushObj);
return system.getResult("新建方案成功!");
} catch (error) {
console.log("fitaxschemeCtl/insertInfo---------------------------------------------------------------- " + error);
......@@ -24,17 +37,37 @@ class FitaxschemeCtl extends CtlBase {
}
}
async findInfoByBizid(pobj,qobj,req){//方案
try{
if (pobj.bizId){
/**
* @param {*} pobj
* @param {*} qobj
* @param {*} req
*/
async updateInfo(pobj, qobj, req) {
try {
let res = await this.service.updateInfo(pobj);
return system.getResult("添加方案编号成功!");
} catch (error) {
console.log("fitaxschemeCtl/updateInfo error: " + error);
return system.getResultError("添加方案编号失败: " + error)
}
}
/**
* @param {*} pobj
* @param {*} qobj
* @param {*} req
*/
async findInfoByBizid(pobj, qobj, req) {//方案
try {
if (pobj.bizId) {
var res = await this.service.findInfoByBizid(pobj);
return system.getResult(res);
}
else{
else {
return system.getResultError("缺少方案编号");
}
}
catch(error){
catch (error) {
return system.getResultError(error);
}
}
......@@ -42,20 +75,20 @@ class FitaxschemeCtl extends CtlBase {
module.exports = FitaxschemeCtl;
var task = new FitaxschemeCtl();
var obj={
d:{
"demand_code":"20200728103902194844_book",
"solution_bizid":"22222",
"service_type":"代理记账",
"service_name":"海南省三亚市",
"company_type":"特殊行业",
"buy_duration":2,
"remarks":"SaaS",
"taxpayer_type":"小规模纳税人",
"total_cost":"2222"
var obj = {
d: {
"demand_code": "20200728103902194844_book",
"solution_bizid": "22222",
"service_type": "代理记账",
"service_name": "海南省三亚市",
"company_type": "特殊行业",
"buy_duration": 2,
"remarks": "SaaS",
"taxpayer_type": "小规模纳税人",
"total_cost": "2222"
}
}
task.insertInfo(obj,{},{}).then(d=>{
task.insertInfo(obj, {}, {}).then(d => {
console.log(JSON.stringify(d));
})
......@@ -18,7 +18,6 @@ class FitaxschemeDao extends Dao {
/**
* 插入方案信息
* TODO 同步方案信息,获取方案编号(走队列,再写一个接收队列方案编号的方法,将方案编号更新到数据库)
* @param {*} qobj
* @param {*} t
*/
......@@ -35,12 +34,15 @@ class FitaxschemeDao extends Dao {
}
/**
*更新方案编号
*更新方案信息(主要是添加方案编号)
*@param {*} qobj
* @param {*} t
*/
async updateInfo(qobj, t) {
let obj = this.buildObj(qobj);
let obj = {};
if (qobj.solution_bizid) {// 方案编号
obj.solution_bizid = qobj.solution_bizid;
}
let whereObj = { "demand_code": obj.demand_code };
return await this.updateByWhere(obj, whereObj, t);
}
......
......@@ -59,6 +59,13 @@ var settings = {
return "http://logs-sytxpublic-msgq-service/api/queueAction/producer/springBoard";
}
},
rysUrl: function () {
if (this.env == "localhost") {
return "http://";
} else {
return "http://";
}
},
ftConfig: function () {
if (this.env == "localhost") {
return {
......
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