小修改
This commit is contained in:
parent
bbdd880bcf
commit
9e69f5481e
|
@ -401,17 +401,9 @@ class ClientMapper {
|
|||
}
|
||||
|
||||
async queryWarnInfos(warningInfo: WarningInfo) {
|
||||
const {
|
||||
address,
|
||||
devName,
|
||||
type,
|
||||
status,
|
||||
pageSize = 10,
|
||||
pageNo = 1,
|
||||
} = warningInfo;
|
||||
let sql = `select a.id,a.dev_name as devName,a.room,a.create_time as createTime,d.hcc_id as hccId,h.address_detail as address
|
||||
from szja_device_alarm_info a
|
||||
left join szja_device_data d on d.dev_id = a.dev_id
|
||||
const { address, devName, pageSize = 10, pageNo = 1 } = warningInfo;
|
||||
let sql = `select d.id,d.dev_name as devName,d.room,d.create_time as createTime,d.hcc_id as hccId,h.address_detail as address
|
||||
from szja_device_data d
|
||||
left join szja_hcc_info h on d.hcc_id = h.id `;
|
||||
const arr = [];
|
||||
let bool = false;
|
||||
|
|
|
@ -195,35 +195,35 @@ client.on('close', async () => {
|
|||
client.subscribe(['1/req/#', '1/rsp/#', '$SYS/brokers/+/clients/#']);
|
||||
|
||||
// 查询家庭数据
|
||||
setInterval(async () => {
|
||||
// console.log(`${moment().format('YYYY-MM-DD hh:mm:ss')}查询家庭数据`);
|
||||
const reqId = stringRandom(16);
|
||||
const hccId = 'e6ca693e-a803-4ef4-91d6-e16131536937';
|
||||
const hccInfo = await hccMapper.getInfoByHccId(
|
||||
'e6ca693e-a803-4ef4-91d6-e16131536937',
|
||||
);
|
||||
let seId;
|
||||
if (hccInfo.length) {
|
||||
seId = hccInfo[0].se_id;
|
||||
}
|
||||
const obj = {
|
||||
cmd: '7',
|
||||
reqId,
|
||||
payload: { dataType: '01', mpId: '6433be833832fb000180193e' },
|
||||
};
|
||||
// 调用加密接口
|
||||
const info = await mqttService.encrypt(seId, getConfig().keyAlias, obj);
|
||||
if (!info) {
|
||||
console.log('mqtt加密失败');
|
||||
return;
|
||||
}
|
||||
// await mqttMapper.updateLog(1);
|
||||
client.publish(`2/req/${hccId}`, JSON.stringify({ message: info }), () => {
|
||||
// 记录reqid,放入全局缓存
|
||||
globalConfig.reqIdMap.set(reqId, null);
|
||||
// console.log('通知成功');
|
||||
});
|
||||
}, 500);
|
||||
// setInterval(async () => {
|
||||
// console.log(`${moment().format('YYYY-MM-DD hh:mm:ss')}查询家庭数据`);
|
||||
// const reqId = stringRandom(16);
|
||||
// const hccId = 'e6ca693e-a803-4ef4-91d6-e16131536937';
|
||||
// const hccInfo = await hccMapper.getInfoByHccId(
|
||||
// 'e6ca693e-a803-4ef4-91d6-e16131536937',
|
||||
// );
|
||||
// let seId;
|
||||
// if (hccInfo.length) {
|
||||
// seId = hccInfo[0].se_id;
|
||||
// }
|
||||
// const obj = {
|
||||
// cmd: '7',
|
||||
// reqId,
|
||||
// payload: { dataType: '01', mpId: '6433be833832fb000180193e' },
|
||||
// };
|
||||
// // 调用加密接口
|
||||
// const info = await mqttService.encrypt(seId, getConfig().keyAlias, obj);
|
||||
// if (!info) {
|
||||
// console.log('mqtt加密失败');
|
||||
// return;
|
||||
// }
|
||||
// // await mqttMapper.updateLog(1);
|
||||
// client.publish(`2/req/${hccId}`, JSON.stringify({ message: info }), () => {
|
||||
// // 记录reqid,放入全局缓存
|
||||
// globalConfig.reqIdMap.set(reqId, null);
|
||||
// // console.log('通知成功');
|
||||
// });
|
||||
// }, 500);
|
||||
|
||||
export default client;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user