linwei
2024-01-09 269daa8c7bba1547ffa4c9fa7700b920bb5a6b13
Merge remote-tracking branch 'origin/master'
4 files modified
35 ■■■■■ changed files
pom.xml 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/resource/builder/oss/OssBuilder.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java 18 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 2 ●●● patch | view | raw | blame | history
pom.xml
@@ -191,6 +191,12 @@
            <artifactId>jts</artifactId>
            <version>1.13</version>
        </dependency>
        <!-- 微信支付 SDK-->
        <dependency>
            <groupId>com.github.binarywang</groupId>
            <artifactId>weixin-java-pay</artifactId>
            <version>4.4.9.B</version>
        </dependency>
    </dependencies>
    <build>
src/main/java/org/springblade/modules/resource/builder/oss/OssBuilder.java
@@ -70,6 +70,15 @@
    /**
     * 获取template
     *
     * @return OssProperties
     */
    public OssProperties ossProperties() {
        return ossProperties;
    }
    /**
     * 获取template
     *
     * @return OssTemplate
     */
    public OssTemplate template() {
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
@@ -146,7 +146,22 @@
    @PostMapping("/put-file")
    public R<BladeFile> putFile(@RequestParam MultipartFile file) {
        BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
        // 修改link
        changeLink(bladeFile);
        // 返回
        return R.data(bladeFile);
    }
    /**
     * 修改link
     * @param bladeFile
     */
    private void changeLink(BladeFile bladeFile) {
        if (null!=bladeFile){
            // 替换url link 前缀
            String newLink = ossBuilder.ossProperties().getEndpoint() + bladeFile.getName();
            bladeFile.setLink(newLink);
        }
    }
    /**
@@ -176,6 +191,9 @@
        BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
        Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
        bladeFile.setAttachId(attachId);
        // 修改link
        changeLink(bladeFile);
        // 返回
        return R.data(bladeFile);
    }
src/main/resources/application.yml
@@ -138,7 +138,7 @@
  enabled: true
  name: qiniu
  tenant-mode: true
  endpoint: http://prt1thnw3.bkt.clouddn.com
  endpoint: https://srgdjczzxtpt.com:2080/gminio/jczz/
  access-key: N_Loh1ngBqcJovwiAJqR91Ifj2vgOWHOf8AwBA_h
  secret-key: AuzuA1KHAbkIndCU0dB3Zfii2O3crHNODDmpxHRS
  bucket-name: bladex