Commit ab895e44 by 蒋勇

Merge branch 'igirl-zcapi' of gitlab.gongsibao.com:jiangyong/zhichan into igirl-zcapi

parents 5f1dac09 26c6af7b
...@@ -139,7 +139,7 @@ class APIBase extends DocBase { ...@@ -139,7 +139,7 @@ class APIBase extends DocBase {
content: e.stack, content: e.stack,
clientIp: pobj.clientIp, clientIp: pobj.clientIp,
agent: req.uagent, agent: req.uagent,
optitle: "api调用出现异常,请联系管理员", optitle: "api调用出现异常,请联系管理员_zcapi",
}); });
var rtnerror = system.getResultFail(-200, "出现异常,请联系管理员"); var rtnerror = system.getResultFail(-200, "出现异常,请联系管理员");
rtnerror.requestid = requestid; rtnerror.requestid = requestid;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
class NeedOrderAPI extends APIBase {
constructor() {
super();
this.needinfoSve = system.getObject("service.dbneed.needinfoSve");
}
/**
* 接口跳转-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;
pobj.actionBody["user"]=req.user;
pobj.actionBody["app"]=req.app;
switch (pobj.actionProcess) {
case "jd"://京东
result = await this.jdOpActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody);
break;
default:
result = system.getResult(null, "actionProcess参数错误");
break;
}
return result;
}
async jdOpActionProcess(action_process, action_type, action_body) {
var opResult = null;
switch (action_type) {
// sy
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "subNeed"://提交需求
opResult = await this.needinfoSve.subNeed(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = NeedOrderAPI;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
class TmOrderAPI 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");
}
/**
* 接口跳转-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.jdOpActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody);
break;
default:
result = system.getResult(null, "actionProcess参数错误");
break;
}
return result;
}
async jdOpActionProcess(action_process, action_type, action_body) {
action_body.app = { id: 1, appPayType: "00", appDataOpType: "00" };
action_body.user = { id: 1, app_id: 1, nickname: "测试用户" };
var opResult = null;
switch (action_type) {
// sy
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "addOrder"://商标提报
opResult = await this.ordertmproductSve.addTmOrder(action_body);
break;
case "getTmOrderList"://商标交付列表
opResult = await this.ordertmproductSve.getTmOrderList(action_body);
break;
case "getTmOrderInfo"://商标交付信息
opResult = await this.ordertmproductSve.getTmOrder(action_body);
break;
case "getTmApplyInfo"://商标订单-申请信息
opResult = await this.ordertmproductSve.getTmApply(action_body);
break;
case "getTmNclList"://商标订单-商标尼斯信息
opResult = await this.ordertmproductSve.getTmNclList(action_body);
break;
case "updateTmInfo"://修改商标订单-商标信息修改
opResult = await this.trademarkSve.updateTmInfo(action_body);
break;
case "updateNclInfo"://修改商标订单-商标尼斯信息修改
opResult = await this.trademarkSve.updateNclInfo(action_body);
break;
case "updateContacts"://修改商标订单-修改商标交付单联系人
opResult = await this.customercontactsSve.updateContacts(action_body);
break;
case "updateCustomerInfo"://修改商标订单-修改申请人信息
opResult = await this.customerinfoSve.updateCustomerInfo(action_body);
break;
case "updateOfficial"://修改商标订单-修改交官文件
opResult = await this.customerinfoSve.updateOfficial(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = TmOrderAPI;
\ No newline at end of file
...@@ -4,7 +4,7 @@ class TmToolsAPI extends APIBase { ...@@ -4,7 +4,7 @@ class TmToolsAPI extends APIBase {
constructor() { constructor() {
super(); super();
this.toolSve = system.getObject("service.trademark.toolSve"); this.toolSve = system.getObject("service.trademark.toolSve");
this.toolApi = system.getObject("api.tool.toolApi"); // this.toolApi = system.getObject("api.tool.toolApi");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
......
var APIBase = require("../../api.base");
var system = require("../../../system");
class TmTransactionAPI extends APIBase {
constructor() {
super();
}
/**
* 接口跳转-POST请求
* actionProcess 执行的流程
* actionType 执行的类型
* actionBody 执行的参数
*/
async springboard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.action_type) {
return system.getResult(null, "actionType参数不能为空");
}
var result = null;
switch (pobj.actionProcess) {
case "jd"://京东
result = await this.jdOpActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody);
break;
default:
result = system.getResult(null, "actionProcess参数错误");
break;
}
return result;
}
async jdOpActionProcess(action_process, action_type, action_body) {
var opResult = null;
switch (action_type) {
// sy
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "addOrder"://添加订单
// opResult = await this.orderSve.addOrder(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = TmTransactionAPI;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
class zcosssignAPI extends APIBase {
constructor() {
super();
this.uploadSve = system.getObject("service.common.uploadSve");
}
async getOssConfig(pobj, qobj, req) {
var rtn=await this.uploadSve.getOssConfig();
return rtn;
}
}
module.exports = zcosssignAPI;
\ No newline at end of file
...@@ -335,6 +335,14 @@ class ImageHandleApi extends ApiBase{ ...@@ -335,6 +335,14 @@ class ImageHandleApi extends ApiBase{
//标准商标图样上传(生成黑白商标,调整商标宽高 使其合规) //标准商标图样上传(生成黑白商标,调整商标宽高 使其合规)
async uploadStandardTm(obj){ async uploadStandardTm(obj){
var jpgpath=obj.jpgpath; var jpgpath=obj.jpgpath;
var colorjpgpath = await this.getUidStr(20,62)+".jpg";
colorjpgpath = "zc_color"+colorjpgpath;
if(jpgpath){
var arr = jpgpath.split("/");
if(arr && arr.length>0){
colorjpgpath = arr[arr.length-1];
}
}
// var basename=obj.jpgpath.substring(0,obj.jpgpath.lastIndexOf(".")); // var basename=obj.jpgpath.substring(0,obj.jpgpath.lastIndexOf("."));
var basename=await this.getUidStr(20,62)+".jpg"; var basename=await this.getUidStr(20,62)+".jpg";
var destfile = "/tmp/"+basename; var destfile = "/tmp/"+basename;
...@@ -361,12 +369,13 @@ class ImageHandleApi extends ApiBase{ ...@@ -361,12 +369,13 @@ class ImageHandleApi extends ApiBase{
//合成图像 //合成图像
var comimg=await this._composeImg(scale,maxSize,jpgpathtmp,bkimgpath,comimgpath); var comimg=await this._composeImg(scale,maxSize,jpgpathtmp,bkimgpath,comimgpath);
//上传覆盖元先的路径 //上传覆盖元先的路径
var rtn=await this.ossClient.upfile(jpgpath,comimgpath); var rtn=await this.ossClient.upfile(colorjpgpath,comimgpath);
fs.unlink(jpgpathtmp,function(err){}); fs.unlink(jpgpathtmp,function(err){});
fs.unlink(bkimgpath,function(err){}); fs.unlink(bkimgpath,function(err){});
// fs.unlink(comimgpath,function(err){}); // fs.unlink(comimgpath,function(err){});
var grayimg=await this._grayImg(comimgpath); var grayimg=await this._grayImg(comimgpath);
var blackjpgpath = await this.getUidStr(20,62)+".jpg"; var blackjpgpath = await this.getUidStr(20,62)+".jpg";
blackjpgpath = "zc_black"+blackjpgpath;
var rtn2=await this.ossClient.upfile(blackjpgpath,comimgpath); var rtn2=await this.ossClient.upfile(blackjpgpath,comimgpath);
fs.unlink(comimgpath,function(err){}); fs.unlink(comimgpath,function(err){});
return system.getResult2({"url":rtn.url,"url2":rtn2.url},null); return system.getResult2({"url":rtn.url,"url2":rtn2.url},null);
...@@ -394,28 +403,8 @@ class ImageHandleApi extends ApiBase{ ...@@ -394,28 +403,8 @@ class ImageHandleApi extends ApiBase{
} }
module.exports=ImageHandleApi; module.exports=ImageHandleApi;
// var t=new ImageHandleApi(); // var t=new ImageHandleApi();
//
// t.makeDeleForTM({"url":"http://192.168.18.40:3000/mobile#/products/createwts/10711536633793138"}).then(d=>{ // t.uploadStandardTm({"jpgpath":"https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_picUrl2055157656303330920191117.jpg"}).then(d=>{
// console.log(d); // console.log(d,"dddddddddddddddddddddddddddddddd");
// }); // });
// t.onLineMakeTM("hello","/tmp/a.jpg").then(f=>{
// console.log(f);
// });
// t.adjustTMSize({
// appKey:"wx76a324c5d201d1a4",
// jpgpath:"zc_1158153631265738720187173057387ban4.jpg"
// }).then(d=>{
// console.log(d);
// });
// t.toblack({
// appKey:"wx76a324c5d201d1a4",
// jpgpath:"zc_1158153631265738720187173057387ban4.jpg"
// }).then(d=>{
// console.log(d);
// });
// t._scaleImg("/tmp/a.jpg",400).then(d=>{
// console.log(d);
// });
// t._grayImg("/tmp/b.png").then(d=>{
// console.log(d);
// });
...@@ -397,7 +397,7 @@ class ToolApi extends ApiBase { ...@@ -397,7 +397,7 @@ class ToolApi extends ApiBase {
var j = await this.imghandleApi.uploadStandardTm(obj); var j = await this.imghandleApi.uploadStandardTm(obj);
return j; return j;
} catch (e) { } catch (e) {
console.log(e); console.log(e.stack,"uploadStandardTm...........................");
return System.getResult2(null, null); return System.getResult2(null, null);
} }
} }
......
var system = require("../../../system")
const CtlBase = require("../../ctl.base");
const crypto = require('crypto');
var fs = require("fs");
var accesskey = 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla';
var accessKeyId = 'LTAIyAUK8AD04P5S';
var url = "https://gsb-zc.oss-cn-beijing.aliyuncs.com";
class UploadCtl extends CtlBase {
constructor() {
super("common", CtlBase.getServiceName(UploadCtl));
this.cmdPdf2HtmlPattern = "docker run -i --rm -v /tmp/:/pdf 0c pdf2htmlEX --zoom 1.3 '{fileName}'";
this.restS = system.getObject("util.execClient");
this.cmdInsertToFilePattern = "sed -i 's/id=\"page-container\"/id=\"page-container\" contenteditable=\"true\"/'";
//sed -i 's/1111/&BBB/' /tmp/input.txt
//sed 's/{position}/{content}/g' {path}
}
async getOssConfig() {
var end = new Date().getTime() + 300000
var expiration = new Date(end).toISOString()
var policyText = {
"expiration": expiration,
"conditions": [
["content-length-range", 0, 1048576000],
["starts-with", "$key", "zc"]
]
};
var b = new Buffer(JSON.stringify(policyText));
var policyBase64 = b.toString('base64');
var signature = crypto.createHmac('sha1', accesskey).update(policyBase64).digest().toString('base64'); //base64
var data = {
OSSAccessKeyId: accessKeyId,
policy: policyBase64,
Signature: signature,
Bucket: 'gsb-zc',
success_action_status: 201,
url: url
};
return data;
};
async upfile(srckey, dest) {
var oss = system.getObject("util.ossClient");
var result = await oss.upfile(srckey, "/tmp/" + dest);
return result;
};
async downfile(srckey) {
var oss = system.getObject("util.ossClient");
var downfile = await oss.downfile(srckey).then(function () {
downfile = "/tmp/" + srckey;
return downfile;
});
return downfile;
};
async pdf2html(obj) {
var srckey = obj.key;
var downfile = await this.downfile(srckey);
var cmd = this.cmdPdf2HtmlPattern.replace(/\{fileName\}/g, srckey);
var rtn = await this.restS.exec(cmd);
var path = "/tmp/" + srckey.split(".pdf")[0] + ".html";
var a = await this.insertToFile(path);
fs.unlink("/tmp/" + srckey);
var result = await this.upfile(srckey.split(".pdf")[0] + ".html", srckey.split(".pdf")[0] + ".html");
return result.url;
};
async insertToFile(path) {
var cmd = this.cmdInsertToFilePattern + " " + path;
return await this.restS.exec(cmd);
};
}
module.exports = UploadCtl;
const system=require("../../../system");
const Dao=require("../../dao.base");
class UploadDao extends Dao{
constructor(){
super(Dao.getModelName(UploadDao));
}
}
module.exports=UploadDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class PushBusinessDao extends Dao {
constructor() {
super(Dao.getModelName(PushBusinessDao));
}
async getItemByUappKey(uappKey, reqEnv) {
return this.model.findOne({
where: {
uappKey: uappKey,
reqEnv: reqEnv
},
attributes: ["id",
"sourceCode",
"sourceName",
"uappKey",
"aliAppkey",
"aliSecret",
"status",
"pushSveUrl",
"pushProductId",
"sveProductId",
"reqEnv",
"notes"],
raw: true
});
}
}
module.exports = PushBusinessDao;
module.exports = { module.exports = {
"appid": "40d64e586551405c9bcafab87266bc04", "appid": "201911051030",
"label": "研发开放平台", "label": "知产api应用",
"config": { "config": {
"rstree": { "rstree": {
"code": "paasroot", "code": "paasroot",
......
...@@ -13,9 +13,9 @@ module.exports = (db, DataTypes) => { ...@@ -13,9 +13,9 @@ module.exports = (db, DataTypes) => {
defaultValue: "info", defaultValue: "info",
}, },
op: DataTypes.STRING, op: DataTypes.STRING,
content: DataTypes.STRING(5000), content: DataTypes.TEXT('long'),
resultInfo: DataTypes.TEXT,
clientIp: DataTypes.STRING, clientIp: DataTypes.STRING,
resultInfo: DataTypes.TEXT('long'),
agent: { agent: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
...@@ -30,7 +30,7 @@ module.exports = (db, DataTypes) => { ...@@ -30,7 +30,7 @@ module.exports = (db, DataTypes) => {
updatedAt: false, updatedAt: false,
//freezeTableName: true, //freezeTableName: true,
// define the table's name // define the table's name
tableName: 'zc_op_log', tableName: 'zcapi_op_log',
validate: { validate: {
}, },
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("app", {
name: DataTypes.STRING(100), // 应用名称
appDataOpType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.app_data_op_type),
}, // 应用数据操作类型:00独立,10全委托,20部分委托
appPayType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.app_pay_type),
}, // 支付类型:00第三方支付,10平台代收款
contactName : DataTypes.STRING(30), // 联系人姓名
contactMobile: DataTypes.STRING(30), // 联系人手机
contactEmail : DataTypes.STRING(30), // 联系人邮箱
uappKey : DataTypes.STRING(64), // 平台应用key
appSecret : DataTypes.STRING(64), // 密钥信息,用于进行签名请求接口
status : DataTypes.INTEGER, // 状态 0禁用 1启用
channelAppId : DataTypes.STRING(64), // 渠道appID
channelAppKey: DataTypes.STRING(64), // 渠道appKey
notes : DataTypes.STRING, // 备注
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_app',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("appproduct", {
app_id :DataTypes.STRING(50),// 应用id
itemCode :DataTypes.STRING(100),// 产品编码
itemName :DataTypes.STRING(100),// 产品名称
picUrl :DataTypes.STRING(500),// 产品图片地址
channelItemCode :DataTypes.STRING(100),// 渠道产品编码
channelItemName :DataTypes.STRING(100),// 渠道产品名称
status :DataTypes.BOOLEAN,// 状态 0禁用 1启用
verifyPrice :DataTypes.BOOLEAN,// 是否验证价格 0不验证 1验证
proPrice :DataTypes.DOUBLE,// 产品价格
serviceCharge :DataTypes.DOUBLE,// 服务费
publicExpense :DataTypes.DOUBLE,// 官费
rateConfig :DataTypes.DECIMAL(12, 2),// 税率
discountsRateConfig :DataTypes.DECIMAL(12, 2),// 优惠税率
channelProfitRate :DataTypes.DECIMAL(12, 2),// 渠道利润分成比率(只分订单中毛利润总额的分成)
sort :DataTypes.INTEGER,// 排序
productType_id :DataTypes.INTEGER,// 产品类型Id
productOneType_id :DataTypes.INTEGER,// 产品大类Id
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_app_product',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("appuser", {
app_id : DataTypes.INTEGER, // 应用id
channelUserId : DataTypes.STRING(64), // 渠道用户ID
channelUserName : DataTypes.STRING(64), // 渠道用户登录名
userMoblie : DataTypes.STRING(20), // 用户手机号
nickname : DataTypes.STRING(50), // 昵称
orgName : DataTypes.STRING(255), // 组织结构名称
orgPath : DataTypes.STRING(255), // 组织结构路径
isEnabled : DataTypes.INTEGER, // 是否启用
lastLoginTime : DataTypes.DATE, // 上次登录时间
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_app_user',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("needinfo", {
app_id :DataTypes.INTEGER, //
needNo :DataTypes.STRING(64), //需求单号
needDesc :DataTypes.STRING(255), //
needUserMoblie :DataTypes.STRING(20), //
notes :DataTypes.STRING(255), //
opNotes :DataTypes.STRING(500), //
channelUserName :DataTypes.STRING(50), // 渠道用户登录名
auditStatus :DataTypes.STRING(10), //确认状态:00待确认,10确认通过,20确认不通过
createuser_id :DataTypes.INTEGER, //
updateuser_id :DataTypes.INTEGER, //
owner_id :DataTypes.INTEGER, //
creator :DataTypes.STRING(50), //
updator :DataTypes.STRING(50), //
owner :DataTypes.STRING(50), //
ownerMoblie :DataTypes.STRING(20), //
itemCode :DataTypes.STRING(80), //产品码
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_needinfo',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("customercontacts", {
app_id :DataTypes.INTEGER, //
customerinfo_id :DataTypes.INTEGER, //
deliveryOrderNo :DataTypes.STRING(64), // 交付订单号
mobile :DataTypes.STRING(20), //
email :DataTypes.STRING(50), //
tel :DataTypes.STRING(20), //
fax :DataTypes.STRING(50), //
name :DataTypes.STRING(1000), // 联系人
code :DataTypes.STRING(100), // 暂时没有用
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_customercontacts',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("customerinfo", {
customerTypeName :DataTypes.STRING(50), //
customerType : {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.customer_type),
set: function (val) {
this.setDataValue("customerType", val);
this.setDataValue("customerTypeName", uiconfig.config.pdict.customer_type[val]);
},
defaultValue: "0",
}, //申请企业类型: ent:企业,person:个人
identityCardPic :DataTypes.STRING(500), // 身份证图片
identityCardPdf :DataTypes.STRING(500), // 身份证pdf
businessLicensePic :DataTypes.STRING(500), // 营业执照图片
businessLicensePdf :DataTypes.STRING(500), // 营业执照pdf
name :DataTypes.STRING(1000), // 公司名称或个人名称
code :DataTypes.STRING(100), // 公司统一社会代码
app_id :DataTypes.INTEGER, //
deliveryOrderNo :DataTypes.STRING(64), // 交付订单号
applyAddr :DataTypes.STRING, // 申请地址
applyArea :DataTypes.STRING(50), // 存储省市编码
province :DataTypes.STRING(50), // 省
city :DataTypes.STRING(50), // 市
identityCardNo :DataTypes.STRING(50), // 身份证号
notes :DataTypes.STRING, // 备注
createuser_id :DataTypes.INTEGER, //
updateuser_id :DataTypes.INTEGER, //
owner_id :DataTypes.INTEGER, // 拥有者
zipCode :DataTypes.STRING(20), //
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_customerinfo',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("order", {
app_id :DataTypes.INTEGER,//
orderNo :DataTypes.STRING(64),// 订单号
channelServiceNo :DataTypes.STRING(64),// 渠道服务单号
channelOrderNo :DataTypes.STRING(1024),// 渠道订单号列表,多个以,隔开
itemCode :DataTypes.STRING(64),//
itemName :DataTypes.STRING(100),//
channelItemCode :DataTypes.STRING(64),// 渠道产品编码
channelItemName :DataTypes.STRING,// 渠道产品名称
payTime :DataTypes.DATE,// 渠道有支付时间则用渠道的支付时间
salesNum :DataTypes.INTEGER,// 项目订单数量(即服务项目的倍数,默认值为1)
salesDiliverNum :DataTypes.INTEGER,// 项目订单交付数量(即与项目订单数量相对应)
minitermNum :DataTypes.INTEGER,// 订单小项数量
minitermDiliverNum :DataTypes.INTEGER,// 订单小项交付数量
orderType :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_type),
},// 订单类型,zzdd: 自主订单,dkxd: 代客下单
orderPayStatusName: DataTypes.STRING(50),//
orderPayStatus :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_pay_status),
set: function (val) {
this.setDataValue("orderPayStatus", val);
this.setDataValue("orderPayStatusName", uiconfig.config.pdict.order_pay_status[val]);
}
},// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过
totalServiceCharge :DataTypes.DECIMAL(12, 2),// 服务费总额(产品配置的服务费*订单件数)
totalPublicExpense :DataTypes.DECIMAL(12, 2),// 官费总额(产品配置的官费*订单件数)
totalDiscounts :DataTypes.DECIMAL(12, 2),// 优惠总额((服务费总额+官费总额)-订单总额(产品价格×优惠费率×订单件数)>0则有优惠额度)
totalTaxes :DataTypes.DECIMAL(12, 2),// 税费总额(订单总额-(订单总额/(1+产品费率)))
totalSum :DataTypes.DECIMAL(12, 2),// 订单总额(产品价格×优惠费率×订单件数)
refundSum :DataTypes.DECIMAL(12, 2),// 退款金额
totalProfitSum :DataTypes.DECIMAL(12, 2),// 订单毛利润总额(订单总额-官费总额)
pfProfitSum :DataTypes.DECIMAL(12, 2),// 订单平台毛利润总额(订单毛利润总额-订单渠道分成毛利润总额)
channelProfitSum :DataTypes.DECIMAL(12, 2),// 订单渠道分成毛利润总额((订单总额-官费总额)*渠道利润分成比率)
pfSettleProfit :DataTypes.DECIMAL(12, 2),// 平台结算渠道利润,0否,1是
opNotes :DataTypes.STRING,// 备注
appPayType :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.app_pay_type),
},// 支付类型:00第三方支付,10平台代收款
createuser_id :DataTypes.INTEGER,//
updateuser_id :DataTypes.INTEGER,//
owner_id :DataTypes.INTEGER,//
creator :DataTypes.STRING(100),//
updator :DataTypes.STRING(100),//
owner :DataTypes.STRING(100),//
ownerMoblie :DataTypes.STRING(20),//
invoiceApplyStatus :DataTypes.STRING(10),// 发票状态:00: 未申请, 10: 已申请,20:已开票
channelUserId :DataTypes.STRING(64), // 渠道用户ID
needNo :DataTypes.STRING(64), // 需求单号
picUrl :DataTypes.STRING(500),// 产品图片地址
productType_id :DataTypes.INTEGER, //产品类型Id
productOneType_id :DataTypes.INTEGER, //产品大类Id
serviceItemSnapshot :DataTypes.TEXT, //产品快照
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_order',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderflow", {
sourceOrderNo: DataTypes.STRING(64), // 来源单号
opContent: DataTypes.STRING(1024), // 操作描述
app_id: DataTypes.INTEGER, //
notes: DataTypes.STRING, // 备注
createuser_id: DataTypes.INTEGER, //
isShow: {//是否显示
type: DataTypes.BOOLEAN,
defaultValue: false,
},
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_orderflow',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("ordertmproduct", {
app_id: DataTypes.INTEGER,//
productType_id: DataTypes.INTEGER,//产品类型Id
productOneType_id: DataTypes.INTEGER,//产品大类Id
itemCode: DataTypes.STRING(64),//产品编码
itemName: DataTypes.STRING(100),//产品名称
tmName: DataTypes.STRING(1000),//商标名称
tmType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.tm_type),
},//p:普通商标,j:集体商标,z:证明商标,t:特殊商标
tmFormTypeName: DataTypes.STRING(50),//
tmFormType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.tm_form_type),
set: function (val) {
this.setDataValue("tmFormType", val);
this.setDataValue("tmFormTypeName", uiconfig.config.pdict.tm_form_type[val]);
}
},//商标类型形式:1:立体,3:字,4:图,5:字图,6:颜色,7:彩色
nclOneCodes: DataTypes.STRING,//尼斯大类列表:格式以,隔开
payStatusName: DataTypes.STRING(50),//
payStatus: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_service_pay_status),
set: function (val) {
this.setDataValue("payStatus", val);
this.setDataValue("payStatusName", uiconfig.config.pdict.order_service_pay_status[val]);
}
},//支付状态:dfk:待付款,yzf:已支付
deliveryStatusName: DataTypes.STRING(50),//
deliveryStatus: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.delivery_status),
set: function (val) {
this.setDataValue("deliveryStatus", val);
this.setDataValue("deliveryStatusName", uiconfig.config.pdict.delivery_status[val]);
}
},//商标交付状态:dsccl:待上传材料,dsh:待审核,ddj:待递交, ydj: 已递交,ywc:已完成
appDataOpType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.app_data_op_type),
},//应用数据操作类型:00独立,10全委托,20部分委托
deliveryOrderNo: DataTypes.STRING(64),//交付订单号
channelServiceNo: DataTypes.STRING(64),//渠道服务单号
channelOrderNo: DataTypes.STRING(1024),//渠道订单号列表,多个以,隔开
needNo: DataTypes.STRING(64),//需求单号
sourceType: DataTypes.STRING(10),//来源类型:00订单,10需求,20服务商
picUrl: DataTypes.STRING(500), //商标图样
colorizedPicUrl: DataTypes.STRING(500),//商标彩色图样
gzwtsUrl: DataTypes.STRING(500), //盖章委托书
sywjUrl: DataTypes.STRING(500), //声音文件
smwjUrl: DataTypes.STRING(500), //说明文件
channelUserId: DataTypes.STRING(64),//渠道用户ID
notes: DataTypes.STRING(255),//备注
createuser_id: DataTypes.INTEGER,//
updateuser_id: DataTypes.INTEGER,//
auditor_id: DataTypes.INTEGER,//
createuser: DataTypes.STRING(100),//
updateuser: DataTypes.STRING(100),//
auditor: DataTypes.STRING(100),//
nclOneCount: DataTypes.INTEGER, // 尼斯大类数量
nclCount: DataTypes.INTEGER, // 尼斯数量
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_order_tm_product',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("tmofficial", {
tmRegistNum :DataTypes.STRING(50), //注册号
officialTypeName :DataTypes.STRING(50), //
officialType : {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.official_type),
set: function (val) {
this.setDataValue("officialType", val);
this.setDataValue("officialTypeName", uiconfig.config.pdict.official_type[val]);
}
}, //商标官文类型:1: 商标注册申请书, 2: 商标注册申请补正通知书, 3: 商标注册申请受理通知书, 4: 商标注册申请不予受理通知书,
//5: 商标注册同日申请补送使用证据通知书,6: 商标注册同日申请协商通知书商标注册同日申请抽签通知书,
//7: 商标驳回通知书, 8: 商标部分驳回通知书, 9: 商标注册申请初步审定公告通知书,
//10: 商标异议答辩通知书, 11: 异议裁定书, 12: 纸质版商标注册证, 13: 电子版商标注册证
officialFileName :DataTypes.STRING(200), // 官文文件名称
officialFileUrl :DataTypes.STRING(255), // 官文文件地址
notes :DataTypes.STRING , //
name :DataTypes.STRING(1000), //暂时没有用
code :DataTypes.STRING(64), //官文单号(自动生成)
app_id :DataTypes.INTEGER, //
createuser_id :DataTypes.INTEGER, //
updateuser_id :DataTypes.INTEGER, //
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_tmofficial',
validate: {
},
indexes: [
]
});
}
const system=require("../../../system");
const ServiceBase=require("../../sve.base");
const crypto = require('crypto');
var accesskey = 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla';
var accessKeyId = 'LTAIyAUK8AD04P5S';
var url = "https://gsb-zc.oss-cn-beijing.aliyuncs.com";
class UploadService extends ServiceBase{
constructor(){
super("common",ServiceBase.getDaoName(UploadService));
//this.appDao=system.getObject("db.appDao");
}
async getOssConfig() {
var end = new Date().getTime() + 3000000;
var expiration = new Date(end).toISOString()
var policyText = {
"expiration": expiration,
"conditions": [
["content-length-range", 0, 1048576000],
["starts-with", "$key", "zc"]
]
};
var b = new Buffer(JSON.stringify(policyText));
var policyBase64 = b.toString('base64');
var signature = crypto.createHmac('sha1', accesskey).update(policyBase64).digest().toString('base64'); //base64
var data = {
OSSAccessKeyId: accessKeyId,
policy: policyBase64,
Signature: signature,
Bucket: 'gsb-zc',
success_action_status: 201,
url: url
};
return data;
};
}
module.exports=UploadService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class AapService extends ServiceBase {
constructor() {
super("dbapp", ServiceBase.getDaoName(AapService));
}
}
module.exports=AapService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class AppProductService extends ServiceBase {
constructor() {
super("dbapp", ServiceBase.getDaoName(AppProductService));
}
}
module.exports = AppProductService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class AapUserService extends ServiceBase {
constructor() {
super("dbapp", ServiceBase.getDaoName(AapUserService));
this.opPlatformUtils = system.getObject("util.businessManager.opPlatformUtils");
}
async loginUser(channelUserId, channelUserName, userMoblie, nickname, orgName, orgPath) {
if (!channelUserId) {
return system.getResult(null, "channelUserId不能为空");
}
var params = {
channelUserId: channelUserId,
channelUserName: channelUserName,
userMoblie: userMoblie,
nickname: nickname,
orgName: orgName,
orgPath: orgPath
}
var userItem = await this.cacheManager["ApiUserCache"].cache(channelUserId, { status: true }, 3000, params);
if (!userItem) {
return system.getResult(null, "用户注册失败");
}
return system.getResultSuccess(userItem);
}
}
module.exports = AapUserService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class NeedInfoService extends ServiceBase {
constructor() {
super("dbneed", ServiceBase.getDaoName(NeedInfoService));
}
async subNeed(obj){
var user = obj.user;
var app = obj.app;
if(!user){
return system.getResultFail(-100, "未知用户");
}
if(!app){
return system.getResultFail(-101, "未知渠道");
}
var needNo=await this.getBusUid("ni");
var needObj={
app_id :app.id,
needNo :needNo,
needDesc :obj.needDesc,
needUserMoblie :obj.needUserMoblie,
notes :obj.notes,
channelUserName :user.channelUserName,
auditStatus :"00",
createuser_id :user.id,
itemCode:obj.itemCode
};
var need = await this.dao.create(needObj);
return system.getResultSuccess(need);
}
}
module.exports=NeedInfoService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class CustomerContactsService extends ServiceBase {
constructor() {
super("dborder", ServiceBase.getDaoName(CustomerContactsService));
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
}
/**
* 修改商标交付单联系人(订单详情页面)
* @param {*} obj
* obj.deliveryOrderNo 交付订单号,
* obj.name 联系人,obj.mobile 联系电话,obj.email 电子邮箱,obj.tel 座机电话
* obj.user 用户数据
*/
async updateContacts(obj){
var user = obj.user;
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, "商标交付单不存在");
}
// 2.获取交付单状态,判断是否可修改
if(ordertmproduct.deliveryStatus=='ddj' || ordertmproduct.deliveryStatus=='ywc'){
var deliveryStatusName = "待递交";
if(ordertmproduct.deliveryStatus=='ywc'){
deliveryStatusName="已完成";
}
return system.getResultFail(-103, "该商标交付单状态为"+deliveryStatusName+",不能进行修改");
}
var self = this;
return await self.db.transaction(async function (t) {
var contactsObj={deliveryOrderNo:deliveryOrderNo};
if(obj.name){
contactsObj["name"]=obj.name;
}
if(obj.mobile){
contactsObj["mobile"]=obj.mobile;
}
if(obj.email){
contactsObj["email"]=obj.email;
}
if(obj.tel){
contactsObj["tel"]=obj.tel;
}
//修改联系人信息
await self.dao.model.update(contactsObj, { where: { deliveryOrderNo:deliveryOrderNo }, transaction: t });
return system.getResultSuccess();
})
}
}
module.exports=CustomerContactsService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class CustomerInfoService extends ServiceBase {
constructor() {
super("dborder", ServiceBase.getDaoName(CustomerInfoService));
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
}
/**
* 修改申请人信息(订单详情页面使用)
* @param {*} obj
* obj.deliveryOrderNo 交付订单号,
* obj.customerType 申请人类型,
* obj.name 公司名称或个人名称,
* obj.code 社会统一信用代码,
* obj.applyAddr 公司地址,
* obj.zipCode 邮编
* obj.identityCardPic 身份证图片,
* obj.businessLicensePic 营业执照图片,
* obj.identityCardPdf 身份证pdf,
* obj.businessLicensePdf 营业执照pdf,
* obj.user 用户数据
*/
async updateCustomerInfo(obj){
var user = obj.user;
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, "商标交付单不存在");
}
// 2.获取交付单状态,判断是否可修改
if(ordertmproduct.deliveryStatus=='ddj' || ordertmproduct.deliveryStatus=='ywc'){
var deliveryStatusName = "待递交";
if(ordertmproduct.deliveryStatus=='ywc'){
deliveryStatusName="已完成";
}
return system.getResultFail(-103, "该商标交付单状态为"+deliveryStatusName+",不能进行修改");
}
var customerinfo = await this.dao.model.findOne({
where:{
deliveryOrderNo:deliveryOrderNo
},
raw:true
});
if(!customerinfo || !customerinfo.id){
return system.getResultFail(-104, "未知申请人");
}
var self = this;
return await self.db.transaction(async function (t) {
var ciObj={ id:customerinfo.id,updateuser_id:user.id };
if(obj.customerType){
ciObj["customerType"]=obj.customerType;
}
if(obj.name){
ciObj["name"]=obj.name;
}
if(obj.code){
ciObj["code"]=obj.code;
}
if(obj.applyAddr){
ciObj["applyAddr"]=obj.applyAddr;
}
if(obj.zipCode){
ciObj["zipCode"]=obj.zipCode;
}
if(obj.businessLicensePic){
ciObj["businessLicensePic"]=obj.businessLicensePic;
}
if(obj.identityCardPic){
ciObj["identityCardPic"]=obj.identityCardPic;
}
if(obj.businessLicensePdf){
ciObj["businessLicensePdf"]=obj.businessLicensePdf;
}
if(obj.identityCardPdf){
ciObj["identityCardPdf"]=obj.identityCardPdf;
}
await self.dao.update(ciObj,t);//修改申请人信息
return system.getResultSuccess();
})
}
/**
* 修改交官文件
* @param {*} obj
* obj.deliveryOrderNo 交付单号,
* obj.gzwtsUrl 盖章委托书,
* obj.smwjUrl 说明文件,
* obj.identityCardPic 身份证图片,
* obj.businessLicensePic 营业执照图片,
* obj.identityCardPdf 身份证pdf,
* obj.businessLicensePdf 营业执照pdf,
* obj.user 用户数据
*/
async updateOfficial(obj){
var user = obj.user;
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, "商标交付单不存在");
}
// 2.获取交付单状态,判断是否可修改
if(ordertmproduct.deliveryStatus=='ddj' || ordertmproduct.deliveryStatus=='ywc'){
var deliveryStatusName = "待递交";
if(ordertmproduct.deliveryStatus=='ywc'){
deliveryStatusName="已完成";
}
return system.getResultFail(-103, "该商标交付单状态为"+deliveryStatusName+",不能进行修改");
}
var customerinfo = await this.dao.model.findOne({
where:{
deliveryOrderNo:deliveryOrderNo
},
raw:true
});
if(!customerinfo || !customerinfo.id){
return system.getResultFail(-104, "未知申请人");
}
var self = this;
return await self.db.transaction(async function (t) {
var ciObj={ id:customerinfo.id,updateuser_id:user.id };
if(obj.businessLicensePic){
ciObj["businessLicensePic"]=obj.businessLicensePic;
}
if(obj.identityCardPic){
ciObj["identityCardPic"]=obj.identityCardPic;
}
if(obj.businessLicensePdf){
ciObj["businessLicensePdf"]=obj.businessLicensePdf;
}
if(obj.identityCardPdf){
ciObj["identityCardPdf"]=obj.identityCardPdf;
}
await self.dao.update(ciObj,t);//申请人信息 修改营业执照、身份证文件
var otpObj={
id:ordertmproduct.id,
updateuser_id:user.id,
updateuser:user.nickname
};
if(obj.gzwtsUrl){
otpObj["gzwtsUrl"]=obj.gzwtsUrl;
}
if(obj.smwjUrl){
otpObj["smwjUrl"]=obj.smwjUrl;
}
await self.ordertmproductSve.update(otpObj,t);//商标交付单 修改盖章委托书、说明文件
return system.getResultSuccess();
})
}
}
module.exports=CustomerInfoService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class OrderService extends ServiceBase {
constructor() {
super("dborder", ServiceBase.getDaoName(OrderService));
}
}
module.exports = OrderService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class OrderFlowService extends ServiceBase {
constructor() {
super("dborder", ServiceBase.getDaoName(OrderFlowService));
}
}
module.exports=OrderFlowService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class TmOfficialService extends ServiceBase {
constructor() {
super("dbtrademark", ServiceBase.getDaoName(TmOfficialService));
}
}
module.exports=TmOfficialService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class TmStuffService extends ServiceBase {
constructor() {
super("dbtrademark", ServiceBase.getDaoName(TmStuffService));
}
}
module.exports=TmStuffService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class TradeMarkService extends ServiceBase {
constructor() {
super("dbtrademark", ServiceBase.getDaoName(TradeMarkService));
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
}
/**
* 修改商标信息 (订单详情页面使用)
* @param {*} obj
* obj.deliveryOrderNo 交付订单号,
* obj.tmName 商标名称,
* obj.tmFormType 商标类型,
* obj.notes 商标说明,
* obj.picUrl 商标图样,
* obj.colorizedPicUrl 商标彩色图样,
* obj.user 用户数据
*/
async updateTmInfo(obj){
var user = obj.user;
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, "商标交付单不存在");
}
// 2.获取交付单状态,判断是否可修改
if(ordertmproduct.deliveryStatus=='ddj' || ordertmproduct.deliveryStatus=='ywc'){
var deliveryStatusName = "待递交";
if(ordertmproduct.deliveryStatus=='ywc'){
deliveryStatusName="已完成";
}
return system.getResultFail(-103, "该商标交付单状态为"+deliveryStatusName+",不能进行修改");
}
var self = this;
return await self.db.transaction(async function (t) {
var otpObj={
id:ordertmproduct.id,
deliveryOrderNo:deliveryOrderNo,
updateuser_id:user.id,
updateuser:user.nickname
};
if(obj.picUrl){//商标图样 黑白
otpObj["picUrl"]=obj.picUrl;
}
if(obj.colorizedPicUrl){//彩色商标图样
otpObj["colorizedPicUrl"]=obj.colorizedPicUrl;
}
if(obj.tmName){//商标名称
otpObj["tmName"]=obj.tmName;
}
if(obj.tmFormType){//商标类型
otpObj["tmFormType"]=obj.tmFormType;
}
if(obj.notes){//商标说明
otpObj["notes"]=obj.notes;
}
await self.ordertmproductSve.dao.update(otpObj,t);//商标交付单 修改商标图样
return system.getResultSuccess();
})
}
/**
* 修改商标尼斯信息 (订单详情页面使用)
* @param {*} obj
* obj.tbCode 商标提报号,
* obj.deliveryOrderNo 交付订单号,
* obj.nclOneCodes 商标尼斯大类,
* obj.nclSmallCodes 商标尼斯小类数组
* obj.user 用户数据
*/
async updateNclInfo(obj){
var user = obj.user;
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, "商标交付单不存在");
}
// 2.获取交付单状态,判断是否可修改
if(ordertmproduct.deliveryStatus=='ddj' || ordertmproduct.deliveryStatus=='ywc'){
var deliveryStatusName = "待递交";
if(ordertmproduct.deliveryStatus=='ywc'){
deliveryStatusName="已完成";
}
return system.getResultFail(-103, "该商标交付单状态为"+deliveryStatusName+",不能进行修改");
}
var tbCode = obj.tbCode;
if(!tbCode){
return system.getResultFail(-104, "tbCode参数错误");
}
//获取商标尼斯信息
var tm = await this.dao.model.findOne({
where:{tbCode:tbCode},
raw:true
});
if(!tm || !tm.id){
return system.getResultFail(-105, "尼斯信息不存在");
}
//获取交付单下其它商标尼斯信息
var othertm = await this.dao.model.findAll({
where:{
deliveryOrderNo:deliveryOrderNo,
tbCode: { [self.db.Op.ne]: tbCode }
},
raw:true
});
if(!obj.nclOneCodes){
return system.getResultFail(-106, "nclOneCodes参数错误");
}
if(!obj.nclSmallCodes || obj.nclSmallCodes.length<1){
return system.getResultFail(-107, "nclSmallCodes参数错误");
}
if(obj.nclSmallCodes.length>10){
return system.getResultFail(-108, "尼斯小类不能超过10项");
}
var nclOneCodes2 = obj.nclOneCodes;
for(var i=0;i<othertm.length;i++){//判断重复大类
var other = othertm[i];
if(other.nclOneCodes==obj.nclOneCodes){
return system.getResultFail(-109, "该商标存在重复的尼斯大类");
}else{
nclOneCodes2=nclOneCodes2+","+other.nclOneCodes;
}
}
return await self.db.transaction(async function (t) {
var tmObj={
id:tm.id,
nclOneCodes:obj.nclOneCodes,
nclSmallCodes: JSON.stringify(obj.nclSmallCodes),
updateuser_id:user.id,
updateuser:user.nickname
};
await self.dao.update(tmObj,t);//修改商标尼斯信息
var otpObj={
id:ordertmproduct.id,
nclOneCodes:nclOneCodes2,
updateuser_id:user.id,
updateuser:user.nickname
};
await self.ordertmproductSve.dao.update(otpObj,t);//商标交付单 修改大类列表
return system.getResultSuccess();
})
}
}
module.exports=TradeMarkService;
const system=require("../../../system"); const system = require("../../../system");
var settings=require("../../../../config/settings"); var settings = require("../../../../config/settings");
class ToolService { class ToolService {
constructor(){ constructor() {
} }
async pushFqBusiness(pushBusinessSource, reqEnv, action_body) {
}
} }
module.exports=ToolService; module.exports = ToolService;
// var test = new TmqueryService(); // var test = new TmqueryService();
// test.bigtmcount({tmreg_year:2018,apply_addr_province:""}).then(function(d){ // test.bigtmcount({tmreg_year:2018,apply_addr_province:""}).then(function(d){
// console.log("#################################"); // console.log("#################################");
......
const settings = require("../../config/settings");
const Client = require('aliyun-api-gateway').Client;
// const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');
class AliyunClient {
constructor() {
}
async post(appkey, secret, aliReqUrl, actionBody) {
var client = new Client(appkey, secret);
var param = {
data: actionBody,
timeout: 20000,
headers: {
accept: 'application/json'
}
};
console.log(JSON.stringify(param), "______________峰擎---阿里云Prod参数_______");
var result = await client.post(aliReqUrl, param);
console.log(JSON.stringify(result), "______________峰擎---阿里云返回Prod结果_______");
return result;
}
}
module.exports = AliyunClient;
const settings = require("../../config/settings");
const Client = require('aliyun-api-gateway').Client;
const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');
class aliyunFqDevClient {
constructor() {
}
async post(aliReqUrl, actionBody) {
var param = {
data: actionBody,
timeout: 20000,
headers: {
accept: 'application/json'
}
};
console.log(JSON.stringify(param), "______________峰擎---阿里云dev参数_______");
var result = await client.post(aliReqUrl, param);
console.log(JSON.stringify(result), "______________峰擎---阿里云返回dev结果_______");
return result;
}
}
module.exports = aliyunFqDevClient;
const settings = require("../../config/settings");
const Client = require('aliyun-api-gateway').Client;
const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');
class aliyunFqProdClient {
constructor() {
}
async post(aliReqUrl, actionBody) {
var param = {
data: actionBody,
timeout: 20000,
headers: {
accept: 'application/json'
}
};
console.log(JSON.stringify(param), "______________峰擎---阿里云Prod参数_______");
var result = await client.post(aliReqUrl, param);
console.log(JSON.stringify(result), "______________峰擎---阿里云返回Prod结果_______");
return result;
}
}
module.exports = aliyunFqProdClient;
...@@ -6,7 +6,7 @@ var settings={ ...@@ -6,7 +6,7 @@ var settings={
db:10, db:10,
}, },
database:{ database:{
dbname : "igirl_zcapi", dbname : "igirl_api",
user: "write", user: "write",
password: "write", password: "write",
config: { config: {
...@@ -28,7 +28,7 @@ var settings={ ...@@ -28,7 +28,7 @@ var settings={
} }
}, },
reqEsDevUrl:"http://192.168.4.249:9200/", reqEsDevUrl:"http://192.168.4.249:9200/",
reqHomePageDevUrl:"http://zcapi.apps.com:3002/", reqHomePageDevUrl:"http://zcapi.apps.com:4002/",
reqAuthUrl:"http://sj.app.com:3002/auth" reqAuthUrl:"http://sj.app.com:4002/auth"
}; };
module.exports = settings; module.exports = settings;
var path = require('path'); var path = require('path');
var ENVINPUT={ var ENVINPUT = {
DB_HOST:process.env.DB_HOST, DB_HOST: process.env.DB_HOST,
DB_PORT:process.env.DB_PORT, DB_PORT: process.env.DB_PORT,
DB_USER:process.env.DB_USER, DB_USER: process.env.DB_USER,
DB_PWD:process.env.DB_PWD, DB_PWD: process.env.DB_PWD,
REDIS_HOST:process.env.REDIS_HOST, REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT:process.env.REDIS_PORT, REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD:process.env.REDIS_PWD, REDIS_PWD: process.env.REDIS_PWD,
DB_NAME:process.env.ZC_API_DB_NAME, DB_NAME: process.env.ZC_API_DB_NAME,
REDIS_DB:process.env.ZC_API_REDIS_DB, REDIS_DB: process.env.ZC_API_REDIS_DB,
APP_ENV:process.env.APP_ENV?process.env.APP_ENV:"dev" APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
}; };
var settings = { var settings = {
env: ENVINPUT.APP_ENV, env: ENVINPUT.APP_ENV,
appKey: "40d64e586551405c9bcafab87266bc04", appKey: "201911051030",
paasKey: "wx76a324c5d201d1a4", paasKey: "wx76a324c5d201d1a4",
secret: "f99d413b767f09b5dff0b3610366cc46", secret: "aeea89de9e8049b09233ec146173de4a",
salt: "%iatpD1gcxz7iF#B", salt: "%iatpD1gcxz7iF#B",
cacheprefix: "sjb", cacheprefix: "sjb",
usertimeout: 3600,//单位秒 usertimeout: 3600,//单位秒
basepath: path.normalize(path.join(__dirname, '../..')), basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 3002, port: process.env.NODE_PORT || 4002,
paasUrl: function () { paasUrl: function () {
if (this.env == "dev") { if (this.env == "dev") {
return "http://p.apps.com:3001/"; return "http://p.apps.com:4001/";
} else { } else {
return "http://www.telecredit.cn/"; return "http://paas-service/";
} }
}, },
reqEsAddr: function () { reqEsAddr: function () {
...@@ -229,7 +229,14 @@ var settings = { ...@@ -229,7 +229,14 @@ var settings = {
} }
}, },
}, },
gatewayAli: function () {
return {
devFqAppkey: "203756805",
devFqSecret: "crkyej0xlmqa6bmvqijun6ltxparllyn",
prodFqAppkey: "203756805",
prodFqSecret: "crkyej0xlmqa6bmvqijun6ltxparllyn"
}
},
homePage: function () { homePage: function () {
if (this.env == "dev") { if (this.env == "dev") {
var localsettings = require("./localsettings"); var localsettings = require("./localsettings");
...@@ -244,10 +251,10 @@ var settings = { ...@@ -244,10 +251,10 @@ var settings = {
return localsettings.redis; return localsettings.redis;
} else { } else {
return { return {
host:ENVINPUT.REDIS_HOST, host: ENVINPUT.REDIS_HOST,
port:ENVINPUT.REDIS_PORT, port: ENVINPUT.REDIS_PORT,
password:ENVINPUT.REDIS_PWD, password: ENVINPUT.REDIS_PWD,
db:ENVINPUT.REDIS_DB, db: ENVINPUT.REDIS_DB,
}; };
} }
}, },
...@@ -257,10 +264,10 @@ var settings = { ...@@ -257,10 +264,10 @@ var settings = {
return localsettings.database; return localsettings.database;
} else { } else {
return { return {
dbname : ENVINPUT.DB_NAME, dbname: ENVINPUT.DB_NAME,
user : ENVINPUT.DB_USER, user: ENVINPUT.DB_USER,
password : ENVINPUT.DB_PWD, password: ENVINPUT.DB_PWD,
config : { config: {
host: ENVINPUT.DB_HOST, host: ENVINPUT.DB_HOST,
dialect: 'mysql', dialect: 'mysql',
operatorsAliases: false, operatorsAliases: false,
...@@ -270,8 +277,8 @@ var settings = { ...@@ -270,8 +277,8 @@ var settings = {
acquire: 90000000, acquire: 90000000,
idle: 1000000 idle: 1000000
}, },
debug:false, debug: false,
dialectOptions:{ dialectOptions: {
requestTimeout: 999999, requestTimeout: 999999,
// instanceName:'DEV' // instanceName:'DEV'
} //设置MSSQL超时时间 } //设置MSSQL超时时间
...@@ -280,5 +287,5 @@ var settings = { ...@@ -280,5 +287,5 @@ var settings = {
} }
} }
}; };
settings.ENVINPUT=ENVINPUT; settings.ENVINPUT = ENVINPUT;
module.exports = settings; module.exports = settings;
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -29,15 +29,18 @@ ...@@ -29,15 +29,18 @@
"exif-js": "^2.3.0", "exif-js": "^2.3.0",
"express": "^4.16.2", "express": "^4.16.2",
"express-session": "^1.15.6", "express-session": "^1.15.6",
"glob": "^7.1.6",
"gm": "^1.23.1", "gm": "^1.23.1",
"marked": "^0.7.0", "marked": "^0.7.0",
"method-override": "^2.3.10", "method-override": "^2.3.10",
"moment": "^2.24.0",
"mongoose": "^5.7.1", "mongoose": "^5.7.1",
"morgan": "^1.9.0", "morgan": "^1.9.0",
"multer": "^1.3.0", "multer": "^1.3.0",
"mysql2": "^1.5.3", "mysql2": "^1.5.3",
"node-cron": "^2.0.1", "node-cron": "^2.0.1",
"node-uuid": "^1.4.8", "node-uuid": "^1.4.8",
"node-xlsx": "^0.15.0",
"nodemailer": "^6.3.0", "nodemailer": "^6.3.0",
"pinyin": "^2.9.0", "pinyin": "^2.9.0",
"puppeteer": "^1.20.0", "puppeteer": "^1.20.0",
......
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