Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
Jone 4 months ago
parent
commit
bcce380d27
  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/pom.xml
  4. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/control/DataSourceExecuteController.java
  5. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/control/RemoteController.java
  6. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/feign/AuthClient.java
  7. 9
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/DataSourceService.java
  8. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java
  9. 27
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/RedisKeyDeleter.java
  10. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/FontEndInteractiveController.java
  11. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/HznlmInteractiveController.java
  12. 7
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java
  13. 10
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java
  14. 16
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java
  15. 5
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java
  16. 14
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java
  17. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java
  18. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TableColumnController.java
  19. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/TableInfoController.java
  20. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java
  21. 12
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/question/service/QuestionHandlerService.java
  22. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java
  23. 15
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java
  24. 113
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java
  25. 3
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/whitelist/controller/WhitelistController.java
  26. 81
      hzims-service/hzims-big-model/src/main/resources/template/template.yml
  27. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  28. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  29. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java
  30. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/HazardLibraryController.java
  31. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/HazardLibraryWrapper.java
  32. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimateServiceImpl.java
  33. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardCategoryServiceImpl.java

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
@DeleteMapping(PREFIX_API + DELETE_BY_IDS)
R deleteByIds(@RequestParam(value = "ids") String ids);
R deleteByIds(@RequestParam("ids") 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;
@JSONField(name = "itemId")
@JSONField(name = "id")
private String attrId;
@JSONField(name = "record_name")
@ -32,7 +32,7 @@ public class DataItemVO implements Serializable {
@JSONField(name = "station_name")
private String projectName;
@JSONField(name = "record_id")
@JSONField(name = "item_id")
private String signage;
private String units;

2
hzims-service/hzims-big-model/pom.xml

@ -76,7 +76,7 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>2.5.6</version>
<version>3.5.0</version>
</dependency>
</dependencies>

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.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.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.business.service.RemoteService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/remote")
@RestController
@Api(value = "数据平台遥控指令管理",tags = "数据平台遥控指令管理")
@Business(module = BigModelConstants.APP_NAME,value = "数据平台遥控指令管理")
public class RemoteController {
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("站点鉴权失败!");
}
}
if("业务".equals(req.getType())) {
if("数据中心".equals(req.getType())) {
}
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.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -38,9 +39,11 @@ public class DataSourceService {
});
String sql = sqlVO.getSql();
String userAuthDataSQL = userAuthDataService.getUserAuthDataSQL(Long.parseLong(sqlVO.getUserId()));
for (TableAuthVO tableAuthVO : sqlVO.getTableAuthVOList()) {
String tableSubStr = "(SELECT * FROM " + tableAuthVO.getTableName() + " where" + userAuthDataSQL +") temp";
sql = sql.replace(tableAuthVO.getTableName(),tableSubStr);
if(StringUtil.isNotBlank(userAuthDataSQL)) {
for (TableAuthVO tableAuthVO : sqlVO.getTableAuthVOList()) {
String tableSubStr = "(SELECT * FROM " + tableAuthVO.getTableName() + " where" + userAuthDataSQL +") temp";
sql = sql.replace(tableAuthVO.getTableName(),tableSubStr);
}
}
log.info("执行sql:{}",sql);
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.extern.slf4j.Slf4j;
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.Func;
import org.springframework.stereotype.Service;
@ -33,7 +32,6 @@ import java.time.temporal.ChronoUnit;
public class HistoryDataService {
private final DeviceDataClient deviceDataClient;
//private final BladeLogger logger;
public static final int DATA_COUNT_MAX = 1000;
public Result<ReductionDataVO> getPolymerizationData(HistoryDataSearchVO searchVO) {
@ -55,7 +53,7 @@ public class HistoryDataService {
dataDTO.setSaveTimeType(dateEnum.getSaveTimeType());
dataDTO.setTimeInterval(1);
dataDTO.setDtos(Lists.newArrayList(reductionAttrData));
//logger.info("interactive:getPolymerizationData","config传参为:" + JSON.toJSONString(dataDTO));
log.info("config传参为:{}", JSON.toJSONString(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.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -27,7 +26,6 @@ import java.util.List;
@RequestMapping("/fontEnd/interactive")
@Api(value = "前端交互控制层",tags = "前端交互控制层")
@AllArgsConstructor
@Business(module = BigModelConstants.APP_NAME,value = "前端交互层管理",ignore = false)
public class FontEndInteractiveController {
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.vo.AuthDataVO;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -29,7 +28,6 @@ import java.util.Map;
@AllArgsConstructor
@Api(value = "HZLLM大模型交互层",tags = "HZLLM大模型交互层")
@RequestMapping("/hzn_lm/interactive")
@Business(module = BigModelConstants.MODULE_NAME,value = "HZLLM大模型交互层")
public class HznlmInteractiveController {
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.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.service.IAnswerResolveService;
import com.hnac.hzims.bigmodel.interactive.service.IResolveService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzinfo.exception.HzServiceException;
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.SpringUtil;
@ -49,7 +48,7 @@ public class AnswerResolveFactory {
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.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.logger.BladeLogger;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil;
@ -11,6 +13,7 @@ import org.springblade.core.tool.utils.SpringUtil;
* @Author: huangxing
* @Date: 2024/06/21 15:53
*/
@Slf4j
public class ResolveFactory {
public static final String CANVAS_RESOLVE_SERVICE = "canvasResolveService";
@ -22,7 +25,6 @@ public class ResolveFactory {
* @return 解析函数所需service
*/
public static IResolveService getResolveService(String funcCode) {
// BladeLogger logger = SpringUtil.getBean(BladeLogger.class);
FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(funcCode);
if(Func.isNotEmpty(funcRouteEnum)) {
switch(funcRouteEnum) {
@ -31,8 +33,8 @@ public class ResolveFactory {
case OPEN_VIDEO:
return SpringUtil.getBean("videoResolveService");
default:
// logger.error("hzims:bigModel:getResolveService","函数解析失败,函数编号为:" + funcCode);
throw new ServiceException("service解析失败");
log.error("函数解析失败,函数编号为:{}", funcCode);
throw new HzServiceException(ResultCode.FAILURE,"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;
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.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import groovy.util.logging.Slf4j;
import com.hnac.hzinfo.exception.HzServiceException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.ResultCode;
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.springframework.stereotype.Service;
import org.springframework.util.Assert;
import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory;
import java.util.*;
import java.util.stream.IntStream;
@ -33,7 +34,6 @@ import java.util.stream.IntStream;
public class CanvasResolveServiceImpl implements IResolveService {
private final IStationClient stationClient;
// private final BladeLogger logger;
@Override
public ExtraVO resolve(ModelFunctionReq req) {
@ -41,8 +41,8 @@ public class CanvasResolveServiceImpl implements IResolveService {
String id = args.get("itemId");
String name = args.get("itemName");
Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> {
// logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req));
throw new ServiceException(ResultCode.FAILURE,"解析传参错误,缺少必要参数video_id");
log.error("解析传参错误,缺少必要参数video_id,传参内容为:{}", JSON.toJSONString(req));
throw new HzServiceException(ResultCode.FAILURE,"解析传参错误,缺少必要参数video_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));
}
else {
throw new ServiceException(ResultCode.FAILURE,"解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由");
throw new HzServiceException(ResultCode.FAILURE,"解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由");
}
return extraVO;
}
@ -91,7 +91,7 @@ public class CanvasResolveServiceImpl implements IResolveService {
Map<String,String> result = new HashMap<>();
List<String> params = Func.toStrList("\\^", paramsStr);
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)));
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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
//import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
@ -38,7 +37,6 @@ import java.util.Map;
public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
private final BigModelInvokeUrl bigModelInvokeUrl;
// private final BladeLogger logger;
private final SessionRedisManager sessionRedisManager;
private final IAuthClient authClient;
@ -112,8 +110,9 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
@Override
public void askAbort(String sessionId) {
Map<String,Object> params = new HashMap<>();
params.put("id",sessionId);
params.put("chat_id",sessionId);
RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAskAbort(), params);
sessionRedisManager.removeSessionId(sessionId);
}
@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.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import groovy.util.logging.Slf4j;
import com.hnac.hzinfo.exception.HzServiceException;
import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
//import org.springblade.core.log.logger.BladeLogger;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -31,7 +31,6 @@ import java.util.Map;
public class VideoResolveServiceImpl implements IResolveService {
private final IStationVideoTypeClient videoClient;
// private final BladeLogger logger;
@Override
public ExtraVO resolve(ModelFunctionReq req) {
@ -39,13 +38,10 @@ public class VideoResolveServiceImpl implements IResolveService {
String id = args.get("itemId");
String name = args.get("itemName");
Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> {
// logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req));
throw new ServiceException("解析传参错误,缺少必要参数video_id");
log.error("解析传参错误,缺少必要参数video_id,传参内容为:{}", JSON.toJSONString(req));
throw new HzServiceException(ResultCode.FAILURE, "解析传参错误,缺少必要参数video_id");
});
return this.resolve(id);
// ExtraVO extra = this.resolve(id);
// String message = "已成功打开" + name + ";";
// return new ResolveResultVO(message,extra);
}
@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")
@JSONField(name = "chat_id")
private String sessionId;
private String chatId;
@ApiModelProperty("发起问答时的用户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.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.maintenance.service.TableColumnService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -24,7 +23,6 @@ import java.util.Map;
@RestController
@RequestMapping("/table/info")
@Api(value = "数据库表、列信息查询管理",tags = "数据库表、列信息查询管理")
@Business(module = BigModelConstants.APP_NAME,value = "数据库表、列信息查询管理",ignore = false)
@AllArgsConstructor
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.maintenance.entity.TableInfoEntity;
import com.hnac.hzims.bigmodel.maintenance.service.TableInfoService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -26,7 +25,6 @@ import javax.validation.Valid;
@RequestMapping("/tableInfo")
@Api(value = "数据库信息管理",tags = "数据库信息管理")
@AllArgsConstructor
@Business(module = BigModelConstants.APP_NAME,value = "数据库信息管理",ignore = false)
public class TableInfoController {
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
*/
@Data
@EqualsAndHashCode
@EqualsAndHashCode(callSuper=false)
@TableName("HZIMS_DATASOURCE")
@ApiModel(value = "数据源配置",description = "数据源配置")
public class DatasourceEntity extends TenantEntity implements Serializable {
@ApiModelProperty("数据源")
@QueryField(condition = SqlCondition.LIKE)
private String datasource;
@ApiModelProperty("数据源名称")
@QueryField(condition = SqlCondition.LIKE)
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;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory;
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.sessionManager.InteractiveSessionManager;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil;
@ -27,6 +29,7 @@ import org.springframework.web.socket.TextMessage;
*/
@Service
@AllArgsConstructor
@Slf4j
public class QuestionHandlerService {
private final IHznlmInvokeService hznlmInvokeService;
@ -70,12 +73,12 @@ public class QuestionHandlerService {
private void handleVideoChoose(MessageDTO messageDTO) {
InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class);
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());
String videoId = selection.getItemId();
ExtraVO videoExtras = resolveService.resolve(videoId);
AnswerVO answerVO = new AnswerVO();
answerVO.setSessionId(messageDTO.getChatId());
answerVO.setChatId(messageDTO.getChatId());
answerVO.setQuery(selection.getItemName());
answerVO.setRunning(0);
answerVO.setStatus(0);
@ -85,6 +88,7 @@ public class QuestionHandlerService {
wsService.sendMessage(messageDTO.getChatId(),textMessage);
}
catch (Exception e) {
log.error("an error occurred!",e);
AnswerVO answerVO = new AnswerVO();
answerVO.setRunning(0);
answerVO.setStatus(-2);
@ -97,11 +101,11 @@ public class QuestionHandlerService {
private void handleScadaChoose(MessageDTO messageDTO) {
InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class);
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());
ExtraVO scadaExtra = resolveService.resolve(selection.getItemId());
AnswerVO answerVO = new AnswerVO();
answerVO.setSessionId(messageDTO.getChatId());
answerVO.setChatId(messageDTO.getChatId());
answerVO.setRunning(0);
answerVO.setStatus(0);
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 lombok.AllArgsConstructor;
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.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.*;
@ -45,7 +41,6 @@ public class FrontEndInteractiveSchedule {
private final InteractiveWsService wsService;
private final ThreadPoolExecutor getAnswerPoolExecutor;
private final IHznlmInvokeService hznlmInvokeService;
// private final BladeLogger logger;
@XxlJob(GET_INTERACTIVE_RESULT)
public ReturnT<String> getInteractiveResult(String params) {
@ -58,8 +53,8 @@ public class FrontEndInteractiveSchedule {
answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> {
// 如果已经获取到答案 则删除缓存
if(answerVO.getRunning() == 0) {
// logger.info("hzims:bigmodel:getInteractiveResult:answer","获取大模型解析答案:" + JSON.toJSONString(answerVO));
sessionRedisManager.removeSessionId(answerVO.getSessionId());
log.info("获取大模型解析答案:{}" , JSON.toJSONString(answerVO));
sessionRedisManager.removeSessionId(answerVO.getChatId());
}
Object[] extras = answerVO.getExtras();
if(ObjectUtil.isNotEmpty(answerVO.getExtras()) && extras.length > 0){
@ -77,11 +72,11 @@ public class FrontEndInteractiveSchedule {
}
catch(Exception 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));
wsService.sendMessage(answerVO.getSessionId(),message);
wsService.sendMessage(answerVO.getChatId(),message);
}, getAnswerPoolExecutor));
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.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.hnac.hzinfo.exception.HzServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.ResultCode;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
@ -29,8 +30,8 @@ public class RequestClientUtil {
log.info("开始远程调用{}接口",url);
HttpResponse response = HttpRequest.post(url).body(body).execute();
log.info("远程调用{}接口结束",url);
Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> {
throw new ServiceException("远程调用接口" + url + "失败!");
Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new HzServiceException(ResultCode.FAILURE, "远程调用接口" + url + "失败!");
});
}
@ -43,8 +44,8 @@ public class RequestClientUtil {
log.info("开始远程调用{}接口",url);
HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute();
log.info("远程调用{}接口结束",url);
Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> {
throw new ServiceException("远程调用接口" + url + "失败!");
Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
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) {
HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute();
Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> {
throw new ServiceException("远程调用大模型接口" + url + "失败!");
Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new HzServiceException(ResultCode.FAILURE, "远程调用大模型接口" + url + "失败!");
});
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);
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;
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.whitelist.service.WhitelistService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -23,7 +21,6 @@ import java.util.List;
@RestController
@RequestMapping("/whitelist")
@Api(value = "白名单用户",tags = "白名单用户")
@Business(module = BigModelConstants.MODULE_NAME,value = "大模型函数管理")
@AllArgsConstructor
public class WhitelistController {

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

@ -1,22 +1,51 @@
#服务器端口
server:
port: 8135
#数据源配置
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
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
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
#oss配置
oss:
endpoint: ${hzinfo.oss.endpoint}
access-key: ${hzinfo.oss.access-key}
secret-key: ${hzinfo.oss.secret-key}
dynamic:
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
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
username: ${hzinfo.db.busines.username}
password: ${hzinfo.db.busines.password}
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}
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:
host: http://192.168.60.16:9997
@ -35,32 +64,10 @@ xxl:
job:
accessToken: ''
admin:
addresses: http://${hzims.xxljob.ip}:${hzims.xxljob.port}/xxl-job-admin
addresses: http://${hzims.server.ip}:${hzims.xxljob.port}/xxl-job-admin
executor:
appname: hzims-big-model
ip: ${hzims.server.ip}
ip: ${hzims.xxljob.ip}
logpath: /data/applogs/xxl-job/jobhandler
logretentiondays: 7
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
port: 28135

6
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -948,17 +948,17 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
if (!file.exists()) {
throw new RuntimeException("文件名称为:" + fileName + "不存在,上传失败!");
}
R<BladeFile> r = null;
R<BladeFile> r;
try {
r = putFile(file);
if (!r.isSuccess()) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错" + r);
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错" );
}
BladeFile bladeFile = r.getData();
return bladeFile != null ? bladeFile.getLink() : null;
} catch (Exception ex) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString(), ex);
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:", ex);
}
}).filter(StringUtils::isNotBlank).collect(Collectors.toList());
bo.setFiles(urls);

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

@ -1192,7 +1192,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskEntity> impleme
if (CollectionUtil.isEmpty(list)||CollectionUtil.isEmpty(undoneIds)){
voteChartVo.setFinishRate(0.00d);
}else {
BigDecimal divide = new BigDecimal(finishIds.size()).divide(new BigDecimal(list.size()),2, RoundingMode.HALF_UP).setScale(2,RoundingMode.HALF_UP);
BigDecimal divide = new BigDecimal(finishIds.size()).divide(new BigDecimal(list.size()),4, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100)).setScale(2,RoundingMode.HALF_UP);
voteChartVo.setFinishRate(divide.doubleValue());
}
return voteChartVo;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java

@ -148,7 +148,7 @@ public class ImsAnalyseExampleServiceImpl extends ServiceImpl<ImsAnalyseExampleM
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
String fileName = URLEncoder.encode( name, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
if(page.getRecords()!=null){
if(ObjectUtils.isNotEmpty(page.getRecords())){
List<List<String>> head=new ArrayList<>();
List<String> title = new ArrayList<>(Collections.singletonList("时间"));
head.add(title);

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/HazardLibraryController.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.hazard.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.hazard.dto.HazardLibraryDTO;
@ -40,7 +41,9 @@ public class HazardLibraryController extends BladeController {
@ApiOperationSupport(order = 2)
public R<List<HazardLibraryVO>> list(HazardLibraryDTO req) {
HazardLibraryEntity library = BeanUtil.copy(req, HazardLibraryEntity.class);
List<HazardLibraryEntity> list = hazardLibraryService.list(hazardLibraryService.getQueryWrapper(library));
LambdaQueryWrapper<HazardLibraryEntity> queryWrapper = hazardLibraryService.getQueryWrapper(library);
queryWrapper.orderByDesc(HazardLibraryEntity::getCreateTime);
List<HazardLibraryEntity> list = hazardLibraryService.list(queryWrapper);
return R.data(HazardLibraryWrapper.build().listVO(list));
}

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/HazardLibraryWrapper.java

@ -5,6 +5,9 @@ import com.hnac.hzims.safeproduct.hazard.vo.HazardLibraryVO;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
/**
* @author huangxing
*/
public class HazardLibraryWrapper extends BaseEntityWrapper<HazardLibraryEntity, HazardLibraryVO> {
public static HazardLibraryWrapper build() {
@ -13,7 +16,6 @@ public class HazardLibraryWrapper extends BaseEntityWrapper<HazardLibraryEntity,
@Override
public HazardLibraryVO entityVO(HazardLibraryEntity entity) {
HazardLibraryVO hazardLibraryVO = BeanUtil.copy(entity, HazardLibraryVO.class);
return hazardLibraryVO;
return BeanUtil.copy(entity, HazardLibraryVO.class);
}
}

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/EstimateServiceImpl.java

@ -56,6 +56,7 @@ public class EstimateServiceImpl extends ServiceImpl<EstimateMapper, RiskEstimat
}
// 站点年度评估保存
entity.setStatus(1);
this.save(entity);
// 站点类型评估危险源绑定
@ -79,6 +80,7 @@ public class EstimateServiceImpl extends ServiceImpl<EstimateMapper, RiskEstimat
point.setEDownLimit(source.getLDownLimit());
point.setCSUpLimit(source.getCSUpLimit());
point.setCSDownLimit(source.getCSDownLimit());
point.setStatus(1);
return point;
}).collect(Collectors.toList()));
}

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardCategoryServiceImpl.java

@ -81,7 +81,7 @@ public class HazardCategoryServiceImpl extends ServiceImpl<HazardCategoryMapper,
// 保存危险类别记录
this.updateById(entity);
// 保存详情
return sourceService.updateBatchById(entity.getSources().stream().peek(source-> source.setCategoryId(entity.getId())).collect(Collectors.toList()));
return sourceService.saveOrUpdateBatch(entity.getSources().stream().peek(source-> source.setCategoryId(entity.getId())).collect(Collectors.toList()));
}
/**

Loading…
Cancel
Save