Browse Source

#视频播放功能

zhongwei
yang_shj 3 months ago
parent
commit
9944bd384b
  1. 14
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java
  2. 20
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDevicePointVo.java
  3. 20
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryFactoryPointVo.java
  4. 31
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/VideoRecordEntity.java
  5. 38
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java
  6. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/HistoryTemplateController.java
  7. 14
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java
  8. 93
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  9. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java
  10. 47
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoRecordController.java
  11. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.java
  12. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.xml
  13. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/VideoRecordService.java
  14. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/VideoRecordServiceImpl.java

14
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java

@ -19,7 +19,7 @@ import org.springblade.core.tenant.mp.TenantEntity;
public class HistoryTemplateEntity extends TenantEntity {
@ApiModelProperty(value = "模板名称")
private Long templateName;
private String templateName;
@ApiModelProperty(value = "站点编码")
private String stationId;
@ -27,24 +27,36 @@ public class HistoryTemplateEntity extends TenantEntity {
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "厂组ID1")
private String factoryId1;
@ApiModelProperty(value = "属性1")
private String realId1;
@ApiModelProperty(value = "属性1名称")
private String realName1;
@ApiModelProperty(value = "厂组ID2")
private String factoryId2;
@ApiModelProperty(value = "属性2")
private String realId2;
@ApiModelProperty(value = "属性2名称")
private String realName2;
@ApiModelProperty(value = "厂组ID3")
private String factoryId3;
@ApiModelProperty(value = "属性3")
private String realId3;
@ApiModelProperty(value = "属性3名称")
private String realName3;
@ApiModelProperty(value = "厂组ID4")
private String factoryId4;
@ApiModelProperty(value = "属性4")
private String realId4;

20
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDevicePointVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class HistoryDevicePointVo {
@ApiModelProperty(value = "设备编号")
private String deviceCode;
@ApiModelProperty(value = "点位名称")
private String name;
@ApiModelProperty(value = "点位属性标识")
private String signage;
}

20
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryFactoryPointVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class HistoryFactoryPointVo {
@ApiModelProperty(value = "厂租Id")
private String factoryId;
@ApiModelProperty(value = "点位名称")
private String name;
@ApiModelProperty(value = "点位Id")
private String factoryAttrId;
}

31
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/VideoRecordEntity.java

@ -0,0 +1,31 @@
package com.hnac.hzims.operational.station.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* @author ysj
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("hzims_station_video_record")
public class VideoRecordEntity extends TenantEntity {
@ApiModelProperty("站点ID")
private String stationId;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("视频保存配置ID,用逗号分割")
private String videoIds;
@ApiModelProperty("视频保存名称,用逗号分割")
private String videoNames;
}

38
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java

@ -3,8 +3,12 @@ package com.hnac.hzims.history.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -29,24 +33,42 @@ public class DeviceHistoryController extends BladeController {
@GetMapping ("/device")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询项目设备列表", notes = "传入TrainEntity")
@ApiOperation(value = "查询项目设备列表", notes = "传入projectId")
public R<List<DeviceInstanceVO>> device(@RequestParam(value="projectId") String projectId) {
return R.data(service.device(projectId));
}
@GetMapping ("/monitor_point")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "设备监测点查询", notes = "传入TrainEntity")
public R<List<DeviceInstanceAttrVO>> monitor_point(@RequestParam(value="projectId",required = false) String projectId,
@GetMapping ("/device_point")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "设备监测点查询", notes = "传入projectId、deviceCode、deviceName、attrName")
public R<List<HistoryDevicePointVo>> device_point(@RequestParam(value="projectId",required = false) String projectId,
@RequestParam(value="deviceCode",required = false) String deviceCode,
@RequestParam(value="deviceName",required = false) String deviceName,
@RequestParam(value="attrName",required = false) String attrName) {
return R.data(service.monitor_point(projectId,deviceCode,deviceName,attrName));
return R.data(service.device_point(projectId,deviceCode,deviceName,attrName));
}
@GetMapping ("/factory")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "查询项目厂组列表", notes = "传入projectId")
public R<List<FacDeviceVO>> factory(@RequestParam(value="projectId") String projectId) {
return R.data(service.factory(projectId));
}
@GetMapping ("/factory_point")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "查询厂组点位信息", notes = "传入TrainEntity")
public R<List<HistoryFactoryPointVo>> factory_point(@RequestParam(value = "projectId",required = false) String projectId,
@RequestParam(value = "facDeviceId",required = false) String facDeviceId,
@RequestParam(value="facDeviceName",required = false) String facDeviceName,
@RequestParam(value = "attrName",required = false) String attrName) {
return R.data(service.factory_point(projectId,facDeviceId,facDeviceName,attrName));
}
@PostMapping("/history_curve")
@ApiOperationSupport(order = 5)
@ApiOperationSupport(order = 3)
@ApiOperation(value = "设备历史数据曲线图", notes = "获取设备历史数据曲线图")
public R<Map<String, Object>> historyCurve(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyCurve(param));

