diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination index bf5724d..b020ef3 100644 --- a/ABAP_AS_WITH_POOL.jcoDestination +++ b/ABAP_AS_WITH_POOL.jcoDestination @@ -1,5 +1,5 @@ #for tests only ! -#Fri Jun 07 08:18:57 CST 2024 +#Fri Jun 07 13:50:17 CST 2024 jco.destination.pool_capacity=10 jco.client.lang=ZH jco.client.ashost=172.19.0.120 @@ -7,5 +7,5 @@ jco.client.saprouter= jco.client.user=RFC jco.client.sysnr=00 jco.destination.peak_limit=10 -jco.client.passwd=wcV2,:%3ns!n1TrQ,`o|.r`%fsDCCa5oz~~`VEonO~?t$xIU +jco.client.passwd=gkH^Opi?[Xww_Q-nC1k#E=#-#?!=b9Pbs9/oH+!;`0oQqb=7 jco.client.client=300 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java index bc515e7..582f5d7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java @@ -1,9 +1,11 @@ package com.ruoyi.web.controller.quot; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletResponse; +import com.alibaba.fastjson.JSON; import com.ruoyi.common.constant.WebsocketConst; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.redis.RedisCache; @@ -11,10 +13,14 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.MinioUtil; +import com.ruoyi.common.utils.sign.Base64; import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.priceVerification.domain.QuotHj; import com.ruoyi.priceVerification.service.IQuotHjService; import com.ruoyi.quot.domain.*; +import com.ruoyi.quot.domain.jsw.QuotJswFile; +import com.ruoyi.quot.domain.jsw.QuotJswFiles; +import com.ruoyi.quot.domain.jsw.QuotJswResult; import com.ruoyi.quot.service.IQuotFileService; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysNoticeService; @@ -448,7 +454,40 @@ public class QuotController extends BaseController @PostMapping("/commitJswQuot") public AjaxResult commitJswQuot(@RequestBody Quot quot) { - // TODO 对接金思维接口 + // 对接金思维接口 + //附件对接 + List files = new ArrayList<>(); + + QuotFile quotFile = new QuotFile(); + quotFile.setRelationId(quot.getQuotId());// 报价单ID + quotFile.setFileType("quotXjFile");// 附件类型-询价清单附件 + List quotXjFiles = quotFileService.selectQuotFileList(quotFile); + if(quotXjFiles!=null&"XjFiles.size()>0){ + files.addAll(quotXjFiles); + } + + quotFile = new QuotFile(); + quotFile.setRelationId(quot.getQuotId());// 报价单ID + quotFile.setFileType("quotJsgfFile");// 附件类型-技术附件 + List quotJsgfFiles = quotFileService.selectQuotFileList(quotFile); + if(quotJsgfFiles!=null&"JsgfFiles.size()>0){ + files.addAll(quotJsgfFiles); + } + + QuotJswFiles quotJswFiles = null; + QuotJswFile quotJswFile = new QuotJswFile(); + quotJswFile.setBJDID(quot.getQuotCode()); + for(QuotFile qf:files){ + quotJswFiles = new QuotJswFiles(); + quotJswFiles.setFileName(qf.getFileName()); + quotJswFiles.setFileData(Base64.fileBase64(qf.getFileUrl())); + quotJswFile.getFJData().add(quotJswFiles); + } + String json = JSON.toJSONString(quotJswFile); + //调用金思维接口上传附件 + + + quot.setQuotJswApprovalStatus("1");// 更新金思维提交状态为 协助中 quotService.updateQuot(quot); return success(); diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 7cd3268..2800795 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -79,7 +79,7 @@ org.apache.commons commons-lang3 - + com.fasterxml.jackson.core @@ -152,7 +152,12 @@ javax.servlet javax.servlet-api + + org.apache.httpcomponents + httpclient + 4.5.14 + - \ No newline at end of file + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java index f85c82c..25c2b42 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java @@ -24,7 +24,7 @@ import com.ruoyi.common.utils.StringUtils; /** * 通用http发送方法 - * + * * @author ruoyi */ public class HttpUtils @@ -189,6 +189,80 @@ public class HttpUtils return result.toString(); } + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 json字符串 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPostJson(String url, String param) + { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try + { + String urlNameString = url; + log.info("sendPost - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "application/json"); + conn.setRequestProperty("Content-Type", "application/json"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (out != null) + { + out.close(); + } + if (in != null) + { + in.close(); + } + } + catch (IOException ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + public static String sendSSLPost(String url, String param) { StringBuilder result = new StringBuilder(); @@ -271,4 +345,4 @@ public class HttpUtils return true; } } -} \ No newline at end of file +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java index ca1cd92..9eddf2a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java @@ -1,8 +1,18 @@ package com.ruoyi.common.utils.sign; +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; + +import java.io.IOException; +import java.io.InputStream; + /** * Base64工具类 - * + * * @author ruoyi */ public final class Base64 @@ -263,6 +273,29 @@ public final class Base64 return decodedData; } + /** + * 将文件转为base64字符串 + * @param url + * @return + */ + public static String fileBase64(String url){ + String encode = null; + try { + CloseableHttpClient client = HttpClients.createDefault(); + HttpGet get = new HttpGet(url); + CloseableHttpResponse response = client.execute(get); + //文件流 + HttpEntity httpEntity = response.getEntity(); + InputStream inStream = httpEntity.getContent(); + byte[] bytes = IOUtils.toByteArray(inStream); + //附件base64 + encode = Base64.encode(bytes); + } catch (IOException e) { + return null; + } + return encode; + } + /** * remove WhiteSpace from MIME containing encoded Base64 data. * diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswFile.java b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswFile.java new file mode 100644 index 0000000..d22da8c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswFile.java @@ -0,0 +1,24 @@ +package com.ruoyi.quot.domain.jsw; + +import java.util.List; + +public class QuotJswFile { + private String BJDID; + List FJData; + + public String getBJDID() { + return BJDID; + } + + public void setBJDID(String BJDID) { + this.BJDID = BJDID; + } + + public List getFJData() { + return FJData; + } + + public void setFJData(List FJData) { + this.FJData = FJData; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswFiles.java b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswFiles.java new file mode 100644 index 0000000..8e9eb0a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswFiles.java @@ -0,0 +1,22 @@ +package com.ruoyi.quot.domain.jsw; + +public class QuotJswFiles { + private String fileName; + private String fileData; + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileData() { + return fileData; + } + + public void setFileData(String fileData) { + this.fileData = fileData; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswResult.java b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswResult.java new file mode 100644 index 0000000..68cc111 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswResult.java @@ -0,0 +1,31 @@ +package com.ruoyi.quot.domain.jsw; + +public class QuotJswResult { + private String Success; + private String Message; + private String ErrorMessage; + + public String getSuccess() { + return Success; + } + + public void setSuccess(String success) { + Success = success; + } + + public String getMessage() { + return Message; + } + + public void setMessage(String message) { + Message = message; + } + + public String getErrorMessage() { + return ErrorMessage; + } + + public void setErrorMessage(String errorMessage) { + ErrorMessage = errorMessage; + } +}