Browse Source

fix: 合并master分支

zhongwei
haungxing 4 months ago
parent
commit
e3313a099a
  1. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IVideoSyncClient.java
  2. 4
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java
  3. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/control/DataSourceExecuteController.java
  4. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/control/RemoteController.java
  5. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/feign/AuthClient.java
  6. 9
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/DataSourceService.java
  7. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java
  8. 27
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/RedisKeyDeleter.java
  9. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/FontEndInteractiveController.java
  10. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/HznlmInteractiveController.java
  11. 7
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java
  12. 10
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java
  13. 16
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java
  14. 5
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java
  15. 14
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java
  16. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java
  17. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TableColumnController.java
  18. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TableInfoController.java
  19. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java
  20. 12
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/service/QuestionHandlerService.java
  21. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java
  22. 15
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java
  23. 113
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java
  24. 3
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/whitelist/controller/WhitelistController.java
  25. 79
      hzims-service/hzims-big-model/src/main/resources/template/template.yml

2
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IVideoSyncClient.java

@ -28,6 +28,6 @@ public interface IVideoSyncClient extends ISyncClient<VideoSyncDTO> {
@Override @Override
@DeleteMapping(PREFIX_API + DELETE_BY_IDS) @DeleteMapping(PREFIX_API + DELETE_BY_IDS)
R deleteByIds(@RequestParam(value = "ids") String ids); R deleteByIds(@RequestParam String ids);
} }

4
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java

@ -14,7 +14,7 @@ public class DataItemVO implements Serializable {
private String name; private String name;
@JSONField(name = "itemId") @JSONField(name = "id")
private String attrId; private String attrId;
@JSONField(name = "record_name") @JSONField(name = "record_name")
@ -32,7 +32,7 @@ public class DataItemVO implements Serializable {
@JSONField(name = "station_name") @JSONField(name = "station_name")
private String projectName; private String projectName;
@JSONField(name = "record_id") @JSONField(name = "item_id")
private String signage; private String signage;
private String units; private String units;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/controller/DataSourceExecuteController.java → hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/control/DataSourceExecuteController.java

@ -1,4 +1,4 @@
package com.hnac.hzims.bigmodel.business.controller; package com.hnac.hzims.bigmodel.business.control;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.business.service.DataSourceService; import com.hnac.hzims.bigmodel.business.service.DataSourceService;

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/controller/RemoteController.java → hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/control/RemoteController.java

@ -1,9 +1,8 @@
package com.hnac.hzims.bigmodel.business.controller; package com.hnac.hzims.bigmodel.business.control;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.business.service.RemoteService; import com.hnac.hzims.bigmodel.business.service.RemoteService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/remote") @RequestMapping("/remote")
@RestController @RestController
@Api(value = "数据平台遥控指令管理",tags = "数据平台遥控指令管理") @Api(value = "数据平台遥控指令管理",tags = "数据平台遥控指令管理")
@Business(module = BigModelConstants.APP_NAME,value = "数据平台遥控指令管理")
public class RemoteController { public class RemoteController {
private final RemoteService remoteService; private final RemoteService remoteService;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/feign/AuthClient.java

@ -39,7 +39,7 @@ public class AuthClient implements IAuthClient {
return R.fail("站点鉴权失败!"); return R.fail("站点鉴权失败!");
} }
} }
if("业务".equals(req.getType())) { if("数据中心".equals(req.getType())) {
} }
return R.success("鉴权成功"); return R.success("鉴权成功");

9
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/DataSourceService.java

@ -7,6 +7,7 @@ import com.hnac.hzims.common.service.UserAuthDataService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -38,9 +39,11 @@ public class DataSourceService {
}); });
String sql = sqlVO.getSql(); String sql = sqlVO.getSql();
String userAuthDataSQL = userAuthDataService.getUserAuthDataSQL(Long.parseLong(sqlVO.getUserId())); String userAuthDataSQL = userAuthDataService.getUserAuthDataSQL(Long.parseLong(sqlVO.getUserId()));
for (TableAuthVO tableAuthVO : sqlVO.getTableAuthVOList()) { if(StringUtil.isNotBlank(userAuthDataSQL)) {
String tableSubStr = "(SELECT * FROM " + tableAuthVO.getTableName() + " where" + userAuthDataSQL +") temp"; for (TableAuthVO tableAuthVO : sqlVO.getTableAuthVOList()) {
sql = sql.replace(tableAuthVO.getTableName(),tableSubStr); String tableSubStr = "(SELECT * FROM " + tableAuthVO.getTableName() + " where" + userAuthDataSQL +") temp";
sql = sql.replace(tableAuthVO.getTableName(),tableSubStr);
}
} }
log.info("执行sql:{}",sql); log.info("执行sql:{}",sql);
return this.queryListOnSpecificDataSource(sql, sqlVO.getTableAuthVOList().get(0).getDatasourceName()); return this.queryListOnSpecificDataSource(sql, sqlVO.getTableAuthVOList().get(0).getDatasourceName());

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java

