Commit 07dbc509 by 王悦

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

parent 22145abe
......@@ -4,87 +4,98 @@ const settings = require("../../../config/settings");
const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
const tmSourceTypeToChannelCode = uiconfig.config.pdict.tmSourceTypeToChannelCode;//商标来源对应渠道码
const channelCodeToTmSourceType = uiconfig.config.pdict.channelCodeToTmSourceType;//渠道码对应商标来源
class TrademarkDao extends Dao {
constructor() {
super(Dao.getModelName(TrademarkDao));
}
judgeChannelCode(channelcode) {//判断渠道编码是否为igirl-channel渠道,若是返回渠道码对应商标来源类型
if (!channelCodeToTmSourceType || !channelcode) {
return null;
constructor() {
super(Dao.getModelName(TrademarkDao));
}
if (channelCodeToTmSourceType.hasOwnProperty(channelcode)) {
return channelCodeToTmSourceType[channelcode];
} else {
return null;
}
}
judgeTmSourceType(type) {//判断商标来源类型是否为igirl-channel来源,若是返回来源类型对应渠道码
if (!tmSourceTypeToChannelCode || !type) {
return null;
}
if (tmSourceTypeToChannelCode.hasOwnProperty(type)) {
return tmSourceTypeToChannelCode[type];
} else {
return null;
judgeChannelCode(channelcode) {//判断渠道编码是否为igirl-channel渠道,若是返回渠道码对应商标来源类型
if (!channelCodeToTmSourceType || !channelcode) {
return null;
}
if (channelCodeToTmSourceType.hasOwnProperty(channelcode)) {
return channelCodeToTmSourceType[channelcode];
} else {
return null;
}
}
}
orderBy() {
//return {"key":"include","value":{model:this.db.models.app}};
return [["lastUp", "DESC"]];
}
extraWhere(obj, w) {
if (obj.codepath && obj.codepath != "") {
if (obj.codepath.indexOf("alltrademark") < 0 && obj.codepath.indexOf("allfqtm") < 0) {
// 改成当前登录者的onlyCode进行查不同平台的用户提报的商标数据
var whereArray = [];
if (obj.onlyCode) {
whereArray.push({ [this.db.Op.and]: [{ onlyCode: obj.onlyCode }] });
judgeTmSourceType(type) {//判断商标来源类型是否为igirl-channel来源,若是返回来源类型对应渠道码
if (!tmSourceTypeToChannelCode || !type) {
return null;
}
if (obj.mobile) {
whereArray.push({ [this.db.Op.and]: [{ mobile: obj.mobile }] });
if (tmSourceTypeToChannelCode.hasOwnProperty(type)) {
return tmSourceTypeToChannelCode[type];
} else {
return null;
}
if (obj.uid) {
whereArray.push({ [this.db.Op.and]: [{ user_id: obj.uid }] });
}
orderBy() {
//return {"key":"include","value":{model:this.db.models.app}};
return [["lastUp", "DESC"]];
}
extraWhere(obj, w) {
if (obj.codepath && obj.codepath != "") {
if (obj.codepath.indexOf("alltrademark") < 0 && obj.codepath.indexOf("allfqtm") < 0) {
// 改成当前登录者的onlyCode进行查不同平台的用户提报的商标数据
var whereArray = [];
if (obj.onlyCodes) {
whereArray.push({[this.db.Op.or]: [{onlyCode: { [this.db.Op.in]: obj.onlyCodes }},
{mobile: { [this.db.Op.in]: obj.mobiles }}]});
}
if (obj.mobile) {
whereArray.push({[this.db.Op.and]: [{mobile: obj.mobile}]});
}
if (obj.uid) {
whereArray.push({[this.db.Op.and]: [{user_id: obj.uid}]});
}
w[this.db.Op.or] = whereArray;
}
else {
//----平台的运营人员可以看全部的商标信息
var whereArray = [];
whereArray.push({[this.db.Op.and]: [{channelPayStatus: "yzf"}]});
whereArray.push({[this.db.Op.and]: [{channelPayStatus: "wzf"}, {tmSourceType: "32"}]});
w[this.db.Op.or] = whereArray;
//----平台的运营人员可以看全部的商标信息
// w["channelPayStatus"] = "yzf";
}
}
w[this.db.Op.or] = whereArray;
}
else {
//----平台的运营人员可以看全部的商标信息
var whereArray = [];
whereArray.push({ [this.db.Op.and]: [{ channelPayStatus: "yzf" }] });
whereArray.push({ [this.db.Op.and]: [{ channelPayStatus: "wzf" },{ tmSourceType: "32" }] });
w[this.db.Op.or] = whereArray;
//----平台的运营人员可以看全部的商标信息
// w["channelPayStatus"] = "yzf";
}
return w;
}
async getTmByOrderNumStatus(orderNum, tmStatus) {
//根据订单号及状态查询商标
var qc = {
'where': {'orderNum': orderNum, 'tmStatus': tmStatus}
};
var apps = await this.model.findAndCountAll(qc);
return apps;
}
async getTmByOrderNum(orderNum) {
var qc = {
'where': {'orderNum': orderNum}
};
var apps = await this.model.findAndCountAll(qc);
return apps;
}
async getTmsByCalcId(calcId) {
var qc = {
'where': {'nclCalc_id': calcId}
};
var apps = await this.model.findAndCountAll(qc);
return apps;
}
async deleteByOrderNum(orderNum, t) {
var en = await this.model.destroy({where: {orderNum: orderNum}}, {transaction: t});
return en;
}
return w;
}
async getTmByOrderNumStatus(orderNum, tmStatus) {
//根据订单号及状态查询商标
var qc = {
'where': { 'orderNum': orderNum, 'tmStatus': tmStatus }
};
var apps = await this.model.findAndCountAll(qc);
return apps;
}
async getTmByOrderNum(orderNum) {
var qc = {
'where': { 'orderNum': orderNum }
};
var apps = await this.model.findAndCountAll(qc);
return apps;
}
async getTmsByCalcId(calcId) {
var qc = {
'where': { 'nclCalc_id': calcId }
};
var apps = await this.model.findAndCountAll(qc);
return apps;
}
async deleteByOrderNum(orderNum, t) {
var en = await this.model.destroy({ where: { orderNum: orderNum } }, { transaction: t });
return en;
}
}
module.exports = TrademarkDao;
......@@ -5,6 +5,9 @@ const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
const logCtl = system.getObject("web.oplogCtl");
const uuidv4 = require('uuid/v4');
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 {
constructor() {
......@@ -23,6 +26,7 @@ class TrademarkService extends ServiceBase {
this.channelApiUrl = settings.channelApiUrl();
this.execClient = system.getObject("util.execClient");
this.channelreceiveDao = system.getObject("db.channelreceiveDao");
this.aliyunClient = new aliyunClient();
this.tm_submit_status = {
"WAITARTIFICIALEXAMINE": "等待人工审核",
"1": "商标注册申请书",
......@@ -81,6 +85,15 @@ class TrademarkService extends ServiceBase {
return "tbKeyAllotData_" + key;
}
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 rows = apps.rows;
var count = rows.length;
......@@ -1694,6 +1707,18 @@ class TrademarkService extends ServiceBase {
}
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;
// 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