Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
b5d61aae
Commit
b5d61aae
authored
Jun 26, 2019
by
sober
Committed by
linlinjava
Jun 26, 2019
Browse files
remove useless reference and modify log print type (#216)
parent
5b006701
Changes
39
Hide whitespace changes
Inline
Side-by-side
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/Application.java
View file @
b5d61aae
...
...
@@ -6,7 +6,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
@SpringBootApplication
(
scanBasePackages
=
{
"org.linlinjava.litemall.db"
,
"org.linlinjava.litemall.core"
,
"org.linlinjava.litemall.admin"
})
@SpringBootApplication
(
scanBasePackages
=
{
"org.linlinjava.litemall.db"
,
"org.linlinjava.litemall.core"
,
"org"
+
".linlinjava.litemall.admin"
})
@MapperScan
(
"org.linlinjava.litemall.db.dao"
)
@EnableTransactionManagement
@EnableScheduling
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/annotation/RequiresPermissionsDesc.java
View file @
b5d61aae
package
org.linlinjava.litemall.admin.annotation
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
...
...
@@ -11,5 +9,6 @@ import java.lang.annotation.Target;
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
RequiresPermissionsDesc
{
String
[]
menu
();
String
button
();
}
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/config/ShiroConfig.java
View file @
b5d61aae
package
org.linlinjava.litemall.admin.config
;
import
org.apache.shiro.mgt.SecurityManager
;
import
org.apache.shiro.realm.Realm
;
import
org.apache.shiro.session.mgt.SessionManager
;
import
org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor
;
import
org.apache.shiro.spring.web.ShiroFilterFactoryBean
;
import
org.apache.shiro.mgt.SecurityManager
;
import
org.apache.shiro.web.mgt.DefaultWebSecurityManager
;
import
org.linlinjava.litemall.admin.shiro.AdminAuthorizingRealm
;
import
org.linlinjava.litemall.admin.shiro.AdminWebSessionManager
;
...
...
@@ -45,8 +45,8 @@ public class ShiroConfig {
@Bean
public
SessionManager
sessionManager
()
{
AdminWebSessionManager
mySessionManager
=
new
AdminWebSessionManager
();
return
my
SessionManager
;
return
new
AdminWeb
SessionManager
()
;
}
@Bean
...
...
@@ -59,7 +59,8 @@ public class ShiroConfig {
@Bean
public
AuthorizationAttributeSourceAdvisor
authorizationAttributeSourceAdvisor
(
SecurityManager
securityManager
)
{
AuthorizationAttributeSourceAdvisor
authorizationAttributeSourceAdvisor
=
new
AuthorizationAttributeSourceAdvisor
();
AuthorizationAttributeSourceAdvisor
authorizationAttributeSourceAdvisor
=
new
AuthorizationAttributeSourceAdvisor
();
authorizationAttributeSourceAdvisor
.
setSecurityManager
(
securityManager
);
return
authorizationAttributeSourceAdvisor
;
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/config/ShiroExceptionHandler.java
View file @
b5d61aae
package
org.linlinjava.litemall.admin.config
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.apache.shiro.authz.AuthorizationException
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
...
...
@@ -10,20 +12,22 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import
org.springframework.web.bind.annotation.ResponseBody
;
@ControllerAdvice
@Order
(
value
=
Ordered
.
HIGHEST_PRECEDENCE
)
@Order
(
value
=
Ordered
.
HIGHEST_PRECEDENCE
)
public
class
ShiroExceptionHandler
{
private
final
Log
logger
=
LogFactory
.
getLog
(
ShiroExceptionHandler
.
class
);
@ExceptionHandler
(
AuthenticationException
.
class
)
@ResponseBody
public
Object
unauthenticatedHandler
(
AuthenticationException
e
)
{
e
.
printStackTrace
(
);
logger
.
warn
(
e
.
getMessage
(),
e
);
return
ResponseUtil
.
unlogin
();
}
@ExceptionHandler
(
AuthorizationException
.
class
)
@ResponseBody
public
Object
unauthorizedHandler
(
AuthorizationException
e
)
{
e
.
printStackTrace
(
);
logger
.
warn
(
e
.
getMessage
(),
e
);
return
ResponseUtil
.
unauthz
();
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/config/Swagger2Configuration.java
View file @
b5d61aae
...
...
@@ -13,9 +13,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* swagger在线文档配置<br>
* 项目启动后可通过地址:http://host:ip/swagger-ui.html 查看在线文档
* @version 2018-07-24
*
* @author enilu
* @version 2018-07-24
*/
@Configuration
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/job/CouponJob.java
View file @
b5d61aae
...
...
@@ -11,6 +11,7 @@ import org.linlinjava.litemall.db.util.CouponUserConstant;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
...
...
@@ -35,13 +36,13 @@ public class CouponJob {
logger
.
info
(
"系统开启任务检查优惠券是否已经过期"
);
List
<
LitemallCoupon
>
couponList
=
couponService
.
queryExpired
();
for
(
LitemallCoupon
coupon
:
couponList
){
for
(
LitemallCoupon
coupon
:
couponList
)
{
coupon
.
setStatus
(
CouponConstant
.
STATUS_EXPIRED
);
couponService
.
updateById
(
coupon
);
}
List
<
LitemallCouponUser
>
couponUserList
=
couponUserService
.
queryExpired
();
for
(
LitemallCouponUser
couponUser
:
couponUserList
){
for
(
LitemallCouponUser
couponUser
:
couponUserList
)
{
couponUser
.
setStatus
(
CouponUserConstant
.
STATUS_EXPIRED
);
couponUserService
.
update
(
couponUser
);
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/job/OrderJob.java
View file @
b5d61aae
...
...
@@ -3,7 +3,6 @@ package org.linlinjava.litemall.admin.job;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.linlinjava.litemall.core.system.SystemConfig
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsProduct
;
import
org.linlinjava.litemall.db.domain.LitemallOrder
;
import
org.linlinjava.litemall.db.domain.LitemallOrderGoods
;
import
org.linlinjava.litemall.db.service.LitemallGoodsProductService
;
...
...
@@ -42,7 +41,7 @@ public class OrderJob {
* 注意,因为是相隔半小时检查,因此导致订单真正超时时间是 [LITEMALL_ORDER_UNPAID, 30 + LITEMALL_ORDER_UNPAID]
*/
@Scheduled
(
fixedDelay
=
30
*
60
*
1000
)
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
checkOrderUnpaid
()
{
logger
.
info
(
"系统开启任务检查订单是否已经超期自动取消订单"
);
...
...
@@ -65,7 +64,7 @@ public class OrderJob {
throw
new
RuntimeException
(
"商品货品库存增加失败"
);
}
}
logger
.
info
(
"订单 ID
=
"
+
order
.
getId
()
+
" 已经超期自动取消订单"
);
logger
.
info
(
"订单 ID"
+
order
.
getId
()
+
" 已经超期自动取消订单"
);
}
}
...
...
@@ -109,7 +108,6 @@ public class OrderJob {
public
void
checkOrderComment
()
{
logger
.
info
(
"系统开启任务检查订单是否已经超期未评价"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
List
<
LitemallOrder
>
orderList
=
orderService
.
queryComment
(
SystemConfig
.
getOrderComment
());
for
(
LitemallOrder
order
:
orderList
)
{
order
.
setComments
((
short
)
0
);
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/service/AdminGoodsService.java
View file @
b5d61aae
...
...
@@ -37,10 +37,6 @@ public class AdminGoodsService {
private
LitemallCategoryService
categoryService
;
@Autowired
private
LitemallBrandService
brandService
;
@Autowired
private
LitemallCartService
cartService
;
@Autowired
private
LitemallOrderGoodsService
orderGoodsService
;
@Autowired
private
QCodeService
qCodeService
;
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/service/AdminOrderService.java
View file @
b5d61aae
...
...
@@ -53,7 +53,8 @@ public class AdminOrderService {
public
Object
list
(
Integer
userId
,
String
orderSn
,
List
<
Short
>
orderStatusArray
,
Integer
page
,
Integer
limit
,
String
sort
,
String
order
)
{
List
<
LitemallOrder
>
orderList
=
orderService
.
querySelective
(
userId
,
orderSn
,
orderStatusArray
,
page
,
limit
,
sort
,
order
);
List
<
LitemallOrder
>
orderList
=
orderService
.
querySelective
(
userId
,
orderSn
,
orderStatusArray
,
page
,
limit
,
sort
,
order
);
return
ResponseUtil
.
okList
(
orderList
);
}
...
...
@@ -154,7 +155,8 @@ public class AdminOrderService {
//TODO 发送邮件和短信通知,这里采用异步发送
// 退款成功通知用户, 例如“您申请的订单退款 [ 单号:{1} ] 已成功,请耐心等待到账。”
// 注意订单号只发后6位
notifyService
.
notifySmsTemplate
(
order
.
getMobile
(),
NotifyType
.
REFUND
,
new
String
[]{
order
.
getOrderSn
().
substring
(
8
,
14
)});
notifyService
.
notifySmsTemplate
(
order
.
getMobile
(),
NotifyType
.
REFUND
,
new
String
[]{
order
.
getOrderSn
().
substring
(
8
,
14
)});
logHelper
.
logOrderSucceed
(
"退款"
,
"订单编号 "
+
orderId
);
return
ResponseUtil
.
ok
();
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/service/LogHelper.java
View file @
b5d61aae
...
...
@@ -19,7 +19,7 @@ import javax.servlet.http.HttpServletRequest;
* 安全日志:用户安全相关的操作日志,例如登录、删除管理员
* 订单日志:用户交易相关的操作日志,例如订单发货、退款
* 其他日志:如果以上三种不合适,可以选择其他日志,建议是优先级最低的日志级别
*
*
<p>
* 当然可能很多操作是不需要记录到数据库的,例如编辑商品、编辑广告品之类。
*/
@Component
...
...
@@ -32,74 +32,73 @@ public class LogHelper {
@Autowired
private
LitemallLogService
logService
;
public
void
logGeneralSucceed
(
String
action
){
public
void
logGeneralSucceed
(
String
action
)
{
logAdmin
(
LOG_TYPE_GENERAL
,
action
,
true
,
""
,
""
);
}
public
void
logGeneralSucceed
(
String
action
,
String
result
){
public
void
logGeneralSucceed
(
String
action
,
String
result
)
{
logAdmin
(
LOG_TYPE_GENERAL
,
action
,
true
,
result
,
""
);
}
public
void
logGeneralFail
(
String
action
,
String
error
){
public
void
logGeneralFail
(
String
action
,
String
error
)
{
logAdmin
(
LOG_TYPE_GENERAL
,
action
,
false
,
error
,
""
);
}
public
void
logAuthSucceed
(
String
action
){
public
void
logAuthSucceed
(
String
action
)
{
logAdmin
(
LOG_TYPE_AUTH
,
action
,
true
,
""
,
""
);
}
public
void
logAuthSucceed
(
String
action
,
String
result
){
public
void
logAuthSucceed
(
String
action
,
String
result
)
{
logAdmin
(
LOG_TYPE_AUTH
,
action
,
true
,
result
,
""
);
}
public
void
logAuthFail
(
String
action
,
String
error
){
public
void
logAuthFail
(
String
action
,
String
error
)
{
logAdmin
(
LOG_TYPE_AUTH
,
action
,
false
,
error
,
""
);
}
public
void
logOrderSucceed
(
String
action
){
public
void
logOrderSucceed
(
String
action
)
{
logAdmin
(
LOG_TYPE_ORDER
,
action
,
true
,
""
,
""
);
}
public
void
logOrderSucceed
(
String
action
,
String
result
){
public
void
logOrderSucceed
(
String
action
,
String
result
)
{
logAdmin
(
LOG_TYPE_ORDER
,
action
,
true
,
result
,
""
);
}
public
void
logOrderFail
(
String
action
,
String
error
){
public
void
logOrderFail
(
String
action
,
String
error
)
{
logAdmin
(
LOG_TYPE_ORDER
,
action
,
false
,
error
,
""
);
}
public
void
logOtherSucceed
(
String
action
){
public
void
logOtherSucceed
(
String
action
)
{
logAdmin
(
LOG_TYPE_OTHER
,
action
,
true
,
""
,
""
);
}
public
void
logOtherSucceed
(
String
action
,
String
result
){
public
void
logOtherSucceed
(
String
action
,
String
result
)
{
logAdmin
(
LOG_TYPE_OTHER
,
action
,
true
,
result
,
""
);
}
public
void
logOtherFail
(
String
action
,
String
error
){
public
void
logOtherFail
(
String
action
,
String
error
)
{
logAdmin
(
LOG_TYPE_OTHER
,
action
,
false
,
error
,
""
);
}
public
void
logAdmin
(
Integer
type
,
String
action
,
Boolean
succeed
,
String
result
,
String
comment
){
public
void
logAdmin
(
Integer
type
,
String
action
,
Boolean
succeed
,
String
result
,
String
comment
)
{
LitemallLog
log
=
new
LitemallLog
();
Subject
currentUser
=
SecurityUtils
.
getSubject
();
if
(
currentUser
!=
null
)
{
if
(
currentUser
!=
null
)
{
LitemallAdmin
admin
=
(
LitemallAdmin
)
currentUser
.
getPrincipal
();
if
(
admin
!=
null
)
{
if
(
admin
!=
null
)
{
log
.
setAdmin
(
admin
.
getUsername
());
}
else
{
}
else
{
log
.
setAdmin
(
"匿名用户"
);
}
}
else
{
}
else
{
log
.
setAdmin
(
"匿名用户"
);
}
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
if
(
request
!=
null
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
if
(
request
!=
null
)
{
log
.
setIp
(
IpUtil
.
getIpAddr
(
request
));
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/shiro/AdminAuthorizingRealm.java
View file @
b5d61aae
...
...
@@ -52,7 +52,7 @@ public class AdminAuthorizingRealm extends AuthorizingRealm {
UsernamePasswordToken
upToken
=
(
UsernamePasswordToken
)
token
;
String
username
=
upToken
.
getUsername
();
String
password
=
new
String
(
upToken
.
getPassword
());
String
password
=
new
String
(
upToken
.
getPassword
());
if
(
StringUtils
.
isEmpty
(
username
))
{
throw
new
AccountException
(
"用户名不能为空"
);
...
...
@@ -64,16 +64,16 @@ public class AdminAuthorizingRealm extends AuthorizingRealm {
List
<
LitemallAdmin
>
adminList
=
adminService
.
findAdmin
(
username
);
Assert
.
state
(
adminList
.
size
()
<
2
,
"同一个用户名存在两个账户"
);
if
(
adminList
.
size
()
==
0
)
{
throw
new
UnknownAccountException
(
"找不到用户("
+
username
+
")的帐号信息"
);
throw
new
UnknownAccountException
(
"找不到用户("
+
username
+
")的帐号信息"
);
}
LitemallAdmin
admin
=
adminList
.
get
(
0
);
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
();
if
(!
encoder
.
matches
(
password
,
admin
.
getPassword
()))
{
throw
new
UnknownAccountException
(
"找不到用户("
+
username
+
")的帐号信息"
);
throw
new
UnknownAccountException
(
"找不到用户("
+
username
+
")的帐号信息"
);
}
return
new
SimpleAuthenticationInfo
(
admin
,
password
,
getName
());
return
new
SimpleAuthenticationInfo
(
admin
,
password
,
getName
());
}
}
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/shiro/AdminWebSessionManager.java
View file @
b5d61aae
...
...
@@ -17,13 +17,13 @@ public class AdminWebSessionManager extends DefaultWebSessionManager {
@Override
protected
Serializable
getSessionId
(
ServletRequest
request
,
ServletResponse
response
)
{
String
id
=
WebUtils
.
toHttp
(
request
).
getHeader
(
LOGIN_TOKEN_KEY
);
if
(!
StringUtils
.
isEmpty
(
id
))
{
if
(!
StringUtils
.
isEmpty
(
id
))
{
request
.
setAttribute
(
ShiroHttpServletRequest
.
REFERENCED_SESSION_ID_SOURCE
,
REFERENCED_SESSION_ID_SOURCE
);
request
.
setAttribute
(
ShiroHttpServletRequest
.
REFERENCED_SESSION_ID
,
id
);
request
.
setAttribute
(
ShiroHttpServletRequest
.
REFERENCED_SESSION_ID_IS_VALID
,
Boolean
.
TRUE
);
return
id
;
}
else
{
return
super
.
getSessionId
(
request
,
response
);
}
}
else
{
return
super
.
getSessionId
(
request
,
response
);
}
}
}
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/util/Permission.java
View file @
b5d61aae
...
...
@@ -2,7 +2,6 @@ package org.linlinjava.litemall.admin.util;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc
;
import
org.springframework.web.bind.annotation.RequestMapping
;
public
class
Permission
{
private
RequiresPermissions
requiresPermissions
;
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/util/PermissionUtil.java
View file @
b5d61aae
...
...
@@ -74,8 +74,7 @@ public class PermissionUtil {
leftPerm
.
setLabel
(
requiresPermissionsDesc
.
button
());
leftPerm
.
setApi
(
api
);
perm2
.
getChildren
().
add
(
leftPerm
);
}
else
{
}
else
{
// TODO
// 目前限制Controller里面每个方法的RequiresPermissionsDesc注解是唯一的
// 如果允许相同,可能会造成内部权限不一致。
...
...
@@ -100,8 +99,10 @@ public class PermissionUtil {
RequestMapping
clazzRequestMapping
=
AnnotationUtils
.
findAnnotation
(
controllerClz
,
RequestMapping
.
class
);
List
<
Method
>
methods
=
MethodUtils
.
getMethodsListWithAnnotation
(
controllerClz
,
RequiresPermissions
.
class
);
for
(
Method
method
:
methods
)
{
RequiresPermissions
requiresPermissions
=
AnnotationUtils
.
getAnnotation
(
method
,
RequiresPermissions
.
class
);
RequiresPermissionsDesc
requiresPermissionsDesc
=
AnnotationUtils
.
getAnnotation
(
method
,
RequiresPermissionsDesc
.
class
);
RequiresPermissions
requiresPermissions
=
AnnotationUtils
.
getAnnotation
(
method
,
RequiresPermissions
.
class
);
RequiresPermissionsDesc
requiresPermissionsDesc
=
AnnotationUtils
.
getAnnotation
(
method
,
RequiresPermissionsDesc
.
class
);
if
(
requiresPermissions
==
null
||
requiresPermissionsDesc
==
null
)
{
continue
;
...
...
@@ -143,7 +144,7 @@ public class PermissionUtil {
public
static
Set
<
String
>
listPermissionString
(
List
<
Permission
>
permissions
)
{
Set
<
String
>
permissionsString
=
new
HashSet
<>();
for
(
Permission
permission
:
permissions
){
for
(
Permission
permission
:
permissions
)
{
permissionsString
.
add
(
permission
.
getRequiresPermissions
().
value
()[
0
]);
}
return
permissionsString
;
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAdController.java
View file @
b5d61aae
...
...
@@ -27,7 +27,7 @@ public class AdminAdController {
private
LitemallAdService
adService
;
@RequiresPermissions
(
"admin:ad:list"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"查询"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"查询"
)
@GetMapping
(
"/list"
)
public
Object
list
(
String
name
,
String
content
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
...
...
@@ -51,7 +51,7 @@ public class AdminAdController {
}
@RequiresPermissions
(
"admin:ad:create"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"添加"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"添加"
)
@PostMapping
(
"/create"
)
public
Object
create
(
@RequestBody
LitemallAd
ad
)
{
Object
error
=
validate
(
ad
);
...
...
@@ -63,7 +63,7 @@ public class AdminAdController {
}
@RequiresPermissions
(
"admin:ad:read"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"详情"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"详情"
)
@GetMapping
(
"/read"
)
public
Object
read
(
@NotNull
Integer
id
)
{
LitemallAd
ad
=
adService
.
findById
(
id
);
...
...
@@ -71,7 +71,7 @@ public class AdminAdController {
}
@RequiresPermissions
(
"admin:ad:update"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"编辑"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"编辑"
)
@PostMapping
(
"/update"
)
public
Object
update
(
@RequestBody
LitemallAd
ad
)
{
Object
error
=
validate
(
ad
);
...
...
@@ -86,7 +86,7 @@ public class AdminAdController {
}
@RequiresPermissions
(
"admin:ad:delete"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"删除"
)
@RequiresPermissionsDesc
(
menu
=
{
"推广管理"
,
"广告管理"
},
button
=
"删除"
)
@PostMapping
(
"/delete"
)
public
Object
delete
(
@RequestBody
LitemallAd
ad
)
{
Integer
id
=
ad
.
getId
();
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAddressController.java
View file @
b5d61aae
...
...
@@ -31,7 +31,7 @@ public class AdminAddressController {
private
LitemallRegionService
regionService
;
@RequiresPermissions
(
"admin:address:list"
)
@RequiresPermissionsDesc
(
menu
=
{
"用户管理"
,
"收货地址"
},
button
=
"查询"
)
@RequiresPermissionsDesc
(
menu
=
{
"用户管理"
,
"收货地址"
},
button
=
"查询"
)
@GetMapping
(
"/list"
)
public
Object
list
(
Integer
userId
,
String
name
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAdminController.java
View file @
b5d61aae
...
...
@@ -36,7 +36,7 @@ public class AdminAdminController {
private
LogHelper
logHelper
;
@RequiresPermissions
(
"admin:admin:list"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"查询"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"查询"
)
@GetMapping
(
"/list"
)
public
Object
list
(
String
username
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
...
...
@@ -63,7 +63,7 @@ public class AdminAdminController {
}
@RequiresPermissions
(
"admin:admin:create"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"添加"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"添加"
)
@PostMapping
(
"/create"
)
public
Object
create
(
@RequestBody
LitemallAdmin
admin
)
{
Object
error
=
validate
(
admin
);
...
...
@@ -87,7 +87,7 @@ public class AdminAdminController {
}
@RequiresPermissions
(
"admin:admin:read"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"详情"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"详情"
)
@GetMapping
(
"/read"
)
public
Object
read
(
@NotNull
Integer
id
)
{
LitemallAdmin
admin
=
adminService
.
findById
(
id
);
...
...
@@ -95,7 +95,7 @@ public class AdminAdminController {
}
@RequiresPermissions
(
"admin:admin:update"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"编辑"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"编辑"
)
@PostMapping
(
"/update"
)
public
Object
update
(
@RequestBody
LitemallAdmin
admin
)
{
Object
error
=
validate
(
admin
);
...
...
@@ -120,7 +120,7 @@ public class AdminAdminController {
}
@RequiresPermissions
(
"admin:admin:delete"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"删除"
)
@RequiresPermissionsDesc
(
menu
=
{
"系统管理"
,
"管理员管理"
},
button
=
"删除"
)
@PostMapping
(
"/delete"
)
public
Object
delete
(
@RequestBody
LitemallAdmin
admin
)
{
Integer
anotherAdminId
=
admin
.
getId
();
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAuthController.java
View file @
b5d61aae
...
...
@@ -16,9 +16,7 @@ import org.linlinjava.litemall.core.util.IpUtil;
import
org.linlinjava.litemall.core.util.JacksonUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.db.domain.LitemallAdmin
;
import
org.linlinjava.litemall.db.domain.LitemallLog
;
import
org.linlinjava.litemall.db.service.LitemallAdminService
;
import
org.linlinjava.litemall.db.service.LitemallLogService
;
import
org.linlinjava.litemall.db.service.LitemallPermissionService
;
import
org.linlinjava.litemall.db.service.LitemallRoleService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -153,7 +151,7 @@ public class AdminAuthController {
apis
.
clear
();
apis
.
add
(
"*"
);
return
apis
;
// return systemPermissionsMap.values();
// return systemPermissionsMap.values();
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminBrandController.java
View file @
b5d61aae
...
...
@@ -28,7 +28,7 @@ public class AdminBrandController {
private
LitemallBrandService
brandService
;
@RequiresPermissions
(
"admin:brand:list"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"查询"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"查询"
)
@GetMapping
(
"/list"
)
public
Object
list
(
String
id
,
String
name
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
...
...
@@ -58,7 +58,7 @@ public class AdminBrandController {
}
@RequiresPermissions
(
"admin:brand:create"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"添加"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"添加"
)
@PostMapping
(
"/create"
)
public
Object
create
(
@RequestBody
LitemallBrand
brand
)
{
Object
error
=
validate
(
brand
);
...
...
@@ -70,7 +70,7 @@ public class AdminBrandController {
}
@RequiresPermissions
(
"admin:brand:read"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"详情"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"详情"
)
@GetMapping
(
"/read"
)
public
Object
read
(
@NotNull
Integer
id
)
{
LitemallBrand
brand
=
brandService
.
findById
(
id
);
...
...
@@ -78,7 +78,7 @@ public class AdminBrandController {
}
@RequiresPermissions
(
"admin:brand:update"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"编辑"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"编辑"
)
@PostMapping
(
"/update"
)
public
Object
update
(
@RequestBody
LitemallBrand
brand
)
{
Object
error
=
validate
(
brand
);
...
...
@@ -92,7 +92,7 @@ public class AdminBrandController {
}
@RequiresPermissions
(
"admin:brand:delete"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"删除"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"品牌管理"
},
button
=
"删除"
)
@PostMapping
(
"/delete"
)
public
Object
delete
(
@RequestBody
LitemallBrand
brand
)
{
Integer
id
=
brand
.
getId
();
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminCategoryController.java
View file @
b5d61aae
...
...
@@ -29,13 +29,13 @@ public class AdminCategoryController {
private
LitemallCategoryService
categoryService
;
@RequiresPermissions
(
"admin:category:list"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"查询"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"查询"
)
@GetMapping
(
"/list"
)
public
Object
list
()
{
List
<
CategoryVo
>
categoryVoList
=
new
ArrayList
<>();
List
<
LitemallCategory
>
categoryList
=
categoryService
.
queryByPid
(
0
);
for
(
LitemallCategory
category
:
categoryList
){
for
(
LitemallCategory
category
:
categoryList
)
{
CategoryVo
categoryVO
=
new
CategoryVo
();
categoryVO
.
setId
(
category
.
getId
());
categoryVO
.
setDesc
(
category
.
getDesc
());
...
...
@@ -47,7 +47,7 @@ public class AdminCategoryController {
List
<
CategoryVo
>
children
=
new
ArrayList
<>();
List
<
LitemallCategory
>
subCategoryList
=
categoryService
.
queryByPid
(
category
.
getId
());
for
(
LitemallCategory
subCategory
:
subCategoryList
){
for
(
LitemallCategory
subCategory
:
subCategoryList
)
{
CategoryVo
subCategoryVo
=
new
CategoryVo
();
subCategoryVo
.
setId
(
subCategory
.
getId
());
subCategoryVo
.
setDesc
(
subCategory
.
getDesc
());
...
...
@@ -90,7 +90,7 @@ public class AdminCategoryController {
}
@RequiresPermissions
(
"admin:category:create"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"添加"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"添加"
)
@PostMapping
(
"/create"
)
public
Object
create
(
@RequestBody
LitemallCategory
category
)
{
Object
error
=
validate
(
category
);
...
...
@@ -102,7 +102,7 @@ public class AdminCategoryController {
}
@RequiresPermissions
(
"admin:category:read"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"详情"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"详情"
)
@GetMapping
(
"/read"
)
public
Object
read
(
@NotNull
Integer
id
)
{
LitemallCategory
category
=
categoryService
.
findById
(
id
);
...
...
@@ -110,7 +110,7 @@ public class AdminCategoryController {
}
@RequiresPermissions
(
"admin:category:update"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"编辑"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"编辑"
)
@PostMapping
(
"/update"
)
public
Object
update
(
@RequestBody
LitemallCategory
category
)
{
Object
error
=
validate
(
category
);
...
...
@@ -125,7 +125,7 @@ public class AdminCategoryController {
}
@RequiresPermissions
(
"admin:category:delete"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"删除"
)
@RequiresPermissionsDesc
(
menu
=
{
"商场管理"
,
"类目管理"
},
button
=
"删除"
)
@PostMapping
(
"/delete"
)
public
Object
delete
(
@RequestBody
LitemallCategory
category
)
{
Integer
id
=
category
.
getId
();
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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