@ -13,7 +13,6 @@ import com.hnac.hzinfo.sdk.v5.device.vo.ReductionDataVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
//import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,7 +32,6 @@ import java.time.temporal.ChronoUnit;
public class HistoryDataService { public class HistoryDataService {
private final DeviceDataClient deviceDataClient; private final DeviceDataClient deviceDataClient;
//private final BladeLogger logger;
public static final int DATA_COUNT_MAX = 1000; public static final int DATA_COUNT_MAX = 1000;
public Result<ReductionDataVO> getPolymerizationData(HistoryDataSearchVO searchVO) { public Result<ReductionDataVO> getPolymerizationData(HistoryDataSearchVO searchVO) {
@ -55,7 +53,7 @@ public class HistoryDataService {
dataDTO.setSaveTimeType(dateEnum.getSaveTimeType()); dataDTO.setSaveTimeType(dateEnum.getSaveTimeType());
dataDTO.setTimeInterval(1); dataDTO.setTimeInterval(1);
dataDTO.setDtos(Lists.newArrayList(reductionAttrData)); dataDTO.setDtos(Lists.newArrayList(reductionAttrData));
//logger.info("interactive:getPolymerizationData","config传参为:" + JSON.toJSONString(dataDTO)); log.info("config传参为:{}", JSON.toJSONString(dataDTO));
return deviceDataClient.pageDeviceCodeAndSignages(dataDTO); return deviceDataClient.pageDeviceCodeAndSignages(dataDTO);
} }

27
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/RedisKeyDeleter.java

@ -1,27 +0,0 @@
package com.hnac.hzims.bigmodel.configuration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.HZIMS_BIGMODEL_ASK_KEY;
/**
* @Author: huangxing
* @Date: 2024/07/12 09:23
*/
@Component
@Slf4j
public class RedisKeyDeleter implements CommandLineRunner {
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override
public void run(String... args) throws Exception {
// 删除指定的Redis key
redisTemplate.delete(HZIMS_BIGMODEL_ASK_KEY);
log.info("服务重启删除问题reids缓存:{}",HZIMS_BIGMODEL_ASK_KEY);
}
}

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/FontEndInteractiveController.java

@ -5,7 +5,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -27,7 +26,6 @@ import java.util.List;
@RequestMapping("/fontEnd/interactive") @RequestMapping("/fontEnd/interactive")
@Api(value = "前端交互控制层",tags = "前端交互控制层") @Api(value = "前端交互控制层",tags = "前端交互控制层")
@AllArgsConstructor @AllArgsConstructor
@Business(module = BigModelConstants.APP_NAME,value = "前端交互层管理",ignore = false)
public class FontEndInteractiveController { public class FontEndInteractiveController {
private final IHznlmInvokeService hznlmInvokeService; private final IHznlmInvokeService hznlmInvokeService;

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/HznlmInteractiveController.java

@ -10,7 +10,6 @@ import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq;
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInteractiveService; import com.hnac.hzims.bigmodel.interactive.service.IHznlmInteractiveService;
import com.hnac.hzims.bigmodel.interactive.vo.AuthDataVO; import com.hnac.hzims.bigmodel.interactive.vo.AuthDataVO;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -29,7 +28,6 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@Api(value = "HZLLM大模型交互层",tags = "HZLLM大模型交互层") @Api(value = "HZLLM大模型交互层",tags = "HZLLM大模型交互层")
@RequestMapping("/hzn_lm/interactive") @RequestMapping("/hzn_lm/interactive")
@Business(module = BigModelConstants.MODULE_NAME,value = "HZLLM大模型交互层")
public class HznlmInteractiveController { public class HznlmInteractiveController {
private final IHznlmInteractiveService interactiveService; private final IHznlmInteractiveService interactiveService;

7
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java

@ -4,10 +4,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.service.IAnswerResolveService; import com.hnac.hzims.bigmodel.interactive.service.IAnswerResolveService;
import com.hnac.hzims.bigmodel.interactive.service.IResolveService; import com.hnac.hzinfo.exception.HzServiceException;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
//import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
@ -49,7 +48,7 @@ public class AnswerResolveFactory {
return null; return null;
} }
} }
throw new ServiceException("service解析失败!"); throw new HzServiceException(ResultCode.DEFAULT_NULL_MESSAGE,"service解析失败!");
} }
} }

