|
@@ -28,7 +28,9 @@ import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
+import org.springframework.http.MediaType;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
import org.springframework.util.MultiValueMap;
|
|
import org.springframework.util.MultiValueMap;
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
@@ -61,6 +63,8 @@ public class OaFlow {
|
|
private String requestName;
|
|
private String requestName;
|
|
@Value("${oa.outMaintain}")
|
|
@Value("${oa.outMaintain}")
|
|
private String outMaintainUrl;
|
|
private String outMaintainUrl;
|
|
|
|
+ @Value("${oa.userid}")
|
|
|
|
+ private String userid;
|
|
|
|
|
|
private static String spk = "";
|
|
private static String spk = "";
|
|
private static String secret = "";
|
|
private static String secret = "";
|
|
@@ -187,7 +191,7 @@ public class OaFlow {
|
|
HttpHeaders headersOut = new HttpHeaders();
|
|
HttpHeaders headersOut = new HttpHeaders();
|
|
headersOut.add("token", token);
|
|
headersOut.add("token", token);
|
|
headersOut.add("appid", appid);
|
|
headersOut.add("appid", appid);
|
|
- headersOut.add("userid", "cLPEaFs9moW6b3xZMl1kNNWAAo7bp61ZRRTKmpiJUe56hSxQvrC2vWtY5ogj7g5FAnUOlzYjYg9MRktKXcseh/nsvZCQGa3BAlYixlDJruV19y4Omx5dYnqu/qv2rJAqTzUS71sOwuB1M2nKlLVsphw1GF74UhGP4xsjpZP7mC8=");
|
|
|
|
|
|
+ headersOut.add("userid", userid);
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -229,6 +233,7 @@ public class OaFlow {
|
|
headersOut.add("appid", appid);
|
|
headersOut.add("appid", appid);
|
|
String person = E9ApiTokenUtil.encryptString(spk, iotMaintainDO.getApplyPersonId());
|
|
String person = E9ApiTokenUtil.encryptString(spk, iotMaintainDO.getApplyPersonId());
|
|
headersOut.add("userid", person);
|
|
headersOut.add("userid", person);
|
|
|
|
+ headersOut.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
|
|
|
OutRepairFlow flow = new OutRepairFlow().setFieldName("xmjl").setFieldValue(iotMaintainDO.getProjectManager());
|
|
OutRepairFlow flow = new OutRepairFlow().setFieldName("xmjl").setFieldValue(iotMaintainDO.getProjectManager());
|
|
OutRepairFlow flow1 = new OutRepairFlow().setFieldName("sqr").setFieldValue(iotMaintainDO.getApplyPersonId());
|
|
OutRepairFlow flow1 = new OutRepairFlow().setFieldName("sqr").setFieldValue(iotMaintainDO.getApplyPersonId());
|
|
@@ -262,18 +267,24 @@ public class OaFlow {
|
|
ImmutableList<OutRepairFlow> outRepairFlows = ImmutableList.of(flow16,flow12, flow3, flow4, flow5, flow6, flow7, flow8, flow9, flow10, flow11, flow2, flow, flow14, flow1, flow15, flow13,flow17);
|
|
ImmutableList<OutRepairFlow> outRepairFlows = ImmutableList.of(flow16,flow12, flow3, flow4, flow5, flow6, flow7, flow8, flow9, flow10, flow11, flow2, flow, flow14, flow1, flow15, flow13,flow17);
|
|
|
|
|
|
|
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
|
- params.put("workflowId", workflowId);
|
|
|
|
- params.put("requestName", requestName);
|
|
|
|
- params.put("mainData", outRepairFlows);
|
|
|
|
|
|
+
|
|
|
|
+ // 创建表单数据
|
|
|
|
+ MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
|
|
|
|
+ params.add("workflowId", workflowId);
|
|
|
|
+ params.add("requestName", requestName);
|
|
|
|
+ params.add("mainData", JSON.toJSONString(outRepairFlows));
|
|
|
|
+ Map<String, String> other = new HashMap<>();
|
|
|
|
+ other.put("isnextflow", "1");
|
|
|
|
+ params.add("otherParams", JSON.toJSONString(other));
|
|
|
|
+ System.out.println("------------"+JSON.toJSONString(outRepairFlows));
|
|
// 3. 组合请求头和请求体
|
|
// 3. 组合请求头和请求体
|
|
- HttpEntity<Map<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
|
|
|
|
|
|
+ HttpEntity<MultiValueMap<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);
|
|
RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
|
|
RestTemplate restTemplate = SslSkippingRestTemplate.createRestTemplate();
|
|
String out = restTemplate.postForObject(outMaintainUrl, requestEntityOut, String.class);
|
|
String out = restTemplate.postForObject(outMaintainUrl, requestEntityOut, String.class);
|
|
JSONObject outInfo = JSON.parseObject(out);
|
|
JSONObject outInfo = JSON.parseObject(out);
|
|
//请求成功
|
|
//请求成功
|
|
if (Objects.isNull(outInfo) || !"success".equalsIgnoreCase(String.valueOf(outInfo.get("code")))) {
|
|
if (Objects.isNull(outInfo) || !"success".equalsIgnoreCase(String.valueOf(outInfo.get("code")))) {
|
|
- throw new ServiceException(new ErrorCode(777, "发起oa流程失败"));
|
|
|
|
|
|
+ throw new ServiceException(new ErrorCode(777, String.valueOf(outInfo.get("msg"))));
|
|
}
|
|
}
|
|
JSONObject jsonObject = JSON.parseObject(outInfo.get("data").toString());
|
|
JSONObject jsonObject = JSON.parseObject(outInfo.get("data").toString());
|
|
String requestid = String.valueOf(jsonObject.get("requestid"));
|
|
String requestid = String.valueOf(jsonObject.get("requestid"));
|