Browse Source

激光疲劳模式

develop
王兴琳 6 days ago
parent
commit
d5d79a45fb
  1. 62
      zc-business/src/main/java/com/zc/business/enums/LaserMode.java
  2. 8
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

62
zc-business/src/main/java/com/zc/business/enums/LaserMode.java

@ -0,0 +1,62 @@
package com.zc.business.enums;
/**
*
*/
public enum LaserMode {
LASER_OFF(0, "激光关闭"),
CONSTANT_ON(1, "常亮模式"),
BLINK_100MS(2, "间隔100ms闪烁模式"),
BLINK_200MS(3, "间隔200ms闪烁模式"),
BLINK_500MS(4, "间隔500ms闪烁模式"),
DOUBLE_BLINK(5, "2次闪烁模式"),
SOS(6, "SOS模式"),
CUSTOM_1(7, "自定义模式1"),
CUSTOM_2(8, "自定义模式2"),
CUSTOM_3(9, "自定义模式3");
private final int code;
private final String description;
// 构造函数
LaserMode(int code, String description) {
this.code = code;
this.description = description;
}
// 获取 code
public int getCode() {
return code;
}
// 获取 description
public String getDescription() {
return description;
}
// 根据 code 获取对应的枚举值
// 根据 code 获取对应的枚举值
public static LaserMode getByCode(int code) {
for (LaserMode mode : values()) {
if (mode.getCode() == code) {
return mode;
}
}
throw new IllegalArgumentException("无效的模式代码: " + code);
}
// 根据名称获取对应的 code
public static int getCodeByName(String name) {
for (LaserMode location : LaserMode.values()) {
if (location.getDescription().equals(name)) {
return location.getCode();
}
}
throw new IllegalArgumentException("无效的: " + name);
}
@Override
public String toString() {
return String.format("%s (%d): %s", name(), code, description);
}
}

8
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -2034,7 +2034,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
int deviceType = controlItem.getIntValue("deviceType");
if (deviceType == 2){
//情报板 切换播放目录
for (String deviceId : deviceList) {
for (String deviceId : deviceList) {
HashMap<String, Object> props = new HashMap<>();
props.put("fileId", UniversalEnum.TEN.getValue());
String functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B;
@ -2044,6 +2044,12 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
} else if (deviceType == 10){
//激光疲劳唤醒"recoverConfig": "{\"operationDuration\":1,\"operationType\":\"0\",\"name\":\"激光关闭\"}",
for (String deviceId : deviceList) {
//更改模式
HashMap<String, Object> props = new HashMap<>();
props.put(UniversalEnum.SET.getValue(), LaserMode.getCodeByName(recoverConfig.getString("name")));
String functionIdMode = UniversalEnum.SETMD.getValue();
deviceController.getAjaxResult(deviceId, functionIdMode, props);
//更改时长
HashMap<String, Object> propsTime = new HashMap<>();
propsTime.put(UniversalEnum.SET.getValue(), recoverConfig.getString("operationDuration"));
String functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_SETTM;

Loading…
Cancel
Save