工作流新增校验

文件加密/解密
文件加密上传oss
master
Diyu0904 2025-02-07 13:55:53 +08:00
parent 6dedc5a170
commit 7b99089c67
11 changed files with 553 additions and 67 deletions

View File

@ -1,17 +1,22 @@
package com.mcwl.web.controller.resource; package com.mcwl.web.controller.resource;
import com.mcwl.web.controller.common.OssUtil;
import org.springframework.mock.web.MockMultipartFile;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.CipherInputStream; import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream; import javax.crypto.CipherOutputStream;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.security.AlgorithmParameters; import java.security.AlgorithmParameters;
import java.util.Base64; import java.util.Base64;
/** /**
*
* @author DaiZibo * @author DaiZibo
* @date 2025/1/25 * @date 2025/1/25
* @apiNote * @apiNote
@ -27,8 +32,10 @@ public class FileEncryptDecryptUtil {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// 示例:加密文件 // 示例:加密文件
encryptFile("D:\\ASE\\encryption\\测试文件1.txt", "D:\\ASE\\decode\\加密测试文件1.txt"); encryptFile("D:\\ASE\\encryption\\测试文件1.txt", "D:\\ASE\\decode\\加密测试文件1.txt");
// 解密文件 //// 解密文件
// decryptFile("D:\\Temp\\test\\test\\caaaa", "D:\\Temp\\test\\test\\日报.xlsx"); decryptFile("C:\\Users\\Dzb\\Desktop\\a.enc", "D:\\\\ASE\\\\encryption\\\\解密测试文件2.txt");
uploadEncryptedFileToOSS("D:\\ASE\\encryption\\测试文件1.txt", "encrypted-test-file1.enc");
} }
public static void encryptFile(String sourcePath, String encryptedPath) throws Exception { public static void encryptFile(String sourcePath, String encryptedPath) throws Exception {
@ -72,4 +79,27 @@ public class FileEncryptDecryptUtil {
} }
return cipher; return cipher;
} }
public static void uploadEncryptedFileToOSS(String sourcePath, String ossFileName) throws Exception {
Cipher cipher = initCipher(Cipher.ENCRYPT_MODE);
// 使用ByteArrayOutputStream代替FileOutputStream
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try (FileInputStream fis = new FileInputStream(sourcePath);
CipherInputStream cis = new CipherInputStream(fis, cipher)) {
byte[] buffer = new byte[1024];
int read;
while ((read = cis.read(buffer)) != -1) {
bos.write(buffer, 0, read);
}
}
System.out.println("加密完成");
// 将加密后的字节数组转换为MultipartFile
MockMultipartFile multipartFile = new MockMultipartFile(ossFileName, ossFileName, "application/octet-stream", bos.toByteArray());
// 调用上传方法
String s = OssUtil.uploadMultipartFile(multipartFile);
System.out.println("文件已上传至: " + s);
}
} }

View File

@ -0,0 +1,180 @@
package com.mcwl.web.controller.resource;
import com.mcwl.web.controller.common.OssUtil;
import org.springframework.mock.web.MockMultipartFile;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.AlgorithmParameters;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
/**
* @author DaiZibo
* @date 2025/2/5
* @apiNote
*/
public class Test {
private static final String ALGORITHM = "AES/CBC/PKCS5Padding";
private static final String TRANSFORMATION = "AES";
private static final String KEY = "iamkeyeeddzasdfs";
private static byte[] SAVED_IV; // 静态变量存储IV确保解密时可访问
// iv=gHauCGwTlX/mgXrvTUCifQ==, key=aWFta2V5ZWVkZHphc2Rmcw==
public static void main(String[] args) throws Exception {
// 示例:加密文件并获取密钥
// Map<String, String> stringStringMap = encryptFile("D:\\ASE\\encryption\\测试文件1.txt", "D:\\ASE\\decode\\加密测试文件1.txt");
// System.out.println("-------------------"+keyBase64);
// System.out.println("Encryption Key: " + keyBase64);
//
// // 使用上面得到的密钥解密文件
decryptFile("C:\\Users\\Dzb\\Desktop\\a.enc", "D:\\ASE\\encryption\\解密测试文件3.txt","aWFta2V5ZWVkZHphc2Rmcw==","gHauCGwTlX/mgXrvTUCifQ==");
// Map<String, String> stringStringMap = uploadEncryptedFileToOSS("D:\\ASE\\encryption\\测试文件1.txt", "encrypted-test-file1.enc");
// System.out.println("-------------"+stringStringMap);
}
public static Map<String, String> encryptFile(String sourcePath, String encryptedPath) throws Exception {
Cipher cipher = initCipher(Cipher.ENCRYPT_MODE);
try (FileInputStream fis = new FileInputStream(sourcePath);
FileOutputStream fos = new FileOutputStream(encryptedPath);
CipherOutputStream cos = new CipherOutputStream(fos, cipher)) {
byte[] buffer = new byte[1024];
int read;
while ((read = fis.read(buffer)) != -1) {
cos.write(buffer, 0, read);
}
}
System.out.println("加密完成");
SecretKey secretKey = new SecretKeySpec(KEY.getBytes(), TRANSFORMATION);
Map<String, String> result = new HashMap<>();
result.put("key", Base64.getEncoder().encodeToString(secretKey.getEncoded()));
result.put("iv", Base64.getEncoder().encodeToString(SAVED_IV));
return result;
}
// public static void decryptFile(String encryptedPath, String decryptedPath, String keyBase64) throws Exception {
// byte[] keyBytes = Base64.getDecoder().decode(keyBase64);
// SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, TRANSFORMATION);
// Cipher cipher = initCipher(Cipher.DECRYPT_MODE, secretKeySpec);
//
// try (FileInputStream fis = new FileInputStream(encryptedPath);
// CipherInputStream cis = new CipherInputStream(fis, cipher);
// FileOutputStream fos = new FileOutputStream(decryptedPath)) {
// byte[] buffer = new byte[1024];
// int read;
// while ((read = cis.read(buffer)) != -1) {
// fos.write(buffer, 0, read);
// }
// }
// System.out.println("解密完成");
// }
public static void decryptFile(String encryptedPath, String decryptedPath, String keyBase64, String ivBase64) throws Exception {
byte[] keyBytes = Base64.getDecoder().decode(keyBase64);
byte[] ivBytes = Base64.getDecoder().decode(ivBase64);
SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, TRANSFORMATION);
IvParameterSpec ivParameterSpec = new IvParameterSpec(ivBytes);
Cipher cipher = initCipher(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
try (FileInputStream fis = new FileInputStream(encryptedPath);
CipherInputStream cis = new CipherInputStream(fis, cipher);
FileOutputStream fos = new FileOutputStream(decryptedPath)) {
byte[] buffer = new byte[1024];
int read;
while ((read = cis.read(buffer)) != -1) {
fos.write(buffer, 0, read);
}
}
System.out.println("解密完成");
}
// private static Cipher initCipher(int mode) throws Exception {
//// return initCipher(mode, null);
//// }
////
//// private static Cipher initCipher(int mode, SecretKeySpec secretKeySpec) throws Exception {
//// Cipher cipher = Cipher.getInstance(ALGORITHM);
//// if (secretKeySpec == null) {
//// secretKeySpec = new SecretKeySpec(KEY.getBytes(), TRANSFORMATION);
//// }
//// if (mode == Cipher.ENCRYPT_MODE && SAVED_IV == null) {
//// cipher.init(mode, secretKeySpec);
//// AlgorithmParameters params = cipher.getParameters();
//// SAVED_IV = params.getParameterSpec(IvParameterSpec.class).getIV();
//// System.out.println("Generated IV: " + Base64.getEncoder().encodeToString(SAVED_IV));
//// } else {
//// cipher.init(mode, secretKeySpec, new IvParameterSpec(SAVED_IV));
//// }
//// return cipher;
//// }
private static Cipher initCipher(int mode, SecretKeySpec secretKeySpec, IvParameterSpec ivParameterSpec) throws Exception {
Cipher cipher = Cipher.getInstance(ALGORITHM);
if (secretKeySpec == null){
secretKeySpec = new SecretKeySpec(KEY.getBytes(), TRANSFORMATION);
}
if (mode == Cipher.ENCRYPT_MODE) {
cipher.init(mode, secretKeySpec);
AlgorithmParameters params = cipher.getParameters();
SAVED_IV = params.getParameterSpec(IvParameterSpec.class).getIV();
System.out.println("Generated IV: " + Base64.getEncoder().encodeToString(SAVED_IV));
} else {
cipher.init(mode, secretKeySpec, ivParameterSpec);
}
return cipher;
}
private static Cipher initCipher(int mode) throws Exception {
return initCipher(mode, null, null);
}
private static Cipher initCipher(int mode, SecretKeySpec secretKeySpec) throws Exception {
return initCipher(mode, secretKeySpec, null);
}
public static Map<String, String> uploadEncryptedFileToOSS(String sourcePath, String ossFileName) throws Exception {
Cipher cipher = initCipher(Cipher.ENCRYPT_MODE);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try (FileInputStream fis = new FileInputStream(sourcePath);
CipherInputStream cis = new CipherInputStream(fis, cipher)) {
byte[] buffer = new byte[1024];
int read;
while ((read = cis.read(buffer)) != -1) {
bos.write(buffer, 0, read);
}
}
System.out.println("加密完成");
// 将加密后的字节数组转换为MultipartFile
MockMultipartFile multipartFile = new MockMultipartFile(ossFileName, ossFileName, "application/octet-stream", bos.toByteArray());
// 调用上传方法
String uploadedUrl = OssUtil.uploadMultipartFile(multipartFile);
Map<String, String> result = new HashMap<>();
result.put("uploadedUrl", uploadedUrl);
SecretKey secretKey = new SecretKeySpec(KEY.getBytes(), TRANSFORMATION);
result.put("key",Base64.getEncoder().encodeToString(secretKey.getEncoded()));
result.put("iv", Base64.getEncoder().encodeToString(SAVED_IV));
return result;
}
}

