Browse Source

fix:实时数据时间查询格式化

zhongwei
haungxing 6 months ago
parent
commit
3e3fac67ae
  1. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java
  2. 17
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java
  3. 3
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java
  4. 20
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java

4
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<Object> sendRemoteControl(@RequestBody ControlDTO operate) {
return R.data(interactiveService.sendRemoteControl(operate));
public R sendRemoteControl(@RequestBody ControlDTO operate) {
return interactiveService.sendRemoteControl(operate);
}
}

17
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<String,Object> 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);
}

3
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<String,Object> real;
private RealDataVO real;
private DataItemVO item;

20
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;
}
Loading…
Cancel
Save