Commit e0646743 by 庄冰

gsbh5

parent fb7aa8a9
......@@ -13,6 +13,7 @@ class ChannelPushApi{
constructor(){
this.orderSve=System.getObject("service.orderSve");
this.tmflowSve = System.getObject("service.tmflowSve");
this.channelreceiveSve = System.getObject("service.channelreceiveSve");
// this.userSve=System.getObject("service.userSve");
// this.appSve=System.getObject("service.appSve");
// this.channelSve=System.getObject("service.channelSve");
......@@ -314,9 +315,34 @@ class ChannelPushApi{
// officialType:"1",
// tmRegistNum:"111111",
// officialFileName:"商标注册申请书",
// officialFileUrl:"http://www.baidu.com",
// };
// return this.tmflowSve.pushTmOfficialData(pushObj);
// officialFileUrl:"http://www.baidu.com", pushChannelAssistTmData
// };pushEditChannelAssistTmData
// var co = {
// "org_name":"汉唐信通",
// "operator_name":"庄冰",
// "order_pay_state":"待付款",
// "order_state":"办理中",
// "order_company_name":"北京联大共享科技有限公司",
// "customer_phone":"13075556693",
// "customer_name":"测试李四",
// "customer_email":"2577638904@qq.com",
// "order_price":0.01,
// "payOneClassCount":1,
// "needId":"OT18202003312235gT1S",
// "order_no_class_count":[
// {
// "class_count":10,
// "order_no":"100173202"
// }
// ],
// "threeClassCount":10,
// "order_nos":[
// "100173202"
// ],
// "oneClassCount":1,
// "payThreeClassCount":10
// };
// return this.channelreceiveSve.pushEditChannelAssistTmData("4u31585290678404","dbsbzc",co);
}
}
module.exports=ChannelPushApi;
\ No newline at end of file
......@@ -204,5 +204,40 @@ class ChannelReceiveApi {
return { code: -200, msg: "操作失败", err: e.stack };
}
}
//渠道商标方案确认
async channelTmConfirm(pobj, obj) {
// var userInfo = obj.userInfo;
var appInfo = obj.appInfo;
if (!appInfo || !appInfo.app_code) {
return { code: -1, msg: "appInfo参数错误" };
}
try {
var app = await this.appSve.dao.model.findOne({
where: { appid: "2e787bbaacda4c6488b9fae58fff30ba", isEnabled: 1 },
raw: true
});
if (app) {
obj["app"] = app
} else {
return { code: -100, msg: "未知应用" };
}
var channel = await this.channelSve.getChannelItem(appInfo.app_code);
if (channel) {
obj["channel"] = channel
} else {
return { code: -101, msg: "未知渠道" };
}
// var user = await this.getUserInfo(userInfo, appInfo,app);
// if (user) {
// obj["user"] = user;
// } else {
// return { code: -102, msg: "未知用户" };
// }
return await this.channelreceiveSve.channelTmConfirm(obj);
} catch (e) {
return { code: -200, msg: "操作失败", err: e.stack };
}
}
}
module.exports = ChannelReceiveApi;
\ No newline at end of file
......@@ -8,10 +8,6 @@ class ChannelReceiveDao {
//推送渠道商标状态修改信息(同步商标注册号|商标状态|推送商标回执)
async updateChannelTmStatus(obj) {
try {
// var tbCode = obj.tbCode;
// if (!tbCode) {
// return { code: -100, msg: "tbCode参数错误" };
// }
var channelApiUrl = this.channelApiUrl;
channelApiUrl = settings.channelApiUrl("gsbh5");
var reqUrl = channelApiUrl + "/notifyaction/internalCallsNotify/updateTmStatus";
......@@ -21,14 +17,13 @@ class ChannelReceiveDao {
if(rtn && rtn.stdout){
rtn = JSON.parse(rtn.stdout);
}
console.log(rtn,"11111111111111111111111111111");
if (rtn.status == 0) {
await this.oplogSve.createDb({
logLevel: "info",
optitle: "gsbh5商标状态修改---成功",
op: reqUrl,
content: JSON.stringify(obj),
result: JSON.stringify(rtn),
resultinfo: JSON.stringify(rtn),
clientIp: ""
});
} else {
......@@ -37,7 +32,7 @@ class ChannelReceiveDao {
optitle: "gsbh5商标状态修改---失败",
op: reqUrl,
content: JSON.stringify(obj),
result: JSON.stringify(rtn),
resultinfo: JSON.stringify(rtn),
clientIp: ""
});
return { code: -200 };
......@@ -48,14 +43,106 @@ class ChannelReceiveDao {
await this.oplogSve.createDb({
logLevel: "error",
optitle: "渠道商标状态修改---异常",
op: "trademarkSve/updateChannelTmStatus",
op: "app/base/db/impl/channelreceiveDao.js",
content: JSON.stringify(obj),
resultinfo: JSON.stringify(e.stack),
clientIp: ""
});
return { code: -400, msg: "操作失败", err: e.stack };
}
}
//推送辅助、担保商标注册数据
async pushChannelAssistTmData(obj){
try {
var channelApiUrl = this.channelApiUrl;
channelApiUrl = settings.channelApiUrl("gsbh5");
var reqUrl = channelApiUrl + "/notifyaction/internalCallsNotify/nbtzreceiveAssistTmData";
var rc = system.getObject("util.execClient");
var rtn = await rc.execPost(obj, reqUrl);
if(rtn && rtn.stdout){
rtn = JSON.parse(rtn.stdout);
}
if (rtn.status == 0) {
await this.oplogSve.createDb({
logLevel: "info",
optitle: "gsbh5辅助、担保商标注册数据推送---成功",
op: reqUrl,
content: JSON.stringify(obj),
resultinfo: JSON.stringify(rtn),
clientIp: ""
});
} else {
await this.oplogSve.createDb({
logLevel: "error",
optitle: "gsbh5辅助、担保商标注册数据推送---失败",
op: reqUrl,
content: JSON.stringify(obj),
resultinfo: JSON.stringify(rtn),
clientIp: ""
});
return { code: -200 };
}
return { code: 1 };
} catch (e) {
console.log(e.stack);
await this.oplogSve.createDb({
logLevel: "error",
optitle: "gsbh5辅助、担保商标注册数据推送---异常",
op: "app/base/db/impl/channelreceiveDao.js",
content: JSON.stringify(obj),
resultinfo: JSON.stringify(e.stack),
clientIp: ""
});
return { code: -400, msg: "操作失败", err: e.stack };
}
}
//推送辅助、担保商标注册修改数据
async pushEditChannelAssistTmData(obj){
try {
var channelApiUrl = this.channelApiUrl;
channelApiUrl = settings.channelApiUrl("gsbh5");
var reqUrl = channelApiUrl + "/notifyaction/internalCallsNotify/nbtzreceiveEditAssistTmData";
var rc = system.getObject("util.execClient");
var rtn = await rc.execPost(obj, reqUrl);
if(rtn && rtn.stdout){
rtn = JSON.parse(rtn.stdout);
}
if (rtn.status == 0) {
await this.oplogSve.createDb({
logLevel: "info",
optitle: "gsbh5辅助、担保商标注册修改数据推送---成功",
op: reqUrl,
content: JSON.stringify(obj),
result: JSON.stringify(rtn),
clientIp: ""
});
} else {
await this.oplogSve.createDb({
logLevel: "error",
optitle: "gsbh5辅助、担保商标注册修改数据推送---失败",
op: reqUrl,
content: JSON.stringify(obj),
result: JSON.stringify(rtn),
clientIp: ""
});
return { code: -200 };
}
return { code: 1 };
} catch (e) {
console.log(e.stack);
await this.oplogSve.createDb({
logLevel: "error",
optitle: "gsbh5辅助、担保商标注册修改数据推送---异常",
op: "app/base/db/impl/channelreceiveDao.js",
content: JSON.stringify(e.stack),
clientIp: ""
});
return { code: -400, msg: "操作失败", err: e.stack };
}
}
}
module.exports=ChannelReceiveDao;
// var task = new ChannelReceiveDao();
......
......@@ -6,6 +6,7 @@ class ChannelReceiveService {
constructor() {
this.orderSve = system.getObject("service.orderSve");
this.channelApiUrl = settings.channelApiUrl();
this.channelreceiveDao = system.getObject("db.channelreceiveDao");
}
//--------------接收渠道订单数据---start-------------------------------------------------------------
//商标自动提报(渠道)
......@@ -449,125 +450,314 @@ class ChannelReceiveService {
return { code: 1 };
})
}
//渠道商标方案确认
async channelTmConfirm(obj) {
var self = this;
// var user = obj.user;
// var app = obj.app;
var serviceNo = obj.serviceNo;
if (!serviceNo) {
return system.getResultFail(-101, "serviceNo参数错误");
}
var isConfirm = obj.isConfirm;
if (!isConfirm) {
return system.getResultFail(-103, "isConfirm参数错误");
}
// 1.获取交付单信息
var orderItem = await this.dao.model.findOne({
where: { channelOrderNum: serviceNo, channelCode: obj.channelCode },
raw: true
});
if (!orderItem) {
return { code: -102, msg: "系统中未查到相应订单,无法修改" };
}
var tms = await self.trademarkDao.model.findAll({ where: { channelOrderNum: serviceNo, orderNum: orderItem.orderNum }, raw: true });
var tradem = null;
for (var i = 0; i < tms.length; i++) {
tradem = tms[i];
if (tradem.tmStatus != "WAITCONFIRM") {
return { code: -103, msg: "方案确认失败,存在状态为" + tradem.tmStatusName + "的商标" };
}
}
var tmObj = {
orderNum: orderItem.orderNum
};
if (isConfirm == "0") {
tmObj["tmStatus"] = "CONFIRMFAIL";
if (obj.notes) {
tmObj["remarkInfo"] = obj.notes;
}
}
if (isConfirm == "1") {
tmObj["tmStatus"] = "WAITARTIFICIALEXAMINE";
}
await this.trademarkDao.model.update(tmObj, {
where: { orderNum: orderItem.orderNum }
});
return { code: 1 };
}
//--------------接收渠道订单数据---end-------------------------------app----------------------------
//--------------推送渠道订单数据---start-----------------------------app------------------------------
// async getToken(channelCode) {
// var self = this;
// var token = "";
// var channelApiUrl = this.channelApiUrl;
// if (channelCode) {
// channelApiUrl = settings.channelApiUrl(channelCode);
// }
// var reqTokenUrl = channelApiUrl + "/auth/accessAuth/getToken";
// try {
// var reqParam = {};
// reqParam = {
// "appkey":"201911131657",
// "secret":"eeb18393aade40149287b024d8ba0850"
// };
// if(channelCode=="jd"){
// reqParam = {
// "appkey":"201911251551",
// "secret":"56006077354d48858026c80c0e10bef6"
// };
// }
// var rtn = await this.execClient.execPost(reqParam, reqTokenUrl);
// if (!rtn.stdout) {
// return {status:-1, msg:"获取token失败"};
// }
// var tokenResult = JSON.parse(rtn.stdout);
// if (tokenResult.status == 0) {
// tokenResult.data.secret = reqParam.secret;
// }
// return tokenResult;
// } catch (e) {
// await this.oplogSve.createDb({
// logLevel:"error",
// optitle: "获取token---异常",
// op: reqTokenUrl,
// content: JSON.stringify(e.stack),
// clientIp: ""
// });
// return {status:-1, msg:"获取token失败"};
// }
// }
// //推送渠道商标状态修改信息
// async updateChannelTmStatus(obj) {
// try {
// var proxyCode = obj.proxyCode;
// var channelCode = obj.channelCode;
// var tmStatus = obj.tmStatus;
// var channelOrderNum = obj.channelOrderNum;
// if (!proxyCode) {
// return { code: -100, msg: "proxyCode参数错误" };
// }
// var judgeRes = this.dao.judgeChannelCode(channelCode);
// if (!judgeRes) {
// return { code: -101, msg: "channelCode参数错误" };
// }
// if (!tmStatus) {
// return { code: -102, msg: "tmStatus参数错误" };
// }
// if (!channelOrderNum) {
// return { code: -103, msg: "channelOrderNum参数错误" };
// }
// var token = await this.getToken(channelCode);
// if (!token || token.status != 0) {
// await this.oplogSve.createDb({
// logLevel: "error",
// optitle: "推送渠道辅助注册商标数据---获取token失败",
// op: "trademarkSve/updateChannelTmStatus",
// content: JSON.stringify(token),
// clientIp: ""
// });
// return { code: -104, msg: "获取token失败" };
// }
// var channelApiUrl = this.channelApiUrl;
// if (channelCode) {
// channelApiUrl = settings.channelApiUrl(channelCode);
// }
// var reqUrl = channelApiUrl + "/action/receiveData/springBoard";
// var reqObj = {
// "actionBody": obj,
// "actionType": "updateAssistTmStatus",
// "actionProcess": channelCode,
// };
// var rc = system.getObject("util.execClient");
// var rtn = await rc.execPostTK(reqObj, reqUrl, token.data.token);
// if (rtn.status == 0) {
// await this.oplogSve.createDb({
// logLevel: "info",
// optitle: channelCode + "商标状态修改---成功",
// op: reqUrl,
// content: JSON.stringify(reqObj),
// resultinfo: JSON.stringify(rtn),
// clientIp: ""
// });
// } else {
// await this.oplogSve.createDb({
// logLevel: "error",
// optitle: channelCode + "商标状态修改---失败",
// op: reqUrl,
// content: JSON.stringify(reqObj),
// resultinfo: JSON.stringify(rtn),
// clientIp: ""
// });
// return { code: -200 };
// }
// return { code: 1 };
// } catch (e) {
// await this.oplogSve.createDb({
// logLevel: "error",
// optitle: "渠道商标状态修改---异常",
// op: "trademarkSve/updateChannelTmStatus",
// content: JSON.stringify(e.stack),
// clientIp: ""
// });
// return { code: -400, msg: "操作失败", err: e.stack };
// }
// }
//推送渠道辅助注册商标数据
async pushChannelAssistTmData(orderNum, channelCode,channelorder) {
if (!channelCode) {
return { code: -200, msg: "渠道参数错误" };
}
if (!orderNum) {
return { code: -201, msg: "订单号参数错误" };
}
//获取订单信息
var order = await this.orderSve.dao.model.findOne({
where: { orderNum: orderNum },
raw: true
});
if (!order || !order.id) {
return { code: -202, msg: "未知订单" };
}
//获取订单所属人信息
var user = await this.orderSve.userDao.model.findOne({
where: { id: order.user_id },
raw: true
});
if (!user || !user.id) {
return { code: -206, msg: "未知用户" };
}
//获取商标信息
var tms = await this.orderSve.trademarkDao.model.findAll({
where: { orderNum: orderNum },
raw: true
});
if (!tms || tms.length < 1) {
return { code: -203, msg: "未知商标" };
}
//获取申请人信息
var applier = await this.orderSve.tmapplierinfoDao.model.findOne({
where: { orderNum: orderNum },
raw: true
});
if (!applier || !applier.id) {
return { code: -204, msg: "未知申请人" };
}
//获取联系人信息
var contacts = await this.orderSve.tmcustomerinfoDao.model.findOne({
where: { orderNum: orderNum },
raw: true
});
if (!contacts || !contacts.id) {
return { code: -205, msg: "未知联系人" };
}
var contactsObj = {
contactName: contacts.customerContact,
mobile: contacts.mobile,
email: contacts.email,
tel: contacts.tel,//座机
fax: contacts.fax//传真
};
var itemCode = order.itemCode;
var channelOrder = {
"channelServiceNo": "",
"channelOrderNo": "",
"needNo": "",
"payStatus": "yfk",
"deliveryOrderNo": order.channelOrderNum
};
var tm = tms[0];
channelOrder.channelServiceNo = tm.channelOrderNum;
channelOrder.channelOrderNo = tm.channelOrderListInfo;
channelOrder.needNo = tm.needId;
channelOrder.nclCount = tm.nclCount || 10;
var apply = {
"code": applier.creditCode,
"name": applier.applyName,
"smwjUrl": tm.descUrl,
"zipCode": contacts.zipCode,
"gzwtsUrl": tm.sealAuthorizeStuff,
"applyAddr": applier.applyAddr,
"applyArea": applier.applyArea,
"customerType": applier.type,
"identityCardNo": applier.identityCard,
"identityCardPic": applier.identityCardPic2,
"identityCardPdf": applier.identityCardPic,
"businessLicensePic": applier.businessLicensePic2,
"businessLicensePdf": applier.businessLicensePic
};
var tmObj = {
"colorizedPicUrl": tm.colorizedPicUrl,
"tmName": tm.tmName,
"picUrl": tm.picUrl,
"tmFormType": tm.tmFormType,
};
var nclones = [];
for (var i = 0; i < tms.length; i++) {
if (tms[i]) {
var nclthree = tms[i].nclSmallCodes;
nclthree = JSON.parse(nclthree);
var nclone = { code: tms[i].nclOneCodes, tbCode: tms[i].proxyCode, name: "", nclThree: nclthree,
nclCount:nclthree.length,
"tmStatus":tms[i].tmStatus,
"tmStatusName":tms[i].tmStatusName,
"submitTime":tms[i].created_at,
"tmRegistNum":"",
"deliveryType":"10",
"nclPublicExpense":tms[i].nclPublicExpense
};
nclones.push(nclone);
}
}
var reqObj = {
"serviceNo":order.channelOrderNum,
"sourceOrderNo":channelorder.idempotent_no || channelorder.needId || "",
"notes":order.remark,
"apply": apply,
"orderContact":contactsObj,
"tm": tmObj,
"nclones": nclones,
"channelCode":channelCode,
"channelOrder":channelOrder
};
await this.channelreceiveDao.pushChannelAssistTmData(reqObj);
return { code: 1 };
}
//推送渠道辅助注册商标修改数据
async pushEditChannelAssistTmData(orderNum, channelCode,channelorder) {
if (!channelCode) {
return { code: -200, msg: "渠道参数错误" };
}
if (!orderNum) {
return { code: -201, msg: "订单号参数错误" };
}
//获取订单信息
var order = await this.orderSve.dao.model.findOne({
where: { orderNum: orderNum },
raw: true
});
if (!order || !order.id) {
return { code: -202, msg: "未知订单" };
}
//获取订单所属人信息
var user = await this.orderSve.userDao.model.findOne({
where: { id: order.user_id },
raw: true
});
if (!user || !user.id) {
return { code: -206, msg: "未知用户" };
}
//获取商标信息
var tms = await this.orderSve.trademarkDao.model.findAll({
where: { orderNum: orderNum },
raw: true
});
if (!tms || tms.length < 1) {
return { code: -203, msg: "未知商标" };
}
//获取申请人信息
var applier = await this.orderSve.tmapplierinfoDao.model.findOne({
where: { orderNum: orderNum },
raw: true
});
if (!applier || !applier.id) {
return { code: -204, msg: "未知申请人" };
}
//获取联系人信息
var contacts = await this.orderSve.tmcustomerinfoDao.model.findOne({
where: { orderNum: orderNum },
raw: true
});
if (!contacts || !contacts.id) {
return { code: -205, msg: "未知联系人" };
}
var contactsObj = {
contactName: contacts.customerContact,
mobile: contacts.mobile,
email: contacts.email,
tel: contacts.tel,//座机
fax: contacts.fax//传真
};
var itemCode = order.itemCode;
var channelOrder = {
"channelServiceNo": "",
"channelOrderNo": "",
"needNo": "",
"deliveryOrderNo": order.channelOrderNum
};
var tm = tms[0];
channelOrder.channelServiceNo = tm.channelOrderNum;
channelOrder.channelOrderNo = tm.channelOrderListInfo;
channelOrder.needNo = tm.needId;
channelOrder.nclCount = tm.nclCount || 10;
var apply = {
"code": applier.creditCode,
"name": applier.applyName,
"smwjUrl": tm.descUrl,
"zipCode": contacts.zipCode,
"gzwtsUrl": tm.sealAuthorizeStuff,
"applyAddr": applier.applyAddr,
"applyArea": applier.applyArea,
"customerType": applier.type,
"identityCardNo": applier.identityCard,
"identityCardPic": applier.identityCardPic2,
"identityCardPdf": applier.identityCardPic,
"businessLicensePic": applier.businessLicensePic2,
"businessLicensePdf": applier.businessLicensePic
};
var tmObj = {
"colorizedPicUrl": tm.colorizedPicUrl,
"tmName": tm.tmName,
"picUrl": tm.picUrl,
"tmFormType": tm.tmFormType,
};
var nclones = [];
for (var i = 0; i < tms.length; i++) {
if (tms[i]) {
var nclthree = tms[i].nclSmallCodes;
nclthree = JSON.parse(nclthree);
var nclone = { code: tms[i].nclOneCodes, tbCode: tms[i].proxyCode, name: "", nclThree: nclthree,
nclCount:nclthree.length,
"tmStatus":tms[i].tmStatus,
"tmStatusName":tms[i].tmStatusName,
"submitTime":tms[i].created_at,
"tmRegistNum":tms[i].tmRegistNum || "",
"nclPublicExpense":tms[i].nclPublicExpense
};
nclones.push(nclone);
}
}
var reqObj = {
"serviceNo":order.channelOrderNum,
"sourceOrderNo":channelorder.idempotent_no || channelorder.needId || "",
"notes":order.remark,
"apply": apply,
"orderContact":contactsObj,
"tm": tmObj,
"nclones": nclones,
"channelCode":channelCode,
"channelOrder":channelOrder
};
await this.channelreceiveDao.pushEditChannelAssistTmData(reqObj);
return { code: 1 };
}
//--------------推送渠道订单数据---end-------------------------------------------------------------
//获取渠道订单信息
async getChannelOrderByChannelOrderNum(channelOrderNum,env) {
var reqUrl = "http://fq" + env + "-api.gongsibao.com/openapi/serviceOrder/getByServiceOrderNo";
if (channelOrderNum) {
try {
var data = {
"order_no": channelOrderNum
};
var rc = system.getObject("util.execClient");
var rtn = await rc.execPost(data, reqUrl);
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
return null;
}
} else {
return null;
}
}
}
module.exports = ChannelReceiveService;
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