yangys
2024-04-01 c323e4ce593a886412bac2403a922ae2bf629655
resource模块修复
已修改7个文件
558 ■■■■ 文件已修改
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/builder/oss/OssBuilder.java 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/builder/sms/SmsBuilder.java 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/controller/OssController.java 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/endpoint/OssEndpointController.java 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/OssServiceImpl.java 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SmsServiceImpl.java 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SystemResourceServiceImpl.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/builder/oss/OssBuilder.java
@@ -1,12 +1,10 @@
package com.qianwen.smartman.modules.resource.builder.oss;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.lang.invoke.SerializedLambda;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.qianwen.smartman.common.constant.ExtCacheConstant;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.qianwen.core.cache.utils.CacheUtil;
import com.qianwen.core.log.exception.ServiceException;
import com.qianwen.core.oss.OssTemplate;
@@ -16,10 +14,12 @@
import com.qianwen.core.oss.rule.BladeOssRule;
import com.qianwen.core.oss.rule.OssRule;
import com.qianwen.core.redis.cache.BladeRedis;
import com.qianwen.core.tenant.mp.TenantEntity;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.core.tool.utils.SpringUtil;
import com.qianwen.core.tool.utils.StringUtil;
import com.qianwen.core.tool.utils.WebUtil;
import com.qianwen.smartman.common.constant.ExtCacheConstant;
import com.qianwen.smartman.modules.resource.entity.Oss;
import com.qianwen.smartman.modules.resource.enums.BucketEnum;
import com.qianwen.smartman.modules.resource.service.IOssService;
@@ -33,56 +33,7 @@
    private final OssProperties ossProperties;
    private final IOssService ossService;
    private final Map<String, OssTemplate> templatePool = new ConcurrentHashMap();
    private final Map<String, Oss> ossPool = new ConcurrentHashMap();
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -128783002:
                if (implMethodName.equals("getOssCode")) {
                    z = false;
                    break;
                }
                break;
            case 771206363:
                if (implMethodName.equals("getTenantId")) {
                    z = true;
                    break;
                }
                break;
            case 803533544:
                if (implMethodName.equals("getStatus")) {
                    z = true;
                    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/Oss") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getOssCode();
                    };
                }
                break;
            case true:
                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/core/tenant/mp/TenantEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTenantId();
                    };
                }
                break;
            case true:
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getStatus();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
    private final Map<String, Oss> ossPool = new ConcurrentHashMap<>();
    public OssBuilder(OssProperties ossProperties, IOssService ossService) {
        this.ossProperties = ossProperties;
@@ -189,23 +140,30 @@
    public Oss getOss(String tenantId, String code) {
        String key = Func.isBlank(tenantId) ? "000000" : tenantId;
        LambdaQueryWrapper<Oss> lqw = Wrappers.<Oss>query().lambda().eq(Oss::getTenantId, tenantId);
        /*
        Wrapper wrapper = (LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> {
            return v0.getTenantId();
        }, tenantId);
        }, tenantId);*/
        String ossCode = StringUtil.isBlank(code) ? WebUtil.getParameter("code") : code;
        if (StringUtil.isNotBlank(ossCode)) {
            key = key.concat("-").concat(ossCode);
            lqw.eq(Oss::getOssCode, ossCode);
            /*
            wrapper.eq((v0) -> {
                return v0.getOssCode();
            }, ossCode);
            }, ossCode);*/
        } else {
            lqw.eq(Oss::getStatus, Integer.valueOf(OssStatusEnum.ENABLE.getNum()));
            /*
            wrapper.eq((v0) -> {
                return v0.getStatus();
            }, Integer.valueOf(OssStatusEnum.ENABLE.getNum()));
            }, Integer.valueOf(OssStatusEnum.ENABLE.getNum()));*/
        }
        Oss oss = (Oss) CacheUtil.get("blade:resource", OSS_CODE, key, ExtCacheConstant.TENANT_MODE);
        if (Func.isEmpty(oss)) {
            oss = (Oss) this.ossService.getOne(wrapper);
            oss = this.ossService.getOne(lqw);
            String redisKey = "blade:resource".concat("::").concat(OSS_CODE).concat(tenantId);
            getBladeRedis().setEx(redisKey, oss, ExtCacheConstant.FIVE_MINUTES_EXPIRE_TIME);
        }
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/builder/sms/SmsBuilder.java
@@ -1,11 +1,10 @@
package com.qianwen.smartman.modules.resource.builder.sms;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.lang.invoke.SerializedLambda;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.qianwen.smartman.common.constant.ExtCacheConstant;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.qianwen.core.cache.utils.CacheUtil;
import com.qianwen.core.log.exception.ServiceException;
import com.qianwen.core.redis.cache.BladeRedis;
@@ -18,6 +17,7 @@
import com.qianwen.core.tool.utils.Func;
import com.qianwen.core.tool.utils.StringUtil;
import com.qianwen.core.tool.utils.WebUtil;
import com.qianwen.smartman.common.constant.ExtCacheConstant;
import com.qianwen.smartman.modules.resource.entity.Sms;
import com.qianwen.smartman.modules.resource.service.ISmsService;
@@ -30,55 +30,6 @@
    private final BladeRedis bladeRedis;
    private final Map<String, SmsTemplate> templatePool = new ConcurrentHashMap();
    private final Map<String, Sms> smsPool = new ConcurrentHashMap();
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -1045510480:
                if (implMethodName.equals("getSmsCode")) {
                    z = true;
                    break;
                }
                break;
            case 771206363:
                if (implMethodName.equals("getTenantId")) {
                    z = false;
                    break;
                }
                break;
            case 803533544:
                if (implMethodName.equals("getStatus")) {
                    z = true;
                    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/core/tenant/mp/TenantEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTenantId();
                    };
                }
                break;
            case true:
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getStatus();
                    };
                }
                break;
            case true:
                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/Sms") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getSmsCode();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
    public SmsBuilder(SmsProperties smsProperties, ISmsService smsService, BladeRedis bladeRedis) {
        this.smsProperties = smsProperties;
@@ -120,9 +71,11 @@
    public Sms getSms(String tenantId, String code) {
        String key = tenantId;
        LambdaQueryWrapper<Sms> lqw = Wrappers.<Sms>query().lambda().eq(Sms::getTenantId, tenantId);
        /*
        LambdaQueryWrapper<Sms> lqw = (LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> {
            return v0.getTenantId();
        }, tenantId);
        }, tenantId);*/
        String smsCode = StringUtil.isBlank(code) ? WebUtil.getParameter("code") : code;
        if (StringUtil.isNotBlank(smsCode)) {
            key = key.concat("-").concat(smsCode);
@@ -135,7 +88,7 @@
            }, Integer.valueOf(SmsStatusEnum.ENABLE.getNum()));
        }
        Sms sms = (Sms) CacheUtil.get("blade:resource", SMS_CODE, key, () -> {
            Sms s = (Sms) this.smsService.getOne(lqw);
            Sms s = this.smsService.getOne(lqw);
            if (Func.isEmpty(s)) {
                Sms defaultSms = new Sms();
                defaultSms.setId(BladeConstant.TOP_PARENT_ID);
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/controller/OssController.java
@@ -1,17 +1,15 @@
package com.qianwen.smartman.modules.resource.controller;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.lang.invoke.SerializedLambda;
import javax.validation.Valid;
import com.qianwen.smartman.common.cache.RegionCache;
import com.qianwen.smartman.common.constant.ExtCacheConstant;
import com.qianwen.core.boot.ctrl.BladeController;
import com.qianwen.core.cache.utils.CacheUtil;
import com.qianwen.core.mp.support.Condition;
@@ -26,13 +24,16 @@
import com.qianwen.core.tenant.annotation.NonDS;
import com.qianwen.core.tool.api.R;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.common.cache.RegionCache;
import com.qianwen.smartman.common.constant.ExtCacheConstant;
import com.qianwen.smartman.modules.resource.entity.Oss;
import com.qianwen.smartman.modules.resource.service.IOssService;
import com.qianwen.smartman.modules.resource.vo.OssVO;
import com.qianwen.smartman.modules.resource.wrapper.OssWrapper;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@Api(value = "对象存储接口", tags = {"对象存储接口"})
@RestController
@@ -43,41 +44,6 @@
    private final IOssService ossService;
    private final OssProperties ossProperties;
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case 771206363:
                if (implMethodName.equals("getTenantId")) {
                    z = false;
                    break;
                }
                break;
            case 803533544:
                if (implMethodName.equals("getStatus")) {
                    z = true;
                    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/core/tenant/mp/TenantEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTenantId();
                    };
                }
                break;
            case true:
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getStatus();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
    public OssController(final IOssService ossService, final OssProperties ossProperties) {
        this.ossService = ossService;
@@ -154,13 +120,18 @@
    @ApiOperation("获取默认OSS存储地址")
    public R<String> defaultOss() {
        String result;
        LambdaQueryWrapper<Oss> lqw = Wrappers.<Oss>query().lambda().eq(Oss::getTenantId, AuthUtil.getTenantId());
        lqw.eq(Oss::getStatus, Integer.valueOf(OssStatusEnum.ENABLE.getNum()));
        Oss detail = this.ossService.getOne(lqw);
        /*
        Wrapper wrapper = (LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> {
            return v0.getTenantId();
        }, AuthUtil.getTenantId());
        wrapper.eq((v0) -> {
            return v0.getStatus();
        }, Integer.valueOf(OssStatusEnum.ENABLE.getNum()));
        Oss detail = (Oss) this.ossService.getOne(wrapper);
        Oss detail = (Oss) this.ossService.getOne(wrapper);*/
        if (Func.isEmpty(detail)) {
            result = this.ossProperties.getEndpoint();
        } else {
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/endpoint/OssEndpointController.java
@@ -4,6 +4,8 @@
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import io.swagger.annotations.Api;
import me.zhyd.oauth.log.Log;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.http.HttpServletResponse;
@@ -75,35 +77,21 @@
    @GetResource({"/file-content"})
    public void getFileContent(@RequestParam String fileName, HttpServletResponse response) {
        InputStream objectStream;
        Throwable th;
        try {
            objectStream = this.ossBuilder.template().getObject(fileName);
            th = null;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e2) {
            throw new ServiceException("文件不存在");
        }
        try {
        try (InputStream objectStream = this.ossBuilder.template().getObject(fileName)) {
            response.setContentType("application/octet-stream; charset=UTF-8");
            response.addHeader("Expires", "0");
            response.addHeader("Pragma", "no-cache");
            response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate");
            IoUtil.copy(objectStream, response.getOutputStream());
            if (objectStream != null) {
                if (0 != 0) {
                    try {
                        objectStream.close();
                    } catch (Throwable th2) {
                        th.addSuppressed(th2);
                    }
                } else {
                    objectStream.close();
                }
            }
        } finally {
        }
        } catch (IOException e) {
            Log.error("获取文件内容错误",e);
            e.printStackTrace();
        } catch (Exception e) {
            throw new ServiceException("文件不存在");
        }
    }
    @PostResource({"/put-file"})
@@ -128,19 +116,31 @@
    @PostResource({"/put-file-attach"})
    public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
        String fileName = file.getOriginalFilename();
        BladeFile bladeFile = this.ossBuilder.template().putFile(fileName, file.getInputStream());
        Long attachId = buildAttach(fileName, Long.valueOf(file.getSize()), bladeFile);
        bladeFile.setAttachId(attachId);
        return R.data(bladeFile);
        try {
            String fileName = file.getOriginalFilename();
            BladeFile bladeFile = this.ossBuilder.template().putFile(fileName, file.getInputStream());
            Long attachId = buildAttach(fileName, Long.valueOf(file.getSize()), bladeFile);
            bladeFile.setAttachId(attachId);
            return R.data(bladeFile);
        } catch (Throwable ex) {
                //log.error("putFileAttachByName,异常,file={}",fileName,ex);
                throw new ServiceException("putFileAttach异常"+ex.getMessage());
             }
    }
    @PostResource({"/put-file-attach-by-name"})
    public R<BladeFile> putFileAttachByName(@RequestParam String fileName, @RequestParam MultipartFile file) {
        BladeFile bladeFile = this.ossBuilder.template().putFile(fileName, file.getInputStream());
        Long attachId = buildAttach(fileName, Long.valueOf(file.getSize()), bladeFile);
        bladeFile.setAttachId(attachId);
        return R.data(bladeFile);
        try {
            BladeFile bladeFile = this.ossBuilder.template().putFile(fileName, file.getInputStream());
            Long attachId = buildAttach(fileName, Long.valueOf(file.getSize()), bladeFile);
            bladeFile.setAttachId(attachId);
            return R.data(bladeFile);
         } catch (Throwable ex) {
             //log.error("putFileAttachByName,异常,file={}",fileName,ex);
             throw new ServiceException("putFileAttachByName异常"+ex.getMessage());
          }
    }
    private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile) {
@@ -170,10 +170,16 @@
    @PostResource({"/get-file-detail"})
    public R<BladeFile> getFileDetail(@RequestParam MultipartFile file) {
        BladeFile bladeFile = this.ossBuilder.template().putFile(file.getName(), file.getInputStream());
        long size = file.getSize();
        Long attachId = buildAttach(file.getName(), Long.valueOf(size), bladeFile);
        bladeFile.setAttachId(attachId);
        return R.data(bladeFile);
        try {
            BladeFile bladeFile = this.ossBuilder.template().putFile(file.getName(), file.getInputStream());
            long size = file.getSize();
            Long attachId = buildAttach(file.getName(), Long.valueOf(size), bladeFile);
            bladeFile.setAttachId(attachId);
            return R.data(bladeFile);
        } catch (Throwable ex) {
             //log.error("putFileAttachByName,异常,file={}",fileName,ex);
             throw new ServiceException("getFileDetail异常"+ex.getMessage());
        }
    }
}
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/OssServiceImpl.java
@@ -1,11 +1,11 @@
package com.qianwen.smartman.modules.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.lang.invoke.SerializedLambda;
import com.qianwen.core.log.exception.ServiceException;
import com.qianwen.core.mp.base.BaseServiceImpl;
import com.qianwen.core.secure.utils.AuthUtil;
@@ -14,83 +14,11 @@
import com.qianwen.smartman.modules.resource.mapper.OssMapper;
import com.qianwen.smartman.modules.resource.service.IOssService;
import com.qianwen.smartman.modules.resource.vo.OssVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/resource/service/impl/OssServiceImpl.class */
public class OssServiceImpl extends BaseServiceImpl<OssMapper, Oss> implements IOssService {
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -128783002:
                if (implMethodName.equals("getOssCode")) {
                    z = false;
                    break;
                }
                break;
            case 98245393:
                if (implMethodName.equals("getId")) {
                    z = true;
                    break;
                }
                break;
            case 771206363:
                if (implMethodName.equals("getTenantId")) {
                    z = true;
                    break;
                }
                break;
            case 803533544:
                if (implMethodName.equals("getStatus")) {
                    z = true;
                    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/Oss") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getOssCode();
                    };
                }
                break;
            case true:
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getId();
                    };
                }
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getId();
                    };
                }
                break;
            case true:
                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/core/tenant/mp/TenantEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTenantId();
                    };
                }
                break;
            case true:
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getStatus();
                    };
                }
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getStatus();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
    @Override // org.springblade.modules.resource.service.IOssService
    public IPage<OssVO> selectOssPage(IPage<OssVO> page, OssVO oss) {
@@ -99,6 +27,9 @@
    @Override // org.springblade.modules.resource.service.IOssService
    public boolean submit(Oss oss) {
        LambdaQueryWrapper<Oss> lqw = Wrappers.<Oss>query().lambda().eq(Oss::getOssCode, oss.getOssCode()).eq(Oss::getTenantId, AuthUtil.getTenantId());
        Long cnt = this.baseMapper.selectCount(Func.isEmpty(oss.getId()) ? lqw : lqw.notIn(Oss::getId, new Object[] { oss.getId() }));
        /*
        Wrapper wrapper = (LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> {
            return v0.getOssCode();
        }, oss.getOssCode())).eq((v0) -> {
@@ -106,7 +37,7 @@
        }, AuthUtil.getTenantId());
        Long cnt = ((OssMapper) this.baseMapper).selectCount(Func.isEmpty(oss.getId()) ? wrapper : (Wrapper) wrapper.notIn((v0) -> {
            return v0.getId();
        }, new Object[]{oss.getId()}));
        }, new Object[]{oss.getId()}));*/
        if (cnt.longValue() > 0) {
            throw new ServiceException("当前资源编号已存在!");
        }
@@ -116,6 +47,9 @@
    @Override // org.springblade.modules.resource.service.IOssService
    @Transactional(rollbackFor = {Exception.class})
    public boolean enable(Long id) {
        boolean temp1 = update(Wrappers.<Oss>update().lambda().set(Oss::getStatus, 1));
        boolean temp2 = update(Wrappers.<Oss>update().lambda().set(Oss::getStatus, 2).eq(Oss::getId, id));
        /*
        boolean temp1 = update((Wrapper) Wrappers.update().lambda().set((v0) -> {
            return v0.getStatus();
        }, 1));
@@ -123,7 +57,7 @@
            return v0.getStatus();
        }, 2)).eq((v0) -> {
            return v0.getId();
        }, id));
        }, id));*/
        return temp1 && temp2;
    }
}
smart-man-boot/src/main/java/com/qianwen/smartman/modules/resource/service/impl/SmsServiceImpl.java
@@ -1,11 +1,11 @@
package com.qianwen.smartman.modules.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.lang.invoke.SerializedLambda;
import com.qianwen.core.log.exception.ServiceException;
import com.qianwen.core.mp.base.BaseServiceImpl;
import com.qianwen.core.secure.utils.AuthUtil;
@@ -14,83 +14,11 @@
import com.qianwen.smartman.modules.resource.mapper.SmsMapper;
import com.qianwen.smartman.modules.resource.service.ISmsService;
import com.qianwen.smartman.modules.resource.vo.SmsVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/resource/service/impl/SmsServiceImpl.class */
public class SmsServiceImpl extends BaseServiceImpl<SmsMapper, Sms> implements ISmsService {
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -1045510480:
                if (implMethodName.equals("getSmsCode")) {
                    z = true;
                    break;
                }
                break;
            case 98245393:
                if (implMethodName.equals("getId")) {
                    z = false;
                    break;
                }
                break;
            case 771206363:
                if (implMethodName.equals("getTenantId")) {
                    z = true;
                    break;
                }
                break;
            case 803533544:
                if (implMethodName.equals("getStatus")) {
                    z = true;
                    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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getId();
                    };
                }
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getId();
                    };
                }
                break;
            case true:
                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/core/tenant/mp/TenantEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTenantId();
                    };
                }
                break;
            case true:
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getStatus();
                    };
                }
                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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getStatus();
                    };
                }
                break;
            case true:
                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/Sms") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getSmsCode();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
    @Override // org.springblade.modules.resource.service.ISmsService
    public IPage<SmsVO> selectSmsPage(IPage<SmsVO> page, SmsVO sms) {
@@ -99,6 +27,9 @@
    @Override // org.springblade.modules.resource.service.ISmsService
    public boolean submit(Sms sms) {
        LambdaQueryWrapper<Sms> lqw = Wrappers.<Sms>query().lambda().eq(Sms::getSmsCode, sms.getSmsCode()).eq(Sms::getTenantId, AuthUtil.getTenantId());
        Long cnt = this.baseMapper.selectCount(Func.isEmpty(sms.getId()) ? lqw : lqw.notIn(Sms::getId, new Object[] { sms.getId() }));
        /*
        Wrapper wrapper = (LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> {
            return v0.getSmsCode();
        }, sms.getSmsCode())).eq((v0) -> {
@@ -106,7 +37,7 @@
        }, AuthUtil.getTenantId());
        Long cnt = ((SmsMapper) this.baseMapper).selectCount(Func.isEmpty(sms.getId()) ? wrapper : (Wrapper) wrapper.notIn((v0) -> {
            return v0.getId();
        }, new Object[]{sms.getId()}));
        }, new Object[]{sms.getId()}));*/
        if (cnt.longValue() > 0) {
            throw new ServiceException("当前资源编号已存在!");
        }
@@ -116,6 +47,9 @@
    @Override // org.springblade.modules.resource.service.ISmsService
    @Transactional(rollbackFor = {Exception.class})
    public boolean enable(Long id) {
        boolean temp1 = update(Wrappers.<Sms>update().lambda().set(Sms::getStatus, 1));
        boolean temp2 = update(Wrappers.<Sms>update().lambda().set(Sms::getStatus, 2).eq(Sms::getId, id));
        /*
        boolean temp1 = update((Wrapper) Wrappers.update().lambda().set((v0) -> {
            return v0.getStatus();
        }, 1));
@@ -123,7 +57,7 @@
            return v0.getStatus();
        }, 2)).eq((v0) -> {
            return v0.getId();
        }, id));
        }, id));*/
        return temp1 && temp2;
    }
}
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);
        }
    }
}