1、接口定义
public interface ProApprovalFlowAppService {
/**
* 提交
*
* @param submitDto submitDto
* @return ResultDto
*/
ResultDto<ProApprovalFlowInstanceDto> submit(SubmitDto submitDto);
/**
* 异步提交
*
* @param submitDto submitDto
* @return ResultDto
*/
ResultDto<String> submitAsync(SubmitDto submitDto);
/**
* 撤回
*
* @param approvalDto approvalDto
* @return ResultDto
*/
ResultDto<String> revoke(ApprovalDto approvalDto);
/**
* 同意
*
* @param approvalDto approvalDto
* @return ResultDto
*/
ResultDto<String> agree(ApprovalDto approvalDto);
/**
* 驳回
*
* @param approvalDto approvalDto
* @return ResultDto
*/
ResultDto<String> reject(ApprovalDto approvalDto);
/**
* 转审
*
* @param approvalDto approvalDto
* @return ResultDto
*/
ResultDto<String> referral(ApprovalDto approvalDto);
/**
* 作废
*
* @param approvalDto approvalDto
* @return ResultDto
*/
ResultDto<String> abort(ApprovalDto approvalDto);
/**
* 删除
*
* @param bizType bizType
* @param bizDataId bizDataId
* @return ResultDto
*/
ResultDto<String> delete(String bizType, String bizDataId);
/**
* 清空日志
*
* @param bizType bizType
* @param bizDataId bizDataId
* @return ResultDto
*/
ResultDto<String> clearLog(String bizType, String bizDataId);
/**
* 修改Owner
*
* @param modifyOwnerDto modifyOwnerDto
* @return ResultDto
*/
ResultDto<String> modifyOwner(ModifyOwnerDto modifyOwnerDto);
/**
* 获取流程实例的基本信息
*
* @param bizType bizType
* @param bizDataId bizDataId
* @return ResultDto
*/
ResultDto<ProApprovalFlowInstanceDto> getInstanceInfo(String bizType, String bizDataId);
/**
* 保存日志
*
* @param logDto logDto
* @return ResultDto
*/
ResultDto<String> saveLog(ApprovalLogDto logDto);
/**
* 异步保存日志
*
* @param logDto logDto
* @return ResultDto
*/
ResultDto<String> saveLogAsync(ApprovalLogDto logDto);
/**
* 获取审批日志
*
* @param bizType bizType
* @param bizDataId bizDataId
* @return ResultDto
*/
ResultDto<List<ProApprovalFlowLogDto>> getLog(String bizType, String bizDataId);
/**
* 审批系统节点
*
* @param approveSysNodeDto approveSysNodeDto
* @return ResultDto
*/
ResultDto<String> approveSysNode(ApproveSysNodeDto approveSysNodeDto);
/**
* 获取审批人
*
* @param bizType bizType
* @param bizDataId bizDataId
* @return ResultDto
*/
ResultDto<List<NodeApproverDto>> getApprover(String bizType, String bizDataId);
/**
* 获取流程节点
*
* @param bizType bizType
* @param bizDataId bizDataId
* @return ResultDto
*/
ResultDto<List<FlowNodeDto>> getFlow(String bizType, String bizDataId);
/**
* 重新启动
*
* @param restartDto restartDto
* @return ResultDto
*/
ResultDto<String> restart(RestartDto restartDto);
}
2、DTO定义
@Data
@ApiModel(value = "审批流提交DTO", description = "审批流提交DTO")
public class SubmitDto {
@ApiModelProperty(value = "流程ID")
private Long flowId;
@ApiModelProperty(value = "业务类型", required = true)
@NotBlank(message = "bizType is required")
private String bizType;
@ApiModelProperty(value = "业务数据ID", required = true)
@NotBlank(message = "bizDataId is required")
private String bizDataId;
@ApiModelProperty(value = "责任人")
private String owner;
@ApiModelProperty(value = "责任人名称")
private String ownerName;
@ApiModelProperty(value = "审批人", required = true)
@NotNull(message = "approver is required")
private Object approver;
@ApiModelProperty(value = "业务数据")
private Object bizData;
@ApiModelProperty(value = "操作人W3账号")
private String w3account;
@ApiModelProperty(value = "操作人UCN")
private String userCn;
@ApiModelProperty("备注")
private String remark;
}
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel(value = "审批流接口通用DTO", description = "审批流接口通用DTO")
@Builder
public class ApprovalDto {
@ApiModelProperty(value = "业务类型", required = true)
@NotBlank(message = "bizType is required")
private String bizType;
@ApiModelProperty(value = "业务数据ID", required = true)
@NotBlank(message = "bizDataId is required")
private String bizDataId;
@ApiModelProperty("审批意见")
private String comment;
@ApiModelProperty("转后审批人W3账号,当待办结果为转审时必填")
private String forwardUser;
@ApiModelProperty("转后审批人名称,当待办结果为转审时必填")
private String forwardUserName;
@ApiModelProperty(value = "操作人W3账号")
private String w3account;
@ApiModelProperty(value = "操作人UCN")
private String userCn;
}
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel(value = "审批流日志参数DTO", description = "审批流日志参数DTO")
@Builder
public class ApprovalLogDto implements Serializable {
@ApiModelProperty(value = "业务类型", required = true)
@NotBlank(message = "bizType is required")
private String bizType;
@ApiModelProperty(value = "业务数据ID", required = true)
@NotBlank(message = "bizDataId is required")
private String bizDataId;
@ApiModelProperty("节点编码,如果为空则默认为当前节点")
private String flowNodeCode;
@ApiModelProperty(
value = "操作类型,SUBMIT提交,AGREE同意,REJECT驳回,RESUBMIT重新提交,REVOKE撤回,REFERRAL转审,ABORT作废,FINISHED已完成,OTHER其它",
required = true)
@NotBlank(message = "opType is required")
private String opType;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "操作人W3账号")
private String w3account;
@ApiModelProperty(value = "操作人UCN")
private String userCn;
}
@ApiModel(value = "审批系统节点DTO", description = "审批系统节点DTO")
@Data
public class ApproveSysNodeDto {
@ApiModelProperty(value = "流程实例ID", required = true)
@NotNull(message = "flowInstanceId is required")
private Long flowInstanceId;
@ApiModelProperty(value = "节点编码", required = true)
@NotBlank(message = "flowNodeCode is required")
private String flowNodeCode;
@ApiModelProperty(value = "审批结果(AGREE:通过、DISAGREE:不通过)", required = true)
@NotBlank(message = "result is required")
private String result;
@ApiModelProperty(value = "审批意见")
@NotBlank(message = "comment is required")
private String comment;
}
@Data
@ApiModel(description = "接口基本返回结果")
public class ResultDto<T> {
/** 成功码 */
public static final int SUCCESS_CODE = 200;
/** 错误码 */
private static final int ERROR_CODE = 500;
private static final String COMMON_FAIL_MSG =
"We're sorry, an unknown error occurred while processing your request! "
.concat("Please give feedback to the IT hotline or the IT support staff of this system");
@ApiModelProperty(value = "状态码", name = "code")
private Integer code = SUCCESS_CODE;
@ApiModelProperty(value = "描述", name = "message")
private String message;
@ApiModelProperty(value = "时间戳", name = "timestamp")
private Long timestamp;
@ApiModelProperty(value = "返回数据体", name = "data")
private T data;
private Object result;
/**
* resultDto
*/
public ResultDto() {
}
/**
* resultDto
*
* @param data 数据
*/
public ResultDto(T data) {
this.data = data;
this.timestamp = System.currentTimeMillis();
}
/**
* fail
*
* @param errorMsg resultCode
* @return resultDto
*/
public static ResultDto fail(String errorMsg) {
ResultDto resultDto = new ResultDto();
resultDto.setCode(ERROR_CODE);
resultDto.setMessage(errorMsg);
return resultDto;
}
/**
* 通用失败返回
*
* @return resultDto
*/
public static ResultDto fail() {
ResultDto resultDto = new ResultDto();
resultDto.setCode(ERROR_CODE);
resultDto.setMessage(COMMON_FAIL_MSG);
return resultDto;
}
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel(value = "审批流日志参数DTO", description = "审批流日志参数DTO")
@Builder
public class ApprovalLogDto implements Serializable {
@ApiModelProperty(value = "业务类型", required = true)
@NotBlank(message = "bizType is required")
private String bizType;
@ApiModelProperty(value = "业务数据ID", required = true)
@NotBlank(message = "bizDataId is required")
private String bizDataId;
@ApiModelProperty("节点编码,如果为空则默认为当前节点")
private String flowNodeCode;
@ApiModelProperty(
value = "操作类型,SUBMIT提交,AGREE同意,REJECT驳回,RESUBMIT重新提交,REVOKE撤回,REFERRAL转审,ABORT作废,FINISHED已完成,OTHER其它",
required = true)
@NotBlank(message = "opType is required")
private String opType;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "操作人W3账号")
private String w3account;
@ApiModelProperty(value = "操作人UCN")
private String userCn;
}
@ApiModel(value = "审批系统节点DTO", description = "审批系统节点DTO")
@Data
public class ApproveSysNodeDto {
@ApiModelProperty(value = "流程实例ID", required = true)
@NotNull(message = "flowInstanceId is required")
private Long flowInstanceId;
@ApiModelProperty(value = "节点编码", required = true)
@NotBlank(message = "flowNodeCode is required")
private String flowNodeCode;
@ApiModelProperty(value = "审批结果(AGREE:通过、DISAGREE:不通过)", required = true)
@NotBlank(message = "result is required")
private String result;
@ApiModelProperty(value = "审批意见")
@NotBlank(message = "comment is required")
private String comment;
}
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel(value = "重新启动参数DTO", description = "重新启动参数DTO")
@Builder
public class RestartDto implements Serializable {
@ApiModelProperty(value = "业务类型", required = true)
@NotBlank(message = "bizType is required")
private String bizType;
@ApiModelProperty(value = "业务数据ID", required = true)
@NotBlank(message = "bizDataId is required")
private String bizDataId;
@ApiModelProperty("节点编码,如果为空则默认为当前节点")
private String flowNodeCode;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "操作人W3账号")
private String w3account;
@ApiModelProperty(value = "操作人UCN")
private String userCn;
}
public enum ApprovalEnum {
/**
* 提交
*/
SUBMIT("提交"),
/**
* 同意
*/
AGREE("同意"),
/**
* 驳回
*/
REJECT("驳回"),
/**
* 重新启动
*/
RESTART("重新启动"),
/**
* 重新提交
*/
RESUBMIT("重新提交"),
/**
* 撤回
*/
REVOKE("撤回"),
/**
* 转审
*/
REFERRAL("转审"),
/**
* 修改owner
*/
MODIFY_OWNER("修改owner"),
/**
* 作废
*/
ABORT("作废"),
/**
* 删除
*/
DELETE("删除"),
/**
* 未处理
*/
UNHANDLED("未处理"),
/**
* 进行中
*/
RUNNING("进行中"),
/**
* 已完成
*/
FINISHED("已完成"),
/**
* 取消
*/
CANCEL("取消");
private final String name;
ApprovalEnum(String name) {
this.name = name;
}
public String getName() {
return name;
}
}