Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
9fb182e2
提交
9fb182e2
authored
12月 05, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. 访问令牌,增加 Redis 作为缓存
2. 删除多余的 order 代码
上级
03fde369
隐藏空白字符变更
内嵌
并排
正在显示
47 个修改的文件
包含
326 行增加
和
2220 行删除
+326
-2220
README.md
README.md
+1
-1
OrderLastLogisticsInfoBO.java
...n/iocoder/mall/order/biz/bo/OrderLastLogisticsInfoBO.java
+0
-85
OrderLogisticsBO.java
...n/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsBO.java
+0
-41
OrderLogisticsInfoBO.java
...va/cn/iocoder/mall/order/biz/bo/OrderLogisticsInfoBO.java
+0
-82
OrderLogisticsInfoWithOrderBO.java
...oder/mall/order/biz/bo/OrderLogisticsInfoWithOrderBO.java
+0
-100
OrderReturnInfoBO.java
.../java/cn/iocoder/mall/order/biz/bo/OrderReturnInfoBO.java
+0
-141
OrderReturnListBO.java
.../java/cn/iocoder/mall/order/biz/bo/OrderReturnListBO.java
+0
-122
OrderCommentBO.java
.../cn/iocoder/mall/order/biz/bo/comment/OrderCommentBO.java
+0
-86
OrderCommentCreateBO.java
...coder/mall/order/biz/bo/comment/OrderCommentCreateBO.java
+0
-25
OrderCommentInfoAndMerchantReplyBO.java
...er/biz/bo/comment/OrderCommentInfoAndMerchantReplyBO.java
+0
-29
OrderCommentInfoBO.java
...iocoder/mall/order/biz/bo/comment/OrderCommentInfoBO.java
+0
-84
OrderCommentMerchantReplyBO.java
...all/order/biz/bo/comment/OrderCommentMerchantReplyBO.java
+0
-21
OrderCommentPageBO.java
...iocoder/mall/order/biz/bo/comment/OrderCommentPageBO.java
+0
-159
OrderCommentReplyCreateBO.java
.../mall/order/biz/bo/comment/OrderCommentReplyCreateBO.java
+0
-24
OrderCommentReplyPageBO.java
...er/mall/order/biz/bo/comment/OrderCommentReplyPageBO.java
+0
-83
OrderCommentStateInfoPageBO.java
...all/order/biz/bo/comment/OrderCommentStateInfoPageBO.java
+0
-87
OrderCommentTimeOutBO.java
...oder/mall/order/biz/bo/comment/OrderCommentTimeOutBO.java
+0
-25
OrderLastLogisticsInfoBO.java
...der/mall/order/biz/bo/order/OrderLastLogisticsInfoBO.java
+0
-85
OrderLogisticsBO.java
.../cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java
+0
-41
OrderLogisticsInfoBO.java
...iocoder/mall/order/biz/bo/order/OrderLogisticsInfoBO.java
+0
-82
OrderLogisticsInfoWithOrderBO.java
...all/order/biz/bo/order/OrderLogisticsInfoWithOrderBO.java
+0
-100
OrderReturnInfoBO.java
...cn/iocoder/mall/order/biz/bo/order/OrderReturnInfoBO.java
+0
-141
OrderReturnListBO.java
...cn/iocoder/mall/order/biz/bo/order/OrderReturnListBO.java
+0
-122
UsersOrderController.java
...all/order/rest/controller/order/UsersOrderController.java
+0
-30
pom.xml
moved/product/pom.xml
+0
-35
ProductAttrBO.java
...va/cn/iocoder/mall/product/biz/bo/attr/ProductAttrBO.java
+0
-30
ProductAttrSimpleBO.java
...iocoder/mall/product/biz/bo/attr/ProductAttrSimpleBO.java
+0
-25
pom.xml
moved/product/product-start/pom.xml
+0
-106
UserAddressController.http
...r/mall/shopweb/controller/user/UserAddressController.http
+1
-0
pom.xml
system-service-project/pom.xml
+1
-0
SystemBizProperties.java
...ocoder/mall/systemservice/config/SystemBizProperties.java
+30
-0
OAuth2Convert.java
...coder/mall/systemservice/convert/oauth/OAuth2Convert.java
+1
-4
OAuth2AccessTokenMapper.java
...rvice/dal/mysql/mapper/oauth/OAuth2AccessTokenMapper.java
+11
-0
RedisKeyConstants.java
...coder/mall/systemservice/dal/redis/RedisKeyConstants.java
+24
-0
OAuth2AccessTokenRedisDAO.java
...ystemservice/dal/redis/dao/OAuth2AccessTokenRedisDAO.java
+36
-0
AdminManager.java
...ocoder/mall/systemservice/manager/admin/AdminManager.java
+4
-3
OAuth2Manager.java
...coder/mall/systemservice/manager/oauth/OAuth2Manager.java
+0
-47
OAuth2RpcImpl.java
...n/iocoder/mall/systemservice/rpc/oauth/OAuth2RpcImpl.java
+9
-9
OAuth2Service.java
...coder/mall/systemservice/service/oauth/OAuth2Service.java
+10
-107
OAuth2ServiceImpl.java
...r/mall/systemservice/service/oauth/OAuth2ServiceImpl.java
+161
-0
OAuth2AccessTokenBO.java
...l/systemservice/service/oauth/bo/OAuth2AccessTokenBO.java
+0
-36
application.properties
...tem-service-app/src/main/resources/application.properties
+0
-4
application.yaml
...ct/system-service-app/src/main/resources/application.yaml
+5
-2
pom.xml
...m-service-project/system-service-integration-test/pom.xml
+7
-16
OAuth2ServiceImplTest.java
...ll/systemservice/service/oauth/OAuth2ServiceImplTest.java
+21
-0
package-info.java
...a/cn/iocoder/mall/systemservice/service/package-info.java
+1
-0
TradeBizProperties.java
.../iocoder/mall/tradeservice/config/TradeBizProperties.java
+3
-0
没有找到文件。
README.md
浏览文件 @
9fb182e2
...
@@ -119,7 +119,7 @@ TODO 此处应有一个架构图的装逼 JPG 图。
...
@@ -119,7 +119,7 @@ TODO 此处应有一个架构图的装逼 JPG 图。
|
`pay-service-project`
| 支付 RPC 服务 | 随机 | |
|
`pay-service-project`
| 支付 RPC 服务 | 随机 | |
|
`trade-service-project`
| 交易 RPC 服务 | 随机 | |
|
`trade-service-project`
| 交易 RPC 服务 | 随机 | |
|
`product-service-project`
| 商品 RPC 服务 | 随机 | |
|
`product-service-project`
| 商品 RPC 服务 | 随机 | |
|
`search-service-project`
| 搜索
å
RPC 服务 | 随机 | |
|
`search-service-project`
| 搜索 RPC 服务 | 随机 | |
-------
-------
...
...
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLastLogisticsInfoBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单物流 - 最后一个物流信息
*
* @author Sin
* @time 2019-04-12 22:03
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLastLogisticsInfoBO
implements
Serializable
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流 (字典)
*/
private
Integer
logistics
;
/**
* 物流 (字典) 转换后的值
*/
private
String
logisticsText
;
/**
* 物流编号
*/
private
String
logisticsNo
;
///
/// 物流信息
/**
* 最后一个物流信息
*/
private
LogisticsDetail
lastLogisticsDetail
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
LogisticsDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
/**
* 物流时间
*/
private
Date
logisticsTime
;
/**
* 物流时间 text
*/
private
String
logisticsTimeText
;
/**
* 物流信息
*/
private
String
logisticsInformation
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
;
import
cn.iocoder.mall.mybatis.core.dataobject.BaseDO
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 订单物流信息
*
* @author Sin
* @time 2019-03-19 20:47
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLogisticsBO
extends
BaseDO
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流编号
*/
private
String
logisticsNo
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsInfoBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单物流 - 详细信息
*
* @author Sin
* @time 2019-04-12 22:03
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLogisticsInfoBO
implements
Serializable
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流 (字典)
*/
private
Integer
logistics
;
/**
* 物流 (字典) 转换后的值
*/
private
String
logisticsText
;
/**
* 物流编号
*/
private
String
logisticsNo
;
///
/// 物流信息
private
List
<
LogisticsDetail
>
details
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
LogisticsDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
/**
* 物流时间
*/
private
Date
logisticsTime
;
/**
* 物流时间 text
*/
private
String
logisticsTimeText
;
/**
* 物流信息
*/
private
String
logisticsInformation
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderLogisticsInfoWithOrderBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单物流 - 详细信息
*
* @author Sin
* @time 2019-04-12 22:03
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLogisticsInfoWithOrderBO
implements
Serializable
{
/**
* 订单id
*/
private
Integer
orderId
;
/**
* 订单编号
*/
private
String
orderNo
;
/**
* 物流信息
*/
private
List
<
Logistics
>
logistics
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
Logistics
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流 (字典)
*/
private
Integer
logistics
;
/**
* 物流 (字典) 转换后的值
*/
private
String
logisticsText
;
/**
* 物流编号
*/
private
String
logisticsNo
;
///
/// 物流信息
private
List
<
LogisticsDetail
>
details
;
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
LogisticsDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
/**
* 物流时间
*/
private
Date
logisticsTime
;
/**
* 物流时间 text
*/
private
String
logisticsTimeText
;
/**
* 物流信息
*/
private
String
logisticsInformation
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderReturnInfoBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单退货 info
*
* @author Sin
* @time 2019-04-27 10:19
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderReturnInfoBO
implements
Serializable
{
/**
* 退货信息
*/
private
ReturnInfo
returnInfo
;
/**
* 订单 item
*/
private
List
<
OrderItem
>
orderItems
;
/**
* 最后一个物流信息/最新物流信息
*/
private
OrderLastLogisticsInfoBO
lastLogisticsInfo
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
OrderItem
{
/**
* 商品编号
*/
private
Integer
skuId
;
/**
* 商品名称
*/
private
String
skuName
;
/**
* 商品图片
*/
private
String
skuImage
;
/**
* 数量
*/
private
Integer
quantity
;
/**
* 最终总金额,单位:分。
*/
private
Integer
presentTotal
;
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
ReturnInfo
{
/**
* 编号自动增长
*/
private
Integer
id
;
/**
* 服务号
*/
private
String
serviceNumber
;
/**
* 订单编号
*/
private
Integer
orderId
;
/**
* 订单号 (保存一个冗余)
*/
private
String
orderNo
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
///
/// 退货原因
/**
* 退货金额
*/
private
Integer
refundPrice
;
/**
* 退货原因(字典值)
*/
private
Integer
reason
;
/**
* 问题描述
*/
private
String
describe
;
///
/// 时间信息
/**
* 同意时间
*/
private
Date
approvalTime
;
/**
* 物流时间(填写物流单号时间)
*/
private
Date
logisticsTime
;
/**
* 收货时间
*/
private
Date
receiverTime
;
/**
* 成交时间(确认时间)
*/
private
Date
closingTime
;
/**
* 退款类型
*
* - 1、退货退款
* - 2、退款
*/
private
Integer
serviceType
;
/**
* 退款类型 转换值
*/
private
String
serviceTypeText
;
/**
* 状态
*
* - 1、退货申请
* - 2、申请成功
* - 3、申请失败
* - 4、退货中
* - 5、退货成功
*/
private
Integer
status
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/OrderReturnListBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 订单退货 list
*
* @author Sin
* @time 2019-05-06 21:54
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderReturnListBO
implements
Serializable
{
/**
* 分页当前 index
*/
private
Integer
index
;
/**
* pageSize
*/
private
Integer
pageSize
;
/**
* totalCount
*/
private
Integer
totalCount
;
/**
* data
*/
private
List
<
OrderReturn
>
data
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
OrderReturn
{
/**
* 编号自动增长
*/
private
Integer
id
;
/**
* 服务号
*/
private
String
serviceNumber
;
/**
* 订单编号
*/
private
Integer
orderId
;
/**
* 订单号 (保存一个冗余)
*/
private
String
orderNo
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
///
/// 退货原因
/**
* 退货金额
*/
private
Integer
refundPrice
;
/**
* 退货原因(字典值)
*/
private
Integer
reason
;
/**
* 问题描述
*/
private
String
describe
;
///
/// 时间信息
/**
* 同意时间
*/
private
Date
approvalTime
;
/**
* 物流时间(填写物流单号时间)
*/
private
Date
logisticsTime
;
/**
* 收货时间
*/
private
Date
receiverTime
;
/**
* 成交时间(确认时间)
*/
private
Date
closingTime
;
/**
* 服务类型
*
* - 1、退货退款
* - 2、退款
*/
private
Integer
serviceType
;
/**
* 状态
*
* - 1、退货申请
* - 2、申请成功
* - 3、申请失败
* - 4、退货中
* - 5、退货成功
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
*
* 订单评价
*
* @author wtz
* @time 2019-05-14 20:00:00
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentBO
implements
Serializable
{
/**
* 总条数
*/
private
Integer
total
;
/**
* 好评
*/
private
Integer
positiveTotal
;
/**
* 中评
*/
private
Integer
moderateTotal
;
/**
* 差评
*/
private
Integer
negativeTotal
;
/**
* 评论 id
*/
private
Integer
id
;
/**
* 用户头像
*/
private
String
userAvatar
;
/**
* 用户的真实姓名
*/
private
String
userNickName
;
/**
* 评价星
*/
private
Integer
star
;
/**
* 评论的内容
*/
private
String
commentContent
;
/**
* 评论的图片地址
*/
private
String
commentPics
;
/**
* 回复条数
*/
private
Integer
replayCount
;
/**
* 点赞数
*/
private
Integer
collectCount
;
/**
* 创建时间
*/
private
Date
createTime
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentCreateBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
*
* 订单评论创建
*
* @author wtz
* @time 2019-05-19 18:32
*
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentCreateBO
implements
Serializable
{
/**
* 订单评论 id
*/
private
Integer
id
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoAndMerchantReplyBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
/**
*
* 评论详情和商家评论回复
*
* @author wtz
* @time 2019-06-03 20:30
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentInfoAndMerchantReplyBO
{
/**
* 评论详情
*/
private
OrderCommentInfoBO
orderCommentInfoBO
;
/**
* 商家评论回复
*/
private
List
<
OrderCommentMerchantReplyBO
>
orderCommentMerchantReplyBOS
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
*
* 订单回复评价详情
*
* @author wtz
* @time 2019-05-16 18:40
*
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentInfoBO
implements
Serializable
{
/**
* 评论 id
*/
private
Integer
id
;
/**
* 用户头像
*/
private
String
userAvatar
;
/**
* 用户昵称
*/
private
String
userNickName
;
/**
* 评价星
*/
private
Integer
star
;
/**
* 评论的内容
*/
private
String
commentContent
;
/**
* 评论的图片地址
*/
private
String
commentPics
;
/**
* 点赞数
*/
private
Integer
likeCount
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 商品 sku id
*/
private
int
productSkuId
;
/**
* 商品 sku 属性
*/
private
String
productSkuAttrs
;
/**
* 商品 sku 价格
*/
private
String
productSkuPrice
;
/**
* 商品 sku 地址
*/
private
String
productSkuPicUrl
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentMerchantReplyBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
*
* 商家评论回复
*
* @author wtz
* @time 2019-06-03 19:30
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentMerchantReplyBO
{
/**
* 商家评论回复
*/
private
String
replyContent
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentPageBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
*
* 订单评论分页展示
*
* @author wtz
* @time 2019-05-14 20:00:00
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentPageBO
implements
Serializable
{
/**
* 总条数
*/
private
Integer
total
;
// 评论标签化等等在做
// /**
// * 好评
// */
// private Integer positiveTotal;
//
// /**
// * 中评
// */
// private Integer moderateTotal;
//
// /**
// * 差评
// */
// private Integer negativeTotal;
// /**
// * 评论列表
// */
// private List<OrderCommentItem> orderCommentItems;
/**
* 评论 id
*/
private
Integer
id
;
/**
* 用户头像
*/
private
String
userAvatar
;
/**
* 用户的真实姓名
*/
private
String
userNickName
;
/**
* 评价星
*/
private
Integer
star
;
/**
* 评论的内容
*/
private
String
commentContent
;
/**
* 评论的图片地址
*/
private
String
commentPics
;
/**
* 回复条数
*/
private
Integer
replayCount
;
/**
* 点赞数
*/
private
Integer
likeCount
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 商家回复列表
* 只展示最近的一条
*/
private
String
replyContent
;
@Data
@Accessors
(
chain
=
true
)
@AllArgsConstructor
public
static
class
OrderCommentItem
{
// /**
// * 评论 id
// */
// private Integer id;
//
// /**
// * 用户头像
// */
// private String userAvatar;
//
// /**
// * 用户的真实姓名
// */
// private String userNickName;
//
// /**
// * 评价星
// */
// private Integer star;
//
// /**
// * 评论的内容
// */
// private String commentContent;
//
// /**
// * 评论的图片地址
// */
// private String commentPics;
//
// /**
// * 回复条数
// */
// private Integer replayCount;
//
// /**
// * 点赞数
// */
// private Integer likeCount;
//
// /**
// * 创建时间
// */
// private Date createTime;
//
// /**
// * 商家回复列表
// * 只展示最近的一条
// */
// private String replyContent;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyCreateBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
*
* 订单回复创建
*
* @author wtz
* @time 2019-05-19 18:35
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentReplyCreateBO
implements
Serializable
{
/**
* 评论回复 id
*/
private
Integer
id
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyPageBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
*
* 评论回复分页展示
*
* @author wtz
* @time 2019-05-19 14:19
*
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentReplyPageBO
implements
Serializable
{
/**
* 评论回复总数
*/
private
Integer
total
;
/**
* 用户回复
*/
List
<
OrderCommentReplayItem
>
orderCommentReplayItems
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
OrderCommentReplayItem
{
/**
* 回复 id
*/
private
Integer
id
;
/**
* 回复的类型
*/
private
Integer
replyType
;
/**
* 回复的内容
*/
private
String
replyContent
;
/**
* 回复的用户 id
*/
private
int
replyUserId
;
/**
* 回复用户的真实姓名
*/
private
String
replyUserNickName
;
/**
* 回复用户的头像
*/
private
String
replyUserAvatar
;
/**
* 回复的点赞数
*/
private
int
replyCollectCount
;
/**
* 回复目标用户昵称
*/
private
String
parentUserNickName
;
/**
* 创建时间
*/
private
Date
createTime
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentStateInfoPageBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
*
* 订单评论状态详情分页(这么设计因为这个接口需要登陆以后才能看到所以与订单分页接口分开)
*
* @author wtz
* @time 2019-06-07 10:39
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentStateInfoPageBO
implements
Serializable
{
/**
* (待/已)评论总数
*/
private
Integer
total
;
/**
* 评论状态
*/
private
List
<
OrderCommentStateInfoItem
>
orderCommentStateInfoItems
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
OrderCommentStateInfoItem
{
/**
* 订单 id
*/
private
Integer
orderId
;
/**
* 订单编号
*/
private
String
orderNo
;
/**
* 商品 id
*/
private
Integer
productSpuId
;
/**
* 商品名称
*/
private
String
productSpuName
;
/**
* 商品 sku id
*/
private
Integer
productSkuId
;
/**
* 商品 sku 属性
*/
private
String
productSkuAttrs
;
/**
* 商品 sku 价格
*/
private
Integer
productSkuPrice
;
/**
* 商品 sku url
*/
private
String
productSkuPicUrl
;
/**
* 订单评论状态
*/
private
Integer
commentState
;
/**
* 创建时间
*/
private
Date
createTime
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentTimeOutBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
comment
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.io.Serializable
;
/**
* 订单评论超时
*
* @author wtz
* @time 2019-06-15 13:52
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderCommentTimeOutBO
implements
Serializable
{
/**
* 评论 id
*/
private
Integer
id
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLastLogisticsInfoBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
order
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单物流 - 最后一个物流信息
*
* @author Sin
* @time 2019-04-12 22:03
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLastLogisticsInfoBO
implements
Serializable
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流 (字典)
*/
private
Integer
logistics
;
/**
* 物流 (字典) 转换后的值
*/
private
String
logisticsText
;
/**
* 物流编号
*/
private
String
logisticsNo
;
///
/// 物流信息
/**
* 最后一个物流信息
*/
private
LogisticsDetail
lastLogisticsDetail
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
LogisticsDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
/**
* 物流时间
*/
private
Date
logisticsTime
;
/**
* 物流时间 text
*/
private
String
logisticsTimeText
;
/**
* 物流信息
*/
private
String
logisticsInformation
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
order
;
import
cn.iocoder.mall.mybatis.core.dataobject.BaseDO
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 订单物流信息
*
* @author Sin
* @time 2019-03-19 20:47
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLogisticsBO
extends
BaseDO
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流编号
*/
private
String
logisticsNo
;
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
order
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单物流 - 详细信息
*
* @author Sin
* @time 2019-04-12 22:03
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLogisticsInfoBO
implements
Serializable
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流 (字典)
*/
private
Integer
logistics
;
/**
* 物流 (字典) 转换后的值
*/
private
String
logisticsText
;
/**
* 物流编号
*/
private
String
logisticsNo
;
///
/// 物流信息
private
List
<
LogisticsDetail
>
details
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
LogisticsDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
/**
* 物流时间
*/
private
Date
logisticsTime
;
/**
* 物流时间 text
*/
private
String
logisticsTimeText
;
/**
* 物流信息
*/
private
String
logisticsInformation
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoWithOrderBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
order
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单物流 - 详细信息
*
* @author Sin
* @time 2019-04-12 22:03
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderLogisticsInfoWithOrderBO
implements
Serializable
{
/**
* 订单id
*/
private
Integer
orderId
;
/**
* 订单编号
*/
private
String
orderNo
;
/**
* 物流信息
*/
private
List
<
Logistics
>
logistics
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
Logistics
{
/**
* id
*/
private
Integer
id
;
/**
* 收件区域编号
*/
private
String
areaNo
;
/**
* 收件人名称
*/
private
String
name
;
/**
* 收件手机号
*/
private
String
mobile
;
/**
* 收件详细地址
*/
private
String
address
;
/**
* 物流 (字典)
*/
private
Integer
logistics
;
/**
* 物流 (字典) 转换后的值
*/
private
String
logisticsText
;
/**
* 物流编号
*/
private
String
logisticsNo
;
///
/// 物流信息
private
List
<
LogisticsDetail
>
details
;
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
LogisticsDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
/**
* 物流时间
*/
private
Date
logisticsTime
;
/**
* 物流时间 text
*/
private
String
logisticsTimeText
;
/**
* 物流信息
*/
private
String
logisticsInformation
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnInfoBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
order
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单退货 info
*
* @author Sin
* @time 2019-04-27 10:19
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderReturnInfoBO
implements
Serializable
{
/**
* 退货信息
*/
private
ReturnInfo
returnInfo
;
/**
* 订单 item
*/
private
List
<
OrderItem
>
orderItems
;
/**
* 最后一个物流信息/最新物流信息
*/
private
OrderLastLogisticsInfoBO
lastLogisticsInfo
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
OrderItem
{
/**
* 商品编号
*/
private
Integer
skuId
;
/**
* 商品名称
*/
private
String
skuName
;
/**
* 商品图片
*/
private
String
skuImage
;
/**
* 数量
*/
private
Integer
quantity
;
/**
* 最终总金额,单位:分。
*/
private
Integer
presentTotal
;
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
ReturnInfo
{
/**
* 编号自动增长
*/
private
Integer
id
;
/**
* 服务号
*/
private
String
serviceNumber
;
/**
* 订单编号
*/
private
Integer
orderId
;
/**
* 订单号 (保存一个冗余)
*/
private
String
orderNo
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
///
/// 退货原因
/**
* 退货金额
*/
private
Integer
refundPrice
;
/**
* 退货原因(字典值)
*/
private
Integer
reason
;
/**
* 问题描述
*/
private
String
describe
;
///
/// 时间信息
/**
* 同意时间
*/
private
Date
approvalTime
;
/**
* 物流时间(填写物流单号时间)
*/
private
Date
logisticsTime
;
/**
* 收货时间
*/
private
Date
receiverTime
;
/**
* 成交时间(确认时间)
*/
private
Date
closingTime
;
/**
* 退款类型
*
* - 1、退货退款
* - 2、退款
*/
private
Integer
serviceType
;
/**
* 退款类型 转换值
*/
private
String
serviceTypeText
;
/**
* 状态
*
* - 1、退货申请
* - 2、申请成功
* - 3、申请失败
* - 4、退货中
* - 5、退货成功
*/
private
Integer
status
;
}
}
moved/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnListBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
order
.
biz
.
bo
.
order
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 订单退货 list
*
* @author Sin
* @time 2019-05-06 21:54
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OrderReturnListBO
implements
Serializable
{
/**
* 分页当前 index
*/
private
Integer
index
;
/**
* pageSize
*/
private
Integer
pageSize
;
/**
* totalCount
*/
private
Integer
totalCount
;
/**
* data
*/
private
List
<
OrderReturn
>
data
;
@Data
@Accessors
(
chain
=
true
)
public
static
class
OrderReturn
{
/**
* 编号自动增长
*/
private
Integer
id
;
/**
* 服务号
*/
private
String
serviceNumber
;
/**
* 订单编号
*/
private
Integer
orderId
;
/**
* 订单号 (保存一个冗余)
*/
private
String
orderNo
;
/**
* 物流id
*/
private
Integer
orderLogisticsId
;
///
/// 退货原因
/**
* 退货金额
*/
private
Integer
refundPrice
;
/**
* 退货原因(字典值)
*/
private
Integer
reason
;
/**
* 问题描述
*/
private
String
describe
;
///
/// 时间信息
/**
* 同意时间
*/
private
Date
approvalTime
;
/**
* 物流时间(填写物流单号时间)
*/
private
Date
logisticsTime
;
/**
* 收货时间
*/
private
Date
receiverTime
;
/**
* 成交时间(确认时间)
*/
private
Date
closingTime
;
/**
* 服务类型
*
* - 1、退货退款
* - 2、退款
*/
private
Integer
serviceType
;
/**
* 状态
*
* - 1、退货申请
* - 2、申请成功
* - 3、申请失败
* - 4、退货中
* - 5、退货成功
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
}
}
moved/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java
浏览文件 @
9fb182e2
...
@@ -16,36 +16,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -16,36 +16,6 @@ import org.springframework.web.bind.annotation.RestController;
@Api
(
description
=
"用户订单"
)
// TODO FROM 芋艿 to 小范,description 已经废弃啦
@Api
(
description
=
"用户订单"
)
// TODO FROM 芋艿 to 小范,description 已经废弃啦
public
class
UsersOrderController
{
public
class
UsersOrderController
{
// @PostMapping("create_order_from_cart")
// @RequiresLogin
// @ApiOperation("创建订单购物车")
// public CommonResult<OrderCreateBO> createOrderFromCart(@RequestParam("userAddressId") Integer userAddressId,
// @RequestParam(value = "couponCardId", required = false) Integer couponCardId,
// @RequestParam(value = "remark", required = false) String remark,
// HttpServletRequest request) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// // 获得购物车中选中的商品
// List<CartItemBO> cartItems = cartService.list(userId, true);
// if (cartItems.isEmpty()) {
// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_CREATE_CART_IS_EMPTY.getCode());
// }
// // 创建 OrderCreateDTO 对象
// OrderCreateDTO orderCreateDTO = OrderConvertAPP.INSTANCE.createOrderCreateDTO(userId, userAddressId,
// remark, HttpUtil.getIp(request),
// cartItems, couponCardId);
// // 创建订单
// CommonResult<OrderCreateBO> createResult = orderService.createOrder(orderCreateDTO);
// if (createResult.isError()) {
// return CommonResult.error(createResult);
// }
// // 清空购物车 // TODO 芋艿,需要标记删除的原因,即结果为创建为某个订单。
// cartService.deleteList(userId, cartItems.stream().map(CartItemBO::getSkuId).collect(Collectors.toList()));
// // 返回结果
// return createResult;
// }
//
//
//
// @PostMapping("confirm_receiving")
// @PostMapping("confirm_receiving")
// @RequiresLogin
// @RequiresLogin
...
...
moved/product/pom.xml
deleted
100644 → 0
浏览文件 @
03fde369
<?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>
onemall
</artifactId>
<groupId>
cn.iocoder.mall
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
product
</artifactId>
<name>
product
</name>
<packaging>
pom
</packaging>
<modules>
<module>
product-rpc-api
</module>
<module>
product-rpc
</module>
<module>
product-rest
</module>
<module>
product-biz
</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-dependencies
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
moved/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
product
.
biz
.
bo
.
attr
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@Accessors
(
chain
=
true
)
public
class
ProductAttrBO
implements
Serializable
{
/**
* 规格编号
*/
private
Integer
id
;
/**
* 规格名
*/
private
String
name
;
/**
* 状态
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
}
moved/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/attr/ProductAttrSimpleBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
product
.
biz
.
bo
.
attr
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* 商品规格精简 VO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
ProductAttrSimpleBO
implements
Serializable
{
/**
* 规格编号
*/
private
Integer
id
;
/**
* 规格名
*/
private
String
name
;
}
moved/product/product-start/pom.xml
deleted
100644 → 0
浏览文件 @
03fde369
<?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>
product
</artifactId>
<groupId>
cn.iocoder.mall
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
product-start
</artifactId>
<dependencies>
<!-- Mall 相关 -->
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
common-framework
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
product-service-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
product-service-impl
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot-starter-mybatis
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
swagger-bootstrap-ui
</artifactId>
</dependency>
<!-- 服务保障相关 -->
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-sentinel
</artifactId>
</dependency>
<!-- 监控 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
io.micrometer
</groupId>
<artifactId>
micrometer-registry-prometheus
</artifactId>
</dependency>
<!-- 测试相关 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-spring-boot-starter-security
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 提供给 mapstruct 使用 -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
</plugin>
<!-- 打包 -->
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.http
浏览文件 @
9fb182e2
### /user-address/get-default 成功
### /user-address/get-default 成功
GET {{shop-api-base-url}}/user-address/get-default
GET {{shop-api-base-url}}/user-address/get-default
Authorization: Bearer {{user-access-token}}
Authorization: Bearer {{user-access-token}}
dubbo-tag: {{dubboTag}}
###
###
system-service-project/pom.xml
浏览文件 @
9fb182e2
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
<modules>
<modules>
<module>
system-service-api
</module>
<module>
system-service-api
</module>
<module>
system-service-app
</module>
<module>
system-service-app
</module>
<module>
system-service-integration-test
</module>
</modules>
</modules>
<dependencyManagement>
<dependencyManagement>
...
...
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/config/SystemBizProperties.java
0 → 100644
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
config
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.constraints.NotNull
;
/**
* 系统服务的业务配置项
*/
@Component
@ConfigurationProperties
(
"biz"
)
@Validated
@Data
public
class
SystemBizProperties
{
/**
* 访问令牌过期时间,单位:毫秒
*/
@NotNull
(
message
=
"访问令牌过期时间不能为空"
)
private
int
accessTokenExpireTimeMillis
;
/**
* 刷新令牌过期时间,单位:毫秒
*/
@NotNull
(
message
=
"刷新令牌过期时间不能为空"
)
private
int
refreshTokenExpireTimeMillis
;
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/convert/oauth/OAuth2Convert.java
浏览文件 @
9fb182e2
...
@@ -2,7 +2,6 @@ package cn.iocoder.mall.systemservice.convert.oauth;
...
@@ -2,7 +2,6 @@ package cn.iocoder.mall.systemservice.convert.oauth;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2AccessTokenDO
;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2AccessTokenDO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO
;
import
cn.iocoder.mall.systemservice.service.oauth.bo.OAuth2AccessTokenBO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.factory.Mappers
;
import
org.mapstruct.factory.Mappers
;
...
@@ -13,8 +12,6 @@ public interface OAuth2Convert {
...
@@ -13,8 +12,6 @@ public interface OAuth2Convert {
OAuth2Convert
INSTANCE
=
Mappers
.
getMapper
(
OAuth2Convert
.
class
);
OAuth2Convert
INSTANCE
=
Mappers
.
getMapper
(
OAuth2Convert
.
class
);
@Mapping
(
source
=
"id"
,
target
=
"accessToken"
)
@Mapping
(
source
=
"id"
,
target
=
"accessToken"
)
OAuth2AccessTokenBO
convert
(
OAuth2AccessTokenDO
bean
);
OAuth2AccessTokenRespDTO
convert
(
OAuth2AccessTokenDO
bean
);
OAuth2AccessTokenRespDTO
convert
(
OAuth2AccessTokenBO
bean
);
}
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/mysql/mapper/oauth/OAuth2AccessTokenMapper.java
浏览文件 @
9fb182e2
...
@@ -5,9 +5,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -5,9 +5,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
public
interface
OAuth2AccessTokenMapper
extends
BaseMapper
<
OAuth2AccessTokenDO
>
{
public
interface
OAuth2AccessTokenMapper
extends
BaseMapper
<
OAuth2AccessTokenDO
>
{
default
OAuth2AccessTokenDO
selectByUserIdAndUserType
(
Integer
userId
,
Integer
userType
)
{
return
selectOne
(
new
QueryWrapper
<
OAuth2AccessTokenDO
>()
.
eq
(
"user_id"
,
userId
).
eq
(
"user_type"
,
userType
));
}
default
int
deleteByUserIdAndUserType
(
Integer
userId
,
Integer
userType
)
{
default
int
deleteByUserIdAndUserType
(
Integer
userId
,
Integer
userType
)
{
return
delete
(
new
QueryWrapper
<
OAuth2AccessTokenDO
>()
return
delete
(
new
QueryWrapper
<
OAuth2AccessTokenDO
>()
.
eq
(
"user_id"
,
userId
).
eq
(
"user_type"
,
userType
));
.
eq
(
"user_id"
,
userId
).
eq
(
"user_type"
,
userType
));
...
@@ -17,4 +24,8 @@ public interface OAuth2AccessTokenMapper extends BaseMapper<OAuth2AccessTokenDO>
...
@@ -17,4 +24,8 @@ public interface OAuth2AccessTokenMapper extends BaseMapper<OAuth2AccessTokenDO>
return
delete
(
new
QueryWrapper
<
OAuth2AccessTokenDO
>().
eq
(
"refresh_token"
,
refreshToken
));
return
delete
(
new
QueryWrapper
<
OAuth2AccessTokenDO
>().
eq
(
"refresh_token"
,
refreshToken
));
}
}
default
List
<
OAuth2AccessTokenDO
>
selectListByRefreshToken
(
String
refreshToken
)
{
return
selectList
(
new
QueryWrapper
<
OAuth2AccessTokenDO
>().
eq
(
"refresh_token"
,
refreshToken
));
}
}
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/redis/RedisKeyConstants.java
0 → 100644
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
dal
.
redis
;
import
cn.iocoder.mall.redis.core.RedisKeyDefine
;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2AccessTokenDO
;
import
java.time.Duration
;
import
static
cn
.
iocoder
.
mall
.
redis
.
core
.
RedisKeyDefine
.
KeyTypeEnum
.
STRING
;
/**
* Redis Key 枚举类
*
* 通过将项目中的 Key 枚举在该类中,方便统一管理。
*/
public
interface
RedisKeyConstants
{
/**
* {@link OAuth2AccessTokenDO} 的缓存
*
* key 的 format 的参数是 [{@link OAuth2AccessTokenDO#getId()}]
*/
RedisKeyDefine
OAUTH2_ACCESS_TOKEN
=
new
RedisKeyDefine
(
"oauth2_access_token:%s"
,
STRING
,
OAuth2AccessTokenDO
.
class
,
Duration
.
ofHours
(
2
));
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/dal/redis/dao/OAuth2AccessTokenRedisDAO.java
0 → 100644
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
dal
.
redis
.
dao
;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2AccessTokenDO
;
import
com.alibaba.fastjson.JSON
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Repository
;
import
static
cn
.
iocoder
.
mall
.
systemservice
.
dal
.
redis
.
RedisKeyConstants
.
OAUTH2_ACCESS_TOKEN
;
@Repository
public
class
OAuth2AccessTokenRedisDAO
{
@Autowired
private
StringRedisTemplate
redisTemplate
;
public
OAuth2AccessTokenDO
get
(
String
accessToken
)
{
String
redisKey
=
formatKey
(
accessToken
);
return
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
redisKey
),
OAuth2AccessTokenDO
.
class
);
}
public
void
set
(
OAuth2AccessTokenDO
accessTokenDO
)
{
String
redisKey
=
formatKey
(
accessTokenDO
.
getId
());
redisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
accessTokenDO
),
OAUTH2_ACCESS_TOKEN
.
getTimeout
());
}
public
void
delete
(
String
accessToken
)
{
String
redisKey
=
formatKey
(
accessToken
);
redisTemplate
.
delete
(
redisKey
);
}
private
static
String
formatKey
(
String
accessToken
)
{
return
String
.
format
(
OAUTH2_ACCESS_TOKEN
.
getKeyTemplate
(),
accessToken
);
}
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/manager/admin/AdminManager.java
浏览文件 @
9fb182e2
...
@@ -10,9 +10,10 @@ import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminPageDTO;
...
@@ -10,9 +10,10 @@ import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminPageDTO;
import
cn.iocoder.mall.systemservice.rpc.admin.dto.AdminUpdateDTO
;
import
cn.iocoder.mall.systemservice.rpc.admin.dto.AdminUpdateDTO
;
import
cn.iocoder.mall.systemservice.rpc.admin.dto.AdminVerifyPasswordDTO
;
import
cn.iocoder.mall.systemservice.rpc.admin.dto.AdminVerifyPasswordDTO
;
import
cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO
;
import
cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RemoveTokenByUserReqDTO
;
import
cn.iocoder.mall.systemservice.service.admin.AdminService
;
import
cn.iocoder.mall.systemservice.service.admin.AdminService
;
import
cn.iocoder.mall.systemservice.service.admin.bo.AdminBO
;
import
cn.iocoder.mall.systemservice.service.admin.bo.AdminBO
;
import
cn.iocoder.mall.systemservice.service.oauth.OAuth2Service
;
import
cn.iocoder.mall.systemservice.service.oauth.OAuth2Service
Impl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -23,7 +24,7 @@ public class AdminManager {
...
@@ -23,7 +24,7 @@ public class AdminManager {
@Autowired
@Autowired
private
AdminService
adminService
;
private
AdminService
adminService
;
@Autowired
@Autowired
private
OAuth2Service
oauth2Service
;
private
OAuth2Service
Impl
oauth2Service
;
public
AdminVO
verifyPassword
(
AdminVerifyPasswordDTO
verifyPasswordDTO
)
{
public
AdminVO
verifyPassword
(
AdminVerifyPasswordDTO
verifyPasswordDTO
)
{
AdminBO
adminBO
=
adminService
.
verifyPassword
(
verifyPasswordDTO
.
getUsername
(),
AdminBO
adminBO
=
adminService
.
verifyPassword
(
verifyPasswordDTO
.
getUsername
(),
...
@@ -43,7 +44,7 @@ public class AdminManager {
...
@@ -43,7 +44,7 @@ public class AdminManager {
// 如果修改密码,或者禁用管理员
// 如果修改密码,或者禁用管理员
if
(
StringUtils
.
hasText
(
updateDTO
.
getPassword
())
if
(
StringUtils
.
hasText
(
updateDTO
.
getPassword
())
||
AdminStatusEnum
.
INACTIVE
.
getStatus
().
equals
(
updateDTO
.
getStatus
()))
{
||
AdminStatusEnum
.
INACTIVE
.
getStatus
().
equals
(
updateDTO
.
getStatus
()))
{
oauth2Service
.
removeToken
(
updateDTO
.
getId
(),
UserTypeEnum
.
ADMIN
.
getValue
(
));
oauth2Service
.
removeToken
(
new
OAuth2RemoveTokenByUserReqDTO
().
setUserId
(
updateDTO
.
getId
()).
setUserType
(
UserTypeEnum
.
ADMIN
.
getValue
()
));
}
}
}
}
...
...
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/manager/oauth/OAuth2Manager.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
systemservice
.
manager
.
oauth
;
import
cn.iocoder.mall.systemservice.convert.oauth.OAuth2Convert
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RefreshAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RemoveTokenByUserReqDTO
;
import
cn.iocoder.mall.systemservice.service.oauth.OAuth2Service
;
import
cn.iocoder.mall.systemservice.service.oauth.bo.OAuth2AccessTokenBO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
/**
* OAuth2.0 Manager
*/
@Service
@Validated
public
class
OAuth2Manager
{
@Autowired
private
OAuth2Service
oauth2Service
;
public
OAuth2AccessTokenRespDTO
createAccessToken
(
@Valid
OAuth2CreateAccessTokenReqDTO
createAccessTokenDTO
)
{
OAuth2AccessTokenBO
accessTokenBO
=
oauth2Service
.
createAccessToken
(
createAccessTokenDTO
.
getUserId
(),
createAccessTokenDTO
.
getUserType
(),
createAccessTokenDTO
.
getCreateIp
());
return
OAuth2Convert
.
INSTANCE
.
convert
(
accessTokenBO
);
}
public
OAuth2AccessTokenRespDTO
checkAccessToken
(
String
accessToken
)
{
OAuth2AccessTokenBO
accessTokenBO
=
oauth2Service
.
checkAccessToken
(
accessToken
);
return
OAuth2Convert
.
INSTANCE
.
convert
(
accessTokenBO
);
}
public
OAuth2AccessTokenRespDTO
refreshAccessToken
(
@Valid
OAuth2RefreshAccessTokenReqDTO
refreshAccessTokenDTO
)
{
OAuth2AccessTokenBO
accessTokenBO
=
oauth2Service
.
refreshAccessToken
(
refreshAccessTokenDTO
.
getRefreshToken
(),
refreshAccessTokenDTO
.
getCreateIp
());
return
OAuth2Convert
.
INSTANCE
.
convert
(
accessTokenBO
);
}
public
void
removeToken
(
@Valid
OAuth2RemoveTokenByUserReqDTO
removeTokenDTO
)
{
oauth2Service
.
removeToken
(
removeTokenDTO
.
getUserId
(),
removeTokenDTO
.
getUserType
());
}
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/rpc/oauth/OAuth2RpcImpl.java
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
rpc
.
oauth
;
package
cn
.
iocoder
.
mall
.
systemservice
.
rpc
.
oauth
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.systemservice.
manager.oauth.OAuth2Manager
;
import
cn.iocoder.mall.systemservice.
rpc.oauth.dto.OAuth2AccessTokenRespDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RefreshAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RefreshAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RemoveTokenByUserReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RemoveTokenByUserReqDTO
;
import
org.apache.dubbo.config.annotation.Service
;
import
cn.iocoder.mall.systemservice.service.oauth.OAuth2Service
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@
Service
(
version
=
"${dubbo.provider.OAuth2Rpc.version}"
)
@
DubboService
public
class
OAuth2RpcImpl
implements
OAuth2Rpc
{
public
class
OAuth2RpcImpl
implements
OAuth2Rpc
{
@Autowired
@Autowired
private
OAuth2
Manager
oauth2Manager
;
private
OAuth2
Service
oAuth2Service
;
@Override
@Override
public
CommonResult
<
OAuth2AccessTokenRespDTO
>
createAccessToken
(
OAuth2CreateAccessTokenReqDTO
createAccessTokenDTO
)
{
public
CommonResult
<
OAuth2AccessTokenRespDTO
>
createAccessToken
(
OAuth2CreateAccessTokenReqDTO
createAccessTokenDTO
)
{
return
success
(
o
auth2Manager
.
createAccessToken
(
createAccessTokenDTO
));
return
success
(
o
Auth2Service
.
createAccessToken
(
createAccessTokenDTO
));
}
}
@Override
@Override
public
CommonResult
<
OAuth2AccessTokenRespDTO
>
checkAccessToken
(
String
accessToken
)
{
public
CommonResult
<
OAuth2AccessTokenRespDTO
>
checkAccessToken
(
String
accessToken
)
{
return
success
(
o
auth2Manager
.
checkAccessToken
(
accessToken
));
return
success
(
o
Auth2Service
.
checkAccessToken
(
accessToken
));
}
}
@Override
@Override
public
CommonResult
<
OAuth2AccessTokenRespDTO
>
refreshAccessToken
(
OAuth2RefreshAccessTokenReqDTO
refreshAccessTokenDTO
)
{
public
CommonResult
<
OAuth2AccessTokenRespDTO
>
refreshAccessToken
(
OAuth2RefreshAccessTokenReqDTO
refreshAccessTokenDTO
)
{
return
success
(
o
auth2Manager
.
refreshAccessToken
(
refreshAccessTokenDTO
));
return
success
(
o
Auth2Service
.
refreshAccessToken
(
refreshAccessTokenDTO
));
}
}
@Override
@Override
public
CommonResult
<
Boolean
>
removeToken
(
OAuth2RemoveTokenByUserReqDTO
removeTokenDTO
)
{
public
CommonResult
<
Boolean
>
removeToken
(
OAuth2RemoveTokenByUserReqDTO
removeTokenDTO
)
{
o
auth2Manager
.
removeToken
(
removeTokenDTO
);
o
Auth2Service
.
removeToken
(
removeTokenDTO
);
return
success
(
true
);
return
success
(
true
);
}
}
...
...
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/oauth/OAuth2Service.java
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
service
.
oauth
;
package
cn
.
iocoder
.
mall
.
systemservice
.
service
.
oauth
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO
;
import
cn.iocoder.common.framework.util.StringUtils
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.convert.oauth.OAuth2Convert
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RefreshAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2AccessTokenDO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RemoveTokenByUserReqDTO
;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2RefreshTokenDO
;
import
cn.iocoder.mall.systemservice.dal.mysql.mapper.oauth.OAuth2AccessTokenMapper
;
import
cn.iocoder.mall.systemservice.dal.mysql.mapper.oauth.OAuth2RefreshTokenMapper
;
import
cn.iocoder.mall.systemservice.service.oauth.bo.OAuth2AccessTokenBO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
static
cn
.
iocoder
.
mall
.
systemservice
.
enums
.
SystemErrorCodeConstants
.*;
/**
/**
* OAuth2.0 Service
* OAuth2.0 Service
接口
*/
*/
@Service
public
interface
OAuth2Service
{
public
class
OAuth2Service
{
/**
* 访问令牌过期时间,单位:毫秒
*/
@Value
(
"${modules.oauth2-service.access-token-expire-time-millis}"
)
private
int
accessTokenExpireTimeMillis
;
/**
* 刷新令牌过期时间,单位:毫秒
*/
@Value
(
"${modules.oauth2-service.refresh-token-expire-time-millis}"
)
private
int
refreshTokenExpireTimeMillis
;
@Autowired
private
OAuth2AccessTokenMapper
oauth2AccessTokenMapper
;
@Autowired
private
OAuth2RefreshTokenMapper
oauth2RefreshTokenMapper
;
@Transactional
public
OAuth2AccessTokenBO
createAccessToken
(
Integer
userId
,
Integer
userType
,
String
createIp
)
{
// 创建刷新令牌 + 访问令牌
OAuth2RefreshTokenDO
refreshTokenDO
=
createOAuth2RefreshToken
(
userId
,
userType
,
createIp
);
OAuth2AccessTokenDO
accessTokenDO
=
createOAuth2AccessToken
(
refreshTokenDO
,
createIp
);
// 返回访问令牌
return
OAuth2Convert
.
INSTANCE
.
convert
(
accessTokenDO
);
}
@Transactional
public
OAuth2AccessTokenBO
checkAccessToken
(
String
accessToken
)
{
OAuth2AccessTokenDO
accessTokenDO
=
oauth2AccessTokenMapper
.
selectById
(
accessToken
);
if
(
accessTokenDO
==
null
)
{
// 不存在
throw
ServiceExceptionUtil
.
exception
(
OAUTH2_ACCESS_TOKEN_NOT_FOUND
);
}
if
(
accessTokenDO
.
getExpiresTime
().
getTime
()
<
System
.
currentTimeMillis
())
{
// 已过期
throw
ServiceExceptionUtil
.
exception
(
OAUTH2_ACCESS_TOKEN_TOKEN_EXPIRED
);
}
// 返回访问令牌
return
OAuth2Convert
.
INSTANCE
.
convert
(
accessTokenDO
);
}
@Transactional
public
OAuth2AccessTokenBO
refreshAccessToken
(
String
refreshToken
,
String
createIp
)
{
OAuth2RefreshTokenDO
refreshTokenDO
=
oauth2RefreshTokenMapper
.
selectById
(
refreshToken
);
// 校验刷新令牌是否合法
if
(
refreshTokenDO
==
null
)
{
// 不存在
throw
ServiceExceptionUtil
.
exception
(
OAUTH2_REFRESH_TOKEN_NOT_FOUND
);
}
if
(
refreshTokenDO
.
getExpiresTime
().
getTime
()
<
System
.
currentTimeMillis
())
{
// 已过期
throw
ServiceExceptionUtil
.
exception
(
OAUTH_REFRESH_TOKEN_EXPIRED
);
}
// 标记 refreshToken 对应的 accessToken 都不合法
// 这块的实现,参考了 Spring Security OAuth2 的代码
oauth2AccessTokenMapper
.
deleteByRefreshToken
(
refreshToken
);
// 创建访问令牌
OAuth2AccessTokenDO
oauth2AccessTokenDO
=
createOAuth2AccessToken
(
refreshTokenDO
,
createIp
);
// 返回访问令牌
return
OAuth2Convert
.
INSTANCE
.
convert
(
oauth2AccessTokenDO
);
}
@Transactional
public
void
removeToken
(
Integer
userId
,
Integer
userType
)
{
oauth2AccessTokenMapper
.
deleteByUserIdAndUserType
(
userId
,
userType
);
oauth2RefreshTokenMapper
.
deleteByUserIdAndUserType
(
userId
,
userType
);
}
private
OAuth2AccessTokenDO
createOAuth2AccessToken
(
OAuth2RefreshTokenDO
refreshTokenDO
,
String
createIp
)
{
OAuth2AccessTokenRespDTO
createAccessToken
(
OAuth2CreateAccessTokenReqDTO
createAccessTokenDTO
);
OAuth2AccessTokenDO
accessToken
=
new
OAuth2AccessTokenDO
()
.
setId
(
generateAccessToken
())
.
setUserId
(
refreshTokenDO
.
getUserId
()).
setUserType
(
refreshTokenDO
.
getUserType
())
.
setRefreshToken
(
refreshTokenDO
.
getId
())
.
setExpiresTime
(
new
Date
(
System
.
currentTimeMillis
()
+
accessTokenExpireTimeMillis
))
.
setCreateIp
(
createIp
);
oauth2AccessTokenMapper
.
insert
(
accessToken
);
return
accessToken
;
}
private
OAuth2RefreshTokenDO
createOAuth2RefreshToken
(
Integer
userId
,
Integer
userType
,
String
createIp
)
{
OAuth2AccessTokenRespDTO
checkAccessToken
(
String
accessToken
);
OAuth2RefreshTokenDO
refreshToken
=
new
OAuth2RefreshTokenDO
()
.
setId
(
generateRefreshToken
())
.
setUserId
(
userId
).
setUserType
(
userType
)
.
setExpiresTime
(
new
Date
(
System
.
currentTimeMillis
()
+
refreshTokenExpireTimeMillis
))
.
setCreateIp
(
createIp
);
oauth2RefreshTokenMapper
.
insert
(
refreshToken
);
return
refreshToken
;
}
private
String
generateAccessToken
()
{
OAuth2AccessTokenRespDTO
refreshAccessToken
(
OAuth2RefreshAccessTokenReqDTO
refreshAccessTokenDTO
);
return
StringUtils
.
uuid
(
true
);
}
private
String
generateRefreshToken
()
{
void
removeToken
(
OAuth2RemoveTokenByUserReqDTO
removeTokenDTO
);
return
StringUtils
.
uuid
(
true
);
}
}
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/oauth/OAuth2ServiceImpl.java
0 → 100644
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
service
.
oauth
;
import
cn.iocoder.common.framework.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.util.StringUtils
;
import
cn.iocoder.mall.systemservice.config.SystemBizProperties
;
import
cn.iocoder.mall.systemservice.convert.oauth.OAuth2Convert
;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2AccessTokenDO
;
import
cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth.OAuth2RefreshTokenDO
;
import
cn.iocoder.mall.systemservice.dal.mysql.mapper.oauth.OAuth2AccessTokenMapper
;
import
cn.iocoder.mall.systemservice.dal.mysql.mapper.oauth.OAuth2RefreshTokenMapper
;
import
cn.iocoder.mall.systemservice.dal.redis.dao.OAuth2AccessTokenRedisDAO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RefreshAccessTokenReqDTO
;
import
cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RemoveTokenByUserReqDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
mall
.
systemservice
.
enums
.
SystemErrorCodeConstants
.*;
/**
* OAuth2.0 Service 实现类
*/
@Service
public
class
OAuth2ServiceImpl
implements
OAuth2Service
{
@Autowired
private
SystemBizProperties
systemBizProperties
;
@Autowired
private
OAuth2AccessTokenMapper
oauth2AccessTokenMapper
;
@Autowired
private
OAuth2RefreshTokenMapper
oauth2RefreshTokenMapper
;
@Autowired
private
OAuth2AccessTokenRedisDAO
oauth2AccessTokenRedisDAO
;
@Override
@Transactional
public
OAuth2AccessTokenRespDTO
createAccessToken
(
OAuth2CreateAccessTokenReqDTO
createAccessTokenDTO
)
{
// 创建刷新令牌 + 访问令牌
OAuth2RefreshTokenDO
refreshTokenDO
=
createOAuth2RefreshToken
(
createAccessTokenDTO
.
getUserId
(),
createAccessTokenDTO
.
getUserType
(),
createAccessTokenDTO
.
getCreateIp
());
OAuth2AccessTokenDO
accessTokenDO
=
createOAuth2AccessToken
(
refreshTokenDO
,
createAccessTokenDTO
.
getCreateIp
());
// 返回访问令牌
return
OAuth2Convert
.
INSTANCE
.
convert
(
accessTokenDO
);
}
@Override
@Transactional
public
OAuth2AccessTokenRespDTO
checkAccessToken
(
String
accessToken
)
{
OAuth2AccessTokenDO
accessTokenDO
=
this
.
getOAuth2AccessToken
(
accessToken
);
if
(
accessTokenDO
==
null
)
{
// 不存在
throw
ServiceExceptionUtil
.
exception
(
OAUTH2_ACCESS_TOKEN_NOT_FOUND
);
}
if
(
accessTokenDO
.
getExpiresTime
().
getTime
()
<
System
.
currentTimeMillis
())
{
// 已过期
throw
ServiceExceptionUtil
.
exception
(
OAUTH2_ACCESS_TOKEN_TOKEN_EXPIRED
);
}
// 返回访问令牌
return
OAuth2Convert
.
INSTANCE
.
convert
(
accessTokenDO
);
}
@Override
@Transactional
public
OAuth2AccessTokenRespDTO
refreshAccessToken
(
OAuth2RefreshAccessTokenReqDTO
refreshAccessTokenDTO
)
{
OAuth2RefreshTokenDO
refreshTokenDO
=
oauth2RefreshTokenMapper
.
selectById
(
refreshAccessTokenDTO
.
getRefreshToken
());
// 校验刷新令牌是否合法
if
(
refreshTokenDO
==
null
)
{
// 不存在
throw
ServiceExceptionUtil
.
exception
(
OAUTH2_REFRESH_TOKEN_NOT_FOUND
);
}
if
(
refreshTokenDO
.
getExpiresTime
().
getTime
()
<
System
.
currentTimeMillis
())
{
// 已过期
throw
ServiceExceptionUtil
.
exception
(
OAUTH_REFRESH_TOKEN_EXPIRED
);
}
// 标记 refreshToken 对应的 accessToken 都不合法
// 这块的实现,参考了 Spring Security OAuth2 的代码
List
<
OAuth2AccessTokenDO
>
accessTokenDOs
=
oauth2AccessTokenMapper
.
selectListByRefreshToken
(
refreshAccessTokenDTO
.
getRefreshToken
());
accessTokenDOs
.
forEach
(
accessTokenDO
->
deleteOAuth2AccessToken
(
accessTokenDO
.
getId
()));
// 创建访问令牌
OAuth2AccessTokenDO
oauth2AccessTokenDO
=
createOAuth2AccessToken
(
refreshTokenDO
,
refreshAccessTokenDTO
.
getCreateIp
());
// 返回访问令牌
return
OAuth2Convert
.
INSTANCE
.
convert
(
oauth2AccessTokenDO
);
}
@Override
@Transactional
public
void
removeToken
(
OAuth2RemoveTokenByUserReqDTO
removeTokenDTO
)
{
// 删除 Access Token
OAuth2AccessTokenDO
accessTokenDO
=
oauth2AccessTokenMapper
.
selectByUserIdAndUserType
(
removeTokenDTO
.
getUserId
(),
removeTokenDTO
.
getUserType
());
if
(
accessTokenDO
!=
null
)
{
this
.
deleteOAuth2AccessToken
(
accessTokenDO
.
getId
());
}
// 删除 Refresh Token
oauth2RefreshTokenMapper
.
deleteByUserIdAndUserType
(
removeTokenDTO
.
getUserId
(),
removeTokenDTO
.
getUserType
());
}
private
OAuth2AccessTokenDO
createOAuth2AccessToken
(
OAuth2RefreshTokenDO
refreshTokenDO
,
String
createIp
)
{
OAuth2AccessTokenDO
accessToken
=
new
OAuth2AccessTokenDO
()
.
setId
(
generateAccessToken
())
.
setUserId
(
refreshTokenDO
.
getUserId
()).
setUserType
(
refreshTokenDO
.
getUserType
())
.
setRefreshToken
(
refreshTokenDO
.
getId
())
.
setExpiresTime
(
new
Date
(
System
.
currentTimeMillis
()
+
systemBizProperties
.
getAccessTokenExpireTimeMillis
()))
.
setCreateIp
(
createIp
);
oauth2AccessTokenMapper
.
insert
(
accessToken
);
return
accessToken
;
}
private
OAuth2RefreshTokenDO
createOAuth2RefreshToken
(
Integer
userId
,
Integer
userType
,
String
createIp
)
{
OAuth2RefreshTokenDO
refreshToken
=
new
OAuth2RefreshTokenDO
()
.
setId
(
generateRefreshToken
())
.
setUserId
(
userId
).
setUserType
(
userType
)
.
setExpiresTime
(
new
Date
(
System
.
currentTimeMillis
()
+
systemBizProperties
.
getRefreshTokenExpireTimeMillis
()))
.
setCreateIp
(
createIp
);
oauth2RefreshTokenMapper
.
insert
(
refreshToken
);
return
refreshToken
;
}
private
OAuth2AccessTokenDO
getOAuth2AccessToken
(
String
accessToken
)
{
// 优先从 Redis 中获取
OAuth2AccessTokenDO
accessTokenDO
=
oauth2AccessTokenRedisDAO
.
get
(
accessToken
);
if
(
accessTokenDO
!=
null
)
{
return
accessTokenDO
;
}
// 获取不到,从 MySQL 中获取
accessTokenDO
=
oauth2AccessTokenMapper
.
selectById
(
accessToken
);
// 如果在 MySQL 存在,则往 Redis 中写入
if
(
accessTokenDO
!=
null
)
{
oauth2AccessTokenRedisDAO
.
set
(
accessTokenDO
);
}
return
accessTokenDO
;
}
/**
* 删除 accessToken 的 MySQL 与 Redis 的数据
*
* @param accessToken 访问令牌
*/
private
void
deleteOAuth2AccessToken
(
String
accessToken
)
{
// 删除 MySQL
oauth2AccessTokenMapper
.
deleteById
(
accessToken
);
// 删除 Redis
oauth2AccessTokenRedisDAO
.
delete
(
accessToken
);
}
private
static
String
generateAccessToken
()
{
return
StringUtils
.
uuid
(
true
);
}
private
static
String
generateRefreshToken
()
{
return
StringUtils
.
uuid
(
true
);
}
}
system-service-project/system-service-app/src/main/java/cn/iocoder/mall/systemservice/service/oauth/bo/OAuth2AccessTokenBO.java
deleted
100644 → 0
浏览文件 @
03fde369
package
cn
.
iocoder
.
mall
.
systemservice
.
service
.
oauth
.
bo
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* OAuth2.0 访问令牌 BO
*/
@Data
@Accessors
(
chain
=
true
)
public
class
OAuth2AccessTokenBO
{
/**
* 访问令牌
*/
private
String
accessToken
;
/**
* 刷新令牌
*/
private
String
refreshToken
;
/**
* 用户编号
*/
private
Integer
userId
;
/**
* 用户类型
*/
private
Integer
userType
;
/**
* 过期时间
*/
private
Date
expiresTime
;
}
system-service-project/system-service-app/src/main/resources/application.properties
deleted
100644 → 0
浏览文件 @
03fde369
##################### 业务模块 #####################
## OAuth2CodeService
modules.oauth2-service.access-token-expire-time-millis
=
2880000
modules.oauth2-service.refresh-token-expire-time-millis
=
43200000
system-service-project/system-service-app/src/main/resources/application.yaml
浏览文件 @
9fb182e2
...
@@ -35,8 +35,6 @@ dubbo:
...
@@ -35,8 +35,6 @@ dubbo:
provider
:
provider
:
filter
:
-exception
filter
:
-exception
validation
:
true
# 开启 Provider 参数校验
validation
:
true
# 开启 Provider 参数校验
OAuth2Rpc
:
version
:
1.0.0
AdminRpc
:
AdminRpc
:
version
:
1.0.0
version
:
1.0.0
ResourceRpc
:
ResourceRpc
:
...
@@ -72,3 +70,8 @@ mall:
...
@@ -72,3 +70,8 @@ mall:
error-code
:
error-code
:
group
:
${spring.application.name}
group
:
${spring.application.name}
constants-class
:
cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants
constants-class
:
cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants
# 业务配置
biz
:
access-token-expire-time-millis
:
2880000
refresh-token-expire-time-millis
:
43200000
moved/product/product-service-api
/pom.xml
→
system-service-project/system-service-integration-test
/pom.xml
浏览文件 @
9fb182e2
...
@@ -3,35 +3,26 @@
...
@@ -3,35 +3,26 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
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"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<parent>
<artifactId>
produ
ct
</artifactId>
<artifactId>
system-service-proje
ct
</artifactId>
<groupId>
cn.iocoder.mall
</groupId>
<groupId>
cn.iocoder.mall
</groupId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
product-service-api
</artifactId>
<artifactId>
system-service-integration-test
</artifactId>
<dependencies>
<dependencies>
<!-- Mall 相关 -->
<dependency>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
common-framework
</artifactId>
<artifactId>
system-service-app
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependency>
<!--
工具类
相关 -->
<!--
Test
相关 -->
<dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
mapstruct
</artifactId>
<!-- use mapstruct-jdk8 for Java 8 or higher -->
<artifactId>
spring-boot-starter-test
</artifactId>
</dependency>
<scope>
test
</scope>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct-jdk8
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
system-service-project/system-service-integration-test/src/test/java/cn/iocoder/mall/systemservice/service/oauth/OAuth2ServiceImplTest.java
0 → 100644
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
service
.
oauth
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
OAuth2ServiceImplTest
{
@Autowired
private
OAuth2ServiceImpl
oauth2Service
;
@Test
public
void
testCheckAccessToken
()
{
oauth2Service
.
checkAccessToken
(
"yunai"
);
}
}
system-service-project/system-service-integration-test/src/test/java/cn/iocoder/mall/systemservice/service/package-info.java
0 → 100644
浏览文件 @
9fb182e2
package
cn
.
iocoder
.
mall
.
systemservice
.
service
;
trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/TradeBizProperties.java
浏览文件 @
9fb182e2
...
@@ -7,6 +7,9 @@ import org.springframework.validation.annotation.Validated;
...
@@ -7,6 +7,9 @@ import org.springframework.validation.annotation.Validated;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
/**
* 交易服务的业务配置项
*/
@Component
@Component
@ConfigurationProperties
(
"biz"
)
@ConfigurationProperties
(
"biz"
)
@Validated
@Validated
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论