|
@@ -1,6 +1,8 @@
|
|
|
package cn.tr.module.export.bean;
|
|
package cn.tr.module.export.bean;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import cn.tr.module.export.enums.ExportType;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NoArgsConstructor;
|
|
@@ -12,16 +14,24 @@ import lombok.NoArgsConstructor;
|
|
|
* @Date: 2023年06月15日
|
|
* @Date: 2023年06月15日
|
|
|
*/
|
|
*/
|
|
|
@Data
|
|
@Data
|
|
|
-@AllArgsConstructor(staticName = "of")
|
|
|
|
|
|
|
+@AllArgsConstructor
|
|
|
@NoArgsConstructor
|
|
@NoArgsConstructor
|
|
|
public class ExportResult {
|
|
public class ExportResult {
|
|
|
private String fileName;
|
|
private String fileName;
|
|
|
private String base64;
|
|
private String base64;
|
|
|
-
|
|
|
|
|
|
|
+ private ExportType type;
|
|
|
public String getFileName() {
|
|
public String getFileName() {
|
|
|
- if (StrUtil.endWith(fileName, ".xlsx")) {
|
|
|
|
|
|
|
+ if(CollectionUtil.size(StrUtil.split(fileName,"."))>2){
|
|
|
return fileName;
|
|
return fileName;
|
|
|
}
|
|
}
|
|
|
- return fileName+".xlsx";
|
|
|
|
|
|
|
+ return fileName+type.getSuffix();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static ExportResult of(String fileName,String base64){
|
|
|
|
|
+ return new ExportResult(fileName,base64,ExportType.EXCEL);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static ExportResult of(String fileName,String base64,ExportType type){
|
|
|
|
|
+ return new ExportResult(fileName,base64,type);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|