wangyinsheng
2 months ago
6 changed files with 166 additions and 1 deletions
@ -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; |
||||||
|
} |
@ -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; |
||||||
|
|
||||||
|
} |
@ -1,14 +1,65 @@ |
|||||||
package com.hnac.gglm.bigmodel.maintenance.service; |
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.entity.DataRecordEntity; |
||||||
import com.hnac.gglm.bigmodel.maintenance.mapper.DataRecordMapper; |
import com.hnac.gglm.bigmodel.maintenance.mapper.DataRecordMapper; |
||||||
|
import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||||
import org.springblade.core.mp.base.BaseServiceImpl; |
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.core.tool.utils.BeanUtil; |
||||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
@Service |
@Service |
||||||
@Slf4j |
@Slf4j |
||||||
@AllArgsConstructor |
@AllArgsConstructor |
||||||
public class DataRecordService extends BaseServiceImpl<DataRecordMapper, DataRecordEntity> { |
public class DataRecordService extends BaseServiceImpl<DataRecordMapper, DataRecordEntity> { |
||||||
|
|
||||||
|
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<DeviceAttrDTO> getDataRecordList() { |
||||||
|
List<DataRecordEntity> list = baseMapper.selectList(null); |
||||||
|
List<DeviceAttrDTO> deviceAttrDTOS = BeanUtil.copyProperties(list, DeviceAttrDTO.class); |
||||||
|
List<DeviceAttrInfoDTO> 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; |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue