Commit f63e2da2 by 王栋源

wdy

parent 6e8a5f53
......@@ -8,23 +8,25 @@ class TmtransactionApi extends ApiBase {
this.trademarktransactionSve = System.getObject("service.trademarktransactionSve");
this.companyS = System.getObject("service.companySve");
this.utilstmtasktradeSve = System.getObject("service.utilstmtasktradeSve");
this.pytmreportSve = System.getObject("service.pytmreportSve");
this.mailClient = System.getObject("util.mailClient");
};
//获取某类型的交易商标 post
async findByTmType(obj){
if(!obj.company_id){
async findByTmType(obj) {
if (!obj.company_id) {
//获取当前域名
var hostname = "jiaoyi.gongsibao.com";
// console.log("xccccccccccccccccccccccccccccccccccccccc", hostname);
//按照hostname去查找公司站点信息
var companytmp = await this.companyS.findOne({ domainname: hostname, isEnabled: true });
if(companytmp){
obj.company_id=companytmp.id;
if (companytmp) {
obj.company_id = companytmp.id;
}
}
try {
return this.trademarktransactionSve.findByTmType(obj);
} catch (error) {
return {code:-200,msg:"操作失败"};
return { code: -200, msg: "操作失败" };
}
}
......@@ -44,5 +46,52 @@ class TmtransactionApi extends ApiBase {
console.log(e.stack, "ttttttttt...............");
}
}
async tmreport() {
var id = await this.redisClient.lpop("create_tmrepotCache");
// console.log(id, "商标检索报告执行开始.................");
if (id) {
var info = await this.pytmreportSve.dao.findById(id);
console.log(info.dataValues);
if (info) {
var url = "http://43.247.184.92:8015/tmdoc/api/createdoc?mycompanyname=" + encodeURIComponent(info.companyname);
var rc = system.getObject("util.execClient");
var rtn = null;
try {
rtn = await rc.execGetTimeOut({}, url, 300000);
var j = rtn.stdout;
// var j="https://gsb-zc.oss-cn-beijing.aliyuncs.com/北京创知厚德科技有限公司_20190822014212_tmreport.docx"
// console.log("fanhui");
console.log(j);
if (j.indexOf("gsb-zc.oss-cn-beijing.aliyuncs.com") >= 0) {
var text = "企业监控报告";
var html = '<a href="' + j + '">企业监控报告</a>'
var mresult = this.mailClient.sendMsg(info.email, "企业监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
}
info.dataValues.filepath = j;
info.dataValues.status = 1;
var result = await this.pytmreportSve.dao.model.update(info.dataValues, { where: { id: id } });
logCtl.info({
optitle: "商标检索报告执行结果",
op: "/igirl-web/app/base/db/task/CreatetmrepotTask.js",
content: "id=" + id + "执行结果:" + j,
clientIp: ""
});
return result;
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "商标检索报告执行结果-error",
op: "/igirl-web/app/base/db/task/CreatetmrepotTask.js",
content: e.stack,
clientIp: ""
});
return { code: -200, msg: "操作失败" };
}
}
}
}
}
module.exports = TmtransactionApi;
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