20260303:修复bug,1.系统管理-通知公告-文档;2.微信公众号通知模板内容调整
This commit is contained in:
parent
0ad130fcc2
commit
90da58d73e
@ -37,6 +37,10 @@ public class AlertPushParams {
|
||||
* 告警发生地点
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 告警内容
|
||||
*/
|
||||
private String alertContent;
|
||||
/**
|
||||
* 告警名称
|
||||
*/
|
||||
|
||||
@ -112,14 +112,14 @@ public class SceneContext {
|
||||
// 执行动作
|
||||
} else if (scriptTemplate.getPurpose() == 3) {
|
||||
scene_logger.info("[{}]=====+>符合触发条件!", requestId);
|
||||
if (scriptTemplate.getCheckdelay() != 0) {
|
||||
if (scriptTemplate.getCheckdelay() != 0 || scriptTemplate.getDelay() != 0) {
|
||||
// 告警恢复规则 设备上线触发 不加载
|
||||
if (scriptTemplate.getSource() != 5 && type != 5) {
|
||||
loadDelayTrigger(scriptTemplate);
|
||||
}
|
||||
} else {
|
||||
// 执行动作,延迟执行,线程休眠 delay x 1000毫秒
|
||||
Thread.sleep(scriptTemplate.getDelay() * 1000L);
|
||||
// Thread.sleep(scriptTemplate.getDelay() * 1000L);
|
||||
if (scriptTemplate.getSource() == 4) {
|
||||
// 存在相同未处理告警只记录 不触发告警通知和动作
|
||||
if (checkDeviceAlerting(scriptTemplate.getSceneId(), requestId, this.deviceNum)) {
|
||||
@ -360,6 +360,7 @@ public class SceneContext {
|
||||
String key = "CHECK_" + scriptTemplate.getSceneId() + deviceNum;
|
||||
// 默认上线执行告警恢复 在延迟匹配周期内不告警
|
||||
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
|
||||
int delayTime = scriptTemplate.getCheckdelay() > 0 ? scriptTemplate.getCheckdelay() : scriptTemplate.getDelay();
|
||||
executor.schedule(() -> {
|
||||
// 设备未上线,则执行告警任务
|
||||
if (scriptTemplate.getSource() == 4) {
|
||||
@ -369,7 +370,7 @@ public class SceneContext {
|
||||
// 下发指令
|
||||
this.send(scriptTemplate);
|
||||
}
|
||||
}, scriptTemplate.getCheckdelay(), TimeUnit.SECONDS);
|
||||
}, delayTime, TimeUnit.SECONDS);
|
||||
scene_logger.info("[{}]=====+>延时执行告警任务:{}", requestId, key);
|
||||
ruleService.addCheckTask(key, executor);
|
||||
}
|
||||
@ -512,6 +513,8 @@ public class SceneContext {
|
||||
}
|
||||
alertPushParams.setAddress(address);
|
||||
alertPushParams.setAlertTime(DateUtils.parseDateToStr(DateUtils.YY_MM_DD_HH_MM_SS, new Date()));
|
||||
// 告警内容 格式:id:value
|
||||
alertPushParams.setAlertContent(sceneThingsModelItem.getId() + ":" + sceneThingsModelItem.getValue());
|
||||
return alertPushParams;
|
||||
}
|
||||
|
||||
|
||||
@ -164,6 +164,9 @@ public class NotifySendServiceImpl implements NotifySendService {
|
||||
map.put(variables.get(i), alertPushParams.getSerialNumber());
|
||||
} else if (i == 2) {
|
||||
map.put(variables.get(i), alertPushParams.getAddress());
|
||||
} else if (i == 3) {
|
||||
// 报警内容
|
||||
map.put(variables.get(i), alertPushParams.getAlertContent());
|
||||
} else {
|
||||
map.put(variables.get(i), alertPushParams.getAlertName());
|
||||
}
|
||||
|
||||
@ -34,6 +34,15 @@
|
||||
|
||||
<script>
|
||||
import { getToken } from "@/utils/auth";
|
||||
import request from "@/utils/request";
|
||||
|
||||
function getBaseUrl() {
|
||||
try {
|
||||
return (request && request.defaults && request.defaults.baseURL) ? request.defaults.baseURL : '';
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "FileUpload",
|
||||
@ -62,14 +71,14 @@ export default {
|
||||
},
|
||||
uploadFileUrl: {
|
||||
type: String,
|
||||
default: process.env.VUE_APP_BASE_API + "/iot/tool/upload",
|
||||
default: () => getBaseUrl() + "/iot/tool/upload",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
number: 0,
|
||||
uploadList: [],
|
||||
baseUrl: process.env.VUE_APP_BASE_API,
|
||||
baseUrl: getBaseUrl(),
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
},
|
||||
|
||||
@ -93,12 +93,12 @@
|
||||
<!-- 文档类型时显示文件上传 -->
|
||||
<el-col :span="24" v-if="form.noticeType == '3'">
|
||||
<el-form-item label="文档上传" prop="filePath">
|
||||
<file-upload
|
||||
v-model="form.filePath"
|
||||
<file-upload
|
||||
v-model="form.filePath"
|
||||
:file-type="['pdf', 'doc', 'docx']"
|
||||
:file-size="50"
|
||||
:limit="1"
|
||||
:upload-file-url="process.env.VUE_APP_BASE_API + '/common/upload'"
|
||||
:upload-file-url="uploadFileUrl"
|
||||
></file-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -122,6 +122,7 @@
|
||||
<script>
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from '@/api/system/notice';
|
||||
import FileUpload from '@/components/FileUpload';
|
||||
import request from '@/utils/request';
|
||||
|
||||
export default {
|
||||
name: 'Notice',
|
||||
@ -129,6 +130,13 @@ export default {
|
||||
FileUpload
|
||||
},
|
||||
dicts: ['sys_notice_status', 'sys_notice_type'],
|
||||
computed: {
|
||||
/** 文档上传地址,避免在模板中直接使用 process.env 导致 undefined 报错 */
|
||||
uploadFileUrl() {
|
||||
const base = (request && request.defaults && request.defaults.baseURL) ? request.defaults.baseURL : '';
|
||||
return base + '/common/upload';
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -164,15 +172,15 @@ export default {
|
||||
noticeTitle: [{ required: true, message: this.$t('system.notice.670989-9'), trigger: 'blur' }],
|
||||
noticeType: [{ required: true, message: this.$t('system.notice.670989-10'), trigger: 'change' }],
|
||||
filePath: [
|
||||
{
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (this.form.noticeType == '3' && !value) {
|
||||
callback(new Error('文档类型必须上传文件'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user