监控摄像头模块
This commit is contained in:
parent
c9d35cebe6
commit
2ed4de174b
@ -1,17 +1,18 @@
|
||||
package cn.iocoder.yudao.module.system.api.dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 字典数据")
|
||||
@ -46,4 +47,9 @@ public interface DictDataApi {
|
||||
CommonResult<DictDataRespDTO> parseDictData(@RequestParam("dictType") String dictType,
|
||||
@RequestParam("label") String label);
|
||||
|
||||
@GetMapping(PREFIX + "/get-list")
|
||||
@Operation(summary = "获得指定的字典数据列表")
|
||||
@Parameter(name = "dictType", description = "字典类型", example = "SEX", required = true)
|
||||
CommonResult<List<DictDataRespDTO>> getDictDataList(@RequestParam("dictType") String dictType);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.api.dict;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@ -38,4 +40,11 @@ public class DictDataApiImpl implements DictDataApi {
|
||||
return success(BeanUtils.toBean(dictData, DictDataRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<DictDataRespDTO>> getDictDataList(String dictType) {
|
||||
|
||||
List<DictDataDO> dictDataDOS = dictDataService.getDictDataList(CommonStatusEnum.ENABLE.getStatus(), dictType);
|
||||
return success(BeanUtils.toBean(dictDataDOS, DictDataRespDTO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.constant;
|
||||
|
||||
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
@ -9,6 +8,7 @@ import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
@PropertySource("classpath:application-hik.yaml")
|
||||
public class ArtemisApiConstant implements CommandLineRunner {
|
||||
|
||||
public static String camerasApi;
|
||||
|
@ -9,6 +9,7 @@ import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
@PropertySource("classpath:application-hik.yaml")
|
||||
public class ArtemisConfigConstant implements CommandLineRunner {
|
||||
|
||||
|
||||
|
@ -29,21 +29,6 @@ public class CameraDevicePageReqVO extends PageParam {
|
||||
@Schema(description = "状态(0正常 1停用)", example = "1")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "实时抓图地址", example = "https://www.iocoder.cn")
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "录像机地址", example = "https://www.iocoder.cn")
|
||||
private String videoUrl;
|
||||
|
||||
@Schema(description = "流媒体地址", example = "https://www.iocoder.cn")
|
||||
private String streamUrl;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "是否在大屏显示 0否 1是")
|
||||
private Integer isShow;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
@ -35,10 +35,6 @@ public class CameraDeviceRespVO {
|
||||
@ExcelProperty("状态(0正常 1停用)")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "实时抓图地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("实时抓图地址")
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "录像机地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("录像机地址")
|
||||
private String videoUrl;
|
||||
@ -47,10 +43,6 @@ public class CameraDeviceRespVO {
|
||||
@ExcelProperty("流媒体地址")
|
||||
private String streamUrl;
|
||||
|
||||
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "是否在大屏显示 0否 1是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否在大屏显示 0否 1是")
|
||||
private Integer isShow;
|
||||
|
@ -32,19 +32,12 @@ public class CameraDeviceSaveReqVO {
|
||||
@NotEmpty(message = "状态(0正常 1停用)不能为空")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "实时抓图地址", example = "https://www.iocoder.cn")
|
||||
private String iconUrl;
|
||||
|
||||
@Schema(description = "录像机地址", example = "https://www.iocoder.cn")
|
||||
private String videoUrl;
|
||||
|
||||
@Schema(description = "流媒体地址", example = "https://www.iocoder.cn")
|
||||
private String streamUrl;
|
||||
|
||||
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "是否在大屏显示 0否 1是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否在大屏显示 0否 1是不能为空")
|
||||
private Integer isShow;
|
||||
|
@ -12,6 +12,8 @@ import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.Fact
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactorySimpleRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -23,7 +25,11 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
@ -37,6 +43,9 @@ public class FactoryInfoController {
|
||||
@Resource
|
||||
private FactoryInfoService factoryInfoService;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工厂信息")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:create')")
|
||||
@ -88,6 +97,42 @@ public class FactoryInfoController {
|
||||
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-tree")
|
||||
@Operation(summary = "获得工厂树结构")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
|
||||
public CommonResult<Map<FactorySimpleRespVO, Map<String, List<FactorySimpleRespVO>>>> getFactoryTree() {
|
||||
|
||||
Map<FactorySimpleRespVO, Map<String, List<FactorySimpleRespVO>>> data = new HashMap<>();
|
||||
|
||||
List<FactoryInfoDO> factoryInfo = factoryInfoService.getFactoryList();
|
||||
|
||||
// 获取所有工厂类型
|
||||
List<DictDataRespDTO> dictDataDTOs = dictDataApi.getDictDataList("sf_factory_type").getCheckedData();
|
||||
|
||||
Map<String, List<FactorySimpleRespVO>> subdataMap = new HashMap<>();
|
||||
for (DictDataRespDTO dto : dictDataDTOs) {
|
||||
|
||||
if (!"1".equals(dto.getValue())) {
|
||||
|
||||
List<FactorySimpleRespVO> subData = BeanUtils.toBean(
|
||||
factoryInfo.stream().filter(info -> info.getType().equals(dto.getValue())).collect(Collectors.toList()),
|
||||
FactorySimpleRespVO.class);
|
||||
|
||||
subdataMap.put(dto.getLabel(), subData);
|
||||
}
|
||||
}
|
||||
|
||||
// 获得type为1 即总公司的工厂信息
|
||||
Optional<FactoryInfoDO> factoryInfoDO = factoryInfo.stream().filter(info -> "1".equals(info.getType())).findFirst();
|
||||
|
||||
FactorySimpleRespVO headOfficeVO = BeanUtils.toBean(
|
||||
factoryInfoDO.orElse(null), FactorySimpleRespVO.class);
|
||||
|
||||
data.put(headOfficeVO, subdataMap);
|
||||
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得工厂信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
|
||||
|
@ -62,10 +62,6 @@ public class FactoryInfoSaveReqVO {
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lat;
|
||||
|
||||
@Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
@ -46,10 +46,6 @@ public class CameraDeviceDO extends BaseDO {
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 实时抓图地址
|
||||
*/
|
||||
private String iconUrl;
|
||||
/**
|
||||
* 录像机地址
|
||||
*/
|
||||
@ -58,10 +54,6 @@ public class CameraDeviceDO extends BaseDO {
|
||||
* 流媒体地址
|
||||
*/
|
||||
private String streamUrl;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 是否在大屏显示 0否 1是
|
||||
*/
|
||||
|
@ -97,10 +97,6 @@ public class FactoryInfoDO extends BaseDO {
|
||||
* 纬度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态
|
||||
* <p>
|
||||
|
@ -22,11 +22,6 @@ public interface CameraDeviceMapper extends BaseMapperX<CameraDeviceDO> {
|
||||
.eqIfPresent(CameraDeviceDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(CameraDeviceDO::getType, reqVO.getType())
|
||||
.eqIfPresent(CameraDeviceDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(CameraDeviceDO::getIconUrl, reqVO.getIconUrl())
|
||||
.eqIfPresent(CameraDeviceDO::getVideoUrl, reqVO.getVideoUrl())
|
||||
.eqIfPresent(CameraDeviceDO::getStreamUrl, reqVO.getStreamUrl())
|
||||
.eqIfPresent(CameraDeviceDO::getSort, reqVO.getSort())
|
||||
.eqIfPresent(CameraDeviceDO::getIsShow, reqVO.getIsShow())
|
||||
.betweenIfPresent(CameraDeviceDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CameraDeviceDO::getId));
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ public interface FactoryInfoMapper extends BaseMapperX<FactoryInfoDO> {
|
||||
.likeIfPresent(FactoryInfoDO::getType, reqVO.getType())
|
||||
.eqIfPresent(FactoryInfoDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(FactoryInfoDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(FactoryInfoDO::getSort));
|
||||
.orderByAsc(FactoryInfoDO::getType)
|
||||
.orderByDesc(FactoryInfoDO::getId));
|
||||
}
|
||||
|
||||
default List<FactoryInfoDO> selectListByType(List<Long> factoryId) {
|
||||
|
@ -16,11 +16,8 @@ import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
* 工厂 出入库数据统计 定时任务
|
||||
*/
|
||||
@ -56,7 +53,6 @@ public class FactoryDataJob {
|
||||
|
||||
//设置 出入库类型为 入库
|
||||
data.setDataType(2);
|
||||
data.setCreator(Objects.requireNonNull(getLoginUserId()).toString());
|
||||
|
||||
//取出 同一个工厂和日期的数据
|
||||
List<FactoryDataInfoRespVO> infos = infoRespVOS.stream()
|
||||
@ -87,7 +83,6 @@ public class FactoryDataJob {
|
||||
dataDO.setDataType(1);
|
||||
dataDO.setTotalNum(infos.get(0).getOutNum());
|
||||
dataDO.setDamageNum(infos.get(0).getOutDamageNum());
|
||||
dataDO.setCreator(Objects.requireNonNull(getLoginUserId()).toString());
|
||||
|
||||
outFactoryDataDOs.add(dataDO);
|
||||
}
|
||||
@ -108,7 +103,6 @@ public class FactoryDataJob {
|
||||
outDO.setDataType(1);
|
||||
outDO.setTotalNum(infoRespVO.getOutNum());
|
||||
outDO.setDamageNum(infoRespVO.getOutDamageNum());
|
||||
outDO.setCreator(Objects.requireNonNull(getLoginUserId()).toString());
|
||||
|
||||
outFactoryDataDOs.add(outDO);
|
||||
|
||||
@ -120,7 +114,6 @@ public class FactoryDataJob {
|
||||
inDO.setDataType(2);
|
||||
inDO.setTotalNum(infoRespVO.getInNum());
|
||||
inDO.setDamageNum(infoRespVO.getInDamageNum());
|
||||
inDO.setCreator(Objects.requireNonNull(getLoginUserId()).toString());
|
||||
|
||||
outFactoryDataDOs.add(inDO);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.hik;
|
||||
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@ -38,7 +37,7 @@ public class HikServiceImpl implements HikService {
|
||||
};
|
||||
JSONObject body = new JSONObject();
|
||||
body.set("cameraIndexCode", cameraCode);
|
||||
body.set("streamType", 0);
|
||||
body.set("streamType", streamType);
|
||||
body.set("protocol", "ws");
|
||||
body.set("transmode", 1);
|
||||
body.set("expand", "streamform=ps");
|
||||
@ -108,8 +107,7 @@ public class HikServiceImpl implements HikService {
|
||||
String result = ArtemisHttpUtil.doPostStringArtemis(path, JSONUtil.toJsonStr(body), null, null, "application/json");
|
||||
log.info("云台操作:{},返回结果:{}", JSONUtil.toJsonStr(dto), result);
|
||||
JSONObject json = JSONUtil.parseObj(result);
|
||||
String msg = json.getStr("msg");
|
||||
return msg;
|
||||
return json.get("msg").toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
#海康威视的相关配置
|
||||
isc:
|
||||
host: hik.znkj.ispt.com.cn:10443
|
||||
appKey: 24991430
|
||||
appSecret: jQd4pIYZBzwW8cnuI9IN
|
||||
#视频资源
|
||||
resource:
|
||||
cameras: /artemis/api/resource/v1/cameras
|
||||
#视频能力
|
||||
video:
|
||||
previewUrls: /artemis/api/video/v2/cameras/previewURLs
|
||||
replayUrlApi: /artemis/api/video/v2/cameras/playbackURLs
|
Loading…
Reference in New Issue
Block a user