Commit 1aec3b5e by 庄冰

channel

parent 072c7bb3
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
/**
* 接收远程推送的商标数据api
*/
class ReceiveDataAPI extends APIBase {
constructor() {
super();
this.opPlatformUtils = system.getObject("util.businessManager.opPlatformUtils");
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
this.customerinfoSve = system.getObject("service.dborder.customerinfoSve");
this.customercontactsSve = system.getObject("service.dborder.customercontactsSve");
this.trademarkSve = system.getObject("service.dbtrademark.trademarkSve");
this.zcApiUrl = settings.reqZcApi();
this.pushFqbossDataUrl = settings.pushFqbossDataUrl();
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = null;
switch (pobj.actionProcess) {
case "jd"://京东
result = await this.opActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody, pobj, req);
break;
case "1688"://1688
result = await this.opActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody, pobj, req);
break;
default:
result = system.getResult(null, "actionProcess参数错误");
break;
}
return result;
}
async opActionProcess(action_process, action_type, action_body, pobj, req) {
// action_body.app = req.app;
// action_body.user = req.user;
action_body.app = { id: 1, appPayType: "00", appDataOpType: "00" };
action_body.user = { id: 1, app_id: 1, nickname: "测试用户",channelUserId:"channelUserIdtest01" };
var opResult = null;
switch (action_type) {
// sy
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "receiveTmData"://接收商标状态信息
opResult = await this.trademarkSve.receiveTmData(action_body);
break;
case "assistRegTmData"://接收辅助注册商标数据
opResult = await this.ordertmproductSve.addAssistTm(action_body);
break;
case "assistEditTmData"://接收辅助注册修改商标数据
opResult = system.getResultSuccess(null, "测试成功");
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = ReceiveDataAPI;
\ No newline at end of file
......@@ -6,6 +6,7 @@ class TradeMarkService extends ServiceBase {
constructor() {
super("dbtrademark", ServiceBase.getDaoName(TradeMarkService));
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
this.tmofficialDao = system.getObject("db.dbtrademark.tmofficialDao");
}
/**
......@@ -165,5 +166,93 @@ class TradeMarkService extends ServiceBase {
return system.getResultSuccess();
})
}
/**
* 接收商标状态数据
* @param {*} obj
* obj.tbCode 商标提报号,
* obj.deliveryOrderNo 交付订单号,
* obj.officialType 商标状态类型officialType,
* 1: 商标注册申请书, 2: 商标注册申请补正通知书, 3: 商标注册申请受理通知书, 4: 商标注册申请不予受理通知书,
5: 商标注册同日申请补送使用证据通知书,6: 商标注册同日申请协商通知书商标注册同日申请抽签通知书,
7: 商标驳回通知书, 8: 商标部分驳回通知书, 9: 商标注册申请初步审定公告通知书,
10: 商标异议答辩通知书, 11: 异议裁定书, 12: 纸质版商标注册证, 13: 电子版商标注册证
"dsccl": "待上传材料", "dsh": "待审核", "shbtg": "审核不通过", "ddj": "待递交",
"ydj": "已递交", "djyc": "递交异常" ,
* obj.tmRegistNum 商标注册号,
* obj.officialFileName 官文文件名称 ,
* obj.officialFileUrl 官文文件地址 ,
* obj.submitTime 提报时间,
* obj.user 用户数据
*/
async receiveTmData(obj){
return system.getResultFail(-100, "接口开发中");
var user = obj.user;
var app = obj.app;
var self = this;
if(!user || !user.id){
return system.getResultFail(-100, "未知用户");
}
var deliveryOrderNo = obj.deliveryOrderNo;
if(!deliveryOrderNo){
return system.getResultFail(-101, "deliveryOrderNo参数错误");
}
// 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo},
raw:true
});
if(!ordertmproduct || !ordertmproduct.id){
return system.getResultFail(-102, "商标交付单不存在");
}
if(!app){
return system.getResultFail(-103, "未知应用");
}
var tbCode = obj.tbCode;
if(!tbCode){
return system.getResultFail(-104, "tbCode参数错误");
}
//获取商标尼斯信息
var tm = await this.dao.model.findOne({
where:{tbCode:tbCode,deliveryOrderNo:deliveryOrderNo},
raw:true
});
if(!tm || !tm.id){
return system.getResultFail(-105, "尼斯信息不存在");
}
return await self.db.transaction(async function (t) {
var tmObj={
id:tm.id,
updateuser_id:user.id,
updateuser:user.nickname
};
var officialObj={
app_id:applicationCache.id,createuser_id:user.id
};
if(obj.officialType){
tmObj["officialType"]=obj.officialType;
officialObj["officialObj"] = obj.officialType;
}
if(obj.submitTime){
tmObj["submitTime"]=obj.submitTime;
}
if(obj.tmRegistNum){
officialObj["tmRegistNum"] = obj.tmRegistNum;
tmObj["tmRegistNum"]=obj.tmRegistNum;
}
await self.dao.update(tmObj,t);//修改商标状态信息
if(officialObj["tmRegistNum"] && officialObj["officialType"]){
if(obj.officialFileName){
officialObj["officialFileName"] = obj.officialFileName;
}
if(obj.officialFileUrl){
officialObj["officialFileUrl"] = obj.officialFileUrl;
}
var code = await self.getBusUid("tmoff");
officialObj["code"]=code;
await this.tmofficialDao.create(officialObj,t);
}
return system.getResultSuccess();
})
}
}
module.exports=TradeMarkService;
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