feat: 设备管理相关功能

This commit is contained in:
2024-04-02 10:14:20 +08:00
parent 0081e21fc8
commit 062bbb55e3
8 changed files with 49 additions and 3 deletions
@@ -30,7 +30,7 @@ import org.apache.poi.ss.formula.functions.T;
*/
@Api(tags="设备")
@RestController
@RequestMapping("/khDevice")
@RequestMapping("/device")
@Slf4j
public class KhDeviceController extends JeroController<KhDevice, IKhDeviceService> {
@Autowired
@@ -24,7 +24,7 @@ import org.apache.poi.ss.formula.functions.T;
*/
@Api(tags="系统设置")
@RestController
@RequestMapping("/khSystemSetting")
@RequestMapping("/systemSetting")
@Slf4j
public class KhSystemSettingController extends JeroController<KhSystemSetting, IKhSystemSettingService> {
@@ -30,7 +30,7 @@ import org.apache.poi.ss.formula.functions.T;
*/
@Api(tags="井口")
@RestController
@RequestMapping("/khWellhead")
@RequestMapping("/wellhead")
@Slf4j
public class KhWellheadController extends JeroController<KhWellhead, IKhWellheadService> {
@Autowired
@@ -6,6 +6,7 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jero.common.aspect.annotation.Dict;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@@ -64,6 +65,7 @@ public class KhDevice implements Serializable {
/**所属井口*/
@Excel(name = "所属井口", width = 15)
@ApiModelProperty(value = "所属井口")
@Dict(dicCode = "id", dictTable = "kh_wellhead", dicText = "wellhead_name")
private String wellheadId;
/**设备描述*/
@Excel(name = "设备描述", width = 15)
@@ -67,9 +67,11 @@ public class KhSystemSetting implements Serializable {
/**数据采集协议*/
@Excel(name = "数据采集协议", width = 15)
@ApiModelProperty(value = "数据采集协议")
@Dict(dicCode = "data_acquisition_protocol")
private String dataAcquisitionProtocol;
/**数据采集周期*/
@Excel(name = "数据采集周期", width = 15)
@ApiModelProperty(value = "数据采集周期")
@Dict(dicCode = "data_acquisition_cycle")
private String dataAcquisitionCycle;
}
@@ -63,10 +63,12 @@ public class KhWellhead implements Serializable {
/**所属井场*/
@Excel(name = "所属井场", width = 15)
@ApiModelProperty(value = "所属井场")
@Dict(dicCode = "wellhead_area")
private String wellheadArea;
/**井口类型*/
@Excel(name = "井口类型", width = 15)
@ApiModelProperty(value = "井口类型")
@Dict(dicCode = "wellhead_type")
private String wellheadType;
/**井口名称*/
@Excel(name = "井口名称", width = 15)
@@ -0,0 +1,33 @@
package com.jero.modules.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @description
* @date 2022/1/21 15:22
* @auth zhn
*/
@Getter
@AllArgsConstructor
public enum YesOrNoEnum {
/**
*
*/
NO("","0",0),
YES("","1",1);
final String name;
final String value;
final Integer integer;
public static String getNameByValue(String value) {
for (YesOrNoEnum enumObject : values()) {
if (enumObject.getValue().equals(value)) {
return enumObject.getName();
}
}
return null;
}
}
@@ -1,7 +1,9 @@
package com.jero.modules.service.impl;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.modules.entity.KhDevice;
import com.jero.modules.enums.YesOrNoEnum;
import com.jero.modules.mapper.KhDeviceMapper;
import com.jero.modules.service.IKhDeviceService;
import org.springframework.stereotype.Service;
@@ -67,6 +69,11 @@ public class KhDeviceServiceImpl extends ServiceImpl<KhDeviceMapper, KhDevice> i
Date now = new Date();
khDevice.setCreateTime(now);
khDevice.setUpdateTime(now);
// 生成随机8位数
String deviceSn = RandomUtil.randomNumbers(8);
khDevice.setDeviceSn(deviceSn);
// 默认为在线状态
khDevice.setDeviceStatus(YesOrNoEnum.YES.getValue());
save(khDevice);
}