Commit a1db065d by 王勇飞

gyq

parent 05f5376d
......@@ -10,6 +10,7 @@ class DeliverybillCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(DeliverybillCtl));
this.logService = system.getObject("service.bizchance.statuslogSve");
this.cacheManager = system.getObject("db.common.cacheManager");
}
/**
......@@ -143,8 +144,20 @@ class DeliverybillCtl extends CtlBase {
// 创建服务实例
async insertInfo(pobj, qobj, req) {
try {
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' &&
if (pobj.acrequestId && pobj.requestId != 'undefined' &&
pobj.bizId && pobj.bizId != 'undefined' &&
pobj.contactsPhone && pobj.contactsPhone != 'undefined' &&
pobj.userId && pobj.userId != 'undefined' &&
......@@ -158,17 +171,32 @@ class DeliverybillCtl extends CtlBase {
pobj.service_address && pobj.service_address != 'undefined' &&
pobj.delivery_status && pobj.delivery_status != 'undefined' &&
pobj.facilitator_id && pobj.facilitator_id != 'undefined') {
try {
var buInfo = await this.service.insertInfo(pobj);
return system.getResult(buInfo);
} catch (error) {
return system.getResultError(error);
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.getResultError("参数错误!");
}
} else {
return system.getResultError("参数错误!");
}
}
}
catch (error) {
return system.getResultError(error);
}
}
async updateServer(pobj, qobj, req) {
try {
if (!pobj.requestId || pobj.requestId == 'undefined') {
......@@ -202,16 +230,16 @@ class DeliverybillCtl extends CtlBase {
}
}
//根据bizId查询deliverybill表中的所有信息
async getInfo(pobj,qobj,req){
try{
if(!pobj.bizId){
async getInfo(pobj, qobj, req) {
try {
if (!pobj.bizId) {
throw new Error("bizId 不能为空");
}
const rs=await this.service.getInfo(pobj);
const rs = await this.service.getInfo(pobj);
//console.log("got message");
return system.getResult(rs);
}catch(err){
return system.getResult(null,err.message)
} catch (err) {
return system.getResult(null, err.message)
}
}
}
......
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