Merge remote-tracking branch 'origin/master' into feature_20250519_nameplate

# Conflicts:
#	ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/utils/ConstantStr.java
This commit is contained in:
刘亚洲(A)
2025-06-18 17:53:17 +08:00
34 changed files with 1394 additions and 260 deletions

View File

@@ -19,7 +19,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<!--sentinel 依赖-->
<dependency>
<groupId>com.alibaba.cloud</groupId>

View File

@@ -0,0 +1,27 @@
package com.volvo.ai.analytic.center.dto.req;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
*
* @ClassName: AnalysisRequest
* @author: renzhen
* @Description: Ai查询请求参数
* @date: 2025-04-15 13:39
*/
@Data
public class AnalysisQueryReq {
private Object data;
// aiId
@NotNull(message = "aiAnalysisRequestId不能为空")
private String aiAnalysisRequestId;
// 是否重试:默认:否
private String retryAnalyze;
}

View File

@@ -0,0 +1,56 @@
package com.volvo.ai.analytic.center.dto.req;
import com.alibaba.csp.sentinel.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
* @ClassName: AnalysisRequest
* @author: renzhen
* @Description: Ai解析请求参数
* @date: 2025-04-15 13:39
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AnalysisReq {
// 请求的所有参数
@Valid
@NotNull(message = "请求语料不能为空")
private Object data;
// 回调地址
@Valid
@NotBlank(message = "回调地址不能为空")
private String callbackUrl;
// aiId
private String aiAnalysisRequestId;
// 业务类型
@Valid
@NotBlank(message = "业务类型不能为空")
private String aiAnalysisRequestType;
public void validate() {
if (null == data){
throw new IllegalArgumentException("请求语料不能为空");
}
if (StringUtil.isBlank(aiAnalysisRequestType)){
throw new IllegalArgumentException("业务类型不能为空");
}
if (StringUtil.isBlank(callbackUrl)){
throw new IllegalArgumentException("回调地址不能为空");
}
}
}

View File

