传感器类型管理功能重构

main
zhangyue 2026-04-22 15:58:44 +08:00
parent 730657c0ef
commit a0b140ae8f
7 changed files with 146 additions and 108 deletions

View File

@ -2,6 +2,7 @@ package com.zcloud.web;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.sdk.http.annotation.request.Post;
import com.zcloud.api.SensorTypeServiceI;
import com.zcloud.dto.SensorTypeAddCmd;
import com.zcloud.dto.SensorTypePageQry;
@ -41,7 +42,7 @@ public class SensorTypeController {
}
@ApiOperation("修改")
@PutMapping("/edit")
@PostMapping("/edit")
// @PreAuthorize("@pms.hasAnyPermission('iotalarm-sensortype-edit')")
public SingleResponse edit(@Validated @RequestBody SensorTypeUpdateCmd cmd) {
sensorTypeService.edit(cmd);
@ -49,7 +50,7 @@ public class SensorTypeController {
}
@ApiOperation("删除")
@DeleteMapping("/{id}")
@PostMapping("/{id}")
// @PreAuthorize("@pms.hasAnyPermission('iotalarm-sensortype-delete')")
public SingleResponse remove(@PathVariable("id") Long id) {
sensorTypeService.remove(id);

View File

@ -34,9 +34,6 @@ public class SensorTypeAddExe {
SensorTypeE entity = new SensorTypeE();
BeanUtils.copyProperties(cmd, entity);
entity.setSensorTypeId(UuidUtil.get32UUID());
// 设置默认值
entity.setDeleteEnum("FALSE");
Long res = sensorTypeGateway.add(entity);
if (Tools.isEmpty(res)) {
throw new BizException("保存失败");

View File

@ -6,6 +6,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
/**
@ -19,21 +21,18 @@ import java.math.BigDecimal;
@EqualsAndHashCode(callSuper = true)
public class SensorTypeAddCmd extends Command {
@ApiModelProperty(value = "类型编码", name = "typeCode", required = true)
private String typeCode;
@ApiModelProperty(value = "传感器类型业务ID")
private String sensorTypeId;
@ApiModelProperty(value = "类型名称", name = "typeName", required = true)
@NotEmpty(message = "传感器属性不能为空")
private String typeName;
@ApiModelProperty(value = "传感器属性(NUMBER/SWITCH)", name = "sensorAttr", required = true)
@NotEmpty(message = "传感器属性不能为空")
private String sensorAttr;
@ApiModelProperty(value = "备注", name = "remarks")
private String remarks;
@ApiModelProperty(value = "环境", name = "env")
private String env;
@ApiModelProperty(value = "低低报阈值", name = "thresholdLowLow")
private BigDecimal thresholdLowLow;
@ -45,4 +44,19 @@ public class SensorTypeAddCmd extends Command {
@ApiModelProperty(value = "高高报阈值", name = "thresholdHighHigh")
private BigDecimal thresholdHighHigh;
@ApiModelProperty(value = "单位")
private String unitName;
@ApiModelProperty(value = "量程上限")
private BigDecimal rangeMax;
@ApiModelProperty(value = "量程下限")
private BigDecimal rangeMin;
}

View File

@ -6,6 +6,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
/**
@ -22,21 +24,17 @@ public class SensorTypeUpdateCmd extends Command {
@ApiModelProperty(value = "主键ID", name = "id", required = true)
private Long id;
@ApiModelProperty(value = "类型编码", name = "typeCode", required = false)
private String typeCode;
@ApiModelProperty(value = "传感器类型业务ID")
private String sensorTypeId;
@ApiModelProperty(value = "类型名称", name = "typeName", required = false)
@ApiModelProperty(value = "类型名称", name = "typeName", required = true)
@NotEmpty(message = "传感器属性不能为空")
private String typeName;
@ApiModelProperty(value = "传感器属性(NUMBER/SWITCH)", name = "sensorAttr", required = false)
@ApiModelProperty(value = "传感器属性(NUMBER/SWITCH)", name = "sensorAttr", required = true)
@NotEmpty(message = "传感器属性不能为空")
private String sensorAttr;
@ApiModelProperty(value = "备注", name = "remarks")
private String remarks;
@ApiModelProperty(value = "环境", name = "env")
private String env;
@ApiModelProperty(value = "低低报阈值", name = "thresholdLowLow")
private BigDecimal thresholdLowLow;
@ -48,4 +46,17 @@ public class SensorTypeUpdateCmd extends Command {
@ApiModelProperty(value = "高高报阈值", name = "thresholdHighHigh")
private BigDecimal thresholdHighHigh;
@ApiModelProperty(value = "单位")
private String unitName;
@ApiModelProperty(value = "量程上限")
private BigDecimal rangeMax;
@ApiModelProperty(value = "量程下限")
private BigDecimal rangeMin;
}

View File

@ -16,14 +16,13 @@ import java.util.Date;
@Data
public class SensorTypeCO extends ClientObject {
@ApiModelProperty(value = "主键ID")
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "传感器类型业务ID")
private String sensorTypeId;
@ApiModelProperty(value = "类型编码")
private String typeCode;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ -31,6 +30,29 @@ public class SensorTypeCO extends ClientObject {
@ApiModelProperty(value = "传感器属性(NUMBER/SWITCH)")
private String sensorAttr;
@ApiModelProperty(value = "单位")
private String unitName;
@ApiModelProperty(value = "量程上限")
private BigDecimal rangeMax;
@ApiModelProperty(value = "量程下限")
private BigDecimal rangeMin;
@ApiModelProperty(value = "高高报阈值")
private BigDecimal thresholdHighHigh;
@ApiModelProperty(value = "高报阈值")
private BigDecimal thresholdHigh;
@ApiModelProperty(value = "低低报阈值")
private BigDecimal thresholdLowLow;
@ApiModelProperty(value = "低报阈值")
private BigDecimal thresholdLow;
@ApiModelProperty(value = "备注")
private String remarks;
@ -63,15 +85,4 @@ public class SensorTypeCO extends ClientObject {
@ApiModelProperty(value = "环境")
private String env;
@ApiModelProperty(value = "低低报阈值")
private BigDecimal thresholdLowLow;
@ApiModelProperty(value = "低报阈值")
private BigDecimal thresholdLow;
@ApiModelProperty(value = "高报阈值")
private BigDecimal thresholdHigh;
@ApiModelProperty(value = "高高报阈值")
private BigDecimal thresholdHighHigh;
}

View File

@ -20,10 +20,6 @@ public class SensorTypeE extends BaseE {
*/
private String sensorTypeId;
/**
*
*/
private String typeCode;
/**
*
@ -35,6 +31,34 @@ public class SensorTypeE extends BaseE {
*/
private String sensorAttr;
/**
*
*/
private BigDecimal thresholdLowLow;
/**
*
*/
private BigDecimal thresholdLow;
/**
*
*/
private BigDecimal thresholdHigh;
/**
*
*/
private BigDecimal thresholdHighHigh;
private String unitName;
private BigDecimal rangeMax;
private BigDecimal rangeMin;
/**
*
*/
@ -55,23 +79,4 @@ public class SensorTypeE extends BaseE {
*/
private String env;
/**
*
*/
private BigDecimal thresholdLowLow;
/**
*
*/
private BigDecimal thresholdLow;
/**
*
*/
private BigDecimal thresholdHigh;
/**
*
*/
private BigDecimal thresholdHighHigh;
}

View File

@ -18,11 +18,12 @@ import java.math.BigDecimal;
@EqualsAndHashCode(callSuper = true)
public class SensorTypeDO extends BaseDO {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "传感器类型业务ID")
private String sensorTypeId;
@ApiModelProperty(value = "类型编码")
private String typeCode;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ -51,8 +52,6 @@ public class SensorTypeDO extends BaseDO {
@ApiModelProperty(value = "低报阈值")
private BigDecimal thresholdLow;
@ApiModelProperty(value = "备注")
private String remarks;
}