This commit is contained in:
xd 2024-06-07 14:05:07 +08:00
parent 554506ad78
commit 64fadfd745
8 changed files with 236 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#for tests only ! #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.destination.pool_capacity=10
jco.client.lang=ZH jco.client.lang=ZH
jco.client.ashost=172.19.0.120 jco.client.ashost=172.19.0.120
@ -7,5 +7,5 @@ jco.client.saprouter=
jco.client.user=RFC jco.client.user=RFC
jco.client.sysnr=00 jco.client.sysnr=00
jco.destination.peak_limit=10 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 jco.client.client=300

View File

@ -1,9 +1,11 @@
package com.ruoyi.web.controller.quot; package com.ruoyi.web.controller.quot;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.constant.WebsocketConst; import com.ruoyi.common.constant.WebsocketConst;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache; 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.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.MinioUtil; import com.ruoyi.common.utils.file.MinioUtil;
import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.priceVerification.domain.QuotHj; import com.ruoyi.priceVerification.domain.QuotHj;
import com.ruoyi.priceVerification.service.IQuotHjService; import com.ruoyi.priceVerification.service.IQuotHjService;
import com.ruoyi.quot.domain.*; 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.quot.service.IQuotFileService;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysNoticeService; import com.ruoyi.system.service.ISysNoticeService;
@ -448,7 +454,40 @@ public class QuotController extends BaseController
@PostMapping("/commitJswQuot") @PostMapping("/commitJswQuot")
public AjaxResult commitJswQuot(@RequestBody Quot quot) public AjaxResult commitJswQuot(@RequestBody Quot quot)
{ {
// TODO 对接金思维接口 // 对接金思维接口
//附件对接
List<QuotFile> files = new ArrayList<>();
QuotFile quotFile = new QuotFile();
quotFile.setRelationId(quot.getQuotId());// 报价单ID
quotFile.setFileType("quotXjFile");// 附件类型-询价清单附件
List<QuotFile> quotXjFiles = quotFileService.selectQuotFileList(quotFile);
if(quotXjFiles!=null&&quotXjFiles.size()>0){
files.addAll(quotXjFiles);
}
quotFile = new QuotFile();
quotFile.setRelationId(quot.getQuotId());// 报价单ID
quotFile.setFileType("quotJsgfFile");// 附件类型-技术附件
List<QuotFile> quotJsgfFiles = quotFileService.selectQuotFileList(quotFile);
if(quotJsgfFiles!=null&&quotJsgfFiles.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");// 更新金思维提交状态为 协助中 quot.setQuotJswApprovalStatus("1");// 更新金思维提交状态为 协助中
quotService.updateQuot(quot); quotService.updateQuot(quot);
return success(); return success();

View File

@ -152,6 +152,11 @@
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
</dependencies> </dependencies>

View File

@ -189,6 +189,80 @@ public class HttpUtils
return result.toString(); 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) public static String sendSSLPost(String url, String param)
{ {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();

View File

@ -1,5 +1,15 @@
package com.ruoyi.common.utils.sign; 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工具类 * Base64工具类
* *
@ -263,6 +273,29 @@ public final class Base64
return decodedData; 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. * remove WhiteSpace from MIME containing encoded Base64 data.
* *

View File

@ -0,0 +1,24 @@
package com.ruoyi.quot.domain.jsw;
import java.util.List;
public class QuotJswFile {
private String BJDID;
List<QuotJswFiles> FJData;
public String getBJDID() {
return BJDID;
}
public void setBJDID(String BJDID) {
this.BJDID = BJDID;
}
public List<QuotJswFiles> getFJData() {
return FJData;
}
public void setFJData(List<QuotJswFiles> FJData) {
this.FJData = FJData;
}
}

View File

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

View File

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