@@ -12,6 +12,7 @@ public class CommunityTargetDTO {
private String targetType;
private String targetId;
private String communityRequestId;
private String communityType;
private List<ContentNode> content;
@Setter

View File

@@ -0,0 +1,24 @@
package com.volvo.ai.analytic.center.dto.resp;
import lombok.Data;
/**
*
* @ClassName: AnalysisRequest
* @author: renzhen
* @Description: 工作流处理结果
* @date: 2025-04-15 13:39
*/
@Data
public class AnalysisDifyResultDTO{
// 响应
private String workflowRunId;
private String workflowAppId;
private String workUserId;
// 分析中心唯一ID
private String aiAnalysisRequestId;
private String difyResponse;
private String aiAnalysisRequestType;
}

View File

@@ -0,0 +1,57 @@
package com.volvo.ai.analytic.center.dto.resp;
import com.volvo.common.core.constant.CommonConstants;
import com.volvo.common.core.util.ResultMsg;
import lombok.Data;
/**
*
* @ClassName: AnalysisRequest
* @author: renzhen
* @Description: Ai解析响应
* @date: 2025-04-15 13:39
*/
@Data
public class AnalysisResp<T> {
// 响应
private T data;
// 分析中心唯一ID
private String aiAnalysisRequestId;
private int code;
private String msg;
public static <T> AnalysisResp<T> success(String message) {
return (AnalysisResp<T>) analysisResp((Object)null, CommonConstants.SUCCESS, message);
}
public static <T> AnalysisResp<T> success(T data, String aiAnalysisRequestId) {
AnalysisResp<T> analysisResp = new AnalysisResp();
analysisResp.setAiAnalysisRequestId(aiAnalysisRequestId);
analysisResp.setData(data);
analysisResp.setMsg("ok");
analysisResp.setCode(CommonConstants.SUCCESS);
return analysisResp;
}
public static <T> AnalysisResp<T> failed(String message) {
return (AnalysisResp<T>) analysisResp((Object)null, CommonConstants.FAIL, message);
}
private static <T> AnalysisResp<T> analysisResp(T data, int code, String msg) {
AnalysisResp<T> analysisResp = new AnalysisResp();
analysisResp.setCode(code);
analysisResp.setData(data);
analysisResp.setMsg(msg);
return analysisResp;
}
private static <T> AnalysisResp<T> analysisResp(T data, String aiAnalysisRequestId) {
AnalysisResp<T> analysisResp = new AnalysisResp();
analysisResp.setAiAnalysisRequestId(aiAnalysisRequestId);
analysisResp.setData(data);
analysisResp.setMsg("ok");
analysisResp.setCode(CommonConstants.SUCCESS);
return analysisResp;
}
}

View File

@@ -43,6 +43,18 @@ public class AiAnalysisRequestLogs {
@TableField("dify_agent_key")
private String difyAgentKey;
@TableField("workflow_run_id")
private String workflowRunId;
@TableField("workflow_app_id")
private String workflowAppId;
@TableField("work_user_id")
private String workUserId;
@TableField("callback_url")
private String callbackUrl;
@TableField("is_deleted")
@TableLogic
private Integer isDeleted;

View File

@@ -0,0 +1,70 @@
package com.volvo.ai.analytic.center.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("tc_business_type")
public class TcBusinessType {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@TableField("business_request_type")
private String businessRequestType;
@TableField("business_request_desc")
private String businessRequestDesc;
@TableField("business_type_topic")
private String businessTypeTopic; // JSON 字符串
@TableField("business_type_topic_tag")
private String businessTypeTopicTag;
@TableField("workflow_api_key")
private String workflowApiKey; // JSON 字符串
@TableField("workflow_user")
private String workflowUser;
@TableField("is_deleted")
@TableLogic
private Integer isDeleted;
@TableField("versions")
@Version
private Integer versions;
/**
* 创建者
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@TableField("create_time")
private Date createTime;
/**
* 更新者
*/
@TableField("update_by")
private String updateBy;
/**
* 更新时间
*/
@TableField("update_time")
private Date updateTime;
}

View File

@@ -6,6 +6,9 @@ import lombok.Getter;
public enum BusinessTypeEnum {
COMMUNITYTARGET("CommunityTarget", "社区舆情分析"),
FEEDQUALITY("feedQuality", "Feed流好内容"),
PUBLICOPINIONAUTOMATION("publicOpinionAutomation", "舆情自动化"),
SMART_ASSISTANT("SMART_ASSISTANT", "智能助手-DCC"),
SMART_ASSISTANT_QIWEI("SMART_ASSISTANT_QIWEI", "智能助手-企微"),
INTELLIGENT_CUSTOMER("INTELLIGENT_CUSTOMER_4IN1", "智能客服-4合一"),

View File

@@ -3,6 +3,8 @@ package com.volvo.ai.analytic.center.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -16,12 +18,18 @@ public interface DiFyFeign {
, produces = MediaType.APPLICATION_JSON_VALUE)
JSONObject runWorkflows(@RequestHeader(value = "Authorization") String authorization, @RequestBody Map<String, Object> map);
@Retryable(include = Exception.class,maxAttempts = 2, backoff = @Backoff(delay = 1000))
@PostMapping(value = "v1/workflows/run"
, consumes = MediaType.APPLICATION_JSON_VALUE
, produces = MediaType.APPLICATION_JSON_VALUE)
JSONObject runWorkflowsRetry(@RequestHeader(value = "Authorization") String authorization, @RequestBody Map<String, Object> map);
@PostMapping(value = "/v1/files/upload" , consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
JSONObject fileUpload(@RequestHeader(value = "Authorization") String authorization, @RequestPart("file") MultipartFile file);
@PostMapping(value = "/v1/workflows/run/:{workflowRunId}" , consumes = MediaType.APPLICATION_JSON_VALUE
@GetMapping(value = "/v1/workflows/run/{workflowRunId}" , consumes = MediaType.APPLICATION_JSON_VALUE
, produces = MediaType.APPLICATION_JSON_VALUE)
JSONObject queryWorkFlowById(@RequestHeader(value = "Authorization") String authorization, @PathVariable("workflowRunId") String workflowRunId);
}