From ed4a5236bab800094be4a8378f5098eebe3de6ac Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 04 四月 2024 23:30:30 +0800
Subject: [PATCH] 清楚不不要的mapstruct文件
---
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SystemResourceServiceImpl.java | 92 ++++++++++++++++++++-------------------------
1 files changed, 41 insertions(+), 51 deletions(-)
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SystemResourceServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SystemResourceServiceImpl.java
index a73003e..867d996 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SystemResourceServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SystemResourceServiceImpl.java
@@ -1,24 +1,27 @@
package com.qianwen.smartman.modules.resource.service.impl;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.io.File;
-import java.lang.invoke.SerializedLambda;
+import java.io.IOException;
+
import org.apache.commons.io.FileUtils;
-import com.qianwen.smartman.common.constant.ExcelConstant;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qianwen.core.excel.util.ExcelUtil;
import com.qianwen.core.oss.model.BladeFile;
import com.qianwen.core.tool.utils.FileUtil;
import com.qianwen.core.tool.utils.Func;
+import com.qianwen.smartman.common.constant.ExcelConstant;
import com.qianwen.smartman.modules.resource.builder.oss.OssBuilder;
import com.qianwen.smartman.modules.resource.convert.AttachConvert;
import com.qianwen.smartman.modules.resource.entity.Attach;
import com.qianwen.smartman.modules.resource.enums.TemplateEnum;
import com.qianwen.smartman.modules.resource.service.IAttachService;
import com.qianwen.smartman.modules.resource.service.ISystemResourceService;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
+
+import me.zhyd.oauth.log.Log;
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/resource/service/impl/SystemResourceServiceImpl.class */
@@ -26,28 +29,6 @@
private final OssBuilder ossBuilder;
private final IAttachService attachService;
- private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
- String implMethodName = lambda.getImplMethodName();
- boolean z = true;
- switch (implMethodName.hashCode()) {
- case -530662798:
- if (implMethodName.equals("getOriginalName")) {
- z = false;
- break;
- }
- break;
- }
- switch (z) {
- case false:
- if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/resource/entity/Attach") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
- return (v0) -> {
- return v0.getOriginalName();
- };
- }
- break;
- }
- throw new IllegalArgumentException("Invalid lambda deserialization");
- }
public SystemResourceServiceImpl(final OssBuilder ossBuilder, final IAttachService attachService) {
this.ossBuilder = ossBuilder;
@@ -56,27 +37,36 @@
@Override // org.springblade.modules.resource.service.ISystemResourceService
public BladeFile getBusinessTemplateInfo(TemplateEnum templateEnum) {
- String fileName = templateEnum.getFileName() + ExcelConstant.SUFFIX;
- Attach target = (Attach) this.attachService.getOne((Wrapper) new QueryWrapper().lambda().eq((v0) -> {
- return v0.getOriginalName();
- }, fileName));
- if (!Func.isEmpty(target)) {
- return AttachConvert.INSTANCE.convert(target);
- }
- ClassPathResource classPathResource = new ClassPathResource(ExcelConstant.DIRECTORY + fileName);
- File file = new File(System.getProperty("java.io.tmpdir") + "/" + fileName);
- FileUtils.copyToFile(classPathResource.getInputStream(), file);
- MultipartFile multipartFile = ExcelUtil.fileToMultipartFile(file);
- BladeFile bladeFile = this.ossBuilder.systemTemplate().putFile(fileName, multipartFile);
- String fileExtension = FileUtil.getFileExtension(fileName);
- Attach attach = new Attach();
- attach.setDomainName(bladeFile.getDomain());
- attach.setLink(bladeFile.getLink());
- attach.setName(bladeFile.getName());
- attach.setOriginalName(bladeFile.getOriginalName());
- attach.setAttachSize(Long.valueOf(multipartFile.getSize()));
- attach.setExtension(fileExtension);
- this.attachService.save(attach);
- return bladeFile;
+ try {
+ String fileName = templateEnum.getFileName() + ExcelConstant.SUFFIX;
+ Attach target = this.attachService.getOne((new QueryWrapper<Attach>()).lambda().eq(Attach::getOriginalName, fileName));
+ /*
+ Attach target = (Attach) this.attachService.getOne((Wrapper) new QueryWrapper().lambda().eq((v0) -> {
+ return v0.getOriginalName();
+ }, fileName));*/
+ if (!Func.isEmpty(target)) {
+ return AttachConvert.INSTANCE.convert(target);
+ }
+ ClassPathResource classPathResource = new ClassPathResource(ExcelConstant.DIRECTORY + fileName);
+ File file = new File(System.getProperty("java.io.tmpdir") + "/" + fileName);
+
+ FileUtils.copyToFile(classPathResource.getInputStream(), file);
+
+ MultipartFile multipartFile = ExcelUtil.fileToMultipartFile(file);
+ BladeFile bladeFile = this.ossBuilder.systemTemplate().putFile(fileName, multipartFile);
+ String fileExtension = FileUtil.getFileExtension(fileName);
+ Attach attach = new Attach();
+ attach.setDomainName(bladeFile.getDomain());
+ attach.setLink(bladeFile.getLink());
+ attach.setName(bladeFile.getName());
+ attach.setOriginalName(bladeFile.getOriginalName());
+ attach.setAttachSize(Long.valueOf(multipartFile.getSize()));
+ attach.setExtension(fileExtension);
+ this.attachService.save(attach);
+ return bladeFile;
+ } catch (IOException e) {
+ Log.error("鑾峰彇涓氬姟妯℃澘澶辫触",e);
+ throw new RuntimeException(e);
+ }
}
}
--
Gitblit v1.9.3