From 3e3fac67aec56f48d3ad591cbefa3057fad9e858 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Fri, 24 May 2024 11:59:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=AE=9E=E6=97=B6=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=9F=A5=E8=AF=A2=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/InteractiveController.java | 4 ++-- .../service/impl/ExtraResolveStrategyService.java | 17 +++++++++++++---- .../hnac/hzims/bigmodel/interactive/vo/DataVO.java | 3 +-- .../hzims/bigmodel/interactive/vo/RealDataVO.java | 20 ++++++++++++++++++++ 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java index a80b2aa..40e79b3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java @@ -74,7 +74,7 @@ public class InteractiveController { @ApiOperation("下发遥控指令") @ApiOperationSupport(order = 6) @PostMapping("/sendRemoteControl") - public R sendRemoteControl(@RequestBody ControlDTO operate) { - return R.data(interactiveService.sendRemoteControl(operate)); + public R sendRemoteControl(@RequestBody ControlDTO operate) { + return interactiveService.sendRemoteControl(operate); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index bcda8cb..9502fec 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -18,16 +18,15 @@ import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.dto.ControlDTO; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.time.format.DateTimeFormatter; +import java.util.*; import java.util.stream.Collectors; /** @@ -38,6 +37,10 @@ import java.util.stream.Collectors; @AllArgsConstructor public class ExtraResolveStrategyService { + public static final String PATTERN_DATETIME = "yyyy-MM-dd HH:mm:ss.SSS"; + + public static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(PATTERN_DATETIME); + private final IStationClient stationClient; private final IStationVideoTypeClient videoTypeClient; private final JumpRouteJoinStrategy jumpRouteJoinStrategy; @@ -85,6 +88,11 @@ public class ExtraResolveStrategyService { result.setType(FuncRouteEnum.SHOW_PARAM.getType().getType()); Map param = new HashMap(1); DataVO data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")),DataVO.class); + if(Func.isNotEmpty(data) && Func.isNotEmpty(data.getReal()) && Func.isNotEmpty(data.getReal().getTime()) && StringUtil.isNotBlank(data.getReal().getTime())) { + RealDataVO real = data.getReal(); + Date date = DateUtil.parse(real.getTime(), PATTERN_DATETIME); + real.setTime(DateUtil.format(date,DateUtil.PATTERN_DATETIME)); + } param.put("data", data); result.setParams(param); return result; @@ -101,6 +109,7 @@ public class ExtraResolveStrategyService { param.put("control",funcVOR.getData()); param.put("deviceName",remoteParam.getDeviceName()); param.put("projectName",remoteParam.getProjectName()); + param.put("deviceCode",remoteParam.getDeviceId()); param.put("value",remoteParam.getValue()); result.setParams(param); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java index d3ea096..1f2fcfd 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; import java.io.Serializable; -import java.util.Map; /** * @Author: huangxing @@ -26,7 +25,7 @@ public class DataVO implements Serializable { private String method; /**实时数据结果集**/ - private Map real; + private RealDataVO real; private DataItemVO item; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java new file mode 100644 index 0000000..16a5a46 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springblade.core.tool.utils.DateUtil; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/24 10:26 + */ +@Data +public class RealDataVO implements Serializable { + + private String time; + + private String value; + +}