View File

@ -3,6 +3,7 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.impl.WorkFlowServiceImpl; import com.mcwl.resource.service.impl.WorkFlowServiceImpl;
@ -14,6 +15,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.util.List; import java.util.List;
@ -108,14 +110,14 @@ public class WorkFlowController extends BaseController {
/** /**
* *
* @param requestWorkFlow * @param addRequestWorkFlow
* @return * @return
*/ */
@ApiOperation(value = "添加工作流") @ApiOperation(value = "添加工作流")
@PostMapping("/addWorkFlow") @PostMapping("/addWorkFlow")
public AjaxResult addWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){ public AjaxResult addWorkFlow(@Valid @RequestBody AddRequestWorkFlow addRequestWorkFlow){
return workFlowService.addWorkFlow(requestWorkFlow); return workFlowService.addWorkFlow(addRequestWorkFlow);
} }
/** /**

View File

@ -382,6 +382,13 @@
<version>2.6</version> <version>2.6</version>
</dependency> </dependency>
<!-- Spring Test Dependency for MockMultipartFile -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.25</version> <!-- 请确保与 spring-web 使用相同的主要版本 -->
</dependency>
</dependencies> </dependencies>

View File

@ -56,4 +56,9 @@ public class DictConstants {
*/ */
public static final String IMAGE_LABEL = "image_label"; public static final String IMAGE_LABEL = "image_label";
/**
*
*/
public static final String WORK_FLOW_TYPE_CHILD = "work_flow_type_child";
} }

