Commit e410a123 by 宋毅

tj

parent f7d07c40
...@@ -490,7 +490,7 @@ class OrderService extends ServiceBase { ...@@ -490,7 +490,7 @@ class OrderService extends ServiceBase {
return system.getResult(null, "订单已经推送过,请勿重覆推送"); return system.getResult(null, "订单已经推送过,请勿重覆推送");
} }
var rtn = null; var rtn = null;
var reqUrl = "https://yunfuapi.gongsibao.com/crm/order/submit"; var reqUrl = "https://yunfuapi-dev.gongsibao.com/crm/order/submit";
try { try {
var body = { var body = {
idempotentId: item.channelServiceNo,// 是 业务 ID idempotentId: item.channelServiceNo,// 是 业务 ID
......
const system = require("../../../system"); const system = require("../../../system");
const ServiceBase = require("../../sve.base"); const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
class TradeMarkService extends ServiceBase { class TradeMarkService extends ServiceBase {
constructor() { constructor() {
super("dbtrademark", ServiceBase.getDaoName(TradeMarkService)); super("dbtrademark", ServiceBase.getDaoName(TradeMarkService));
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve"); this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
this.tmofficialDao = system.getObject("db.dbtrademark.tmofficialDao"); this.tmofficialDao = system.getObject("db.dbtrademark.tmofficialDao");
this.statusConvertJSON={ this.statusConvertJSON = {
"WAITARTIFICIALEXAMINE": "dsh", "WAITARTIFICIALEXAMINE": "dsh",
"1": "1", "1": "1",
"2": "2", "2": "2",
...@@ -32,8 +32,8 @@ class TradeMarkService extends ServiceBase { ...@@ -32,8 +32,8 @@ class TradeMarkService extends ServiceBase {
"RECVCOMMIT": "ydj", "RECVCOMMIT": "ydj",
"FILLEXCEPTION": "shbtg", "FILLEXCEPTION": "shbtg",
//1688 //1688
"WAITCONFIRM":"dqrfa", "WAITCONFIRM": "dqrfa",
"CONFIRMFAIL":"dqrfa" "CONFIRMFAIL": "dqrfa"
} }
} }
...@@ -48,55 +48,55 @@ class TradeMarkService extends ServiceBase { ...@@ -48,55 +48,55 @@ class TradeMarkService extends ServiceBase {
* obj.colorizedPicUrl 商标彩色图样, * obj.colorizedPicUrl 商标彩色图样,
* obj.user 用户数据 * obj.user 用户数据
*/ */
async updateTmInfo(obj){ async updateTmInfo(obj) {
var user = obj.user; var user = obj.user;
if(!user || !user.id){ if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if(!deliveryOrderNo){ if (!deliveryOrderNo) {
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo}, where: { deliveryOrderNo: deliveryOrderNo },
raw:true raw: true
}); });
if(!ordertmproduct || !ordertmproduct.id){ if (!ordertmproduct || !ordertmproduct.id) {
return system.getResultFail(-102, "商标交付单不存在"); return system.getResultFail(-102, "商标交付单不存在");
} }
// 2.获取交付单状态,判断是否可修改 // 2.获取交付单状态,判断是否可修改
if(ordertmproduct.deliveryStatus=='ddj' || ordertmproduct.deliveryStatus=='ywc'){ if (ordertmproduct.deliveryStatus == 'ddj' || ordertmproduct.deliveryStatus == 'ywc') {
var deliveryStatusName = "待递交"; var deliveryStatusName = "待递交";
if(ordertmproduct.deliveryStatus=='ywc'){ if (ordertmproduct.deliveryStatus == 'ywc') {
deliveryStatusName="已完成"; deliveryStatusName = "已完成";
} }
return system.getResultFail(-103, "该商标交付单状态为"+deliveryStatusName+",不能进行修改"); return system.getResultFail(-103, "该商标交付单状态为" + deliveryStatusName + ",不能进行修改");
} }
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var otpObj={ var otpObj = {
id:ordertmproduct.id, id: ordertmproduct.id,
deliveryOrderNo:deliveryOrderNo, deliveryOrderNo: deliveryOrderNo,
updateuser_id:user.id, updateuser_id: user.id,
updateuser:user.nickname updateuser: user.nickname
}; };
if(obj.picUrl){//商标图样 黑白 if (obj.picUrl) {//商标图样 黑白
otpObj["picUrl"]=obj.picUrl; otpObj["picUrl"] = obj.picUrl;
} }
if(obj.colorizedPicUrl){//彩色商标图样 if (obj.colorizedPicUrl) {//彩色商标图样
otpObj["colorizedPicUrl"]=obj.colorizedPicUrl; otpObj["colorizedPicUrl"] = obj.colorizedPicUrl;
} }
if(obj.tmName){//商标名称 if (obj.tmName) {//商标名称
otpObj["tmName"]=obj.tmName; otpObj["tmName"] = obj.tmName;
} }
if(obj.tmFormType){//商标类型 if (obj.tmFormType) {//商标类型
otpObj["tmFormType"]=obj.tmFormType; otpObj["tmFormType"] = obj.tmFormType;
} }
if(obj.notes){//商标说明 if (obj.notes) {//商标说明
otpObj["notes"]=obj.notes; otpObj["notes"] = obj.notes;
} }
await self.ordertmproductSve.dao.update(otpObj,t);//商标交付单 修改商标图样 await self.ordertmproductSve.dao.update(otpObj, t);//商标交付单 修改商标图样
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
...@@ -110,87 +110,87 @@ class TradeMarkService extends ServiceBase { ...@@ -110,87 +110,87 @@ class TradeMarkService extends ServiceBase {
* obj.nclSmallCodes 商标尼斯小类数组 * obj.nclSmallCodes 商标尼斯小类数组
* obj.user 用户数据 * obj.user 用户数据
*/ */
async updateNclInfo(obj){ async updateNclInfo(obj) {
var user = obj.user; var user = obj.user;
var self = this; var self = this;
if(!user || !user.id){ if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if(!deliveryOrderNo){ if (!deliveryOrderNo) {
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo}, where: { deliveryOrderNo: deliveryOrderNo },
raw:true raw: true
}); });
if(!ordertmproduct || !ordertmproduct.id){ if (!ordertmproduct || !ordertmproduct.id) {
return system.getResultFail(-102, "商标交付单不存在"); return system.getResultFail(-102, "商标交付单不存在");
} }
// 2.获取交付单状态,判断是否可修改 // 2.获取交付单状态,判断是否可修改
if(ordertmproduct.deliveryStatus=='ddj' || ordertmproduct.deliveryStatus=='ywc'){ if (ordertmproduct.deliveryStatus == 'ddj' || ordertmproduct.deliveryStatus == 'ywc') {
var deliveryStatusName = "待递交"; var deliveryStatusName = "待递交";
if(ordertmproduct.deliveryStatus=='ywc'){ if (ordertmproduct.deliveryStatus == 'ywc') {
deliveryStatusName="已完成"; deliveryStatusName = "已完成";
} }
return system.getResultFail(-103, "该商标交付单状态为"+deliveryStatusName+",不能进行修改"); return system.getResultFail(-103, "该商标交付单状态为" + deliveryStatusName + ",不能进行修改");
} }
var tbCode = obj.tbCode; var tbCode = obj.tbCode;
if(!tbCode){ if (!tbCode) {
return system.getResultFail(-104, "tbCode参数错误"); return system.getResultFail(-104, "tbCode参数错误");
} }
//获取商标尼斯信息 //获取商标尼斯信息
var tm = await this.dao.model.findOne({ var tm = await this.dao.model.findOne({
where:{tbCode:tbCode}, where: { tbCode: tbCode },
raw:true raw: true
}); });
if(!tm || !tm.id){ if (!tm || !tm.id) {
return system.getResultFail(-105, "尼斯信息不存在"); return system.getResultFail(-105, "尼斯信息不存在");
} }
//获取交付单下其它商标尼斯信息 //获取交付单下其它商标尼斯信息
var othertm = await this.dao.model.findAll({ var othertm = await this.dao.model.findAll({
where:{ where: {
deliveryOrderNo:deliveryOrderNo, deliveryOrderNo: deliveryOrderNo,
tbCode: { [self.db.Op.ne]: tbCode } tbCode: { [self.db.Op.ne]: tbCode }
}, },
raw:true raw: true
}); });
if(!obj.nclOneCodes){ if (!obj.nclOneCodes) {
return system.getResultFail(-106, "nclOneCodes参数错误"); return system.getResultFail(-106, "nclOneCodes参数错误");
} }
if(!obj.nclSmallCodes || obj.nclSmallCodes.length<1){ if (!obj.nclSmallCodes || obj.nclSmallCodes.length < 1) {
return system.getResultFail(-107, "nclSmallCodes参数错误"); return system.getResultFail(-107, "nclSmallCodes参数错误");
} }
if(obj.nclSmallCodes.length>10){ if (obj.nclSmallCodes.length > 10) {
return system.getResultFail(-108, "尼斯小类不能超过10项"); return system.getResultFail(-108, "尼斯小类不能超过10项");
} }
var nclOneCodes2 = obj.nclOneCodes; var nclOneCodes2 = obj.nclOneCodes;
for(var i=0;i<othertm.length;i++){//判断重复大类 for (var i = 0; i < othertm.length; i++) {//判断重复大类
var other = othertm[i]; var other = othertm[i];
if(other.nclOneCodes==obj.nclOneCodes){ if (other.nclOneCodes == obj.nclOneCodes) {
return system.getResultFail(-109, "该商标存在重复的尼斯大类"); return system.getResultFail(-109, "该商标存在重复的尼斯大类");
}else{ } else {
nclOneCodes2=nclOneCodes2+","+other.nclOneCodes; nclOneCodes2 = nclOneCodes2 + "," + other.nclOneCodes;
} }
} }
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var tmObj={ var tmObj = {
id:tm.id, id: tm.id,
nclOneCodes:obj.nclOneCodes, nclOneCodes: obj.nclOneCodes,
nclSmallCodes: JSON.stringify(obj.nclSmallCodes), nclSmallCodes: JSON.stringify(obj.nclSmallCodes),
updateuser_id:user.id, updateuser_id: user.id,
updateuser:user.nickname updateuser: user.nickname
}; };
await self.dao.update(tmObj,t);//修改商标尼斯信息 await self.dao.update(tmObj, t);//修改商标尼斯信息
var otpObj={ var otpObj = {
id:ordertmproduct.id, id: ordertmproduct.id,
nclOneCodes:nclOneCodes2, nclOneCodes: nclOneCodes2,
updateuser_id:user.id, updateuser_id: user.id,
updateuser:user.nickname updateuser: user.nickname
}; };
await self.ordertmproductSve.dao.update(otpObj,t);//商标交付单 修改大类列表 await self.ordertmproductSve.dao.update(otpObj, t);//商标交付单 修改大类列表
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
...@@ -210,7 +210,7 @@ class TradeMarkService extends ServiceBase { ...@@ -210,7 +210,7 @@ class TradeMarkService extends ServiceBase {
* obj.officialFileName 官文文件名称 , * obj.officialFileName 官文文件名称 ,
* obj.officialFileUrl 官文文件地址 , * obj.officialFileUrl 官文文件地址 ,
*/ */
async receiveTmOfficialData(obj){ async receiveTmOfficialData(obj) {
// return system.getResultFail(-100, "接口开发中"); // return system.getResultFail(-100, "接口开发中");
// var user = obj.user; // var user = obj.user;
// var app = obj.app; // var app = obj.app;
...@@ -219,60 +219,60 @@ class TradeMarkService extends ServiceBase { ...@@ -219,60 +219,60 @@ class TradeMarkService extends ServiceBase {
// return system.getResultFail(-100, "未知用户"); // return system.getResultFail(-100, "未知用户");
// } // }
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if(!deliveryOrderNo){ if (!deliveryOrderNo) {
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo}, where: { deliveryOrderNo: deliveryOrderNo },
raw:true raw: true
}); });
if(!ordertmproduct || !ordertmproduct.id){ if (!ordertmproduct || !ordertmproduct.id) {
return system.getResultFail(-102, "商标交付单不存在"); return system.getResultFail(-102, "商标交付单不存在");
} }
// if(!app){ // if(!app){
// return system.getResultFail(-103, "未知应用"); // return system.getResultFail(-103, "未知应用");
// } // }
var tbCode = obj.tbCode; var tbCode = obj.tbCode;
if(!tbCode){ if (!tbCode) {
return system.getResultFail(-104, "tbCode参数错误"); return system.getResultFail(-104, "tbCode参数错误");
} }
//获取商标尼斯信息 //获取商标尼斯信息
var tm = await this.dao.model.findOne({ var tm = await this.dao.model.findOne({
where:{tbCode:tbCode,deliveryOrderNo:deliveryOrderNo}, where: { tbCode: tbCode, deliveryOrderNo: deliveryOrderNo },
raw:true raw: true
}); });
if(!tm || !tm.id){ if (!tm || !tm.id) {
return system.getResultFail(-105, "尼斯信息不存在"); return system.getResultFail(-105, "尼斯信息不存在");
} }
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var tmObj={ var tmObj = {
id:tm.id id: tm.id
}; };
var officialObj={ var officialObj = {
app_id:ordertmproduct.app_id app_id: ordertmproduct.app_id
}; };
if(obj.officialType){ if (obj.officialType) {
if(self.statusConvertJSON[obj.officialType]){ if (self.statusConvertJSON[obj.officialType]) {
tmObj["officialType"]=self.statusConvertJSON[obj.officialType]; tmObj["officialType"] = self.statusConvertJSON[obj.officialType];
officialObj["officialType"] = self.statusConvertJSON[obj.officialType]; officialObj["officialType"] = self.statusConvertJSON[obj.officialType];
} }
} }
if(obj.tmRegistNum){ if (obj.tmRegistNum) {
officialObj["tmRegistNum"] = obj.tmRegistNum; officialObj["tmRegistNum"] = obj.tmRegistNum;
tmObj["tmRegistNum"]=obj.tmRegistNum; tmObj["tmRegistNum"] = obj.tmRegistNum;
} }
await self.dao.update(tmObj,t);//修改商标状态信息 await self.dao.update(tmObj, t);//修改商标状态信息
if(officialObj["tmRegistNum"] && officialObj["officialType"]){ if (officialObj["tmRegistNum"] && officialObj["officialType"]) {
if(obj.officialFileName){ if (obj.officialFileName) {
officialObj["officialFileName"] = obj.officialFileName; officialObj["officialFileName"] = obj.officialFileName;
} }
if(obj.officialFileUrl){ if (obj.officialFileUrl) {
officialObj["officialFileUrl"] = obj.officialFileUrl; officialObj["officialFileUrl"] = obj.officialFileUrl;
} }
var code = await self.getBusUid("tmoff"); var code = await self.getBusUid("tmoff");
officialObj["code"]=code; officialObj["code"] = code;
await self.tmofficialDao.create(officialObj,t); await self.tmofficialDao.create(officialObj, t);
} }
return system.getResultSuccess(); return system.getResultSuccess();
}) })
...@@ -281,54 +281,63 @@ class TradeMarkService extends ServiceBase { ...@@ -281,54 +281,63 @@ class TradeMarkService extends ServiceBase {
* 辅助商标状态修改 * 辅助商标状态修改
* @param {*} obj * @param {*} obj
*/ */
async updateAssistTmStatus(obj){ async updateAssistTmStatus(obj) {
var self = this; var self = this;
var deliveryOrderNo = obj.channelOrderNum; var deliveryOrderNo = obj.channelOrderNum;
if(!deliveryOrderNo){ if (!deliveryOrderNo) {
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo}, where: { deliveryOrderNo: deliveryOrderNo },
raw:true raw: true
}); });
if(!ordertmproduct || !ordertmproduct.id){ if (!ordertmproduct || !ordertmproduct.id) {
return system.getResultFail(-102, "商标交付单不存在"); return system.getResultFail(-102, "商标交付单不存在");
} }
var tbCode = obj.proxyCode; var tbCode = obj.proxyCode;
if(!tbCode){ if (!tbCode) {
return system.getResultFail(-104, "tbCode参数错误"); return system.getResultFail(-104, "tbCode参数错误");
} }
//获取商标尼斯信息 //获取商标尼斯信息
var tm = await this.dao.model.findOne({ var tm = await this.dao.model.findOne({
where:{tbCode:tbCode,deliveryOrderNo:deliveryOrderNo}, where: { tbCode: tbCode, deliveryOrderNo: deliveryOrderNo },
raw:true raw: true
}); });
if(!tm || !tm.id){ if (!tm || !tm.id) {
return system.getResultFail(-105, "商标信息不存在"); return system.getResultFail(-105, "商标信息不存在");
} }
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var tmObj={id:tm.id}; var tmObj = { id: tm.id };
var otp = {id:ordertmproduct.id}; var otp = { id: ordertmproduct.id };
if(obj.tmStatus){ if (obj.tmStatus) {
if(self.statusConvertJSON[obj.tmStatus]){ if (self.statusConvertJSON[obj.tmStatus]) {
tmObj["officialType"]=self.statusConvertJSON[obj.tmStatus]; tmObj["officialType"] = self.statusConvertJSON[obj.tmStatus];
} }
if(tmObj.officialType && ",dqrfa,dsccl,dsh,ddj,ydj,ywc,".indexOf(tmObj.officialType)>=0){ if (tmObj.officialType && ",dqrfa,dsccl,dsh,ddj,ydj,ywc,".indexOf(tmObj.officialType) >= 0) {
otp["deliveryStatus"]=tmObj.officialType; otp["deliveryStatus"] = tmObj.officialType;
await self.ordertmproductSve.update(otp,t); await self.ordertmproductSve.update(otp, t);
var deliveryStatusName = uiconfig.config.pdict.official_type[tmObj.officialType];
var flowObj = {
app_id: ordertmproduct.app_id,
createuser_id: ordertmproduct.createuser_id,
sourceOrderNo: deliveryOrderNo,
opContent: "交付状态更新为【" + deliveryStatusName + "】" + obj.opNotes
};
await self.orderflowDao.create(flowObj, t);//创建订单流程
} }
// {"dqrfa":"待确认方案", "dsccl": "待上传材料", "dsh": "待审核", "ddj": "待递交", "ydj": "已递交", "ywc": "已完成" }, // {"dqrfa":"待确认方案", "dsccl": "待上传材料", "dsh": "待审核", "ddj": "待递交", "ydj": "已递交", "ywc": "已完成" },
} }
if(obj.opNotes){ if (obj.opNotes) {
tmObj["opNotes"]=obj.opNotes; tmObj["opNotes"] = obj.opNotes;
} }
if(obj.submitTime){ if (obj.submitTime) {
tmObj["submitTime"]=obj.submitTime; tmObj["submitTime"] = obj.submitTime;
} }
await self.dao.update(tmObj,t);//修改商标状态信息 await self.dao.update(tmObj, t);//修改商标状态信息
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
} }
module.exports=TradeMarkService; 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