发布流程结束后,同步GPT文件加载附件链接

This commit is contained in:
yujh_java 2025-06-18 15:50:53 +08:00
parent 2e1e35d2d8
commit c9bbdcff22
3 changed files with 31 additions and 5 deletions

View File

@ -90,7 +90,7 @@ public class SendGPTAlsp implements ASLP {
String finalFilePath = filepath.replace("bin\\..\\", "");
JSONObject result = null;
result = JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl, appkey, requestCode, dcContext.getFilePath()));
result = JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl, appkey, requestCode, dcContext.getFilePath(),dcContext.getFileName(),fileId));
if (result.getString("msg").equals("success")) {
String data = result.getString("data");
//插入模型ID与DOCID对应表中
@ -153,7 +153,7 @@ public class SendGPTAlsp implements ASLP {
String filepath = dcContext.getFilePath();
String finalFilePath = filepath.replace("bin\\..\\", "");
JSONObject result = JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl, appkey, requestCode, dcContext.getFilePath()));
JSONObject result = JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl, appkey, requestCode, dcContext.getFilePath(),dcContext.getFileName(),changefileIdNew));
if (result.getString("msg").equals("success")) {
String data = result.getString("data");

View File

@ -581,7 +581,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
String finalFilePath = filepath.replace("bin\\..\\", "");
JSONObject result=JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl,appkey,requestCode,dcContext.getFilePath()));
JSONObject result=JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl,appkey,requestCode,dcContext.getFilePath(),dcContext.getFileName(),fileId));
if(result.getString("msg").equals("success")){
String data=result.getString("data");
@ -708,7 +708,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
String filepath = dcContext.getFilePath();
String finalFilePath = filepath.replace("bin\\..\\", "");
JSONObject result=JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl,appkey,requestCode,dcContext.getFilePath()));
JSONObject result=JSONObject.parseObject(UploadGptFileUtils.uploadGptFile(uploadGptUrl,appkey,requestCode,dcContext.getFilePath(),dcContext.getFileName(),changefileIdNew));
if(result.getString("msg").equals("success")){
String data=result.getString("data");

View File

@ -1,5 +1,6 @@
package com.actionsoft.apps.coe.pal.publisher.utils;
import com.actionsoft.bpms.server.conf.portal.AWSPortalConf;
import com.actionsoft.sdk.local.SDK;
import java.io.*;
@ -13,7 +14,7 @@ public class UploadGptFileUtils {
public static String uploadGptFile(String targetUrl,String appkey,String requestCode,String filePath) throws Exception {
public static String uploadGptFile(String targetUrl,String appkey,String requestCode,String filePath,String fileLinkName,String fileId) throws Exception {
String result = null;
HttpURLConnection connection=null;
OutputStream output=null;
@ -57,6 +58,20 @@ public class UploadGptFileUtils {
writer.append("\r\n");
writer.append(requestCode).append("\r\n");
// Send requestCode part
writer.append("--").append(boundary).append("\r\n");
writer.append("Content-Disposition: form-data; name=\"extensionName\"\r\n");
writer.append("Content-Type: text/plain; charset=UTF-8\r\n");
writer.append("\r\n");
writer.append(fileLinkName).append("\r\n");
// Send requestCode part
writer.append("--").append(boundary).append("\r\n");
writer.append("Content-Disposition: form-data; name=\"extensionValue\"\r\n");
writer.append("Content-Type: text/plain; charset=UTF-8\r\n");
writer.append("\r\n");
writer.append(getFileLinkUrl(fileId)).append("\r\n");
// End of multipart/form-data
writer.append("--").append(boundary).append("--\r\n");
writer.flush();
@ -81,4 +96,15 @@ public class UploadGptFileUtils {
return result;
}
/**
* 获取文件链接地址
* @param fileId
* @return
*/
public static String getFileLinkUrl(String fileId){
String fileLinkUrl = AWSPortalConf.getUrl() + "/r/w?cmd=com.awspaas.user.apps.gpt_interface.openRepositoryHome&repositoryId=";
fileLinkUrl+=fileId;
return fileLinkUrl;
}
}