传感器类型管理功能重构
parent
730657c0ef
commit
a0b140ae8f
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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("保存失败");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
@ -18,31 +20,43 @@ import java.math.BigDecimal;
|
|||
@AllArgsConstructor
|
||||
@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;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "低报阈值", name = "thresholdLow")
|
||||
private BigDecimal thresholdLow;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "高报阈值", name = "thresholdHigh")
|
||||
private BigDecimal thresholdHigh;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "高高报阈值", name = "thresholdHighHigh")
|
||||
private BigDecimal thresholdHighHigh;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "量程上限")
|
||||
private BigDecimal rangeMax;
|
||||
|
||||
@ApiModelProperty(value = "量程下限")
|
||||
private BigDecimal rangeMin;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
@ -18,34 +20,43 @@ import java.math.BigDecimal;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
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 = "类型名称", name = "typeName", required = false)
|
||||
|
||||
@ApiModelProperty(value = "传感器类型业务ID")
|
||||
private String sensorTypeId;
|
||||
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "低报阈值", name = "thresholdLow")
|
||||
private BigDecimal thresholdLow;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "高报阈值", name = "thresholdHigh")
|
||||
private BigDecimal thresholdHigh;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "高高报阈值", name = "thresholdHighHigh")
|
||||
private BigDecimal thresholdHighHigh;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "量程上限")
|
||||
private BigDecimal rangeMax;
|
||||
|
||||
@ApiModelProperty(value = "量程下限")
|
||||
private BigDecimal rangeMin;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,63 +15,74 @@ 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;
|
||||
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "创建人ID")
|
||||
private Long createId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "创建人姓名")
|
||||
private String createName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "更新人ID")
|
||||
private Long updateId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "更新人姓名")
|
||||
private String updateName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
private Long orgId;
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,64 +14,69 @@ import java.math.BigDecimal;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SensorTypeE extends BaseE {
|
||||
|
||||
|
||||
/**
|
||||
* 传感器类型业务ID (生成32位UUID)
|
||||
*/
|
||||
private String sensorTypeId;
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
private String typeCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
|
||||
/**
|
||||
* 传感器属性(NUMBER/SWITCH)
|
||||
*/
|
||||
private String sensorAttr;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 环境
|
||||
*/
|
||||
private String env;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 低低报阈值
|
||||
*/
|
||||
private BigDecimal thresholdLowLow;
|
||||
|
||||
|
||||
/**
|
||||
* 低报阈值
|
||||
*/
|
||||
private BigDecimal thresholdLow;
|
||||
|
||||
|
||||
/**
|
||||
* 高报阈值
|
||||
*/
|
||||
private BigDecimal thresholdHigh;
|
||||
|
||||
|
||||
/**
|
||||
* 高高报阈值
|
||||
*/
|
||||
private BigDecimal thresholdHighHigh;
|
||||
}
|
||||
|
||||
private String unitName;
|
||||
|
||||
private BigDecimal rangeMax;
|
||||
|
||||
private BigDecimal rangeMin;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 环境
|
||||
*/
|
||||
private String env;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue