Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
b55cbd88
Commit
b55cbd88
authored
Apr 20, 2021
by
hanghang.wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20210226_【C端服务端】订单状态新增英文字段_wanghanghang'
parents
e6fce948
b3fd63a5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
371 additions
and
56 deletions
+371
-56
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+0
-0
order-application-service/src/main/java/cn/freemud/annotations/IsConvertEN.java
+20
-0
order-application-service/src/main/java/cn/freemud/aop/IsConvertEnAspect.java
+96
-0
order-application-service/src/main/java/cn/freemud/controller/OrderController.java
+5
-0
order-application-service/src/main/java/cn/freemud/entities/dto/OrderViewStatusDto.java
+4
-0
order-application-service/src/main/java/cn/freemud/entities/vo/QueryOrderResponseVo.java
+22
-0
order-application-service/src/main/java/cn/freemud/entities/vo/encircle/PreviewOrderInfoVo.java
+6
-0
order-application-service/src/main/java/cn/freemud/enums/OrderStatus.java
+19
-9
order-application-service/src/main/java/cn/freemud/enums/PayStatus.java
+16
-6
order-application-service/src/main/java/cn/freemud/enums/RefundStatus.java
+19
-7
order-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+0
-0
order-application-service/src/main/java/cn/freemud/interceptor/ServiceException.java
+11
-0
order-application-service/src/main/java/cn/freemud/service/impl/EncircleOrderServiceImpl.java
+0
-1
ordercenter-sdk/src/main/java/com/freemud/application/sdk/api/ordercenter/enums/PayChannelType.java
+8
-7
shopping-cart-application-service/src/main/java/cn/freemud/annotations/IgnoreFeignLogAnnotation.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/annotations/IsConvertEN.java
+19
-0
shopping-cart-application-service/src/main/java/cn/freemud/annotations/LogIgnore.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/aop/ControllerLogAop.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/aop/IsConvertEnAspect.java
+97
-0
shopping-cart-application-service/src/main/java/cn/freemud/aop/WebAspect.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartCollageController.java
+1
-2
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartController.java
+7
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
+8
-6
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/ActivityClient.java
+1
-3
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/BigDataFeiginClient.java
+0
-3
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CalculationClient.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CardBinClient.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CustomScoreClient.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CustomerApplicationClient.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/StockClient.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/StoreItemClient.java
+1
-1
No files found.
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
b55cbd88
This diff is collapsed.
Click to expand it.
order-application-service/src/main/java/cn/freemud/annotations/IsConvertEN.java
0 → 100644
View file @
b55cbd88
package
cn
.
freemud
.
annotations
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
/**
* 判断返回message是否转换为英文
*
* @author wanghanghang
* @date 2021/04/01
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
IsConvertEN
{
//此字段用于区分具体服务。
//区分服务之后寻找对应服务的返回code枚举类
String
service
()
default
""
;
}
order-application-service/src/main/java/cn/freemud/aop/IsConvertEnAspect.java
0 → 100644
View file @
b55cbd88
package
cn
.
freemud
.
aop
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.enums.ResponseResult
;
import
com.alibaba.fastjson.JSON
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.exception.IgnoreErrorAnnotation
;
import
com.freemud.application.sdk.api.log.ApiLog
;
import
com.freemud.application.sdk.api.log.ErrorLog
;
import
com.freemud.application.sdk.api.log.LogParams
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.service.EmailAlertService
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.Signature
;
import
org.aspectj.lang.annotation.*
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.Ordered
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Parameter
;
import
java.util.*
;
/**
* 判断返回message是否转换为英文
*
* @author wanghanghang
* @date 2021/04/01
*/
@Aspect
@Component
@Slf4j
public
class
IsConvertEnAspect
implements
Ordered
{
@Pointcut
(
"@annotation(cn.freemud.annotations.IsConvertEN)"
)
public
void
pointcut
()
{
}
@Around
(
"pointcut()"
)
public
Object
convertMessage
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
HttpServletRequest
request
=
currentRequest
();
String
language
=
request
.
getHeader
(
"lang"
);
BaseResponse
baseResponse
=
(
BaseResponse
)
joinPoint
.
proceed
();
//表示返回英文提示
if
(
"en-US"
.
equals
(
language
))
{
/**此处注释**/
String
enMessage
=
ResponseResult
.
getResponseResult
(
baseResponse
.
getCode
()).
getEnMessage
();
if
(!
StringUtils
.
isEmpty
(
enMessage
))
{
baseResponse
.
setMessage
(
enMessage
);
}
}
return
baseResponse
;
}
private
HttpServletRequest
currentRequest
()
{
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
return
Optional
.
ofNullable
(
servletRequestAttributes
).
map
(
ServletRequestAttributes:
:
getRequest
).
orElse
(
null
);
}
/**
* 备用方法,避免code或者message信息不统一
* 过滤返参code是否在excludeStatusCodes存在
*
* @param excludeStatusCodes
* @param statusCodeValue
* @return
*/
private
boolean
containStatusCode
(
String
[]
excludeStatusCodes
,
String
statusCodeValue
)
{
if
(
excludeStatusCodes
==
null
||
excludeStatusCodes
.
length
==
0
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
excludeStatusCodes
.
length
;
i
++)
{
if
(
excludeStatusCodes
[
i
].
equals
(
statusCodeValue
))
{
return
true
;
}
}
return
false
;
}
@Override
public
int
getOrder
()
{
return
0
;
}
}
order-application-service/src/main/java/cn/freemud/controller/OrderController.java
View file @
b55cbd88
...
...
@@ -12,6 +12,7 @@
*/
package
cn
.
freemud
.
controller
;
import
cn.freemud.annotations.IsConvertEN
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.entities.vo.*
;
import
cn.freemud.entities.vo.encircle.CreateReserveOrderVo
;
...
...
@@ -68,6 +69,7 @@ public class OrderController {
/**
* 创建订单
*/
@IsConvertEN
@ApiAnnotation
(
logMessage
=
"createOrder"
)
@PostMapping
(
"/createOrder"
)
public
BaseResponse
createOrder
(
@Validated
@LogParams
@RequestBody
CreateOrderVo
createOrderVo
)
{
...
...
@@ -160,6 +162,7 @@ public class OrderController {
* @param queryOrderVo
* @return
*/
@IsConvertEN
@ApiAnnotation
(
logMessage
=
"previewOrderInfo"
)
@PostMapping
(
"/previewOrderInfo"
)
public
BaseResponse
previewOrderInfo
(
@Validated
@LogParams
@RequestBody
QueryOrderVo
queryOrderVo
){
...
...
@@ -176,6 +179,7 @@ public class OrderController {
* @param queryOrderVo
* @return
*/
@IsConvertEN
@ApiAnnotation
(
logMessage
=
"previewOrderInfoSvcCheck"
)
@PostMapping
(
"/previewOrderInfoSvcCheck"
)
public
BaseResponse
previewOrderInfoSvcCheck
(
@Validated
@LogParams
@RequestBody
QueryOrderVo
queryOrderVo
){
...
...
@@ -296,6 +300,7 @@ public class OrderController {
/**
* 查询桌号是否开台
*/
@IsConvertEN
@ApiAnnotation
(
logMessage
=
"queryTableNumberStatus"
)
@ApiOperation
(
value
=
"查询桌号是否开台"
,
notes
=
"查询桌号是否开台"
,
produces
=
"application/json"
)
@PostMapping
(
"/queryTableNumberStatus"
)
...
...
order-application-service/src/main/java/cn/freemud/entities/dto/OrderViewStatusDto.java
View file @
b55cbd88
...
...
@@ -26,6 +26,10 @@ public class OrderViewStatusDto {
*/
private
String
orderStatusDesc
;
/**
* 订单类型描述
*/
private
String
orderStatusDescEn
;
/**
* 订单类型描述文案
*/
private
String
orderStatusDescText
;
...
...
order-application-service/src/main/java/cn/freemud/entities/vo/QueryOrderResponseVo.java
View file @
b55cbd88
...
...
@@ -147,6 +147,10 @@ public class QueryOrderResponseVo {
*/
private
String
orderTypeDesc
;
/**
* 订单类型描述
*/
private
String
orderTypeDescEn
;
/**
* 订单状态 enum OrderStatus ,DeliverStatus=42 骑手取餐中
*/
private
Integer
orderStatus
;
...
...
@@ -155,6 +159,10 @@ public class QueryOrderResponseVo {
*/
private
String
orderStatusDesc
;
/**
* 订单状态描述
*/
private
String
orderStatusDescEn
;
/**
* 订单状态显示的对应描述
*/
private
String
orderStatusDescText
;
...
...
@@ -209,6 +217,10 @@ public class QueryOrderResponseVo {
*/
private
String
payStatusDesc
;
/**
* 支付状态描述英文
*/
private
String
payStatusDescEn
;
/**
* 支付时间
*/
private
String
payCreateTime
;
...
...
@@ -216,6 +228,11 @@ public class QueryOrderResponseVo {
* 付款方式 微信支付
*/
private
String
orderPayType
;
/**
* 付款方式 微信支付
*/
private
String
orderPayTypeDescEn
;
/**
* 收货地址id
*/
...
...
@@ -246,6 +263,11 @@ public class QueryOrderResponseVo {
private
String
refundStatusDesc
;
/**
* 退款状态描述
*/
private
String
refundStatusDescEn
;
/**
* 退款原因
*/
private
String
refundReason
;
...
...
order-application-service/src/main/java/cn/freemud/entities/vo/encircle/PreviewOrderInfoVo.java
View file @
b55cbd88
...
...
@@ -65,6 +65,8 @@ public class PreviewOrderInfoVo {
*/
private
String
orderStatusDesc
;
private
String
orderStatusDescEn
;
/**
* 支付状态 enum PayStatus
*/
...
...
@@ -73,6 +75,10 @@ public class PreviewOrderInfoVo {
* 支付状态描述
*/
private
String
payStatusDesc
;
/**
* 支付状态描述英文
*/
private
String
payStatusDescEn
;
/**
* 订单修改版本号
...
...
order-application-service/src/main/java/cn/freemud/enums/OrderStatus.java
View file @
b55cbd88
...
...
@@ -14,21 +14,23 @@ package cn.freemud.enums;
public
enum
OrderStatus
{
TAKE_ORDER
(
1
,
"下单"
),
WAIT_PAY
(
2
,
"待支付"
),
RECEIPT
(
3
,
"接单"
),
DISTRIBUTION
(
4
,
"配送中"
),
COMPLETE
(
5
,
"完成"
),
CALCEL
(
6
,
"取消"
),
REFUSE
(
7
,
"拒单"
),
COMPLETE_MAKE
(
31
,
"制作完成"
);
TAKE_ORDER
(
1
,
"下单"
,
"place an order"
),
WAIT_PAY
(
2
,
"待支付"
,
"To be paid"
),
RECEIPT
(
3
,
"接单"
,
"Receiving orders"
),
DISTRIBUTION
(
4
,
"配送中"
,
"In delivery"
),
COMPLETE
(
5
,
"完成"
,
"Complete"
),
CALCEL
(
6
,
"取消"
,
"Cancel"
),
REFUSE
(
7
,
"拒单"
,
"Refuse to accept orders"
),
COMPLETE_MAKE
(
31
,
"制作完成"
,
"Production completed"
);
private
Integer
code
;
private
String
desc
;
private
String
descEn
;
OrderStatus
(
Integer
code
,
String
desc
)
{
OrderStatus
(
Integer
code
,
String
desc
,
String
descEn
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
this
.
descEn
=
descEn
;
}
public
static
Integer
[]
getAllCodes
()
{
...
...
@@ -53,6 +55,14 @@ public enum OrderStatus {
return
null
;
}
public
String
getDescEn
()
{
return
descEn
;
}
public
void
setDescEn
(
String
descEn
)
{
this
.
descEn
=
descEn
;
}
public
Integer
getCode
()
{
return
code
;
}
...
...
order-application-service/src/main/java/cn/freemud/enums/PayStatus.java
View file @
b55cbd88
...
...
@@ -14,19 +14,21 @@ package cn.freemud.enums;
public
enum
PayStatus
{
NOT_PAY
(
1
,
"未支付"
),
HAVE_PAID
(
2
,
"已支付"
),
HAVE_REFUND
(
3
,
"已退款"
),
HAVE_PART_REFUND
(
4
,
"已经部分退款"
),
COMPLETE
(
5
,
"完成"
);
NOT_PAY
(
1
,
"未支付"
,
"Unpaid"
),
HAVE_PAID
(
2
,
"已支付"
,
"Paid"
),
HAVE_REFUND
(
3
,
"已退款"
,
"Refunded"
),
HAVE_PART_REFUND
(
4
,
"已经部分退款"
,
"Partial refund"
),
COMPLETE
(
5
,
"完成"
,
"Complete"
);
private
Integer
code
;
private
String
desc
;
private
String
descEn
;
PayStatus
(
Integer
code
,
String
desc
)
{
PayStatus
(
Integer
code
,
String
desc
,
String
descEn
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
this
.
descEn
=
descEn
;
}
public
static
PayStatus
getByCode
(
Integer
code
)
{
...
...
@@ -56,4 +58,12 @@ public enum PayStatus {
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getDescEn
()
{
return
descEn
;
}
public
void
setDescEn
(
String
descEn
)
{
this
.
descEn
=
descEn
;
}
}
order-application-service/src/main/java/cn/freemud/enums/RefundStatus.java
View file @
b55cbd88
...
...
@@ -14,19 +14,23 @@ package cn.freemud.enums;
public
enum
RefundStatus
{
APPLY_REFUND
(
1
,
"申请退款"
),
AGREE_REFUND
(
2
,
"同意退款"
),
ALREADY_REFUND
(
3
,
"已退货"
),
COMPLETE_REFUND
(
4
,
"退款完成"
),
REFUSE_REFUND
(
5
,
"拒绝退款"
);
APPLY_REFUND
(
1
,
"申请退款"
,
"Apply for a refund"
),
AGREE_REFUND
(
2
,
"同意退款"
,
"Agree to refund"
),
ALREADY_REFUND
(
3
,
"已退货"
,
"Returned"
),
COMPLETE_REFUND
(
4
,
"退款完成"
,
"Refund complete"
),
REFUSE_REFUND
(
5
,
"拒绝退款"
,
"Refuse refund"
);
/**编号**/
private
Integer
code
;
/**中文**/
private
String
desc
;
/**英文**/
private
String
descEn
;
RefundStatus
(
Integer
code
,
String
desc
)
{
RefundStatus
(
Integer
code
,
String
desc
,
String
descEn
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
this
.
descEn
=
descEn
;
}
public
static
RefundStatus
getByCode
(
Integer
code
)
{
...
...
@@ -53,4 +57,12 @@ public enum RefundStatus {
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getDescEn
()
{
return
descEn
;
}
public
void
setDescEn
(
String
descEn
)
{
this
.
descEn
=
descEn
;
}
}
order-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
b55cbd88
This diff is collapsed.
Click to expand it.
order-application-service/src/main/java/cn/freemud/interceptor/ServiceException.java
View file @
b55cbd88
...
...
@@ -15,9 +15,12 @@ public class ServiceException extends RuntimeException {
private
String
message
;
private
String
enMessage
;
public
ServiceException
(
ResponseResult
result
)
{
this
.
result
=
result
;
this
.
message
=
result
.
getMessage
();
this
.
enMessage
=
result
.
getEnMessage
();
}
public
ServiceException
(
ResponseResult
result
,
String
message
)
{
...
...
@@ -42,4 +45,12 @@ public class ServiceException extends RuntimeException {
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
String
getEnMessage
()
{
return
enMessage
;
}
public
void
setEnMessage
(
String
enMessage
)
{
this
.
enMessage
=
enMessage
;
}
}
order-application-service/src/main/java/cn/freemud/service/impl/EncircleOrderServiceImpl.java
View file @
b55cbd88
...
...
@@ -149,7 +149,6 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
if
(
ObjectUtils
.
notEqual
(
ResponseResult
.
SUCCESS
.
getCode
(),
storeTable
.
getCode
())
||
storeTable
.
getData
()
==
null
)
return
ResponseUtil
.
error
(
ResponseResult
.
STORE_NOT_TABLE_INFO
);
if
(
storeTable
.
getData
().
getActiveFlag
()
==
0
)
return
ResponseUtil
.
error
(
ResponseResult
.
QUERY_TABLESTATUS_ACTIVEFLAG_ERROR
);
if
(
storeTable
.
getData
().
getOrderState
()
==
1
)
{
log
.
info
(
"门店返回1,已开台"
);
return
ResponseUtil
.
success
();
}
/**
...
...
ordercenter-sdk/src/main/java/com/freemud/application/sdk/api/ordercenter/enums/PayChannelType.java
View file @
b55cbd88
...
...
@@ -7,17 +7,18 @@ import lombok.Getter;
@AllArgsConstructor
public
enum
PayChannelType
{
WECHAT
((
byte
)
1
,
"10211"
,
"微信"
),
ALIPAY
((
byte
)
2
,
"10300"
,
"支付宝"
),
SVC
((
byte
)
3
,
"10102"
,
"储值卡"
),
COMB
((
byte
)
4
,
"10212"
,
"混合支付"
),
USVCP
((
byte
)
5
,
"10556"
,
"电子风味卡支付"
),
ZERO
((
byte
)
6
,
"100000"
,
"0元支付"
),
TIKTOKPAY
((
byte
)
7
,
"10066"
,
"抖音支付"
);
WECHAT
((
byte
)
1
,
"10211"
,
"微信"
,
"wechat"
),
ALIPAY
((
byte
)
2
,
"10300"
,
"支付宝"
,
"alipay"
),
SVC
((
byte
)
3
,
"10102"
,
"储值卡"
,
"svc"
),
COMB
((
byte
)
4
,
"10212"
,
"混合支付"
,
"comb"
),
USVCP
((
byte
)
5
,
"10556"
,
"电子风味卡支付"
,
"usvcp"
),
ZERO
((
byte
)
6
,
"100000"
,
"0元支付"
,
"zero"
),
TIKTOKPAY
((
byte
)
7
,
"10066"
,
"抖音支付"
,
"tiktokpay"
);
private
Byte
index
;
private
String
ebcode
;
private
String
name
;
private
String
nameEn
;
public
static
final
String
API_DESC
=
"订单支付渠道类型 1:微信 2:储值卡 3:支付宝 4:混合支付,5:电子风味卡支付"
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/a
op
/IgnoreFeignLogAnnotation.java
→
shopping-cart-application-service/src/main/java/cn/freemud/a
nnotations
/IgnoreFeignLogAnnotation.java
View file @
b55cbd88
package
cn
.
freemud
.
a
op
;
package
cn
.
freemud
.
a
nnotations
;
import
java.lang.annotation.*
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/annotations/IsConvertEN.java
0 → 100644
View file @
b55cbd88
package
cn
.
freemud
.
annotations
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
/**
* 判断返回message是否转换为英文
*
* @author wanghanghang
* @date 2021/04/01
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
IsConvertEN
{
//传入服务名,用于区分枚举类
String
service
()
default
""
;
}
shopping-cart-application-service/src/main/java/cn/freemud/a
op
/LogIgnore.java
→
shopping-cart-application-service/src/main/java/cn/freemud/a
nnotations
/LogIgnore.java
View file @
b55cbd88
package
cn
.
freemud
.
a
op
;
package
cn
.
freemud
.
a
nnotations
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
/**
* @author
* @author
wanghanghang
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
...
...
shopping-cart-application-service/src/main/java/cn/freemud/aop/ControllerLogAop.java
View file @
b55cbd88
package
cn
.
freemud
.
aop
;
import
cn.freemud.annotations.LogIgnore
;
import
com.alibaba.fastjson.JSON
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.exception.IgnoreErrorAnnotation
;
...
...
@@ -27,7 +28,6 @@ import javax.servlet.http.HttpServletRequest;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Parameter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -53,7 +53,7 @@ public class ControllerLogAop implements Ordered {
@Value
(
"${exclude-print-body-log-methods:findNearPickUpStores,getMenuCategory}"
)
private
volatile
List
<
String
>
excludePrintBodyLogMethods
=
Lists
.
newArrayList
();
@Pointcut
(
"@annotation(cn.freemud.a
op
.LogIgnore)"
)
@Pointcut
(
"@annotation(cn.freemud.a
nnotations
.LogIgnore)"
)
public
void
pointcut
()
{
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/aop/IsConvertEnAspect.java
0 → 100644
View file @
b55cbd88
package
cn
.
freemud
.
aop
;
import
cn.freemud.base.entity.BaseResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.core.Ordered
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Optional
;
/**
* 判断返回message是否转换为英文
*
* @author wanghanghang
* @date 2021/04/01
*/
@Aspect
@Component
@Slf4j
public
class
IsConvertEnAspect
implements
Ordered
{
@Pointcut
(
"@annotation(cn.freemud.annotations.IsConvertEN)"
)
public
void
pointcut
()
{
}
@Around
(
"pointcut()"
)
public
Object
convertMessage
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
HttpServletRequest
request
=
currentRequest
();
String
language
=
request
.
getHeader
(
"lang"
);
BaseResponse
baseResponse
=
(
BaseResponse
)
joinPoint
.
proceed
();
//表示返回英文提示 本次变更3个提示 手动直接转换
if
(
"en-US"
.
equals
(
language
))
{
switch
(
baseResponse
.
getCode
())
{
case
"44013"
:
//购物车商品有变动,请手动刷新再修改
baseResponse
.
setMessage
(
"Shopping cart items have changed, please refresh and modify manually"
);
break
;
case
"44014"
:
//没有绑定桌号,无法加入购物车
baseResponse
.
setMessage
(
"There is no binding table number, unable to join the shopping cart"
);
break
;
case
"44003"
:
//添加购物车失败
baseResponse
.
setMessage
(
"Failed to add shopping cart"
);
break
;
case
"43005"
:
//门店商品校验失败
baseResponse
.
setMessage
(
"Store product verification failed"
);
break
;
case
"43003"
:
//门店商品信息不存在
baseResponse
.
setMessage
(
"Store product information does not exist"
);
break
;
}
}
return
baseResponse
;
}
private
HttpServletRequest
currentRequest
()
{
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
return
Optional
.
ofNullable
(
servletRequestAttributes
).
map
(
ServletRequestAttributes:
:
getRequest
).
orElse
(
null
);
}
/**
* 备用方法,避免code或者message信息不统一
* 过滤返参code是否在excludeStatusCodes存在
*
* @param excludeStatusCodes
* @param statusCodeValue
* @return
*/
private
boolean
containStatusCode
(
String
[]
excludeStatusCodes
,
String
statusCodeValue
)
{
if
(
excludeStatusCodes
==
null
||
excludeStatusCodes
.
length
==
0
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
excludeStatusCodes
.
length
;
i
++)
{
if
(
excludeStatusCodes
[
i
].
equals
(
statusCodeValue
))
{
return
true
;
}
}
return
false
;
}
@Override
public
int
getOrder
()
{
return
0
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/aop/WebAspect.java
View file @
b55cbd88
package
cn
.
freemud
.
aop
;
import
cn.freemud.annotations.IgnoreFeignLogAnnotation
;
import
cn.freemud.constant.CommonRedisKeyConstant
;
import
cn.freemud.entities.vo.ThirdPartLogVo
;
import
cn.freemud.enums.CommonResponseResult
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartCollageController.java
View file @
b55cbd88
...
...
@@ -12,12 +12,11 @@
*/
package
cn
.
freemud
.
controller
;
import
cn.freemud.a
op
.LogIgnore
;
import
cn.freemud.a
nnotations
.LogIgnore
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.entities.vo.*
;
import
cn.freemud.enums.ResponseResult
;
import
cn.freemud.service.impl.ShoppingCartCollageServiceImpl
;
import
cn.freemud.service.impl.ShoppingCartMallServiceImpl
;
import
cn.freemud.utils.ResponseUtil
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.log.ApiAnnotation
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartController.java
View file @
b55cbd88
...
...
@@ -12,7 +12,8 @@
*/
package
cn
.
freemud
.
controller
;
import
cn.freemud.aop.LogIgnore
;
import
cn.freemud.annotations.IsConvertEN
;
import
cn.freemud.annotations.LogIgnore
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.demo.controller.ShoppingCartDemoController
;
...
...
@@ -80,6 +81,7 @@ public class ShoppingCartController {
/**
* 向购物车中添加商品
*/
@IsConvertEN
@PostMapping
(
value
=
"/addGoods"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"addGoods"
)
public
BaseResponse
addGoods
(
@Validated
@LogParams
@RequestBody
AddShoppingCartGoodsRequestVo
request
)
{
...
...
@@ -95,6 +97,7 @@ public class ShoppingCartController {
/**
* 修改购物车中商品数量
*/
@IsConvertEN
@PostMapping
(
value
=
"/updateGoodsQty"
)
@LogIgnore
(
logMessage
=
"updateGoodsQty"
)
public
BaseResponse
updateGoodsQty
(
@Validated
@LogParams
@RequestBody
UpdateShoppingCartGoodsQtyRequestVo
request
)
{
...
...
@@ -110,6 +113,7 @@ public class ShoppingCartController {
/**
* 查询购物车信息
*/
@IsConvertEN
@PostMapping
(
value
=
"/listCartGoods"
)
@LogIgnore
(
logMessage
=
"listCartGoods"
)
public
BaseResponse
listCartGoods
(
@Validated
@LogParams
@RequestBody
ShoppingCartInfoRequestVo
request
)
{
...
...
@@ -143,6 +147,7 @@ public class ShoppingCartController {
/**
* 清空购物车
*/
@IsConvertEN
@PostMapping
(
value
=
"/clearCartGoods"
)
@LogIgnore
(
logMessage
=
"clearCartGoods"
)
public
BaseResponse
clearCartGoods
(
@Validated
@LogParams
@RequestBody
ShoppingCartClearRequestVo
request
)
{
...
...
@@ -163,6 +168,7 @@ public class ShoppingCartController {
* @param getShoppingCartGoodsApportionRequestVo
* @return
*/
@IsConvertEN
@PostMapping
(
value
=
"/getShoppingCartGoodsApportion"
)
@LogIgnore
(
logMessage
=
"getShoppingCartGoodsApportion"
)
public
BaseResponse
getShoppingCartGoodsApportion
(
@Validated
@LogParams
@RequestBody
GetShoppingCartGoodsApportionRequestVo
getShoppingCartGoodsApportionRequestVo
)
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMealServiceImpl.java
View file @
b55cbd88
...
...
@@ -97,13 +97,15 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
@Override
public
BaseResponse
addGoods
(
AddShoppingCartGoodsRequestVo
requestVo
)
{
// 获取用户信息
CustomerInfoVo
customerInfo
=
getCustomerInfoVo
(
requestVo
.
getSessionId
());
//todo 单元测试使用
//customerInfo = test(customerInfo, requestVo.getSessionId());
checkBase
(
customerInfo
);
if
(
customerInfo
==
null
||
customerInfo
.
getMemberId
()
==
null
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
NOT_LOGIN
);
}
if
(
StringUtils
.
isBlank
(
customerInfo
.
getTableNumber
())
||
StringUtils
.
isBlank
(
customerInfo
.
getStoreId
())
||
StringUtils
.
isBlank
(
customerInfo
.
getPartnerId
()))
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_NO_BIND_TABLE_NUMBER
);
}
// checkBase(customerInfo);
String
userId
=
customerInfo
.
getMemberId
();
String
partnerId
=
customerInfo
.
getPartnerId
();
String
storeId
=
customerInfo
.
getStoreId
();
...
...
@@ -129,7 +131,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
BusinessTypeEnum
.
SAAS_WC
.
getName
(),
mealCartBaseService
);
if
(
productBeanListSpuClass
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_ADD_ERROR
);
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_ADD_ERROR
);
}
//缓存中获取购物车商品信息
// 注意,围餐和点餐redis数据结构不一样
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/ActivityClient.java
View file @
b55cbd88
...
...
@@ -12,13 +12,11 @@
*/
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.a
op
.IgnoreFeignLogAnnotation
;
import
cn.freemud.a
nnotations
.IgnoreFeignLogAnnotation
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeKeyConstant
;
import
cn.freemud.entities.dto.*
;
import
cn.freemud.entities.dto.activity.ActivityQueryResponseDto
;
import
com.freemud.application.sdk.api.base.BaseResponse
;
import
com.freemud.application.sdk.api.promotioncenter.response.CalculationDiscountResponseDTO
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/BigDataFeiginClient.java
View file @
b55cbd88
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.aop.IgnoreFeignLogAnnotation
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeKeyConstant
;
import
cn.freemud.entities.dto.BuryingPointBigDto
;
import
cn.freemud.entities.dto.BuryingPointResDto
;
import
org.springframework.cloud.openfeign.FeignClient
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CalculationClient.java
View file @
b55cbd88
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.a
op
.IgnoreFeignLogAnnotation
;
import
cn.freemud.a
nnotations
.IgnoreFeignLogAnnotation
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeKeyConstant
;
import
cn.freemud.entities.dto.calculate.CalculationSharingDiscountRequestDto
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CardBinClient.java
View file @
b55cbd88
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.a
op
.IgnoreFeignLogAnnotation
;
import
cn.freemud.a
nnotations
.IgnoreFeignLogAnnotation
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeKeyConstant
;
import
cn.freemud.entities.dto.BatchQueryActivityInfoRequestDto
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CustomScoreClient.java
View file @
b55cbd88
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.a
op
.IgnoreFeignLogAnnotation
;
import
cn.freemud.a
nnotations
.IgnoreFeignLogAnnotation
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeKeyConstant
;
import
cn.freemud.entities.dto.user.GetUserScoreUseDetailRequest
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/CustomerApplicationClient.java
View file @
b55cbd88
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.a
op
.IgnoreFeignLogAnnotation
;
import
cn.freemud.a
nnotations
.IgnoreFeignLogAnnotation
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.entities.dto.GetPaidRuleRequestDto
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/StockClient.java
View file @
b55cbd88
...
...
@@ -12,7 +12,7 @@
*/
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.a
op
.IgnoreFeignLogAnnotation
;
import
cn.freemud.a
nnotations
.IgnoreFeignLogAnnotation
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeKeyConstant
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/thirdparty/StoreItemClient.java
View file @
b55cbd88
...
...
@@ -12,7 +12,7 @@
*/
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.a
op
.IgnoreFeignLogAnnotation
;
import
cn.freemud.a
nnotations
.IgnoreFeignLogAnnotation
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ResponseCodeKeyConstant
;
import
cn.freemud.entities.dto.*
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment