Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
gogirl-miniapp-backend
Commits
1089fb95
Commit
1089fb95
authored
Jul 23, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错误状态码
parent
f874c39c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
79 additions
and
16 deletions
+79
-16
CustomerMessageServiceImpl.java
...plication/common/xcx/impl/CustomerMessageServiceImpl.java
+2
-1
ScheduleManageServiceImpl.java
...plication/order/serve/impl/ScheduleManageServiceImpl.java
+2
-1
StoreManageServiceImpl.java
.../application/store/store/impl/StoreManageServiceImpl.java
+2
-1
StoreTechnicianServiceImpl.java
...lication/store/store/impl/StoreTechnicianServiceImpl.java
+4
-3
CustomerBalanceServiceImpl.java
...cation/user/customer/impl/CustomerBalanceServiceImpl.java
+2
-1
ErrorCode.java
...com/gogirl/infrastructure/common/exception/ErrorCode.java
+48
-0
RRException.java
...m/gogirl/infrastructure/common/exception/RRException.java
+5
-0
AuthHandlerInterceptor.java
...astructure/common/interceptor/AuthHandlerInterceptor.java
+3
-2
LoginHandlerInterceptor.java
...structure/common/interceptor/LoginHandlerInterceptor.java
+4
-3
SessionUtils.java
...a/com/gogirl/infrastructure/common/util/SessionUtils.java
+3
-2
WxUtils.java
...n/java/com/gogirl/infrastructure/common/util/WxUtils.java
+2
-1
ScheduleManageController.java
...girl/interfaces/order/serve/ScheduleManageController.java
+2
-1
No files found.
src/main/java/com/gogirl/application/common/xcx/impl/CustomerMessageServiceImpl.java
View file @
1089fb95
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.gogirl.application.common.xcx.CustomerMessageService
;
import
com.gogirl.domain.user.customer.CustomerMessage
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.SessionUtils
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerMessageMapper
;
...
...
@@ -30,7 +31,7 @@ public class CustomerMessageServiceImpl extends ServiceImpl<CustomerMessageMappe
public
Page
<
CustomerMessage
>
queryPageMessage
(
CustomerMessagePageQuery
qry
)
{
//线程变量当前当前用户id
if
(
SessionUtils
.
getCustomerToken
()
==
null
)
{
throw
new
RRException
(
2000
,
"token失效"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
qry
.
setCustomerId
(
SessionUtils
.
getCustomerToken
().
getCustomerId
());
...
...
src/main/java/com/gogirl/application/order/serve/impl/ScheduleManageServiceImpl.java
View file @
1089fb95
...
...
@@ -23,6 +23,7 @@ import com.gogirl.domain.store.store.StoreManage;
import
com.gogirl.domain.store.store.StoreTechnician
;
import
com.gogirl.domain.user.customer.Customer
;
import
com.gogirl.infrastructure.common.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.*
;
import
com.gogirl.infrastructure.mapper.market.discount.LeisureDiscountConfigLabelMapper
;
...
...
@@ -621,7 +622,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
technicianId
,
scheduleId
);
if
(
ListUtil
.
isNotEmpty
(
conflictScheduleServeList
))
{
throw
new
RRException
(
2003
,
"冲突"
);
throw
new
RRException
(
ErrorCode
.
OR_2003
);
}
});
}
...
...
src/main/java/com/gogirl/application/store/store/impl/StoreManageServiceImpl.java
View file @
1089fb95
...
...
@@ -8,6 +8,7 @@ import com.gogirl.application.store.store.StoreManageService;
import
com.gogirl.domain.common.xcx.GogirlToken
;
import
com.gogirl.domain.store.store.StoreGuide
;
import
com.gogirl.domain.store.store.StoreManage
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.MapDistanceUtils
;
import
com.gogirl.infrastructure.common.util.SessionUtils
;
...
...
@@ -37,7 +38,7 @@ public class StoreManageServiceImpl extends ServiceImpl<StoreManageMapper, Store
public
List
<
StoreManage
>
getTechnicianShopList
()
{
GogirlToken
gogirlToken
=
SessionUtils
.
getTechnicianToken
();
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
return
storeManageMapper
.
getTechnicianShopList
(
SessionUtils
.
getTechnicianId
());
}
...
...
src/main/java/com/gogirl/application/store/store/impl/StoreTechnicianServiceImpl.java
View file @
1089fb95
...
...
@@ -9,6 +9,7 @@ import com.gogirl.application.store.store.StoreTechnicianService;
import
com.gogirl.domain.common.xcx.GogirlToken
;
import
com.gogirl.domain.store.store.StoreManage
;
import
com.gogirl.domain.store.store.StoreTechnician
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.SessionUtils
;
import
com.gogirl.infrastructure.mapper.store.store.StoreManageMapper
;
...
...
@@ -58,7 +59,7 @@ public class StoreTechnicianServiceImpl extends ServiceImpl<StoreTechnicianMappe
StoreTechnician
storeTechnician
=
this
.
getOne
(
new
LambdaQueryWrapper
<
StoreTechnician
>().
eq
(
StoreTechnician:
:
getOpenid
,
openid
));
if
(
storeTechnician
==
null
)
{
throw
new
RRException
(
2006
,
"请绑定手机号"
);
throw
new
RRException
(
ErrorCode
.
TC_2006
);
}
//美甲师token
...
...
@@ -82,7 +83,7 @@ public class StoreTechnicianServiceImpl extends ServiceImpl<StoreTechnicianMappe
public
void
choseStore
(
Integer
departmentId
)
{
GogirlToken
gogirlToken
=
SessionUtils
.
getTechnicianToken
();
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token已经失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
StoreManage
storeManage
=
storeManageMapper
.
selectById
(
departmentId
);
...
...
@@ -95,7 +96,7 @@ public class StoreTechnicianServiceImpl extends ServiceImpl<StoreTechnicianMappe
public
StoreTechnician
getTechnician
()
{
Integer
technicianId
=
SessionUtils
.
getTechnicianId
();
if
(
technicianId
==
null
)
{
throw
new
RRException
(
2000
,
"token已经失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
StoreTechnician
storeTechnician
=
this
.
getById
(
technicianId
);
GogirlToken
gogirlToken
=
SessionUtils
.
getTechnicianToken
();
...
...
src/main/java/com/gogirl/application/user/customer/impl/CustomerBalanceServiceImpl.java
View file @
1089fb95
...
...
@@ -12,6 +12,7 @@ import com.gogirl.domain.order.serve.OrderManage;
import
com.gogirl.domain.store.store.StoreUser
;
import
com.gogirl.domain.user.customer.CustomerBalance
;
import
com.gogirl.domain.user.customer.CustomerBalanceRecord
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.mapper.store.store.UserManageMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper
;
...
...
@@ -72,7 +73,7 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
}
if
(
customerBalance
.
getBalance
()
<
cmd
.
getAmount
())
{
throw
new
RRException
(
2002
,
"余额不足"
);
throw
new
RRException
(
ErrorCode
.
CS_2002
);
}
//余额支付
...
...
src/main/java/com/gogirl/infrastructure/common/exception/ErrorCode.java
0 → 100644
View file @
1089fb95
package
com
.
gogirl
.
infrastructure
.
common
.
exception
;
/**
* <p>
* 错误码
* </p>
*
* @author robbendev
* @since 2020/7/23 2:17 下午
*/
public
enum
ErrorCode
{
CS_1001
(
1001
,
"请授权手机号"
),
CS_1002
(
1002
,
"会员才能享受服务"
),
CS_2000
(
2000
,
"token失效,请重新登陆"
),
CS_2002
(
2002
,
"余额不足"
),
OR_2003
(
2003
,
"预约冲突"
),
ST_2005
(
2005
,
"请选择店铺"
),
TC_2006
(
2006
,
"请绑定手机号"
),
;
private
Integer
code
;
private
String
message
;
ErrorCode
(
Integer
code
,
String
message
)
{
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
src/main/java/com/gogirl/infrastructure/common/exception/RRException.java
View file @
1089fb95
...
...
@@ -46,6 +46,11 @@ public class RRException extends RuntimeException implements Serializable {
}
public
RRException
(
ErrorCode
errorCode
)
{
this
.
code
=
errorCode
.
getCode
();
this
.
message
=
errorCode
.
getMessage
();
}
public
RRException
(
String
message
)
{
this
.
code
=
500
;
this
.
message
=
message
;
...
...
src/main/java/com/gogirl/infrastructure/common/interceptor/AuthHandlerInterceptor.java
View file @
1089fb95
...
...
@@ -4,6 +4,7 @@ import com.gogirl.application.common.xcx.GogirlTokenService;
import
com.gogirl.domain.common.xcx.GogirlToken
;
import
com.gogirl.domain.user.customer.Customer
;
import
com.gogirl.infrastructure.common.annotation.AuthIgnore
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.StringUtils
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerMapper
;
...
...
@@ -54,11 +55,11 @@ public class AuthHandlerInterceptor implements HandlerInterceptor {
if
(
sourceFrom
.
equals
(
"customer"
))
{
GogirlToken
gogirlToken
=
gogirlTokenService
.
getByToken
(
token
);
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
else
{
Customer
customer
=
customerMapper
.
selectById
(
gogirlToken
.
getCustomerId
());
if
(
customer
!=
null
&&
StringUtils
.
isEmpty
(
customer
.
getPhone
()))
{
throw
new
RRException
(
1001
,
"请授权手机号码"
);
throw
new
RRException
(
ErrorCode
.
CS_1001
);
}
}
}
...
...
src/main/java/com/gogirl/infrastructure/common/interceptor/LoginHandlerInterceptor.java
View file @
1089fb95
...
...
@@ -4,6 +4,7 @@ import com.gogirl.application.common.xcx.GogirlTokenService;
import
com.gogirl.domain.common.xcx.GogirlToken
;
import
com.gogirl.domain.store.store.StoreManage
;
import
com.gogirl.infrastructure.common.annotation.LoginIgnore
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.ListUtil
;
import
com.gogirl.infrastructure.mapper.store.store.StoreManageMapper
;
...
...
@@ -53,14 +54,14 @@ public class LoginHandlerInterceptor implements HandlerInterceptor {
if
(
sourceFrom
.
equals
(
"customer"
))
{
GogirlToken
gogirlToken
=
gogirlTokenService
.
getByToken
(
token
);
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
}
if
(
sourceFrom
.
equals
(
"technician"
))
{
GogirlToken
gogirlToken
=
gogirlTokenService
.
getByToken
(
token
);
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
else
{
if
(
gogirlToken
.
getDepartmentId
()
==
null
||
gogirlToken
.
getDepartmentId
()
==
0
)
{
List
<
StoreManage
>
storeManageList
=
storeManageMapper
.
getTechnicianShopList
(
gogirlToken
.
getTechnicianId
());
...
...
@@ -70,7 +71,7 @@ public class LoginHandlerInterceptor implements HandlerInterceptor {
gogirlToken
.
setDepartmentName
(
storeManage
.
getName
());
gogirlTokenService
.
updateByToken
(
gogirlToken
);
}
else
{
throw
new
RRException
(
2005
,
"请选择店铺"
);
throw
new
RRException
(
ErrorCode
.
ST_2005
);
}
}
}
...
...
src/main/java/com/gogirl/infrastructure/common/util/SessionUtils.java
View file @
1089fb95
package
com
.
gogirl
.
infrastructure
.
common
.
util
;
import
com.gogirl.domain.common.xcx.GogirlToken
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
/**
...
...
@@ -77,7 +78,7 @@ public class SessionUtils {
public
static
Integer
getTechnicianId
()
{
GogirlToken
gogirlToken
=
technicianTokenThreadLocal
.
get
();
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token已经失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
return
gogirlToken
.
getTechnicianId
();
}
...
...
@@ -90,7 +91,7 @@ public class SessionUtils {
public
static
Integer
getCustomerId
()
{
GogirlToken
gogirlToken
=
customerTokenThreadLocal
.
get
();
if
(
gogirlToken
==
null
)
{
throw
new
RRException
(
2000
,
"token已经失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
return
gogirlToken
.
getCustomerId
();
}
...
...
src/main/java/com/gogirl/infrastructure/common/util/WxUtils.java
View file @
1089fb95
package
com
.
gogirl
.
infrastructure
.
common
.
util
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.codec.binary.Base64
;
...
...
@@ -34,7 +35,7 @@ public class WxUtils {
result
=
new
String
(
WxPKCS7Encoder
.
decode
(
resultByte
));
return
JSONObject
.
fromObject
(
result
);
}
throw
new
RRException
(
2000
,
"token失效,请重新登陆"
);
throw
new
RRException
(
ErrorCode
.
CS_2000
);
}
/**
...
...
src/main/java/com/gogirl/interfaces/order/serve/ScheduleManageController.java
View file @
1089fb95
...
...
@@ -17,6 +17,7 @@ import com.gogirl.domain.order.serve.ScheduleServe;
import
com.gogirl.domain.product.serve.BaseProduce
;
import
com.gogirl.domain.store.store.StoreTechnician
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.common.exception.ErrorCode
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.ListUtil
;
import
com.gogirl.infrastructure.common.util.SessionUtils
;
...
...
@@ -153,7 +154,7 @@ public class ScheduleManageController {
.
eq
(
VipServe:
:
getVipLevel
,
customerBalanceService
.
getCustomerBalance
(
currentCustomerId
).
getLevel
()));
if
(
ListUtil
.
isEmpty
(
vipServeList
))
{
throw
new
RRException
(
1002
,
"会员才能享受服务"
);
throw
new
RRException
(
ErrorCode
.
CS_1002
);
}
return
JsonResult
.
success
();
...
...
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