Merge remote-tracking branch 'origin/dev_20250409_difyResult' into feature-20250616-release

This commit is contained in:
zren25
2025-06-16 11:08:04 +08:00
26 changed files with 1161 additions and 106 deletions

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

@@ -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

@@ -29,7 +29,7 @@ public interface DiFyFeign {
@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);
}