Browse Source

fix:大模型代码合并

zhongwei
haungxing 4 months ago
parent
commit
03d3c6749e
  1. 7
      hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java
  2. 2
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/feign/IVideoSyncClient.java
  3. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationClient.java
  4. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java
  5. 58
      hzims-service/hzims-big-model/pom.xml
  6. 32
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java
  7. 6
      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/factory/AnswerResolveFactory.java
  10. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/ResolveFactory.java
  11. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/CanvasResolveServiceImpl.java
  12. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java
  13. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/VideoResolveServiceImpl.java
  14. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/DatasourceEntity.java
  15. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java
  16. 8
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/utils/RequestClientUtil.java
  17. 36
      hzims-service/hzims-big-model/src/main/resources/db/2.0.0.sql
  18. 75
      hzims-service/hzims-big-model/src/main/resources/template/template.yml

7
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);
}

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 String ids);
R deleteByIds(@RequestParam(value = "ids") String ids);
}

4
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<List<StationEntity>> querySatationByCodes(@RequestParam("codes") List<String> codes);
@GetMapping(GET_STATIONS_BY_TYPE_AND_DURATION)
R<List<StationEntity>> getStationByTypeAndDuration(@RequestParam(required = false) String startTime,@RequestParam(required = false) String endTime,@RequestParam(required = false) String type);
R<List<StationEntity>> getStationByTypeAndDuration(@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(value = "type",required = false) String type);
}

2
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>> list(StationVideoTypeEntity req);
@GetMapping(GET_BY_ID)
R<StationVideoTypeEntity> getById(@RequestParam Long id);
R<StationVideoTypeEntity> getById(@RequestParam(value = "id",required = false) Long id);
}

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

@ -13,12 +13,27 @@
<dependencies>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>big-model-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
</dependency>
<!-- spring-boot-websocket start -->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -36,47 +51,26 @@
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-operational-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>equipment-api</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>2.5.6</version>
</dependency>
</dependencies>
<build>
<finalName>${project.name}-${project.version}</finalName>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<username>${docker.username}</username>
<password>${docker.password}</password>
<repository>${docker.registry.url}/${docker.namespace}/${project.artifactId}</repository>
<tag>${project.version}</tag>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<skip>false</skip>
</configuration>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>

32
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<String, Object> 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);
// }
}

6
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<ReductionDataVO> 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);
}

27
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<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/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;

6
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解析失败");
}
}

13
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<String,String> result = new HashMap<>();
List<String> 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;

4
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;

6
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);

4
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;

6
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<String> 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();

8
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> T postCall(String url, Map body, TypeReference<T> 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);

36
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='数据库表配置';
) 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='模型函数参数';

75
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
Loading…
Cancel
Save