Commit fabf90f6 authored by fangxinjiang's avatar fangxinjiang

项目订单附件上传优化-fxj

parent cd42008d
......@@ -26,6 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author licancan
......@@ -156,30 +157,16 @@ public class EkpOrderUtil {
public String syncFileFromEkp(String orderNo, String attIds){
log.info("同步项目订单附件信息");
RestTemplate yourRestTemplate = new RestTemplate();
String formValues = "{}";
try{
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
/*MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("orderNo", orderNo);
wholeForm.add("attIds", attIds);
wholeForm.add("fileFlag", CommonConstants.ZERO_STRING);
wholeForm.add("docSubject",ekpProperties.getReplyDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpProperties.getDocStatus());
wholeForm.add("fdModelId", ekpProperties.getReplyFdModelId());
wholeForm.add("fdFlowId", ekpProperties.getReplyFdFlowId());
wholeForm.add("formValues", formValues);*/
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(null,headers);
HttpEntity<Map<String,Object>> entity = new HttpEntity<Map<String,Object>>(null,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
log.error("附件同步结果"+ekpProperties.getUrl());
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl2()+"?addIds="+attIds+"&orderNo="+orderNo, HttpMethod.POST, entity, String.class);
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl2()+"?addIds="+attIds+"&orderNo="+orderNo, HttpMethod.POST, null, String.class);
log.error("附件同步结果:"+ JSONObject.toJSONString(obj));
String body = obj.getBody();
if (StringUtils.isBlank(body)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment