Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
5695ec5c88
@ -16,4 +16,9 @@ public interface SysAuthorityIds {
|
|||||||
* 设备台账浏览权限
|
* 设备台账浏览权限
|
||||||
*/
|
*/
|
||||||
Integer SYS_AUTHORITY_ID_DEVICE_VIEW = 103;
|
Integer SYS_AUTHORITY_ID_DEVICE_VIEW = 103;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 风机启停复位控制权限
|
||||||
|
*/
|
||||||
|
Integer SYS_AUTHORITY_ID_TURBINE_CTRL=104;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class DataController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 实时数据查询
|
* 实时数据查询
|
||||||
* @param param 查询数据请求体
|
* @param param 查询条件
|
||||||
* @return redis数据
|
* @return redis数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/snapshot")
|
@PostMapping("/snapshot")
|
||||||
@ -43,8 +43,8 @@ public class DataController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 历史区间数据查询
|
* 历史区间数据查询
|
||||||
* @param param
|
* @param param 查询条件
|
||||||
* @return
|
* @return TD数据库数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/history")
|
@PostMapping("/history")
|
||||||
public R<Map<String, Map<String, Map<String, Object>>>> queryTimeSeriesValues(@RequestBody @Valid TSValueQueryParam param) {
|
public R<Map<String, Map<String, Map<String, Object>>>> queryTimeSeriesValues(@RequestBody @Valid TSValueQueryParam param) {
|
||||||
|
@ -6,15 +6,20 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据查询参数
|
||||||
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@Data
|
@Data
|
||||||
public class SnapshotValueQueryParam
|
public class SnapshotValueQueryParam
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 测点irn列表
|
* 设备ID
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
/**
|
||||||
|
* 设备所属物模型中的属性列表
|
||||||
|
*/
|
||||||
private List<String> attributes;
|
private List<String> attributes;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,11 @@ public class DataService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DataServiceImpl dataService;
|
private DataServiceImpl dataService;
|
||||||
|
|
||||||
// 读取实时数据快照
|
/**
|
||||||
|
* 读取实时数据快照
|
||||||
|
* @param paramList 设备id及设备属性列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Map<String, Map<String, Object>> querySnapshotValues(List<SnapshotValueQueryParam> paramList) {
|
public Map<String, Map<String, Object>> querySnapshotValues(List<SnapshotValueQueryParam> paramList) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Map<String, Map<String, Object>> result = new HashMap<>(paramList.size());
|
Map<String, Map<String, Object>> result = new HashMap<>(paramList.size());
|
||||||
@ -80,7 +84,11 @@ public class DataService {
|
|||||||
return finalResult;
|
return finalResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史区间数据查询
|
||||||
|
* @param param 查询条件
|
||||||
|
* @return TD数据库数据
|
||||||
|
*/
|
||||||
public Map<String, Map<String, Map<String, Object>>> queryTimeSeriesValues(TSValueQueryParam param) {
|
public Map<String, Map<String, Map<String, Object>>> queryTimeSeriesValues(TSValueQueryParam param) {
|
||||||
if (CollectionUtil.isEmpty(param.getDevices()) || (param.getStartTime() == null && param.getEndTime() == null)) {
|
if (CollectionUtil.isEmpty(param.getDevices()) || (param.getStartTime() == null && param.getEndTime() == null)) {
|
||||||
throw new ServiceException("必要参数缺失");
|
throw new ServiceException("必要参数缺失");
|
||||||
|
@ -68,6 +68,10 @@ public class SysIotModelFieldDto implements Serializable {
|
|||||||
private String orderColumn;
|
private String orderColumn;
|
||||||
|
|
||||||
private String orderType;
|
private String orderType;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,5 +60,10 @@ public class SysIotModelFieldExcel {
|
|||||||
* 是否可见
|
* 是否可见
|
||||||
*/
|
*/
|
||||||
private Integer visible;
|
private Integer visible;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,26 @@ public class SysIotModelFieldVo {
|
|||||||
private Integer porder;
|
private Integer porder;
|
||||||
|
|
||||||
private Integer revision;
|
private Integer revision;
|
||||||
|
/**
|
||||||
|
* 属性频度:0低频属性,1高频属性
|
||||||
|
*/
|
||||||
private Integer highSpeed;
|
private Integer highSpeed;
|
||||||
|
/**
|
||||||
|
* 子系统
|
||||||
|
*/
|
||||||
private String subSystem;
|
private String subSystem;
|
||||||
|
/**
|
||||||
|
* 数据类型:int4,int8;float4;float8
|
||||||
|
*/
|
||||||
private String dataType;
|
private String dataType;
|
||||||
|
/**
|
||||||
|
* 是否可见:0不可见,1可见
|
||||||
|
*/
|
||||||
private Integer visible;
|
private Integer visible;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -93,4 +93,10 @@ public class SysIotModelField extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField("visible")
|
@TableField("visible")
|
||||||
private Integer visible;
|
private Integer visible;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
@TableField("unit")
|
||||||
|
private String unit;
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,9 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
}
|
}
|
||||||
SysIotModelFieldVo sysIotModelFieldQuery = sysIotModelFieldMapper.selectByAttributeCode(sysIotModelFieldDto.getIotModelId(), sysIotModelFieldDto.getAttributeCode());
|
SysIotModelFieldVo sysIotModelFieldQuery = sysIotModelFieldMapper.selectByAttributeCode(sysIotModelFieldDto.getIotModelId(), sysIotModelFieldDto.getAttributeCode());
|
||||||
if (!(sysIotModelFieldQuery == null)) {
|
if (!(sysIotModelFieldQuery == null)) {
|
||||||
if (sysIotModelFieldQuery.getId() != sysIotModelFieldDto.getId()){
|
if (!sysIotModelFieldQuery.getId().equals(sysIotModelFieldDto.getId())){
|
||||||
throw new ServiceException("物模型属性code已经存在");
|
throw new ServiceException("物模型属性code已经存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
sysIotModelFieldMapper.updateById(sysIotModelField);
|
sysIotModelFieldMapper.updateById(sysIotModelField);
|
||||||
|
|
||||||
@ -284,6 +283,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
map.put("attributeCode", "*物模型属性编码");
|
map.put("attributeCode", "*物模型属性编码");
|
||||||
map.put("attributeName", "*物模型属性名称");
|
map.put("attributeName", "*物模型属性名称");
|
||||||
map.put("attributeType", "*属性类型(138:模拟量,139:累积量,140:离散量)");
|
map.put("attributeType", "*属性类型(138:模拟量,139:累积量,140:离散量)");
|
||||||
|
map.put("unit", "单位");
|
||||||
map.put("porder", "*测点序号");
|
map.put("porder", "*测点序号");
|
||||||
map.put("subSystem", "子系統");
|
map.put("subSystem", "子系統");
|
||||||
map.put("dataType", "数据类型");
|
map.put("dataType", "数据类型");
|
||||||
@ -453,11 +453,12 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
field.setAttributeCode(row.get(3).toString().toLowerCase());
|
field.setAttributeCode(row.get(3).toString().toLowerCase());
|
||||||
field.setAttributeName(row.get(4).toString());
|
field.setAttributeName(row.get(4).toString());
|
||||||
field.setAttributeType(Integer.valueOf(row.get(5).toString()));
|
field.setAttributeType(Integer.valueOf(row.get(5).toString()));
|
||||||
field.setPorder(Integer.valueOf(row.get(6).toString()));
|
field.setUnit(row.get(6).toString());
|
||||||
field.setSubSystem(row.get(7).toString());
|
field.setPorder(Integer.valueOf(row.get(7).toString()));
|
||||||
field.setDataType(row.get(8).toString());
|
field.setSubSystem(row.get(8).toString());
|
||||||
field.setVisible(Integer.valueOf(row.get(9).toString()));
|
field.setDataType(row.get(9).toString());
|
||||||
field.setHighSpeed(Integer.valueOf(row.get(10).toString()));
|
field.setVisible(Integer.valueOf(row.get(10).toString()));
|
||||||
|
field.setHighSpeed(Integer.valueOf(row.get(11).toString()));
|
||||||
field.setIotModelId(Long.valueOf(iotModelId));
|
field.setIotModelId(Long.valueOf(iotModelId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class SysNodeController {
|
|||||||
public R<SysNodeVo> createSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
public R<SysNodeVo> createSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ public class SysNodeController {
|
|||||||
public R<SysNodeVo> updateSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
public R<SysNodeVo> updateSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ public class SysNodeController {
|
|||||||
public R<Void> deleteSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
public R<Void> deleteSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ public class SysNodeController {
|
|||||||
public R<SysCommunicationLinkVo> createSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
public R<SysCommunicationLinkVo> createSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ public class SysNodeController {
|
|||||||
public R<SysCommunicationLinkVo> updateSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
public R<SysCommunicationLinkVo> updateSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ public class SysNodeController {
|
|||||||
public R<SysCommunicationLinkVo> deleteSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
public R<SysCommunicationLinkVo> deleteSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -160,13 +160,13 @@ public class SysNodeController {
|
|||||||
public R<?> getMappingList(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
public R<?> getMappingList(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
// boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
// if(!hasPermission){
|
if(!hasPermission){
|
||||||
// return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
// }
|
}
|
||||||
// if (sysImptabmappingDto.getLinkId() == null) {
|
if (sysImptabmappingDto.getLinkId() == null) {
|
||||||
// throw new ServiceException("参数缺失");
|
throw new ServiceException("参数缺失");
|
||||||
// }
|
}
|
||||||
List<ImptabmappingVo> list = sysNodeService.getMappingList(sysImptabmappingDto);
|
List<ImptabmappingVo> list = sysNodeService.getMappingList(sysImptabmappingDto);
|
||||||
return R.success(list);
|
return R.success(list);
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ public class SysNodeController {
|
|||||||
public R<?> getBindDeviceTree(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
public R<?> getBindDeviceTree(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ public class SysNodeController {
|
|||||||
public R<Void> bindMeas(@RequestBody BindEquipmentDto bindEquipmentDto) {
|
public R<Void> bindMeas(@RequestBody BindEquipmentDto bindEquipmentDto) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ public class SysNodeController {
|
|||||||
public R<Void> saveMappingList(@RequestBody List<ImptabmappingDto> impList) {
|
public R<Void> saveMappingList(@RequestBody List<ImptabmappingDto> impList) {
|
||||||
|
|
||||||
//判断是否有权限
|
//判断是否有权限
|
||||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_ADMIN.toString());
|
||||||
if(!hasPermission){
|
if(!hasPermission){
|
||||||
return R.fail("没有节点管理权限");
|
return R.fail("没有节点管理权限");
|
||||||
}
|
}
|
||||||
@ -232,10 +232,22 @@ public class SysNodeController {
|
|||||||
return R.success("导入失败");
|
return R.success("导入失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 遥控遥调 */
|
/**
|
||||||
@PostMapping("/link/deviceControl")
|
* 设备遥控操作
|
||||||
public void deviceControl(@RequestBody DeviceControlDto device) {
|
* @param deviceInfo 遥控信息
|
||||||
sysNodeService.deviceControl(device);
|
*/
|
||||||
|
@PostMapping("/link/command")
|
||||||
|
public void deviceCommand(@RequestBody DeviceCommandDto deviceInfo) {
|
||||||
|
sysNodeService.deviceCommand(deviceInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备遥调操作
|
||||||
|
* @param deviceInfo 遥控信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/link/setPoint")
|
||||||
|
public void deviceSetPoint(@RequestBody DeviceSetPointDto deviceInfo) {
|
||||||
|
sysNodeService.deviceSetPoint(deviceInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,23 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备控制 输入参数
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class DeviceControlDto {
|
public class DeviceCommandDto {
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
*/
|
||||||
private Long nodeId;
|
|
||||||
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long deviceId;
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 遥控命令
|
||||||
|
*/
|
||||||
private String serviceName;
|
private String serviceName;
|
||||||
|
/**
|
||||||
|
*遥控值, 1或者0
|
||||||
|
*/
|
||||||
private Integer opValue;
|
private Integer opValue;
|
||||||
}
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.das.modules.node.domain.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceSetPointDto {
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 遥调命令
|
||||||
|
*/
|
||||||
|
private String serviceName;
|
||||||
|
/**
|
||||||
|
*遥调值,浮点数
|
||||||
|
*/
|
||||||
|
private Float opValue;
|
||||||
|
}
|
@ -43,5 +43,15 @@ public interface SysNodeService {
|
|||||||
|
|
||||||
boolean importMappingList(String linkId, MultipartFile file);
|
boolean importMappingList(String linkId, MultipartFile file);
|
||||||
|
|
||||||
void deviceControl(DeviceControlDto device);
|
/**
|
||||||
|
* 设备遥控操作
|
||||||
|
* @param deviceInfo 遥控具体的设备信息,设备id、遥控命令、遥控值
|
||||||
|
*/
|
||||||
|
void deviceCommand(DeviceCommandDto deviceInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备遥调操作
|
||||||
|
* @param deviceInfo 遥调具体的设备信息,设备id、遥调命令、遥调值
|
||||||
|
*/
|
||||||
|
void deviceSetPoint(DeviceSetPointDto deviceInfo);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
}
|
}
|
||||||
IoUtil.close(os);
|
IoUtil.close(os);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deviceControl(DeviceControlDto device) {
|
public void deviceCommand(DeviceCommandDto device) {
|
||||||
try {
|
try {
|
||||||
HashMap map = new HashMap<>();
|
HashMap map = new HashMap<>();
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
@ -345,6 +345,12 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
map.put("serviceName", device.getServiceName());
|
map.put("serviceName", device.getServiceName());
|
||||||
map.put("opValue", device.getOpValue());
|
map.put("opValue", device.getOpValue());
|
||||||
|
|
||||||
|
//激活的node节点Id
|
||||||
|
long activeNodeId = getActiveNodeId();
|
||||||
|
if(activeNodeId==0){
|
||||||
|
throw new RuntimeException("找不到激活的节点信息");
|
||||||
|
}
|
||||||
|
|
||||||
// 将 HashMap 转换为 JsonNode
|
// 将 HashMap 转换为 JsonNode
|
||||||
ObjectNode jsonNode = objectMapper.convertValue(map, ObjectNode.class);
|
ObjectNode jsonNode = objectMapper.convertValue(map, ObjectNode.class);
|
||||||
TerminalMessage configUpdate = TerminalMessage.builder()
|
TerminalMessage configUpdate = TerminalMessage.builder()
|
||||||
@ -353,13 +359,58 @@ public class SysNodeServiceImpl implements SysNodeService {
|
|||||||
.time(time)
|
.time(time)
|
||||||
.data(jsonNode)
|
.data(jsonNode)
|
||||||
.build();
|
.build();
|
||||||
terminalMessageEventHandler.sendTerminalMessageWithResult(device.getNodeId(), configUpdate);
|
terminalMessageEventHandler.sendTerminalMessageWithResult(activeNodeId, configUpdate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("设备控制失败 ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deviceSetPoint(DeviceSetPointDto device) {
|
||||||
|
try {
|
||||||
|
HashMap map = new HashMap<>();
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
String cmd = NodeConstant.DEVICE_CONTROL;
|
||||||
|
Long time = System.currentTimeMillis();
|
||||||
|
|
||||||
|
map.put("deviceId", device.getDeviceId());
|
||||||
|
map.put("serviceName", device.getServiceName());
|
||||||
|
map.put("opValue", device.getOpValue());
|
||||||
|
|
||||||
|
//激活的node节点Id
|
||||||
|
long activeNodeId = getActiveNodeId();
|
||||||
|
if(activeNodeId==0){
|
||||||
|
throw new RuntimeException("找不到激活的节点信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 HashMap 转换为 JsonNode
|
||||||
|
ObjectNode jsonNode = objectMapper.convertValue(map, ObjectNode.class);
|
||||||
|
TerminalMessage configUpdate = TerminalMessage.builder()
|
||||||
|
.cmd(cmd)
|
||||||
|
.cmdId(String.valueOf(device.getDeviceId()))
|
||||||
|
.time(time)
|
||||||
|
.data(jsonNode)
|
||||||
|
.build();
|
||||||
|
terminalMessageEventHandler.sendTerminalMessageWithResult(activeNodeId, configUpdate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("设备控制失败 ", e);
|
log.error("设备控制失败 ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得当前激活的节点id
|
||||||
|
* @return 节点id
|
||||||
|
*/
|
||||||
|
private long getActiveNodeId(){
|
||||||
|
List<SysNodeVo> list = sysNodeMapper.querySysNodeList();
|
||||||
|
if(list.isEmpty()){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return list.get(0).getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 绑定设备的测点信息,不是绑定设备到映射表
|
// 绑定设备的测点信息,不是绑定设备到映射表
|
||||||
private void addSysImptabmapping(List<BindEquipmentInfoDto> equipmentId, Long linkId, SysUserVo sysUserVo, List<SysImptabmapping> addList) {
|
private void addSysImptabmapping(List<BindEquipmentInfoDto> equipmentId, Long linkId, SysUserVo sysUserVo, List<SysImptabmapping> addList) {
|
||||||
|
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.das.modules.page.controller;
|
||||||
|
|
||||||
|
import com.das.common.result.R;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author houwei
|
||||||
|
* @date 2024-10-24
|
||||||
|
* @description: 风机列表页面 对应的 后端api
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/api/page/turbines")
|
||||||
|
@RestController
|
||||||
|
public class WindTurbinesPageController {
|
||||||
|
/**
|
||||||
|
* 获取风机机组所属线路列表
|
||||||
|
* @return 返回字符串数组
|
||||||
|
*/
|
||||||
|
@PostMapping("/lines")
|
||||||
|
public R<List<String>> queryBelongLines() {
|
||||||
|
//TODO: 查询sql: select distinct belong_line as name from sys_equipment t where t.object_type = 10002 and belong_line !='';
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
<result property="revision" column="revision" jdbcType="INTEGER"/>
|
<result property="revision" column="revision" jdbcType="INTEGER"/>
|
||||||
<result property="id" column="id" jdbcType="BIGINT"/>
|
<result property="id" column="id" jdbcType="BIGINT"/>
|
||||||
<result property="iotModelId" column="iot_model_id" jdbcType="BIGINT"/>
|
<result property="iotModelId" column="iot_model_id" jdbcType="BIGINT"/>
|
||||||
|
<result property="unit" column="unit" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="querySysIotModelFieldList" resultMap="SysIotModelFieldMap">
|
<select id="querySysIotModelFieldList" resultMap="SysIotModelFieldMap">
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
<result property="subSystem" column="subsystem" jdbcType="VARCHAR"/>
|
<result property="subSystem" column="subsystem" jdbcType="VARCHAR"/>
|
||||||
<result property="dataType" column="datatype" jdbcType="VARCHAR"/>
|
<result property="dataType" column="datatype" jdbcType="VARCHAR"/>
|
||||||
<result property="visible" column="visible" jdbcType="INTEGER"/>
|
<result property="visible" column="visible" jdbcType="INTEGER"/>
|
||||||
|
<result property="unit" column="unit" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="com.das.modules.equipment.domain.vo.SysIotModelVo" id="SysIotModelMap">
|
<resultMap type="com.das.modules.equipment.domain.vo.SysIotModelVo" id="SysIotModelMap">
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -237,9 +237,14 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
<div class="formRowStyle">
|
||||||
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
||||||
</el-form-item>
|
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="attributeForm.attributeType === 138 || attributeForm.attributeType === 139" :label="ModelAttributeFieldsEnums['unit']" prop="unit">
|
||||||
|
<el-input v-model="attributeForm.unit" :placeholder="'请输入' + ModelAttributeFieldsEnums['unit']"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['subSystem']" prop="subSystem">
|
<el-form-item :label="ModelAttributeFieldsEnums['subSystem']" prop="subSystem">
|
||||||
<el-input v-model="attributeForm.subSystem" :placeholder="'请输入' + ModelAttributeFieldsEnums['subSystem']"></el-input>
|
<el-input v-model="attributeForm.subSystem" :placeholder="'请输入' + ModelAttributeFieldsEnums['subSystem']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -750,6 +755,7 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
|||||||
subSystem: '',
|
subSystem: '',
|
||||||
dataType: '',
|
dataType: '',
|
||||||
visible: true,
|
visible: true,
|
||||||
|
unit:'',
|
||||||
revision: 1,
|
revision: 1,
|
||||||
createdBy: undefined,
|
createdBy: undefined,
|
||||||
createdTime: undefined,
|
createdTime: undefined,
|
||||||
@ -907,8 +913,10 @@ const attributeAndServiceRules = {
|
|||||||
|
|
||||||
const addModelAttributeAndService = () => {
|
const addModelAttributeAndService = () => {
|
||||||
if (ModelTabs.value === 'attribute') {
|
if (ModelTabs.value === 'attribute') {
|
||||||
|
attributeFormTitle.value = AttributeDialogTitleStateType['add']
|
||||||
attributeVisible.value = true
|
attributeVisible.value = true
|
||||||
} else {
|
} else {
|
||||||
|
serviceFormTitle.value = serviceDialogTitleStateType['add']
|
||||||
serviceVisible.value = true
|
serviceVisible.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1110,5 +1118,8 @@ $paginationHeight: 32px;
|
|||||||
.el-select {
|
.el-select {
|
||||||
width: 184px;
|
width: 184px;
|
||||||
}
|
}
|
||||||
|
.el-input{
|
||||||
|
width: 184px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -66,6 +66,7 @@ export enum ModelAttributeFieldsEnums {
|
|||||||
'subSystem' = '子系统',
|
'subSystem' = '子系统',
|
||||||
'dataType' = '数据类型',
|
'dataType' = '数据类型',
|
||||||
'visible' = '是否可见',
|
'visible' = '是否可见',
|
||||||
|
'unit'='单位',
|
||||||
'revision' = '乐观锁',
|
'revision' = '乐观锁',
|
||||||
'createdBy' = '创建人',
|
'createdBy' = '创建人',
|
||||||
'createdTime' = '创建时间',
|
'createdTime' = '创建时间',
|
||||||
@ -108,6 +109,7 @@ export type AddModelAttributeType = {
|
|||||||
highSpeed: 0 | 1 | boolean
|
highSpeed: 0 | 1 | boolean
|
||||||
subSystem: string
|
subSystem: string
|
||||||
dataType: attributeTypeDataType | ''
|
dataType: attributeTypeDataType | ''
|
||||||
|
unit:string
|
||||||
visible: 0 | 1 | boolean
|
visible: 0 | 1 | boolean
|
||||||
revision: number
|
revision: number
|
||||||
createdBy?: string
|
createdBy?: string
|
||||||
|
Loading…
Reference in New Issue
Block a user