diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java index 00abfd0..f588e6f 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java @@ -2,8 +2,11 @@ package com.hnac.gglm.bigmodel.maintenance.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; import com.hnac.gglm.bigmodel.maintenance.service.DataInstructService; +import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; +import com.hnac.hzinfo.api.annotation.ApiInterface; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -15,6 +18,7 @@ import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.List; @RestController @RequestMapping("/dataInstruct") @@ -53,4 +57,13 @@ public class DataInstructController { return R.status(dataInstructService.removeByIds(Func.toLongList(",",ids))); } + + @GetMapping ("/getDataInstructList") + @ApiOperationSupport(order = 210) + @ApiOperation(value = "查询指令记录") + @ApiInterface + public R> getDataInstructList() { + return R.data(dataInstructService.getDataInstructList()); + } + } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java index 7588b01..d561cf4 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java @@ -2,8 +2,10 @@ package com.hnac.gglm.bigmodel.maintenance.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO; import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService; +import com.hnac.hzinfo.api.annotation.ApiInterface; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -15,6 +17,7 @@ import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.List; @RestController @RequestMapping("/dataRecord") @@ -51,4 +54,13 @@ public class DataRecordController { public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) { return R.status(dataRecordService.removeByIds(Func.toLongList(",",ids))); } + + @GetMapping ("/getDataRecordList") + @ApiOperationSupport(order = 200) + @ApiOperation(value = "查询数据记录记录") + @ApiInterface + public R> getDataRecordList() { + return R.data(dataRecordService.getDataRecordList()); + } + } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceAttrDTO.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceAttrDTO.java new file mode 100644 index 0000000..adcc3d4 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceAttrDTO.java @@ -0,0 +1,33 @@ +package com.hnac.gglm.bigmodel.maintenance.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class DeviceAttrDTO { + + + @ApiModelProperty("item") + private String itemId; + + @ApiModelProperty("站点名称") + private String stationName; + + @ApiModelProperty("站点ID") + private String stationId; + + @ApiModelProperty("遥控的设备名称") + private String deviceName; + + @ApiModelProperty("遥控的设备ID") + private String deviceId; + + @ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") + private String itemName; + + @ApiModelProperty("记录名称") + private String recordName; + + @ApiModelProperty("取数规则") + private String rule; +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceFuncDTO.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceFuncDTO.java new file mode 100644 index 0000000..c60ee79 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/dto/DeviceFuncDTO.java @@ -0,0 +1,28 @@ +package com.hnac.gglm.bigmodel.maintenance.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +public class DeviceFuncDTO { + + @ApiModelProperty("item") + private String itemId; + + @ApiModelProperty("站点名称") + private String stationName; + + @ApiModelProperty("站点ID") + private String stationId; + + @ApiModelProperty("遥控的设备名称") + private String deviceName; + + @ApiModelProperty("遥控的设备ID") + private String deviceId; + + @ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") + private String itemName; + +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java index 444c320..11ac798 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java @@ -2,18 +2,28 @@ package com.hnac.gglm.bigmodel.maintenance.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.gglm.bigmodel.business.service.VectorDataService; +import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; import com.hnac.gglm.bigmodel.maintenance.mapper.DataInstructMapper; +import com.hnac.hzinfo.sdk.v5.device.dto.DeviceFuncInfoDTO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; @Service @Slf4j @AllArgsConstructor public class DataInstructService extends BaseServiceImpl { + private final VectorDataService vectorDataService; + public boolean save(DataInstructEntity entity) { //对遥控名称判重 LambdaQueryWrapper queryWrapper = new QueryWrapper() @@ -27,6 +37,7 @@ public class DataInstructService extends BaseServiceImpl queryWrapper = new QueryWrapper() .lambda().eq(DataInstructEntity::getItemName, entity.getItemName()) .ne(DataInstructEntity::getId, entity.getId()); @@ -34,7 +45,24 @@ public class DataInstructService extends BaseServiceImpl 0) { return false; } - //对遥控名称判重 + //修改信息 return true; } + + public List getDataInstructList() { + List list = baseMapper.selectList(null); + List deviceFuncDTOS = BeanUtil.copyProperties(list, DeviceFuncDTO.class); + List deviceFuncList = vectorDataService.getDeviceFunc(); + for (DeviceFuncInfoDTO deviceFunc : deviceFuncList) { + DeviceFuncDTO deviceFuncDTO = new DeviceFuncDTO(); + deviceFuncDTO.setDeviceId(deviceFunc.getDeviceId()); + deviceFuncDTO.setDeviceName(deviceFunc.getDeviceName()); + deviceFuncDTO.setItemId(deviceFunc.getSignage()); + deviceFuncDTO.setItemName(deviceFunc.getItemName()); + deviceFuncDTO.setStationName(deviceFunc.getProjectName()); + deviceFuncDTO.setStationId(deviceFunc.getProjectId()); + deviceFuncDTOS.add(deviceFuncDTO); + } + return deviceFuncDTOS; + } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java index ffb3743..06cf331 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java @@ -1,14 +1,65 @@ package com.hnac.gglm.bigmodel.maintenance.service; +import com.hnac.gglm.bigmodel.business.service.VectorDataService; +import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO; +import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; import com.hnac.gglm.bigmodel.maintenance.mapper.DataRecordMapper; +import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.stereotype.Service; +import java.util.List; + @Service @Slf4j @AllArgsConstructor public class DataRecordService extends BaseServiceImpl { + + private final VectorDataService vectorDataService; + + public boolean save(DataRecordEntity entity) { + splicing(entity); + return save(entity); + } + + public boolean updateById(DataRecordEntity entity) { + splicing(entity); + return updateById(entity); + } + + /** + * //拼接itemName + * @param entity + */ + private void splicing(DataRecordEntity entity) { + String stationName = entity.getStationName() == null ? "" : entity.getStationName(); + String deviceName = entity.getDeviceName() == null ? "" : entity.getDeviceName(); + String recordName = entity.getRecordName() == null ? "" : entity.getRecordName(); + entity.setItemName(new StringBuffer(stationName) + .append(" ").append(deviceName) + .append(" ").append(recordName).toString()); + } + + public List getDataRecordList() { + List list = baseMapper.selectList(null); + List deviceAttrDTOS = BeanUtil.copyProperties(list, DeviceAttrDTO.class); + List deviceAttrList = vectorDataService.getDeviceAttr(); + for (DeviceAttrInfoDTO deviceAttr : deviceAttrList) { + DeviceAttrDTO deviceAttrDTO = new DeviceAttrDTO(); + deviceAttrDTO.setDeviceId(deviceAttr.getDeviceId()); + deviceAttrDTO.setDeviceName(deviceAttr.getDeviceName()); + deviceAttrDTO.setStationName(deviceAttr.getProjectName()); + deviceAttrDTO.setStationId(deviceAttr.getProjectId()); + deviceAttrDTO.setRecordName(deviceAttr.getName()); + deviceAttrDTO.setItemId(deviceAttr.getSignage()); + deviceAttrDTO.setRule(deviceAttr.getRule()); + deviceAttrDTO.setItemName(deviceAttr.getItemName()); + deviceAttrDTOS.add(deviceAttrDTO); + } + return deviceAttrDTOS; + } }