广播和视频分组导入
This commit is contained in:
parent
7aa4d307e7
commit
48f41ef72a
@ -150,6 +150,7 @@ public class AsyncAiAnalyse {
|
||||
enableMessageDevRuleService.sendSms(messageDevRule, templateParams, text, null);
|
||||
}
|
||||
enableMessageDevRuleService.sendSystemMessage(messageDevRule, "8");
|
||||
enableMessageDevRuleService.sendBroadcast(messageDevRule);
|
||||
}, threadPoolTaskExecutor);
|
||||
}
|
||||
|
||||
|
||||
47
src/main/java/com/zhgd/xmgl/call/ShiZiWangBroadcastCall.java
Normal file
47
src/main/java/com/zhgd/xmgl/call/ShiZiWangBroadcastCall.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.zhgd.xmgl.call;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zhgd.xmgl.call.api.BroadcastManufacturer;
|
||||
import com.zhgd.xmgl.modules.broadcast.entity.SmartBroadcastConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public class ShiZiWangBroadcastCall implements BroadcastManufacturer {
|
||||
private SmartBroadcastConfig config;
|
||||
|
||||
@Override
|
||||
public SmartBroadcastConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfig(SmartBroadcastConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playVoiceFile(List<String> devSns, String fileName, String filePath) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("SerialNums", devSns);
|
||||
jsonObject.put("PlayText", fileName);
|
||||
jsonObject.put("PlayFileContent", Base64.encode(FileUtil.readBytes(filePath)));
|
||||
String body = jsonObject.toJSONString();
|
||||
String url = "https://norsos.lionking110.com/sos/v1/mntn/adap/business/external/group/play";
|
||||
log.info("狮子王播放语音文件url:{},body:{}", url, body);
|
||||
String result = HttpRequest.post(url)
|
||||
.body(body)
|
||||
.timeout(20000)
|
||||
.execute().body();
|
||||
log.info("狮子王播放语音文件结果:{}", result);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.zhgd.xmgl.call.api;
|
||||
|
||||
import com.zhgd.xmgl.modules.broadcast.entity.SmartBroadcastConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BroadcastManufacturer {
|
||||
|
||||
SmartBroadcastConfig getConfig();
|
||||
|
||||
void setConfig(SmartBroadcastConfig config);
|
||||
|
||||
/**
|
||||
* 播放语音文件
|
||||
*
|
||||
* @param devSns 设备snList
|
||||
* @param fileName 文件名称
|
||||
* @param filePath 文件路径
|
||||
* @return
|
||||
*/
|
||||
void playVoiceFile(List<String> devSns, String fileName, String filePath);
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.zhgd.xmgl.call.factory;
|
||||
|
||||
import com.zhgd.jeecg.common.util.SpringContextUtils;
|
||||
import com.zhgd.xmgl.call.ShiZiWangBroadcastCall;
|
||||
import com.zhgd.xmgl.call.api.BroadcastManufacturer;
|
||||
import com.zhgd.xmgl.modules.broadcast.entity.SmartBroadcastConfig;
|
||||
import com.zhgd.xmgl.modules.broadcast.service.ISmartBroadcastConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
public class BroadcastManufacturerFactory {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISmartBroadcastConfigService smartBroadcastConfigService;
|
||||
|
||||
public BroadcastManufacturer getManufacturer(HashMap<String, Object> param) {
|
||||
SmartBroadcastConfig config = smartBroadcastConfigService.getUseConfig(param);
|
||||
if (config == null) {
|
||||
return null;
|
||||
}
|
||||
BroadcastManufacturer manufacturer = null;
|
||||
if (Objects.equals(config.getManufacturerType(), 1)) {
|
||||
manufacturer = SpringContextUtils.getBean(ShiZiWangBroadcastCall.class);
|
||||
manufacturer.setConfig(config);
|
||||
}
|
||||
return manufacturer;
|
||||
}
|
||||
}
|
||||
@ -842,6 +842,7 @@ public class EnvironmentAlarmServiceImpl extends ServiceImpl<EnvironmentAlarmMap
|
||||
enableMessageDevRuleService.sendSms(messageDevRule, templateParams, text, null);
|
||||
}
|
||||
enableMessageDevRuleService.sendSystemMessage(messageDevRule, "7");
|
||||
enableMessageDevRuleService.sendBroadcast(messageDevRule);
|
||||
}, threadPoolTaskExecutor);
|
||||
}
|
||||
|
||||
|
||||
@ -98,4 +98,11 @@ public interface IEnableMessageDevRuleService extends IService<EnableMessageDevR
|
||||
* @param type
|
||||
*/
|
||||
void sendSystemMessage(EnableMessageDevRule rule, String type);
|
||||
|
||||
/**
|
||||
* 发送广播
|
||||
*
|
||||
* @param rule
|
||||
*/
|
||||
void sendBroadcast(EnableMessageDevRule rule);
|
||||
}
|
||||
|
||||
@ -10,7 +10,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.call.api.BroadcastManufacturer;
|
||||
import com.zhgd.xmgl.call.api.DevSmsManufacturer;
|
||||
import com.zhgd.xmgl.call.factory.BroadcastManufacturerFactory;
|
||||
import com.zhgd.xmgl.call.factory.DevSmsManufacturerFactory;
|
||||
import com.zhgd.xmgl.enums.ParamEnum;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
@ -24,12 +26,15 @@ import com.zhgd.xmgl.modules.project.entity.vo.EnableMessageDevRuleVo;
|
||||
import com.zhgd.xmgl.modules.project.mapper.EnableMessageDevRuleMapper;
|
||||
import com.zhgd.xmgl.modules.project.service.IEnableMessageDevRuleService;
|
||||
import com.zhgd.xmgl.modules.project.service.IEnableMessageDevService;
|
||||
import com.zhgd.xmgl.util.FileUtils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -48,6 +53,9 @@ public class EnableMessageDevRuleServiceImpl extends ServiceImpl<EnableMessageDe
|
||||
@Lazy
|
||||
@Autowired
|
||||
ISystemUserService systemUserService;
|
||||
@Lazy
|
||||
@Resource
|
||||
BroadcastManufacturerFactory broadcastManufacturerFactory;
|
||||
@Autowired
|
||||
private EnableMessageDevRuleMapper enableMessageDevRuleMapper;
|
||||
@Lazy
|
||||
@ -181,5 +189,15 @@ public class EnableMessageDevRuleServiceImpl extends ServiceImpl<EnableMessageDe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBroadcast(EnableMessageDevRule rule) {
|
||||
if (Objects.equals(rule.getEnableBroadcastNotification(), 1) && StrUtil.isNotBlank(rule.getBroadcastDevices()) && StrUtil.isNotBlank(rule.getVoiceFileConfiguration())) {
|
||||
BroadcastManufacturer manufacturer = broadcastManufacturerFactory.getManufacturer(new MapBuilder<String, Object>()
|
||||
.put("projectSn", rule.getProjectSn())
|
||||
.build());
|
||||
manufacturer.playVoiceFile(StrUtil.split(rule.getBroadcastDevices(), ","), FileUtils.urlToFileName(rule.getVoiceFileConfiguration()), FileUtils.urlToFilePath(rule.getVoiceFileConfiguration()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -336,35 +336,6 @@ public class RiskListSourceDataCenterController {
|
||||
&& DateUtil.compare(bo.getDate(), time) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已排查的数量List
|
||||
*
|
||||
* @param sourceVos
|
||||
* @return
|
||||
*/
|
||||
private List<SourceCheckNumBo> getSourceCheckNumBo(List<RiskListSourceVo> sourceVos) {
|
||||
List<Long> sourceIds = sourceVos.stream().map(RiskListSourceVo::getId).collect(Collectors.toList());
|
||||
List<XzSecurityQualityInspectionRecord> securityList = xzSecurityQualityInspectionRecordService.list(new LambdaQueryWrapper<XzSecurityQualityInspectionRecord>()
|
||||
.eq(XzSecurityQualityInspectionRecord::getType, 10)
|
||||
.in(XzSecurityQualityInspectionRecord::getEngineeringId, sourceIds)
|
||||
);
|
||||
List<RiskListSourceUnbuilt> unbuilts = riskListSourceUnbuiltService.list(new LambdaQueryWrapper<RiskListSourceUnbuilt>()
|
||||
.in(RiskListSourceUnbuilt::getSourceId, sourceIds));
|
||||
List<SourceCheckNumBo> collect = securityList.stream().map(o -> {
|
||||
SourceCheckNumBo bo = new SourceCheckNumBo();
|
||||
bo.setSourceId(o.getEngineeringId());
|
||||
bo.setDate(DateUtil.parseDate(o.getInspectTime()));
|
||||
return bo;
|
||||
}).collect(Collectors.toList());
|
||||
collect.addAll(unbuilts.stream().map(o -> {
|
||||
SourceCheckNumBo bo = new SourceCheckNumBo();
|
||||
bo.setSourceId(o.getSourceId());
|
||||
bo.setDate(o.getInspectionTime());
|
||||
return bo;
|
||||
}).collect(Collectors.toList()));
|
||||
return collect;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "风险类别占比图", notes = "风险类别占比图", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "Integer"),
|
||||
|
||||
@ -1,16 +1,28 @@
|
||||
package com.zhgd.xmgl.modules.video.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.async.AsyncProject;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectVideoConfigService;
|
||||
import com.zhgd.xmgl.modules.video.entity.VideoGroup;
|
||||
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
||||
import com.zhgd.xmgl.modules.video.entity.dto.MoveGroupVideoItemDto;
|
||||
import com.zhgd.xmgl.modules.video.entity.vo.CaptureVo;
|
||||
import com.zhgd.xmgl.modules.video.entity.vo.HistoryCaptureVo;
|
||||
import com.zhgd.xmgl.modules.video.entity.vo.TalkURLsV2Vo;
|
||||
import com.zhgd.xmgl.modules.video.service.IVideoGroupService;
|
||||
import com.zhgd.xmgl.modules.video.service.IVideoItemService;
|
||||
import com.zhgd.xmgl.modules.xz.entity.vo.CountStatusVo;
|
||||
import com.zhgd.xmgl.util.ExcelUtils;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@ -19,12 +31,16 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -44,6 +60,12 @@ public class VideoItemController {
|
||||
private IVideoItemService videoItemService;
|
||||
@Autowired
|
||||
private AsyncProject asyncProject;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IVideoGroupService videoGroupService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IProjectVideoConfigService projectVideoConfigService;
|
||||
|
||||
/**
|
||||
* 添加
|
||||
@ -99,7 +121,6 @@ public class VideoItemController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@OperLog(operModul = "视频管理", operType = "修改视频设备地图坐标", operDesc = "修改视频设备地图坐标")
|
||||
@ApiOperation(value = "修改视频设备地图坐标", notes = "修改视频设备地图坐标", httpMethod = "POST")
|
||||
@PostMapping(value = "/updateVideoItemCoordinate")
|
||||
@ -288,7 +309,6 @@ public class VideoItemController {
|
||||
return Result.success(videoItemService.selectUserVideoList(map));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "按照摄像头类型查询具有AI功能的摄像头数量", notes = "按照摄像头类型查询具有AI功能的摄像头数量")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
||||
@ -367,7 +387,6 @@ public class VideoItemController {
|
||||
return Result.success(videoItemService.callPostPlaybackUrlsV2(map));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "统计监控点在线率", notes = "统计监控点在线率", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ -402,7 +421,6 @@ public class VideoItemController {
|
||||
return Result.success(videoItemService.searchCameraFromHk(param));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "根据视频设备监控点编号抓拍图片", notes = "根据视频设备监控点编号抓拍图片", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = false, dataType = "String"),
|
||||
@ -484,6 +502,128 @@ public class VideoItemController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "视频管理", operType = "批量删除", operDesc = "批量删除视频设备")
|
||||
@ApiOperation(value = "批量删除视频设备", notes = "批量删除视频设备", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "itemIds", value = "视频设备itemIds(多个,分隔)", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result deleteBatch(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result result = new Result<>();
|
||||
String ids = MapUtils.getString(map, "itemIds");
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
videoItemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
Result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@OperLog(operModul = "视频管理", operType = "移动视频设备", operDesc = "移动视频设备")
|
||||
@ApiOperation(value = "移动视频设备", notes = "移动视频设备", httpMethod = "POST")
|
||||
@PostMapping(value = "/moveGroup")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result moveGroup(@RequestBody MoveGroupVideoItemDto dto) {
|
||||
List<String> itemIds = dto.getItemIds();
|
||||
VideoGroup videoGroup = videoGroupService.getById(dto.getVideoGroupId());
|
||||
if (videoGroup == null) {
|
||||
throw new OpenAlertException("视频分组不存在");
|
||||
}
|
||||
videoItemService.update(null, new LambdaUpdateWrapper<VideoItem>()
|
||||
.set(VideoItem::getGroupId, dto.getVideoGroupId())
|
||||
.set(VideoItem::getParentObj, JSON.toJSONString(videoGroup))
|
||||
.in(VideoItem::getItemId, itemIds)
|
||||
);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入模板下载", notes = "导入模板下载")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "videoType", value = "视频类型,1:萤石云,3:ISC,4:ICC", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@GetMapping("/downloadExcelTemplate")
|
||||
public void downloadExcelTemplate(HttpServletResponse response, @RequestParam HashMap<String, Object> param) {
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
Integer videoType = MapUtils.getInteger(param, "videoType");
|
||||
List<String> groupNames = videoGroupService.list(new LambdaQueryWrapper<VideoGroup>()
|
||||
.eq(VideoGroup::getProjectSn, projectSn)).stream().map(VideoGroup::getGroupName).collect(Collectors.toList());
|
||||
List<ExcelUtils.ExportExcelTemplatePullDown> pullDowns = Arrays.asList(new ExcelUtils.ExportExcelTemplatePullDown("视频分组", 0, groupNames));
|
||||
String downLoadFileName = null;
|
||||
if (Objects.equals(videoType, 1)) {
|
||||
downLoadFileName = "监控点导入模版(萤石云).xlsx";
|
||||
} else if (Objects.equals(videoType, 3)) {
|
||||
downLoadFileName = "监控点导入模版(isc).xlsx";
|
||||
} else if (Objects.equals(videoType, 4)) {
|
||||
downLoadFileName = "监控点导入模版(大华).xlsx";
|
||||
}
|
||||
ExcelUtils.exportExcelTemplate("excel/videoitem/" + downLoadFileName, downLoadFileName, pullDowns, response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入excel", notes = "导入excel")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "excelFile", value = "导入文件", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "videoType", value = "视频类型,1:萤石云,3:ISC,4:ICC", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/importExcel")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result importExcel(MultipartFile excelFile, @RequestBody HashMap<String, Object> param) {
|
||||
try {
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
Integer videoType = MapUtils.getInteger(param, "videoType");
|
||||
List<Map<String, String>> list = ExcelUtils.jxlExlToList(excelFile.getInputStream(), 0);
|
||||
if (list == null || list.size() == 0) {
|
||||
throw new OpenAlertException(MessageUtil.get("excelNotDataErr"));
|
||||
}
|
||||
Map<String, VideoGroup> groupMap = videoGroupService.list(new LambdaQueryWrapper<VideoGroup>()
|
||||
.eq(VideoGroup::getProjectSn, projectSn)).stream().collect(Collectors.toMap(VideoGroup::getGroupName, Function.identity(), (o1, o2) -> o1));
|
||||
ProjectVideoConfig videoConfig = projectVideoConfigService.getOne(new LambdaQueryWrapper<ProjectVideoConfig>()
|
||||
.eq(ProjectVideoConfig::getProjectSn, projectSn)
|
||||
.eq(ProjectVideoConfig::getVideoType, videoType)
|
||||
);
|
||||
if (videoConfig == null) {
|
||||
throw new OpenAlertException("请先启用该视频类型");
|
||||
}
|
||||
List<VideoItem> videoItems = new ArrayList<>();
|
||||
List<String> sucList = new ArrayList<>();
|
||||
List<String> failVideoList = new ArrayList<>();
|
||||
List<String> failGroupList = new ArrayList<>();
|
||||
for (Map<String, String> importInfo : list) {
|
||||
VideoGroup group = groupMap.get(importInfo.get("*视频分组"));
|
||||
String videoName = importInfo.get("*设备名称");
|
||||
String serialNumber = importInfo.get("*监控点");
|
||||
String deviceType = importInfo.get("设备类型");
|
||||
String verificationCode = importInfo.get("*通道号");
|
||||
String aiVideoUrl = importInfo.get("AI分析视频地址");
|
||||
String mrql = importInfo.get("默认取流");
|
||||
Integer defaultStreamType = null;
|
||||
if (StrUtil.isNotBlank(mrql)) {
|
||||
defaultStreamType = Objects.equals(mrql, "子码流") ? 1 : 2;
|
||||
}
|
||||
Integer aiFunctionType = Objects.equals(importInfo.get("是否具有AI识别功能"), "是") ? 1 : 0;
|
||||
if (group == null) {
|
||||
failGroupList.add(videoName);
|
||||
continue;
|
||||
}
|
||||
VideoItem videoItem = new VideoItem();
|
||||
videoItem.setVideoId(videoConfig.getId());
|
||||
videoItem.setVideoName(videoName);
|
||||
videoItem.setSerialNumber(serialNumber);
|
||||
videoItem.setVerificationCode(verificationCode);
|
||||
videoItem.setDeviceType(videoItemService.getDeviceType(deviceType));
|
||||
videoItem.setCreateTime(new Date());
|
||||
videoItem.setDeviceState(2);
|
||||
videoItem.setGroupId(group.getId());
|
||||
videoItem.setAiFunctionType(aiFunctionType);
|
||||
videoItem.setParentObj(JSON.toJSONString(group));
|
||||
videoItem.setAiVideoUrl(aiVideoUrl);
|
||||
videoItem.setDefaultStreamType(defaultStreamType);
|
||||
videoItems.add(videoItem);
|
||||
}
|
||||
videoItemService.saveBatch(videoItems);
|
||||
return Result.ok(StrUtil.format("导入完成。导入成功:你好,阿爸{};导入失败:嘉兴、囧扥就(),军方,周邓个(){}"));
|
||||
} catch (Exception e) {
|
||||
throw new OpenAlertException("导入excel失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,6 +166,12 @@ public class VideoItem implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "默认码流类型:1、子码流,2、主码流,默认子码流")
|
||||
private Integer defaultStreamType;
|
||||
/**
|
||||
* 智能广播设备devSns(多个,分隔)
|
||||
*/
|
||||
@ApiModelProperty(value = "智能广播设备devSns(多个,分隔)")
|
||||
private String broadcastDevs;
|
||||
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.video.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MoveGroupVideoItemDto {
|
||||
@ApiModelProperty("视频设备idList")
|
||||
private List<String> itemIds;
|
||||
@ApiModelProperty("视频分组id")
|
||||
private Long videoGroupId;
|
||||
}
|
||||
@ -25,6 +25,9 @@
|
||||
<if test="groupId != null and groupId != ''">
|
||||
and vi.group_id = #{groupId}
|
||||
</if>
|
||||
<if test="videoName != null and videoName != ''">
|
||||
and vi.video_name = #{videoName}
|
||||
</if>
|
||||
<if test="devIds != null and devIds.size() != 0">
|
||||
and vi.item_id in
|
||||
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
|
||||
|
||||
@ -23,6 +23,14 @@ import java.util.concurrent.ExecutionException;
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IVideoItemService extends IService<VideoItem> {
|
||||
/**
|
||||
* 根据设备类型文字获取对应的数字编码
|
||||
*
|
||||
* @param deviceName 设备类型名称
|
||||
* @return 对应的数字编码
|
||||
*/
|
||||
Integer getDeviceType(String deviceName);
|
||||
|
||||
/**
|
||||
* 添加视频设备列表信息
|
||||
*
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.video.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@ -189,7 +190,7 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
|
||||
if (videoItem == null) {
|
||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||
}
|
||||
checkBindOther(videoItem);
|
||||
// checkBindOther(videoItem);
|
||||
ProjectVideoConfig projectVideoConfig = projectVideoConfigMapper.selectById(videoItem.getVideoId());
|
||||
//if (projectVideoConfig.getVideoType() == 1) {
|
||||
// String accessToken = YsVideoUtil.getToken(projectVideoConfig.getAppId(), projectVideoConfig.getAppSecret());
|
||||
@ -711,11 +712,56 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
|
||||
newArray.add(videoJo);
|
||||
}
|
||||
}
|
||||
data.put("videoList", ListUtils.listToTree(newArray, "id", "parentId", "children"));
|
||||
JSONArray videoList = ListUtils.listToTree(newArray, "id", "parentId", "children");
|
||||
data.put("videoList", videoList);
|
||||
if (CollUtil.isNotEmpty(videoList)) {
|
||||
for (int i = 0; i < videoList.size(); i++) {
|
||||
JSONObject jsonObject = videoList.getJSONObject(i);
|
||||
Map<String, Integer> integerMap = getTotalAndOnlineNum(jsonObject);
|
||||
jsonObject.putAll(integerMap);
|
||||
}
|
||||
}
|
||||
data.put("type", 2);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归统计所有下级有serialNumber的节点数量
|
||||
* 并设置总数和在线视频监控数量
|
||||
*
|
||||
* @param jsonObject JSON对象
|
||||
* @return 包含totalNum和onlineNum的Map
|
||||
*/
|
||||
private static Map<String, Integer> getTotalAndOnlineNum(JSONObject jsonObject) {
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
int totalNum = 0;
|
||||
int onlineNum = 0;
|
||||
// 检查当前节点是否有serialNumber(算作一个设备)
|
||||
if (jsonObject.containsKey("videoName")) {
|
||||
totalNum = 1;
|
||||
// 假设在线状态字段为"online"或"status"
|
||||
if (Objects.equals(jsonObject.getInteger("deviceState"), 1)) {
|
||||
onlineNum = 1;
|
||||
}
|
||||
}
|
||||
// 递归处理子节点
|
||||
JSONArray children = jsonObject.getJSONArray("children");
|
||||
if (CollUtil.isNotEmpty(children)) {
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
JSONObject child = children.getJSONObject(i);
|
||||
Map<String, Integer> childStats = getTotalAndOnlineNum(child);
|
||||
// 累加子节点的统计结果
|
||||
totalNum += childStats.getOrDefault("totalNum", 0);
|
||||
onlineNum += childStats.getOrDefault("onlineNum", 0);
|
||||
child.putAll(childStats);
|
||||
}
|
||||
}
|
||||
result.put("totalNum", totalNum);
|
||||
result.put("onlineNum", onlineNum);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<EntityMap> selecAllVideoList(Map<String, Object> map) {
|
||||
return videoItemMapper.selectProjectVideoList(map);
|
||||
@ -1131,4 +1177,27 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDeviceType(String deviceName) {
|
||||
if (deviceName == null) {
|
||||
return null;
|
||||
}
|
||||
String name = deviceName.trim();
|
||||
switch (name) {
|
||||
case "枪机":
|
||||
return 1;
|
||||
case "球机":
|
||||
return 2;
|
||||
case "热成像":
|
||||
return 3;
|
||||
case "单兵":
|
||||
return 4;
|
||||
case "全景":
|
||||
return 5;
|
||||
case "无人机":
|
||||
return 6;
|
||||
default:
|
||||
return null; // 未找到对应的编码
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.xmgl.call.factory.BroadcastManufacturerFactory;
|
||||
import com.zhgd.xmgl.call.factory.DevSmsManufacturerFactory;
|
||||
import com.zhgd.xmgl.enums.ParamEnum;
|
||||
import com.zhgd.xmgl.modules.basicdata.constant.DictionaryConstant;
|
||||
@ -48,6 +49,9 @@ public class MessageDevRuleTask {
|
||||
@Autowired
|
||||
ISystemUserService systemUserService;
|
||||
@Lazy
|
||||
@Resource
|
||||
BroadcastManufacturerFactory broadcastManufacturerFactory;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private DevSmsManufacturerFactory devSmsManufacturerFactory;
|
||||
@Lazy
|
||||
@ -164,10 +168,12 @@ public class MessageDevRuleTask {
|
||||
if (Objects.equals(rule.getEnableSystemMessagePush(), 1) && isSystemSendTime(rule)) {
|
||||
enableMessageDevRuleService.sendSystemMessage(rule, type);
|
||||
}
|
||||
//广播
|
||||
enableMessageDevRuleService.sendBroadcast(rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是需要发送的时间了
|
||||
* 是系统消息需要发送的时间了
|
||||
*
|
||||
* @param rule
|
||||
* @return
|
||||
@ -180,7 +186,7 @@ public class MessageDevRuleTask {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是需要发送的时间了
|
||||
* 是短信需要发送的时间了
|
||||
*
|
||||
* @param rule
|
||||
* @return
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarType;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamSubject;
|
||||
@ -9,6 +10,7 @@ import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceGroupV2;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerSafeEducationWorker;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerType;
|
||||
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerAttendanceDto;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -42,6 +44,14 @@ public class ExcelUtils {
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取excel。返回List<Map<标题名,值>>
|
||||
*
|
||||
* @param is
|
||||
* @param index
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<Map<String, String>> jxlExlToList(InputStream is, int index) throws Exception {
|
||||
Workbook book = null;
|
||||
List<Map<String, String>> list = null;
|
||||
@ -993,4 +1003,50 @@ public class ExcelUtils {
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 导出excel模板
|
||||
*
|
||||
* @param templatePath classPath文件路径
|
||||
* @param downLoadFileName 下载名称
|
||||
* @param pullDowns 下拉
|
||||
* @param response
|
||||
*/
|
||||
public static void exportExcelTemplate(String templatePath, String downLoadFileName, List<ExportExcelTemplatePullDown> pullDowns, HttpServletResponse response) {
|
||||
try {
|
||||
ClassPathResource classPathResource = new ClassPathResource(templatePath);
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
|
||||
//下拉列
|
||||
if (CollUtil.isNotEmpty(pullDowns)) {
|
||||
for (ExportExcelTemplatePullDown pullDown : pullDowns) {
|
||||
XSSFSheet sheet = workbook.getSheet(pullDown.getSheetName());
|
||||
for (int i = 0; i < pullDown.getContents().size(); i++) {
|
||||
XSSFRow row = sheet.createRow(i);
|
||||
XSSFCell cell = row.createCell(pullDown.getColumnIndex());
|
||||
cell.setCellType(CellType.STRING);
|
||||
cell.setCellValue(pullDown.getContents().get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
downLoadExcel(downLoadFileName, response, workbook);
|
||||
} catch (IOException e) {
|
||||
log.error("exportExcelTemplate:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ExportExcelTemplatePullDown {
|
||||
private String sheetName;
|
||||
private Integer columnIndex;
|
||||
private List<String> contents;
|
||||
|
||||
public ExportExcelTemplatePullDown(String sheetName, Integer columnIndex, List<String> contents) {
|
||||
this.contents = contents;
|
||||
this.columnIndex = columnIndex;
|
||||
this.sheetName = sheetName;
|
||||
}
|
||||
|
||||
public ExportExcelTemplatePullDown() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,11 +174,33 @@ public class FileUtils {
|
||||
return PathUtil.getBasePath() + "/" + fileUrl1;
|
||||
}
|
||||
|
||||
/**
|
||||
* url(如:xxx*xxxx,xxx*xxxx,[],xxx.jpg等等)转换成本地文件名称
|
||||
*
|
||||
* @param fileUrl
|
||||
* @return
|
||||
*/
|
||||
public static String urlToFileName(String fileUrl) {
|
||||
List<FileObj> fileObjs = parseUrlString(fileUrl);
|
||||
if (CollUtil.isEmpty(fileObjs)) {
|
||||
return null;
|
||||
}
|
||||
String fileName = fileObjs.get(0).getFileName();
|
||||
if (StrUtil.isNotBlank(fileName)) {
|
||||
return fileName;
|
||||
}
|
||||
String fileUrl1 = fileObjs.get(0).getFileUrl();
|
||||
if (fileUrl1.contains("http") || fileUrl1.contains("https")) {
|
||||
fileUrl1 = StringUtils.substringAfter(fileUrl1, "/image/");
|
||||
}
|
||||
return new File(PathUtil.getBasePath() + "/" + fileUrl1).getName();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(urlToFilePath("图片2.png*http://jxj.zhgdyun.com:21000/image/68afb689e6ca0a85c0ef03dd.png"));
|
||||
System.out.println(urlToFilePath("68afb8b6e6ca0a85c0ef03de.png*68afb8b6e6ca0a85c0ef03de.png"));
|
||||
System.out.println(urlToFilePath("68afb8b6e6ca0a85c0ef03de.png"));
|
||||
System.out.println(urlToFilePath("68afb8b6e6ca0a85c0ef03de.png,123.png"));
|
||||
System.out.println(urlToFileName("图片2.png*http://jxj.zhgdyun.com:21000/image/0012710f3eac4542b30314130873ae6e1.png"));
|
||||
System.out.println(urlToFileName("文件名称.png*0012710f3eac4542b30314130873ae6e.png"));
|
||||
System.out.println(urlToFileName("0012710f3eac4542b30314130873ae6e1.png"));
|
||||
System.out.println(urlToFileName("0012710f3eac4542b30314130873ae6e.png,123.png"));
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
BIN
src/main/resources/excel/videoitem/监控点导入模版(isc).xlsx
Normal file
BIN
src/main/resources/excel/videoitem/监控点导入模版(isc).xlsx
Normal file
Binary file not shown.
BIN
src/main/resources/excel/videoitem/监控点导入模版(大华).xlsx
Normal file
BIN
src/main/resources/excel/videoitem/监控点导入模版(大华).xlsx
Normal file
Binary file not shown.
BIN
src/main/resources/excel/videoitem/监控点导入模版(萤石云).xlsx
Normal file
BIN
src/main/resources/excel/videoitem/监控点导入模版(萤石云).xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user