Commit cad6fd9d by 王勇飞

gyq

parent b0da6c73
......@@ -12,6 +12,7 @@ class DeliverybillCtl extends CtlBase {
super("bizchance", CtlBase.getServiceName(DeliverybillCtl));
this.logService = system.getObject("service.bizchance.statuslogSve");
this.cacheManager = system.getObject("db.common.cacheManager");
this.fitaxschemeService = system.getObject("service.bizchance.fitaxschemeSve");
}
/**
......@@ -143,155 +144,135 @@ class DeliverybillCtl extends CtlBase {
}
}
// 创建融易算服务实例
async insertInfo(obj, qobj, req) {
try {
var pobj = obj.actionBody.messageBody;
var cachestr = sha235(JSON.stringify(pobj));
var cacheInfo = await this.cacheManager["TxCache"].getCache(cachestr);
if (cacheInfo && cacheInfo != 'undefined') {
return {
"status": 1, //1代表成功,否则失败
"msg": "已处理成功!",
"data": "",
"requestId": ""
}
} else {
// 检验各项必传参数
if (!pobj.requestId || pobj.requestId == 'undefined') {
throw new Error("requestId 不能为空");
}
if (!pobj.bizId || pobj.bizId == 'undefined') {
throw new Error("bizId 不能为空");
}
if (!pobj.contactsPhone || pobj.contactsPhone == 'undefined') {
throw new Error("contactsPhone 不能为空");
}
if (!pobj.userId || pobj.userId == 'undefined') {
throw new Error("userId 不能为空");
}
if (!pobj.orderId || pobj.orderId == 'undefined') {
throw new Error("orderId 不能为空");
}
if (!pobj.areatype || pobj.areatype == 'undefined') {
throw new Error("areatype 不能为空");
}
if (!pobj.area || pobj.area == 'undefined') {
throw new Error("area 不能为空");
}
if (!pobj.topOrgCode || pobj.topOrgCode == 'undefined') {
throw new Error("topOrgCode 不能为空");
}
if (!pobj.taxpayerType || pobj.taxpayerType == 'undefined') {
throw new Error("taxpayerType 不能为空");
}
if (!pobj.product_code || pobj.product_code == 'undefined') {
throw new Error("product_code 不能为空");
}
if (!pobj.product_name || pobj.product_name == 'undefined') {
throw new Error("product_name 不能为空");
}
if (!pobj.service_address || pobj.service_address == 'undefined') {
throw new Error("service_address 不能为空");
}
if (!pobj.delivery_status || pobj.delivery_status == 'undefined') {
throw new Error("delivery_status 不能为空");
}
if (!pobj.facilitator_id || pobj.delivery_status == 'undefined') {
throw new Error("delivery_status 不能为空");
}
var buInfo = await this.service.insertInfo(pobj);
if (buInfo) {
await this.cacheManager["TxCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);//插入redis缓存
return {
"status": 1, //1代表成功,否则失败
"msg": "处理成功!",
"data": buInfo,
"requestId": ""
}
} else {
return system.getResultFail(buInfo);
}
}
}
catch (err) {
return system.getResult(null, err.message)
}
}
// // 创建融易算服务实例
// async insertInfo(obj, qobj, req) {
// console.log("GGGGGGG----------------------------------------------" + JSON.stringify(obj));
// try {
// var pobj = obj.actionBody.messageBody;
// var cachestr = sha235(JSON.stringify(pobj));
// var cacheInfo = await this.cacheManager["TxCache"].getCache(cachestr);
// if (cacheInfo && cacheInfo != 'undefined') {
// return {
// "status": 1, //1代表成功,否则失败
// "msg": "已处理成功!",
// "data": "",
// "requestId": ""
// }
// }
// else {
// pobj.orderId = pobj.orderId + "_book";
// pobj.contactsPhone = pobj.contactsMobile;
// pobj.product_code = "bookkeeping";
// pobj.product_name = "代帐服务";
// pobj.delivery_status = "received";
// pobj.facilitator_id = "10";
// pobj.facilitator_name = "公司宝";
// pobj.source_number = "tx";
// pobj.source_name = "tencentCloud";
// pobj.taxpayerName = pobj.taxpayerType;
// if (pobj.taxpayerType == 1){
// pobj.taxpayerType = "generalTaxpayer";
// }
// else if (pobj.taxpayerType == 2){
// pobj.taxpayerType = "smallScaleTaxpayer";
// }
// if (pobj.solutionBizId){
// var scheme = await this.fitaxschemeService.findInfoByBizid({"bizId":pobj.solutionBizId});
// if (scheme){
// pobj.demand_code = scheme.demand_code;
// }
// }
// var buInfo = await this.service.insertInfo(pobj);
// if (buInfo) {
// await this.cacheManager["TxCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);//插入redis缓存
// return {
// "status": 1, //1代表成功,否则失败
// "msg": "处理成功!",
// "data": buInfo,
// "requestId": ""
// }
// }
// else {
// return system.getResultFail(buInfo);
// }
// }
// }
// catch (err) {
// return system.getResult(null, err.message)
// }
// }
// 更新融易算服务实例
async updateServer(obj, qobj, req) {
try {
var pobj = obj.actionBody.messageBody;
var cachestr = sha235(JSON.stringify(pobj));
var cacheInfo = await this.cacheManager["TxCache"].getCache(cachestr);
var cacheInfo;
if (cacheInfo && cacheInfo != 'undefined') {
return {
"status": 1, //1代表成功,否则失败
"msg": "已处理成功!",
"data": "",
"requestId": ""
}
} else {
if (!pobj.requestId || pobj.requestId == 'undefined') {
throw new Error("requestId 不能为空");
}
if (!pobj.bizId || pobj.bizId == 'undefined') {
throw new Error("bizId 不能为空");
}
if (!pobj.orderId || pobj.orderId == 'undefined') {
throw new Error("orderId 不能为空");
}
if (!pobj.topOrgCode || pobj.topOrgCode == 'undefined') {
throw new Error("topOrgCode 不能为空");
}
if (!pobj.companyName || pobj.companyName == 'undefined') {
throw new Error("companyName 不能为空");
}
if (!pobj.contactName || pobj.contactName == 'undefined') {
throw new Error("contactName 不能为空");
}
if (!pobj.companyBizType || pobj.companyBizType == 'undefined') {
throw new Error("companyBizType 不能为空");
}
if (!pobj.uscc || pobj.uscc == 'undefined') {
throw new Error("uscc 不能为空");
}
const rs = await this.service.updateServer(pobj);
if (rs) {
await this.cacheManager["TxCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);//插入redis缓存
return {
"status": 1, //1代表成功,否则失败
"msg": "处理成功!",
"data": rs,
"requestId": ""
}
} else {
return system.getResultFail(rs);
}
}
}
catch (err) {
return system.getResult(null, err.message)
}
}
// async updateServer(obj, qobj, req) {
// try {
// var pobj = obj.actionBody.messageBody;
// var cachestr = sha235(JSON.stringify(pobj));
// var cacheInfo = await this.cacheManager["TxCache"].getCache(cachestr);
// var cacheInfo;
// if (cacheInfo && cacheInfo != 'undefined') {
// return {
// "status": 1, //1代表成功,否则失败
// "msg": "已处理成功!",
// "data": "",
// "requestId": ""
// }
// } else {
// if (!pobj.requestId || pobj.requestId == 'undefined') {
// throw new Error("requestId 不能为空");
// }
// if (!pobj.bizId || pobj.bizId == 'undefined') {
// throw new Error("bizId 不能为空");
// }
// if (!pobj.orderId || pobj.orderId == 'undefined') {
// throw new Error("orderId 不能为空");
// }
// if (!pobj.topOrgCode || pobj.topOrgCode == 'undefined') {
// throw new Error("topOrgCode 不能为空");
// }
// if (!pobj.companyName || pobj.companyName == 'undefined') {
// throw new Error("companyName 不能为空");
// }
// if (!pobj.contactName || pobj.contactName == 'undefined') {
// throw new Error("contactName 不能为空");
// }
// if (!pobj.companyBizType || pobj.companyBizType == 'undefined') {
// throw new Error("companyBizType 不能为空");
// }
// if (!pobj.uscc || pobj.uscc == 'undefined') {
// throw new Error("uscc 不能为空");
// }
// const rs = await this.service.updateServer(pobj);
// if (rs) {
// await this.cacheManager["TxCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);//插入redis缓存
// return {
// "status": 1, //1代表成功,否则失败
// "msg": "处理成功!",
// "data": rs,
// "requestId": ""
// }
// } else {
// return system.getResultFail(rs);
// }
// }
// }
// catch (err) {
// return system.getResult(null, err.message)
// }
// }
//根据bizId查询deliverybill表中的所有信息
async getInfo(pobj, qobj, req) {
try {
if (!pobj.bizId) {
throw new Error("bizId 不能为空");
}
const rs = await this.service.getInfo(pobj);
//console.log("got message");
return system.getResult(rs);
} catch (err) {
return system.getResult(null, err.message)
}
}
// //根据bizId查询deliverybill表中的所有信息
// async getInfo(pobj, qobj, req) {
// try {
// if (!pobj.bizId) {
// throw new Error("bizId 不能为空");
// }
// const rs = await this.service.getInfo(pobj);
// //console.log("got message");
// return system.getResult(rs);
// } catch (err) {
// return system.getResult(null, err.message)
// }
// }
}
module.exports = DeliverybillCtl;
......@@ -323,16 +304,3 @@ module.exports = DeliverybillCtl;
// task.insertInfo(obj, {}, {}).then(d => {
// console.log(JSON.stringify(d));
// })
// (async () => {
// var task = new DeliverybillCtl();
// var obj = {
// "deliverId":"1111111",
// "company1": "华为技术有限公司",
// "company2": "中兴通讯股份有限公司",
// "keyword1":"用户设备,通信领域,通信技术,设备发送,指示信息,通信系统,通信方法,设备接收,对应关系,基站发送,终端发送,用户体验,配置信息,请求消息,数据传输方法,用户终端,网络侧,移动终端,通信设备,传输方法",
// "keyword2":"用户体验,移动终端,用户设备,相关技术,网络侧,终端发送,用户终端,配置信息,指示信息,请求消息,对应关系,传输方法,基站发送,通信系统,数据传输方法,通信领域,通信技术,设备发送,响应消息,发送方法"
// };
// var d = await task.deliverInfo(obj,{},{})
// console.log("dddddd---------" + JSON.stringify(d));
// })()
......@@ -23,6 +23,21 @@ class FitaxschemeCtl extends CtlBase {
return system.getResultError("fitaxschemeCtl/insertInfo 新建方案出错!");
}
}
// async findInfoByBizid(pobj,qobj,req){//方案
// try{
// if (pobj.bizId){
// var res = await this.service.findInfoByBizid(pobj);
// return system.getResult(res);
// }
// else{
// return system.getResultError("缺少方案编号");
// }
// }
// catch(error){
// return system.getResultError(error);
// }
// }
}
module.exports = FitaxschemeCtl;
......
......@@ -16,7 +16,7 @@ class Dao {
var u2 = this.preCreate(u);
if (t) {
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
//console.log( this.model);
console.log( this.model);
return this.model.create(u2, { transaction: t }).then(u => {
return u;
});
......
......@@ -94,120 +94,120 @@ class DeliverybillDao extends Dao {
return qw;
}
async insertInfo(qobj, t) {
var obj = {
"delivery_code": qobj.orderId,
"product_code": qobj.product_code,
"product_name": qobj.product_name,
"service_address": qobj.service_address,
"delivery_status": qobj.delivery_status,
"facilitator_id": qobj.facilitator_id,
"biz_id": qobj.bizId
};
// source_number
if (qobj.source_number && qobj.source_number != 'undefined') {
obj.source_number = qobj.source_number;
delete qobj.source_number;
}
// demand_code
if (qobj.demand_code && qobj.demand_code != 'undefined') {
obj.demand_code = qobj.demand_code;
delete qobj.demand_code;
}
// sku_code
if (qobj.sku_code && qobj.sku_code != 'undefined') {
obj.sku_code = qobj.sku_code;
delete qobj.sku_code;
}
// scheme_number
if (qobj.solutionBizId && qobj.solutionBizId != 'undefined') {
obj.scheme_number = qobj.solutionBizId;
delete qobj.solutionBizId;
}
// selling_price
if (qobj.selling_price && qobj.selling_price != 'undefined') {
obj.selling_price = qobj.selling_price;
delete qobj.selling_price;
}
// cost_price
if (qobj.cost_price && qobj.cost_price != 'undefined') {
obj.cost_price = qobj.cost_price;
delete qobj.cost_price;
}
// close_reason
if (qobj.close_reason && qobj.close_reason != 'undefined') {
obj.close_reason = qobj.close_reason;
delete qobj.close_reason;
}
// facilitator_name
if (qobj.facilitator_name && qobj.facilitator_name != 'undefined') {
obj.facilitator_name = qobj.facilitator_name;
delete qobj.facilitator_name;
}
// salesman_opcode
if (qobj.salesman_opcode && qobj.salesman_opcode != 'undefined') {
obj.salesman_opcode = qobj.salesman_opcode;
delete qobj.salesman_opcode;
}
// salesman_id
if (qobj.salesman_id && qobj.salesman_id != 'undefined') {
obj.salesman_id = qobj.salesman_id;
delete qobj.salesman_id;
}
// salesman_name
if (qobj.salesman_name && qobj.salesman_name != 'undefined') {
obj.salesman_name = qobj.salesman_name;
delete qobj.salesman_name;
}
// salesman_phone
if (qobj.salesman_phone && qobj.salesman_phone != 'undefined') {
obj.salesman_phone = qobj.salesman_phone;
delete qobj.salesman_phone;
}
// source_name
if (qobj.source_name && qobj.source_name != 'undefined') {
obj.source_name = qobj.source_name;
delete qobj.source_name;
}
// master_source_number
if (qobj.master_source_number && qobj.master_source_number != 'undefined') {
obj.master_source_number = qobj.master_source_number;
delete qobj.master_source_number;
}
// settle_status
if (qobj.settle_status && qobj.settle_status != 'undefined') {
obj.settle_status = qobj.settle_status;
delete qobj.settle_status;
}
// settlebill_id
if (qobj.settlebill_id && qobj.settlebill_id != 'undefined') {
obj.settlebill_id = qobj.settlebill_id;
delete qobj.settlebill_id;
}
// delivery_man_id
if (qobj.delivery_man_id && qobj.delivery_man_id != 'undefined') {
obj.delivery_man_id = qobj.delivery_man_id;
delete qobj.delivery_man_id;
}
// delivery_man_name
if (qobj.delivery_man_name && qobj.delivery_man_name != 'undefined') {
obj.delivery_man_name = qobj.delivery_man_name;
delete qobj.delivery_man_name;
}
// delivery_man_opcode
if (qobj.delivery_man_opcode && qobj.delivery_man_opcode != 'undefined') {
obj.delivery_man_opcode = qobj.delivery_man_opcode;
delete qobj.delivery_man_opcode;
}
delete qobj.orderId;
delete qobj.product_code;
delete qobj.product_name;
delete qobj.service_address;
delete qobj.delivery_status;
delete qobj.facilitator_id;
obj.delivery_info = qobj;
return await this.create(obj, t);
}
// async insertInfo(qobj, t) {
// var obj = {
// "delivery_code": qobj.orderId,
// "product_code": qobj.product_code,
// "product_name": qobj.product_name,
// "service_address": qobj.area,
// "delivery_status": qobj.delivery_status,
// "facilitator_id": qobj.facilitator_id,
// "biz_id": qobj.bizId
// };
// // source_number
// if (qobj.source_number && qobj.source_number != 'undefined') {
// obj.source_number = qobj.source_number;
// delete qobj.source_number;
// }
// // demand_code
// if (qobj.demand_code && qobj.demand_code != 'undefined') {
// obj.demand_code = qobj.demand_code;
// delete qobj.demand_code;
// }
// // sku_code
// if (qobj.sku_code && qobj.sku_code != 'undefined') {
// obj.sku_code = qobj.sku_code;
// delete qobj.sku_code;
// }
// // scheme_number
// if (qobj.solutionBizId && qobj.solutionBizId != 'undefined') {
// obj.scheme_number = qobj.solutionBizId;
// delete qobj.solutionBizId;
// }
// // selling_price
// if (qobj.selling_price && qobj.selling_price != 'undefined') {
// obj.selling_price = qobj.selling_price;
// delete qobj.selling_price;
// }
// // cost_price
// if (qobj.cost_price && qobj.cost_price != 'undefined') {
// obj.cost_price = qobj.cost_price;
// delete qobj.cost_price;
// }
// // close_reason
// if (qobj.close_reason && qobj.close_reason != 'undefined') {
// obj.close_reason = qobj.close_reason;
// delete qobj.close_reason;
// }
// // facilitator_name
// if (qobj.facilitator_name && qobj.facilitator_name != 'undefined') {
// obj.facilitator_name = qobj.facilitator_name;
// delete qobj.facilitator_name;
// }
// // salesman_opcode
// if (qobj.salesman_opcode && qobj.salesman_opcode != 'undefined') {
// obj.salesman_opcode = qobj.salesman_opcode;
// delete qobj.salesman_opcode;
// }
// // salesman_id
// if (qobj.salesman_id && qobj.salesman_id != 'undefined') {
// obj.salesman_id = qobj.salesman_id;
// delete qobj.salesman_id;
// }
// // salesman_name
// if (qobj.salesman_name && qobj.salesman_name != 'undefined') {
// obj.salesman_name = qobj.salesman_name;
// delete qobj.salesman_name;
// }
// // salesman_phone
// if (qobj.salesman_phone && qobj.salesman_phone != 'undefined') {
// obj.salesman_phone = qobj.salesman_phone;
// delete qobj.salesman_phone;
// }
// // source_name
// if (qobj.source_name && qobj.source_name != 'undefined') {
// obj.source_name = qobj.source_name;
// delete qobj.source_name;
// }
// // master_source_number
// if (qobj.master_source_number && qobj.master_source_number != 'undefined') {
// obj.master_source_number = qobj.master_source_number;
// delete qobj.master_source_number;
// }
// // settle_status
// if (qobj.settle_status && qobj.settle_status != 'undefined') {
// obj.settle_status = qobj.settle_status;
// delete qobj.settle_status;
// }
// // settlebill_id
// if (qobj.settlebill_id && qobj.settlebill_id != 'undefined') {
// obj.settlebill_id = qobj.settlebill_id;
// delete qobj.settlebill_id;
// }
// // delivery_man_id
// if (qobj.delivery_man_id && qobj.delivery_man_id != 'undefined') {
// obj.delivery_man_id = qobj.delivery_man_id;
// delete qobj.delivery_man_id;
// }
// // delivery_man_name
// if (qobj.delivery_man_name && qobj.delivery_man_name != 'undefined') {
// obj.delivery_man_name = qobj.delivery_man_name;
// delete qobj.delivery_man_name;
// }
// // delivery_man_opcode
// if (qobj.delivery_man_opcode && qobj.delivery_man_opcode != 'undefined') {
// obj.delivery_man_opcode = qobj.delivery_man_opcode;
// delete qobj.delivery_man_opcode;
// }
// delete qobj.orderId;
// delete qobj.product_code;
// delete qobj.product_name;
// delete qobj.service_address;
// delete qobj.delivery_status;
// delete qobj.facilitator_id;
// obj.delivery_info = qobj;
// return await this.create(obj, t);
// }
async updateServer(qobj, whereobj, t) {
return await this.updateByWhere(qobj, whereobj, t);
......
......@@ -67,5 +67,12 @@ class FitaxschemeDao extends Dao {
}
return obj;
}
// async findInfoByBizid(qobj){
// let obj = {
// "solution_bizid": qobj.bizId
// }
// return await this.findOne(obj);
// }
}
module.exports = FitaxschemeDao;
......@@ -160,6 +160,33 @@ module.exports = {
"inservice": "已交付",
"expired": "已到期"
},
"bookAreaDict":{//代帐服务地区
"620100":"兰州市" ,
"510100":"成都市" ,
"350100":"福州市" ,
"430100":"长沙市" ,
"130100":"石家庄市" ,
"500100":"重庆市" ,
"330100":"杭州市" ,
"350200":"厦门市" ,
"330300":"温州市" ,
"440100":"广州市" ,
"440300":"深圳市" ,
"410100":"郑州市" ,
"420100":"武汉市" ,
"610100":"西安市" ,
"320100":"南京市" ,
"340100":"合肥市" ,
"330200":"宁波市" ,
"370100":"济南市" ,
"370200":"青岛市" ,
"320500":"苏州市" ,
"120100":"天津市" ,
"210200":"大连市" ,
"520100":"贵阳市" ,
"110100":"北京市" ,
"310100":"上海市" ,
},
"registeredAreaDict": {//注册地区
"110100": "北京",
......
......@@ -235,12 +235,12 @@ class DeliverybillService extends ServiceBase {
}
async insertInfo(qobj) {
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj, t);
});
}
// async insertInfo(qobj) {
// var self = this;
// return self.db.transaction(async function (t) {
// return await self.dao.insertInfo(qobj, t);
// });
// }
async updateServer(qobj) {
var self = this;
......@@ -380,7 +380,7 @@ class DeliverybillService extends ServiceBase {
async getInfo(pobj){
let result={};
let deliveryBillInfo = await this.dao.findByBizId(pobj);
//console.log("gggg"+deliveryBillInfo+pobj.bizId)
// console.log("gggg"+deliveryBillInfo+pobj.bizId)
if(!deliveryBillInfo){
throw new Error("没有服务信息");
}
......
......@@ -18,5 +18,9 @@ class FitaxschemeService extends ServiceBase {
var self = this;
return await self.dao.findInfo(qobj);
}
// async findInfoByBizid(qobj){
// return await this.dao.findInfoByBizid(qobj);
// }
}
module.exports = FitaxschemeService;
\ No newline at end of file
......@@ -220,7 +220,8 @@ class System {
try {
ClassObj = require(objabspath);
} catch (e) {
// console.log(e)
console.log("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
console.log(e);
let fname = objsettings[packageName + "base"];
ClassObj = require(fname);
}
......@@ -402,7 +403,7 @@ System.FLOWCODE = {
SCHEME: "SCHEME",//方案表
DELIVERY: "DELIVERY",//服务单表
}
// 服务名称
// 服务名称c
System.SERVICECODE = {
FT: 'bookkeeping' // 财税项目
}
......
......@@ -30,7 +30,7 @@ class ExecClient {
async execPost(subData, url) {
let cmd = this.FetchPostCmd(subData, url);
//console.log("__________________" + cmd);
console.log("__________________" + cmd);
var result = await this.exec(cmd);
return result;
}
......
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