View File

@ -49,26 +49,12 @@ public class WorkFlow {
*/ */
@ApiModelProperty(value = "名称最多30字") @ApiModelProperty(value = "名称最多30字")
private String workflowName; private String workflowName;
/**
*
*/
@ApiModelProperty(value = "垂类")
private String category;
/**
*
*/
@ApiModelProperty(value = "主题")
private String theme;
/**
*
*/
@ApiModelProperty(value = "风格")
private String style;
/** /**
* *
*/ */
@ApiModelProperty(value = "功能") @ApiModelProperty(value = "类别")
private String functions; private String type;
/** /**
* *
*/ */
@ -175,17 +161,12 @@ public class WorkFlow {
@ApiModelProperty(value = "作品点赞数量") @ApiModelProperty(value = "作品点赞数量")
private Integer likeCount = 0; private Integer likeCount = 0;
/**
*
*/
@ApiModelProperty(value = "翻译后主体")
@TableField(exist = false)
private List<String> themeList;
/** /**
* *
*/ */
@ApiModelProperty(value = "翻译后风格") @ApiModelProperty(value = "翻译后类别")
@TableField(exist = false) @TableField(exist = false)
private List<String> styleList; private List<String> typeList;
} }

View File

@ -0,0 +1,34 @@
package com.mcwl.resource.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.Valid;
import java.util.List;
/**
* +
*
* @author DaiZibo
* @date 2025/1/9
* @apiNote
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel(description = "工作流入参 工作流+版本")
public class AddRequestWorkFlow {
@ApiModelProperty(value = "工作流信息")
@Valid
private AddWorkFlow addWorkFlow;
@Valid
@ApiModelProperty(value = "工作流版本信息")
private List<AddWorkFlowVersion> addWorkFlowVersions;
}

View File

@ -0,0 +1,179 @@
package com.mcwl.resource.domain.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
*
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.domain
* @FilenameWorkFlow
* @Description
* @Version1.0
* @Date2025/1/8 19:38
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName("work_flow")
@ApiModel(description = "工作流表")
public class AddWorkFlow {
/**
* ID
*/
@ApiModelProperty(value = "主键ID")
@TableId
private Long id;
/**
* id
*/
@ApiModelProperty(value = "用户id")
private Long userId;
/**
* 30
*/
@ApiModelProperty(value = "名称最多30字")
@NotBlank(message = "名称不能为空")
@Size(max = 30,message = "名称最多30字")
private String workflowName;
/**
*
*/
@ApiModelProperty(value = "类别")
private String type;
/**
*
*/
@ApiModelProperty(value = "参与活动")
private String activityParticipation;
/**
* 0 2
*/
@ApiModelProperty(value = "删除标志0代表存在 2代表删除")
private Integer delFlag;
/**
* 0 1- 2- 3 4
*/
@ApiModelProperty(value = "审核状态0全部状态 1已发布-公开 2已发布-仅自己可见 3审核中 4审核未通过")
private Integer auditStatus = 3;
/**
*
*/
@ApiModelProperty(value = "审核失败原因")
private String auditText;
/**
*
*/
@ApiModelProperty(value = "是否原创")
@NotNull(message = "是否公开原创必选")
private Integer original;
/**
*
*/
@ApiModelProperty(value = "原文作者名字")
private String authorName;
/**
* 使
*/
@ApiModelProperty(value = "使用数量")
private Long useNumber = 0L;
/**
*
*/
@ApiModelProperty(value = "下载数量")
private Long downloadNumber = 0L;
/**
* 线使(0 1)
*/
@ApiModelProperty(value = "是否允许在线使用(0允许 1不允许)")
private Integer onlineUse;
/**
* (0 1)
*/
@ApiModelProperty(value = "是否允许下载工作流(0允许 1不允许)")
private Integer download;
/**
* (0 1
*/
@ApiModelProperty(value = "是否允许出售或商用(0允许 1不允许)")
private Integer sell;
/**
*
*/
@ApiModelProperty(value = "封面图地址")
private String coverPath;
/**
*
*/
@ApiModelProperty(value = "审核权限")
@NotNull(message = "是否公开必选")
private Integer jurisdiction;
/**
*
*/
@ApiModelProperty(value = "是否置顶")
private Integer isTop;
/**
*
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date createTime;
/**
*
*/
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date updateTime;
/**
*
*/
@ApiModelProperty(value = "作品点赞数量")
private Integer likeCount = 0;
/**
*
*/
@ApiModelProperty(value = "翻译后类别")
@TableField(exist = false)
private List<String> typeList;
}

