Commit 07dbc509 by 王悦

增加通过onlycode获取下面员工的商标信息

parent 22145abe
...@@ -4,10 +4,12 @@ const settings = require("../../../config/settings"); ...@@ -4,10 +4,12 @@ const settings = require("../../../config/settings");
const uiconfig = system.getUiConfig2(settings.wxconfig.appId); const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
const tmSourceTypeToChannelCode = uiconfig.config.pdict.tmSourceTypeToChannelCode;//商标来源对应渠道码 const tmSourceTypeToChannelCode = uiconfig.config.pdict.tmSourceTypeToChannelCode;//商标来源对应渠道码
const channelCodeToTmSourceType = uiconfig.config.pdict.channelCodeToTmSourceType;//渠道码对应商标来源 const channelCodeToTmSourceType = uiconfig.config.pdict.channelCodeToTmSourceType;//渠道码对应商标来源
class TrademarkDao extends Dao { class TrademarkDao extends Dao {
constructor() { constructor() {
super(Dao.getModelName(TrademarkDao)); super(Dao.getModelName(TrademarkDao));
} }
judgeChannelCode(channelcode) {//判断渠道编码是否为igirl-channel渠道,若是返回渠道码对应商标来源类型 judgeChannelCode(channelcode) {//判断渠道编码是否为igirl-channel渠道,若是返回渠道码对应商标来源类型
if (!channelCodeToTmSourceType || !channelcode) { if (!channelCodeToTmSourceType || !channelcode) {
return null; return null;
...@@ -18,6 +20,7 @@ class TrademarkDao extends Dao { ...@@ -18,6 +20,7 @@ class TrademarkDao extends Dao {
return null; return null;
} }
} }
judgeTmSourceType(type) {//判断商标来源类型是否为igirl-channel来源,若是返回来源类型对应渠道码 judgeTmSourceType(type) {//判断商标来源类型是否为igirl-channel来源,若是返回来源类型对应渠道码
if (!tmSourceTypeToChannelCode || !type) { if (!tmSourceTypeToChannelCode || !type) {
return null; return null;
...@@ -28,31 +31,34 @@ class TrademarkDao extends Dao { ...@@ -28,31 +31,34 @@ class TrademarkDao extends Dao {
return null; return null;
} }
} }
orderBy() { orderBy() {
//return {"key":"include","value":{model:this.db.models.app}}; //return {"key":"include","value":{model:this.db.models.app}};
return [["lastUp", "DESC"]]; return [["lastUp", "DESC"]];
} }
extraWhere(obj, w) { extraWhere(obj, w) {
if (obj.codepath && obj.codepath != "") { if (obj.codepath && obj.codepath != "") {
if (obj.codepath.indexOf("alltrademark") < 0 && obj.codepath.indexOf("allfqtm") < 0) { if (obj.codepath.indexOf("alltrademark") < 0 && obj.codepath.indexOf("allfqtm") < 0) {
// 改成当前登录者的onlyCode进行查不同平台的用户提报的商标数据 // 改成当前登录者的onlyCode进行查不同平台的用户提报的商标数据
var whereArray = []; var whereArray = [];
if (obj.onlyCode) { if (obj.onlyCodes) {
whereArray.push({ [this.db.Op.and]: [{ onlyCode: obj.onlyCode }] }); whereArray.push({[this.db.Op.or]: [{onlyCode: { [this.db.Op.in]: obj.onlyCodes }},
{mobile: { [this.db.Op.in]: obj.mobiles }}]});
} }
if (obj.mobile) { if (obj.mobile) {
whereArray.push({ [this.db.Op.and]: [{ mobile: obj.mobile }] }); whereArray.push({[this.db.Op.and]: [{mobile: obj.mobile}]});
} }
if (obj.uid) { if (obj.uid) {
whereArray.push({ [this.db.Op.and]: [{ user_id: obj.uid }] }); whereArray.push({[this.db.Op.and]: [{user_id: obj.uid}]});
} }
w[this.db.Op.or] = whereArray; w[this.db.Op.or] = whereArray;
} }
else { else {
//----平台的运营人员可以看全部的商标信息 //----平台的运营人员可以看全部的商标信息
var whereArray = []; var whereArray = [];
whereArray.push({ [this.db.Op.and]: [{ channelPayStatus: "yzf" }] }); whereArray.push({[this.db.Op.and]: [{channelPayStatus: "yzf"}]});
whereArray.push({ [this.db.Op.and]: [{ channelPayStatus: "wzf" },{ tmSourceType: "32" }] }); whereArray.push({[this.db.Op.and]: [{channelPayStatus: "wzf"}, {tmSourceType: "32"}]});
w[this.db.Op.or] = whereArray; w[this.db.Op.or] = whereArray;
//----平台的运营人员可以看全部的商标信息 //----平台的运营人员可以看全部的商标信息
// w["channelPayStatus"] = "yzf"; // w["channelPayStatus"] = "yzf";
...@@ -60,31 +66,36 @@ class TrademarkDao extends Dao { ...@@ -60,31 +66,36 @@ class TrademarkDao extends Dao {
} }
return w; return w;
} }
async getTmByOrderNumStatus(orderNum, tmStatus) { async getTmByOrderNumStatus(orderNum, tmStatus) {
//根据订单号及状态查询商标 //根据订单号及状态查询商标
var qc = { var qc = {
'where': { 'orderNum': orderNum, 'tmStatus': tmStatus } 'where': {'orderNum': orderNum, 'tmStatus': tmStatus}
}; };
var apps = await this.model.findAndCountAll(qc); var apps = await this.model.findAndCountAll(qc);
return apps; return apps;
} }
async getTmByOrderNum(orderNum) { async getTmByOrderNum(orderNum) {
var qc = { var qc = {
'where': { 'orderNum': orderNum } 'where': {'orderNum': orderNum}
}; };
var apps = await this.model.findAndCountAll(qc); var apps = await this.model.findAndCountAll(qc);
return apps; return apps;
} }
async getTmsByCalcId(calcId) { async getTmsByCalcId(calcId) {
var qc = { var qc = {
'where': { 'nclCalc_id': calcId } 'where': {'nclCalc_id': calcId}
}; };
var apps = await this.model.findAndCountAll(qc); var apps = await this.model.findAndCountAll(qc);
return apps; return apps;
} }
async deleteByOrderNum(orderNum, t) { async deleteByOrderNum(orderNum, t) {
var en = await this.model.destroy({ where: { orderNum: orderNum } }, { transaction: t }); var en = await this.model.destroy({where: {orderNum: orderNum}}, {transaction: t});
return en; return en;
} }
} }
module.exports = TrademarkDao; module.exports = TrademarkDao;
...@@ -5,6 +5,9 @@ const uiconfig = system.getUiConfig2(settings.wxconfig.appId); ...@@ -5,6 +5,9 @@ const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
const logCtl = system.getObject("web.oplogCtl"); const logCtl = system.getObject("web.oplogCtl");
const uuidv4 = require('uuid/v4'); const uuidv4 = require('uuid/v4');
const fs = require("fs"); const fs = require("fs");
const aliyunClient = require('../../utils/aliyunClient.js');
// let fqReqUrl = "https://yunfuapi-dev.gongsibao.com";//dev域名
let fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名
class TrademarkService extends ServiceBase { class TrademarkService extends ServiceBase {
constructor() { constructor() {
...@@ -23,6 +26,7 @@ class TrademarkService extends ServiceBase { ...@@ -23,6 +26,7 @@ class TrademarkService extends ServiceBase {
this.channelApiUrl = settings.channelApiUrl(); this.channelApiUrl = settings.channelApiUrl();
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
this.channelreceiveDao = system.getObject("db.channelreceiveDao"); this.channelreceiveDao = system.getObject("db.channelreceiveDao");
this.aliyunClient = new aliyunClient();
this.tm_submit_status = { this.tm_submit_status = {
"WAITARTIFICIALEXAMINE": "等待人工审核", "WAITARTIFICIALEXAMINE": "等待人工审核",
"1": "商标注册申请书", "1": "商标注册申请书",
...@@ -81,6 +85,15 @@ class TrademarkService extends ServiceBase { ...@@ -81,6 +85,15 @@ class TrademarkService extends ServiceBase {
return "tbKeyAllotData_" + key; return "tbKeyAllotData_" + key;
} }
async findAndCountAll(obj) { async findAndCountAll(obj) {
if (obj.onlyCode){
let users = await this.getuseridsByleadid(obj.onlyCode.split("_")[1]);
obj.onlyCodes = [obj.onlyCode];
obj.mobiles = [];
users.forEach(uobj=>{
obj.onlyCodes.push(`ar_${uobj.userid}_gsb_zcsubmit`);
obj.mobiles.push(uobj.phone)
})
}
var apps = await this.dao.findAndCountAll(obj); var apps = await this.dao.findAndCountAll(obj);
var rows = apps.rows; var rows = apps.rows;
var count = rows.length; var count = rows.length;
...@@ -1694,6 +1707,18 @@ class TrademarkService extends ServiceBase { ...@@ -1694,6 +1707,18 @@ class TrademarkService extends ServiceBase {
} }
return { code: -101, msg: "未知申请人" }; return { code: -101, msg: "未知申请人" };
} }
async getuseridsByleadid(userid) {
let url = fqReqUrl + '/cloudapi/employee/useridsByleadId';
let body = {
'userid': userid,
};
let res = await this.aliyunClient.postig(url, body);
if (res.code == 200) {
return res.data.useridList
}
return []
}
} }
module.exports = TrademarkService; module.exports = TrademarkService;
// var task = new TrademarkService(); // var task = new 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