From 1c0aec87e2365ed27364621f3b1e736896852c15 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Sat, 25 May 2024 11:37:51 +0800 Subject: [PATCH] =?UTF-8?q?add:=E7=AB=99=E7=82=B9=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/interactive/vo/AttrSelectionVO.java | 14 ++++++ .../hzims/bigmodel/interactive/vo/DataItemVO.java | 39 ++++++++++++++++ .../hnac/hzims/bigmodel/interactive/vo/DataVO.java | 32 +++++++++++++ .../hzims/bigmodel/interactive/vo/RealDataVO.java | 20 ++++++++ .../operational/station/feign/IStationClient.java | 5 +- .../station/feign/IStationClientFallBack.java | 5 ++ .../interactive/constants/FuncRouteEnum.java | 1 + .../constants/SearchStationTypeEnum.java | 39 ++++++++++++++++ .../interactive/constants/SearchTypeEnum.java | 28 ++++++++++++ .../controller/InteractiveController.java | 7 +++ .../interactive/service/IInteractiveService.java | 3 ++ .../service/impl/ExtraResolveStrategyService.java | 49 ++++++++++++++++---- .../service/impl/InteractiveServiceImpl.java | 53 ++++++++++++++++++++++ .../hzims/bigmodel/interactive/vo/DataItemVO.java | 39 ---------------- .../hnac/hzims/bigmodel/interactive/vo/DataVO.java | 32 ------------- .../hzims/bigmodel/interactive/vo/RealDataVO.java | 20 -------- .../operational/station/feign/StationClient.java | 13 ++++++ 17 files changed, 299 insertions(+), 100 deletions(-) create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AttrSelectionVO.java create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchStationTypeEnum.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchTypeEnum.java delete mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java delete mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java delete mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AttrSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AttrSelectionVO.java new file mode 100644 index 0000000..67f0011 --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AttrSelectionVO.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/24 15:55 + */ +@Data +public class AttrSelectionVO extends SelectionVO implements Serializable { + private DataItemVO item; +} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java new file mode 100644 index 0000000..914f25b --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/22 10:20 + */ +@Data +public class DataItemVO implements Serializable { + + private String name; + + @JSONField(name = "id") + private String attrId; + + @JSONField(name = "param_name") + private String attrName; + + @JSONField(name = "device_name") + private String deviceName; + + @JSONField(name = "device_id") + private String deviceId; + + @JSONField(name = "station_id") + private String projectId; + + @JSONField(name = "station_name") + private String projectName; + + private String signage; + + private String units; + +} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java new file mode 100644 index 0000000..1f2fcfd --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java @@ -0,0 +1,32 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/22 10:28 + */ +@Data +public class DataVO implements Serializable { + + /**数据查询类型:实时、历史**/ + private String type; + + @JSONField(name = "time_begin") + private String startTime; + + @JSONField(name = "time_end") + private String endTime; + + /**包括:"其它"、"最大值"、"最小值"、"总和值"、"平均值"**/ + private String method; + + /**实时数据结果集**/ + private RealDataVO real; + + private DataItemVO item; + +} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java new file mode 100644 index 0000000..16a5a46 --- /dev/null +++ b/hzims-service-api/big-model-api/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; + +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java index cc8856a..8574363 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java @@ -30,7 +30,7 @@ public interface IStationClient { String LIST = API_PREFIX + "/list"; String QUERY_EXIST_LGTD_LTTD = API_PREFIX + "/queryExistLgtdAndLttd"; String GET_ONE = API_PREFIX + "/getOne"; - + String GET_STATIONS_BY_TYPE_AND_DURATION = "/getStationByTypeAndDuration"; String QUERY_STATION_BY_CODES = API_PREFIX + "/querySatationByCodes"; @GetMapping(GET_LIST_ALL) @@ -81,4 +81,7 @@ public interface IStationClient { */ @PostMapping(QUERY_STATION_BY_CODES) R> querySatationByCodes(@RequestParam("codes") List codes); + + @GetMapping(GET_STATIONS_BY_TYPE_AND_DURATION) + R> getStationByTypeAndDuration(@RequestParam(required = false) String startTime,@RequestParam(required = false) String endTime,@RequestParam String type); } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClientFallBack.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClientFallBack.java index 5c0aca1..eeb90e5 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClientFallBack.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClientFallBack.java @@ -76,4 +76,9 @@ public class IStationClientFallBack implements IStationClient { public R> querySatationByCodes(List codes) { return R.data(new ArrayList<>()); } + + @Override + public R> getStationByTypeAndDuration(String startTime, String endTime, String type) { + return R.fail("远程调用失败!"); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index 4b1d359..8ce75d0 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -21,6 +21,7 @@ public enum FuncRouteEnum { CHOOSE_FAULT("choose_fault","选择故障",null), CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.PARAMS), SHOW_PARAM("show_param","设备参数查询", FunctionConstants.TypeEnum.PARAMS), + CHOOSE_YC("choose_yc","选择遥测数据",FunctionConstants.TypeEnum.CHOOSE) ; @Getter private String funcCode; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchStationTypeEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchStationTypeEnum.java new file mode 100644 index 0000000..15be73a --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchStationTypeEnum.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.bigmodel.interactive.constants; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * @Author: huangxing + * @Date: 2024/05/24 17:14 + */ +@AllArgsConstructor +public enum SearchStationTypeEnum { + TOTAL("站点总数量",null), + HYDROPOWER_TOTAL("水电站总数量","0"), + WIND_POWER_TOTAL("风电场总数量","1"), + ENERGY_STORAGE_TOTAL("储能站总数量","3"), + PHOTOVOLTAIC_TOTAL("光伏站总数量","5"), + CHARGE_TOTAL("充电站总数量","7"), + HYDROPOWER_NUM("水电站接入量","0"), + WIND_POWER_NUM("风电场接入量","1"), + ENERGY_STORAGE_NUM("储能站接入量","3"), + PHOTOVOLTAIC_NUM("光伏站接入量","5"), + CHARGE_NUM("充电站接入量","7"), + ; + + @Getter + private String searchStationType; + @Getter + private String stationType; + + public static SearchStationTypeEnum getTypeEnum(String searchStationType) { + return Arrays.stream(SearchStationTypeEnum.class.getEnumConstants()) + .filter(e -> e.getSearchStationType().equals(searchStationType)) + .findFirst() + .orElse(null); + } + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchTypeEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchTypeEnum.java new file mode 100644 index 0000000..0692d62 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SearchTypeEnum.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.bigmodel.interactive.constants; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; + +import java.util.Arrays; + +/** + * @Author: huangxing + * @Date: 2024/05/24 17:13 + */ +@AllArgsConstructor +public enum SearchTypeEnum { + REAL("实时"), + HISTORY("历史") + ; + @Getter + private String searchType; + + public static SearchTypeEnum getSearchType(String searchType) { + return Arrays.stream(SearchTypeEnum.class.getEnumConstants()) + .filter(e -> e.getSearchType().equals(searchType)) + .findFirst() + .orElse(null); + } + +} 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 40e79b3..9fbb0b2 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 @@ -77,4 +77,11 @@ public class InteractiveController { public R sendRemoteControl(@RequestBody ControlDTO operate) { return interactiveService.sendRemoteControl(operate); } + + @ApiOperation("解析接入站点数量") + @ApiOperationSupport(order = 7) + @PostMapping("/resolveStations") + public R resolveStations(String startTime,String endTime,String type,String enumType) { + return R.data(interactiveService.resolveStations(startTime,endTime,type,enumType)); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index 2f6588a..d37d0cf 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -2,6 +2,7 @@ package com.hnac.hzims.bigmodel.interactive.service; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; +import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import org.springblade.core.tool.api.R; import org.springblade.system.dto.ControlDTO; @@ -14,6 +15,8 @@ import java.util.Map; */ public interface IInteractiveService { + ExtraVO resolveStations(String startTime, String endTime, String type, String enumType); + R resolve(ModelFunctionReq req); R ask(String question,String sessionId,String userId); 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 9502fec..4143a10 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 @@ -12,15 +12,14 @@ import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; +import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO; import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; +import org.springblade.core.log.logger.BladeLogger; 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.core.tool.utils.*; import org.springblade.system.dto.ControlDTO; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -45,6 +44,7 @@ public class ExtraResolveStrategyService { private final IStationVideoTypeClient videoTypeClient; private final JumpRouteJoinStrategy jumpRouteJoinStrategy; private final DeviceClient deviceClient; + private final BladeLogger logger; private final RedisTemplate redisTemplate; /** @@ -74,6 +74,8 @@ public class ExtraResolveStrategyService { return this.resolveConfirmRemote(extra); case SHOW_PARAM: return this.resolveShowParam(extra); + case CHOOSE_YC: + return this.resolveChooseYc(extra); default: break; } @@ -82,16 +84,47 @@ public class ExtraResolveStrategyService { return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); } + private ExtraVO resolveChooseYc(JSONObject extra) { + ExtraVO result = new ExtraVO(); + JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); + if(data.containsKey("ycs")) { + List attrs = JSONArray.parseArray(JSON.toJSONString(data.get("ycs")), AttrSelectionVO.class); + result.setSelection(attrs); + } + result.setFuncCode(FuncRouteEnum.CHOOSE_YC.getFuncCode()); + result.setSpecial(true); + result.setType(FuncRouteEnum.CHOOSE_YC.getType().getType()); + return result; + } + private ExtraVO resolveShowParam(Map extra) { ExtraVO result = new ExtraVO(); result.setFuncCode(FuncRouteEnum.SHOW_PARAM.getFuncCode()); 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)); + if(Func.isNotEmpty(data)) { + if(Func.isNotEmpty(data.getReal())) { + if(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)); + } + } + if(Func.isNotEmpty(data.getItem())) { + if("历史".equals(data.getType())) { + // 历史数据需要手动查询功能ID供前端使用 + DataItemVO item = data.getItem(); + R> attrR = deviceClient.getOnlineAttr(item.getDeviceId()); + if(attrR.isSuccess() && CollectionUtil.isNotEmpty(attrR.getData())) { + List attrList = attrR.getData(); + Optional facDeviceIdOptional = attrList.stream().parallel().filter(f -> item.getSignage().equals(f.getSignage())) + .map(DeviceInstanceAttrVO::getFacDeviceAttrId).findFirst(); + logger.info("hzims-big-model:resolveShowParam:facDeviceId",facDeviceIdOptional.orElse("")); + item.setAttrId(facDeviceIdOptional.orElse(null)); + } + } + } } param.put("data", data); result.setParams(param); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index f5571dd..ba34e33 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -9,11 +9,17 @@ import com.hnac.hzims.bigmodel.configuration.BigModelInvokeUrl; import com.hnac.hzims.bigmodel.entity.FunctionEntity; import com.hnac.hzims.bigmodel.function.service.IFunctionService; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; +import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants; +import com.hnac.hzims.bigmodel.interactive.constants.SearchStationTypeEnum; +import com.hnac.hzims.bigmodel.interactive.constants.SearchTypeEnum; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; import com.hnac.hzims.bigmodel.interactive.service.IJumpPageService; import com.hnac.hzims.bigmodel.interactive.service.IParamsService; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; +import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.feign.IStationClient; import com.xxl.job.core.log.XxlJobLogger; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -66,12 +72,59 @@ public class InteractiveServiceImpl implements IInteractiveService { private final RedisTemplate redisTemplate; + private final IStationClient stationClient; + private final ExtraResolveStrategyService extraResolveStrategyService; @Value("${fdp.host}") private String fdpHost; @Override + public ExtraVO resolveStations(String startTime, String endTime, String type, String enumType) { + ExtraVO extraVO = new ExtraVO(); + extraVO.setType(TypeEnum.PARAMS.getType()); + extraVO.setFuncCode("stations_num"); + String stationType = ""; + SearchStationTypeEnum stationTypeEnum = SearchStationTypeEnum.getTypeEnum(enumType); + if(SearchTypeEnum.REAL.getSearchType().equals(type)) { + startTime = null; + endTime = null; + } + else { + switch(stationTypeEnum) { + case HYDROPOWER_TOTAL: + case WIND_POWER_TOTAL: + case ENERGY_STORAGE_TOTAL: + case PHOTOVOLTAIC_TOTAL: + case CHARGE_TOTAL: + stationType = stationTypeEnum.getStationType(); + startTime = null; + break; + case HYDROPOWER_NUM: + case WIND_POWER_NUM: + case ENERGY_STORAGE_NUM: + case PHOTOVOLTAIC_NUM: + case CHARGE_NUM: + stationType = stationTypeEnum.getStationType(); + break; + default: + throw new ServiceException("未查询到相关"); + } + } + R> stationListR = stationClient.getStationByTypeAndDuration(startTime, endTime, stationType); + Assert.isTrue(stationListR.isSuccess(),() -> { + throw new ServiceException("获取接入站点数量失败!"); + }); + Map params = new HashMap<>(); + params.put("searchStationType",stationTypeEnum.getSearchStationType()); + params.put("num",stationTypeEnum.getSearchStationType()); + params.put("startTime",startTime); + params.put("endTime",endTime); + extraVO.setParams(params); + return extraVO; + } + + @Override public R resolve(ModelFunctionReq req) { logger.info("interactive:resolve","开始解析大模型函数,函数内容为:" + JSON.toJSONString(req)); FunctionEntity function = functionService.getFunctionByCode(req.getFunctionName()); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java deleted file mode 100644 index 914f25b..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.hnac.hzims.bigmodel.interactive.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import lombok.Data; - -import java.io.Serializable; - -/** - * @Author: huangxing - * @Date: 2024/05/22 10:20 - */ -@Data -public class DataItemVO implements Serializable { - - private String name; - - @JSONField(name = "id") - private String attrId; - - @JSONField(name = "param_name") - private String attrName; - - @JSONField(name = "device_name") - private String deviceName; - - @JSONField(name = "device_id") - private String deviceId; - - @JSONField(name = "station_id") - private String projectId; - - @JSONField(name = "station_name") - private String projectName; - - private String signage; - - private String units; - -} 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 deleted file mode 100644 index 1f2fcfd..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hnac.hzims.bigmodel.interactive.vo; - -import com.alibaba.fastjson.annotation.JSONField; -import lombok.Data; - -import java.io.Serializable; - -/** - * @Author: huangxing - * @Date: 2024/05/22 10:28 - */ -@Data -public class DataVO implements Serializable { - - /**数据查询类型:实时、历史**/ - private String type; - - @JSONField(name = "time_begin") - private String startTime; - - @JSONField(name = "time_end") - private String endTime; - - /**包括:"其它"、"最大值"、"最小值"、"总和值"、"平均值"**/ - private String method; - - /**实时数据结果集**/ - 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 deleted file mode 100644 index 16a5a46..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RealDataVO.java +++ /dev/null @@ -1,20 +0,0 @@ -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; - -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationClient.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationClient.java index e9cf868..fbefca8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationClient.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationClient.java @@ -14,6 +14,7 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.user.entity.User; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; @@ -137,6 +138,18 @@ public class StationClient implements IStationClient { .in(StationEntity::getCode,codes))); } + @Override + @GetMapping("/getStationByTypeAndDuration") + public R> getStationByTypeAndDuration(@RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime, + @RequestParam(required = false) String type) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(StationEntity::getType, type) + .le(StringUtil.isNotBlank(endTime) && Func.isNotEmpty(endTime),StationEntity::getCreateTime, endTime) + .ge(StringUtil.isNotBlank(startTime) && Func.isNotEmpty(startTime),StationEntity::getCreateTime, startTime); + return R.data(stationService.list(wrapper)); + } + @Override @PostMapping("/getStationByCodeOrRedDept")