| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | 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; |
| | |
| | | @GetResource({"/detail"}) |
| | | @ApiOperation(value = "详情", notes = "传入oss") |
| | | public R<OssVO> detail(Oss oss) { |
| | | Oss detail = (Oss) this.ossService.getOne(Condition.getQueryWrapper(oss)); |
| | | Oss detail = this.ossService.getOne(Condition.getQueryWrapper(oss)); |
| | | return R.data(OssWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | |
| | | @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 { |