优化代码
This commit is contained in:
parent
284dea6a98
commit
2d43880a51
|
|
@ -690,8 +690,7 @@ public class CommonService {
|
||||||
return ElectromagneticResultUtil.success(Optional.ofNullable(finalEdFileInfo).map(EdFileInfo::getId).orElse(""));
|
return ElectromagneticResultUtil.success(Optional.ofNullable(finalEdFileInfo).map(EdFileInfo::getId).orElse(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
private EdFileInfo handUploadRepeatFile(String parentId, MultipartFile file, Integer strategy, int dataOwnCode) throws IOException {
|
||||||
public EdFileInfo handUploadRepeatFile(String parentId, MultipartFile file, Integer strategy, int dataOwnCode) throws IOException {
|
|
||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
String mainName = FileUtil.mainName(fileName);
|
String mainName = FileUtil.mainName(fileName);
|
||||||
String suffix = FileUtil.getSuffix(fileName);
|
String suffix = FileUtil.getSuffix(fileName);
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,6 @@ import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否删除枚举
|
* 是否删除枚举
|
||||||
*
|
|
||||||
* @author zhangxiong.pt
|
|
||||||
* @version $Id: EffectFlagEnum.java, v 0.1 2024-08-01 18:18
|
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum EffectFlagEnum {
|
public enum EffectFlagEnum {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@ package com.electromagnetic.industry.software.common.enums;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum FileRepeatEnum {
|
public enum FileRepeatEnum {
|
||||||
|
|
||||||
|
|
@ -12,22 +16,19 @@ public enum FileRepeatEnum {
|
||||||
public int code;
|
public int code;
|
||||||
public String desc;
|
public String desc;
|
||||||
|
|
||||||
public static String getDesc(int code) {
|
private static final Map<Integer, FileRepeatEnum> MAP = new HashMap<>();
|
||||||
|
static {
|
||||||
for (FileRepeatEnum e : FileRepeatEnum.values()) {
|
for (FileRepeatEnum e : FileRepeatEnum.values()) {
|
||||||
if (e.code == code) {
|
MAP.put(e.code, e);
|
||||||
return e.desc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
|
public static String getDesc(int code) {
|
||||||
|
return Optional.ofNullable(MAP.get(code)).map(e -> e.desc).orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean contains(int code) {
|
public static boolean contains(int code) {
|
||||||
for (FileRepeatEnum e : FileRepeatEnum.values()) {
|
return MAP.containsKey(code);
|
||||||
if (e.code == code) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue