Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
SpringBlade
提交
61c5722b
S
SpringBlade
项目概览
int
/
SpringBlade
10 个月 前同步成功
通知
16
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBlade
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
61c5722b
编写于
9月 23, 2019
作者:
S
smallchill
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🎉
2.5.0.RELEASE. 集成seata支持分布式事务
上级
9e5f3804
变更
48
显示空白变更内容
内联
并排
Showing
48 changed file
with
700 addition
and
87 deletion
+700
-87
blade-auth/pom.xml
blade-auth/pom.xml
+2
-1
blade-common/pom.xml
blade-common/pom.xml
+1
-1
blade-gateway/pom.xml
blade-gateway/pom.xml
+2
-1
blade-ops/blade-admin/pom.xml
blade-ops/blade-admin/pom.xml
+2
-1
blade-ops/blade-develop/pom.xml
blade-ops/blade-develop/pom.xml
+2
-1
blade-ops/blade-resource/pom.xml
blade-ops/blade-resource/pom.xml
+2
-2
blade-ops/blade-seata-order/README.md
blade-ops/blade-seata-order/README.md
+30
-0
blade-ops/blade-seata-order/pom.xml
blade-ops/blade-seata-order/pom.xml
+30
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/SeataOrderApplication.java
...va/org/springblade/seata/order/SeataOrderApplication.java
+37
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/config/OrderConfiguration.java
...rg/springblade/seata/order/config/OrderConfiguration.java
+39
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/controller/OrderController.java
...g/springblade/seata/order/controller/OrderController.java
+34
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/entity/Order.java
...c/main/java/org/springblade/seata/order/entity/Order.java
+31
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/IStorageClient.java
...ava/org/springblade/seata/order/feign/IStorageClient.java
+25
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/StorageClientFallback.java
.../springblade/seata/order/feign/StorageClientFallback.java
+18
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/mapper/OrderMapper.java
.../java/org/springblade/seata/order/mapper/OrderMapper.java
+12
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/mapper/OrderMapper.xml
...n/java/org/springblade/seata/order/mapper/OrderMapper.xml
+5
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/service/IOrderService.java
...va/org/springblade/seata/order/service/IOrderService.java
+23
-0
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/service/impl/OrderServiceImpl.java
...pringblade/seata/order/service/impl/OrderServiceImpl.java
+48
-0
blade-ops/blade-seata-order/src/main/resources/application-dev.yml
.../blade-seata-order/src/main/resources/application-dev.yml
+10
-0
blade-ops/blade-seata-order/src/main/resources/registry.conf
blade-ops/blade-seata-order/src/main/resources/registry.conf
+20
-0
blade-ops/blade-seata-storage/README.md
blade-ops/blade-seata-storage/README.md
+33
-0
blade-ops/blade-seata-storage/pom.xml
blade-ops/blade-seata-storage/pom.xml
+31
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java
...rg/springblade/seata/storage/SeataStorageApplication.java
+41
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/config/StorageConfiguration.java
...pringblade/seata/storage/config/StorageConfiguration.java
+39
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/controller/StorageController.java
...ringblade/seata/storage/controller/StorageController.java
+30
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/entity/Storage.java
...in/java/org/springblade/seata/storage/entity/Storage.java
+24
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/mapper/StorageMapper.java
...a/org/springblade/seata/storage/mapper/StorageMapper.java
+12
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/mapper/StorageMapper.xml
...va/org/springblade/seata/storage/mapper/StorageMapper.xml
+5
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/service/IStorageService.java
...rg/springblade/seata/storage/service/IStorageService.java
+22
-0
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/service/impl/StorageServiceImpl.java
...gblade/seata/storage/service/impl/StorageServiceImpl.java
+30
-0
blade-ops/blade-seata-storage/src/main/resources/application-dev.yml
...lade-seata-storage/src/main/resources/application-dev.yml
+10
-0
blade-ops/blade-seata-storage/src/main/resources/registry.conf
...-ops/blade-seata-storage/src/main/resources/registry.conf
+20
-0
blade-ops/pom.xml
blade-ops/pom.xml
+3
-1
blade-service-api/blade-desk-api/pom.xml
blade-service-api/blade-desk-api/pom.xml
+1
-1
blade-service-api/blade-dict-api/pom.xml
blade-service-api/blade-dict-api/pom.xml
+1
-1
blade-service-api/blade-system-api/pom.xml
blade-service-api/blade-system-api/pom.xml
+1
-1
blade-service-api/blade-user-api/pom.xml
blade-service-api/blade-user-api/pom.xml
+1
-1
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java
...rc/main/java/org/springblade/system/user/entity/User.java
+2
-2
blade-service-api/pom.xml
blade-service-api/pom.xml
+2
-2
blade-service/blade-desk/pom.xml
blade-service/blade-desk/pom.xml
+2
-1
blade-service/blade-log/pom.xml
blade-service/blade-log/pom.xml
+2
-1
blade-service/blade-system/pom.xml
blade-service/blade-system/pom.xml
+2
-1
blade-service/blade-user/pom.xml
blade-service/blade-user/pom.xml
+2
-1
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java
...springblade/system/user/service/impl/UserServiceImpl.java
+2
-2
blade-service/pom.xml
blade-service/pom.xml
+2
-2
doc/sql/blade-mysql-update.sql
doc/sql/blade-mysql-update.sql
+0
-56
pom.xml
pom.xml
+6
-6
script/docker/.env
script/docker/.env
+1
-1
未找到文件。
blade-auth/pom.xml
浏览文件 @
61c5722b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<parent>
<parent>
<artifactId>
SpringBlade
</artifactId>
<artifactId>
SpringBlade
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<artifactId>
blade-auth
</artifactId>
<artifactId>
blade-auth
</artifactId>
...
@@ -89,6 +89,7 @@
...
@@ -89,6 +89,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-common/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
SpringBlade
</artifactId>
<artifactId>
SpringBlade
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
blade-gateway/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
SpringBlade
</artifactId>
<artifactId>
SpringBlade
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -139,6 +139,7 @@
...
@@ -139,6 +139,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-ops/blade-admin/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-ops
</artifactId>
<artifactId>
blade-ops
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -72,6 +72,7 @@
...
@@ -72,6 +72,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-ops/blade-develop/pom.xml
浏览文件 @
61c5722b
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<parent>
<parent>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<artifactId>
blade-ops
</artifactId>
<artifactId>
blade-ops
</artifactId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -78,6 +78,7 @@
...
@@ -78,6 +78,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-ops/blade-resource/pom.xml
浏览文件 @
61c5722b
...
@@ -5,13 +5,13 @@
...
@@ -5,13 +5,13 @@
<parent>
<parent>
<artifactId>
blade-ops
</artifactId>
<artifactId>
blade-ops
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
blade-resource
</artifactId>
<artifactId>
blade-resource
</artifactId>
<name>
${project.artifactId}
</name>
<name>
${project.artifactId}
</name>
<version>
${blade
x
.project.version}
</version>
<version>
${blade.project.version}
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<dependencies>
<dependencies>
...
...
blade-ops/blade-seata-order/README.md
0 → 100644
浏览文件 @
61c5722b
-- 创建 order库、业务表、undo_log表
create database seata_order;
use seata_order;
DROP TABLE IF EXISTS
`tb_order`
;
CREATE TABLE
`tb_order`
(
`id`
int(11) NOT NULL AUTO_INCREMENT,
`user_id`
varchar(255) DEFAULT NULL,
`commodity_code`
varchar(255) DEFAULT NULL,
`count`
int(11) DEFAULT 0,
`money`
int(11) DEFAULT 0,
PRIMARY KEY (
`id`
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE
`undo_log`
(
`id`
BIGINT(20) NOT NULL AUTO_INCREMENT,
`branch_id`
BIGINT(20) NOT NULL,
`xid`
VARCHAR(100) NOT NULL,
`context`
VARCHAR(128) NOT NULL,
`rollback_info`
LONGBLOB NOT NULL,
`log_status`
INT(11) NOT NULL,
`log_created`
DATETIME NOT NULL,
`log_modified`
DATETIME NOT NULL,
`ext`
VARCHAR(100) DEFAULT NULL,
PRIMARY KEY (
`id`
),
UNIQUE KEY
`ux_undo_log`
(
`xid`
,
`branch_id`
)
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8;
\ No newline at end of file
blade-ops/blade-seata-order/pom.xml
0 → 100644
浏览文件 @
61c5722b
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
blade-ops
</artifactId>
<groupId>
org.springblade
</groupId>
<version>
2.5.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
blade-seata-order
</artifactId>
<name>
${project.artifactId}
</name>
<version>
${blade.project.version}
</version>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
org.springblade
</groupId>
<artifactId>
blade-core-boot
</artifactId>
<version>
${blade.tool.version}
</version>
</dependency>
<dependency>
<groupId>
org.springblade
</groupId>
<artifactId>
blade-core-transaction
</artifactId>
<version>
${blade.tool.version}
</version>
</dependency>
</dependencies>
</project>
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/SeataOrderApplication.java
0 → 100644
浏览文件 @
61c5722b
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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
org.springblade.seata.order
;
import
org.springblade.core.launch.BladeApplication
;
import
org.springblade.core.launch.constant.AppConstant
;
import
org.springblade.core.transaction.annotation.SeataCloudApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
/**
* Order启动器
*
* @author Chill
*/
@SeataCloudApplication
@EnableFeignClients
(
AppConstant
.
BASE_PACKAGES
)
public
class
SeataOrderApplication
{
public
static
void
main
(
String
[]
args
)
{
BladeApplication
.
run
(
"blade-seata-order"
,
SeataOrderApplication
.
class
,
args
);
}
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/config/OrderConfiguration.java
0 → 100644
浏览文件 @
61c5722b
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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
org.springblade.seata.order.config
;
import
org.springblade.core.secure.registry.SecureRegistry
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* secure模块api放行配置
*
* @author Chill
*/
@Configuration
public
class
OrderConfiguration
implements
WebMvcConfigurer
{
@Bean
public
SecureRegistry
secureRegistry
()
{
SecureRegistry
secureRegistry
=
new
SecureRegistry
();
secureRegistry
.
excludePathPatterns
(
"/order/create/**"
);
return
secureRegistry
;
}
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/controller/OrderController.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.order.controller
;
import
lombok.AllArgsConstructor
;
import
org.springblade.core.tool.api.R
;
import
org.springblade.seata.order.service.IOrderService
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* OrderController
*
* @author Chill
*/
@RestController
@RequestMapping
(
"order"
)
@AllArgsConstructor
public
class
OrderController
{
private
IOrderService
orderService
;
/**
* 创建订单
*
* @param userId 用户id
* @param commodityCode 商品代码
* @param count 数量
* @return boolean
*/
@RequestMapping
(
"/create"
)
public
R
createOrder
(
String
userId
,
String
commodityCode
,
Integer
count
)
{
return
R
.
status
(
orderService
.
createOrder
(
userId
,
commodityCode
,
count
));
}
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/entity/Order.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.order.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* Order
*
* @author Chill
*/
@Data
@Accessors
(
chain
=
true
)
@TableName
(
"tb_order"
)
public
class
Order
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
String
userId
;
private
String
commodityCode
;
private
Integer
count
;
private
BigDecimal
money
;
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/IStorageClient.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.order.feign
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
* StorageClient
*
* @author Chill
*/
@FeignClient
(
name
=
"blade-seata-storage"
,
fallback
=
StorageClientFallback
.
class
)
public
interface
IStorageClient
{
/**
* 减库存
*
* @param commodityCode 商品代码
* @param count 数量
* @return boolean
*/
@GetMapping
(
"/deduct"
)
int
deduct
(
@RequestParam
(
"commodityCode"
)
String
commodityCode
,
@RequestParam
(
"count"
)
Integer
count
);
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/feign/StorageClientFallback.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.order.feign
;
import
org.springframework.stereotype.Component
;
/**
* StorageClientFallback
*
* @author Chill
*/
@Component
public
class
StorageClientFallback
implements
IStorageClient
{
@Override
public
int
deduct
(
String
commodityCode
,
Integer
count
)
{
return
-
1
;
}
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/mapper/OrderMapper.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.order.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springblade.seata.order.entity.Order
;
/**
* OrderMapper
*
* @author Chill
*/
public
interface
OrderMapper
extends
BaseMapper
<
Order
>
{
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/mapper/OrderMapper.xml
0 → 100644
浏览文件 @
61c5722b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"org.springblade.seata.order.mapper.OrderMapper"
>
</mapper>
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/service/IOrderService.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.order.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.springblade.seata.order.entity.Order
;
/**
* IOrderService
*
* @author Chill
*/
public
interface
IOrderService
extends
IService
<
Order
>
{
/**
* 创建订单
*
* @param userId 用户id
* @param commodityCode 商品代码
* @param count 数量
* @return boolean
*/
boolean
createOrder
(
String
userId
,
String
commodityCode
,
Integer
count
);
}
blade-ops/blade-seata-order/src/main/java/org/springblade/seata/order/service/impl/OrderServiceImpl.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.order.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
lombok.AllArgsConstructor
;
import
org.springblade.core.log.exception.ServiceException
;
import
org.springblade.seata.order.entity.Order
;
import
org.springblade.seata.order.feign.IStorageClient
;
import
org.springblade.seata.order.mapper.OrderMapper
;
import
org.springblade.seata.order.service.IOrderService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
/**
* OrderServiceImpl
*
* @author Chill
*/
@Service
@AllArgsConstructor
public
class
OrderServiceImpl
extends
ServiceImpl
<
OrderMapper
,
Order
>
implements
IOrderService
{
private
IStorageClient
storageClient
;
@Override
@GlobalTransactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
createOrder
(
String
userId
,
String
commodityCode
,
Integer
count
)
{
int
maxCount
=
100
;
BigDecimal
orderMoney
=
new
BigDecimal
(
count
).
multiply
(
new
BigDecimal
(
5
));
Order
order
=
new
Order
()
.
setUserId
(
userId
)
.
setCommodityCode
(
commodityCode
)
.
setCount
(
count
)
.
setMoney
(
orderMoney
);
int
cnt1
=
baseMapper
.
insert
(
order
);
int
cnt2
=
storageClient
.
deduct
(
commodityCode
,
count
);
if
(
cnt2
<
0
)
{
throw
new
ServiceException
(
"创建订单失败"
);
}
else
if
(
count
>
maxCount
)
{
throw
new
ServiceException
(
"超过订单最大值,创建订单失败"
);
}
return
cnt1
>
0
&&
cnt2
>
0
;
}
}
blade-ops/blade-seata-order/src/main/resources/application-dev.yml
0 → 100644
浏览文件 @
61c5722b
#服务器端口
server
:
port
:
8501
#数据源配置
spring
:
datasource
:
url
:
jdbc:mysql://localhost:3306/seata_order?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username
:
root
password
:
root
blade-ops/blade-seata-order/src/main/resources/registry.conf
0 → 100644
浏览文件 @
61c5722b
registry
{
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type
=
"nacos"
nacos
{
serverAddr
=
"localhost"
namespace
=
""
cluster
=
"default"
}
}
config
{
# file、nacos 、apollo、zk、consul、etcd3
type
=
"nacos"
nacos
{
serverAddr
=
"localhost"
namespace
=
""
}
}
blade-ops/blade-seata-storage/README.md
0 → 100644
浏览文件 @
61c5722b
-- 创建 storage库、业务表、undo_log表
create database seata_storage;
use seata_storage;
DROP TABLE IF EXISTS
`tb_storage`
;
CREATE TABLE
`tb_storage`
(
`id`
int(11) NOT NULL AUTO_INCREMENT,
`commodity_code`
varchar(255) DEFAULT NULL,
`count`
int(11) DEFAULT 0,
PRIMARY KEY (
`id`
),
UNIQUE KEY (
`commodity_code`
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE
`undo_log`
(
`id`
BIGINT(20) NOT NULL AUTO_INCREMENT,
`branch_id`
BIGINT(20) NOT NULL,
`xid`
VARCHAR(100) NOT NULL,
`context`
VARCHAR(128) NOT NULL,
`rollback_info`
LONGBLOB NOT NULL,
`log_status`
INT(11) NOT NULL,
`log_created`
DATETIME NOT NULL,
`log_modified`
DATETIME NOT NULL,
`ext`
VARCHAR(100) DEFAULT NULL,
PRIMARY KEY (
`id`
),
UNIQUE KEY
`ux_undo_log`
(
`xid`
,
`branch_id`
)
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8;
-- 初始化库存模拟数据
INSERT INTO seata_storage.tb_storage (id, commodity_code, count) VALUES (1, 'product-1', 9999999);
INSERT INTO seata_storage.tb_storage (id, commodity_code, count) VALUES (2, 'product-2', 0);
\ No newline at end of file
blade-ops/blade-seata-storage/pom.xml
0 → 100644
浏览文件 @
61c5722b
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
blade-ops
</artifactId>
<groupId>
org.springblade
</groupId>
<version>
2.5.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
blade-seata-storage
</artifactId>
<name>
${project.artifactId}
</name>
<version>
${blade.project.version}
</version>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
org.springblade
</groupId>
<artifactId>
blade-core-boot
</artifactId>
<version>
${blade.tool.version}
</version>
</dependency>
<dependency>
<groupId>
org.springblade
</groupId>
<artifactId>
blade-core-transaction
</artifactId>
<version>
${blade.tool.version}
</version>
</dependency>
</dependencies>
</project>
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/SeataStorageApplication.java
0 → 100644
浏览文件 @
61c5722b
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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
org.springblade.seata.storage
;
import
org.springblade.core.launch.BladeApplication
;
import
org.springblade.core.launch.constant.AppConstant
;
import
org.springblade.core.transaction.annotation.SeataCloudApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
/**
* Storage启动器
*
* @author Chill
*/
@SeataCloudApplication
@EnableFeignClients
(
AppConstant
.
BASE_PACKAGES
)
public
class
SeataStorageApplication
{
public
static
void
main
(
String
[]
args
)
{
BladeApplication
.
run
(
"blade-seata-storage"
,
SeataStorageApplication
.
class
,
args
);
}
}
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/config/StorageConfiguration.java
0 → 100644
浏览文件 @
61c5722b
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <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
org.springblade.seata.storage.config
;
import
org.springblade.core.secure.registry.SecureRegistry
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* secure模块api放行配置
*
* @author Chill
*/
@Configuration
public
class
StorageConfiguration
implements
WebMvcConfigurer
{
@Bean
public
SecureRegistry
secureRegistry
()
{
SecureRegistry
secureRegistry
=
new
SecureRegistry
();
secureRegistry
.
excludePathPatterns
(
"/deduct/**"
);
return
secureRegistry
;
}
}
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/controller/StorageController.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.storage.controller
;
import
lombok.AllArgsConstructor
;
import
org.springblade.seata.storage.service.IStorageService
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* StorageController
*
* @author Chill
*/
@RestController
@AllArgsConstructor
public
class
StorageController
{
private
IStorageService
storageService
;
/**
* 减库存
*
* @param commodityCode 商品代码
* @param count 数量
*/
@RequestMapping
(
path
=
"/deduct"
)
public
int
deduct
(
String
commodityCode
,
Integer
count
)
{
return
storageService
.
deduct
(
commodityCode
,
count
);
}
}
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/entity/Storage.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.storage.entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* storage
*
* @author Chill
*/
@Data
@TableName
(
"tb_storage"
)
public
class
Storage
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
Long
id
;
private
String
commodityCode
;
private
Long
count
;
}
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/mapper/StorageMapper.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.storage.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springblade.seata.storage.entity.Storage
;
/**
* StorageMapper
*
* @author Chill
*/
public
interface
StorageMapper
extends
BaseMapper
<
Storage
>
{
}
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/mapper/StorageMapper.xml
0 → 100644
浏览文件 @
61c5722b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"org.springblade.seata.storage.mapper.StorageMapper"
>
</mapper>
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/service/IStorageService.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.storage.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.springblade.seata.storage.entity.Storage
;
/**
* IStorageService
*
* @author Chill
*/
public
interface
IStorageService
extends
IService
<
Storage
>
{
/**
* 减库存
*
* @param commodityCode 商品代码
* @param count 数量
* @return boolean
*/
int
deduct
(
String
commodityCode
,
int
count
);
}
blade-ops/blade-seata-storage/src/main/java/org/springblade/seata/storage/service/impl/StorageServiceImpl.java
0 → 100644
浏览文件 @
61c5722b
package
org.springblade.seata.storage.service.impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springblade.seata.storage.entity.Storage
;
import
org.springblade.seata.storage.mapper.StorageMapper
;
import
org.springblade.seata.storage.service.IStorageService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* StorageServiceImpl
*
* @author Chill
*/
@Service
public
class
StorageServiceImpl
extends
ServiceImpl
<
StorageMapper
,
Storage
>
implements
IStorageService
{
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
int
deduct
(
String
commodityCode
,
int
count
)
{
Storage
storage
=
baseMapper
.
selectOne
(
Wrappers
.<
Storage
>
query
().
lambda
().
eq
(
Storage:
:
getCommodityCode
,
commodityCode
));
if
(
storage
.
getCount
()
<
count
)
{
throw
new
RuntimeException
(
"超过库存数,扣除失败!"
);
}
storage
.
setCount
(
storage
.
getCount
()
-
count
);
return
baseMapper
.
updateById
(
storage
);
}
}
blade-ops/blade-seata-storage/src/main/resources/application-dev.yml
0 → 100644
浏览文件 @
61c5722b
#服务器端口
server
:
port
:
8502
#数据源配置
spring
:
datasource
:
url
:
jdbc:mysql://localhost:3306/seata_storage?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
username
:
root
password
:
root
blade-ops/blade-seata-storage/src/main/resources/registry.conf
0 → 100644
浏览文件 @
61c5722b
registry
{
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type
=
"nacos"
nacos
{
serverAddr
=
"localhost"
namespace
=
""
cluster
=
"default"
}
}
config
{
# file、nacos 、apollo、zk、consul、etcd3
type
=
"nacos"
nacos
{
serverAddr
=
"localhost"
namespace
=
""
}
}
blade-ops/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
SpringBlade
</artifactId>
<artifactId>
SpringBlade
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
<module>
blade-admin
</module>
<module>
blade-admin
</module>
<module>
blade-develop
</module>
<module>
blade-develop
</module>
<module>
blade-resource
</module>
<module>
blade-resource
</module>
<module>
blade-seata-order
</module>
<module>
blade-seata-storage
</module>
</modules>
</modules>
</project>
</project>
blade-service-api/blade-desk-api/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-service-api
</artifactId>
<artifactId>
blade-service-api
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
blade-service-api/blade-dict-api/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-service-api
</artifactId>
<artifactId>
blade-service-api
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
blade-service-api/blade-system-api/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-service-api
</artifactId>
<artifactId>
blade-service-api
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
blade-service-api/blade-user-api/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-service-api
</artifactId>
<artifactId>
blade-service-api
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java
浏览文件 @
61c5722b
...
@@ -23,7 +23,7 @@ import lombok.Data;
...
@@ -23,7 +23,7 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
org.springblade.core.mp.base.TenantEntity
;
import
org.springblade.core.mp.base.TenantEntity
;
import
java.
time.LocalDateTim
e
;
import
java.
util.Dat
e
;
/**
/**
* 实体类
* 实体类
...
@@ -71,7 +71,7 @@ public class User extends TenantEntity {
...
@@ -71,7 +71,7 @@ public class User extends TenantEntity {
/**
/**
* 生日
* 生日
*/
*/
private
LocalDateTim
e
birthday
;
private
Dat
e
birthday
;
/**
/**
* 性别
* 性别
*/
*/
...
...
blade-service-api/pom.xml
浏览文件 @
61c5722b
...
@@ -5,13 +5,13 @@
...
@@ -5,13 +5,13 @@
<parent>
<parent>
<artifactId>
SpringBlade
</artifactId>
<artifactId>
SpringBlade
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
blade-service-api
</artifactId>
<artifactId>
blade-service-api
</artifactId>
<name>
${project.artifactId}
</name>
<name>
${project.artifactId}
</name>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<description>
SpringBlade 微服务API集合
</description>
<description>
SpringBlade 微服务API集合
</description>
...
...
blade-service/blade-desk/pom.xml
浏览文件 @
61c5722b
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<parent>
<parent>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<artifactId>
blade-service
</artifactId>
<artifactId>
blade-service
</artifactId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-service/blade-log/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-service
</artifactId>
<artifactId>
blade-service
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-service/blade-system/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-service
</artifactId>
<artifactId>
blade-service
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-service/blade-user/pom.xml
浏览文件 @
61c5722b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<parent>
<parent>
<artifactId>
blade-service
</artifactId>
<artifactId>
blade-service
</artifactId>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
</goals>
</goals>
<configuration>
<configuration>
<tasks>
<tasks>
<!--suppress UnresolvedMavenProperty -->
<copy
overwrite=
"true"
<copy
overwrite=
"true"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
tofile=
"${session.executionRootDirectory}/target/${artifactId}.jar"
file=
"${project.build.directory}/${artifactId}.jar"
/>
file=
"${project.build.directory}/${artifactId}.jar"
/>
...
...
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java
浏览文件 @
61c5722b
...
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
...
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.exceptions.ApiException
;
import
com.baomidou.mybatisplus.extension.exceptions.ApiException
;
import
org.springblade.common.constant.CommonConstant
;
import
org.springblade.common.constant.CommonConstant
;
import
org.springblade.core.mp.base.BaseServiceImpl
;
import
org.springblade.core.mp.base.BaseServiceImpl
;
import
org.springblade.core.tool.utils.DateUtil
;
import
org.springblade.core.tool.utils.DigestUtil
;
import
org.springblade.core.tool.utils.DigestUtil
;
import
org.springblade.core.tool.utils.Func
;
import
org.springblade.core.tool.utils.Func
;
import
org.springblade.system.user.entity.User
;
import
org.springblade.system.user.entity.User
;
...
@@ -29,7 +30,6 @@ import org.springblade.system.user.mapper.UserMapper;
...
@@ -29,7 +30,6 @@ import org.springblade.system.user.mapper.UserMapper;
import
org.springblade.system.user.service.IUserService
;
import
org.springblade.system.user.service.IUserService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -92,7 +92,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
...
@@ -92,7 +92,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
public
boolean
resetPassword
(
String
userIds
)
{
public
boolean
resetPassword
(
String
userIds
)
{
User
user
=
new
User
();
User
user
=
new
User
();
user
.
setPassword
(
DigestUtil
.
encrypt
(
CommonConstant
.
DEFAULT_PASSWORD
));
user
.
setPassword
(
DigestUtil
.
encrypt
(
CommonConstant
.
DEFAULT_PASSWORD
));
user
.
setUpdateTime
(
LocalDateTime
.
now
());
user
.
setUpdateTime
(
DateUtil
.
now
());
return
this
.
update
(
user
,
Wrappers
.<
User
>
update
().
lambda
().
in
(
User:
:
getId
,
Func
.
toIntList
(
userIds
)));
return
this
.
update
(
user
,
Wrappers
.<
User
>
update
().
lambda
().
in
(
User:
:
getId
,
Func
.
toIntList
(
userIds
)));
}
}
...
...
blade-service/pom.xml
浏览文件 @
61c5722b
...
@@ -7,12 +7,12 @@
...
@@ -7,12 +7,12 @@
<parent>
<parent>
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<artifactId>
SpringBlade
</artifactId>
<artifactId>
SpringBlade
</artifactId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
</parent>
</parent>
<artifactId>
blade-service
</artifactId>
<artifactId>
blade-service
</artifactId>
<name>
${project.artifactId}
</name>
<name>
${project.artifactId}
</name>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<description>
SpringBlade 微服务集合
</description>
<description>
SpringBlade 微服务集合
</description>
...
...
doc/sql/blade-mysql-update.sql
已删除
100644 → 0
浏览文件 @
9e5f3804
-- ----------------------------
-- 创建数据源配置表
-- ----------------------------
CREATE
TABLE
`blade_datasource`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`name`
varchar
(
100
)
NULL
COMMENT
'名称'
,
`driver_class`
varchar
(
100
)
NULL
COMMENT
'驱动类'
,
`url`
varchar
(
500
)
NULL
COMMENT
'连接地址'
,
`username`
varchar
(
50
)
NULL
COMMENT
'用户名'
,
`password`
varchar
(
50
)
NULL
COMMENT
'密码'
,
`remark`
varchar
(
255
)
NULL
COMMENT
'备注'
,
`create_user`
bigint
(
64
)
NULL
DEFAULT
NULL
COMMENT
'创建人'
,
`create_dept`
bigint
(
64
)
NULL
DEFAULT
NULL
COMMENT
'创建部门'
,
`create_time`
datetime
(
0
)
NULL
DEFAULT
NULL
COMMENT
'创建时间'
,
`update_user`
bigint
(
64
)
NULL
DEFAULT
NULL
COMMENT
'修改人'
,
`update_time`
datetime
(
0
)
NULL
DEFAULT
NULL
COMMENT
'修改时间'
,
`status`
int
(
2
)
NULL
DEFAULT
NULL
COMMENT
'状态'
,
`is_deleted`
int
(
2
)
NULL
DEFAULT
NULL
COMMENT
'是否已删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
COMMENT
=
'数据源配置表'
;
-- ----------------------------
-- 插入数据源默认数据
-- ----------------------------
INSERT
INTO
`blade_datasource`
(
`id`
,
`name`
,
`driver_class`
,
`url`
,
`username`
,
`password`
,
`remark`
,
`create_user`
,
`create_dept`
,
`create_time`
,
`update_user`
,
`update_time`
,
`status`
,
`is_deleted`
)
VALUES
(
1
,
'mysql'
,
'com.mysql.cj.jdbc.Driver'
,
'jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true'
,
'root'
,
'root'
,
'mysql'
,
1
,
1
,
'2019-08-14 11:43:06'
,
1
,
'2019-08-14 11:43:06'
,
1
,
0
);
INSERT
INTO
`blade_datasource`
(
`id`
,
`name`
,
`driver_class`
,
`url`
,
`username`
,
`password`
,
`remark`
,
`create_user`
,
`create_dept`
,
`create_time`
,
`update_user`
,
`update_time`
,
`status`
,
`is_deleted`
)
VALUES
(
2
,
'postgresql'
,
'org.postgresql.Driver'
,
'jdbc:postgresql://127.0.0.1:5432/blade'
,
'postgres'
,
'123456'
,
'postgresql'
,
1
,
1
,
'2019-08-14 11:43:41'
,
1
,
'2019-08-14 11:43:41'
,
1
,
0
);
INSERT
INTO
`blade_datasource`
(
`id`
,
`name`
,
`driver_class`
,
`url`
,
`username`
,
`password`
,
`remark`
,
`create_user`
,
`create_dept`
,
`create_time`
,
`update_user`
,
`update_time`
,
`status`
,
`is_deleted`
)
VALUES
(
3
,
'oracle'
,
'oracle.jdbc.OracleDriver'
,
'jdbc:oracle:thin:@127.0.0.1:49161:orcl'
,
'BLADE'
,
'blade'
,
'oracle'
,
1
,
1
,
'2019-08-14 11:44:03'
,
1
,
'2019-08-14 11:44:03'
,
1
,
0
);
-- ----------------------------
-- 插入数据源菜单数据
-- ----------------------------
INSERT
INTO
`blade_menu`
(
`parent_id`
,
`code`
,
`name`
,
`alias`
,
`path`
,
`source`
,
`sort`
,
`category`
,
`action`
,
`is_open`
,
`remark`
,
`is_deleted`
)
VALUES
(
17
,
'datasource'
,
'数据源管理'
,
'menu'
,
'/tool/datasource'
,
'iconfont icon-caidanguanli'
,
2
,
1
,
0
,
1
,
NULL
,
0
);
set
@
parentid
=
(
SELECT
LAST_INSERT_ID
());
INSERT
INTO
`blade_menu`
(
`parent_id`
,
`code`
,
`name`
,
`alias`
,
`path`
,
`source`
,
`sort`
,
`category`
,
`action`
,
`is_open`
,
`remark`
,
`is_deleted`
)
VALUES
(
@
parentid
,
'datasource_add'
,
'新增'
,
'add'
,
'/tool/datasource/add'
,
'plus'
,
1
,
2
,
1
,
1
,
NULL
,
0
);
INSERT
INTO
`blade_menu`
(
`parent_id`
,
`code`
,
`name`
,
`alias`
,
`path`
,
`source`
,
`sort`
,
`category`
,
`action`
,
`is_open`
,
`remark`
,
`is_deleted`
)
VALUES
(
@
parentid
,
'datasource_edit'
,
'修改'
,
'edit'
,
'/tool/datasource/edit'
,
'form'
,
2
,
2
,
2
,
2
,
NULL
,
0
);
INSERT
INTO
`blade_menu`
(
`parent_id`
,
`code`
,
`name`
,
`alias`
,
`path`
,
`source`
,
`sort`
,
`category`
,
`action`
,
`is_open`
,
`remark`
,
`is_deleted`
)
VALUES
(
@
parentid
,
'datasource_delete'
,
'删除'
,
'delete'
,
'/api/blade-develop/datasource/remove'
,
'delete'
,
3
,
2
,
3
,
3
,
NULL
,
0
);
INSERT
INTO
`blade_menu`
(
`parent_id`
,
`code`
,
`name`
,
`alias`
,
`path`
,
`source`
,
`sort`
,
`category`
,
`action`
,
`is_open`
,
`remark`
,
`is_deleted`
)
VALUES
(
@
parentid
,
'datasource_view'
,
'查看'
,
'view'
,
'/tool/datasource/view'
,
'file-text'
,
4
,
2
,
2
,
2
,
NULL
,
0
);
-- ----------------------------
-- 代码生成表增加数据源字段
-- ----------------------------
ALTER
TABLE
`blade_code`
ADD
COLUMN
`datasource_id`
bigint
(
64
)
NULL
COMMENT
'数据源主键'
AFTER
`id`
,
ADD
COLUMN
`base_mode`
int
(
2
)
NULL
COMMENT
'基础业务模式'
AFTER
`package_name`
,
ADD
COLUMN
`wrap_mode`
int
(
2
)
NULL
COMMENT
'包装器模式'
AFTER
`base_mode`
;
-- ----------------------------
-- 代码生成记录增加数据源字段
-- ----------------------------
UPDATE
`blade_code`
SET
`datasource_id`
=
1
,
`base_mode`
=
1
,
`wrap_mode`
=
1
WHERE
`id`
=
1
;
pom.xml
浏览文件 @
61c5722b
...
@@ -5,17 +5,17 @@
...
@@ -5,17 +5,17 @@
<groupId>
org.springblade
</groupId>
<groupId>
org.springblade
</groupId>
<artifactId>
SpringBlade
</artifactId>
<artifactId>
SpringBlade
</artifactId>
<version>
2.
4.1
</version>
<version>
2.
5.0
</version>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<properties>
<properties>
<blade.tool.version>
2.
4.1
</blade.tool.version>
<blade.tool.version>
2.
5.0
</blade.tool.version>
<blade.project.version>
2.
4.1
</blade.project.version>
<blade.project.version>
2.
5.0
</blade.project.version>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
<swagger.version>
2.9.2
</swagger.version>
<swagger.version>
2.9.2
</swagger.version>
<swagger.models.version>
1.5.21
</swagger.models.version>
<swagger.models.version>
1.5.21
</swagger.models.version>
<swagger.bootstrapui.version>
1.9.
4
</swagger.bootstrapui.version>
<swagger.bootstrapui.version>
1.9.
6
</swagger.bootstrapui.version>
<mybatis.plus.version>
3.1.2
</mybatis.plus.version>
<mybatis.plus.version>
3.1.2
</mybatis.plus.version>
<curator.framework.version>
4.0.1
</curator.framework.version>
<curator.framework.version>
4.0.1
</curator.framework.version>
<protostuff.version>
1.6.0
</protostuff.version>
<protostuff.version>
1.6.0
</protostuff.version>
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
<alibaba.cloud.version>
2.1.0.RELEASE
</alibaba.cloud.version>
<alibaba.cloud.version>
2.1.0.RELEASE
</alibaba.cloud.version>
<spring.boot.admin.version>
2.1.5
</spring.boot.admin.version>
<spring.boot.admin.version>
2.1.5
</spring.boot.admin.version>
<spring.boot.version>
2.1.
7
.RELEASE
</spring.boot.version>
<spring.boot.version>
2.1.
8
.RELEASE
</spring.boot.version>
<spring.cloud.version>
Greenwich.SR
2
</spring.cloud.version>
<spring.cloud.version>
Greenwich.SR
3
</spring.cloud.version>
<spring.platform.version>
Cairo-SR8
</spring.platform.version>
<spring.platform.version>
Cairo-SR8
</spring.platform.version>
<!-- 推荐使用Harbor -->
<!-- 推荐使用Harbor -->
...
...
script/docker/.env
浏览文件 @
61c5722b
REGISTER=192.168.0.157/blade
REGISTER=192.168.0.157/blade
TAG=2.
4.1
TAG=2.
5.0
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录