Compare commits
No commits in common. "415e25cdd784c3b92498ca8b4778af6b5563b196" and "e44f6b8a0f1c15a096bcce36ff5478af61c9b3b7" have entirely different histories.
415e25cdd7
...
e44f6b8a0f
|
@ -1,22 +1,17 @@
|
||||||
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
|
||||||
|
@ -32,10 +27,8 @@ 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("C:\\Users\\Dzb\\Desktop\\a.enc", "D:\\\\ASE\\\\encryption\\\\解密测试文件2.txt");
|
// decryptFile("D:\\Temp\\test\\test\\caaaa", "D:\\Temp\\test\\test\\日报.xlsx");
|
||||||
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 {
|
||||||
|
@ -79,27 +72,4 @@ 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,180 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ 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;
|
||||||
|
@ -15,7 +14,6 @@ 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;
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,14 +108,14 @@ public class WorkFlowController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加工作流
|
* 添加工作流
|
||||||
* @param addRequestWorkFlow
|
* @param requestWorkFlow
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "添加工作流")
|
@ApiOperation(value = "添加工作流")
|
||||||
@PostMapping("/addWorkFlow")
|
@PostMapping("/addWorkFlow")
|
||||||
public AjaxResult addWorkFlow(@Valid @RequestBody AddRequestWorkFlow addRequestWorkFlow){
|
public AjaxResult addWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){
|
||||||
|
|
||||||
return workFlowService.addWorkFlow(addRequestWorkFlow);
|
return workFlowService.addWorkFlow(requestWorkFlow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -388,13 +388,6 @@
|
||||||
<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>
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,4 @@ 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";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,26 @@ 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 type;
|
private String functions;
|
||||||
/**
|
/**
|
||||||
* 参与活动
|
* 参与活动
|
||||||
*/
|
*/
|
||||||
|
@ -161,12 +175,17 @@ 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> typeList;
|
private List<String> styleList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,179 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工作流表
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.domain
|
|
||||||
* @Filename:WorkFlow
|
|
||||||
* @Description 工作流表
|
|
||||||
* @Version:1.0
|
|
||||||
* @Date:2025/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;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,92 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
||||||
/**工作流版本表
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.domain
|
|
||||||
* @Filename:WorkFlow
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/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;
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@ 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;
|
||||||
|
@ -19,7 +18,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface WorkFlowService extends IService<WorkFlow> {
|
public interface WorkFlowService extends IService<WorkFlow> {
|
||||||
AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo);
|
AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow);
|
||||||
|
|
||||||
void updateWorkFlow(RequestWorkFlow requestWorkFlow);
|
void updateWorkFlow(RequestWorkFlow requestWorkFlow);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ 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;
|
||||||
|
@ -69,10 +68,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) {
|
public AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow) {
|
||||||
|
|
||||||
RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
|
|
||||||
BeanUtil.copyProperties(addRequestWorkFlo, requestWorkFlow);
|
|
||||||
|
|
||||||
//获取封面图
|
//获取封面图
|
||||||
String filePath = requestWorkFlow.getWorkFlowVersionList().get(0).getFilePath();
|
String filePath = requestWorkFlow.getWorkFlowVersionList().get(0).getFilePath();
|
||||||
|
@ -307,16 +303,45 @@ 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.getType().split(",");
|
String[] split = workFlow.getTheme().split(",");
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
if (s != "") {
|
if (s != "") {
|
||||||
strings.add(DictInit.getDictValue(DictConstants.WORK_FLOW_TYPE_CHILD, s));
|
strings.add(DictInit.getDictValue(DictConstants.WORK_FLOW_THEME, workFlow.getCategory()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
workFlow.setTypeList(strings);
|
workFlow.setThemeList(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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue