diff --git a/hzims-service-api/target/classes/META-INF/build-info.properties b/hzims-service-api/target/classes/META-INF/build-info.properties
new file mode 100644
index 0000000..907791f
--- /dev/null
+++ b/hzims-service-api/target/classes/META-INF/build-info.properties
@@ -0,0 +1,5 @@
+build.artifact=hzims-service-api
+build.group=com.hnac.hzims
+build.name=hzims-service-api
+build.time=2024-08-12T06\:09\:01.772Z
+build.version=4.0.0-SNAPSHOT
diff --git a/hzims-service/hzims-big-model/pom.xml b/hzims-service/hzims-big-model/pom.xml
index 77bd234..d3624b5 100644
--- a/hzims-service/hzims-big-model/pom.xml
+++ b/hzims-service/hzims-big-model/pom.xml
@@ -78,6 +78,11 @@
dynamic-datasource-spring-boot-starter
3.5.0
+
+ cn.bigmodel.openapi
+ oapi-java-sdk
+ release-V4-2.0.2
+
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfig.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfig.java
new file mode 100644
index 0000000..71bf8a7
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfig.java
@@ -0,0 +1,26 @@
+package com.hnac.hzims.bigmodel.zhipuai.config;
+
+import com.zhipu.oapi.ClientV4;
+import lombok.AllArgsConstructor;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.Resource;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/9 17:01
+ */
+@Configuration
+@EnableConfigurationProperties(ZhipuAiConfigProperties.class)
+@AllArgsConstructor
+public class ZhipuAiConfig {
+
+ private ZhipuAiConfigProperties properties;
+
+ @Bean("clientV4")
+ public ClientV4 clientV4() {
+ return new ClientV4.Builder(properties.getApiSecret()).build();
+ }
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfigProperties.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfigProperties.java
new file mode 100644
index 0000000..827fae6
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfigProperties.java
@@ -0,0 +1,20 @@
+package com.hnac.hzims.bigmodel.zhipuai.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/8 14:03
+ */
+@Data
+@ConfigurationProperties(prefix = "zhipuai")
+public class ZhipuAiConfigProperties {
+
+ private String apiSecret;
+
+ private String url;
+
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisModel.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisModel.java
new file mode 100644
index 0000000..bfd686d
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisModel.java
@@ -0,0 +1,27 @@
+package com.hnac.hzims.bigmodel.zhipuai.constants;
+
+import lombok.Getter;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/9 9:50
+ */
+@Getter
+public enum AnalysisModel implements BaseEnum {
+
+ GLM_4("glm-4", "GLM-4模型"),
+ GLM_4V("glm-4v", "GLM-4V模型"),
+ COG_VIDEO_X("cogvideox", "CogVideoX模型"),
+ COG_VIEW("cogvideox", "CogVideoX模型"),
+ GLM_4_ALL_TOOLS("glm-4-alltool", "GLM-4-AllTools模型");
+
+ private final String code;
+
+ private final String msg;
+
+ AnalysisModel(String code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisResultType.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisResultType.java
new file mode 100644
index 0000000..29e0c8e
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisResultType.java
@@ -0,0 +1,32 @@
+package com.hnac.hzims.bigmodel.zhipuai.constants;
+
+import lombok.Getter;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/8 15:27
+ */
+@Getter
+public enum AnalysisResultType implements BaseEnum {
+ BOOLEAN("BOOLEAN", "是非判断", "是", Boolean.class),
+ NUMBER("NUMBER", "确定数量", null, Integer.class),
+ DECIMAL("DECIMAL", "获取数值", null, BigDecimal.class);
+
+ private final String code;
+
+ private final String msg;
+
+ private final String condition;
+
+ private final Class clazz;
+
+ AnalysisResultType(String code, String msg, String condition, Class clazz) {
+ this.code = code;
+ this.msg = msg;
+ this.condition = condition;
+ this.clazz = clazz;
+ }
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/BaseEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/BaseEnum.java
new file mode 100644
index 0000000..6c40f4c
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/BaseEnum.java
@@ -0,0 +1,21 @@
+package com.hnac.hzims.bigmodel.zhipuai.constants;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/8 15:42
+ */
+public interface BaseEnum {
+ U getCode();
+
+ String getMsg();
+
+ static T getInstance(U code, Class clazz) {
+ T[] baseEnums = clazz.getEnumConstants();
+ for (T baseEnum : baseEnums) {
+ if (baseEnum.getCode().equals(code)) {
+ return baseEnum;
+ }
+ }
+ return null;
+ }
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuController.java
new file mode 100644
index 0000000..13db651
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuController.java
@@ -0,0 +1,36 @@
+package com.hnac.hzims.bigmodel.zhipuai.controller;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.hnac.hzims.bigmodel.zhipuai.service.ZhipuAnalysisService;
+import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisRequest;
+import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisResponse;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+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;
+
+import javax.validation.Valid;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/8 16:36
+ */
+@RestController
+@RequestMapping("zhipu")
+@Api(value = "智谱", tags = "智谱")
+@AllArgsConstructor
+public class ZhipuController {
+
+ private final ZhipuAnalysisService analysisService;
+
+ @PostMapping("/analysis")
+ @ApiOperation("分析")
+ @ApiOperationSupport(order = 1)
+ public R analysis(@RequestBody @Valid ZhipuAnalysisRequest request) {
+ return R.data(analysisService.analysis(request));
+ }
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java
new file mode 100644
index 0000000..ffac88d
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java
@@ -0,0 +1,25 @@
+package com.hnac.hzims.bigmodel.zhipuai.entity;
+
+import lombok.Data;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/8 15:17
+ */
+@Data
+public class ZhipuAnalysisInfoEntity extends BaseEntity {
+
+ private String resultType;
+
+ private String name;
+
+ private String code;
+
+ private String model;
+
+ private String requestContent;
+
+ private String resultStrategy;
+
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/AbstractZhipuAnalysisHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/AbstractZhipuAnalysisHandler.java
new file mode 100644
index 0000000..9a86c28
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/AbstractZhipuAnalysisHandler.java
@@ -0,0 +1,23 @@
+package com.hnac.hzims.bigmodel.zhipuai.handler;
+
+import com.zhipu.oapi.ClientV4;
+
+import javax.annotation.Resource;
+import java.util.Base64;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/12 8:44
+ */
+public abstract class AbstractZhipuAnalysisHandler implements ZhipuAnalyser {
+ protected final String requestIdTemplate = "hzims-%d";
+ protected final String resultKey = "结果";
+
+ @Resource
+ protected ClientV4 client;
+
+ @Override
+ public String getBase64(String url) {
+ return Base64.getEncoder().encodeToString(getFileBytes(url));
+ }
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalyser.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalyser.java
new file mode 100644
index 0000000..4bb7d5f
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalyser.java
@@ -0,0 +1,28 @@
+package com.hnac.hzims.bigmodel.zhipuai.handler;
+
+import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/8 14:45
+ */
+public interface ZhipuAnalyser {
+
+ String getBase64(String url);
+
+ byte[] getFileBytes(String url);
+
+ String getAnalysisStrategy();
+
+ String getAnalysisModel();
+
+ default boolean isSupport(String modelName) {
+ return getAnalysisStrategy().equals(modelName);
+ }
+
+ Resp sendRequest(ZhipuAnalysisInfoEntity info, String url);
+
+ Req getRequest(ZhipuAnalysisInfoEntity info, String url);
+
+ String getResult(ZhipuAnalysisInfoEntity info, String url);
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisFactory.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisFactory.java
new file mode 100644
index 0000000..34f390e
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisFactory.java
@@ -0,0 +1,37 @@
+package com.hnac.hzims.bigmodel.zhipuai.handler;
+
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/9 10:47
+ */
+@Component
+@AllArgsConstructor
+@Slf4j
+public class ZhipuAnalysisFactory {
+ private final List analysisStrategyList;
+
+ private static final Map analysisStrategyMap = new ConcurrentHashMap<>();
+
+ public ZhipuAnalyser getAnalysisStrategy(final String modelName) {
+ ZhipuAnalyser result = ZhipuAnalysisFactory.analysisStrategyMap.get(modelName);
+ if (Objects.nonNull(result)) {
+ return result;
+ }
+ Optional strategyOptional = analysisStrategyList.stream().filter(strategy -> strategy.isSupport(modelName)).findFirst();
+ if (strategyOptional.isPresent()) {
+ result = strategyOptional.get();
+ ZhipuAnalysisFactory.analysisStrategyMap.put(modelName, result);
+ }
+ return result;
+ }
+}
diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java
new file mode 100644
index 0000000..609eaf8
--- /dev/null
+++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java
@@ -0,0 +1,95 @@
+package com.hnac.hzims.bigmodel.zhipuai.handler;
+
+import com.hnac.hzims.bigmodel.zhipuai.constants.AnalysisModel;
+import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
+import com.zhipu.oapi.ClientV4;
+import com.zhipu.oapi.Constants;
+import com.zhipu.oapi.service.v4.model.ChatCompletionRequest;
+import com.zhipu.oapi.service.v4.model.ChatMessage;
+import com.zhipu.oapi.service.v4.model.ChatMessageRole;
+import com.zhipu.oapi.service.v4.model.ModelApiResponse;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.jackson.JsonUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: ypj
+ * @Date: 2024/8/12 9:20
+ */
+@Service
+@AllArgsConstructor
+@Slf4j
+public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
+
+ @Override
+ public String getAnalysisStrategy() {
+ return AnalysisModel.GLM_4V.getCode();
+ }
+
+ @Override
+ public String getAnalysisModel() {
+ return AnalysisModel.GLM_4V.getCode();
+ }
+
+
+ @Override
+ public byte[] getFileBytes(String url) {
+ return new byte[0];
+ }
+
+ @Override
+ public ModelApiResponse sendRequest(ZhipuAnalysisInfoEntity info, String url) {
+ ChatCompletionRequest request = getRequest(info, url);
+ log.info("send zhipu ai request :{}", request);
+ return client.invokeModelApi(request);
+ }
+
+ @Override
+ public ChatCompletionRequest getRequest(ZhipuAnalysisInfoEntity info, String url) {
+ List messages = new ArrayList<>();
+ List