Commit f9514670 by 王悦

add 需求未推送预警

parent d1fb9d83
//tag规则 release-v188.19.* 同步fqboss状态到峰擎 //tag规则 release-v188.19.* 同步fqboss状态到峰擎/检查10分钟未推送的任务并发短信
const TaskBase = require("../../task.base"); const TaskBase = require("../../task.base");
const system = require("../../../system"); const system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
class pushAliTmStatus2Fq extends TaskBase { class pushAliTmStatus2Fq extends TaskBase {
constructor() { constructor() {
super(TaskBase.getServiceName(TmtransferTask)); super(TaskBase.getServiceName(pushAliTmStatus2Fq));
this.restclient = system.getObject("util.restClient"); this.restclient = system.getObject("util.restClient");
this.smsClient = system.getObject("util.smsClient");
this.fqbossUrl = settings.fqbossUrl(); this.fqbossUrl = settings.fqbossUrl();
this.centerchannel = "https://gsbweb.qifu-dev.gongsibao.com/"//settings.centerChannelUrl();
this.phone = ["17001277629","13381139519","15010929366"]//李学超 蒋勇 宋毅
} }
async beforeTask(params) { async beforeTask(params) {
console.log("前置操作......", this.serviceName); console.log("前置操作......", this.serviceName);
...@@ -19,6 +22,32 @@ class pushAliTmStatus2Fq extends TaskBase { ...@@ -19,6 +22,32 @@ class pushAliTmStatus2Fq extends TaskBase {
try { try {
var url = this.fqbossUrl + "api/tmInfoPusherApi/collectInfo"; var url = this.fqbossUrl + "api/tmInfoPusherApi/collectInfo";
this.restclient.execGet(null, url); this.restclient.execGet(null, url);
let now = Date.now()
var needurl = this.centerchannel + "web/action/opNeed/springBoard";
this.restclient.execPost({
actionType:"getNeedComparisonList",
actionBody:{
"start": new Date(now - 10 * 60 * 1000),
"end": new Date(now),
"status": "wts",
"listType": "business",
"pageNum": 1,
"pageSize": 10,
tag:"need"
}
}, needurl).then(res=>{
if (res.stdout){
var data = JSON.parse(res.stdout);
if (data.data&&data.data.rows&&data.data.total>0){
let content = `⚠️⚠️⚠️️报警⚠️⚠️⚠️️ : ️️10分钟内有${data.data.total}条未推送的需求❗️❗️❗️`
this.phone.forEach(phone=>{
this.smsClient.sendMsg(phone,content)
})
}
}
}).catch(e=>{
console.log(e)
})
return system.getResultSuccess(); return system.getResultSuccess();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
...@@ -26,4 +55,6 @@ class pushAliTmStatus2Fq extends TaskBase { ...@@ -26,4 +55,6 @@ class pushAliTmStatus2Fq extends TaskBase {
} }
} }
} }
let a = new pushAliTmStatus2Fq()
a.subDoTask()
module.exports = pushAliTmStatus2Fq; module.exports = pushAliTmStatus2Fq;
\ No newline at end of file
const system=require("../system");
class SmsClient{
constructor(){
this.smsTeml="http://123.57.156.109:4103/api/Send";
this.restClient=system.getObject("util.restClient");
}
async sendMsg(to,content){
var txtObj ={
"appId":8,
"mobilePhone":to,
"content":content
}
return this.restClient.execPost(txtObj,this.smsTeml);
}
}
module.exports=SmsClient;
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