|
@@ -2,6 +2,7 @@ package com.hb.proj.api.controller;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -10,12 +11,14 @@ import com.hb.proj.gather.model.LiquidParam;
|
|
|
import com.hb.proj.gather.process.DataTransConfig;
|
|
|
import com.hb.proj.gather.protocol.ChannelGroupMgr;
|
|
|
import com.hb.proj.gather.protocol.ZLOpdProtCMDEnum;
|
|
|
+import com.hb.proj.gather.rep.RedisRepComponent;
|
|
|
import com.hb.proj.gather.scheduler.GatherLiquidTask;
|
|
|
import com.hb.proj.gather.scheduler.GatherTaskExecutor;
|
|
|
import com.hb.proj.gather.scheduler.ManualLiquidTask;
|
|
|
import com.hb.proj.gather.utils.ByteUtils;
|
|
|
import com.hb.proj.utils.RespVO;
|
|
|
import com.hb.proj.utils.RespVOBuilder;
|
|
|
+import com.hb.xframework.util.MapUtils;
|
|
|
|
|
|
import io.netty.buffer.ByteBuf;
|
|
|
import io.netty.buffer.ByteBufAllocator;
|
|
@@ -27,7 +30,8 @@ import jakarta.validation.constraints.NotBlank;
|
|
|
@Validated
|
|
|
public class APIController {
|
|
|
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private RedisRepComponent repRedis;
|
|
|
|
|
|
@RequestMapping("/sendCommond")
|
|
|
public RespVO<Object> sendCommond(@NotBlank(message="指令不能为空") String cmd){
|
|
@@ -110,7 +114,7 @@ public class APIController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/liquid/set")
|
|
|
- public RespVO<Object> setLiquidParams(@NotBlank(message="设备编号不能为空") String serial,@Validated LiquidParam param){
|
|
|
+ public RespVO<Object> setLiquidParams(@NotBlank(message="设备编号不能为空") String serial,@Validated(LiquidParam.LiquidSetting.class) LiquidParam param){
|
|
|
Channel channel=ChannelGroupMgr.get(serial);
|
|
|
return liquidCtr(serial,new ManualLiquidTask(channel,ManualLiquidTask.ACTION_SET,param));
|
|
|
}
|
|
@@ -127,6 +131,7 @@ public class APIController {
|
|
|
}
|
|
|
Channel channel=ChannelGroupMgr.get(serial);
|
|
|
ChannelGroupMgr.addFuture(serial,GatherTaskExecutor.submit(new GatherLiquidTask(channel)));
|
|
|
+ repRedis.put("liquid_"+serial, MapUtils.build("status","complete","action","gather"),true);
|
|
|
return RespVOBuilder.ok();
|
|
|
}
|
|
|
|
|
@@ -137,7 +142,7 @@ public class APIController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/liquid/test")
|
|
|
- public RespVO<Object> testLiquid(@NotBlank(message="设备编号不能为空") String serial,@Validated LiquidParam param){
|
|
|
+ public RespVO<Object> testLiquid(@NotBlank(message="设备编号不能为空") String serial,@Validated(LiquidParam.LiquidTesting.class) LiquidParam param){
|
|
|
Channel channel=ChannelGroupMgr.get(serial);
|
|
|
return liquidCtr(serial,new ManualLiquidTask(channel,ManualLiquidTask.ACTION_BOOT_TEST,param));
|
|
|
}
|