需求:知识库文件操作增加审批电子流
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.sdm.common.entity.constants;
|
||||
|
||||
// 数字常量类,不单一代表某个含义
|
||||
public class NumberConstants {
|
||||
private NumberConstants() {
|
||||
throw new AssertionError("不能实例化常量类!");
|
||||
}
|
||||
|
||||
// int 类型常量
|
||||
public static final int ZERO = 0;
|
||||
public static final int ONE = 1;
|
||||
public static final int TWO = 2;
|
||||
public static final int THREE = 3;
|
||||
public static final int FOUR = 4;
|
||||
public static final int FIVE = 5;
|
||||
public static final int SIX = 6;
|
||||
public static final int SEVEN = 7;
|
||||
public static final int EIGHT = 8;
|
||||
public static final int NINE = 9;
|
||||
public static final int TEN = 10;
|
||||
|
||||
// String 类型常量
|
||||
public static final String ZERO_STR = "0";
|
||||
public static final String ONE_STR = "1";
|
||||
public static final String TWO_STR = "2";
|
||||
public static final String THREE_STR = "3";
|
||||
public static final String FOUR_STR = "4";
|
||||
public static final String FIVE_STR = "5";
|
||||
public static final String SIX_STR = "6";
|
||||
public static final String SEVEN_STR = "7";
|
||||
public static final String EIGHT_STR = "8";
|
||||
public static final String NINE_STR = "9";
|
||||
public static final String TEN_STR = "10";
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.sdm.common.entity.enums;
|
||||
|
||||
public enum ApprovalFileDataStatusEnum {
|
||||
/**
|
||||
* 待审批
|
||||
*/
|
||||
PENDING("pending", "待审批", 1),
|
||||
|
||||
/**
|
||||
* 已通过
|
||||
*/
|
||||
APPROVED("approved", "已通过", 2),
|
||||
|
||||
/**
|
||||
* 已拒绝
|
||||
*/
|
||||
REJECTED("rejected", "已拒绝", 3);
|
||||
|
||||
private final String key;
|
||||
private final String description;
|
||||
private final Integer code;
|
||||
|
||||
ApprovalFileDataStatusEnum(String key, String description, Integer code) {
|
||||
this.key = key;
|
||||
this.description = description;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key获取枚举
|
||||
*/
|
||||
public static ApprovalFileDataStatusEnum getByKey(String key) {
|
||||
for (ApprovalFileDataStatusEnum status : values()) {
|
||||
if (status.getKey().equals(key)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static ApprovalFileDataStatusEnum getByCode(Integer code) {
|
||||
for (ApprovalFileDataStatusEnum status : values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取key
|
||||
*/
|
||||
public static String getKeyByCode(Integer code) {
|
||||
ApprovalFileDataStatusEnum status = getByCode(code);
|
||||
return status != null ? status.getKey() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查key是否有效
|
||||
*/
|
||||
public static boolean isValid(String key) {
|
||||
return getByKey(key) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查code是否有效
|
||||
*/
|
||||
public static boolean isValidCode(Integer code) {
|
||||
return getByCode(code) != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.sdm.common.entity.enums;
|
||||
|
||||
public enum ApproveFileDataTypeEnum {
|
||||
/**
|
||||
* 审核完成
|
||||
*/
|
||||
COMPLETED(0, "审核完成"),
|
||||
|
||||
/**
|
||||
* 文件上传审核中
|
||||
*/
|
||||
UPLOAD_REVIEWING(1, "文件上传审核中"),
|
||||
|
||||
/**
|
||||
* 文件修改审核中
|
||||
*/
|
||||
MODIFY_REVIEWING(2, "文件修改审核中"),
|
||||
|
||||
/**
|
||||
* 文件删除审核中
|
||||
*/
|
||||
DELETE_REVIEWING(3, "文件删除审核中"),
|
||||
|
||||
/**
|
||||
* 文件元数据修改审核中
|
||||
*/
|
||||
MODIFY_METADATA_REVIEWING(4, "文件元数据修改审核中"),;
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
ApproveFileDataTypeEnum(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static ApproveFileDataTypeEnum getByCode(int code) {
|
||||
for (ApproveFileDataTypeEnum type : values()) {
|
||||
if (type.getCode() == code) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查code是否有效
|
||||
*/
|
||||
public static boolean isValid(int code) {
|
||||
return getByCode(code) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否为审核中状态
|
||||
*/
|
||||
public boolean isReviewing() {
|
||||
return this != COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有审核中的类型
|
||||
*/
|
||||
public static ApproveFileDataTypeEnum[] getReviewingTypes() {
|
||||
return new ApproveFileDataTypeEnum[]{UPLOAD_REVIEWING, MODIFY_REVIEWING, DELETE_REVIEWING,MODIFY_METADATA_REVIEWING};
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class LaunchApproveReq extends BaseBean {
|
||||
public long userId ;
|
||||
|
||||
@Schema(description = "审批创建者",defaultValue = "")
|
||||
public String creator;
|
||||
public long creator;
|
||||
|
||||
@Schema(description = "审批创建时间")
|
||||
public String createTime;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sdm.common.feign.impl.data;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -43,4 +44,20 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
return SdmResponse.failed("创建文件夹失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse approveDataFile(LaunchApproveReq req) {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = dataClient.approveDataFile(req);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("知识库文件审批状态修改失败");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("知识库文件审批状态修改异常", e);
|
||||
return SdmResponse.failed("知识库文件审批状态修改异常");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.common.feign.impl.system;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.feign.inter.system.IApproveFeignClient;
|
||||
@@ -7,7 +8,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ApproveFeignClientImpl implements IApproveFeignClient {
|
||||
@@ -15,8 +17,19 @@ public class ApproveFeignClientImpl implements IApproveFeignClient {
|
||||
@Autowired
|
||||
private IApproveFeignClient approveFeignClient;
|
||||
@Override
|
||||
public SdmResponse launchApproval(Map<String, String> hashHeader, LaunchApproveReq approveReq) {
|
||||
SdmResponse response = approveFeignClient.launchApproval(hashHeader, approveReq);
|
||||
public SdmResponse launchApproval( LaunchApproveReq approveReq) {
|
||||
|
||||
SdmResponse response=null ;
|
||||
try {
|
||||
response = approveFeignClient.launchApproval( approveReq);
|
||||
if(response==null||!response.isSuccess()){
|
||||
log.error("launchApproval failed response:{}", JSONObject.toJSONString(Optional.ofNullable(response)));
|
||||
return SdmResponse.failed("发起审批失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("launchApproval error response:{}", JSONObject.toJSONString(Optional.ofNullable(response)));
|
||||
return SdmResponse.failed("发起审批异常");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sdm.common.feign.impl.task;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.feign.inter.task.ISimuluationTaskPoolFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SimuluationTaskPoolFeignClientImpl implements ISimuluationTaskPoolFeignClient {
|
||||
|
||||
@Autowired
|
||||
private ISimuluationTaskPoolFeignClient simuluationTaskPoolFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public SdmResponse receiveApproveNotice(LaunchApproveReq req) {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = simuluationTaskPoolFeignClient.receiveApproveNotice(req);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("仿真地图审批状态修改失败");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("仿真地图审批状态修改异常", e);
|
||||
return SdmResponse.failed("仿真地图审批状态修改异常");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.sdm.common.feign.inter.data;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -19,4 +20,8 @@ public interface IDataFeignClient {
|
||||
|
||||
@PostMapping("/data/createDir")
|
||||
SdmResponse createDir(@RequestBody @Validated CreateDirReq req);
|
||||
|
||||
@PostMapping("/data/approveDataFile")
|
||||
SdmResponse approveDataFile(@RequestBody LaunchApproveReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,8 @@ import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
import java.util.Map;
|
||||
@FeignClient(name = "system",contextId = "systemApproveClient")
|
||||
public interface IApproveFeignClient {
|
||||
@PostMapping("/systemApprove/launchApprove")
|
||||
public SdmResponse launchApproval(@RequestHeader Map<String,String> hashHeader, @RequestBody LaunchApproveReq approveReq);
|
||||
public SdmResponse launchApproval( @RequestBody LaunchApproveReq approveReq);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.sdm.common.feign.inter.task;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(name = "taskpool")
|
||||
public interface ISimuluationTaskPoolFeignClient {
|
||||
|
||||
@PostMapping("/taskpool/approveHandleNotice")
|
||||
SdmResponse receiveApproveNotice(@RequestBody LaunchApproveReq req);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user