Commit bdbb4502 by liuyu

2024/07/19 ai标注枚举修改

parent 7f5af0bb
...@@ -34,6 +34,8 @@ public class AIMark implements Serializable { ...@@ -34,6 +34,8 @@ public class AIMark implements Serializable {
private List<String> fields; private List<String> fields;
private String methodType;
/** /**
* 项目名 * 项目名
*/ */
...@@ -99,6 +101,14 @@ public class AIMark implements Serializable { ...@@ -99,6 +101,14 @@ public class AIMark implements Serializable {
this.projectId = projectId; this.projectId = projectId;
} }
public String getMethodType() {
return methodType;
}
public void setMethodType(String methodType) {
this.methodType = methodType;
}
public List<Integer> getMonitorLevelIds() { public List<Integer> getMonitorLevelIds() {
return monitorLevelIds; return monitorLevelIds;
} }
......
...@@ -6,24 +6,19 @@ package com.zhiwei.middleware.automatic.server.pojo.enums; ...@@ -6,24 +6,19 @@ package com.zhiwei.middleware.automatic.server.pojo.enums;
**/ **/
public enum AiInterfaceEnums { public enum AiInterfaceEnums {
FEI_HE("飞鹤", "62baa19f4d9a553ac3e7cd9b"), PRODUCT("PRODUCT"),
COMMON("常用", "常用"); COMMON("COMMON");
final String project; final String type;
final String projectId;
AiInterfaceEnums(String project, String projectId) { AiInterfaceEnums(String type) {
this.project = project; this.type = type;
this.projectId = projectId;
} }
public String getProject() { public String getType() {
return project; return type;
} }
public String getProjectId() {
return projectId;
}
} }
...@@ -18,7 +18,7 @@ public class AiTaskServiceHandler { ...@@ -18,7 +18,7 @@ public class AiTaskServiceHandler {
private static final Map<String, AiTaskService> SERVICE_MAP = new HashMap<>(); private static final Map<String, AiTaskService> SERVICE_MAP = new HashMap<>();
private AiTaskServiceHandler() { private AiTaskServiceHandler() {
Map<String, AiTaskService> beansOfType = ApplicationContextHolder.getInstance().getBeansOfType(AiTaskService.class); Map<String, AiTaskService> beansOfType = ApplicationContextHolder.getInstance().getBeansOfType(AiTaskService.class);
beansOfType.forEach((k, v) -> SERVICE_MAP.put(v.getType().getProjectId(), v)); beansOfType.forEach((k, v) -> SERVICE_MAP.put(v.getType().getType(), v));
} }
public static AiTaskServiceHandler getInstance() { public static AiTaskServiceHandler getInstance() {
...@@ -26,9 +26,9 @@ public class AiTaskServiceHandler { ...@@ -26,9 +26,9 @@ public class AiTaskServiceHandler {
} }
public MarkInfo sendAIRequest(AiInterfaceParam aiParam, String timeKey) { public MarkInfo sendAIRequest(AiInterfaceParam aiParam, String timeKey) {
AiTaskService aiTaskService = SERVICE_MAP.get(aiParam.getAiMark().getProjectId()); AiTaskService aiTaskService = SERVICE_MAP.get(aiParam.getAiMark().getMethodType());
if (Objects.isNull(aiTaskService)) { if (Objects.isNull(aiTaskService)) {
aiTaskService = SERVICE_MAP.get(AiInterfaceEnums.COMMON.getProjectId()); aiTaskService = SERVICE_MAP.get(AiInterfaceEnums.COMMON.getType());
} }
return aiTaskService.executor(aiParam, timeKey); return aiTaskService.executor(aiParam, timeKey);
} }
......
...@@ -12,9 +12,9 @@ import org.springframework.stereotype.Service; ...@@ -12,9 +12,9 @@ import org.springframework.stereotype.Service;
* date: 2024/7/9 14:16 * date: 2024/7/9 14:16
**/ **/
@Service @Service
public class AiTaskServiceFeiHe extends AbstractAiTaskService { public class AiTaskServiceProduct extends AbstractAiTaskService {
public AiTaskServiceFeiHe(RedissonUtil redissonUtil, AiApiResultDao aiApiResultDao) { public AiTaskServiceProduct(RedissonUtil redissonUtil, AiApiResultDao aiApiResultDao) {
super(AiInterfaceEnums.FEI_HE, redissonUtil, aiApiResultDao); super(AiInterfaceEnums.PRODUCT, redissonUtil, aiApiResultDao);
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment