diff --git a/doc/DesignDocument/模型服务表--hky.md b/doc/DesignDocument/模型服务表--hky.md
new file mode 100644
index 0000000..f4e8c64
--- /dev/null
+++ b/doc/DesignDocument/模型服务表--hky.md
@@ -0,0 +1,16 @@
+# 数据库设计文档
+
+## 服务发布
+
+### 服务发布
+
+#### 1.服务发布表(service_publish)
+
+| 序号 | 数据表名 | 中文名称 |
+| ---- | -------- | ------------------ |
+| 1 | id | 发布表id(发布记录唯一标识) |
+| 2 | model_id | 模型id |
+| 3 | api_url | api路径 |
+| 4 | create_time | 发布请求创建时间 |
+
+####
diff --git a/pom.xml b/pom.xml
index ba0fbb6..8255ccc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,10 @@
spring-boot-starter-web
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
org.postgresql
postgresql
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/config/RedisConfiguration.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/config/RedisConfiguration.java
new file mode 100644
index 0000000..8e3a30a
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/config/RedisConfiguration.java
@@ -0,0 +1,26 @@
+package com.bipt.intelligentapplicationorchestrationservice.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+
+@Configuration
+@Slf4j
+public class RedisConfiguration {
+ @Bean
+ public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){
+ log.info("开始创建redis模板对象...");
+ RedisTemplate redisTemplate = new RedisTemplate();
+ //设置redis的连接工厂对象
+ redisTemplate.setConnectionFactory(redisConnectionFactory);
+ //设置redis key的序列化器
+ redisTemplate.setKeySerializer(new StringRedisSerializer());
+
+ return redisTemplate;
+
+ }
+}
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/controller/publishController.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/controller/publishController.java
new file mode 100644
index 0000000..586f991
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/controller/publishController.java
@@ -0,0 +1,41 @@
+package com.bipt.intelligentapplicationorchestrationservice.controller;
+
+import com.bipt.intelligentapplicationorchestrationservice.pojo.OptResult;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
+import com.bipt.intelligentapplicationorchestrationservice.service.PublishService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Tag(name ="服务发布相关接口")
+@RestController
+@RequestMapping("/publish")
+@Slf4j
+public class publishController {
+ @Autowired
+ private PublishService publishService;
+
+ /**
+ * 新增请求发布
+ * @param servicePublishDTO
+ * @return
+ */
+ @PostMapping
+ @Operation(summary ="新增发布请求")
+ public OptResult save(@RequestBody ServicePublishDTO servicePublishDTO){
+ log.info("模型发布请求:{}", servicePublishDTO);
+ publishService.save(servicePublishDTO);
+ ServicePublishVO servicePublishVO = publishService.getByModelId(servicePublishDTO);
+ return OptResult.success(servicePublishVO);
+ }
+
+
+
+
+}
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/mapper/PublishMapper.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/mapper/PublishMapper.java
new file mode 100644
index 0000000..177c38e
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/mapper/PublishMapper.java
@@ -0,0 +1,21 @@
+package com.bipt.intelligentapplicationorchestrationservice.mapper;
+
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelVersion;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface PublishMapper {
+
+
+
+ void insert(ServicePublishDTO servicePublishDTO);
+
+ Long getByApiUrl(String apiUrl);
+ @Select("select * from model_version where model_id=#{modelId} and status = 1")
+ ModelVersion getById(Long modelId);
+
+ ServicePublishVO getByModelId(Long modelId);
+}
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublish.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublish.java
new file mode 100644
index 0000000..d17b386
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublish.java
@@ -0,0 +1,23 @@
+package com.bipt.intelligentapplicationorchestrationservice.pojo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author hky
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ServicePublish implements Serializable {
+ private Long id;
+ private Long modelId;
+ private String apiUrl;
+ private LocalDateTime createTime;
+}
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublishDTO.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublishDTO.java
new file mode 100644
index 0000000..039a6a5
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublishDTO.java
@@ -0,0 +1,22 @@
+package com.bipt.intelligentapplicationorchestrationservice.pojo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+/**
+ * @author hky
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ServicePublishDTO implements Serializable {
+ private Long id;
+ private Long modelId;
+ private String apiUrl;
+ private LocalDateTime createTime;
+}
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublishVO.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublishVO.java
new file mode 100644
index 0000000..ec12f7f
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/pojo/ServicePublishVO.java
@@ -0,0 +1,29 @@
+package com.bipt.intelligentapplicationorchestrationservice.pojo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author hky
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ServicePublishVO implements Serializable {
+ private Long modelId;
+ private String apiUrl;
+ private String version;
+ private Integer datasetId;
+ private String modelConfig;
+ private String modelPath;
+ private Integer status;
+ private LocalDateTime createTime;
+
+
+}
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/service/Impl/PublishServiceImpl.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/service/Impl/PublishServiceImpl.java
new file mode 100644
index 0000000..5e34fc9
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/service/Impl/PublishServiceImpl.java
@@ -0,0 +1,50 @@
+package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
+
+import com.bipt.intelligentapplicationorchestrationservice.mapper.PublishMapper;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ModelVersion;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
+import com.bipt.intelligentapplicationorchestrationservice.service.PublishService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author hky
+ */
+@Service
+@Slf4j
+public class PublishServiceImpl implements PublishService {
+
+ @Autowired
+ private PublishMapper publishMapper;
+ /**
+ * 新增服务请求
+ * @param servicePublishDTO
+ */
+ @Override
+ @Transactional
+ public void save(ServicePublishDTO servicePublishDTO) {
+ String apiUrl = servicePublishDTO.getApiUrl();
+ Long id = publishMapper.getByApiUrl(apiUrl);
+ if (id != null){
+ throw new IllegalArgumentException("请求已存在: " + apiUrl);
+ }
+ Long modelId = servicePublishDTO.getModelId();
+ ModelVersion modelVersion = publishMapper.getById(modelId);
+ String modelConfig = modelVersion.getModelConfig();
+ //todo 调用GPU分配
+
+
+ publishMapper.insert(servicePublishDTO);
+ }
+
+ @Override
+ public ServicePublishVO getByModelId(ServicePublishDTO servicePublishDTO) {
+ Long modelId = servicePublishDTO.getModelId();
+ return publishMapper.getByModelId(modelId);
+ }
+
+
+}
diff --git a/src/main/java/com/bipt/intelligentapplicationorchestrationservice/service/PublishService.java b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/service/PublishService.java
new file mode 100644
index 0000000..b4a22ca
--- /dev/null
+++ b/src/main/java/com/bipt/intelligentapplicationorchestrationservice/service/PublishService.java
@@ -0,0 +1,10 @@
+package com.bipt.intelligentapplicationorchestrationservice.service;
+
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishDTO;
+import com.bipt.intelligentapplicationorchestrationservice.pojo.ServicePublishVO;
+
+public interface PublishService {
+ void save(ServicePublishDTO servicePublishDTO);
+
+ ServicePublishVO getByModelId(ServicePublishDTO servicePublishDTO);
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index fdc5805..30ffe18 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -15,4 +15,15 @@ mybatis.mapper-locations=classpath:mapper/*.xml
# 配置实体类别名所在包
mybatis.type-aliases-package=com.bipt.intelligentapplicationorchestrationservice.pojo
# 开启驼峰命名转换
-mybatis.configuration.map-underscore-to-camel-case=true
\ No newline at end of file
+mybatis.configuration.map-underscore-to-camel-case=true
+
+# Redis服务器地址
+spring.data.redis.host=localhost
+# Redis服务器端口
+spring.data.redis.port=6379
+# Redis密码(如果有)
+spring.data.redis.password=123456
+# Redis数据库索引(默认为0)
+spring.data.redis.database=2
+# 连接超时时间(毫秒)
+spring.data.redis.timeout=3000
diff --git a/src/main/resources/mapper/PublishMapper.xml b/src/main/resources/mapper/PublishMapper.xml
new file mode 100644
index 0000000..d69505c
--- /dev/null
+++ b/src/main/resources/mapper/PublishMapper.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ INSERT INTO service_publish
+ (id,model_id,api_url,create_time)
+ values (#{id}, #{modelId}, #{apiUrl}, #{createTime})
+
+
+
+
+
\ No newline at end of file