Commit 2389a0b4 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP1.7.2' into MVP1.7.2

parents 17e10b01 fad52f5c
......@@ -20,6 +20,10 @@ public class EkpOrderProperties {
* 接口url
*/
String url;
/**
* 接口url
*/
String url2;
/**
* 订单modelId
......
......@@ -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,23 +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("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>>(wholeForm,headers);
HttpEntity<Map<String,Object>> entity = new HttpEntity<Map<String,Object>>(null,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl(), HttpMethod.POST, entity, String.class);
log.error("附件同步结果"+ekpProperties.getUrl());
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)){
......
......@@ -21,14 +21,5 @@ public class EkpOrderParam implements Serializable {
**/
private String fd_3b0b02a34a0134;
/**
* 附件IDS 目前用于项目订单附件同步
**/
private String attIds;
/**
* 项目订单ID 与 附件attIds 配合使用
**/
private String orderNo;
}
#ekporder.url=http://192.168.0.228:8080/api/sys-modeling/appModelRestService/addModel
ekporder.url=http://36.7.147.29:27007/api/sys-modeling/appModelRestService/addModel
ekporder.url2=http://36.7.147.29:27007/api/hro/modelingWebservice/updateOrderFileInfo
ekporder.orderFdModelId=182f1b7ffe2e96f975564e44e559847d
ekporder.orderFdFlowId=182f1c098ce991ca96bc927408792beb
ekporder.replyFdModelId=182f1bb35bb2156fb9a02904bc88dd8a
......@@ -9,6 +10,5 @@ ekporder.docStatus=20
ekporder.LoginName=admin
ekporder.orderDocSubject=\u7528\u4E8E\u9879\u76EE\u8BA2\u5355\u66F4\u65B0\u63A5\u53E3
ekporder.replyDocSubject=\u7528\u4E8E\u8BA2\u5355\u56DE\u590D\u63A5\u53E3
ekporder.updateOrderFile=\u540C\u6B65\u9644\u4EF6\u4FE1\u606F
......@@ -25,6 +25,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.Resource;
import javax.json.Json;
import java.io.File;
import java.io.IOException;
......@@ -54,7 +55,6 @@ public class EkpOrderController {
@Schema(description = "接收处理ekp订单")
@PostMapping(value = "/receiveOrder")
public R receiveOrder(OrderAddVO vo) throws IOException {
log.error("#################################"+JSONObject.toJSONString(vo));
return tOrderService.receiveOrder(vo,ekpOrderFileTask);
}
......
......@@ -548,10 +548,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
order.setDeptId(settleDomain.getId());
}
boolean save = this.save(order);
//异步处理附件信息同步 fxj 2024-11-22 17:46
if (Common.isNotNull(vo.getAttIds())){
this.syncFileFromEkp(order.getOrderNo(),vo.getAttIds());
}
//处理指派人
if (save && CollectionUtils.isNotEmpty(vo.getHandleUserList())){
List<TOrderHandler> list = new ArrayList<>();
......@@ -765,6 +761,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
**/
@Override
public R<String> syncFileFromEkp(String orderNo, String attIds) {
log.error("I AM HERE 2");
if (StringUtils.isEmpty(orderNo)){
return R.failed(OrderConstants.ORDER_NO_IS_EMPTY);
}
......@@ -773,6 +770,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
}
String res = ekpOrderUtil.syncFileFromEkp(orderNo,attIds);
if (Common.isNotNull(res)){
log.error("I AM HERE 1"+res);
return R.failed(res);
}
return R.ok(OrderConstants.OPERATE_SUCCESS);
......
......@@ -50,7 +50,7 @@
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="debug">
<root level="error">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
......
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