Browse Source

(*)解决冲突

dev
wuqun 2 years ago
parent
commit
5a7800afb4
  1. 46
      api/app/lib/controllers/alarm/video.js
  2. 3
      api/app/lib/routes/alarm/index.js
  3. 33
      web/client/src/sections/control/containers/control.jsx
  4. 9
      web/client/src/sections/install/components/systemModal.jsx
  5. 11
      web/client/src/sections/install/containers/system.jsx
  6. 11
      web/client/src/sections/problem/actions/problem.jsx
  7. 8
      web/client/src/sections/problem/components/sideSheet.jsx
  8. 11
      web/client/src/sections/problem/components/tableData.jsx
  9. 7
      web/client/src/sections/problem/containers/dataAlarm.jsx
  10. 1
      web/client/src/utils/webapi.js

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

@ -6,6 +6,12 @@ async function deviceType (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs 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 kindRes = await clickHouse.vcmp.query(` const kindRes = await clickHouse.vcmp.query(`
SELECT DISTINCT SELECT DISTINCT
@ -16,6 +22,10 @@ async function deviceType (ctx) {
INNER JOIN camera_status_alarm INNER JOIN camera_status_alarm
ON camera.channel_no = camera_status_alarm.channel_no ON camera.channel_no = camera_status_alarm.channel_no
AND camera.serial_no = camera_status_alarm.serial_no AND camera.serial_no = camera_status_alarm.serial_no
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() `).toPromise()
ctx.status = 200; ctx.status = 200;
ctx.body = kindRes ctx.body = kindRes
@ -28,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;
@ -451,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);
}; };

33
web/client/src/sections/control/containers/control.jsx

@ -155,13 +155,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
}) })
} else { } else {
if (ProblemAlarm?.length > 0) { if (ProblemAlarm?.length > 0) {
ProblemAlarm.sort((a, b) => { ProblemAlarm.sort((a, b) => (moment(a.StartTime).isBefore(b.StartTime) ? 1 : -1))
if (moment(a.StartTime).isBefore(b.StartTime)) {
return 1
} else {
return -1
}
})
setProblemsList([...ProblemAlarm, ...problemsList]) setProblemsList([...ProblemAlarm, ...problemsList])
} }
} }
@ -187,19 +181,12 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
} }
}) })
} }
newest.sort((a, b) => { newest.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1))
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
querydata.current = [...newest, ...querydata.current] querydata.current = [...newest, ...querydata.current]
setQueryData1([...querydata.current]) setQueryData1([...querydata.current])
} }
}, [socketData]) }, [socketData])
console.log(querydata.current);
useEffect(() => { useEffect(() => {
consoleToollink() consoleToollink()
@ -423,13 +410,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
id: v.id, id: v.id,
})) }))
} }
data.sort((a, b) => { data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1))
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
// console.log(data) // console.log(data)
querydata.current = data querydata.current = data
setQueryData1(data) setQueryData1(data)
@ -505,13 +486,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
id: v.id, id: v.id,
})) }))
} }
data.sort((a, b) => { data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1))
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
querydata.current = data querydata.current = data
setQueryData1(data) setQueryData1(data)
} }

9
web/client/src/sections/install/components/systemModal.jsx

@ -20,7 +20,8 @@ function adminModal (props) {
anxincloudArr,// anxincloudArr,//
anxinDelete,//, anxinDelete,//,
appArr,// appArr,//
bindId bindId,
mapping //
} = props; } = props;
const { install } = actions; const { install } = actions;
const form = useRef();// const form = useRef();//
@ -236,15 +237,13 @@ function adminModal (props) {
} }
</Form.Select> </Form.Select>
<Form.Select <Form.Select
label="添加映射分类:" label="映射分类:"
field="mappingClass" field="mappingClass"
multiple
filter filter
placeholder="请选择映射类型" placeholder="请选择映射类型"
style={{ width: 425 }} style={{ width: 425 }}
initValue={appArr || []} initValue={mapping}
showClear showClear
renderSelectedItem={renderMultipleWithCustomTag}
> >
{ {
[ [

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

@ -27,6 +27,7 @@ const Example = (props) => {
const [bindId, setBindId] = useState() //id const [bindId, setBindId] = useState() //id
const [tableKey, setTableKey] = useState([]) //id const [tableKey, setTableKey] = useState([]) //id
const page = useRef(query.page);// const page = useRef(query.page);//
const [mapping, setMapping] = useState() //
@ -228,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")||'无';
} }
}, },
{ {
@ -236,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"));
} }
}, },
{ {
@ -244,7 +245,7 @@ const Example = (props) => {
dataIndex: "pepUserName", dataIndex: "pepUserName",
key: 'pepUserName', key: 'pepUserName',
render: (_, row) => { render: (_, row) => {
return row.pepUserName return row.pepUserName||'无'
} }
}, },
{ {
@ -284,9 +285,11 @@ const Example = (props) => {
delete myarrarrList[j].projectApp delete myarrarrList[j].projectApp
myapparr.push(JSON.stringify(myarrarrList[j])) myapparr.push(JSON.stringify(myarrarrList[j]))
} }
setAppArr(myapparr) setAppArr(myapparr)
setAnxincloudArr(myanxinArr) setAnxincloudArr(myanxinArr)
setBindId(row.id) setBindId(row.id)
setMapping(row?.mappingClass)
setSystemEdit(true) setSystemEdit(true)
}} }}
> >
@ -355,6 +358,7 @@ const Example = (props) => {
setAppArr([]) setAppArr([])
setAnxincloudArr() setAnxincloudArr()
setBindId() setBindId()
setMapping('')
}} }}
> >
添加映射关系 添加映射关系
@ -450,6 +454,7 @@ const Example = (props) => {
anxincloudArr={anxincloudArr} anxincloudArr={anxincloudArr}
pepProjectId={pepProjectId} pepProjectId={pepProjectId}
anxinDelete={anxinDelete} anxinDelete={anxinDelete}
mapping={mapping}
appArr={appArr} appArr={appArr}
bindId={bindId} bindId={bindId}
cancel={() => { cancel={() => {

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',

8
web/client/src/sections/problem/components/sideSheet.jsx

@ -32,13 +32,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) {
dispatch(problem.getAlarmDataDetailAgg({ alarmId: alarmId })).then((res) => { dispatch(problem.getAlarmDataDetailAgg({ alarmId: alarmId })).then((res) => {
if (res?.success) { if (res?.success) {
let dataSort = res.payload.data || [] let dataSort = res.payload.data || []
dataSort.sort((a, b) => { dataSort.sort((a, b) => (moment(a.hours).isBefore(b.hours) ? -1 : 1))
if (moment(a.hours).isBefore(b.hours)) {
return -1
} else {
return 1
}
})
let data = { let data = {
grid: { grid: {
left: '5%', left: '5%',

11
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,6 +153,11 @@ 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 })))
}
})
} }
}, []) }, [])
@ -326,6 +331,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,
@ -349,6 +355,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