From 9a87d6550cd34e20c74c7fc2e30fe9aca30204bd Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Thu, 11 Jul 2024 15:04:22 +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 --- .../java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java | 2 +- .../hzims/bigmodel/interactive/factory/ResolveFactory.java | 3 --- .../interactive/service/impl/CanvasResolveServiceImpl.java | 2 +- .../service/impl/ChoiceAnswerResolveServiceImpl.java | 6 +----- .../bigmodel/maintenance/controller/DataSourceController.java | 11 ++++++++++- .../maintenance/controller/TablePropertyController.java | 2 +- .../bigmodel/maintenance/service/TableColumnService.java | 6 +++--- .../java/com/hnac/hzims/bigmodel/question/dto/MessageDTO.java | 5 ----- .../com/hnac/hzims/bigmodel/question/dto/QuestionDTO.java | 2 -- .../bigmodel/question/service/QuestionHandlerService.java | 5 ++--- .../java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java | 3 ++- 11 files changed, 21 insertions(+), 26 deletions(-) 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 c864829..d9be4d7 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 @@ -45,7 +45,7 @@ public class ExtraVO implements Serializable { @ApiModelProperty("选项") @JsonInclude(JsonInclude.Include.NON_NULL) - private List selection; + private List data; @JSONField(name = "agent_name") private String agentName; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java index b3fafc6..6f7a632 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java @@ -1,9 +1,6 @@ package com.hnac.hzims.bigmodel.interactive.factory; -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.service.IResolveService; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.logger.BladeLogger; 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 c4b8f74..6b7f247 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 @@ -52,7 +52,7 @@ public class CanvasResolveServiceImpl implements IResolveService { ExtraVO extraVO = new ExtraVO(); extraVO.setImmediatelyJump(true); extraVO.setFunc(FuncRouteEnum.OPEN_CANVAS.getFunc()); - final String[] SCADA_PARAMS_SOLVE = new String[]{"picResource","context","stationNum","projectId","taskId","name","itemId"}; + 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); 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 568bd50..f6495f1 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 @@ -37,11 +37,7 @@ public class ChoiceAnswerResolveServiceImpl implements IAnswerResolveService { public ExtraVO getExtra(JSONObject originExtra) { ExtraVO result = JSONObject.parseObject(JSON.toJSONString(originExtra),ExtraVO.class); result.setSpecial(true); - String funcCode = originExtra.getString("func"); - result.setFunc(funcCode); - result.setType(FuncRouteEnum.getEnumByFuncCode(funcCode).getType().getType()); - JSONArray selections = JSONArray.parseArray(JSON.toJSONString(originExtra.get("data"))); - result.setSelection(selections); + result.setType(FuncRouteEnum.getEnumByFuncCode(result.getFunc()).getType().getType()); return result; } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/DataSourceController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/DataSourceController.java index 656910e..91989c1 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/DataSourceController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/DataSourceController.java @@ -16,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * @Author: huangxing * @Date: 2024/07/05 16:55 @@ -37,7 +39,7 @@ public class DataSourceController { } @GetMapping("/detail") - @ApiOperation(value = "分页查询") + @ApiOperation(value = "查看详情") @ApiOperationSupport(order = 2) public R detail(@RequestParam @ApiParam("主键ID") Long id) { return R.data(dataSourceService.getById(id)); @@ -64,4 +66,11 @@ public class DataSourceController { return R.status(dataSourceService.updateById(req)); } + @GetMapping("/list") + @ApiOperation(value = "列表查询") + @ApiOperationSupport(order = 1) + public R> list(DatasourceEntity req) { + return R.data(dataSourceService.list(Condition.getQueryWrapper(req).lambda())); + } + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TablePropertyController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TablePropertyController.java index 88412f0..1961bef 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TablePropertyController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TablePropertyController.java @@ -36,7 +36,7 @@ public class TablePropertyController { } @GetMapping("/detail") - @ApiOperation(value = "分页查询") + @ApiOperation(value = "查看详情") @ApiOperationSupport(order = 2) public R detail(@RequestParam @ApiParam("主键ID") Long id) { return R.data(tablePropertyService.getById(id)); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/TableColumnService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/TableColumnService.java index 0d54873..91f04fb 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/TableColumnService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/TableColumnService.java @@ -20,17 +20,17 @@ public class TableColumnService { private final DataSourceService dataSourceService; public List> getDatabase(String datasource) { - String sql = "select distinct `table_schema` from `information_schema`.`tables` where `table_schema` <> 'information_schema';"; + String sql = "select distinct `table_schema` as tableName from `information_schema`.`tables` where `table_schema` <> 'information_schema';"; return dataSourceService.queryListOnSpecificDataSource(sql,datasource); } public List> getTables(String datasource,String database) { - String sql = "select distinct `table_name` from `information_schema`.`tables` where `table_schema` = '" + database + "';"; + String sql = "select distinct `table_name` as tableName from `information_schema`.`tables` where `table_schema` = '" + database + "';"; return dataSourceService.queryListOnSpecificDataSource(sql,datasource); } public List> getColumns(String datasource,String database,String tableName) { - String sql = "select distinct `column_name`,`column_comment` from `information_schema`.`COLUMNS` where `TABLE_SCHEMA` = '" + database + "' and `TABLE_NAME` = '" + tableName + "';"; + String sql = "select distinct `column_name` as columnName,`column_comment` as columnComment from `information_schema`.`COLUMNS` where `TABLE_SCHEMA` = '" + database + "' and `TABLE_NAME` = '" + tableName + "';"; return dataSourceService.queryListOnSpecificDataSource(sql,datasource); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/MessageDTO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/MessageDTO.java index 924c12b..6f2c729 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/MessageDTO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/MessageDTO.java @@ -53,11 +53,6 @@ public class MessageDTO implements Serializable { private String chatId; /** - * 选项 - */ - private Object selection; - - /** * 大模型函数 */ private String func; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/QuestionDTO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/QuestionDTO.java index 126ec04..d01369e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/QuestionDTO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/dto/QuestionDTO.java @@ -37,8 +37,6 @@ public class QuestionDTO implements Serializable { */ private Map extra; - private Object data; - /** * 是否允许大模型查询数据,默认为 1 */ diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/service/QuestionHandlerService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/service/QuestionHandlerService.java index 6ce56b3..1b1ee84 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/service/QuestionHandlerService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/service/QuestionHandlerService.java @@ -53,7 +53,6 @@ public class QuestionHandlerService { case CHOOSE_YC: case CHOOSE_FAULT: case CHOOSE_YK: - question.setData(messageDTO.getSelection()); hznlmInvokeService.specialAsk(question); break; case CHOOSE_VIDEO: @@ -71,7 +70,7 @@ public class QuestionHandlerService { private void handleVideoChoose(MessageDTO messageDTO) { InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class); try { - VideoSelectionVO selection = (VideoSelectionVO) messageDTO.getSelection(); + VideoSelectionVO selection = (VideoSelectionVO) messageDTO.getExtra().get("data"); IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_VIDEO.getFunc()); String videoId = selection.getItemId(); ExtraVO videoExtras = resolveService.resolve(videoId); @@ -98,7 +97,7 @@ public class QuestionHandlerService { private void handleScadaChoose(MessageDTO messageDTO) { InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class); try { - ScadaSelectionVO selection = (ScadaSelectionVO) messageDTO.getSelection(); + ScadaSelectionVO selection = (ScadaSelectionVO) messageDTO.getExtra().get("data"); IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_CANVAS.getFunc()); ExtraVO scadaExtra = resolveService.resolve(selection.getItemId()); AnswerVO answerVO = new AnswerVO(); 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 12ed989..f456c65 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 @@ -41,7 +41,8 @@ public class RequestClientUtil { */ public static void postCall(String url, Map body) { log.info("开始远程调用{}接口",url); - HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute();log.info("远程调用{}接口结束",url); + HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute(); + log.info("远程调用{}接口结束",url); Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> { throw new ServiceException("远程调用接口" + url + "失败!"); });