Commit e0646743 by 庄冰

gsbh5

parent fb7aa8a9
...@@ -13,6 +13,7 @@ class ChannelPushApi{ ...@@ -13,6 +13,7 @@ class ChannelPushApi{
constructor(){ constructor(){
this.orderSve=System.getObject("service.orderSve"); this.orderSve=System.getObject("service.orderSve");
this.tmflowSve = System.getObject("service.tmflowSve"); this.tmflowSve = System.getObject("service.tmflowSve");
this.channelreceiveSve = System.getObject("service.channelreceiveSve");
// this.userSve=System.getObject("service.userSve"); // this.userSve=System.getObject("service.userSve");
// this.appSve=System.getObject("service.appSve"); // this.appSve=System.getObject("service.appSve");
// this.channelSve=System.getObject("service.channelSve"); // this.channelSve=System.getObject("service.channelSve");
...@@ -314,9 +315,34 @@ class ChannelPushApi{ ...@@ -314,9 +315,34 @@ class ChannelPushApi{
// officialType:"1", // officialType:"1",
// tmRegistNum:"111111", // tmRegistNum:"111111",
// officialFileName:"商标注册申请书", // officialFileName:"商标注册申请书",
// officialFileUrl:"http://www.baidu.com", // officialFileUrl:"http://www.baidu.com", pushChannelAssistTmData
// }; // };pushEditChannelAssistTmData
// return this.tmflowSve.pushTmOfficialData(pushObj); // 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; module.exports=ChannelPushApi;
\ No newline at end of file
...@@ -204,5 +204,40 @@ class ChannelReceiveApi { ...@@ -204,5 +204,40 @@ class ChannelReceiveApi {
return { code: -200, msg: "操作失败", err: e.stack }; 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; module.exports = ChannelReceiveApi;
\ No newline at end of file
...@@ -8,10 +8,6 @@ class ChannelReceiveDao { ...@@ -8,10 +8,6 @@ class ChannelReceiveDao {
//推送渠道商标状态修改信息(同步商标注册号|商标状态|推送商标回执) //推送渠道商标状态修改信息(同步商标注册号|商标状态|推送商标回执)
async updateChannelTmStatus(obj) { async updateChannelTmStatus(obj) {
try { try {
// var tbCode = obj.tbCode;
// if (!tbCode) {
// return { code: -100, msg: "tbCode参数错误" };
// }
var channelApiUrl = this.channelApiUrl; var channelApiUrl = this.channelApiUrl;
channelApiUrl = settings.channelApiUrl("gsbh5"); channelApiUrl = settings.channelApiUrl("gsbh5");
var reqUrl = channelApiUrl + "/notifyaction/internalCallsNotify/updateTmStatus"; var reqUrl = channelApiUrl + "/notifyaction/internalCallsNotify/updateTmStatus";
...@@ -21,14 +17,13 @@ class ChannelReceiveDao { ...@@ -21,14 +17,13 @@ class ChannelReceiveDao {
if(rtn && rtn.stdout){ if(rtn && rtn.stdout){
rtn = JSON.parse(rtn.stdout); rtn = JSON.parse(rtn.stdout);
} }
console.log(rtn,"11111111111111111111111111111");
if (rtn.status == 0) { if (rtn.status == 0) {
await this.oplogSve.createDb({ await this.oplogSve.createDb({
logLevel: "info", logLevel: "info",
optitle: "gsbh5商标状态修改---成功", optitle: "gsbh5商标状态修改---成功",
op: reqUrl, op: reqUrl,
content: JSON.stringify(obj), content: JSON.stringify(obj),
result: JSON.stringify(rtn), resultinfo: JSON.stringify(rtn),
clientIp: "" clientIp: ""
}); });
} else { } else {
...@@ -37,7 +32,7 @@ class ChannelReceiveDao { ...@@ -37,7 +32,7 @@ class ChannelReceiveDao {
optitle: "gsbh5商标状态修改---失败", optitle: "gsbh5商标状态修改---失败",
op: reqUrl, op: reqUrl,
content: JSON.stringify(obj), content: JSON.stringify(obj),
result: JSON.stringify(rtn), resultinfo: JSON.stringify(rtn),
clientIp: "" clientIp: ""
}); });
return { code: -200 }; return { code: -200 };
...@@ -48,14 +43,106 @@ class ChannelReceiveDao { ...@@ -48,14 +43,106 @@ class ChannelReceiveDao {
await this.oplogSve.createDb({ await this.oplogSve.createDb({
logLevel: "error", logLevel: "error",
optitle: "渠道商标状态修改---异常", 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), content: JSON.stringify(e.stack),
clientIp: "" clientIp: ""
}); });
return { code: -400, msg: "操作失败", err: e.stack }; return { code: -400, msg: "操作失败", err: e.stack };
} }
} }
} }
module.exports=ChannelReceiveDao; module.exports=ChannelReceiveDao;
// var task = new ChannelReceiveDao(); // var task = new ChannelReceiveDao();
......
...@@ -6,6 +6,7 @@ class ChannelReceiveService { ...@@ -6,6 +6,7 @@ class ChannelReceiveService {
constructor() { constructor() {
this.orderSve = system.getObject("service.orderSve"); this.orderSve = system.getObject("service.orderSve");
this.channelApiUrl = settings.channelApiUrl(); this.channelApiUrl = settings.channelApiUrl();
this.channelreceiveDao = system.getObject("db.channelreceiveDao");
} }
//--------------接收渠道订单数据---start------------------------------------------------------------- //--------------接收渠道订单数据---start-------------------------------------------------------------
//商标自动提报(渠道) //商标自动提报(渠道)
...@@ -449,125 +450,314 @@ class ChannelReceiveService { ...@@ -449,125 +450,314 @@ class ChannelReceiveService {
return { code: 1 }; 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---------------------------- //--------------接收渠道订单数据---end-------------------------------app----------------------------
//--------------推送渠道订单数据---start-----------------------------app------------------------------ //--------------推送渠道订单数据---start-----------------------------app------------------------------
// async getToken(channelCode) { //推送渠道辅助注册商标数据
// var self = this; async pushChannelAssistTmData(orderNum, channelCode,channelorder) {
// var token = ""; if (!channelCode) {
// var channelApiUrl = this.channelApiUrl; return { code: -200, msg: "渠道参数错误" };
// if (channelCode) { }
// channelApiUrl = settings.channelApiUrl(channelCode); if (!orderNum) {
// } return { code: -201, msg: "订单号参数错误" };
// var reqTokenUrl = channelApiUrl + "/auth/accessAuth/getToken"; }
// try { //获取订单信息
// var reqParam = {}; var order = await this.orderSve.dao.model.findOne({
// reqParam = { where: { orderNum: orderNum },
// "appkey":"201911131657", raw: true
// "secret":"eeb18393aade40149287b024d8ba0850" });
// }; if (!order || !order.id) {
// if(channelCode=="jd"){ return { code: -202, msg: "未知订单" };
// reqParam = { }
// "appkey":"201911251551", //获取订单所属人信息
// "secret":"56006077354d48858026c80c0e10bef6" var user = await this.orderSve.userDao.model.findOne({
// }; where: { id: order.user_id },
// } raw: true
// var rtn = await this.execClient.execPost(reqParam, reqTokenUrl); });
// if (!rtn.stdout) { if (!user || !user.id) {
// return {status:-1, msg:"获取token失败"}; return { code: -206, msg: "未知用户" };
// } }
// var tokenResult = JSON.parse(rtn.stdout); //获取商标信息
// if (tokenResult.status == 0) { var tms = await this.orderSve.trademarkDao.model.findAll({
// tokenResult.data.secret = reqParam.secret; where: { orderNum: orderNum },
// } raw: true
// return tokenResult; });
// } catch (e) { if (!tms || tms.length < 1) {
// await this.oplogSve.createDb({ return { code: -203, msg: "未知商标" };
// logLevel:"error", }
// optitle: "获取token---异常", //获取申请人信息
// op: reqTokenUrl, var applier = await this.orderSve.tmapplierinfoDao.model.findOne({
// content: JSON.stringify(e.stack), where: { orderNum: orderNum },
// clientIp: "" raw: true
// }); });
// return {status:-1, msg:"获取token失败"}; if (!applier || !applier.id) {
// } return { code: -204, msg: "未知申请人" };
}
// } //获取联系人信息
// //推送渠道商标状态修改信息 var contacts = await this.orderSve.tmcustomerinfoDao.model.findOne({
// async updateChannelTmStatus(obj) { where: { orderNum: orderNum },
// try { raw: true
// var proxyCode = obj.proxyCode; });
// var channelCode = obj.channelCode; if (!contacts || !contacts.id) {
// var tmStatus = obj.tmStatus; return { code: -205, msg: "未知联系人" };
// var channelOrderNum = obj.channelOrderNum; }
// if (!proxyCode) { var contactsObj = {
// return { code: -100, msg: "proxyCode参数错误" }; contactName: contacts.customerContact,
// } mobile: contacts.mobile,
// var judgeRes = this.dao.judgeChannelCode(channelCode); email: contacts.email,
// if (!judgeRes) { tel: contacts.tel,//座机
// return { code: -101, msg: "channelCode参数错误" }; fax: contacts.fax//传真
// } };
// if (!tmStatus) { var itemCode = order.itemCode;
// return { code: -102, msg: "tmStatus参数错误" }; var channelOrder = {
// } "channelServiceNo": "",
// if (!channelOrderNum) { "channelOrderNo": "",
// return { code: -103, msg: "channelOrderNum参数错误" }; "needNo": "",
// } "payStatus": "yfk",
// var token = await this.getToken(channelCode); "deliveryOrderNo": order.channelOrderNum
// if (!token || token.status != 0) { };
// await this.oplogSve.createDb({ var tm = tms[0];
// logLevel: "error", channelOrder.channelServiceNo = tm.channelOrderNum;
// optitle: "推送渠道辅助注册商标数据---获取token失败", channelOrder.channelOrderNo = tm.channelOrderListInfo;
// op: "trademarkSve/updateChannelTmStatus", channelOrder.needNo = tm.needId;
// content: JSON.stringify(token), channelOrder.nclCount = tm.nclCount || 10;
// clientIp: "" var apply = {
// }); "code": applier.creditCode,
// return { code: -104, msg: "获取token失败" }; "name": applier.applyName,
// } "smwjUrl": tm.descUrl,
// var channelApiUrl = this.channelApiUrl; "zipCode": contacts.zipCode,
// if (channelCode) { "gzwtsUrl": tm.sealAuthorizeStuff,
// channelApiUrl = settings.channelApiUrl(channelCode); "applyAddr": applier.applyAddr,
// } "applyArea": applier.applyArea,
// var reqUrl = channelApiUrl + "/action/receiveData/springBoard"; "customerType": applier.type,
// var reqObj = { "identityCardNo": applier.identityCard,
// "actionBody": obj, "identityCardPic": applier.identityCardPic2,
// "actionType": "updateAssistTmStatus", "identityCardPdf": applier.identityCardPic,
// "actionProcess": channelCode, "businessLicensePic": applier.businessLicensePic2,
// }; "businessLicensePdf": applier.businessLicensePic
// var rc = system.getObject("util.execClient"); };
// var rtn = await rc.execPostTK(reqObj, reqUrl, token.data.token); var tmObj = {
// if (rtn.status == 0) { "colorizedPicUrl": tm.colorizedPicUrl,
// await this.oplogSve.createDb({ "tmName": tm.tmName,
// logLevel: "info", "picUrl": tm.picUrl,
// optitle: channelCode + "商标状态修改---成功", "tmFormType": tm.tmFormType,
// op: reqUrl, };
// content: JSON.stringify(reqObj), var nclones = [];
// resultinfo: JSON.stringify(rtn), for (var i = 0; i < tms.length; i++) {
// clientIp: "" if (tms[i]) {
// }); var nclthree = tms[i].nclSmallCodes;
// } else { nclthree = JSON.parse(nclthree);
// await this.oplogSve.createDb({ var nclone = { code: tms[i].nclOneCodes, tbCode: tms[i].proxyCode, name: "", nclThree: nclthree,
// logLevel: "error", nclCount:nclthree.length,
// optitle: channelCode + "商标状态修改---失败", "tmStatus":tms[i].tmStatus,
// op: reqUrl, "tmStatusName":tms[i].tmStatusName,
// content: JSON.stringify(reqObj), "submitTime":tms[i].created_at,
// resultinfo: JSON.stringify(rtn), "tmRegistNum":"",
// clientIp: "" "deliveryType":"10",
// }); "nclPublicExpense":tms[i].nclPublicExpense
// return { code: -200 }; };
// } nclones.push(nclone);
// return { code: 1 }; }
// } catch (e) { }
// await this.oplogSve.createDb({ var reqObj = {
// logLevel: "error", "serviceNo":order.channelOrderNum,
// optitle: "渠道商标状态修改---异常", "sourceOrderNo":channelorder.idempotent_no || channelorder.needId || "",
// op: "trademarkSve/updateChannelTmStatus", "notes":order.remark,
// content: JSON.stringify(e.stack), "apply": apply,
// clientIp: "" "orderContact":contactsObj,
// }); "tm": tmObj,
// return { code: -400, msg: "操作失败", err: e.stack }; "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------------------------------------------------------------- //--------------推送渠道订单数据---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; 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