销售出货拣货上传附件功能完成
This commit is contained in:
parent
13537e96f2
commit
43046164e6
@ -67,14 +67,14 @@ public class EsbFileDealController {
|
||||
// 组装抛送的报文
|
||||
String fileDir = "MES/" + site + "/" + SapUtil.generateYearMonth();
|
||||
contentObject.put("FILE_DIR", fileDir);
|
||||
String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename());
|
||||
invokeRequest.setMessageContent(fileDir);
|
||||
invokeRequest.setStart(nowTime);
|
||||
invokeRequest.setKeyValue(fileName);
|
||||
invokeRequest.setKeyValue(file.getOriginalFilename());
|
||||
invokeRequest.setRetry(false);
|
||||
// 呼叫SAP
|
||||
invokeResponse = esbFileDealService.call(invokeRequest, file);
|
||||
// FileUtil.writeFromStream(file.getInputStream(),new File("/Users/snow/Documents/"+fileName));
|
||||
params.put("RESULT", invokeResponse.getResult());
|
||||
params.put("MSG", invokeResponse.getMessageContent());
|
||||
} catch (Exception e) {
|
||||
params.put("RESULT", "E");
|
||||
params.put("MSG", e.getMessage());
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.foreverwin.iep.integration.handler.def.sap;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foreverwin.iep.common.faas.common.util.StringUtils;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
@ -45,12 +46,9 @@ public class EsbFileDealService {
|
||||
invokeResponse.setResult("S");
|
||||
// 请求处理成功
|
||||
JSONObject jsonObject = invokeResponse.getObjectResponse();
|
||||
JSONObject bodyJson = jsonObject.getJSONObject("RESPONSE_BODY");
|
||||
JSONObject outJson = bodyJson.getJSONObject("ES_OUTPUT");
|
||||
String result = outJson.getString("MSGTY");
|
||||
status = !"S".equals(result) ? "E" : result;
|
||||
String message = outJson.getString("MSGTX");
|
||||
invokeResponse.setMessageContent(StringUtils.isEmpty(message) ? "成功" : message);
|
||||
JSONArray bodyJson = jsonObject.getJSONArray("files");
|
||||
JSONObject outJson = bodyJson.getJSONObject(0);
|
||||
invokeResponse.setMessageContent(outJson.toJSONString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
status = "E";
|
||||
|
||||
@ -80,18 +80,10 @@ public class SapUtil {
|
||||
InvokeResponse invokeResponse = new InvokeResponse();
|
||||
invokeResponse.setResult("S");
|
||||
try {
|
||||
|
||||
final String boundaryPrefix = Long.toHexString(System.currentTimeMillis()); // 随机边界
|
||||
// 定义数据分隔线
|
||||
String boundary = "========";
|
||||
String newLine = "\r\n";
|
||||
String fileDir = "FILE_DIR";
|
||||
|
||||
String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(multipartFile.getOriginalFilename());
|
||||
|
||||
// 禁用 SSL 验证
|
||||
SSLUtil.disableCertificateValidation();
|
||||
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
httpClient = (CloseableHttpClient) wrapClient(httpClient);
|
||||
|
||||
@ -116,6 +108,15 @@ public class SapUtil {
|
||||
if (finalResponseCode == HttpURLConnection.HTTP_OK) {
|
||||
// 从响应对象中提取正文
|
||||
String responseBody = EntityUtils.toString(response.getEntity());
|
||||
JSONObject bodyJson = JSONObject.parseObject(responseBody);
|
||||
Integer status = bodyJson.getInteger("status");
|
||||
if(200 == status){
|
||||
invokeResponse.setResult("S");
|
||||
invokeResponse.setMessageContent("成功");
|
||||
invokeResponse.setObjectResponse(bodyJson.getJSONObject("data"));
|
||||
}else{
|
||||
invokeResponse.setResult("E");
|
||||
}
|
||||
invokeResponse.setMessageContent(responseBody);
|
||||
return invokeResponse;
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user