10
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java

@ -2,8 +2,10 @@ package com.hnac.hzims.bigmodel.interactive.factory;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.service.IResolveService; import com.hnac.hzims.bigmodel.interactive.service.IResolveService;
import com.hnac.hzinfo.exception.HzServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
//import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
@ -11,6 +13,7 @@ import org.springblade.core.tool.utils.SpringUtil;
* @Author: huangxing * @Author: huangxing
* @Date: 2024/06/21 15:53 * @Date: 2024/06/21 15:53
*/ */
@Slf4j
public class ResolveFactory { public class ResolveFactory {
public static final String CANVAS_RESOLVE_SERVICE = "canvasResolveService"; public static final String CANVAS_RESOLVE_SERVICE = "canvasResolveService";
@ -22,7 +25,6 @@ public class ResolveFactory {
* @return 解析函数所需service * @return 解析函数所需service
*/ */
public static IResolveService getResolveService(String funcCode) { public static IResolveService getResolveService(String funcCode) {
// BladeLogger logger = SpringUtil.getBean(BladeLogger.class);
FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(funcCode); FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(funcCode);
if(Func.isNotEmpty(funcRouteEnum)) { if(Func.isNotEmpty(funcRouteEnum)) {
switch(funcRouteEnum) { switch(funcRouteEnum) {
@ -31,8 +33,8 @@ public class ResolveFactory {
case OPEN_VIDEO: case OPEN_VIDEO:
return SpringUtil.getBean("videoResolveService"); return SpringUtil.getBean("videoResolveService");
default: default:
// logger.error("hzims:bigModel:getResolveService","函数解析失败,函数编号为:" + funcCode); log.error("函数解析失败,函数编号为:{}", funcCode);
throw new ServiceException("service解析失败"); throw new HzServiceException(ResultCode.FAILURE,"service解析失败");
} }
} }
throw new ServiceException("service解析失败"); throw new ServiceException("service解析失败");

16
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java

@ -1,16 +1,18 @@
package com.hnac.hzims.bigmodel.interactive.service.impl; 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.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.constants.ParamKeyConstants; 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.req.ModelFunctionReq;
import com.hnac.hzims.bigmodel.interactive.service.IResolveService; import com.hnac.hzims.bigmodel.interactive.service.IResolveService;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import groovy.util.logging.Slf4j; import com.hnac.hzinfo.exception.HzServiceException;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; 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.api.R;
import org.springblade.core.tool.api.ResultCode; import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -18,7 +20,6 @@ import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.cache.ParamCache; import org.springblade.system.cache.ParamCache;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory;
import java.util.*; import java.util.*;
import java.util.stream.IntStream; import java.util.stream.IntStream;
@ -33,7 +34,6 @@ import java.util.stream.IntStream;
public class CanvasResolveServiceImpl implements IResolveService { public class CanvasResolveServiceImpl implements IResolveService {
private final IStationClient stationClient; private final IStationClient stationClient;
// private final BladeLogger logger;
@Override @Override
public ExtraVO resolve(ModelFunctionReq req) { public ExtraVO resolve(ModelFunctionReq req) {
@ -41,8 +41,8 @@ public class CanvasResolveServiceImpl implements IResolveService {
String id = args.get("itemId"); String id = args.get("itemId");
String name = args.get("itemName"); String name = args.get("itemName");
Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> { Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> {
// logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req)); log.error("解析传参错误,缺少必要参数video_id,传参内容为:{}", JSON.toJSONString(req));
throw new ServiceException(ResultCode.FAILURE,"解析传参错误,缺少必要参数video_id"); throw new HzServiceException(ResultCode.FAILURE,"解析传参错误,缺少必要参数video_id");
}); });
return this.resolve(id); return this.resolve(id);
} }
@ -82,7 +82,7 @@ public class CanvasResolveServiceImpl implements IResolveService {
extraVO.setRoute(this.replacePath("other/v4/canvas/index.html?hzinfowebkit=true&taskId={taskId}&stationNum={stationNum}&projectId={projectId}&source=app&picName={context}&itemName={itemName}", resolveMap)); extraVO.setRoute(this.replacePath("other/v4/canvas/index.html?hzinfowebkit=true&taskId={taskId}&stationNum={stationNum}&projectId={projectId}&source=app&picName={context}&itemName={itemName}", resolveMap));
} }
else { else {
throw new ServiceException(ResultCode.FAILURE,"解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由"); throw new HzServiceException(ResultCode.FAILURE,"解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由");
} }
return extraVO; return extraVO;
} }
@ -91,7 +91,7 @@ public class CanvasResolveServiceImpl implements IResolveService {
Map<String,String> result = new HashMap<>(); Map<String,String> result = new HashMap<>();
List<String> params = Func.toStrList("\\^", paramsStr); List<String> params = Func.toStrList("\\^", paramsStr);
Assert.isTrue(params.size() == keys.length, () -> { Assert.isTrue(params.size() == keys.length, () -> {
throw new ServiceException(ResultCode.FAILURE,"大模型传参params长度错误,传参为:" + paramsStr); throw new HzServiceException(ResultCode.FAILURE, "大模型传参params长度错误,传参为:" + paramsStr);
}); });
IntStream.iterate(0, index -> index + 1).limit(params.size()).forEach(index -> result.put(keys[index],params.get(index))); IntStream.iterate(0, index -> index + 1).limit(params.size()).forEach(index -> result.put(keys[index],params.get(index)));
return result; return result;

5
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java

@ -14,7 +14,6 @@ import com.hnac.hzims.bigmodel.utils.RequestClientUtil;
import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -38,7 +37,6 @@ import java.util.Map;
public class HznlmInvokeServiceImpl implements IHznlmInvokeService { public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
private final BigModelInvokeUrl bigModelInvokeUrl; private final BigModelInvokeUrl bigModelInvokeUrl;
// private final BladeLogger logger;
private final SessionRedisManager sessionRedisManager; private final SessionRedisManager sessionRedisManager;
private final IAuthClient authClient; private final IAuthClient authClient;
@ -112,8 +110,9 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
@Override @Override
public void askAbort(String sessionId) { public void askAbort(String sessionId) {
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
params.put("id",sessionId); params.put("chat_id",sessionId);
RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAskAbort(), params); RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAskAbort(), params);
sessionRedisManager.removeSessionId(sessionId);
} }
@Override @Override

14
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java

@ -9,11 +9,11 @@ import com.hnac.hzims.bigmodel.interactive.service.IResolveService;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import groovy.util.logging.Slf4j; import com.hnac.hzinfo.exception.HzServiceException;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException; import lombok.extern.slf4j.Slf4j;
//import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -31,7 +31,6 @@ import java.util.Map;
public class VideoResolveServiceImpl implements IResolveService { public class VideoResolveServiceImpl implements IResolveService {
private final IStationVideoTypeClient videoClient; private final IStationVideoTypeClient videoClient;
// private final BladeLogger logger;
@Override @Override
public ExtraVO resolve(ModelFunctionReq req) { public ExtraVO resolve(ModelFunctionReq req) {
@ -39,13 +38,10 @@ public class VideoResolveServiceImpl implements IResolveService {
String id = args.get("itemId"); String id = args.get("itemId");
String name = args.get("itemName"); String name = args.get("itemName");
Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> { Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> {
// logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req)); log.error("解析传参错误,缺少必要参数video_id,传参内容为:{}", JSON.toJSONString(req));
throw new ServiceException("解析传参错误,缺少必要参数video_id"); throw new HzServiceException(ResultCode.FAILURE, "解析传参错误,缺少必要参数video_id");
}); });
return this.resolve(id); return this.resolve(id);
// ExtraVO extra = this.resolve(id);
// String message = "已成功打开" + name + ";";
// return new ResolveResultVO(message,extra);
} }
@Override @Override

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java

@ -25,7 +25,7 @@ public class AnswerVO implements Serializable {
@ApiModelProperty("发起问答时的随机ID") @ApiModelProperty("发起问答时的随机ID")
@JSONField(name = "chat_id") @JSONField(name = "chat_id")
private String sessionId; private String chatId;
@ApiModelProperty("发起问答时的用户ID") @ApiModelProperty("发起问答时的用户ID")
@JSONField(name = "user_id") @JSONField(name = "user_id")

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TableColumnController.java

@ -3,7 +3,6 @@ package com.hnac.hzims.bigmodel.maintenance.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.maintenance.service.TableColumnService; import com.hnac.hzims.bigmodel.maintenance.service.TableColumnService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -24,7 +23,6 @@ import java.util.Map;
@RestController @RestController
@RequestMapping("/table/info") @RequestMapping("/table/info")
@Api(value = "数据库表、列信息查询管理",tags = "数据库表、列信息查询管理") @Api(value = "数据库表、列信息查询管理",tags = "数据库表、列信息查询管理")
@Business(module = BigModelConstants.APP_NAME,value = "数据库表、列信息查询管理",ignore = false)
@AllArgsConstructor @AllArgsConstructor
public class TableColumnController { public class TableColumnController {

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TableInfoController.java

@ -5,7 +5,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.maintenance.entity.TableInfoEntity; import com.hnac.hzims.bigmodel.maintenance.entity.TableInfoEntity;
import com.hnac.hzims.bigmodel.maintenance.service.TableInfoService; import com.hnac.hzims.bigmodel.maintenance.service.TableInfoService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -26,7 +25,6 @@ import javax.validation.Valid;
@RequestMapping("/tableInfo") @RequestMapping("/tableInfo")
@Api(value = "数据库信息管理",tags = "数据库信息管理") @Api(value = "数据库信息管理",tags = "数据库信息管理")
@AllArgsConstructor @AllArgsConstructor
@Business(module = BigModelConstants.APP_NAME,value = "数据库信息管理",ignore = false)
public class TableInfoController { public class TableInfoController {
private final TableInfoService tableInfoService; private final TableInfoService tableInfoService;

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java

@ -17,15 +17,11 @@ import java.io.Serializable;
* @Date: 2024/07/05 14:45 * @Date: 2024/07/05 14:45
*/ */
@Data @Data
@EqualsAndHashCode @EqualsAndHashCode(callSuper=false)
@TableName("HZIMS_DATASOURCE") @TableName("HZIMS_DATASOURCE")
@ApiModel(value = "数据源配置",description = "数据源配置") @ApiModel(value = "数据源配置",description = "数据源配置")
public class DatasourceEntity extends TenantEntity implements Serializable { public class DatasourceEntity extends TenantEntity implements Serializable {
@ApiModelProperty("数据源")
@QueryField(condition = SqlCondition.LIKE)
private String datasource;
@ApiModelProperty("数据源名称") @ApiModelProperty("数据源名称")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
private String datasourceName; private String datasourceName;

12
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/service/QuestionHandlerService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.bigmodel.question.service; package com.hnac.hzims.bigmodel.question.service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory; import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory;
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService;
@ -14,6 +15,7 @@ import com.hnac.hzims.bigmodel.question.dto.QuestionDTO;
import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService; import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService;
import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
@ -27,6 +29,7 @@ import org.springframework.web.socket.TextMessage;
*/ */
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@Slf4j
public class QuestionHandlerService { public class QuestionHandlerService {
private final IHznlmInvokeService hznlmInvokeService; private final IHznlmInvokeService hznlmInvokeService;
@ -70,12 +73,12 @@ public class QuestionHandlerService {
private void handleVideoChoose(MessageDTO messageDTO) { private void handleVideoChoose(MessageDTO messageDTO) {
InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class); InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class);
try { try {
VideoSelectionVO selection = (VideoSelectionVO) messageDTO.getExtra().get("data"); VideoSelectionVO selection = JSONObject.parseObject(JSON.toJSONString(messageDTO.getExtra().get("data")),VideoSelectionVO.class);
IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_VIDEO.getFunc()); IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_VIDEO.getFunc());
String videoId = selection.getItemId(); String videoId = selection.getItemId();
ExtraVO videoExtras = resolveService.resolve(videoId); ExtraVO videoExtras = resolveService.resolve(videoId);
AnswerVO answerVO = new AnswerVO(); AnswerVO answerVO = new AnswerVO();
answerVO.setSessionId(messageDTO.getChatId()); answerVO.setChatId(messageDTO.getChatId());
answerVO.setQuery(selection.getItemName()); answerVO.setQuery(selection.getItemName());
answerVO.setRunning(0); answerVO.setRunning(0);
answerVO.setStatus(0); answerVO.setStatus(0);
@ -85,6 +88,7 @@ public class QuestionHandlerService {
wsService.sendMessage(messageDTO.getChatId(),textMessage); wsService.sendMessage(messageDTO.getChatId(),textMessage);
} }
catch (Exception e) { catch (Exception e) {
log.error("an error occurred!",e);
AnswerVO answerVO = new AnswerVO(); AnswerVO answerVO = new AnswerVO();
answerVO.setRunning(0); answerVO.setRunning(0);
answerVO.setStatus(-2); answerVO.setStatus(-2);
@ -97,11 +101,11 @@ public class QuestionHandlerService {
private void handleScadaChoose(MessageDTO messageDTO) { private void handleScadaChoose(MessageDTO messageDTO) {
InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class); InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class);
try { try {
ScadaSelectionVO selection = (ScadaSelectionVO) messageDTO.getExtra().get("data"); ScadaSelectionVO selection = JSONObject.parseObject(JSON.toJSONString(messageDTO.getExtra().get("data")),ScadaSelectionVO.class);;
IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_CANVAS.getFunc()); IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_CANVAS.getFunc());
ExtraVO scadaExtra = resolveService.resolve(selection.getItemId()); ExtraVO scadaExtra = resolveService.resolve(selection.getItemId());
AnswerVO answerVO = new AnswerVO(); AnswerVO answerVO = new AnswerVO();
answerVO.setSessionId(messageDTO.getChatId()); answerVO.setChatId(messageDTO.getChatId());
answerVO.setRunning(0); answerVO.setRunning(0);
answerVO.setStatus(0); answerVO.setStatus(0);
answerVO.setQuery(selection.getItemName()); answerVO.setQuery(selection.getItemName());

13
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java

@ -16,19 +16,15 @@ import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.*; import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.*;
@ -45,7 +41,6 @@ public class FrontEndInteractiveSchedule {
private final InteractiveWsService wsService; private final InteractiveWsService wsService;
private final ThreadPoolExecutor getAnswerPoolExecutor; private final ThreadPoolExecutor getAnswerPoolExecutor;
private final IHznlmInvokeService hznlmInvokeService; private final IHznlmInvokeService hznlmInvokeService;
// private final BladeLogger logger;
@XxlJob(GET_INTERACTIVE_RESULT) @XxlJob(GET_INTERACTIVE_RESULT)
public ReturnT<String> getInteractiveResult(String params) { public ReturnT<String> getInteractiveResult(String params) {
@ -58,8 +53,8 @@ public class FrontEndInteractiveSchedule {
answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> { answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> {
// 如果已经获取到答案 则删除缓存 // 如果已经获取到答案 则删除缓存
if(answerVO.getRunning() == 0) { if(answerVO.getRunning() == 0) {
// logger.info("hzims:bigmodel:getInteractiveResult:answer","获取大模型解析答案:" + JSON.toJSONString(answerVO)); log.info("获取大模型解析答案:{}" , JSON.toJSONString(answerVO));
sessionRedisManager.removeSessionId(answerVO.getSessionId()); sessionRedisManager.removeSessionId(answerVO.getChatId());
} }
Object[] extras = answerVO.getExtras(); Object[] extras = answerVO.getExtras();
if(ObjectUtil.isNotEmpty(answerVO.getExtras()) && extras.length > 0){ if(ObjectUtil.isNotEmpty(answerVO.getExtras()) && extras.length > 0){
@ -77,11 +72,11 @@ public class FrontEndInteractiveSchedule {
} }
catch(Exception e) { catch(Exception e) {
log.error("An error occurred",e); log.error("An error occurred",e);
AnswerVO.error(answerVO.getSessionId(), answerVO.getUserId(), answerVO.getQuery()); AnswerVO.error(answerVO.getChatId(), answerVO.getUserId(), answerVO.getQuery());
} }
} }
TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO)); TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO));
wsService.sendMessage(answerVO.getSessionId(),message); wsService.sendMessage(answerVO.getChatId(),message);
}, getAnswerPoolExecutor)); }, getAnswerPoolExecutor));
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }

15
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java

@ -5,11 +5,12 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.hnac.hzinfo.exception.HzServiceException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.ResultCode; import org.springblade.core.tool.api.ResultCode;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.servlet.http.HttpServletResponse;
import java.util.Map; import java.util.Map;
/** /**
@ -29,8 +30,8 @@ public class RequestClientUtil {
log.info("开始远程调用{}接口",url); log.info("开始远程调用{}接口",url);
HttpResponse response = HttpRequest.post(url).body(body).execute(); HttpResponse response = HttpRequest.post(url).body(body).execute();
log.info("远程调用{}接口结束",url); log.info("远程调用{}接口结束",url);
Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> { Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new ServiceException("远程调用接口" + url + "失败!"); throw new HzServiceException(ResultCode.FAILURE, "远程调用接口" + url + "失败!");
}); });
} }
@ -43,8 +44,8 @@ public class RequestClientUtil {
log.info("开始远程调用{}接口",url); log.info("开始远程调用{}接口",url);
HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute(); HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute();
log.info("远程调用{}接口结束",url); log.info("远程调用{}接口结束",url);
Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> { Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new ServiceException("远程调用接口" + url + "失败!"); throw new HzServiceException(ResultCode.FAILURE, "远程调用接口" + url + "失败!");
}); });
} }
@ -58,8 +59,8 @@ public class RequestClientUtil {
*/ */
public static <T> T postCall(String url, Map body, TypeReference<T> typeRef) { public static <T> T postCall(String url, Map body, TypeReference<T> typeRef) {
HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute(); HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute();
Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> { Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new ServiceException("远程调用大模型接口" + url + "失败!"); throw new HzServiceException(ResultCode.FAILURE, "远程调用大模型接口" + url + "失败!");
}); });
return JSONObject.parseObject(response.body(), typeRef); return JSONObject.parseObject(response.body(), typeRef);
} }

113
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java

@ -80,119 +80,6 @@ public class InteractiveHandler extends TextWebSocketHandler {
QuestionHandlerService service = SpringUtil.getBean(QuestionHandlerService.class); QuestionHandlerService service = SpringUtil.getBean(QuestionHandlerService.class);
service.handleMessage(messageDTO); service.handleMessage(messageDTO);
} }
// JSONObject messageJSON = JSONObject.parseObject(message.getPayload());
// if("0".equals(messageJSON.getString("type"))) {
// // 接收心跳消息,返回一条心跳消息
// try {
// session.sendMessage(InteractiveSessionManager.getTextMessage("0","收到心跳消息"));
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// } else {
// String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey();
// if(messageJSON.containsKey("content")) {
// // 将发送参数存入redis
// redisTemplate.expire(RedisKeyConstants.SESSION_CONTENT_KEY,30, TimeUnit.MINUTES);
// redisTemplate.opsForHash().put(RedisKeyConstants.SESSION_CONTENT_KEY,sessionId,messageJSON.getObject("content", SessionContentVO.class));
// }
// this.handleMessage(messageJSON, sessionId);
// }
}
private void handleMessage(JSONObject messageContext, String sessionId) {
Boolean isSpecial = messageContext.getBoolean("isSpecial");
if (Func.isEmpty(isSpecial) || !isSpecial) {
String context = messageContext.getString("context");
String userId = messageContext.getString("userId");
String knowledge = messageContext.getString("knowledge");
IHznlmInvokeService hznlmInvokeService = SpringUtil.getBean(IHznlmInvokeService.class);
if (knowledge != null) {
hznlmInvokeService.knowledgeAsk(context, sessionId, userId, knowledge);
} else {
hznlmInvokeService.ask(context, sessionId, userId);
}
}
else {
String funcCode = messageContext.getString("func");
FuncRouteEnum funcEnum = FuncRouteEnum.getEnumByFuncCode(funcCode);
switch (funcEnum) {
case CHOOSE_STATION:
case CHOOSE_YC:
case CHOOSE_FAULT:
case CHOOSE_YK:
this.handleDefaultChoose(messageContext,sessionId);
break;
case CHOOSE_VIDEO:
this.handleVideoChoose(messageContext,sessionId);
break;
case CHOOSE_CANVAS:
this.handleScadaChoose(messageContext,sessionId);
break;
default:
break;
}
}
}
private void handleDefaultChoose(JSONObject messageContext,String sessionId) {
IHznlmInvokeService invokeService = SpringUtil.getBean(IHznlmInvokeService.class);
Map<String, Object> extra = messageContext.toJavaObject(Map.class);
extra.put("func",extra.get("func"));
extra.put("data",JSONObject.parseObject(JSON.toJSONString(extra.get("selection"))));
invokeService.specialAsk(sessionId, (String) extra.get("userId"),extra);
}
private void handleVideoChoose(JSONObject messageContext,String sessionId) {
InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class);
try {
VideoSelectionVO selection = messageContext.getObject("selection", VideoSelectionVO.class);
IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_VIDEO.getFunc());
String videoId = selection.getItemId();
ExtraVO videoExtras = resolveService.resolve(videoId);
AnswerVO answerVO = new AnswerVO();
answerVO.setSessionId(sessionId);
answerVO.setQuery(selection.getItemName());
answerVO.setRunning(0);
answerVO.setStatus(0);
answerVO.setAnswer("已成功打开"+selection.getItemName()+"视频");
answerVO.setExtras(new Object[]{JSON.toJSONString(videoExtras)});
TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO));
wsService.sendMessage(sessionId,textMessage);
}
catch (Exception e) {
AnswerVO answerVO = new AnswerVO();
answerVO.setRunning(0);
answerVO.setStatus(-2);
answerVO.setAnswer("视频解析失败!");
TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO));
wsService.sendMessage(sessionId,textMessage);
}
}
private void handleScadaChoose(JSONObject messageContext,String sessionId) {
InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class);
try {
ScadaSelectionVO selection = messageContext.getObject("selection", ScadaSelectionVO.class);
IResolveService resolveService = ResolveFactory.getResolveService(FuncRouteEnum.OPEN_CANVAS.getFunc());
ExtraVO scadaExtra = resolveService.resolve(selection.getItemId());
AnswerVO answerVO = new AnswerVO();
answerVO.setSessionId(sessionId);
answerVO.setRunning(0);
answerVO.setStatus(0);
answerVO.setQuery(selection.getItemName());
answerVO.setAnswer("已成功打开"+selection.getItemName()+"实时画面");
answerVO.setExtras(new Object[]{JSON.toJSONString(scadaExtra)});
TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO));
wsService.sendMessage(sessionId,textMessage);
}
catch (Exception e) {
AnswerVO answerVO = new AnswerVO();
answerVO.setRunning(0);
answerVO.setStatus(-2);
answerVO.setAnswer("实时画面解析失败!");
TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO));
wsService.sendMessage(sessionId,textMessage);
}
} }
} }

