Commit 84fce899 by Sxy

Merge branch 'tx-fi-tax' of gitlab.gongsibao.com:jiangyong/zhichan into tx-fi-tax

parents 44ada3dd b444abec
......@@ -121,36 +121,64 @@ class BizOptCtl extends CtlBase {
async closeBizopt(mobj, qobj, req) {
let pobj = mobj.d;
pobj.business_status = "isClosed";
if (!qobj.demand_code || !qobj.close_reason) {
return system.getResultError("缺少必要参数.");
}
//根据需求编号去更新该条需求的状态为已关闭
try {
let res = await this.service.updateStatusByDemandCode(pobj);
//添加到记录表
pobj.operator = {
id: mobj.userid ? mobj.userid : "",
name: mobj.username ? mobj.username : ""
}
pobj.operation_type = "close";
pobj.operation_details = {
close_reason: pobj.close_reason,
remarks: pobj.remarks
}
let recordRes = await this.operationrecordSve.insertInfo(pobj);
//异步将该需求关闭信息同步到其他系统(走队列,融易算接口文档2.3)
//构造参数
//TODO 构造参数,添加判断(有方案信息的才走队列同步到融易算,没有的直接关闭)
let pushUrl = this.rysUrl + "leads/proposal/close";
let pushObj = {
pushUrl: pushUrl,
actionType: "close",
messageBody: pobj,
headData: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTg0MzQ2ODcsImlzcyI6InJFRVN6TU5ZUlM2RnBWNnZlY09vdExPNWdPcUNXSmFQIiwiaWF0IjoxNTk4NDMxMDg3fQ.isQ40HqHHfJ-rTsUQOhRIdu4XCitZU-AfzeqSH4kPbQ',
'XAPPKEY': 'f6b59b74-f943-4735-bb86-e05d6b7fd78e',
'Source': 'GSB'
}
//构造参数,添加判断(有方案信息的才走队列同步到融易算,没有的直接关闭)
let schemeRes = await this.schemeSve.findInfo(pobj);
if (schemeRes && schemeRes.solution_bizid) {
let pushObj = this.buildObj(pobj, schemeRes);
system.queueOper(pushObj);
} else {
console.log(pobj.demand_code + "该需求没有方案信息,不需要同步");
}
system.queueOper(pushObj);
return system.getResult("关闭需求成功!");
} catch (error) {
return system.getResultError("bizoptCtl/closeBizopt 关闭需求出错!");
}
}
buildObj(pobj, schemeRes) {
let pushUrl = this.rysUrl + "leads/proposal/close";
let solutionBizId;
if (schemeRes.solution_bizid) {
solutionBizId = schemeRes.solution_bizid;
}
let pushObj = {
pushUrl: pushUrl,
actionType: "close",
messageBody: {
IntentionBizId: pobj.demand_code,
BizType: "bookkeeping",
Solution: {
SolutionBizId: solutionBizId,//方案编号
Note: pobj.close_reason //备注
}
},
headData: {
'Source': 'GSB'
}
}
return pushObj;
}
/**
* 获取跟进详情页所有信息
* @param {*} mobj
......
var system = require("../../../system");
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
const { json, JSON } = require("sequelize");
const appconfig = system.getSysConfig();
class FitaxschemeCtl extends CtlBase {
constructor() {
......@@ -124,21 +125,3 @@ 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"
// }
// }
// task.insertInfo(obj, {}, {}).then(d => {
// console.log(JSON.stringify(d));
// })
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 财税-方案表
*/
module.exports = (db, DataTypes) => {
return db.define("fitaxpushqueue", {
delivery_code: { // 交付单id
allowNull: true,
type: DataTypes.STRING
},
current_period: { // 当前帐期
allowNull: true,
type: DataTypes.STRING
},
req_data: { // 推送请求数据
allowNull: true,
type: DataTypes.JSON
},
res_data: { // 推送返回数据
allowNull: true,
type: DataTypes.JSON
},
push_status: { // 推送状态
allowNull: true,
type: DataTypes.STRING
},
rys_check: { // 融易算是否确认
allowNull: true,
type: DataTypes.STRING
},
check_date: { // 融易算确认时间
allowNull: true,
type: DataTypes.DATE
}
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'fi_tax_push_queue',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
const { json } = require("sequelize");
const appconfig = system.getSysConfig();
class FitaxschemeService extends ServiceBase {
constructor() {
......@@ -30,4 +31,16 @@ class FitaxschemeService extends ServiceBase {
})
}
}
module.exports = FitaxschemeService;
\ No newline at end of file
module.exports = FitaxschemeService;
// var task = new FitaxschemeService();
// test()
// async function test() {
// var obj = {
// "demand_code": "20200728103902194844_book",
// }
// let res = await task.findInfo(obj);
// if (res) {
// console.log("返回结果:" + JSON.stringify(res));
// }
// }
\ No newline at end of file
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