Commit a8c7b7d9 authored by chenhao's avatar chenhao

删除common中的remoteWorkflowService代码

parent 4ed0ef43
package com.yeejoin.amos.boot.biz.common.workflow.enums;
public enum WorkFlowUriEnum {
启动流程("启动流程", "/workflow/task/startTask", ""),
流程详情("流程详情", "/workflow/task/{taskId}", "taskId"),
合并启动流程("合并启动流程", "/workflow/task/startProcess", ""),
所有已执行任务详情("所有已执行任务详情","/workflow/activitiHistory/task/detail/{taskId}","taskId"),
流程任务("流程任务", "/workflow/task?processInstanceId={processInstanceId}", "processInstanceId"),
我的代办("我的代办", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
我的代办有ID("我的代办有ID", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
已执行任务("已执行任务", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
已执行任务有ID("已执行任务有ID", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
启动免登录流程("启动免登录流程", "/processes/{appKey}", "appKey"),
当前节点("当前节点", "/wf/taskstodo?processInstanceId={processInstanceId}", "processInstanceId"),
执行流程("执行流程", "/workflow/task/pickupAndCompleteTask/{taskId}", "taskId"),
终止流程("终止流程", "/wf/processes/{processInstanceId}?deleteReason={deleteReason}", "processInstanceId,deleteReason"),
当前子节点("当前子节点", "/wf/processes/{processInstanceId}/tasks?taskDefinitionKey={taskDefinitionKey}", "processInstanceId,taskDefinitionKey"),
工作流流水("工作流流水","/wf/processes/{processInstanceId}/tasks", "processInstanceId"),
子节点信息("子节点信息","/workflow/task/list/all/{instanceId}", "instanceId"),
所有已执行任务集合("所有已执行任务集合","/workflow/activitiHistory/tasks/{processInstanceId}", "processInstanceId");
private String desc;
private String uri;
private String params;
WorkFlowUriEnum(String desc, String uri, String params) {
this.desc = desc;
this.uri = uri;
this.params = params;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
}
package com.yeejoin.amos.boot.biz.common.workflow.enums;
/**
* 是否枚举
* @author WJK
*
*/
public enum YesOrNoEnum {
NO("否","0"),
YES("是","1" );
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
private YesOrNoEnum(String name, String code){
this.name = name;
this.code = code;
}
public static YesOrNoEnum getEnum(String code) {
YesOrNoEnum jPushTypeEnum = null;
for(YesOrNoEnum type: YesOrNoEnum.values()) {
if (type.getCode().equals(code)) {
jPushTypeEnum = type;
break;
}
}
return jPushTypeEnum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
package com.yeejoin.amos.boot.biz.common.workflow.feign;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Author: xl
* @Description:
* @Date: 2020/3/30 16:26
*/
@Configuration
public class CommonMultipartSupportConfig {
@Autowired
private ObjectFactory<HttpMessageConverters> messageConverters;
@Bean
public Encoder feignCommonFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
}
package com.yeejoin.amos.boot.biz.common.workflow.feign;
import java.util.HashMap;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.alibaba.fastjson.JSONObject;
@FeignClient(name = "AMOS-API-WORKFLOW",path = "workflow", configuration = {CommonMultipartSupportConfig.class})
public interface WorkflowFeignService {
/**
* 发起流程
* @param params
* @return
*/
@RequestMapping(value = "/task/startProcess", method = RequestMethod.POST)
JSONObject startByVariable(@RequestBody Object params) ;
/**
* 完成任务
* @param taskID
* @param variable
* @return
* @throws Exception
*/
@RequestMapping(value = "/task/pickupAndCompleteTask/{taskId}", method = RequestMethod.POST)
JSONObject pickupAndCompleteTask(@PathVariable("taskId") String taskID, @RequestBody(required = false) HashMap<String, Object> variable) throws Exception;
/**
* 查询当前流程下所有的可执行任务
* @param processInstanceId
* @return
*/
@RequestMapping(value = "/task/list/all/{processInstanceId}", method = RequestMethod.GET)
JSONObject getTaskList(@PathVariable("processInstanceId") String processInstanceId) ;
}
...@@ -52,28 +52,21 @@ public class FailureDetailsController extends BaseController { ...@@ -52,28 +52,21 @@ public class FailureDetailsController extends BaseController {
* 新增 * 新增
* *
* @return * @return
* @throws Exception
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<Object> save(@RequestBody FailureDetailsDto model) { public ResponseModel<Object> save(@RequestBody FailureDetailsDto model) {
Object result;
Object result = failureDetailsServiceImpl.savemodel(model,getSelectedOrgInfo()); try {
return ResponseHelper.buildResponse(result); result = failureDetailsServiceImpl.savemodel(model,getSelectedOrgInfo());
return ResponseHelper.buildResponse(result);
} catch (Exception e) {
// CommonResponse commonResponse = new CommonResponse(); // TODO Auto-generated catch block
// try { return ResponseHelper.buildResponse("erro");
// AgencyUserModel user = getUserInfo(); }
// if (ObjectUtils.isEmpty(user)) {
// return CommonResponseUtil.failure("用户session过期");
// }
// return failureDetailsServiceImpl.savemodel(model);
// } catch (Exception e) {
// logger.error("", e.getMessage());
// return CommonResponseUtil.failure("系统繁忙,请稍后再试");
// }
} }
......
...@@ -21,9 +21,8 @@ import com.alibaba.fastjson.JSONArray; ...@@ -21,9 +21,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.workflow.RemoteWorkFlowService; import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto; import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureAudit; import com.yeejoin.amos.boot.module.common.api.entity.FailureAudit;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails; import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
...@@ -44,9 +43,9 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -44,9 +43,9 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
@Autowired @Autowired
SourceFileServiceImpl sourceFileServiceImpl; SourceFileServiceImpl sourceFileServiceImpl;
@Autowired @Autowired
RemoteWorkFlowService remoteWorkFlowService; WorkflowFeignService workflowFeignService;
@Value("${failure.work.flow.processDefinitionKey}") @Value("${failure.work.flow.processDefinitionKey}")
private String processDefinitionKey; private String processDefinitionKey;
...@@ -84,11 +83,15 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -84,11 +83,15 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
/** /**
* 发起故障保修单 * 发起故障保修单
* @throws Exception
*/ */
@Transactional @Transactional
public Object savemodel(FailureDetailsDto failureDetailsDto, ReginParams userInfo) { public Object savemodel(FailureDetailsDto failureDetailsDto, ReginParams userInfo) throws Exception {
String businessKey = buildOrderNo(); String businessKey = buildOrderNo();
JSONObject jsonObject = remoteWorkFlowService.startNew(null, businessKey, processDefinitionKey); JSONObject body = new JSONObject();
body.put("businessKey", businessKey);
body.put("processDefinitionKey", processDefinitionKey);
JSONObject jsonObject = workflowFeignService.startByVariable(body);
if (jsonObject == null) { if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// return CommonResponseUtil.failure("启动流程失败"); // return CommonResponseUtil.failure("启动流程失败");
...@@ -120,12 +123,12 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -120,12 +123,12 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
public boolean excuteTask( Long sequenceNbr, ReginParams userInfo, public boolean excuteTask( Long sequenceNbr, ReginParams userInfo,
String condition) { String condition) {
Map<String, Object> conditionMap = new HashMap<String, Object>(); HashMap<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition); conditionMap.put("condition", condition);
Map<String,Object> map= checkExcuteTaskAuthMap(sequenceNbr,userInfo); Map<String,Object> map= checkExcuteTaskAuthMap(sequenceNbr,userInfo);
try { try {
if(Boolean.parseBoolean(map.get("checkFlag").toString())) { if(Boolean.parseBoolean(map.get("checkFlag").toString())) {
remoteWorkFlowService.excute(map.get("taskId").toString(), conditionMap.toString()); workflowFeignService.pickupAndCompleteTask(map.get("taskId").toString(), conditionMap);
} }
} catch (Exception e) { } catch (Exception e) {
return false; return false;
...@@ -134,15 +137,15 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -134,15 +137,15 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
} }
public boolean excuteTask(String procressId, ReginParams userInfo, public boolean excuteTask(String procressId, ReginParams userInfo,
String condition) { String condition) throws Exception {
Map<String, Object> conditionMap = new HashMap<String, Object>(); HashMap<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition); conditionMap.put("condition", condition);
JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId); JSONObject teskObject =workflowFeignService.getTaskList(procressId);
if (ObjectUtils.isNotEmpty(teskObject)) { if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data"); JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) { for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj)); JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
remoteWorkFlowService.excute(detail.getString("id"), conditionMap.toString()); workflowFeignService.pickupAndCompleteTask(detail.getString("id"), conditionMap);
} }
} }
return true; return true;
...@@ -160,7 +163,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -160,7 +163,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
FailureDetails details = this.baseMapper.selectById(sequenceNbr); FailureDetails details = this.baseMapper.selectById(sequenceNbr);
String procressId = details.getProcessId(); String procressId = details.getProcessId();
Long seq = userInfo.getDepartment().getSequenceNbr(); Long seq = userInfo.getDepartment().getSequenceNbr();
JSONObject teskObject = remoteWorkFlowService.getChildNodeDetail(procressId); JSONObject teskObject =workflowFeignService.getTaskList(procressId);
if (ObjectUtils.isNotEmpty(teskObject)) { if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data"); JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) { for (Object obj : taskDetailArray) {
...@@ -190,7 +193,6 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -190,7 +193,6 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
public Object getCurrentProcessHistoryTask(Long id) { public Object getCurrentProcessHistoryTask(Long id) {
FailureDetailsDto failureDetailsDto = this.queryBySeq(id); FailureDetailsDto failureDetailsDto = this.queryBySeq(id);
String processId = failureDetailsDto.getProcessId(); String processId = failureDetailsDto.getProcessId();
JSONObject historyObject = remoteWorkFlowService.queryFinishTaskDetailByInstanceId(processId);
return logger; return logger;
} }
......
...@@ -39,9 +39,4 @@ file.url=http://39.98.45.134:9000/ ...@@ -39,9 +39,4 @@ file.url=http://39.98.45.134:9000/
video.url=https://11.11.16.4:443/ video.url=https://11.11.16.4:443/
params.work.flow.normalProcessDefinitionKey=normalHazardManagement
params.work.flow.processDefinitionKey=hazardManagement
params.work.flow.address=http://172.16.3.4:30040
#params.work.flow.address=http://172.16.10.80:30040
params.spc.address=http://172.16.3.89:9001
failure.work.flow.processDefinitionKey=malfunction_repair failure.work.flow.processDefinitionKey=malfunction_repair
\ No newline at end of file
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