From 03d3c6749e4b325f6609fc0e88084c772d4c49a0 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Fri, 12 Jul 2024 15:53:30 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=A4=A7=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/common/support/utils/Condition.java | 7 +- .../hzims/bigmodel/api/feign/IVideoSyncClient.java | 2 +- .../operational/station/feign/IStationClient.java | 4 +- .../station/feign/IStationVideoTypeClient.java | 2 +- hzims-service/hzims-big-model/pom.xml | 58 ++++++++--------- .../hzims/bigmodel/HzimsBigModelApplication.java | 32 ++++----- .../business/service/HistoryDataService.java | 6 +- .../bigmodel/configuration/RedisKeyDeleter.java | 27 ++++++++ .../interactive/factory/AnswerResolveFactory.java | 2 +- .../interactive/factory/ResolveFactory.java | 6 +- .../service/impl/CanvasResolveServiceImpl.java | 13 ++-- .../service/impl/HznlmInvokeServiceImpl.java | 4 +- .../service/impl/VideoResolveServiceImpl.java | 6 +- .../maintenance/entity/DatasourceEntity.java | 4 ++ .../schedule/FrontEndInteractiveSchedule.java | 6 +- .../hzims/bigmodel/utils/RequestClientUtil.java | 8 +-- .../src/main/resources/db/2.0.0.sql | 36 ++++++++++- .../src/main/resources/template/template.yml | 75 ++++++++++++++++++++++ 18 files changed, 214 insertions(+), 84 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/RedisKeyDeleter.java create mode 100644 hzims-service/hzims-big-model/src/main/resources/template/template.yml diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java index df49dad..673551a 100644 --- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java @@ -7,6 +7,7 @@ import com.hnac.hzims.common.support.constants.Order; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.QueryField; import org.springblade.core.mp.support.SqlCondition; +import org.springblade.core.tool.api.ResultCode; import org.springblade.core.tool.utils.Func; import org.springframework.util.Assert; @@ -68,7 +69,7 @@ public class Condition extends org.springblade.core.mp.support.Condition { try { value = field.get(query); } catch (Exception e) { - throw new ServiceException("获取属性性出错"); + throw new ServiceException(ResultCode.FAILURE,"获取属性性出错"); } if(value == null) { continue; @@ -96,13 +97,13 @@ public class Condition extends org.springblade.core.mp.support.Condition { }else if(SqlCondition.NOT_IN.equals(condition)){ String columnName = queryField.columnName(); Assert.isTrue(Func.isBlank(columnName),() -> { - throw new ServiceException("查询不包含条件时需要指定列名"); + throw new ServiceException(ResultCode.FAILURE,"查询不包含条件时需要指定列名"); }); qw.notIn(camel2under(columnName),list); }else if(SqlCondition.IN.equals(condition)){ String columnName = queryField.columnName(); Assert.isTrue(Func.isBlank(columnName), () -> { - throw new ServiceException("查询包含条件时需要指定列名"); + throw new ServiceException(ResultCode.FAILURE,"查询包含条件时需要指定列名"); }); qw.in(camel2under(columnName),list); } diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IVideoSyncClient.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IVideoSyncClient.java index 5af759e..2cd34d4 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IVideoSyncClient.java +++ b/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 { @Override @DeleteMapping(PREFIX_API + DELETE_BY_IDS) - R deleteByIds(@RequestParam String ids); + R deleteByIds(@RequestParam(value = "ids") String ids); } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java index 28019bd..da6326c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java @@ -83,5 +83,7 @@ public interface IStationClient { R> querySatationByCodes(@RequestParam("codes") List codes); @GetMapping(GET_STATIONS_BY_TYPE_AND_DURATION) - R> getStationByTypeAndDuration(@RequestParam(required = false) String startTime,@RequestParam(required = false) String endTime,@RequestParam(required = false) String type); + R> getStationByTypeAndDuration(@RequestParam(value = "startTime",required = false) String startTime, + @RequestParam(value = "endTime",required = false) String endTime, + @RequestParam(value = "type",required = false) String type); } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java index b29e3e2..324a320 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java @@ -28,5 +28,5 @@ public interface IStationVideoTypeClient { R> list(StationVideoTypeEntity req); @GetMapping(GET_BY_ID) - R getById(@RequestParam Long id); + R getById(@RequestParam(value = "id",required = false) Long id); } diff --git a/hzims-service/hzims-big-model/pom.xml b/hzims-service/hzims-big-model/pom.xml index 35ad20c..03090ac 100644 --- a/hzims-service/hzims-big-model/pom.xml +++ b/hzims-service/hzims-big-model/pom.xml @@ -13,12 +13,27 @@ + org.springblade + blade-common + + + org.springblade + blade-system-api + + + com.hnac.hzinfo.data + hzinfo-data-sdk + + com.hnac.hzims big-model-api 4.0.0-SNAPSHOT compile - + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + org.springframework.boot @@ -36,47 +51,26 @@ xxl-job-core - org.springblade - blade-system-api + com.baomidou + dynamic-datasource-spring-boot-starter + 3.5.0 - com.hnac.hzims hzims-operational-api - 4.0.0-SNAPSHOT - - - com.hnac.hzinfo.data - hzinfo-data-sdk - - - com.hnac.hzims - equipment-api - - - com.baomidou - dynamic-datasource-spring-boot-starter - 2.5.6 - ${project.name}-${project.version} + ${project.artifactId} - com.spotify - dockerfile-maven-plugin - - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - false - + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-source-plugin diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java index 3d58539..e6e8393 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java @@ -1,39 +1,31 @@ package com.hnac.hzims.bigmodel; -import lombok.extern.slf4j.Slf4j; import org.mybatis.spring.annotation.MapperScan; import org.springblade.core.cloud.feign.EnableBladeFeign; -import org.springblade.core.jwt.JwtUtil; import org.springblade.core.launch.BladeApplication; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.cloud.client.SpringCloudApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; -import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.scheduling.annotation.EnableScheduling; import javax.annotation.Resource; -import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.HZIMS_BIGMODEL_ASK_KEY; - -@EnableBladeFeign(basePackages = {"org.springblade","com.hnac"}) -@SpringCloudApplication -@MapperScan("com.hnac.hzims.**.mapper.**") -@Resource -@ComponentScan(basePackages = {"com.hnac.hzims.**"}) -@Slf4j -public class HzimsBigModelApplication extends SpringBootServletInitializer { - +@SpringBootApplication(scanBasePackages = {"org.springblade", "com.hnac.*"}) +@MapperScan(basePackages = {"com.hnac.hzinfo.**.mapper","com.hnac.hzims.**.mapper"}) +@EnableFeignClients(basePackages = {"org.springblade", "com.hnac"}) +public class HzimsBigModelApplication { public static void main(String[] args) { BladeApplication.run(BigModelConstants.APP_NAME, HzimsBigModelApplication.class, args); - RedisTemplate redisTemplate = JwtUtil.getRedisTemplate(); - redisTemplate.delete(HZIMS_BIGMODEL_ASK_KEY); - log.info("服务重启删除问题reids缓存:{}",HZIMS_BIGMODEL_ASK_KEY); } - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { - return BladeApplication.createSpringApplicationBuilder(builder, BigModelConstants.APP_NAME, HzimsBigModelApplication.class); - } +// @Override +// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { +// return BladeApplication.createSpringApplicationBuilder(builder, BigModelConstants.APP_NAME, HzimsBigModelApplication.class); +// } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java index edd905c..302dd08 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/business/service/HistoryDataService.java @@ -13,7 +13,7 @@ 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.log.logger.BladeLogger; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.stereotype.Service; @@ -33,7 +33,7 @@ import java.time.temporal.ChronoUnit; public class HistoryDataService { private final DeviceDataClient deviceDataClient; - private final BladeLogger logger; + //private final BladeLogger logger; public static final int DATA_COUNT_MAX = 1000; public Result getPolymerizationData(HistoryDataSearchVO searchVO) { @@ -55,7 +55,7 @@ public class HistoryDataService { dataDTO.setSaveTimeType(dateEnum.getSaveTimeType()); dataDTO.setTimeInterval(1); dataDTO.setDtos(Lists.newArrayList(reductionAttrData)); - logger.info("interactive:getPolymerizationData","config传参为:" + JSON.toJSONString(dataDTO)); + //logger.info("interactive:getPolymerizationData","config传参为:" + JSON.toJSONString(dataDTO)); return deviceDataClient.pageDeviceCodeAndSignages(dataDTO); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/RedisKeyDeleter.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/RedisKeyDeleter.java new file mode 100644 index 0000000..f4dfd36 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/RedisKeyDeleter.java @@ -0,0 +1,27 @@ +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 redisTemplate; + + @Override + public void run(String... args) throws Exception { + // 删除指定的Redis key + redisTemplate.delete(HZIMS_BIGMODEL_ASK_KEY); + log.info("服务重启删除问题reids缓存:{}",HZIMS_BIGMODEL_ASK_KEY); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java index b9daa43..666b41b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java @@ -7,7 +7,7 @@ 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 org.springblade.core.log.exception.ServiceException; -import org.springblade.core.log.logger.BladeLogger; +//import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java index 6f7a632..df3f0c2 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java @@ -3,7 +3,7 @@ package com.hnac.hzims.bigmodel.interactive.factory; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.service.IResolveService; import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.log.logger.BladeLogger; +//import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; @@ -22,7 +22,7 @@ public class ResolveFactory { * @return 解析函数所需service */ public static IResolveService getResolveService(String funcCode) { - BladeLogger logger = SpringUtil.getBean(BladeLogger.class); +// BladeLogger logger = SpringUtil.getBean(BladeLogger.class); FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(funcCode); if(Func.isNotEmpty(funcRouteEnum)) { switch(funcRouteEnum) { @@ -31,7 +31,7 @@ public class ResolveFactory { case OPEN_VIDEO: return SpringUtil.getBean("videoResolveService"); default: - logger.error("hzims:bigModel:getResolveService","函数解析失败,函数编号为:" + funcCode); +// logger.error("hzims:bigModel:getResolveService","函数解析失败,函数编号为:" + funcCode); throw new ServiceException("service解析失败"); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java index 6b7f247..7e1f001 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java @@ -12,8 +12,9 @@ import com.hnac.hzims.operational.station.feign.IStationClient; import groovy.util.logging.Slf4j; import lombok.AllArgsConstructor; import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.log.logger.BladeLogger; +// 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; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.cache.ParamCache; @@ -33,7 +34,7 @@ import java.util.stream.IntStream; public class CanvasResolveServiceImpl implements IResolveService { private final IStationClient stationClient; - private final BladeLogger logger; + // private final BladeLogger logger; @Override public ExtraVO resolve(ModelFunctionReq req) { @@ -41,8 +42,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("解析传参错误,缺少必要参数video_id"); + // logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req)); + throw new ServiceException(ResultCode.FAILURE,"解析传参错误,缺少必要参数video_id"); }); return this.resolve(id); } @@ -82,7 +83,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("解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由"); + throw new ServiceException(ResultCode.FAILURE,"解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由"); } return extraVO; } @@ -91,7 +92,7 @@ public class CanvasResolveServiceImpl implements IResolveService { Map result = new HashMap<>(); List params = Func.toStrList("\\^", paramsStr); Assert.isTrue(params.size() == keys.length, () -> { - throw new ServiceException("大模型传参params长度错误,传参为:" + paramsStr); + throw new ServiceException(ResultCode.FAILURE,"大模型传参params长度错误,传参为:" + paramsStr); }); IntStream.iterate(0, index -> index + 1).limit(params.size()).forEach(index -> result.put(keys[index],params.get(index))); return result; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java index 8d1cee2..03eed48 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java @@ -14,7 +14,7 @@ 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.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 +38,7 @@ import java.util.Map; public class HznlmInvokeServiceImpl implements IHznlmInvokeService { private final BigModelInvokeUrl bigModelInvokeUrl; - private final BladeLogger logger; +// private final BladeLogger logger; private final SessionRedisManager sessionRedisManager; private final IAuthClient authClient; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java index 10fbf2e..e60bbd3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java @@ -12,7 +12,7 @@ import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; import groovy.util.logging.Slf4j; import lombok.AllArgsConstructor; import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.log.logger.BladeLogger; +//import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; @@ -31,7 +31,7 @@ import java.util.Map; public class VideoResolveServiceImpl implements IResolveService { private final IStationVideoTypeClient videoClient; - private final BladeLogger logger; +// private final BladeLogger logger; @Override public ExtraVO resolve(ModelFunctionReq req) { @@ -39,7 +39,7 @@ 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)); +// logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req)); throw new ServiceException("解析传参错误,缺少必要参数video_id"); }); return this.resolve(id); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java index 0ed6f68..514188e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java @@ -22,6 +22,10 @@ import java.io.Serializable; @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; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java index e861d7a..5ffd675 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java @@ -16,7 +16,7 @@ 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.log.logger.BladeLogger; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; @@ -45,7 +45,7 @@ public class FrontEndInteractiveSchedule { private final InteractiveWsService wsService; private final ThreadPoolExecutor getAnswerPoolExecutor; private final IHznlmInvokeService hznlmInvokeService; - private final BladeLogger logger; +// private final BladeLogger logger; @XxlJob(GET_INTERACTIVE_RESULT) public ReturnT getInteractiveResult(String params) { @@ -58,7 +58,7 @@ public class FrontEndInteractiveSchedule { answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> { // 如果已经获取到答案 则删除缓存 if(answerVO.getRunning() == 0) { - logger.info("hzims:bigmodel:getInteractiveResult:answer","获取大模型解析答案:" + JSON.toJSONString(answerVO)); +// logger.info("hzims:bigmodel:getInteractiveResult:answer","获取大模型解析答案:" + JSON.toJSONString(answerVO)); sessionRedisManager.removeSessionId(answerVO.getSessionId()); } Object[] extras = answerVO.getExtras(); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java index f456c65..3e01b66 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java @@ -7,9 +7,9 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; 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,7 +29,7 @@ public class RequestClientUtil { log.info("开始远程调用{}接口",url); HttpResponse response = HttpRequest.post(url).body(body).execute(); log.info("远程调用{}接口结束",url); - Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> { + Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> { throw new ServiceException("远程调用接口" + url + "失败!"); }); } @@ -43,7 +43,7 @@ public class RequestClientUtil { log.info("开始远程调用{}接口",url); HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute(); log.info("远程调用{}接口结束",url); - Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> { + Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> { throw new ServiceException("远程调用接口" + url + "失败!"); }); } @@ -58,7 +58,7 @@ public class RequestClientUtil { */ public static T postCall(String url, Map body, TypeReference typeRef) { HttpResponse response = HttpRequest.post(url).body(JSON.toJSONString(body)).execute(); - Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> { + Assert.isTrue(response.getStatus() == ResultCode.SUCCESS.getCode(), () -> { throw new ServiceException("远程调用大模型接口" + url + "失败!"); }); return JSONObject.parseObject(response.body(), typeRef); diff --git a/hzims-service/hzims-big-model/src/main/resources/db/2.0.0.sql b/hzims-service/hzims-big-model/src/main/resources/db/2.0.0.sql index 8c3c5cc..e73d3ed 100644 --- a/hzims-service/hzims-big-model/src/main/resources/db/2.0.0.sql +++ b/hzims-service/hzims-big-model/src/main/resources/db/2.0.0.sql @@ -28,4 +28,38 @@ CREATE TABLE IF NOT EXISTS `HZIMS_TABLE_PROPERTY` ( `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间', `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='数据库表配置'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='数据库表配置'; + +CREATE TABLE IF NOT EXISTS `hzims_whitelist` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `USER_ID` bigint(20) NOT NULL COMMENT '主键ID', + `ACCOUNT` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '用户登录账号', + `TENANT_ID` varchar(12) CHARACTER SET utf8 DEFAULT NULL COMMENT '租户ID', + `STATUS` bigint(1) DEFAULT NULL COMMENT '状态', + `CREATE_DEPT` bigint(20) DEFAULT NULL COMMENT '创建单位', + `CREATE_USER` bigint(20) DEFAULT NULL COMMENT '创建人', + `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间', + `UPDATE_USER` bigint(20) DEFAULT NULL COMMENT '修改人', + `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `IS_REQUIRE` tinyint(2) DEFAULT NULL COMMENT '是否必须', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='模型函数参数'; + +CREATE TABLE IF NOT EXISTS `HZIMS_DATASOURCE` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `DATASOURCE` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '数据源', + `DATASOURCE_NAME` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '数据源名', + `DATABASE_NAME` varchar(50) NOT NULL COLLATE utf8mb4_bin NOT NULL COMMENT '数据库名', + `TENANT_ID` varchar(12) CHARACTER SET utf8 DEFAULT NULL COMMENT '租户ID', + `STATUS` bigint(1) DEFAULT NULL COMMENT '状态', + `CREATE_DEPT` bigint(20) DEFAULT NULL COMMENT '创建单位', + `CREATE_USER` bigint(20) DEFAULT NULL COMMENT '创建人', + `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间', + `UPDATE_USER` bigint(20) DEFAULT NULL COMMENT '修改人', + `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `IS_REQUIRE` tinyint(2) DEFAULT NULL COMMENT '是否必须', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='模型函数参数'; + diff --git a/hzims-service/hzims-big-model/src/main/resources/template/template.yml b/hzims-service/hzims-big-model/src/main/resources/template/template.yml new file mode 100644 index 0000000..e7188f0 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/resources/template/template.yml @@ -0,0 +1,75 @@ +#服务器端口 +server: + port: 8135 + +#oss配置 +oss: + endpoint: "${hzinfo.oss.endpoint}" + access-key: "${hzinfo.oss.access-key}" + secret-key: "${hzinfo.oss.secret-key}" + +#数据源配置 +spring: + #排除DruidDataSourceAutoConfigure + autoconfigure: + exclude: com.baomidou.dynamic.datasource.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} + redis: + # redis数据库索引(默认为0),我们使用索引为0的数据库,避免和其他数据库冲突 + database: 2 + # redis服务器地址(默认为localhost) + host: 192.168.60.29 + # redis端口(默认为6379) + port: 3577 + # redis访问密码(默认为空) + password: 1qaz2WSX@redis + + +fdp: + host: http://192.168.60.16:9997 + url: + assistantAsk: /qa/assistant_ask + assistantStatus: /qa/assistant_status + askAbort: /qa/ask_abort + updateVideo: /kn/update_video + updateCanvas: /kn/update_canvas + updateFault: /kn/update_fault + assistantSpecialAsk: /qa/assistant_special_ask + assistantKnowledgeAsk: /qa/assistant_knowledge_ask + hotQuestion: /qa/question_recommand +xxl: + job: + accessToken: '' + admin: + addresses: http://192.168.60.104:7009/xxl-job-admin + executor: + appname: hzims-big-model + ip: 172.31.0.174 + logpath: /data/applogs/xxl-job/jobhandler + logretentiondays: 7 + port: 28135 + +blade: + data: + sdk: + enabled: true + url: http://192.168.60.29/api/hzinfo-data-config + ctrlUrl: http://192.168.60.29/api/hzinfo-data-handler + scadaUrl: http://192.168.60.29/api/hzinfo-data-scada + appId: '1635888805125099521' + appSecret: f4b6a4dc696b36445d2e5d38bbab2417 + redisIp: 192.168.60.34 + redisPort: 3577 + password: L_MM&h=+Nm&p)U9sk.uH + maxKeys: 1000 + data-scope: + enabled: false + lock: + enabled: true + address: redis://192.168.60.29:3577 + password: 1qaz2WSX@redis + database: 0 + ssl: false \ No newline at end of file