Commit 48143440 authored by suhuiguang's avatar suhuiguang

1.摄像头表代码生成

parent fa7bfdc1
package com.yeejoin.amos.boot.biz.common.constants;
/**
* @author Administrator
*/
public class VideoConstant {
public static final String CODE_200 = "200";
public static final String CODE_10001 = "10001";
public static final String CODE_10005 = "10005";
public static final String CODE_10017 = "10017";
public static final String CODE_10030 = "10030";
public static final String CODE_49999 = "49999";
public static final String CODE_201 = "201";
public static final String CODE_401 = "401";
public static final String CODE_403 = "403";
public static final String CODE_404 = "404";
public static final String CODE_20001 = "20001";
}
package com.yeejoin.amos.boot.biz.common.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value = "CommonVideoDto", description = "通用视频信息")
public class CommonVideoDto {
private String key;
private String url;
private String type;
private String title;
private String thumb;
private String parent;
}
package com.yeejoin.amos.boot.biz.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
* <pre>
* 通用视频协议枚举
* </pre>
*
*/
@Getter
@AllArgsConstructor
public enum CommonVideoEnum {
HLS("2", "hls"),
IMG("3", "img");
private String code;
private String name;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static CommonVideoEnum getEnum(String code)
{
for (CommonVideoEnum status : CommonVideoEnum.values())
{
if (status.getCode().equals(code))
{
return status;
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.common.api.service; package com.yeejoin.amos.boot.module.common.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseVideo;
/** /**
* 单位下摄像头表接口类 * 单位下摄像头表接口类
* *
......
//package com.yeejoin.amos.boot.module.common.api.service;
//
//import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
//
//import java.util.List;
//
///**
// * 数据字典 服务类
// *
// * @author tb
// * @date 2021-06-07
// */
//public interface IDataDictionaryService {
//
//
// Object getFireChemical(String type) throws Exception;
//
// Object gwmcDataDictionary(String type) throws Exception;
//
// List<MenuFrom> getGWMCDataDictionary(String type) throws Exception;
//}
//package com.yeejoin.amos.boot.module.common.biz.controller;
//
//import java.util.*;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.typroject.tyboot.core.foundation.enumeration.UserType;
//import org.typroject.tyboot.core.restful.doc.TycloudOperation;
//import org.typroject.tyboot.core.restful.utils.ResponseHelper;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//
//import com.alibaba.fastjson.JSON;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yeejoin.amos.boot.biz.common.controller.BaseController;
//import com.yeejoin.amos.boot.biz.common.utils.Menu;
//import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
//import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
//import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
//import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
//import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
//import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
//import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//
//
///**
// * 数据字典
// *
// * @author tb
// * @date 2021-06-07
// */
//@RestController
//@Api(tags = "数据字典Api")
//@RequestMapping(value = "/data-dictionary")
//public class DataDictionaryController extends BaseController {
//
// @Autowired
// DataDictionaryServiceImpl iDataDictionaryService;
// @Autowired
// RedisUtils redisUtils;
//
// @Value("${redis.cache.failure.time}")
// private long time;
//
// /**
// * 新增数据字典
// *
// * @return
// */
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/save", method = RequestMethod.POST)
// @ApiOperation(httpMethod = "POST", value = "新增数据字典", notes = "新增数据字典")
// public boolean saveDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) {
// return iDataDictionaryService.save(dataDictionary);
// }
//
// /**
// * 根据id删除
// *
// * @param id
// * @return
// */
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
// @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
// public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
// return iDataDictionaryService.removeById(id);
// }
//
//
// /**
// * 修改数据字典
// *
// * @return
// */
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/updateById", method = RequestMethod.PUT)
// @ApiOperation(httpMethod = "PUT", value = "修改数据字典", notes = "修改数据字典")
// public boolean updateByIdDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) {
// return iDataDictionaryService.updateById(dataDictionary);
// }
//
//
// /**
// * 根据id查询
// *
// * @param id
// * @return
// */
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/{id}", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
// public DataDictionary selectById(HttpServletRequest request, @PathVariable Long id) {
// return iDataDictionaryService.getById(id);
// }
//
//
// /**
// * 列表分页查询
// *
// * @return
// */
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/list", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
// public IPage<DataDictionary> listPage(String pageNum, String pageSize, DataDictionary dataDictionary) {
//
// Page<DataDictionary> pageBean;
// QueryWrapper<DataDictionary> dataDictionaryQueryWrapper = new QueryWrapper<>();
// Class<? extends DataDictionary> aClass = dataDictionary.getClass();
// Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
// try {
// field.setAccessible(true);
// Object o = field.get(dataDictionary);
// if (o != null) {
// Class<?> type = field.getType();
// String name = NameUtils.camel2Underline(field.getName());
// if (type.equals(Integer.class)) {
// Integer fileValue = (Integer) field.get(dataDictionary);
// dataDictionaryQueryWrapper.eq(name, fileValue);
// } else if (type.equals(Long.class)) {
// Long fileValue = (Long) field.get(dataDictionary);
// dataDictionaryQueryWrapper.eq(name, fileValue);
// } else if (type.equals(String.class)) {
// String fileValue = (String) field.get(dataDictionary);
// dataDictionaryQueryWrapper.eq(name, fileValue);
// } else {
// String fileValue = (String) field.get(dataDictionary);
// dataDictionaryQueryWrapper.eq(name, fileValue);
// }
// }
// } catch (Exception e) {
// throw new RuntimeException("系统异常");
// }
// });
// IPage<DataDictionary> page;
// if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
// pageBean = new Page<>(0, Long.MAX_VALUE);
// } else {
// pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
// }
// page = iDataDictionaryService.page(pageBean, dataDictionaryQueryWrapper);
// return page;
// }
//
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/gwmcDataDictionary/{type}", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典", notes = "根据字典类型查询字典")
// public ResponseModel<Object> gwmcDataDictionary(@PathVariable String type) throws Exception {
//
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
//
// if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
// Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
// return ResponseHelper.buildResponse(obj);
// } else {
// Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
// List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
// , "getParent", null);
// redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
// return ResponseHelper.buildResponse(menus);
// }
// }
//
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/dataDictionary", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2")
// public ResponseModel<Object> getDictionary(@RequestParam String type) throws Exception {
//
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
//
// if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
// Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
// return ResponseHelper.buildResponse(obj);
// } else {
// Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
// List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
// , "getParent", null);
// redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
// return ResponseHelper.buildResponse(menus);
// }
// }
//
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/gwmcDataDictionary/FireChemical/{type}", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据字典类型查询危险品字典", notes = "根据字典类型查询危险品字典")
// public ResponseModel<Object> gwmcDataDictionaryFireChemical(@PathVariable String type) throws Exception {
//
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
//
// if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
// Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
// return ResponseHelper.buildResponse(obj);
// } else {
// Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
// List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
// "getName", "getParent", null);
// MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
// Me.setIsLeaf(false);
// Me.setChildren(menus);
// redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time);
// return ResponseHelper.buildResponse(Me);
// }
// }
//
//
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/form/list", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据表态类型多个code查询表单数据项", notes = "根据表态类型多个code查询表单数据项")
// public ResponseModel<Object> selectFormdListItem(HttpServletRequest request, String types) {
// HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
// try {
// String[] typest = types.split(",");
// for (String type : typest) {
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
// if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) {
// Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type);
// objectObjectHashMap.put(type, obj);
// } else {
// Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
// List<MenuFrom> menus = null;
// menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
// "getParent", null);
// redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
// objectObjectHashMap.put(type, menus);
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("系统异常!");
// }
// return ResponseHelper.buildResponse(objectObjectHashMap);
// }
//
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/dataDictionaryTree", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典树", notes = "根据字典类型查询字典树")
// public ResponseModel<Object> getDictionaryTree(@RequestParam String type, @RequestParam String rootName) throws Exception {
//
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
//
// Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
// List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
// , "getParent", null);
// // 创建根节点
// Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
// List<Menu> menuList = new ArrayList<>();
// // 挂在主节点
// menuList.add(menu);
// return ResponseHelper.buildResponse(menuList);
// }
//
//
//}
//
...@@ -60,7 +60,7 @@ public class FirefightersContractController extends BaseController { ...@@ -60,7 +60,7 @@ public class FirefightersContractController extends BaseController {
SourceFileServiceImpl sourceFileService; SourceFileServiceImpl sourceFileService;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Value("${redis.cache.failure.time}") @Value("${redis.cache.failure.time:10800}")
private long time; private long time;
/** /**
* 新增消防员合同 * 新增消防员合同
......
...@@ -63,7 +63,7 @@ public class FirefightersPostController extends BaseController { ...@@ -63,7 +63,7 @@ public class FirefightersPostController extends BaseController {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Value("${redis.cache.failure.time}") @Value("${redis.cache.failure.time:10800}")
private long time; private long time;
/** /**
......
...@@ -56,7 +56,7 @@ public class FirefightersThoughtController extends BaseController { ...@@ -56,7 +56,7 @@ public class FirefightersThoughtController extends BaseController {
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
SourceFileServiceImpl sourceFileService; SourceFileServiceImpl sourceFileService;
@Value("${redis.cache.failure.time}") @Value("${redis.cache.failure.time:10800}")
private long time; private long time;
/** /**
* 新增消防员思想谈话记录 * 新增消防员思想谈话记录
......
//package com.yeejoin.amos.boot.module.common.biz.service;
//
//import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
//
///**
// * @author DELL
// */
//public interface IDutyCarService extends IDutyCommonService {
//
// /**
// * 值班信息保存
// * @param dutyCarDto 对象
// * @return List<DutyCarDto>
// */
// DutyCarDto save(DutyCarDto dutyCarDto);
//
// /**
// * 更新
// * @param instanceId 实例id
// * @param dutyCarDto 业务对象
// * @return List<DutyCarDto>
// */
// DutyCarDto update(Long instanceId, DutyCarDto dutyCarDto);
//}
//package com.yeejoin.amos.boot.module.common.biz.service;
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//
//import java.text.ParseException;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author DELL
// */
//public interface IDutyCommonService {
// /**
// * 分页查询
// *
// * @param current 当前页
// * @param size 页大小
// * @param beginDate 开始日期
// * @param endDate 结束日期
// * @return IPage<Map < String, Object>>
// */
// IPage<Map<String, Object>> pageList(int current, int size, String beginDate, String endDate) throws ParseException;
//
// /**
// * 值班明细
// *
// * @param beginDate 开始日期
// * @param endDate 结束日期
// * @return ResponseModel
// */
// List<Map<String, Object>> statisticsDay(String beginDate, String endDate) throws ParseException;
//
// /**
// * 不分页查询
// *
// * @param beginDate 开始日期
// * @param endDate 结束日期
// * @return ResponseModel
// */
// List<Map<String, Object>> list(String beginDate, String endDate) throws ParseException;
//
// /**
// * 获取表单参数
// *
// * @return String
// */
// String getGroupCode();
//
// List downloadList(String beginDate, String endDate) throws ParseException;
//
// /**
// * 值班数据入库
// *
// * @param dataList 数据
// */
// void saveImportData(List<Map<String, Object>> dataList);
//
// /**
// * 删除值班数据
// *
// * @param instanceId 实例id
// * @return Boolean
// */
// Boolean deleteDutyData(Long instanceId);
//
// /**
// * 查询指定条件的值班人信息
// *
// * @param dutyDay 查询条件
// * @param shiftId 班次
// * @param postType 岗位
// * @return List<Map < String, Object>>
// */
// List<Map<String, Object>> dayDutyPersonList(String dutyDay, Long shiftId, String postType);
//
// /**
// * 查询当前值班人信息
// *
// * @return List<Map < String, Object>>
// */
// List<Map<String, Object>> listOnDutyPerson();
//}
//package com.yeejoin.amos.boot.module.common.biz.service;
//
//import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
//
///**
// * @author DELL
// */
//public interface IDutyPersonService extends IDutyCommonService {
// /**
// * 保存
// *
// * @param dutyPersonDto 业务对象
// * @return List<DutyPersonDto>
// */
// DutyPersonDto save(DutyPersonDto dutyPersonDto);
//
//
// /**
// * 更新
// *
// * @param instanceId 实例id
// * @param dutyPersonDto 业务对象
// * @return List<DutyCarDto>
// */
// DutyPersonDto update(Long instanceId, DutyPersonDto dutyPersonDto);
//}
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.dto.CommonVideoDto;
import com.yeejoin.amos.boot.biz.common.enums.CommonVideoEnum;
import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseVideo; import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseVideo;
import com.yeejoin.amos.boot.module.common.api.mapper.BaseEnterpriseVideoMapper; import com.yeejoin.amos.boot.module.common.api.mapper.BaseEnterpriseVideoMapper;
import com.yeejoin.amos.boot.module.common.api.service.IBaseEnterpriseVideoService; import com.yeejoin.amos.boot.module.common.api.service.IBaseEnterpriseVideoService;
import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseVideoDto; import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseVideoDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import static com.yeejoin.amos.boot.biz.common.constants.VideoConstant.*;
import static com.yeejoin.amos.boot.biz.common.constants.VideoConstant.CODE_200;
/** /**
* 单位下摄像头表服务实现类 * 单位下摄像头表服务实现类
* *
...@@ -16,18 +29,104 @@ import java.util.List; ...@@ -16,18 +29,104 @@ import java.util.List;
* @date 2024-10-09 * @date 2024-10-09
*/ */
@Service @Service
@Slf4j
public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVideoDto,BaseEnterpriseVideo,BaseEnterpriseVideoMapper> implements IBaseEnterpriseVideoService { public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVideoDto,BaseEnterpriseVideo,BaseEnterpriseVideoMapper> implements IBaseEnterpriseVideoService {
@Value("${cylinder.video.default.image.url:/upload/tzs/cylinder/no-connect.png}")
private String defaultVideoUrl;
public List<CommonVideoDto> getUnitVideoUrl(String useUnitCode) {
List<CommonVideoDto> result = new ArrayList<CommonVideoDto>();
LambdaQueryWrapper<BaseEnterpriseVideo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEnterpriseVideo::getUseUnitCode, useUnitCode);
BaseEnterpriseVideo cylinderUnitVideo = this.getBaseMapper().selectOne(wrapper);
if (null != cylinderUnitVideo) {
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("appKey", cylinderUnitVideo.getAppKey());
requestInfo.put("appSecret", cylinderUnitVideo.getAppSecret());
String channelNos = cylinderUnitVideo.getChannelNo();
List<CommonVideoDto> channelNoList = JSONObject.parseArray(channelNos, CommonVideoDto.class);
try {
String accessTokenData = HttpUtil.post(cylinderUnitVideo.getTokenUrl(), requestInfo);
JSONObject jsonObject = JSON.parseObject(accessTokenData);
String msg = jsonObject.get("msg").toString();
String code = jsonObject.get("code").toString();
if (CODE_10001.equals(code) || CODE_10005.equals(code) || CODE_10017.equals(code) || CODE_10030.equals(code) || CODE_49999.equals(code)) {
String errorMsg = "code:" + code + "msg:" + msg + "appKey:" + cylinderUnitVideo.getAppKey() + "appSecret:" + cylinderUnitVideo.getAppSecret();
log.info("视频token获取失败errorMsg:{}", errorMsg);
this.setDefaultVideoIfConnectFailed(channelNoList, result);
return result;
}
if (CODE_200.equals(code)) {
String data = jsonObject.get("data").toString();
JSONObject objTokenJson = JSON.parseObject(data);
String accessToken = objTokenJson.get("accessToken").toString();
System.out.println(accessToken);
for (CommonVideoDto channelNo : channelNoList) {
HashMap<String, Object> requestVideosInfo = new HashMap<>();
requestVideosInfo.put("accessToken", accessToken);
requestVideosInfo.put("deviceSerial", cylinderUnitVideo.getDeviceSerial());
requestVideosInfo.put("channelNo", channelNo.getKey());
requestVideosInfo.put("protocol", cylinderUnitVideo.getProtocol());
requestVideosInfo.put("expireTime", cylinderUnitVideo.getExpireTime());
String videoData = HttpUtil.post(cylinderUnitVideo.getUrl(), requestVideosInfo);
JSONObject videoJsonObject = JSON.parseObject(videoData);
String msgVideo = videoJsonObject.get("msg").toString();
String codeVideo = videoJsonObject.get("code").toString();
if (CODE_201.equals(codeVideo) || CODE_401.equals(codeVideo) || CODE_403.equals(codeVideo) || CODE_404.equals(codeVideo) || CODE_20001.equals(codeVideo)) {
String errorMsg = "code:" + codeVideo + "msg:" + msgVideo + "appKey:" + cylinderUnitVideo.getAppKey() + "appSecret:" + cylinderUnitVideo.getAppSecret() + "accessToken:" + accessToken;
log.info("视频地址获取失败errorMsg:{}", errorMsg);
this.setDefaultChannelData(result, channelNo);
continue;
}
if (CODE_200.equals(codeVideo)) {
String dataS = videoJsonObject.get("data").toString();
JSONObject dd = JSON.parseObject(dataS);
String url = dd.get("url").toString();
CommonVideoDto commonVideoDto = new CommonVideoDto();
commonVideoDto.setUrl(url);
commonVideoDto.setKey(channelNo.getKey());
commonVideoDto.setType(CommonVideoEnum.getEnum(cylinderUnitVideo.getProtocol()).getName());
commonVideoDto.setTitle(channelNo.getTitle());
commonVideoDto.setThumb(channelNo.getThumb());
result.add(commonVideoDto);
}
}
}
} catch (Exception e) {
log.error(e.getMessage());
this.setDefaultVideoIfConnectFailed(channelNoList, result);
}
}
return result;
}
/** /**
* 分页查询 * 通道连接不上时,返回通道的默认图片
*
* @param result 返回连接的总通道
* @param channelNo 未连接的通道
*/ */
public Page<BaseEnterpriseVideoDto> queryForBaseEnterpriseVideoPage(Page<BaseEnterpriseVideoDto> page) { private void setDefaultChannelData(List<CommonVideoDto> result, CommonVideoDto channelNo) {
return this.queryForPage(page, null, false); CommonVideoDto commonVideoDto = new CommonVideoDto();
commonVideoDto.setUrl(channelNo.getThumb());
commonVideoDto.setKey(channelNo.getKey());
commonVideoDto.setType(CommonVideoEnum.IMG.getName());
commonVideoDto.setTitle(channelNo.getTitle());
commonVideoDto.setThumb(channelNo.getThumb());
result.add(commonVideoDto);
} }
/** /**
* 列表查询 示例 * 连接不上时返回的气通道信息
*
* @param commonVideoDtos 当前气瓶单位的所有通道
* @param result 返回的结果集合
*/ */
public List<BaseEnterpriseVideoDto> queryForBaseEnterpriseVideoList() { private void setDefaultVideoIfConnectFailed(List<CommonVideoDto> commonVideoDtos, List<CommonVideoDto> result) {
return this.queryForList("" , false); // 先情况防止数据重复
result.clear();
// 每个通道设备默认值
commonVideoDtos.forEach(channelNo -> this.setDefaultChannelData(result, channelNo));
} }
} }
\ No newline at end of file
//package com.yeejoin.amos.boot.module.common.biz.service.impl;
//
//
//import com.alibaba.fastjson.JSON;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.yeejoin.amos.boot.biz.common.utils.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//import org.typroject.tyboot.core.rdbms.service.BaseService;
//
//import com.yeejoin.amos.boot.module.common.api.dto.DataDictionaryDto;
//import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
//import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
//import com.yeejoin.amos.boot.module.common.api.service.IDataDictionaryService;
//import org.typroject.tyboot.core.restful.utils.ResponseHelper;
//
//import java.util.Collection;
//import java.util.List;
//
///**
// * 数据字典 服务实现类
// *
// * @author tb
// * @date 2021-06-07
// */
//@Service
//public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, DataDictionary, DataDictionaryMapper> implements IDataDictionaryService {
// @Autowired
// RedisUtils redisUtils;
//
// @Value("${redis.cache.failure.time}")
// private long time;
//
//
// @Override
// public Object getFireChemical(String type) throws Exception {
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
//
// if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
// Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
// return obj;
// } else {
// Collection<DataDictionary> list = this.list(queryWrapper);
// List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
// "getName", "getParent", null);
// MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
// Me.setIsLeaf(false);
// Me.setChildren(menus);
// redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time);
// return Me;
// }
// }
//
// @Override
// public Object gwmcDataDictionary(String type) throws Exception {
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
//
// if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
// Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
// return obj;
// } else {
// Collection<DataDictionary> list = this.list(queryWrapper);
// List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
// , "getParent", null);
// redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
// return menus;
// }
// }
//
// public List<MenuFrom> getGWMCDataDictionary(String type) throws Exception {
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
//
// Collection<DataDictionary> list = this.list(queryWrapper);
// List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
// , "getParent", null);
// return menus;
//
// }
//}
...@@ -66,7 +66,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -66,7 +66,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Value("${fire-rescue}") @Value("${fire-rescue:1432549862557130753}")
private String fireRescueId; private String fireRescueId;
......
package com.yeejoin.amos.boot.module.statistics.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
/**
* @author Administrator
*/
@Data
public class UnitVideoDto extends BaseDto {
private String id;
private String name;
private String code;
private Long countNum;
}
package com.yeejoin.amos.boot.module.statistics.api.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author Administrator
* 树节点
*/
@Data
@ApiModel(value = "树节点")
public class TreeNodeVo {
@ApiParam(value = "节点唯一标识")
private String id;
@ApiParam(value = "节点名称")
private String name;
@ApiParam(value = "节点类型")
private String nodeType;
@ApiParam(value = "父id")
private String parentId;
@ApiParam(value = "节点code")
private String code;
@ApiParam(value = "字节点")
private List<TreeNodeVo> children = new ArrayList<>();
}
...@@ -30,9 +30,10 @@ import java.net.UnknownHostException; ...@@ -30,9 +30,10 @@ import java.net.UnknownHostException;
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients @EnableFeignClients
@EnableSwagger2WebMvc @EnableSwagger2WebMvc
@MapperScan({"org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*", @MapperScan({"org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.**.api.mapper", "com.yeejoin.amos.boot.module.**.api.service", "com.yeejoin.amos.boot.module.**.api.mapper",
"com.yeejoin.amos.boot.biz.common.dao.mapper"}) "com.yeejoin.amos.boot.biz.common.dao.mapper"})
@ComponentScan(basePackages = {"org.typroject", "com.yeejoin.amos"}) @ComponentScan(basePackages = {"org.typroject", "com.yeejoin.amos"})
public class AmosStatisticsApplication { public class AmosStatisticsApplication {
......
package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.biz.common.dto.CommonVideoDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.VideoServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.vo.TreeNodeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* @author suhuiguang
*/
@RestController
@Api(tags = "摄像头相关api")
@RequestMapping("/video")
public class VideoController {
private VideoServiceImpl videoService;
public VideoController(VideoServiceImpl videoService) {
this.videoService = videoService;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "区域、单位、摄像头3级树接口", httpMethod = "POST")
@PostMapping(value = "/tree")
public ResponseModel<List<TreeNodeVo>> getVideoTree(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
List<TreeNodeVo> re = videoService.getVideoTree(dpFilterParamDto);
return ResponseHelper.buildResponse(re);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询指定区域下的单位列表接口,带摄像头数量统计-不分页", httpMethod = "GET")
@GetMapping(value = "/countByUnit")
public ResponseModel<List<? extends BaseDto>> getUnitList(@RequestParam(value = "code") String regionCode) {
List<? extends BaseDto> re = videoService.getUnitList(regionCode);
return ResponseHelper.buildResponse(re);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询指定单位下的摄像头列表接口-不分页", httpMethod = "GET")
@GetMapping(value = "/list")
public ResponseModel<List<CommonVideoDto>> getVideoList(@RequestParam(value = "code") String useUnitCode) {
List<CommonVideoDto> re = videoService.getVideoList(useUnitCode);
return ResponseHelper.buildResponse(re);
}
}
...@@ -99,6 +99,10 @@ public class StCommonServiceImpl { ...@@ -99,6 +99,10 @@ public class StCommonServiceImpl {
initReginCode(); initReginCode();
} }
public List<RegionModel> getRegionModels(){
return regionModels;
}
private void initReginCode() { private void initReginCode() {
Collection<RegionModel> result = Systemctl.regionClient.queryForTree(null).getResult(); Collection<RegionModel> result = Systemctl.regionClient.queryForTree(null).getResult();
result.forEach(r -> { result.forEach(r -> {
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.biz.common.dto.CommonVideoDto;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseVideo;
import com.yeejoin.amos.boot.module.common.biz.service.impl.BaseEnterpriseVideoServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.dto.UnitVideoDto;
import com.yeejoin.amos.boot.module.statistics.api.vo.TreeNodeVo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Service
@Slf4j
public class VideoServiceImpl {
private static String NODE_TYPE_REGION = "region";
private static String NODE_TYPE_UNIT = "unit";
private static String NODE_TYPE_VIDEO = "video";
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
private StCommonServiceImpl stCommonService;
private BaseEnterpriseVideoServiceImpl enterpriseVideoService;
public VideoServiceImpl(BaseEnterpriseVideoServiceImpl enterpriseVideoService, TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper, StCommonServiceImpl stCommonService) {
this.enterpriseVideoService = enterpriseVideoService;
this.tzBaseEnterpriseInfoMapper = tzBaseEnterpriseInfoMapper;
this.stCommonService = stCommonService;
}
/**
* 按照区域信息,进行显示区域(可能多层级)、单位(可能在多个区域下)、摄像头(在单位节点下)树
*
* @param dpFilterParamDto 区域信息
* @return List<TreeNodeVo>
*/
public List<TreeNodeVo> getVideoTree(DPFilterParamDto dpFilterParamDto) {
// 摄像头设备
List<BaseEnterpriseVideo> videoEquipList = getVideos(dpFilterParamDto);
// 摄像头对应的单位列表
List<TzBaseEnterpriseInfo> baseEnterpriseInfos = this.getUnitListForTree(videoEquipList.stream().map(BaseEnterpriseVideo::getUseUnitCode).collect(Collectors.toSet()));
// 摄像头对应的行政区域列表
List<RegionModel> regionModels = this.getRegionListOfVideo(videoEquipList);
// 摄像头通道
List<CommonVideoDto> channelNoList = this.getVideoChannel(videoEquipList);
// 树组装
return castList2Tree(baseEnterpriseInfos, regionModels, channelNoList, videoEquipList);
}
private List<TreeNodeVo> castList2Tree(List<TzBaseEnterpriseInfo> baseEnterpriseInfos, List<RegionModel> regionModels, List<CommonVideoDto> channelNoList, List<BaseEnterpriseVideo> videoEquipList) {
// 数据处理,把行政区域、单位、摄像头 数据格式化为有parent的标准树结构列表
List<TreeNodeVo> regionNodes = regionModels.stream().map(r -> {
TreeNodeVo treeNodeVo = new TreeNodeVo();
treeNodeVo.setNodeType(NODE_TYPE_REGION);
treeNodeVo.setId(r.getSequenceNbr().toString());
treeNodeVo.setName(r.getRegionName());
treeNodeVo.setCode(r.getRegionCode() + "");
treeNodeVo.setParentId(String.valueOf(r.getParentId()));
return treeNodeVo;
}).collect(Collectors.toList());
List<TreeNodeVo> treeNodeVos = regionNodes.stream().filter(r -> StringUtils.isEmpty(r.getParentId()) || "0".equals(r.getParentId())).map(r -> {
TreeNodeVo treeNodeVo = new TreeNodeVo();
BeanUtil.copyProperties(r, treeNodeVo);
treeNodeVo.setChildren(this.getRegionTypeNode(treeNodeVo , regionNodes));
return treeNodeVo;
}).collect(Collectors.toList());
// 给区域的最下级增加直接下级->单位,id不是其他的parent_id则为树的叶子节点
treeNodeVos.forEach(t->{
this.setChildrenUnitTypeNode(regionNodes, t, baseEnterpriseInfos, videoEquipList, channelNoList);
});
return treeNodeVos;
}
private void setChildrenUnitTypeNode(List<TreeNodeVo> regionNodes, TreeNodeVo parentNode, List<TzBaseEnterpriseInfo> baseEnterpriseInfos, List<BaseEnterpriseVideo> videoEquipList, List<CommonVideoDto> channelNoList) {
if(regionNodes.stream().noneMatch(e -> parentNode.getId().equals(e.getParentId()))){
parentNode.setChildren(this.buildUnitTypeNode(baseEnterpriseInfos, videoEquipList, channelNoList, parentNode));
} else {
parentNode.getChildren().forEach(p->{
setChildrenUnitTypeNode(regionNodes, p, baseEnterpriseInfos, videoEquipList, channelNoList);
});
}
}
private List<TreeNodeVo> getRegionTypeNode(TreeNodeVo parentNode, List<TreeNodeVo> regionNodes) {
return regionNodes.stream().filter(r -> StringUtils.isNotEmpty(r.getParentId()) && r.getParentId().equals(parentNode.getId())).map(r -> {
TreeNodeVo treeNodeVo = new TreeNodeVo();
BeanUtil.copyProperties(r, treeNodeVo);
treeNodeVo.setChildren(this.getRegionTypeNode(treeNodeVo, regionNodes));
return treeNodeVo;
}).collect(Collectors.toList());
}
private List<TreeNodeVo> buildUnitTypeNode(List<TzBaseEnterpriseInfo> baseEnterpriseInfos, List<BaseEnterpriseVideo> videoEquipList, List<CommonVideoDto> channelNoList, TreeNodeVo parentNode) {
Set<String> useUnitCodes = videoEquipList.stream().filter(v -> v.getRegionCode().contains(parentNode.getCode())).map(BaseEnterpriseVideo::getUseUnitCode).collect(Collectors.toSet());
return baseEnterpriseInfos.stream().filter(v -> useUnitCodes.contains(v.getUseUnitCode())).map(u -> {
TreeNodeVo treeNodeVo = new TreeNodeVo();
treeNodeVo.setNodeType(NODE_TYPE_UNIT);
// 防止id不唯一,拼接为{父id}_{本级id},目前左侧树与右侧列表没交互不定位,如需定位需要按照code进行定位
treeNodeVo.setId(parentNode.getId() + "_" + u.getSequenceNbr());
treeNodeVo.setName(u.getUseUnit());
treeNodeVo.setCode(u.getUseUnitCode());
treeNodeVo.setParentId(parentNode.getId());
treeNodeVo.setChildren(this.buildVideoTypeNode(treeNodeVo, channelNoList));
return treeNodeVo;
}).collect(Collectors.toList());
}
private List<TreeNodeVo> buildVideoTypeNode(TreeNodeVo parentNode, List<CommonVideoDto> channelNoList) {
return channelNoList.stream().filter(v -> v.getParent().contains(parentNode.getCode())).map(u -> {
TreeNodeVo treeNodeVo = new TreeNodeVo();
treeNodeVo.setNodeType(NODE_TYPE_VIDEO);
// 这个key需要全局唯一,用来页面左侧点击摄像头类型的节点时与右侧的摄像头列表进行定位
// @see /video/list->CommonVideoDto.key
treeNodeVo.setId(u.getKey());
treeNodeVo.setName(u.getTitle());
treeNodeVo.setParentId(parentNode.getId());
return treeNodeVo;
}).collect(Collectors.toList());
}
private List<CommonVideoDto> getVideoChannel(List<BaseEnterpriseVideo> videoEquipList) {
List<CommonVideoDto> commonVideoDtos = new ArrayList<>();
videoEquipList.forEach(v -> {
String channelNos = v.getChannelNo();
List<CommonVideoDto> channelNoList = JSONObject.parseArray(channelNos, CommonVideoDto.class);
commonVideoDtos.addAll(channelNoList.stream().peek(e -> e.setParent(v.getUseUnitCode())).collect(Collectors.toList()));
});
return commonVideoDtos;
}
private List<RegionModel> getRegionListOfVideo(List<BaseEnterpriseVideo> videoEquipList) {
return stCommonService.getRegionModels().parallelStream().filter(r -> videoEquipList.stream().anyMatch(v -> v.getRegionCode().contains(r.getRegionCode().toString()))).collect(Collectors.toList());
}
private List<TzBaseEnterpriseInfo> getUnitListForTree(Set<String> useUnitCodes) {
LambdaQueryWrapper<TzBaseEnterpriseInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(TzBaseEnterpriseInfo::getUseUnitCode, useUnitCodes);
queryWrapper.select(TzBaseEnterpriseInfo::getUseUnitCode, TzBaseEnterpriseInfo::getUseUnit, TzBaseEnterpriseInfo::getAddress, BaseEntity::getSequenceNbr);
return tzBaseEnterpriseInfoMapper.selectList(queryWrapper);
}
private List<BaseEnterpriseVideo> getVideos(DPFilterParamDto dpFilterParamDto) {
LambdaQueryWrapper<BaseEnterpriseVideo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BaseEnterpriseVideo::getEquListCode, EquipmentClassifityEnum.KYSD.getCode());
queryWrapper.like(BaseEnterpriseVideo::getRegionCode, dpFilterParamDto.getCityCode());
return enterpriseVideoService.list(queryWrapper);
}
private List<BaseEnterpriseVideo> getVideos(String regionCode) {
LambdaQueryWrapper<BaseEnterpriseVideo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BaseEnterpriseVideo::getEquListCode, EquipmentClassifityEnum.KYSD.getCode());
queryWrapper.like(BaseEnterpriseVideo::getRegionCode, regionCode);
return enterpriseVideoService.list(queryWrapper);
}
public List<? extends BaseDto> getUnitList(String regionCode) {
// 摄像头设备
List<BaseEnterpriseVideo> videoEquipList = getVideos(regionCode);
// 摄像头对应的单位列表
List<TzBaseEnterpriseInfo> baseEnterpriseInfos = this.getUnitListForTree(videoEquipList.stream().map(BaseEnterpriseVideo::getUseUnitCode).collect(Collectors.toSet()));
return baseEnterpriseInfos.parallelStream().map(e -> {
UnitVideoDto unitVideoDto = new UnitVideoDto();
unitVideoDto.setId(e.getSequenceNbr() + "");
unitVideoDto.setName(e.getUseUnit());
// 摄像头通道
List<CommonVideoDto> channelNoList = this.getVideoChannel(videoEquipList);
unitVideoDto.setCountNum(channelNoList.stream().filter(c -> c.getParent().equals(e.getUseUnitCode())).count());
return unitVideoDto;
}).collect(Collectors.toList());
}
public List<CommonVideoDto> getVideoList(String useUnitCode) {
return enterpriseVideoService.getUnitVideoUrl(useUnitCode);
}
}
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