工作流代码提交
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.njcn.process.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.OverLimitFlagDTO;
|
||||
import com.njcn.process.api.fallback.FlowableDefineFallbackFactory;
|
||||
import com.njcn.process.api.fallback.RStatWorkOrderFallbackFactory;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流
|
||||
* @author cdf
|
||||
* @date 2023/4/13
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PROCESS,path = "/flowable/definition",fallbackFactory = FlowableDefineFallbackFactory.class)
|
||||
public interface FlowableDefineFeignClient {
|
||||
|
||||
|
||||
|
||||
@PostMapping("/start")
|
||||
HttpResult<String> start(@RequestParam(value = "procDefId") String procDefId,
|
||||
@RequestParam("thsIndex") String thsIndex,
|
||||
@RequestBody Map<String, Object> variables);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.process.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.OverLimitFlagDTO;
|
||||
import com.njcn.process.api.fallback.FlowableTaskFallbackFactory;
|
||||
import com.njcn.process.api.fallback.RStatWorkOrderFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作流
|
||||
* @author cdf
|
||||
* @date 2023/4/13
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PROCESS,path = "/flowable/task",fallbackFactory = FlowableTaskFallbackFactory.class)
|
||||
public interface FlowableTaskFeignClient {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.process.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.OverLimitFlagDTO;
|
||||
import com.njcn.process.api.FlowableDefineFeignClient;
|
||||
import com.njcn.process.api.RStatWorkOrderFeignClient;
|
||||
import com.njcn.process.utils.ProcessEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/4/13
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FlowableDefineFallbackFactory implements FallbackFactory<FlowableDefineFeignClient> {
|
||||
|
||||
@Override
|
||||
public FlowableDefineFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = ProcessEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new FlowableDefineFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<String> start(String procDefId,
|
||||
String thsIndex,
|
||||
Map<String, Object> variables) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "流程开始", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.process.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.OverLimitFlagDTO;
|
||||
import com.njcn.process.api.FlowableTaskFeignClient;
|
||||
import com.njcn.process.api.RStatWorkOrderFeignClient;
|
||||
import com.njcn.process.utils.ProcessEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/4/13
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FlowableTaskFallbackFactory implements FallbackFactory<FlowableTaskFeignClient> {
|
||||
|
||||
@Override
|
||||
public FlowableTaskFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = ProcessEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new FlowableTaskFeignClient() {
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.process.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Tony
|
||||
* @date 2021/4/21 20:55
|
||||
*/
|
||||
@Data
|
||||
public class FlowViewerDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 流程key
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 是否完成(已经审批)
|
||||
*/
|
||||
private boolean completed;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.process.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-04-13
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("ths_flowable_ass")
|
||||
public class FlowableAss{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 技术监督主键
|
||||
*/
|
||||
@TableId
|
||||
private String thsIndex;
|
||||
|
||||
/**
|
||||
* 流程实例主键对应部署id deploymentId
|
||||
*/
|
||||
private String proIndex;
|
||||
|
||||
/**
|
||||
* 步骤主键
|
||||
*/
|
||||
private String execIndex;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.njcn.process.pojo.vo.flowable;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>流程任务<p>
|
||||
*
|
||||
* @author Tony
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
@Data
|
||||
|
||||
public class FlowQueryVo {
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private String startTime;
|
||||
|
||||
|
||||
private String endTime;
|
||||
|
||||
|
||||
private Integer pageNum;
|
||||
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.process.pojo.vo.flowable;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>流程任务<p>
|
||||
*
|
||||
* @author Tony
|
||||
* @date 2021-04-03
|
||||
*/
|
||||
@Data
|
||||
|
||||
public class FlowTaskVo {
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
|
||||
private String userId;
|
||||
|
||||
|
||||
private String comment;
|
||||
|
||||
|
||||
private String instanceId;
|
||||
|
||||
|
||||
private String targetKey;
|
||||
|
||||
private String deploymentId;
|
||||
|
||||
private String defId;
|
||||
|
||||
|
||||
private String currentChildExecutionId;
|
||||
|
||||
|
||||
private Boolean flag;
|
||||
|
||||
|
||||
private Map<String, Object> variables;
|
||||
|
||||
|
||||
private String assignee;
|
||||
|
||||
|
||||
private List<String> candidateUsers;
|
||||
|
||||
|
||||
private List<String> candidateGroups;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.process.pojo.vo.flowable;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>可退回节点<p>
|
||||
*
|
||||
* @author tony
|
||||
* @date 2022-04-23 11:01:52
|
||||
*/
|
||||
@Data
|
||||
|
||||
public class ReturnTaskNodeVo {
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user