diff --git a/README.md b/README.md index 5cd0279..6646378 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Build Status Coverage Status - Downloads + Downloads

## SpringBlade微服务开发平台 diff --git a/blade-auth/pom.xml b/blade-auth/pom.xml index 676ba1b..275ceb4 100644 --- a/blade-auth/pom.xml +++ b/blade-auth/pom.xml @@ -8,7 +8,7 @@ SpringBlade org.springblade - 2.3.1 + 2.3.2 blade-auth diff --git a/blade-common/pom.xml b/blade-common/pom.xml index ccb0a8b..b04bddb 100644 --- a/blade-common/pom.xml +++ b/blade-common/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-common/src/main/resources/banner.txt b/blade-common/src/main/resources/banner.txt new file mode 100644 index 0000000..cbd0280 --- /dev/null +++ b/blade-common/src/main/resources/banner.txt @@ -0,0 +1,10 @@ +${AnsiColor.BRIGHT_CYAN} _____ _ ${AnsiColor.BLUE} ______ _ _ +${AnsiColor.BRIGHT_CYAN}/ ___| (_) ${AnsiColor.BLUE} | ___ \| | | | +${AnsiColor.BRIGHT_CYAN}\ `--. _ __ _ __ _ _ __ __ _ ${AnsiColor.BLUE} | |_/ /| | __ _ __| | ___ +${AnsiColor.BRIGHT_CYAN} `--. \| '_ \ | '__|| || '_ \ / _` | ${AnsiColor.BLUE} | ___ \| | / _` | / _` | / _ \ +${AnsiColor.BRIGHT_CYAN}/\__/ /| |_) || | | || | | || (_| | ${AnsiColor.BLUE} | |_/ /| || (_| || (_| || __/ +${AnsiColor.BRIGHT_CYAN}\____/ | .__/ |_| |_||_| |_| \__, | ${AnsiColor.BLUE} \____/ |_| \__,_| \__,_| \___| +${AnsiColor.BRIGHT_CYAN} | | __/ | +${AnsiColor.BRIGHT_CYAN} |_| |___/ + +${AnsiColor.BLUE}:: SpringBlade :: ${spring.application.name}:${AnsiColor.RED}${blade.env}${AnsiColor.BLUE} :: Running SpringBoot ${spring-boot.version} :: ${AnsiColor.BRIGHT_BLACK} diff --git a/blade-gateway/pom.xml b/blade-gateway/pom.xml index 28e65e2..0463a8c 100644 --- a/blade-gateway/pom.xml +++ b/blade-gateway/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-ops/blade-admin/pom.xml b/blade-ops/blade-admin/pom.xml index d57322f..7a34fc7 100644 --- a/blade-ops/blade-admin/pom.xml +++ b/blade-ops/blade-admin/pom.xml @@ -5,7 +5,7 @@ blade-ops org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-ops/blade-develop/pom.xml b/blade-ops/blade-develop/pom.xml index d3cd477..663a3d0 100644 --- a/blade-ops/blade-develop/pom.xml +++ b/blade-ops/blade-develop/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-ops - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-ops/blade-resource/Dockerfile b/blade-ops/blade-resource/Dockerfile new file mode 100644 index 0000000..72ee543 --- /dev/null +++ b/blade-ops/blade-resource/Dockerfile @@ -0,0 +1,15 @@ +FROM anapsix/alpine-java:8_server-jre_unlimited + +MAINTAINER smallchill@163.com + +RUN mkdir -p /blade/resource + +WORKDIR /blade/resource + +EXPOSE 8010 + +ADD ./target/blade-resource.jar ./app.jar + +ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"] + +CMD ["--spring.profiles.active=test"] diff --git a/blade-ops/blade-resource/pom.xml b/blade-ops/blade-resource/pom.xml new file mode 100644 index 0000000..7589afe --- /dev/null +++ b/blade-ops/blade-resource/pom.xml @@ -0,0 +1,40 @@ + + + + blade-ops + org.springblade + 2.3.2 + + 4.0.0 + + blade-resource + ${project.artifactId} + ${bladex.project.version} + jar + + + + org.springblade + blade-common + ${blade.project.version} + + + org.springblade + blade-core-tool + ${blade.tool.version} + + + org.springblade + blade-core-cloud + ${blade.tool.version} + + + org.springblade + blade-core-oss + ${blade.tool.version} + + + + diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/ResourceApplication.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/ResourceApplication.java new file mode 100644 index 0000000..c233c38 --- /dev/null +++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/ResourceApplication.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 org.springblade.resource; + +import org.springblade.core.launch.BladeApplication; +import org.springblade.core.launch.constant.AppConstant; +import org.springframework.cloud.client.SpringCloudApplication; + +/** + * 资源启动器 + * + * @author Chill + */ +@SpringCloudApplication +public class ResourceApplication { + + public static void main(String[] args) { + BladeApplication.run(AppConstant.APPLICATION_RESOURCE_NAME, ResourceApplication.class, args); + } + +} + diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java new file mode 100644 index 0000000..7cddd8f --- /dev/null +++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 org.springblade.resource.endpoint; + +import io.swagger.annotations.Api; +import lombok.AllArgsConstructor; +import lombok.SneakyThrows; +import org.springblade.core.oss.QiniuTemplate; +import org.springblade.core.oss.model.BladeFile; +import org.springblade.core.oss.model.OssFile; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +/** + * 对象存储端点 + * + * @author Chill + */ +@RestController +@AllArgsConstructor +@RequestMapping("/oss/endpoint") +@Api(value = "对象存储端点", tags = "对象存储端点") +public class OssEndpoint { + + private QiniuTemplate qiniuTemplate; + + /** + * 创建存储桶 + * + * @param bucketName 存储桶名称 + * @return Bucket + */ + @SneakyThrows + @PostMapping("/make-bucket") + public R makeBucket(@RequestParam String bucketName) { + qiniuTemplate.makeBucket(bucketName); + return R.success("创建成功"); + } + + /** + * 创建存储桶 + * + * @param bucketName 存储桶名称 + * @return R + */ + @SneakyThrows + @PostMapping("/remove-bucket") + public R removeBucket(@RequestParam String bucketName) { + qiniuTemplate.removeBucket(bucketName); + return R.success("删除成功"); + } + + /** + * 拷贝文件 + * + * @param fileName 存储桶对象名称 + * @param destBucketName 目标存储桶名称 + * @param destFileName 目标存储桶对象名称 + * @return R + */ + @SneakyThrows + @PostMapping("/copy-file") + public R copyFile(@RequestParam String fileName, @RequestParam String destBucketName, String destFileName) { + qiniuTemplate.copyFile(fileName, destBucketName, destFileName); + return R.success("操作成功"); + } + + /** + * 获取文件信息 + * + * @param fileName 存储桶对象名称 + * @return InputStream + */ + @SneakyThrows + @GetMapping("/stat-file") + public R statFile(@RequestParam String fileName) { + return R.data(qiniuTemplate.statFile(fileName)); + } + + /** + * 获取文件相对路径 + * + * @param fileName 存储桶对象名称 + * @return String + */ + @SneakyThrows + @GetMapping("/file-path") + public R filePath(@RequestParam String fileName) { + return R.data(qiniuTemplate.filePath(fileName)); + } + + + /** + * 获取文件外链 + * + * @param fileName 存储桶对象名称 + * @return String + */ + @SneakyThrows + @GetMapping("/file-link") + public R fileLink(@RequestParam String fileName) { + return R.data(qiniuTemplate.fileLink(fileName)); + } + + /** + * 上传文件 + * + * @param file 文件 + * @return ObjectStat + */ + @SneakyThrows + @PostMapping("/put-file") + public R putFile(@RequestParam MultipartFile file) { + BladeFile bladeFile = qiniuTemplate.putFile(file.getOriginalFilename(), file.getInputStream()); + return R.data(bladeFile); + } + + /** + * 上传文件 + * + * @param fileName 存储桶对象名称 + * @param file 文件 + * @return ObjectStat + */ + @SneakyThrows + @PostMapping("/put-file-by-name") + public R putFile(@RequestParam String fileName, @RequestParam MultipartFile file) { + BladeFile bladeFile = qiniuTemplate.putFile(fileName, file.getInputStream()); + return R.data(bladeFile); + } + + /** + * 删除文件 + * + * @param fileName 存储桶对象名称 + * @return R + */ + @SneakyThrows + @PostMapping("/remove-file") + public R removeFile(@RequestParam String fileName) { + qiniuTemplate.removeFile(fileName); + return R.success("操作成功"); + } + + /** + * 批量删除文件 + * + * @param fileNames 存储桶对象名称集合 + * @return R + */ + @SneakyThrows + @PostMapping("/remove-files") + public R removeFiles(@RequestParam String fileNames) { + qiniuTemplate.removeFiles(Func.toStrList(fileNames)); + return R.success("操作成功"); + } + +} diff --git a/blade-ops/blade-resource/src/main/resources/application.yml b/blade-ops/blade-resource/src/main/resources/application.yml new file mode 100644 index 0000000..53b18bc --- /dev/null +++ b/blade-ops/blade-resource/src/main/resources/application.yml @@ -0,0 +1,12 @@ +#服务器端口 +server: + port: 8010 + +oss: + enable: true + name: qiniu + tenant-mode: true + endpoint: prt1thnw3.bkt.clouddn.com + access-key: N_Loh1ngBqcJovwiAJqR91Ifj2vgOWHOf8AwBA_h + secret-key: AuzuA1KHAbkIndCU0dB3Zfii2O3crHNODDmpxHRS + bucket-name: blade diff --git a/blade-ops/pom.xml b/blade-ops/pom.xml index 44fe3a4..f04016f 100644 --- a/blade-ops/pom.xml +++ b/blade-ops/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.3.1 + 2.3.2 4.0.0 @@ -14,6 +14,7 @@ blade-admin blade-develop + blade-resource diff --git a/blade-service-api/blade-desk-api/pom.xml b/blade-service-api/blade-desk-api/pom.xml index 5dffc93..4a67d25 100644 --- a/blade-service-api/blade-desk-api/pom.xml +++ b/blade-service-api/blade-desk-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-service-api/blade-dict-api/pom.xml b/blade-service-api/blade-dict-api/pom.xml index 4752f0d..de10b68 100644 --- a/blade-service-api/blade-dict-api/pom.xml +++ b/blade-service-api/blade-dict-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-service-api/blade-system-api/pom.xml b/blade-service-api/blade-system-api/pom.xml index 3e28248..74bbb5d 100644 --- a/blade-service-api/blade-system-api/pom.xml +++ b/blade-service-api/blade-system-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-service-api/blade-user-api/pom.xml b/blade-service-api/blade-user-api/pom.xml index 18c9b9d..39666a6 100644 --- a/blade-service-api/blade-user-api/pom.xml +++ b/blade-service-api/blade-user-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml index 0f0fc05..a26bdaa 100644 --- a/blade-service-api/pom.xml +++ b/blade-service-api/pom.xml @@ -5,13 +5,13 @@ SpringBlade org.springblade - 2.3.1 + 2.3.2 4.0.0 blade-service-api ${project.artifactId} - 2.3.1 + 2.3.2 pom SpringBlade 微服务API集合 diff --git a/blade-service/blade-desk/pom.xml b/blade-service/blade-desk/pom.xml index ed6fd0b..76371f2 100644 --- a/blade-service/blade-desk/pom.xml +++ b/blade-service/blade-desk/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-service - 2.3.1 + 2.3.2 4.0.0 @@ -37,6 +37,12 @@ blade-dict-api ${blade.project.version} + + org.springblade + blade-core-test + ${blade.tool.version} + test + diff --git a/blade-service/blade-desk/src/test/java/BladeDemoTest.java b/blade-service/blade-desk/src/test/java/BladeDemoTest.java new file mode 100644 index 0000000..be632a4 --- /dev/null +++ b/blade-service/blade-desk/src/test/java/BladeDemoTest.java @@ -0,0 +1,29 @@ +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springblade.core.test.BladeBootTest; +import org.springblade.core.test.BladeSpringRunner; +import org.springblade.desk.DeskApplication; +import org.springblade.desk.service.INoticeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * Blade单元测试 + * + * @author Chill + */ +@RunWith(BladeSpringRunner.class) +@SpringBootTest(classes = DeskApplication.class) +@BladeBootTest(appName = "blade-desk", profile = "test", enableLoader = true) +public class BladeDemoTest { + + @Autowired + private INoticeService noticeService; + + @Test + public void contextLoads() { + int count = noticeService.count(); + System.out.println("notice数量:[" + count + "] 个"); + } + +} diff --git a/blade-service/blade-desk/src/test/java/org/springblade/desk/test/launcher/DemoTestLauncherServiceImpl.java b/blade-service/blade-desk/src/test/java/org/springblade/desk/test/launcher/DemoTestLauncherServiceImpl.java new file mode 100644 index 0000000..94b45c3 --- /dev/null +++ b/blade-service/blade-desk/src/test/java/org/springblade/desk/test/launcher/DemoTestLauncherServiceImpl.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.desk.test.launcher; + +import org.springblade.common.constant.CommonConstant; +import org.springblade.core.launch.service.LauncherService; +import org.springframework.boot.builder.SpringApplicationBuilder; + +import java.util.Properties; + +/** + * 启动参数拓展 + * + * @author Chill + */ +public class DemoTestLauncherServiceImpl implements LauncherService { + + @Override + public void launcher(SpringApplicationBuilder builder, String appName, String profile) { + Properties props = System.getProperties(); + props.setProperty("spring.cloud.nacos.discovery.server-addr", CommonConstant.NACOS_DEV_ADDR); + props.setProperty("spring.cloud.nacos.config.server-addr", CommonConstant.NACOS_DEV_ADDR); + props.setProperty("spring.cloud.sentinel.transport.dashboard", CommonConstant.SENTINEL_DEV_ADDR); + } + + @Override + public int getOrder() { + return 10; + } +} diff --git a/blade-service/blade-desk/src/test/resources/META-INF/services/org.springblade.core.launch.service.LauncherService b/blade-service/blade-desk/src/test/resources/META-INF/services/org.springblade.core.launch.service.LauncherService new file mode 100644 index 0000000..284573a --- /dev/null +++ b/blade-service/blade-desk/src/test/resources/META-INF/services/org.springblade.core.launch.service.LauncherService @@ -0,0 +1 @@ +org.springblade.desk.test.launcher.DemoTestLauncherServiceImpl diff --git a/blade-service/blade-desk/src/test/resources/application-test.yml b/blade-service/blade-desk/src/test/resources/application-test.yml new file mode 100644 index 0000000..2842aa4 --- /dev/null +++ b/blade-service/blade-desk/src/test/resources/application-test.yml @@ -0,0 +1,10 @@ +#服务器端口 +server: + port: 8200 + +#数据源配置 +spring: + datasource: + url: ${blade.datasource.test.url} + username: ${blade.datasource.test.username} + password: ${blade.datasource.test.password} diff --git a/blade-service/blade-log/pom.xml b/blade-service/blade-log/pom.xml index dcc1149..2e2613c 100644 --- a/blade-service/blade-log/pom.xml +++ b/blade-service/blade-log/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-service/blade-system/pom.xml b/blade-service/blade-system/pom.xml index d50a4c0..2ee4e87 100644 --- a/blade-service/blade-system/pom.xml +++ b/blade-service/blade-system/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-service/blade-user/pom.xml b/blade-service/blade-user/pom.xml index c10f2f6..a8c58ca 100644 --- a/blade-service/blade-user/pom.xml +++ b/blade-service/blade-user/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.3.1 + 2.3.2 4.0.0 diff --git a/blade-service/pom.xml b/blade-service/pom.xml index aee4130..aa03b95 100644 --- a/blade-service/pom.xml +++ b/blade-service/pom.xml @@ -7,12 +7,12 @@ org.springblade SpringBlade - 2.3.1 + 2.3.2 blade-service ${project.artifactId} - 2.3.1 + 2.3.2 pom SpringBlade 微服务集合 diff --git a/pom.xml b/pom.xml index 81a1f0c..b2910d6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,21 +5,21 @@ org.springblade SpringBlade - 2.3.1 + 2.3.2 pom - 2.3.1 - 2.3.1 + 2.3.2 + 2.3.2 1.8 2.9.2 1.5.21 - 1.9.3 + 1.9.4 3.1.0 4.0.1 1.6.0 - 1.0.1 + 1.1.0 0.9.0.RELEASE 2.1.4 diff --git a/script/docker/.env b/script/docker/.env index b681c25..883c556 100644 --- a/script/docker/.env +++ b/script/docker/.env @@ -1,2 +1,2 @@ REGISTER=192.168.0.157/blade -TAG=2.0.0.RC8 +TAG=2.3.2 diff --git a/script/docker/docker-compose.yml b/script/docker/docker-compose.yml index ac7686c..f776423 100644 --- a/script/docker/docker-compose.yml +++ b/script/docker/docker-compose.yml @@ -30,7 +30,7 @@ services: ports: - 88:88 volumes: - - /docker/nginx/gateway/nginx.conf:/etc/nginx/nginx.conf + - /docker/nginx/api/nginx.conf:/etc/nginx/nginx.conf privileged: true restart: always networks: @@ -131,6 +131,13 @@ services: networks: - blade_net + blade-resource: + image: "${REGISTER}/blade/blade-resource:${TAG}" + privileged: true + restart: always + networks: + - blade_net + networks: blade_net: driver: bridge