View File

@ -0,0 +1,92 @@
package com.mcwl.resource.domain.dto;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.domain
* @FilenameWorkFlow
* @Description TODO
* @Date2025/1/8 19:38
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel(description = "工作流版本表")
@TableName("work_flow_version")
public class AddWorkFlowVersion {
/**
* ID
*/
@TableId
@ApiModelProperty("主键ID")
private Long id;
/**
*
*/
@ApiModelProperty("版本名称")
@NotBlank(message = "版本名称不能为空")
private String versionName;
/**
*
*/
@ApiModelProperty("版本介绍(富文本)")
@NotBlank(message = "版本介绍不能为空")
private String versionDescription;
/**
*
*/
@ApiModelProperty("文件地址")
@NotBlank(message = "请上传文件")
private String filePath;
/**
* 20,
*/
@ApiModelProperty("图片地址最多20张,切割)")
@NotBlank(message = "图片至少上传一张")
private String imagePaths;
/**
*
*/
@ApiModelProperty("是否隐藏图片生成信息")
private Integer hideGenInfo;
/**
* 0 2
*/
@ApiModelProperty("删除标志0代表存在 2代表删除")
private String delFlag;
/**
* 0 1- 2- 3 4
*/
@ApiModelProperty("审核状态0全部状态 1已发布-公开 2已发布-仅自己可见 3审核中 4审核未通过")
private Integer auditStatus = 3;
/**
*
*/
@ApiModelProperty("审核失败原因")
private String auditText;
/**
* ID
*/
@ApiModelProperty("模型ID")
private Long workFlowId;
/**
*
*/
@ApiModelProperty("文件名字")
private String fileName;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.dto.ModelImagePageRes; import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
@ -18,7 +19,7 @@ import java.util.List;
*/ */
public interface WorkFlowService extends IService<WorkFlow> { public interface WorkFlowService extends IService<WorkFlow> {
AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow); AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo);
void updateWorkFlow(RequestWorkFlow requestWorkFlow); void updateWorkFlow(RequestWorkFlow requestWorkFlow);

View File

@ -19,6 +19,7 @@ import com.mcwl.common.utils.StringUtils;
import com.mcwl.common.utils.baidu.BaiduCensor; import com.mcwl.common.utils.baidu.BaiduCensor;
import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.WorkFlowVersion; import com.mcwl.resource.domain.WorkFlowVersion;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.dto.ModelImagePageRes; import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
@ -67,7 +68,10 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
@Override @Override
public AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow) { public AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) {
RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
BeanUtil.copyProperties(addRequestWorkFlo, requestWorkFlow);
//获取封面图 //获取封面图
String filePath = requestWorkFlow.getWorkFlowVersionList().get(0).getFilePath(); String filePath = requestWorkFlow.getWorkFlowVersionList().get(0).getFilePath();
@ -302,45 +306,16 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
if (type == 1){ if (type == 1){
String category = workFlow.getCategory(); //类别
//翻译属性 垂类 if (StringUtils.isNotEmpty(workFlow.getType())) {
if (StringUtils.isNotEmpty(category)) {
workFlow.setCategory(DictInit.getDictValue(DictConstants.MODEL_CHILD_CATEGORY, workFlow.getCategory()));
}
//主体
String theme = workFlow.getTheme();
if (StringUtils.isNotEmpty(theme)) {
ArrayList<String> strings = new ArrayList<>(); ArrayList<String> strings = new ArrayList<>();
String[] split = workFlow.getTheme().split(","); String[] split = workFlow.getType().split(",");
for (String s : split) { for (String s : split) {
if (s != "") { if (s != "") {
strings.add(DictInit.getDictValue(DictConstants.WORK_FLOW_THEME, workFlow.getCategory())); strings.add(DictInit.getDictValue(DictConstants.WORK_FLOW_TYPE_CHILD, s));
} }
} }
workFlow.setThemeList(strings); workFlow.setTypeList(strings);
}
//风格
if (StringUtils.isNotEmpty(workFlow.getStyle())) {
ArrayList<String> strings = new ArrayList<>();
String[] split = workFlow.getStyle().split(",");
for (String s : split) {
if (s != "") {
strings.add(DictInit.getDictValue(DictConstants.WORK_FLOW_STYLE, workFlow.getStyle()));
}
}
workFlow.setStyleList(strings);
}
//功能
if (StringUtils.isNotEmpty(workFlow.getFunctions())) {
workFlow.setCategory(DictInit.getDictValue(DictConstants.WORK_FLOW_FUNCTIONS, workFlow.getFunctions()));
}
//活动
if (StringUtils.isNotEmpty(workFlow.getActivityParticipation())) {
workFlow.setActivityParticipation(toActivityService.getById(workFlow.getActivityParticipation()).getActivityName());
} }
} }