From 85384b11b3b17bdbf7282e20c7ad6344faff47d9 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 2 Jul 2024 10:59:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=A4=A7=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/bigmodel/interactive/vo/ExtraVO.java | 7 +- hzims-service/hzims-big-model/pom.xml | 4 + .../hzims/bigmodel/HzimsBigModelApplication.java | 3 +- .../controller/DataSourceExecuteController.java | 26 +++++ .../datasource/service/DataSourceService.java | 51 ++++++++++ .../datasource/service/IDataSourceService.java | 14 +++ .../function/controller/FunctionController.java | 2 +- .../interactive/constants/ParamKeyConstants.java | 19 ++++ .../controller/AnalyseDataController.java | 1 + .../controller/FontEndInteractiveController.java | 8 ++ .../controller/HznlmInteractiveController.java | 3 +- .../controller/InteractiveController.java | 1 + .../interactive/factory/AnswerResolveFactory.java | 3 +- .../service/IHznlmInteractiveService.java | 3 +- .../interactive/service/IResolveService.java | 4 +- .../service/impl/AnalyseDataServiceImpl.java | 2 +- .../service/impl/CanvasResolveServiceImpl.java | 112 ++++++++++++++++++++- .../impl/ChoiceAnswerResolveServiceImpl.java | 2 +- .../impl/DiagnoseAnswerResolveServiceImpl.java | 2 +- .../service/impl/ExtraResolveStrategyService.java | 12 +-- .../service/impl/HznlmInteractiveServiceImpl.java | 9 +- .../service/impl/HznlmInvokeServiceImpl.java | 6 +- .../service/impl/InteractiveServiceImpl.java | 2 +- .../service/impl/JumpRouteJoinStrategy.java | 2 +- .../impl/ParamAnswerResolveServiceImpl.java | 4 +- .../interactive/service/impl/ParamStrategy.java | 2 +- .../impl/RemoteAnswerResolveServiceImpl.java | 2 +- .../service/impl/VideoResolveServiceImpl.java | 14 +-- .../schedule/FrontEndInteractiveSchedule.java | 7 +- .../hzims/bigmodel/utils/RequestClientUtil.java | 5 +- .../websocket/handler/InteractiveHandler.java | 9 +- pom.xml | 5 + 32 files changed, 294 insertions(+), 52 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ParamKeyConstants.java diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java index 89c7f3c..d01b6e6 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java @@ -1,5 +1,6 @@ package com.hnac.hzims.bigmodel.interactive.vo; +import com.alibaba.fastjson.annotation.JSONField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -26,7 +27,7 @@ public class ExtraVO implements Serializable { private String label; @ApiModelProperty("函数编号") - private String funcCode; + private String func; @ApiModelProperty("是否立即跳转") private boolean isImmediatelyJump = false; @@ -40,10 +41,10 @@ public class ExtraVO implements Serializable { @ApiModelProperty("选项") private List selection; - @ApiModelProperty("") + @JSONField(name = "agent_name") private String agentName; - @ApiModelProperty("") + @JSONField(name = "agent_data") private Map agentData; } diff --git a/hzims-service/hzims-big-model/pom.xml b/hzims-service/hzims-big-model/pom.xml index 91ae6d1..e1ebe29 100644 --- a/hzims-service/hzims-big-model/pom.xml +++ b/hzims-service/hzims-big-model/pom.xml @@ -79,6 +79,10 @@ com.hnac.hzims equipment-api + + com.baomidou + dynamic-datasource-spring-boot-starter + diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java index 0f09cc7..3d58539 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java @@ -18,9 +18,8 @@ import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.HZIMS_BIGMO @EnableBladeFeign(basePackages = {"org.springblade","com.hnac"}) @SpringCloudApplication @MapperScan("com.hnac.hzims.**.mapper.**") -@ComponentScan(basePackages = {"com.hnac.hzims.bigmodel.*"}) @Resource -@ComponentScan(basePackages = {"com.hnac.hzims.*"}) +@ComponentScan(basePackages = {"com.hnac.hzims.**"}) @Slf4j public class HzimsBigModelApplication extends SpringBootServletInitializer { diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java new file mode 100644 index 0000000..84172fe --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.bigmodel.datasource.controller; + +import com.hnac.hzims.bigmodel.datasource.service.DataSourceService; +import lombok.AllArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author: huangxing + * @Date: 2024/06/28 14:07 + */ +@RestController +@RequestMapping("/dataSource/execute") +@AllArgsConstructor +public class DataSourceExecuteController { + + private final DataSourceService dataSourceService; + + @GetMapping("/executeQuery") + public R executeQuery(String sql,String dataSourceName) { + return R.data(dataSourceService.queryListOnSpecificDataSource(sql,dataSourceName)); + } + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java new file mode 100644 index 0000000..262d871 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java @@ -0,0 +1,51 @@ +package com.hnac.hzims.bigmodel.datasource.service; + +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * @Author: huangxing + * @Date: 2024/06/28 15:24 + */ +@Service +@AllArgsConstructor +@Slf4j +public class DataSourceService { + + private final JdbcTemplate jdbcTemplate; + + /** + * 指定 + * @param sql + * @param dataSourceName + * @return + */ + public List> queryListOnSpecificDataSource(String sql,String dataSourceName) { + // 切换到指定的数据源 + DynamicDataSourceContextHolder.push(dataSourceName); + try { + return jdbcTemplate.queryForList(sql); + } finally { + // 清除,恢复默认数据源 + DynamicDataSourceContextHolder.clear(); + } + } + + public Integer updateOnSpecificDataSource(String sql,String dataSourceName) { + // 切换到指定的数据源 + DynamicDataSourceContextHolder.push(dataSourceName); + try { + return jdbcTemplate.update(sql); + } finally { + // 清除,恢复默认数据源 + DynamicDataSourceContextHolder.clear(); + } + } + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java new file mode 100644 index 0000000..1f0e802 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.bigmodel.datasource.service; + +import java.util.List; +import java.util.Map; + +/** + * @Author: huangxing + * @Date: 2024/06/28 14:22 + */ +public interface IDataSourceService { + + List> queryList(String sql); + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/function/controller/FunctionController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/function/controller/FunctionController.java index bffa1db..1d63c64 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/function/controller/FunctionController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/function/controller/FunctionController.java @@ -41,7 +41,7 @@ public class FunctionController { return R.status(functionService.save(req)); } - @PutMapping("/save") + @PutMapping("/updateById") @ApiOperation("编辑函数") @ApiOperationSupport(order = 2) public R updateById(@RequestBody FunctionEntity req) { diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ParamKeyConstants.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ParamKeyConstants.java new file mode 100644 index 0000000..cb7b02a --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ParamKeyConstants.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.bigmodel.interactive.constants; + +/** + * @Author: huangxing + * @Date: 2024/07/01 14:26 + * @Describe: 参数key管理 + */ +public interface ParamKeyConstants { + + /**实时画面host**/ + String CANVAS_HOST = "hzims:bigModel:canvas:host"; + /**实时画面v3路径 {context}&stationNum={stationNum}&projectId={projectId}**/ + String CANVAS_V3_PATH = "hzims:bigModel:canvas:v3:path"; + /**实时画面v4路径 other/v4/canvas/index.html?hzinfowebkit=true&taskId={taskId}&stationNum={stationNum}&projectId={projectId}&source=app&picName={context}&name={name}**/ + String CANVAS_V4_PATH = "hzims:bigModel:canvas:v4:path"; + /**实时画面云组态路径 hzinfo-data-scada/view/{projectId}/{id}?source=app**/ + String CANVAS_YZT_PATH = "hzims:bigModel:canvas:yzt:path"; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java index 5ecf019..d09637f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; @AllArgsConstructor @Api(value = "数据查询管理",tags = "数据查询管理") @RestController +@Deprecated public class AnalyseDataController { private final IAnalyseDataService analyseDataService; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/FontEndInteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/FontEndInteractiveController.java index 8ec9e8a..9d0afe8 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/FontEndInteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/FontEndInteractiveController.java @@ -1,5 +1,6 @@ package com.hnac.hzims.bigmodel.interactive.controller; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.google.common.collect.Lists; import com.hnac.hzims.bigmodel.BigModelConstants; @@ -52,4 +53,11 @@ public class FontEndInteractiveController { public R> hotQuestions() { return R.data(hznlmInvokeService.hotQuestions()); } + + @ApiOperation("获取问答sessionId") + @ApiOperationSupport(order = 4) + @GetMapping("/getSessionId") + public R getSessionId() { + return R.data(IdWorker.get32UUID()); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/HznlmInteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/HznlmInteractiveController.java index 3924173..958f103 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/HznlmInteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/HznlmInteractiveController.java @@ -6,6 +6,7 @@ import com.hnac.hzims.bigmodel.interactive.dto.AuthDataDTO; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.service.IHznlmInteractiveService; import com.hnac.hzims.bigmodel.interactive.vo.AuthDataVO; +import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ResolveResultVO; import com.hnac.hzinfo.log.annotation.Business; import io.swagger.annotations.Api; @@ -40,7 +41,7 @@ public class HznlmInteractiveController { @ApiOperation("解析大模型函数") @ApiOperationSupport(order = 2) @PostMapping("/resolve") - public R resolve(@RequestBody @Valid ModelFunctionReq req) { + public R resolve(@RequestBody @Valid ModelFunctionReq req) { return R.data(interactiveService.resolve(req)); } } 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 ca90465..35537ee 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 @@ -28,6 +28,7 @@ import java.util.List; @Api(value = "FDP大模型交互层",tags = "FDP大模型交互层") @RequestMapping("/interactive") @Business(module = BigModelConstants.MODULE_NAME,value = "FDP大模型交互层") +@Deprecated public class InteractiveController { private final IInteractiveService interactiveService; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java index 9595974..b9daa43 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java @@ -21,6 +21,7 @@ public class AnswerResolveFactory { public static final String CHOICE_ANSWER_SERVICE = "choiceAnswerResolveService"; public static final String REMOTE_ANSWER_SERVICE = "remoteAnswerResolveService"; public static final String PARAM_ANSWER_SERVICE = "paramAnswerResolveService"; + public static final String PRE_ANSWER_SERVICE = "preAnswerResolveService"; public static IAnswerResolveService getResolveService(Object extra) { String funcCode = JSONObject.parseObject(JSON.toJSONString(extra)).getString("func"); @@ -45,7 +46,7 @@ public class AnswerResolveFactory { case SHOW_PARAM: return SpringUtil.getBean(PARAM_ANSWER_SERVICE); default: - throw new ServiceException("service解析失败!"); + return null; } } throw new ServiceException("service解析失败!"); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInteractiveService.java index 6239980..ec26387 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IHznlmInteractiveService.java @@ -3,6 +3,7 @@ package com.hnac.hzims.bigmodel.interactive.service; import com.hnac.hzims.bigmodel.interactive.dto.AuthDataDTO; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.vo.AuthDataVO; +import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ResolveResultVO; import org.springframework.web.bind.annotation.RequestBody; @@ -17,5 +18,5 @@ public interface IHznlmInteractiveService { List getAuthData(@RequestBody @Valid AuthDataDTO req); - ResolveResultVO resolve(ModelFunctionReq req); + ExtraVO resolve(ModelFunctionReq req); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IResolveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IResolveService.java index 97c6aa4..19a5869 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IResolveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IResolveService.java @@ -10,8 +10,8 @@ import com.hnac.hzims.bigmodel.interactive.vo.ResolveResultVO; */ public interface IResolveService { - ExtraVO resolve(Long id); + ExtraVO resolve(String id); - ResolveResultVO resolve(ModelFunctionReq req); + ExtraVO resolve(ModelFunctionReq req); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AnalyseDataServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AnalyseDataServiceImpl.java index 9ff9828..418f66c 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AnalyseDataServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AnalyseDataServiceImpl.java @@ -57,7 +57,7 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService { searchVO.setDataType(adapterDate.getDateType()); ExtraVO extraVO = new ExtraVO(); extraVO.setType(FuncRouteEnum.HISTORY_DATA.getType().getType()); - extraVO.setFuncCode(FuncRouteEnum.HISTORY_DATA.getFuncCode()); + extraVO.setFunc(FuncRouteEnum.HISTORY_DATA.getFuncCode()); Map params = new HashMap<>(1); Result reductionDataVOR = historyDataService.getPolymerizationData(searchVO); String label; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java index 4ae5cd5..3016a6b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java @@ -1,14 +1,30 @@ package com.hnac.hzims.bigmodel.interactive.service.impl; +import com.alibaba.fastjson.JSON; +import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; +import com.hnac.hzims.bigmodel.interactive.constants.ParamKeyConstants; import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.service.IResolveService; import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ResolveResultVO; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzinfo.sdk.v5.scada.ScadaClient; import groovy.util.logging.Slf4j; import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.log.logger.BladeLogger; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.cache.ParamCache; import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.util.*; +import java.util.stream.IntStream; /** * @Author: huangxing @@ -19,15 +35,101 @@ import org.springframework.stereotype.Service; @Slf4j public class CanvasResolveServiceImpl implements IResolveService { - private final ScadaClient scadaClient; + private final IStationClient stationClient; + private final BladeLogger logger; @Override - public ResolveResultVO resolve(ModelFunctionReq req) { - return null; + public ExtraVO resolve(ModelFunctionReq req) { + Map args = req.getFunctionArgs(); + String id = args.get("id"); + String name = args.get("name"); + Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> { + logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req)); + throw new ServiceException("解析传参错误,缺少必要参数video_id"); + }); + return this.resolve(id); +// ExtraVO extra = this.resolve(id); +// String message = "已成功打开" + name + ";"; +// return new ResolveResultVO(message,extra); } @Override - public ExtraVO resolve(Long id) { - return null; + public ExtraVO resolve(String id) { + ExtraVO extraVO = new ExtraVO(); + extraVO.setImmediatelyJump(true); + extraVO.setFunc(FuncRouteEnum.OPEN_CANVAS.getFuncCode()); + final String[] SCADA_PARAMS_SOLVE = new String[]{"picResource","context","stationNum","projectId","taskId","name","id"}; + String canvasHost = ParamCache.getValue(ParamKeyConstants.CANVAS_HOST); + // 将ID解析为 + Map resolveMap = this.resolve(id, SCADA_PARAMS_SOLVE); + R stationR = stationClient.getStationByCode(resolveMap.get("projectId")); + extraVO.setLabel(Optional.ofNullable(stationR).filter(r -> r.isSuccess()).map(R::getData).map(StationEntity::getName).orElse("") + "_" + resolveMap.get("name")); + Integer picResource = Integer.valueOf(resolveMap.get("picResource")); + Map extraParams = new HashMap<>(1); + extraParams.put("picResource",picResource); + extraVO.setParams(extraParams); + // 云组态 + if(picResource == 0) { + String path = this.replacePath(ParamCache.getValue(ParamKeyConstants.CANVAS_YZT_PATH), resolveMap); + extraVO.setRoute(canvasHost + path); + } + // v3.0 + else if(picResource == 1) { + String path = this.replacePath(ParamCache.getValue(ParamKeyConstants.CANVAS_V3_PATH), resolveMap); + extraVO.setRoute(canvasHost + path); + } + // v4.0 + else if (picResource == 2) { + // pic_name 去掉头部的/ 以及尾部的.js + String context = resolveMap.get("context"); + context = this.removeHeadChars(context,"/"); + context = this.removeTailChars(context,".js"); + resolveMap.put("context",context); + extraVO.setRoute(this.replacePath("other/v4/canvas/index.html?hzinfowebkit=true&taskId={taskId}&stationNum={stationNum}&projectId={projectId}&source=app&picName={context}&name={name}", resolveMap)); + } + else { + throw new ServiceException("解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由"); + } + return extraVO; + } + + public Map resolve(String paramsStr, String... keys) { + Map result = new HashMap<>(); + List params = Func.toStrList("\\^", paramsStr); + Assert.isTrue(params.size() == keys.length, () -> { + throw new ServiceException("大模型传参params长度错误,传参为:" + paramsStr); + }); + IntStream.iterate(0, index -> index + 1).limit(params.size()).forEach(index -> result.put(keys[index],params.get(index))); + return result; + } + + private String replacePath(String path,Map params) { + Set> entries = params.entrySet(); + // 替换path中变量 + for (Map.Entry entry : entries) { + String replaceVariables = "{" + entry.getKey() + "}"; + path = StringUtil.replace(path,replaceVariables,entry.getValue()); + } + return path; + } + + public String removeHeadChars(String str, String charsToRemove) { + if (str == null || charsToRemove == null || charsToRemove.isEmpty()) { + return str; + } + while (str.startsWith(charsToRemove)) { + str = str.substring(charsToRemove.length()); + } + return str; + } + + public String removeTailChars(String str, String charsToRemove) { + if (str == null || charsToRemove == null || charsToRemove.isEmpty()) { + return str; + } + while (str.endsWith(charsToRemove)) { + str = str.substring(0, str.length() - charsToRemove.length()); + } + return str; } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ChoiceAnswerResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ChoiceAnswerResolveServiceImpl.java index bcc2462..568bd50 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ChoiceAnswerResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ChoiceAnswerResolveServiceImpl.java @@ -38,7 +38,7 @@ public class ChoiceAnswerResolveServiceImpl implements IAnswerResolveService { ExtraVO result = JSONObject.parseObject(JSON.toJSONString(originExtra),ExtraVO.class); result.setSpecial(true); String funcCode = originExtra.getString("func"); - result.setFuncCode(funcCode); + result.setFunc(funcCode); result.setType(FuncRouteEnum.getEnumByFuncCode(funcCode).getType().getType()); JSONArray selections = JSONArray.parseArray(JSON.toJSONString(originExtra.get("data"))); result.setSelection(selections); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/DiagnoseAnswerResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/DiagnoseAnswerResolveServiceImpl.java index b0dcc7f..fa94148 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/DiagnoseAnswerResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/DiagnoseAnswerResolveServiceImpl.java @@ -43,7 +43,7 @@ public class DiagnoseAnswerResolveServiceImpl implements IAnswerResolveService { params.put("fdpOrd",data.getString("ord")); result.setParams(params); String funcCode = originExtra.getString("func"); - result.setFuncCode(funcCode); + result.setFunc(funcCode); result.setType(FuncRouteEnum.getEnumByFuncCode(funcCode).getType().getType()); return result; } 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 40e7b0d..05f54db 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 @@ -82,7 +82,7 @@ public class ExtraResolveStrategyService { private ExtraVO resolveChooseSelection(JSONObject extra,FuncRouteEnum funcRouteEnum) { ExtraVO result = new ExtraVO(); JSONArray selections = JSONArray.parseArray(JSON.toJSONString(extra.get("data"))); - result.setFuncCode(funcRouteEnum.getFuncCode()); + result.setFunc(funcRouteEnum.getFuncCode()); result.setSpecial(true); result.setSelection(selections); result.setType(funcRouteEnum.getType().getType()); @@ -132,7 +132,7 @@ public class ExtraResolveStrategyService { } } ExtraVO result = new ExtraVO(); - result.setFuncCode(FuncRouteEnum.SHOW_PARAM.getFuncCode()); + result.setFunc(FuncRouteEnum.SHOW_PARAM.getFuncCode()); result.setType(FuncRouteEnum.SHOW_PARAM.getType().getType()); Map param = new HashMap(1); param.put("data", data); @@ -144,7 +144,7 @@ public class ExtraResolveStrategyService { private ExtraVO resolveConfirmRemote(Map extra) { ExtraVO result = new ExtraVO(); RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(extra.get("data")), RemoteParamVO.class); - result.setFuncCode(FuncRouteEnum.CONFIRM_YK.getFuncCode()); + result.setFunc(FuncRouteEnum.CONFIRM_YK.getFuncCode()); result.setType(FuncRouteEnum.CONFIRM_YK.getType().getType()); R funcVOR = deviceClient.getFuncById(remoteParam.getFuncId()); if(funcVOR.isSuccess()) { @@ -182,7 +182,7 @@ public class ExtraResolveStrategyService { params.put("fdpDeviceName",data.getString("device_name")); params.put("fdpOrd",data.getString("ord")); result.setParams(params); - result.setFuncCode(FuncRouteEnum.DIAGNOSE.getFuncCode()); + result.setFunc(FuncRouteEnum.DIAGNOSE.getFuncCode()); result.setType(FunctionConstants.TypeEnum.PARAMS.getType()); return result; } @@ -229,7 +229,7 @@ public class ExtraResolveStrategyService { } return selectionVO; }).collect(Collectors.toList()); - result.setFuncCode(FuncRouteEnum.CHOOSE_VIDEO.getFuncCode()); + result.setFunc(FuncRouteEnum.CHOOSE_VIDEO.getFuncCode()); result.setSpecial(true); result.setSelection(selections); } @@ -249,7 +249,7 @@ public class ExtraResolveStrategyService { selectionVO.setName(resolve.get("name")); return selectionVO; }).collect(Collectors.toList()); - result.setFuncCode(FuncRouteEnum.CHOOSE_CANVAS.getFuncCode()); + result.setFunc(FuncRouteEnum.CHOOSE_CANVAS.getFuncCode()); result.setSpecial(true); result.setSelection(selections); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java index 2ccc41f..fc0567f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInteractiveServiceImpl.java @@ -7,6 +7,7 @@ import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.service.IHznlmInteractiveService; import com.hnac.hzims.bigmodel.interactive.service.IResolveService; import com.hnac.hzims.bigmodel.interactive.vo.AuthDataVO; +import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ResolveResultVO; import groovy.util.logging.Slf4j; import lombok.AllArgsConstructor; @@ -43,13 +44,9 @@ public class HznlmInteractiveServiceImpl implements IHznlmInteractiveService { } @Override - public ResolveResultVO resolve(ModelFunctionReq req) { + public ExtraVO resolve(ModelFunctionReq req) { IResolveService resolveService = ResolveFactory.getResolveService(req.getFunctionName()); - try { - return resolveService.resolve(req); - } catch (Exception e) { - return ResolveResultVO.error(); - } + return resolveService.resolve(req); } public List getDeptAuthData(String userId) { diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java index a09ffa0..db48d34 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java @@ -11,6 +11,7 @@ import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; import com.hnac.hzims.bigmodel.manager.SessionRedisManager; import com.hnac.hzims.bigmodel.utils.RequestClientUtil; +import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; @@ -69,6 +70,7 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { params.put("extra",extra); Map authDataIds = this.getAuthDataIds(userId); params.putAll(authDataIds); + log.info("调用大模型接口:{},传参为:{}",fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk(),JSON.toJSONString(params)); RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk(), params); sessionRedisManager.addSessionId(sessionId); } @@ -91,6 +93,8 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { Map params = new HashMap<>(); params.put("id",sessionId); RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAskAbort(), params); + // 移除内存sessionId + InteractiveSessionManager.SESSION_POOL.remove(sessionId); sessionRedisManager.removeSessionId(sessionId); } @@ -119,7 +123,7 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { String[] stationIds = authDatas.stream().map(DeptStationDTO::getStationId) .filter(StringUtil::isNotBlank).toArray(String[]::new); String[] projectIds = authDatas.stream().map(DeptStationDTO::getDeptId) - .filter(Func::isNotEmpty).toArray(String[]::new); + .filter(Func::isNotEmpty).map(String::valueOf).toArray(String[]::new); result.put("stationids", stationIds); result.put("projectids", projectIds); return result; 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 d5e1e6e..a5eff60 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 @@ -108,7 +108,7 @@ public class InteractiveServiceImpl implements IInteractiveService { public ExtraVO resolveStations(String startTime, String endTime, String type, String enumType) { ExtraVO extraVO = new ExtraVO(); extraVO.setType(TypeEnum.PARAMS.getType()); - extraVO.setFuncCode("stations_num"); + extraVO.setFunc("stations_num"); String label; SearchStationTypeEnum stationTypeEnum = SearchStationTypeEnum.getTypeEnum(enumType); if(!startTime.equals(endTime) && SearchTypeEnum.HISTORY.getSearchType().equals(type)) { diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index b5b6b5f..e2e1cbd 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -54,7 +54,7 @@ public class JumpRouteJoinStrategy { // 跳转页面逻辑 ExtraVO extraVO = new ExtraVO(); extraVO.setImmediatelyJump(true); - extraVO.setFuncCode(FuncRouteEnum.OPEN_CANVAS.getFuncCode()); + extraVO.setFunc(FuncRouteEnum.OPEN_CANVAS.getFuncCode()); Map params = this.scadaResolve(args); // 根据hz3000画面版本获取path Integer picResource = Integer.valueOf(params.get("picResource")); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamAnswerResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamAnswerResolveServiceImpl.java index 507b306..8a52994 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamAnswerResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamAnswerResolveServiceImpl.java @@ -57,11 +57,11 @@ public class ParamAnswerResolveServiceImpl implements IAnswerResolveService { } else if(StringUtil.isNotBlank(data.getType()) && SearchTypeEnum.HISTORY.getSearchType().equals(data.getType())) { // 处理查询历史数据 - this.getHistoryData(data); + return this.getHistoryData(data); } String funcCode = originExtra.getString("func"); ExtraVO result = new ExtraVO(); - result.setFuncCode(funcCode); + result.setFunc(funcCode); result.setType(FuncRouteEnum.getEnumByFuncCode(funcCode).getType().getType()); Map param = new HashMap(1); param.put("data", data); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java index 67e49a0..e2a37b2 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java @@ -57,7 +57,7 @@ public class ParamStrategy { StationVideoTypeEntity video = videoR.getData(); extraVO.setType(FunctionConstants.TypeEnum.PARAMS.getType()); extraVO.setImmediatelyJump(true); - extraVO.setFuncCode(FuncRouteEnum.OPEN_VIDEO.getFuncCode()); + extraVO.setFunc(FuncRouteEnum.OPEN_VIDEO.getFuncCode()); Map params = new HashMap<>(); params.put("name", video.getName()); params.put("videoHost", video.getVideoHost()); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/RemoteAnswerResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/RemoteAnswerResolveServiceImpl.java index 95f271a..09cc711 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/RemoteAnswerResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/RemoteAnswerResolveServiceImpl.java @@ -42,7 +42,7 @@ public class RemoteAnswerResolveServiceImpl implements IAnswerResolveService { ExtraVO result = new ExtraVO(); RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(originExtra.get("data")), RemoteParamVO.class); String funcCode = originExtra.getString("func"); - result.setFuncCode(funcCode); + result.setFunc(funcCode); result.setType(FuncRouteEnum.getEnumByFuncCode(funcCode).getType().getType()); R funcVOR = deviceClient.getFuncById(remoteParam.getFuncId()); if(funcVOR.isSuccess()) { diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java index 3cdc225..ee17050 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java @@ -36,7 +36,7 @@ public class VideoResolveServiceImpl implements IResolveService { private final BladeLogger logger; @Override - public ResolveResultVO resolve(ModelFunctionReq req) { + public ExtraVO resolve(ModelFunctionReq req) { Map args = req.getFunctionArgs(); String id = args.get("id"); String name = args.get("name"); @@ -44,13 +44,15 @@ public class VideoResolveServiceImpl implements IResolveService { logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req)); throw new ServiceException("解析传参错误,缺少必要参数video_id"); }); - ExtraVO extra = this.resolve(Long.valueOf(id)); - String message = "已成功打开" + name + ";"; - return new ResolveResultVO(message,extra); + return this.resolve(id); +// ExtraVO extra = this.resolve(id); +// String message = "已成功打开" + name + ";"; +// return new ResolveResultVO(message,extra); } @Override - public ExtraVO resolve(Long id) { + public ExtraVO resolve(String idStr) { + Long id = Long.valueOf(idStr); // 跳转页面逻辑 ExtraVO extraVO = new ExtraVO(); R videoR = videoClient.getById(Long.valueOf(id)); @@ -58,7 +60,7 @@ public class VideoResolveServiceImpl implements IResolveService { StationVideoTypeEntity video = videoR.getData(); extraVO.setType(FunctionConstants.TypeEnum.PARAMS.getType()); extraVO.setImmediatelyJump(true); - extraVO.setFuncCode(FuncRouteEnum.OPEN_VIDEO.getFuncCode()); + extraVO.setFunc(FuncRouteEnum.OPEN_VIDEO.getFuncCode()); Map params = new HashMap<>(); params.put("name", video.getName()); params.put("videoHost", video.getVideoHost()); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java index 39b63fa..be768ed 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java @@ -67,8 +67,11 @@ public class FrontEndInteractiveSchedule { // 解析答案 Object[] resolveExtras = Arrays.stream(extras).map(extra -> { IAnswerResolveService answerResolveService = AnswerResolveFactory.getResolveService(extra); - JSONObject extraObject = JSONObject.parseObject(JSON.toJSONString(extra)); - return answerResolveService.getExtra(extraObject); + if(Func.isNotEmpty(answerResolveService)) { + JSONObject extraObject = JSONObject.parseObject(JSON.toJSONString(extra)); + return answerResolveService.getExtra(extraObject); + } + return extra; }).map(JSON::toJSONString).toArray(); answerVO.setExtras(resolveExtras); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java index a878fff..229fc12 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java @@ -5,7 +5,7 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; -import groovy.util.logging.Slf4j; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springframework.util.Assert; @@ -16,6 +16,7 @@ import java.util.Map; * @Author: huangxing * @Date: 2024/06/21 17:12 */ +@Slf4j public class RequestClientUtil { /** @@ -34,7 +35,7 @@ public class RequestClientUtil { * 远程调用http接口 * @param url 接口url * @param body 传参 - * @param resultT 结果解析对象 + * @param typeRef 结果解析对象 * @return 结果 * @param 结果解析对象类型 */ diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index 810c022..d2e05d7 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; 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.service.IHznlmInvokeService; import com.hnac.hzims.bigmodel.interactive.service.impl.JumpRouteJoinStrategy; import com.hnac.hzims.bigmodel.interactive.service.impl.ParamStrategy; import com.hnac.hzims.bigmodel.interactive.vo.*; @@ -103,7 +104,7 @@ public class InteractiveHandler extends TextWebSocketHandler { } } else { - String funcCode = messageContext.getString("funcCode"); + String funcCode = messageContext.getString("func"); FuncRouteEnum funcEnum = FuncRouteEnum.getEnumByFuncCode(funcCode); switch (funcEnum) { case CHOOSE_STATION: @@ -125,11 +126,11 @@ public class InteractiveHandler extends TextWebSocketHandler { } private void handleDefaultChoose(JSONObject messageContext,String sessionId) { - IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class); + IHznlmInvokeService invokeService = SpringUtil.getBean(IHznlmInvokeService.class); Map extra = messageContext.toJavaObject(Map.class); - extra.put("func",extra.get("funcCode")); + extra.put("func",extra.get("func")); extra.put("data",messageContext.getObject("selection", JSONObject.class)); - interactiveService.specialAsk(sessionId, (String) extra.get("userId"),extra); + invokeService.specialAsk(sessionId, (String) extra.get("userId"),extra); } private void handleVideoChoose(JSONObject messageContext,String sessionId) { diff --git a/pom.xml b/pom.xml index fee8f9d..31b5875 100644 --- a/pom.xml +++ b/pom.xml @@ -212,6 +212,11 @@ easypoi-spring-boot-starter ${easpoi.version} + + com.baomidou + dynamic-datasource-spring-boot-starter + 2.5.6 +