diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java index 7f59f53..135c2bd 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java +++ b/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; diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDevicePointVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDevicePointVo.java new file mode 100644 index 0000000..a03b0af --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryFactoryPointVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryFactoryPointVo.java new file mode 100644 index 0000000..a376e7d --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/VideoRecordEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/VideoRecordEntity.java new file mode 100644 index 0000000..3f124b2 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java index 9d50bee..df8ae59 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java +++ b/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> device(@RequestParam(value="projectId") String projectId) { return R.data(service.device(projectId)); } - - @GetMapping ("/monitor_point") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "设备监测点查询", notes = "传入TrainEntity") - public R> monitor_point(@RequestParam(value="projectId",required = false) String projectId, + @GetMapping ("/device_point") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "设备监测点查询", notes = "传入projectId、deviceCode、deviceName、attrName") + public R> 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> factory(@RequestParam(value="projectId") String projectId) { + return R.data(service.factory(projectId)); } + + @GetMapping ("/factory_point") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "查询厂组点位信息", notes = "传入TrainEntity") + public R> 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> historyCurve(@RequestBody HistoryDataParamVo param) { return R.data(service.historyCurve(param)); diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/HistoryTemplateController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/HistoryTemplateController.java index bda3317..92c4589 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/HistoryTemplateController.java +++ b/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> pageCondition(HistoryTemplateParamVo params, Query query) { return R.data(service.pageCondition(params, Condition.getPage(query))); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java index a4aaf67..f8e47df 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java +++ b/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 device(String projectId); - List monitor_point(String projectId,String deviceCode,String deviceName, String attrName); + List device_point(String projectId, String deviceCode, String deviceName, String attrName); + + List factory(String projectId); + + List factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName); + + + Map historyCurve(HistoryDataParamVo param); - Map historyCurve(HistoryDataParamVo param); } \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java index ce2ae6c..9184934 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java +++ b/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 monitor_point(String projectId,String deviceCode,String deviceName, String attrName) { - List result = new ArrayList<>(); + public List device_point(String projectId,String deviceCode,String deviceName, String attrName) { + List result = new ArrayList<>(); // 查询所有 if(StringUtil.isEmpty(deviceCode)){ R> 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> 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 factory(String projectId) { + Result> 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 factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName) { + List result = new ArrayList<>(); + // 查询所有 + if(StringUtil.isEmpty(facDeviceId)){ + Result> 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> 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> 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(), diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java index c804f8b..7ad6131 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java +++ b/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查询虚拟设备") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoRecordController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoRecordController.java new file mode 100644 index 0000000..679d6e1 --- /dev/null +++ b/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.lambdaQuery() + .eq(VideoRecordEntity::getStationId,stationId) + .eq(VideoRecordEntity::getCreateUser,userId) + )); + } + + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.java new file mode 100644 index 0000000..fa2d649 --- /dev/null +++ b/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 { + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.xml new file mode 100644 index 0000000..b9fcbe9 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/VideoRecordMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/VideoRecordService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/VideoRecordService.java new file mode 100644 index 0000000..88bba2b --- /dev/null +++ b/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 { +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/VideoRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/VideoRecordServiceImpl.java new file mode 100644 index 0000000..d01994c --- /dev/null +++ b/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 implements VideoRecordService { + +} \ No newline at end of file