4
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/HistoryTemplateController.java

@ -29,14 +29,14 @@ public class HistoryTemplateController extends BladeController {
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增历史数据模板", notes = "传入TrainEntity")
@ApiOperation(value = "新增历史数据模板", notes = "传入HistoryTemplateEntity")
public R save(@RequestBody HistoryTemplateEntity entity) {
return R.status(service.save(entity));
}
@GetMapping("/pages")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "分页历史数据模板", notes = "查询条件:entity")
@ApiOperation(value = "分页历史数据模板", notes = "查询条件:params、query")
public R<IPage<HistoryTemplateEntity>> pageCondition(HistoryTemplateParamVo params, Query query) {
return R.data(service.pageCondition(params, Condition.getPage(query)));
}

14
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java

@ -1,8 +1,12 @@
package com.hnac.hzims.history.service;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import java.util.List;
import java.util.Map;
@ -14,7 +18,13 @@ public interface IHistoryDeviceService {
List<DeviceInstanceVO> device(String projectId);
List<DeviceInstanceAttrVO> monitor_point(String projectId,String deviceCode,String deviceName, String attrName);
List<HistoryDevicePointVo> device_point(String projectId, String deviceCode, String deviceName, String attrName);
List<FacDeviceVO> factory(String projectId);
List<HistoryFactoryPointVo> factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName);
Map<String, Object> historyCurve(HistoryDataParamVo param);
Map<String, Object> historyCurve(HistoryDataParamVo param);
}

93
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java