3
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/whitelist/controller/WhitelistController.java

@ -1,10 +1,8 @@
package com.hnac.hzims.bigmodel.whitelist.controller; package com.hnac.hzims.bigmodel.whitelist.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.entity.WhitelistEntity; import com.hnac.hzims.bigmodel.entity.WhitelistEntity;
import com.hnac.hzims.bigmodel.whitelist.service.WhitelistService; import com.hnac.hzims.bigmodel.whitelist.service.WhitelistService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -23,7 +21,6 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/whitelist") @RequestMapping("/whitelist")
@Api(value = "白名单用户",tags = "白名单用户") @Api(value = "白名单用户",tags = "白名单用户")
@Business(module = BigModelConstants.MODULE_NAME,value = "大模型函数管理")
@AllArgsConstructor @AllArgsConstructor
public class WhitelistController { public class WhitelistController {

79
hzims-service/hzims-big-model/src/main/resources/template/template.yml

@ -1,22 +1,55 @@
#服务器端口 #服务器端口
server: server:
port: 8135 port: 8135
#数据源配置
spring: spring:
#排除DruidDataSourceAutoConfigure #排除DruidDataSourceAutoConfigure
autoconfigure: autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource: datasource:
url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/prod_hzims_big_model?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true dynamic:
username: ${hzinfo.db.busines.username} #设置默认的数据源或者数据源组,默认值即为master
password: ${hzinfo.db.busines.password} primary: master
datasource:
#oss配置 master:
oss: url: jdbc:mysql://${hzinfo.db.busines.ip}:${hzinfo.db.busines.port}/test_hzims_big_model?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
endpoint: ${hzinfo.oss.endpoint} username: ${hzinfo.db.busines.username}
access-key: ${hzinfo.oss.access-key} password: ${hzinfo.db.busines.password}
secret-key: ${hzinfo.oss.secret-key} operation:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_operation?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
equipment:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
ticket:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
safeproduct:
url: jdbc:mysql://192.168.60.34:3576/test_hzims?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
inspect:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_inspect?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
basic:
url: jdbc:mysql://192.168.60.34:3576/test_basic?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
alarm:
url: jdbc:mysql://192.168.60.34:3576/test_hzims_alarm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
information:
url: jdbc:mysql://192.168.60.34:3576/information_schema?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
hznlm:
url: jdbc:mysql://192.168.60.16:3306/hzn_lm?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username: root
password: 123
fdp: fdp:
host: http://192.168.60.16:9997 host: http://192.168.60.16:9997
@ -42,25 +75,3 @@ xxl:
logpath: /data/applogs/xxl-job/jobhandler logpath: /data/applogs/xxl-job/jobhandler
logretentiondays: 7 logretentiondays: 7
port: 28135 port: 28135
blade:
data:
sdk:
enabled: true
url: http://${hzims.sdk.ip}/api/hzinfo-data-config
ctrlUrl: http://${hzims.sdk.ip}/api/hzinfo-data-handler
scadaUrl: http://${hzims.sdk.ip}/api/hzinfo-data-scada
appId: ${hzims.sdk.appId}
appSecret: ${hzims.sdk.appSecret}
redisIp: ${hzims.sdk.redisIp}
redisPort: ${hzims.sdk.redisPort}
password: ${hzims.sdk.password}
maxKeys: 1000
data-scope:
enabled: false
lock:
enabled: true
address: redis://${hzinfo.redis.ip}:${hzinfo.redis.port}
password: ${hzinfo.redis.password}
database: 0
ssl: false
Loading…
Cancel
Save