注释掉无用的MQ;

This commit is contained in:
terrfly 2021-07-12 18:33:02 +08:00
parent 40959e8f64
commit 76e0389c85
8 changed files with 141 additions and 26 deletions

View File

@ -63,18 +63,18 @@ spring:
broker-url: tcp://localhost:61616 #连接地址
#rabbitmq配置
rabbitmq:
addresses: 127.0.0.1:5672
username: guest
password: guest
dynamic: true
virtual-host: /
# rabbitmq:
# addresses: 127.0.0.1:5672
# username: guest
# password: guest
# dynamic: true
# virtual-host: /
#rocketmq配置
rocketmq:
name-server: 127.0.0.1:9876
producer:
group: rocket-group
#rocketmq配置
# rocketmq:
# name-server: 127.0.0.1:9876
# producer:
# group: rocket-group
#日志配置参数。
# 当存在logback-spring.xml文件时 该配置将引进到logback配置 springboot配置不生效。
@ -96,7 +96,7 @@ isys:
file-private-path: ${isys.oss.file-root-path}/private #私有化本地访问不允许url方式公共读取 ( 一般配合root-path参数进行设置需以/ 开头, 无需以‘/’结尾 )
# [local]: 本地存储所有的文件将存在放本地可通过nfs, rsync工具实现多机共享
# [aliyun-oss]: 将文件统一上传到阿里云oss服务器;
# [aliyun-oss]: 将文件统一上传到阿里云oss服务器; 注意需调整jeepay-oss/pom.xml中的aliyun-sdk-oss组件依赖方式
service-type: local
# 阿里云OSS服务配置信息

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.core.service;
import com.jeequan.jeepay.core.model.DBApplicationConfig;

View File

@ -20,12 +20,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* 系统Yml配置参数定义Bean
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021-04-27 15:50
*/
* aliyun oss 的yml配置参数
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/7/12 18:18
*/
@Data
@Component
@ConfigurationProperties(prefix="isys.oss.aliyun-oss")

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.oss.constant;
/*

View File

@ -1,6 +1,20 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.oss.constant;
import lombok.Data;
import lombok.Getter;
/*

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.oss.service;
import com.aliyun.oss.OSS;
@ -11,8 +26,16 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
import java.io.File;
/**
* 阿里云OSS 实现类
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/7/12 18:20
*/
@Service
@Slf4j
@ConditionalOnProperty(name = "isys.oss.service-type", havingValue = "aliyun-oss")
@ -20,13 +43,20 @@ public class AliyunOssService implements IOssService{
@Autowired private AliyunOssYmlConfig aliyunOssYmlConfig;
// ossClient 初始化
private OSS ossClient = null;
@PostConstruct
public void init(){
ossClient = new OSSClientBuilder().build(aliyunOssYmlConfig.getEndpoint(), aliyunOssYmlConfig.getAccessKeyId(), aliyunOssYmlConfig.getAccessKeySecret());
}
@Override
public String upload2PreviewUrl(OssSavePlaceEnum ossSavePlaceEnum, MultipartFile multipartFile, String saveDirAndFileName) {
try {
// 创建OSSClient实例
OSS client = new OSSClientBuilder().build(aliyunOssYmlConfig.getEndpoint(), aliyunOssYmlConfig.getAccessKeyId(), aliyunOssYmlConfig.getAccessKeySecret());
client.putObject(aliyunOssYmlConfig.getPublicBucketName(), saveDirAndFileName, multipartFile.getInputStream());
this.ossClient.putObject(aliyunOssYmlConfig.getPublicBucketName(), saveDirAndFileName, multipartFile.getInputStream());
if(ossSavePlaceEnum == OssSavePlaceEnum.PUBLIC){
// 文档https://www.alibabacloud.com/help/zh/doc-detail/39607.htm example: https://BucketName.Endpoint/ObjectName
@ -45,12 +75,9 @@ public class AliyunOssService implements IOssService{
public boolean downloadFile(OssSavePlaceEnum ossSavePlaceEnum, String source, String target) {
try {
// 创建OSSClient实例
OSS client = new OSSClientBuilder().build(aliyunOssYmlConfig.getEndpoint(), aliyunOssYmlConfig.getAccessKeyId(), aliyunOssYmlConfig.getAccessKeySecret());
String bucket = ossSavePlaceEnum == OssSavePlaceEnum.PRIVATE ? aliyunOssYmlConfig.getPrivateBucketName() : aliyunOssYmlConfig.getPublicBucketName();
client.getObject(new GetObjectRequest(bucket, source), new File(target));
this.ossClient.getObject(new GetObjectRequest(bucket, source), new File(target));
return true;
} catch (Exception e) {

View File

@ -1,8 +1,30 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.oss.service;
import com.jeequan.jeepay.oss.constant.OssSavePlaceEnum;
import org.springframework.web.multipart.MultipartFile;
/**
* OSSService 接口
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/7/12 18:18
*/
public interface IOssService {
/** 上传文件 & 生成下载/预览URL **/

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.oss.service;
import com.jeequan.jeepay.core.service.ISysConfigService;
@ -11,6 +26,13 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
/**
* 本地存储 实现类
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/7/12 18:19
*/
@Service
@Slf4j
@ConditionalOnProperty(name = "isys.oss.service-type", havingValue = "local")