@ -2,11 +2,16 @@ package com.hnac.hzims.history.service.impl;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.HzFacClient;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
@ -26,9 +31,10 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
private final HzFacClient hzFacClient;
private final DeviceClient deviceClient;
private final DeviceDataClient deviceDataClient;
/**
@ -52,8 +58,8 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
* @return
*/
@Override
public List<DeviceInstanceAttrVO> monitor_point(String projectId,String deviceCode,String deviceName, String attrName) {
List<DeviceInstanceAttrVO> result = new ArrayList<>();
public List<HistoryDevicePointVo> device_point(String projectId,String deviceCode,String deviceName, String attrName) {
List<HistoryDevicePointVo> result = new ArrayList<>();
// 查询所有
if(StringUtil.isEmpty(deviceCode)){
R<List<DeviceInstanceVO>> instances = deviceClient.getOnlineDeviceInstanceSearchName(projectId,"");
@ -65,21 +71,92 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
if(!attrs.isSuccess() || CollectionUtil.isEmpty(attrs.getData())){
return;
}
result.addAll(attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getFacDeviceAttrId())).peek(attr->{
attr.setName(instance.getName() + "-" + attr.getName());
result.addAll(attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getSignage())).map(attr->{
HistoryDevicePointVo point = new HistoryDevicePointVo();
point.setDeviceCode(instance.getCode());
point.setName(instance.getName() + "-" + attr.getName());
point.setSignage(attr.getSignage());
return point;
}).collect(Collectors.toList()));
});
return result;
}
// 根据设备查询
Result<List<DeviceInstanceAttrVO>> attrs = deviceClient.getDeviceAttrByName(deviceCode,attrName);
if(!attrs.isSuccess() || CollectionUtil.isEmpty(attrs.getData())){
return result;
}
return attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getFacDeviceAttrId())).peek(attr->{
attr.setName(deviceName + "-" + attr.getName());
return attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getSignage())).map(attr->{
HistoryDevicePointVo point = new HistoryDevicePointVo();
point.setDeviceCode(deviceCode);
point.setName(deviceName + "-" + attr.getName());
point.setSignage(attr.getSignage());
return point;
}).collect(Collectors.toList());
}
/**
* 项目厂组列表
* @param projectId
* @return
*/
@Override
public List<FacDeviceVO> factory(String projectId) {
Result<List<FacDeviceVO>> result = hzFacClient.facDeviceByProjectId(projectId,"");
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/**
* 厂租点位列表
* @param projectId
* @param facDeviceId
* @param facDeviceName
* @param attrName
* @return
*/
@Override
public List<HistoryFactoryPointVo> factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName) {
List<HistoryFactoryPointVo> result = new ArrayList<>();
// 查询所有
if(StringUtil.isEmpty(facDeviceId)){
Result<List<FacDeviceVO>> instances = hzFacClient.facDeviceByProjectId(projectId,attrName);
if(!instances.isSuccess() || CollectionUtil.isEmpty(instances.getData())){
return new ArrayList<>();
}
instances.getData().stream().sorted(Comparator.comparing(FacDeviceVO::getName)).forEach(instance->{
Result<List<FacDeviceAttrVO>> attrs = hzFacClient.facDeviceAttrList(facDeviceId,attrName);
if(!attrs.isSuccess() || CollectionUtil.isEmpty(attrs.getData())){
return;
}
result.addAll(attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getSignage())).map(attr->{
HistoryFactoryPointVo point = new HistoryFactoryPointVo();
point.setFactoryId(instance.getId());
point.setName(attr.getName());
point.setFactoryAttrId(attr.getId());
return point;
}).collect(Collectors.toList()));
});
return result;
}
Result<List<FacDeviceAttrVO>> attrs = hzFacClient.facDeviceAttrList(facDeviceId,attrName);
if(!attrs.isSuccess() || CollectionUtil.isEmpty(attrs.getData())){
return new ArrayList<>();
}
return attrs.getData().stream().filter(o-> StringUtil.isNotBlank(o.getSignage())).map(attr->{
HistoryFactoryPointVo point = new HistoryFactoryPointVo();
point.setFactoryId(facDeviceId);
point.setName(attr.getName());
point.setFactoryAttrId(attr.getId());
return point;
}).collect(Collectors.toList());
}
/**
* 设备历史数据曲线图
* @param param
@ -99,7 +176,7 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
param.getStartTime(),
param.getEndTime(),
// 默认查询设备 : 0-厂组点, 1-设备
1,
0,
intervalType,
param.getIsPage(),
param.getCurrent(),

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java

@ -58,6 +58,7 @@ public class HistoryController extends BladeController {
@RequestParam(value = "attrName",required = false) String attrName) {
return R.data(pointService.projectFacDeviceAttr(facDeviceId,attrName));
}
@GetMapping("/projectDeviceInstance")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "站点虚拟设备息", notes = "根据站点id查询虚拟设备")

47
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoRecordController.java

@ -0,0 +1,47 @@
package com.hnac.hzims.operational.station.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.station.entity.VideoRecordEntity;
import com.hnac.hzims.operational.station.service.VideoRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* @author ysj
*/
@RestController
@RequestMapping("/station/videoRecord")
@RequiredArgsConstructor
@Api(value = "站点视频播放保存记录", tags = "视频播放保存记录")
public class StationVideoRecordController extends BladeController {
private final VideoRecordService videoRecordService;
@PostMapping("/submit")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增或修改站点视频播放保存记录", notes = "传入VideoRecordEntity")
public R submit(@Valid @RequestBody VideoRecordEntity entity) {
return R.status(videoRecordService.saveOrUpdate(entity));
}
@GetMapping("/query")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查询站点视频播放保存记录", notes = "传入VideoRecordEntity")
public R query(@RequestParam("stationId") String stationId,
@RequestParam("userId") String userId) {
return R.data(videoRecordService.getOne(Wrappers.<VideoRecordEntity>lambdaQuery()
.eq(VideoRecordEntity::getStationId,stationId)
.eq(VideoRecordEntity::getCreateUser,userId)
));
}
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.java

@ -0,0 +1,12 @@
package com.hnac.hzims.operational.station.mapper;
import com.hnac.hzims.operational.station.entity.VideoRecordEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface VideoRecordMapper extends UserDataScopeBaseMapper<VideoRecordEntity> {
}

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.operational.station.mapper.VideoRecordMapper">
</mapper>

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/VideoRecordService.java

@ -0,0 +1,10 @@
package com.hnac.hzims.operational.station.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.operational.station.entity.VideoRecordEntity;
/**
* @author ysj
*/
public interface VideoRecordService extends IService<VideoRecordEntity> {
}

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/VideoRecordServiceImpl.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.station.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.operational.station.entity.VideoRecordEntity;
import com.hnac.hzims.operational.station.mapper.VideoRecordMapper;
import com.hnac.hzims.operational.station.service.VideoRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author 86187
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class VideoRecordServiceImpl extends ServiceImpl<VideoRecordMapper, VideoRecordEntity> implements VideoRecordService {
}
Loading…
Cancel
Save