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 {
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 kindRes = await clickHouse.vcmp.query(`
SELECT DISTINCT
@ -16,6 +22,10 @@ async function deviceType (ctx) {
INNER JOIN camera_status_alarm
ON camera.channel_no = camera_status_alarm.channel_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()
ctx.status = 200;
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) {
try {
const { models } = ctx.fs.dc;
@ -451,5 +494,6 @@ module.exports = {
alarmList,
confirm,
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 };
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 {
if (ProblemAlarm?.length > 0) {
ProblemAlarm.sort((a, b) => {
if (moment(a.StartTime).isBefore(b.StartTime)) {
return 1
} else {
return -1
}
})
ProblemAlarm.sort((a, b) => (moment(a.StartTime).isBefore(b.StartTime) ? 1 : -1))
setProblemsList([...ProblemAlarm, ...problemsList])
}
}
@ -187,19 +181,12 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
}
})
}
newest.sort((a, b) => {
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
newest.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1))
querydata.current = [...newest, ...querydata.current]
setQueryData1([...querydata.current])
}
}, [socketData])
console.log(querydata.current);
useEffect(() => {
consoleToollink()
@ -423,13 +410,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
id: v.id,
}))
}
data.sort((a, b) => {
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1))
// console.log(data)
querydata.current = data
setQueryData1(data)
@ -505,13 +486,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
id: v.id,
}))
}
data.sort((a, b) => {
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1))
querydata.current = data
setQueryData1(data)
}

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

@ -20,7 +20,8 @@ function adminModal (props) {
anxincloudArr,//
anxinDelete,//,
appArr,//
bindId
bindId,
mapping //
} = props;
const { install } = actions;
const form = useRef();//
@ -236,15 +237,13 @@ function adminModal (props) {
}
</Form.Select>
<Form.Select
label="添加映射分类:"
label="映射分类:"
field="mappingClass"
multiple
filter
placeholder="请选择映射类型"
style={{ width: 425 }}
initValue={appArr || []}
initValue={mapping}
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 [tableKey, setTableKey] = useState([]) //id
const page = useRef(query.page);//
const [mapping, setMapping] = useState() //
@ -228,7 +229,7 @@ const Example = (props) => {
dataIndex: "createTime",
key: 'time',
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",
key: 'updateTime',
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",
key: 'pepUserName',
render: (_, row) => {
return row.pepUserName
return row.pepUserName||'无'
}
},
{
@ -284,9 +285,11 @@ const Example = (props) => {
delete myarrarrList[j].projectApp
myapparr.push(JSON.stringify(myarrarrList[j]))
}
setAppArr(myapparr)
setAnxincloudArr(myanxinArr)
setBindId(row.id)
setMapping(row?.mappingClass)
setSystemEdit(true)
}}
>
@ -355,6 +358,7 @@ const Example = (props) => {
setAppArr([])
setAnxincloudArr()
setBindId()
setMapping('')
}}
>
添加映射关系
@ -450,6 +454,7 @@ const Example = (props) => {
anxincloudArr={anxincloudArr}
pepProjectId={pepProjectId}
anxinDelete={anxinDelete}
mapping={mapping}
appArr={appArr}
bindId={bindId}
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) { //
return dispatch => basicAction({
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) => {
if (res?.success) {
let dataSort = res.payload.data || []
dataSort.sort((a, b) => {
if (moment(a.hours).isBefore(b.hours)) {
return -1
} else {
return 1
}
})
dataSort.sort((a, b) => (moment(a.hours).isBefore(b.hours) ? -1 : 1))
let data = {
grid: {
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,
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 [count, setCount] = useState(0) //
const [checkAll, setCheckAll] = useState(true) //
const api = useRef();
const search = useRef({
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '',
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', statusId: '',
errType: '', confirmState: '', onlineState: '', sustainTimeStart: '', sustainTimeEnd: ''
})
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 })))
}
})
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,
keyword: v.keyword,
kindId: v.kindId,
statusId: v.statusId,
groupUnitId: v.groupUnitId,
errType: v.errType,
confirmState: v.confirmState,
@ -349,6 +355,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
keywordTarget: v.keywordTarget,
keyword: v.keyword,
kindId: v.kindId,
statusId: v.statusId,
groupUnitId: v.groupUnitId,
errType: v.errType,
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 [selected, setSelected] = useState([]) //
const [genre, setGenre] = useState([]) //
const [statusId, setStatusId] = useState([]) //
const [checkPop, setCheckPop] = useState(false) //
const [alarmId, setAlarmId] = useState(false) //alarmId
const [query, setQuery] = useState({ limit: 10, page: 0 }) //
@ -112,6 +113,10 @@ const DataAlarm = (props) => {
name: '设备类型', field: 'kindId',
data: genre,
},
{
name: '异常类型', field: 'statusId',
data: statusId,
},
{
name: '异常状态', field: 'state',
data: [
@ -424,11 +429,13 @@ const DataAlarm = (props) => {
selected={selected}
setSelected={setSelected}
setGenre={setGenre}
setStatusId={setStatusId}
query={query}
setQuery={setQuery}
tableData={tableData}
setTableData={setTableData}
genre={genre}
statusId={statusId}
location={props.location?.query}
/>
{setup ? (

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

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

Loading…
Cancel
Save