Browse Source

视频异常中添加异常类型

dev
deartibers 2 years ago
parent
commit
bb643a0562
  1. 36
      api/app/lib/controllers/alarm/video.js
  2. 3
      api/app/lib/routes/alarm/index.js
  3. 6
      web/client/src/sections/install/containers/system.jsx
  4. 11
      web/client/src/sections/problem/actions/problem.jsx
  5. 15
      web/client/src/sections/problem/components/tableData.jsx
  6. 7
      web/client/src/sections/problem/containers/dataAlarm.jsx
  7. 1
      web/client/src/utils/webapi.js

36
api/app/lib/controllers/alarm/video.js

@ -38,6 +38,39 @@ async function deviceType (ctx) {
} }
} }
async function exceptionType(ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
const { database: anxinyun } = clickHouse.anxinyun.opts.config
const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs
let anxinStruc = await anxinStrucIdRange({
ctx,
})
const anxinStrucIds = anxinStruc.map(a => a.strucId)
const statusRes = await clickHouse.vcmp.query(`
SELECT DISTINCT
camera_status.id AS statusId,camera_status.describe AS describe
FROM camera_status
INNER JOIN camera_status_alarm
ON camera_status.id = camera_status_alarm.status_id
INNER JOIN ${anxinyun}.t_video_ipc
ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no
AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no
${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})`}
`).toPromise()
ctx.status = 200;
ctx.body = statusRes
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
async function alarmList (ctx) { async function alarmList (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -461,5 +494,6 @@ module.exports = {
alarmList, alarmList,
confirm, confirm,
alarmAdded, alarmAdded,
vcmpAppAuthToken vcmpAppAuthToken,
exceptionType
}; };

3
api/app/lib/routes/alarm/index.js

@ -60,4 +60,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/vcmp/auth'] = { content: '获取视频平台应用鉴权token', visible: true }; app.fs.api.logAttr['GET/vcmp/auth'] = { content: '获取视频平台应用鉴权token', visible: true };
router.get('/vcmp/auth', videoAlarm.vcmpAppAuthToken); router.get('/vcmp/auth', videoAlarm.vcmpAppAuthToken);
app.fs.api.logAttr['GET/alarm/video/exception_statusId'] = { content: '查询视频异常类型', visible: true };
router.get('/alarm/video/exception_statusId', videoAlarm.exceptionType);
}; };

6
web/client/src/sections/install/containers/system.jsx

@ -229,7 +229,7 @@ const Example = (props) => {
dataIndex: "createTime", dataIndex: "createTime",
key: 'time', key: 'time',
render: (_, row) => { render: (_, row) => {
return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss") return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss")||'无';
} }
}, },
{ {
@ -237,7 +237,7 @@ const Example = (props) => {
dataIndex: "updateTime", dataIndex: "updateTime",
key: 'updateTime', key: 'updateTime',
render: (_, row) => { render: (_, row) => {
return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss") return (row.updateTime?moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss"):moment(row.createTime).format("YYYY-MM-DD HH:mm:ss"));
} }
}, },
{ {
@ -245,7 +245,7 @@ const Example = (props) => {
dataIndex: "pepUserName", dataIndex: "pepUserName",
key: 'pepUserName', key: 'pepUserName',
render: (_, row) => { render: (_, row) => {
return row.pepUserName return row.pepUserName||'无'
} }
}, },
{ {

11
web/client/src/sections/problem/actions/problem.jsx

@ -149,6 +149,17 @@ export function getAlarmVideoDeviceKind () { //查询视频设备类型
}); });
} }
export function getAlarmVideoExceptionStatusId () { //
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_ALARM_VIDEO_EXCEPTION_STATUS_ID',
url: `${ApiTable.getAlarmVideoExceptionStatusId}`,
msg: { option: '查询视频异常类型' },
reducer: { name: '' }
});
}
export function putAlarmVideoConfirm (data) { // export function putAlarmVideoConfirm (data) { //
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',

15
web/client/src/sections/problem/components/tableData.jsx

@ -10,14 +10,14 @@ import qs from "qs";
const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition, pepProjectId, const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition, pepProjectId,
selected, setSelected, setIfBulk, setConfirm, genre, setGenre, query, setQuery, tableData, setTableData, location, user }) => { selected, setSelected, setIfBulk, setConfirm, genre, setGenre, query, setQuery, tableData, setTableData, location, user, statusId, setStatusId}) => {
const { problem } = actions const { problem } = actions
const [count, setCount] = useState(0) // const [count, setCount] = useState(0) //
const [checkAll, setCheckAll] = useState(true) // const [checkAll, setCheckAll] = useState(true) //
const api = useRef(); const api = useRef();
const search = useRef({ const search = useRef({
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', statusId:'',
errType: '', confirmState: '', onlineState: '', sustainTimeStart: '', sustainTimeEnd: '' errType: '', confirmState: '', onlineState: '', sustainTimeStart: '', sustainTimeEnd: ''
}) })
const kindName = useRef() const kindName = useRef()
@ -153,12 +153,17 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
setGenre(res.payload.data.map(v => ({ name: v.kind, value: v.id }))) setGenre(res.payload.data.map(v => ({ name: v.kind, value: v.id })))
} }
}) })
dispatch(problem.getAlarmVideoExceptionStatusId()).then((res) => {
if (res.success) {
setStatusId(res.payload.data.map(v => ({ name: v.describe, value: v.statusId })))
}
})
} }
}, []) }, [])
const handleExport = () => { const handleExport = () => {
let url = '' let url = ''
let { keywordTarget, keyword = '', errType = '', state = '', kindId = '', groupUnitId = '', confirmState = '', onlineState = '', sustainTimeStart = '', sustainTimeEnd = '' } = search.current let { keywordTarget, keyword = '', errType = '', state = '', kindId = '', statusId = '', groupUnitId = '', confirmState = '', onlineState = '', sustainTimeStart = '', sustainTimeEnd = '' } = search.current
switch (route) { switch (route) {
case 'useAbnormal': case 'useAbnormal':
url = `alarm/application/api?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType} url = `alarm/application/api?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType}
@ -166,7 +171,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
break; break;
case 'videoAbnormal': case 'videoAbnormal':
url = `alarm/video/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keywordTarget=${keywordTarget} url = `alarm/video/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keywordTarget=${keywordTarget}
&keyword=${keyword}&kindId=${kindId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd} &keyword=${keyword}&kindId=${kindId}&statusId=${statusId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}
&pepProjectId=${pepProjectId || ''}` &pepProjectId=${pepProjectId || ''}`
break; break;
default: default:
@ -277,6 +282,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
keywordTarget: v.keywordTarget, keywordTarget: v.keywordTarget,
keyword: v.keyword, keyword: v.keyword,
kindId: v.kindId, kindId: v.kindId,
statusId: v.statusId,
groupUnitId: v.groupUnitId, groupUnitId: v.groupUnitId,
errType: v.errType, errType: v.errType,
confirmState: v.confirmState, confirmState: v.confirmState,
@ -299,6 +305,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
keywordTarget: v.keywordTarget, keywordTarget: v.keywordTarget,
keyword: v.keyword, keyword: v.keyword,
kindId: v.kindId, kindId: v.kindId,
statusId: v.statusId,
groupUnitId: v.groupUnitId, groupUnitId: v.groupUnitId,
errType: v.errType, errType: v.errType,
confirmState: v.confirmState, confirmState: v.confirmState,

7
web/client/src/sections/problem/containers/dataAlarm.jsx

@ -31,6 +31,7 @@ const DataAlarm = (props) => {
const [content, setContent] = useState(false); // const [content, setContent] = useState(false); //
const [selected, setSelected] = useState([]) // const [selected, setSelected] = useState([]) //
const [genre, setGenre] = useState([]) // const [genre, setGenre] = useState([]) //
const [statusId, setStatusId] = useState([]) //
const [checkPop, setCheckPop] = useState(false) // const [checkPop, setCheckPop] = useState(false) //
const [alarmId, setAlarmId] = useState(false) //alarmId const [alarmId, setAlarmId] = useState(false) //alarmId
const [query, setQuery] = useState({ limit: 10, page: 0 }) // const [query, setQuery] = useState({ limit: 10, page: 0 }) //
@ -112,6 +113,10 @@ const DataAlarm = (props) => {
name: '设备类型', field: 'kindId', name: '设备类型', field: 'kindId',
data: genre, data: genre,
}, },
{
name: '异常类型', field: 'statusId',
data: statusId,
},
{ {
name: '异常状态', field: 'state', name: '异常状态', field: 'state',
data: [ data: [
@ -424,11 +429,13 @@ const DataAlarm = (props) => {
selected={selected} selected={selected}
setSelected={setSelected} setSelected={setSelected}
setGenre={setGenre} setGenre={setGenre}
setStatusId={setStatusId}
query={query} query={query}
setQuery={setQuery} setQuery={setQuery}
tableData={tableData} tableData={tableData}
setTableData={setTableData} setTableData={setTableData}
genre={genre} genre={genre}
statusId={statusId}
location={props.location?.query} location={props.location?.query}
/> />
{setup ? ( {setup ? (

1
web/client/src/utils/webapi.js

@ -47,6 +47,7 @@ export const ApiTable = {
getAlarmVideoDeviceKind: 'alarm/video/device_kind', //查询视频设备类型 getAlarmVideoDeviceKind: 'alarm/video/device_kind', //查询视频设备类型
putAlarmVideoConfirm: 'alarm/video/confirm', //确认视频告警信息 putAlarmVideoConfirm: 'alarm/video/confirm', //确认视频告警信息
getVcmpAuth: 'vcmp/auth', // 获取视频平台应用鉴权token getVcmpAuth: 'vcmp/auth', // 获取视频平台应用鉴权token
getAlarmVideoExceptionStatusId: 'alarm/video/exception_statusId', //查询视频设备类型
//服务-信鸽服务 //服务-信鸽服务
getPush: "push", //获取推送配置列表 getPush: "push", //获取推送配置列表

Loading…
Cancel
Save