|
@@ -1,7 +1,9 @@
|
|
|
package com.ims.eval.service.custom;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
|
|
import com.ims.eval.config.ImaConfig;
|
|
|
import com.ims.eval.entity.custom.DoAction;
|
|
|
import com.ims.eval.entity.custom.IsOkAction;
|
|
@@ -19,9 +21,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -52,33 +52,33 @@ public class WorkflowService {
|
|
|
private ScoreCalculationSchedule scoreCalculationSchedule;
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 发起流程
|
|
|
+ *
|
|
|
* @param doAction
|
|
|
* @return
|
|
|
*/
|
|
|
- public JSONObject doAction(DoAction doAction, HttpServletRequest request){
|
|
|
+ public JSONObject doAction(DoAction doAction, HttpServletRequest request) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
|
|
headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
|
|
|
headers.add("code", request.getHeader("code"));
|
|
|
Map<String, String> map = new LinkedHashMap<>();
|
|
|
- map.put("iamCode",doAction.getIamCode());
|
|
|
- map.put("defKey",doAction.getDefKey());
|
|
|
- map.put("businessKey",doAction.getBusinessKey());
|
|
|
- map.put("action",doAction.getAction());
|
|
|
- map.put("opinion",doAction.getOpinion());
|
|
|
+ map.put("iamCode", doAction.getIamCode());
|
|
|
+ map.put("defKey", doAction.getDefKey());
|
|
|
+ map.put("businessKey", doAction.getBusinessKey());
|
|
|
+ map.put("action", doAction.getAction());
|
|
|
+ map.put("opinion", doAction.getOpinion());
|
|
|
|
|
|
HttpEntity<Map> param = new HttpEntity<>(map, headers);
|
|
|
- ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/instance/doAction", HttpMethod.POST,param,String.class);
|
|
|
+ ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/instance/doAction", HttpMethod.POST, param, String.class);
|
|
|
log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
|
|
|
- if(200== responseEntity2.getStatusCodeValue()){
|
|
|
+ if (200 == responseEntity2.getStatusCodeValue()) {
|
|
|
FlowResult result = JSON.parseObject(responseEntity2.getBody()).toJavaObject(FlowResult.class);
|
|
|
|
|
|
- if(result.getIsOk()){
|
|
|
- boolean biz = updateWorkflowState(result.getData(),doAction.getDefKey(),doAction.getBusinessKey(),"");
|
|
|
- if(biz){
|
|
|
+ if (result.getIsOk()) {
|
|
|
+ boolean biz = updateWorkflowState(result.getData(), doAction.getDefKey(), doAction.getBusinessKey(), "");
|
|
|
+ if (biz) {
|
|
|
log.info("保存流程实例id成功");
|
|
|
}
|
|
|
}
|
|
@@ -89,31 +89,45 @@ public class WorkflowService {
|
|
|
|
|
|
/**
|
|
|
* 获取待办任务
|
|
|
+ *
|
|
|
* @param todoTask
|
|
|
* @return
|
|
|
*/
|
|
|
- public JSONObject todoTaskList(TodoTask todoTask, HttpServletRequest request){
|
|
|
+ public FlowResult todoTaskList(TodoTask todoTask, HttpServletRequest request) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
|
|
headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
|
|
|
headers.add("code", request.getHeader("code"));
|
|
|
// MultiValueMap<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(todoTask), LinkedMultiValueMap.class);
|
|
|
Map<String, String> map = new LinkedHashMap<>();
|
|
|
- map.put("iamCode",todoTask.getIamCode());
|
|
|
- map.put("order",todoTask.getOrder());
|
|
|
- map.put("sort",todoTask.getSort());
|
|
|
- map.put("offset",todoTask.getOffset());
|
|
|
- map.put("limit",todoTask.getLimit());
|
|
|
+ map.put("iamCode", todoTask.getIamCode());
|
|
|
+ map.put("order", todoTask.getOrder());
|
|
|
+ map.put("sort", todoTask.getSort());
|
|
|
+ map.put("offset", todoTask.getOffset());
|
|
|
+ map.put("limit", todoTask.getLimit());
|
|
|
HttpEntity<Map> param = new HttpEntity<>(map, headers);
|
|
|
- ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/my/todoTaskList", HttpMethod.POST,param,String.class);
|
|
|
+ ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/my/todoTaskList", HttpMethod.POST, param, String.class);
|
|
|
log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
|
|
|
- if(200== responseEntity2.getStatusCodeValue()){
|
|
|
- return JSON.parseObject(responseEntity2.getBody());
|
|
|
+ //
|
|
|
+ if (200 == responseEntity2.getStatusCodeValue()) {
|
|
|
+ FlowResult result = JSON.parseObject(responseEntity2.getBody()).toJavaObject(FlowResult.class);
|
|
|
+ if (result.getIsOk()) {
|
|
|
+ List<JSONObject> ds = new ArrayList<>();
|
|
|
+ for (int i = 0; i < result.getRows().size(); i++) {
|
|
|
+ String typeId = result.getRows().getJSONObject(i).get("typeId").toString();
|
|
|
+ if(!"440219646351376385".equals(typeId)){
|
|
|
+ ds.add(result.getRows().getJSONObject(i));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.getRows().removeAll(ds);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
- return null;
|
|
|
- }
|
|
|
|
|
|
-//440416982620438529
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 流程审批
|