Commit 2b5eedb4 authored by tianyiming's avatar tianyiming

修改bug

parent 56a0472d
......@@ -221,12 +221,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/alarmTrend", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "报警类型趋势", produces = "application/json;charset=UTF-8", notes = "报警类型趋势")
public ResponseModel alarmTrend(@RequestParam(required = false) String bizOrgCode) {
public ResponseModel alarmTrend() {
String bizOrgCode = null;
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
if (StringUtils.isBlank(bizOrgCode)) {
bizOrgCode = personIdentity.getBizOrgCode();
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
return CommonResponseUtil.success(equipmentSpecificAlarmService.alarmTrend(bizOrgCode));
......@@ -366,13 +368,15 @@ public class SupervisionConfigureController extends AbstractBaseController {
@PersonIdentify
@RequestMapping(value = "/replaceVideo", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "添加视频", produces = "application/json;charset=UTF-8", notes = "添加视频")
public ResponseModel replaceVideo(@RequestBody String ids, @RequestParam(required = false) String bizOrgCode) {
@ApiOperation(httpMethod = "POST", value = "替换视频", produces = "application/json;charset=UTF-8", notes = "替换视频")
public ResponseModel replaceVideo(@RequestBody Map<String,String> ids) {
String bizOrgCode = null;
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
if (StringUtils.isBlank(bizOrgCode)) {
bizOrgCode = personIdentity.getBizOrgCode();
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
return CommonResponseUtil.success(supervisionVideoService.replaceVideo(ids, bizOrgCode));
......@@ -382,12 +386,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/queryVideoList", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询视频列表", produces = "application/json;charset=UTF-8", notes = "查询视频列表")
public ResponseModel queryVideoList(@RequestParam(required = false) String bizOrgCode) {
public ResponseModel queryVideoList() {
String bizOrgCode = null;
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
if (StringUtils.isBlank(bizOrgCode)) {
bizOrgCode = personIdentity.getBizOrgCode();
bizOrgCode = personIdentity.getCompanyBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
return CommonResponseUtil.success(supervisionVideoService.queryVideoList(bizOrgCode));
......@@ -397,12 +403,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/queryVideoAllId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询对应站下所有视频id", produces = "application/json;charset=UTF-8", notes = "根据id查询视频")
public ResponseModel queryVideoAllId(@RequestParam(required = false) String bizOrgCode) {
public ResponseModel queryVideoAllId() {
String bizOrgCode = null;
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
if (StringUtils.isBlank(bizOrgCode)) {
bizOrgCode = personIdentity.getBizOrgCode();
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
return CommonResponseUtil.success(supervisionVideoService.queryVideoAllId(bizOrgCode));
......
......@@ -2,17 +2,17 @@ package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.SupervisionVideo;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface SupervisionVideoMapper extends BaseMapper<SupervisionVideo> {
List<Map<String, Object>> getVideoByCompany(@Param("bizOrgCode") String bizOrgCode);
List<AlamVideoVO> getVideoByCompany(@Param("bizOrgCode") String bizOrgCode);
List<String> queryVideoAllId(@Param("bizOrgCode")String bizOrgCode);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.SupervisionVideo;
import java.util.List;
import java.util.Map;
/**
* @author ZeHua Li
......@@ -14,7 +15,7 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> {
List queryVideoList(String bizOrgCode);
boolean replaceVideo(String ids,String bizOrgCode);
boolean replaceVideo(Map<String,String> ids, String bizOrgCode);
List<String> queryVideoAllId(String bizOrgCode);
}
......@@ -3,10 +3,13 @@ package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.SupervisionVideo;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.mapper.SupervisionVideoMapper;
import com.yeejoin.equipmanage.service.ISupervisionVideoService;
import com.yeejoin.equipmanage.service.IVideoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
......@@ -22,14 +25,22 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
@Autowired
SupervisionVideoMapper supervisionVideoMapper;
@Value("${window.vedioFormat}")
String vedioFormat;
@Autowired
private IVideoService videoService;
@Override
public List<List<Map<String, Object>>> queryVideoList(String bizOrgCode) {
List<List<Map<String, Object>>> resList = new ArrayList<>();
List<Map<String, Object>> list = supervisionVideoMapper.getVideoByCompany(bizOrgCode);
List<Map<String, Object>> mapList = new ArrayList<>();
public List<List<AlamVideoVO>> queryVideoList(String bizOrgCode) {
List<List<AlamVideoVO>> resList = new ArrayList<>();
List<AlamVideoVO> list = supervisionVideoMapper.getVideoByCompany(bizOrgCode);
list.forEach(action -> {
action.setVedioFormat(vedioFormat);
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
});
List<AlamVideoVO> mapList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
if (list.size() > 1 && (i / 2) - 1 != 0 && i != 0) {
if (list.size() > 1 && ((i+1) % 2) - 1 != 0 && i != 0) {
mapList.add(list.get(i));
resList.add(mapList);
mapList = new ArrayList<>();
......@@ -45,9 +56,10 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
@Override
public boolean replaceVideo(String ids, String bizOrgCode) {
public boolean replaceVideo(Map<String,String> map, String bizOrgCode) {
supervisionVideoMapper.delete(new QueryWrapper<SupervisionVideo>().eq("biz_org_code",bizOrgCode));
List<SupervisionVideo> list = new ArrayList<>();
String ids = map.get("ids");
for (String s : ids.split(",")) {
SupervisionVideo supervisionVideo = new SupervisionVideo();
supervisionVideo.setCameraId(s);
......
......@@ -2,10 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.SupervisionVideoMapper">
<select id="getVideoByCompany" resultType="java.util.Map">
select wv.*
<select id="getVideoByCompany" resultType="com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO">
select
wv.id,
wv.token,
wv.name as name,
wv.url,
wv.code,
wv.preset_position as presetPosition,
wv.name
from wl_supervision_video wsv left join wl_video wv on wsv.camera_id = wv.id
where wsv.biz_org_code = #{bizOrgCode}
where wsv.biz_org_code like concat(#{bizOrgCode},'%');
</select>
<select id="queryVideoAllId" resultType="java.lang.String">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment