Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
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
hewei
wecloud_im_server
Commits
57fea55b
Commit
57fea55b
authored
Sep 28, 2020
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成商家CMS权限配置
parent
8d3b684c
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
2059 additions
and
21 deletions
+2059
-21
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantHelloWorldController.java
+36
-6
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantPermissionController.java
+99
-0
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRegisterController.java
+0
-1
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRoleController.java
+99
-0
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRolePermissionController.java
+99
-0
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantUserController.java
+112
-0
common/src/main/java/com/jumeirah/common/convert/SysUserConvert.java
+4
-0
common/src/main/java/com/jumeirah/common/entity/MerchantPermission.java
+79
-0
common/src/main/java/com/jumeirah/common/entity/MerchantRole.java
+62
-0
common/src/main/java/com/jumeirah/common/entity/MerchantRolePermission.java
+60
-0
common/src/main/java/com/jumeirah/common/entity/MerchantUser.java
+88
-0
common/src/main/java/com/jumeirah/common/mapper/MerchantPermissionMapper.java
+42
-0
common/src/main/java/com/jumeirah/common/mapper/MerchantRoleMapper.java
+42
-0
common/src/main/java/com/jumeirah/common/mapper/MerchantRolePermissionMapper.java
+50
-0
common/src/main/java/com/jumeirah/common/mapper/MerchantUserMapper.java
+42
-0
common/src/main/java/com/jumeirah/common/param/MerchantPermissionPageParam.java
+23
-0
common/src/main/java/com/jumeirah/common/param/MerchantRolePageParam.java
+23
-0
common/src/main/java/com/jumeirah/common/param/MerchantRolePermissionPageParam.java
+23
-0
common/src/main/java/com/jumeirah/common/param/MerchantUserPageParam.java
+23
-0
common/src/main/java/com/jumeirah/common/service/MerchantPermissionService.java
+62
-0
common/src/main/java/com/jumeirah/common/service/MerchantRolePermissionService.java
+75
-0
common/src/main/java/com/jumeirah/common/service/MerchantRoleService.java
+62
-0
common/src/main/java/com/jumeirah/common/service/MerchantUserService.java
+78
-0
common/src/main/java/com/jumeirah/common/service/impl/MerchantPermissionServiceImpl.java
+62
-0
common/src/main/java/com/jumeirah/common/service/impl/MerchantRolePermissionServiceImpl.java
+69
-0
common/src/main/java/com/jumeirah/common/service/impl/MerchantRoleServiceImpl.java
+62
-0
common/src/main/java/com/jumeirah/common/service/impl/MerchantUserServiceImpl.java
+221
-0
common/src/main/java/com/jumeirah/common/service/impl/SysLoginServiceImpl.java
+2
-4
common/src/main/java/com/jumeirah/common/vo/MerchantPermissionQueryVo.java
+66
-0
common/src/main/java/com/jumeirah/common/vo/MerchantRolePermissionQueryVo.java
+48
-0
common/src/main/java/com/jumeirah/common/vo/MerchantRoleQueryVo.java
+51
-0
common/src/main/java/com/jumeirah/common/vo/MerchantUserQueryVo.java
+75
-0
common/src/main/resources/mapper/merchant/MerchantPermissionMapper.xml
+23
-0
common/src/main/resources/mapper/merchant/MerchantRoleMapper.xml
+23
-0
common/src/main/resources/mapper/merchant/MerchantRolePermissionMapper.xml
+37
-0
common/src/main/resources/mapper/merchant/MerchantUserMapper.xml
+23
-0
config/src/main/resources/config/application.yml
+4
-4
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtFilter.java
+4
-3
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/realm/JwtRealmSystem.java
+1
-1
generator/src/main/java/io/geekidea/springbootplus/generator/SpringBootPlusGenerator.java
+5
-2
No files found.
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantHelloWorldController.java
View file @
57fea55b
...
@@ -5,6 +5,8 @@ import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
...
@@ -5,6 +5,8 @@ import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -20,12 +22,6 @@ import java.io.IOException;
...
@@ -20,12 +22,6 @@ import java.io.IOException;
@RequestMapping
(
"/merchant/"
)
@RequestMapping
(
"/merchant/"
)
public
class
MerchantHelloWorldController
{
public
class
MerchantHelloWorldController
{
/**
* Hello World
*
* @return
* @throws IOException
*/
@GetMapping
(
value
=
"/world"
)
@GetMapping
(
value
=
"/world"
)
@OperationLog
(
name
=
"helloWorld"
)
@OperationLog
(
name
=
"helloWorld"
)
@ApiOperation
(
value
=
"Hello World"
,
response
=
String
.
class
)
@ApiOperation
(
value
=
"Hello World"
,
response
=
String
.
class
)
...
@@ -34,4 +30,38 @@ public class MerchantHelloWorldController {
...
@@ -34,4 +30,38 @@ public class MerchantHelloWorldController {
return
ApiResult
.
ok
(
"Hello World app merchant"
);
return
ApiResult
.
ok
(
"Hello World app merchant"
);
}
}
@GetMapping
(
value
=
"/needRole"
)
@OperationLog
(
name
=
"needRole"
)
@ApiOperation
(
value
=
"needRole"
,
response
=
String
.
class
)
public
ApiResult
<
String
>
needRole
()
throws
IOException
{
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World app"
);
}
@GetMapping
(
value
=
"/needRoleAdmin"
)
@OperationLog
(
name
=
"needRoleAdmin"
)
@ApiOperation
(
value
=
"needRoleAdmin"
,
response
=
String
.
class
)
@RequiresPermissions
(
"mer:admin"
)
public
ApiResult
<
String
>
needRoleAdmin
()
throws
IOException
{
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World needRoleAdmin"
);
}
@GetMapping
(
value
=
"/needRoleAll"
)
@OperationLog
(
name
=
"needRoleAll"
)
@ApiOperation
(
value
=
"needRoleAll"
,
response
=
String
.
class
)
@RequiresRoles
(
"app:all"
)
public
ApiResult
<
String
>
needRoleAll
()
throws
IOException
{
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World needRoleAll"
);
}
@GetMapping
(
value
=
"/noRole"
)
@OperationLog
(
name
=
"noRole"
)
@ApiOperation
(
value
=
"noRole"
,
response
=
String
.
class
)
public
ApiResult
<
String
>
noRole
()
throws
IOException
{
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World app noRole"
);
}
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantPermissionController.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.common.entity.MerchantPermission
;
import
com.jumeirah.common.param.MerchantPermissionPageParam
;
import
com.jumeirah.common.service.MerchantPermissionService
;
import
com.jumeirah.common.vo.MerchantPermissionQueryVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Add
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 商家权限 控制器
*
* @author wei
* @since 2020-09-27
*/
@Slf4j
@RestController
@RequestMapping
(
"/merchantPermission"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家权限API"
,
tags
=
{
"商家权限"
})
public
class
MerchantPermissionController
extends
BaseController
{
@Autowired
private
MerchantPermissionService
merchantPermissionService
;
/**
* 添加商家权限
*/
@PostMapping
(
"/add"
)
@OperationLog
(
name
=
"添加商家权限"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"添加商家权限"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
addMerchantPermission
(
@Validated
(
Add
.
class
)
@RequestBody
MerchantPermission
merchantPermission
)
throws
Exception
{
boolean
flag
=
merchantPermissionService
.
saveMerchantPermission
(
merchantPermission
);
return
ApiResult
.
result
(
flag
);
}
/**
* 修改商家权限
*/
@PostMapping
(
"/update"
)
@OperationLog
(
name
=
"修改商家权限"
,
type
=
OperationLogType
.
UPDATE
)
@ApiOperation
(
value
=
"修改商家权限"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
updateMerchantPermission
(
@Validated
(
Update
.
class
)
@RequestBody
MerchantPermission
merchantPermission
)
throws
Exception
{
boolean
flag
=
merchantPermissionService
.
updateMerchantPermission
(
merchantPermission
);
return
ApiResult
.
result
(
flag
);
}
/**
* 删除商家权限
*/
@PostMapping
(
"/delete/{id}"
)
@OperationLog
(
name
=
"删除商家权限"
,
type
=
OperationLogType
.
DELETE
)
@ApiOperation
(
value
=
"删除商家权限"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
deleteMerchantPermission
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
boolean
flag
=
merchantPermissionService
.
deleteMerchantPermission
(
id
);
return
ApiResult
.
result
(
flag
);
}
/**
* 获取商家权限详情
*/
@GetMapping
(
"/info/{id}"
)
@OperationLog
(
name
=
"商家权限详情"
,
type
=
OperationLogType
.
INFO
)
@ApiOperation
(
value
=
"商家权限详情"
,
response
=
MerchantPermissionQueryVo
.
class
)
public
ApiResult
<
MerchantPermissionQueryVo
>
getMerchantPermission
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
MerchantPermissionQueryVo
merchantPermissionQueryVo
=
merchantPermissionService
.
getMerchantPermissionById
(
id
);
return
ApiResult
.
ok
(
merchantPermissionQueryVo
);
}
/**
* 商家权限分页列表
*/
@PostMapping
(
"/getPageList"
)
@OperationLog
(
name
=
"商家权限分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"商家权限分页列表"
,
response
=
MerchantPermissionQueryVo
.
class
)
public
ApiResult
<
Paging
<
MerchantPermissionQueryVo
>>
getMerchantPermissionPageList
(
@Validated
@RequestBody
MerchantPermissionPageParam
merchantPermissionPageParam
)
throws
Exception
{
Paging
<
MerchantPermissionQueryVo
>
paging
=
merchantPermissionService
.
getMerchantPermissionPageList
(
merchantPermissionPageParam
);
return
ApiResult
.
ok
(
paging
);
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRegisterController.java
View file @
57fea55b
...
@@ -52,7 +52,6 @@ public class MerchantRegisterController {
...
@@ -52,7 +52,6 @@ public class MerchantRegisterController {
@Autowired
@Autowired
private
SysRegisterService
registerService
;
private
SysRegisterService
registerService
;
@PostMapping
(
"/register"
)
@PostMapping
(
"/register"
)
@OperationLogIgnore
@OperationLogIgnore
@ApiOperation
(
value
=
"注册"
,
notes
=
"商户注册"
,
response
=
LoginSysUserTokenVo
.
class
)
@ApiOperation
(
value
=
"注册"
,
notes
=
"商户注册"
,
response
=
LoginSysUserTokenVo
.
class
)
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRoleController.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.common.entity.MerchantRole
;
import
com.jumeirah.common.param.MerchantRolePageParam
;
import
com.jumeirah.common.service.MerchantRoleService
;
import
com.jumeirah.common.vo.MerchantRoleQueryVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Add
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 商家角色 控制器
*
* @author wei
* @since 2020-09-27
*/
@Slf4j
@RestController
@RequestMapping
(
"/merchantRole"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家角色API"
,
tags
=
{
"商家角色"
})
public
class
MerchantRoleController
extends
BaseController
{
@Autowired
private
MerchantRoleService
merchantRoleService
;
/**
* 添加商家角色
*/
@PostMapping
(
"/add"
)
@OperationLog
(
name
=
"添加商家角色"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"添加商家角色"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
addMerchantRole
(
@Validated
(
Add
.
class
)
@RequestBody
MerchantRole
merchantRole
)
throws
Exception
{
boolean
flag
=
merchantRoleService
.
saveMerchantRole
(
merchantRole
);
return
ApiResult
.
result
(
flag
);
}
/**
* 修改商家角色
*/
@PostMapping
(
"/update"
)
@OperationLog
(
name
=
"修改商家角色"
,
type
=
OperationLogType
.
UPDATE
)
@ApiOperation
(
value
=
"修改商家角色"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
updateMerchantRole
(
@Validated
(
Update
.
class
)
@RequestBody
MerchantRole
merchantRole
)
throws
Exception
{
boolean
flag
=
merchantRoleService
.
updateMerchantRole
(
merchantRole
);
return
ApiResult
.
result
(
flag
);
}
/**
* 删除商家角色
*/
@PostMapping
(
"/delete/{id}"
)
@OperationLog
(
name
=
"删除商家角色"
,
type
=
OperationLogType
.
DELETE
)
@ApiOperation
(
value
=
"删除商家角色"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
deleteMerchantRole
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
boolean
flag
=
merchantRoleService
.
deleteMerchantRole
(
id
);
return
ApiResult
.
result
(
flag
);
}
/**
* 获取商家角色详情
*/
@GetMapping
(
"/info/{id}"
)
@OperationLog
(
name
=
"商家角色详情"
,
type
=
OperationLogType
.
INFO
)
@ApiOperation
(
value
=
"商家角色详情"
,
response
=
MerchantRoleQueryVo
.
class
)
public
ApiResult
<
MerchantRoleQueryVo
>
getMerchantRole
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
MerchantRoleQueryVo
merchantRoleQueryVo
=
merchantRoleService
.
getMerchantRoleById
(
id
);
return
ApiResult
.
ok
(
merchantRoleQueryVo
);
}
/**
* 商家角色分页列表
*/
@PostMapping
(
"/getPageList"
)
@OperationLog
(
name
=
"商家角色分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"商家角色分页列表"
,
response
=
MerchantRoleQueryVo
.
class
)
public
ApiResult
<
Paging
<
MerchantRoleQueryVo
>>
getMerchantRolePageList
(
@Validated
@RequestBody
MerchantRolePageParam
merchantRolePageParam
)
throws
Exception
{
Paging
<
MerchantRoleQueryVo
>
paging
=
merchantRoleService
.
getMerchantRolePageList
(
merchantRolePageParam
);
return
ApiResult
.
ok
(
paging
);
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRolePermissionController.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.common.entity.MerchantRolePermission
;
import
com.jumeirah.common.param.MerchantRolePermissionPageParam
;
import
com.jumeirah.common.service.MerchantRolePermissionService
;
import
com.jumeirah.common.vo.MerchantRolePermissionQueryVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Add
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 商家角色权限关系 控制器
*
* @author wei
* @since 2020-09-27
*/
@Slf4j
@RestController
@RequestMapping
(
"/merchantRolePermission"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家角色权限关系API"
,
tags
=
{
"商家角色权限关系"
})
public
class
MerchantRolePermissionController
extends
BaseController
{
@Autowired
private
MerchantRolePermissionService
merchantRolePermissionService
;
/**
* 添加商家角色权限关系
*/
@PostMapping
(
"/add"
)
@OperationLog
(
name
=
"添加商家角色权限关系"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"添加商家角色权限关系"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
addMerchantRolePermission
(
@Validated
(
Add
.
class
)
@RequestBody
MerchantRolePermission
merchantRolePermission
)
throws
Exception
{
boolean
flag
=
merchantRolePermissionService
.
saveMerchantRolePermission
(
merchantRolePermission
);
return
ApiResult
.
result
(
flag
);
}
/**
* 修改商家角色权限关系
*/
@PostMapping
(
"/update"
)
@OperationLog
(
name
=
"修改商家角色权限关系"
,
type
=
OperationLogType
.
UPDATE
)
@ApiOperation
(
value
=
"修改商家角色权限关系"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
updateMerchantRolePermission
(
@Validated
(
Update
.
class
)
@RequestBody
MerchantRolePermission
merchantRolePermission
)
throws
Exception
{
boolean
flag
=
merchantRolePermissionService
.
updateMerchantRolePermission
(
merchantRolePermission
);
return
ApiResult
.
result
(
flag
);
}
/**
* 删除商家角色权限关系
*/
@PostMapping
(
"/delete/{id}"
)
@OperationLog
(
name
=
"删除商家角色权限关系"
,
type
=
OperationLogType
.
DELETE
)
@ApiOperation
(
value
=
"删除商家角色权限关系"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
deleteMerchantRolePermission
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
boolean
flag
=
merchantRolePermissionService
.
deleteMerchantRolePermission
(
id
);
return
ApiResult
.
result
(
flag
);
}
/**
* 获取商家角色权限关系详情
*/
@GetMapping
(
"/info/{id}"
)
@OperationLog
(
name
=
"商家角色权限关系详情"
,
type
=
OperationLogType
.
INFO
)
@ApiOperation
(
value
=
"商家角色权限关系详情"
,
response
=
MerchantRolePermissionQueryVo
.
class
)
public
ApiResult
<
MerchantRolePermissionQueryVo
>
getMerchantRolePermission
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
MerchantRolePermissionQueryVo
merchantRolePermissionQueryVo
=
merchantRolePermissionService
.
getMerchantRolePermissionById
(
id
);
return
ApiResult
.
ok
(
merchantRolePermissionQueryVo
);
}
/**
* 商家角色权限关系分页列表
*/
@PostMapping
(
"/getPageList"
)
@OperationLog
(
name
=
"商家角色权限关系分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"商家角色权限关系分页列表"
,
response
=
MerchantRolePermissionQueryVo
.
class
)
public
ApiResult
<
Paging
<
MerchantRolePermissionQueryVo
>>
getMerchantRolePermissionPageList
(
@Validated
@RequestBody
MerchantRolePermissionPageParam
merchantRolePermissionPageParam
)
throws
Exception
{
Paging
<
MerchantRolePermissionQueryVo
>
paging
=
merchantRolePermissionService
.
getMerchantRolePermissionPageList
(
merchantRolePermissionPageParam
);
return
ApiResult
.
ok
(
paging
);
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantUserController.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.common.entity.MerchantUser
;
import
com.jumeirah.common.param.LoginParam
;
import
com.jumeirah.common.param.MerchantUserPageParam
;
import
com.jumeirah.common.service.MerchantUserService
;
import
com.jumeirah.common.vo.LoginSysUserTokenVo
;
import
com.jumeirah.common.vo.MerchantUserQueryVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Add
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 商家 控制器
*
* @author wei
* @since 2020-09-27
*/
@Slf4j
@RestController
@RequestMapping
(
"/merchantUser"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家API"
,
tags
=
{
"商家"
})
public
class
MerchantUserController
extends
BaseController
{
@Autowired
private
MerchantUserService
merchantUserService
;
/**
* 添加商家
*/
@PostMapping
(
"/add"
)
@OperationLog
(
name
=
"添加商家"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"添加商家"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
addMerchantUser
(
@Validated
(
Add
.
class
)
@RequestBody
MerchantUser
merchantUser
)
throws
Exception
{
boolean
flag
=
merchantUserService
.
saveMerchantUser
(
merchantUser
);
return
ApiResult
.
result
(
flag
);
}
/**
* 修改商家
*/
@PostMapping
(
"/update"
)
@OperationLog
(
name
=
"修改商家"
,
type
=
OperationLogType
.
UPDATE
)
@ApiOperation
(
value
=
"修改商家"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
updateMerchantUser
(
@Validated
(
Update
.
class
)
@RequestBody
MerchantUser
merchantUser
)
throws
Exception
{
boolean
flag
=
merchantUserService
.
updateMerchantUser
(
merchantUser
);
return
ApiResult
.
result
(
flag
);
}
/**
* 删除商家
*/
@PostMapping
(
"/delete/{id}"
)
@OperationLog
(
name
=
"删除商家"
,
type
=
OperationLogType
.
DELETE
)
@ApiOperation
(
value
=
"删除商家"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
deleteMerchantUser
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
boolean
flag
=
merchantUserService
.
deleteMerchantUser
(
id
);
return
ApiResult
.
result
(
flag
);
}
/**
* 获取商家详情
*/
@GetMapping
(
"/info/{id}"
)
@OperationLog
(
name
=
"商家详情"
,
type
=
OperationLogType
.
INFO
)
@ApiOperation
(
value
=
"商家详情"
,
response
=
MerchantUserQueryVo
.
class
)
public
ApiResult
<
MerchantUserQueryVo
>
getMerchantUser
(
@PathVariable
(
"id"
)
Long
id
)
throws
Exception
{
MerchantUserQueryVo
merchantUserQueryVo
=
merchantUserService
.
getMerchantUserById
(
id
);
return
ApiResult
.
ok
(
merchantUserQueryVo
);
}
/**
* 商家分页列表
*/
@PostMapping
(
"/getPageList"
)
@OperationLog
(
name
=
"商家分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"商家分页列表"
,
response
=
MerchantUserQueryVo
.
class
)
public
ApiResult
<
Paging
<
MerchantUserQueryVo
>>
getMerchantUserPageList
(
@Validated
@RequestBody
MerchantUserPageParam
merchantUserPageParam
)
throws
Exception
{
Paging
<
MerchantUserQueryVo
>
paging
=
merchantUserService
.
getMerchantUserPageList
(
merchantUserPageParam
);
return
ApiResult
.
ok
(
paging
);
}
@PostMapping
(
"/login"
)
@OperationLogIgnore
@ApiOperation
(
value
=
"登录"
,
notes
=
"商家登录"
,
response
=
LoginSysUserTokenVo
.
class
)
public
ApiResult
<
LoginSysUserTokenVo
>
login
(
@Validated
@RequestBody
LoginParam
loginParam
,
HttpServletResponse
response
,
@RequestHeader
(
required
=
false
)
String
language
)
throws
Exception
{
return
merchantUserService
.
login
(
loginParam
,
response
,
language
);
}
}
common/src/main/java/com/jumeirah/common/convert/SysUserConvert.java
View file @
57fea55b
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
jumeirah
.
common
.
convert
;
package
com
.
jumeirah
.
common
.
convert
;
import
com.jumeirah.common.entity.MerchantUser
;
import
com.jumeirah.common.entity.SysUser
;
import
com.jumeirah.common.entity.SysUser
;
import
io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo
;
import
io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
...
@@ -40,4 +41,7 @@ public interface SysUserConvert {
...
@@ -40,4 +41,7 @@ public interface SysUserConvert {
*/
*/
LoginSysUserVo
sysUserToLoginSysUserVo
(
SysUser
sysUser
);
LoginSysUserVo
sysUserToLoginSysUserVo
(
SysUser
sysUser
);
LoginSysUserVo
merchantUserToLoginSysUserVo
(
MerchantUser
sysUser
);
}
}
common/src/main/java/com/jumeirah/common/entity/MerchantPermission.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
entity
;
import
io.geekidea.springbootplus.framework.common.entity.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotation.Version
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
/**
* 商家权限
*
* @author wei
* @since 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"MerchantPermission对象"
)
public
class
MerchantPermission
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@NotNull
(
message
=
"id不能为空"
,
groups
=
{
Update
.
class
})
@ApiModelProperty
(
"主键"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
@ApiModelProperty
(
"权限名称"
)
private
String
name
;
@ApiModelProperty
(
"父id"
)
private
Long
parentId
;
@ApiModelProperty
(
"路径"
)
private
String
url
;
@NotBlank
(
message
=
"唯一编码不能为空"
)
@ApiModelProperty
(
"唯一编码"
)
private
String
code
;
@ApiModelProperty
(
"图标"
)
private
String
icon
;
@NotNull
(
message
=
"类型,1:菜单,2:按钮不能为空"
)
@ApiModelProperty
(
"类型,1:菜单,2:按钮"
)
private
Integer
type
;
@NotNull
(
message
=
"层级,1:第一级,2:第二级,N:第N级不能为空"
)
@ApiModelProperty
(
"层级,1:第一级,2:第二级,N:第N级"
)
private
Integer
level
;
@ApiModelProperty
(
"状态,0:禁用,1:启用"
)
private
Integer
state
;
@ApiModelProperty
(
"排序"
)
private
Integer
sort
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"版本"
)
@Version
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
common/src/main/java/com/jumeirah/common/entity/MerchantRole.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
entity
;
import
io.geekidea.springbootplus.framework.common.entity.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotation.Version
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
/**
* 商家角色
*
* @author wei
* @since 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"MerchantRole对象"
)
public
class
MerchantRole
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@NotNull
(
message
=
"id不能为空"
,
groups
=
{
Update
.
class
})
@ApiModelProperty
(
"主键"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
@NotBlank
(
message
=
"角色名称不能为空"
)
@ApiModelProperty
(
"角色名称"
)
private
String
name
;
@ApiModelProperty
(
"角色唯一编码"
)
private
String
code
;
@ApiModelProperty
(
"角色类型"
)
private
Integer
type
;
@ApiModelProperty
(
"角色状态,0:禁用,1:启用"
)
private
Integer
state
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"版本"
)
@Version
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
common/src/main/java/com/jumeirah/common/entity/MerchantRolePermission.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
entity
;
import
io.geekidea.springbootplus.framework.common.entity.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotation.Version
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
/**
* 商家角色权限关系
*
* @author wei
* @since 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"MerchantRolePermission对象"
)
public
class
MerchantRolePermission
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@NotNull
(
message
=
"id不能为空"
,
groups
=
{
Update
.
class
})
@ApiModelProperty
(
"主键"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
@NotNull
(
message
=
"角色id不能为空"
)
@ApiModelProperty
(
"角色id"
)
private
Long
roleId
;
@NotNull
(
message
=
"权限id不能为空"
)
@ApiModelProperty
(
"权限id"
)
private
Long
permissionId
;
@ApiModelProperty
(
"状态,0:禁用,1:启用"
)
private
Integer
state
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"版本"
)
@Version
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
common/src/main/java/com/jumeirah/common/entity/MerchantUser.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
entity
;
import
io.geekidea.springbootplus.framework.common.entity.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotation.Version
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Update
;
/**
* 商家
*
* @author wei
* @since 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"MerchantUser对象"
)
public
class
MerchantUser
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@NotNull
(
message
=
"id不能为空"
,
groups
=
{
Update
.
class
})
@ApiModelProperty
(
"主键"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
@ApiModelProperty
(
"用户名"
)
private
String
username
;
@ApiModelProperty
(
"昵称"
)
private
String
nickname
;
@NotBlank
(
message
=
"密码不能为空"
)
@ApiModelProperty
(
"密码"
)
private
String
password
;
@ApiModelProperty
(
"盐值"
)
private
String
salt
;
@ApiModelProperty
(
"手机号码"
)
private
String
phone
;
@ApiModelProperty
(
"手机区号"
)
private
String
phoneArea
;
@ApiModelProperty
(
"性别,0:女,1:男,默认1"
)
private
Integer
gender
;
@ApiModelProperty
(
"头像"
)
private
String
head
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"状态,0:禁用,1:启用,2:锁定"
)
private
Integer
state
;
@ApiModelProperty
(
"部门id"
)
private
Long
departmentId
;
@ApiModelProperty
(
"角色id"
)
private
Long
roleId
;
@ApiModelProperty
(
"逻辑删除,0:未删除,1:已删除"
)
@TableLogic
private
Integer
deleted
;
@ApiModelProperty
(
"版本"
)
@Version
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
common/src/main/java/com/jumeirah/common/mapper/MerchantPermissionMapper.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.jumeirah.common.entity.MerchantPermission
;
import
com.jumeirah.common.param.MerchantPermissionPageParam
;
import
com.jumeirah.common.vo.MerchantPermissionQueryVo
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
java.io.Serializable
;
/**
* 商家权限 Mapper 接口
*
* @author wei
* @since 2020-09-28
*/
@Repository
public
interface
MerchantPermissionMapper
extends
BaseMapper
<
MerchantPermission
>
{
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
MerchantPermissionQueryVo
getMerchantPermissionById
(
Serializable
id
);
/**
* 获取分页对象
*
* @param page
* @param merchantPermissionPageParam
* @return
*/
IPage
<
MerchantPermissionQueryVo
>
getMerchantPermissionPageList
(
@Param
(
"page"
)
Page
page
,
@Param
(
"param"
)
MerchantPermissionPageParam
merchantPermissionPageParam
);
}
common/src/main/java/com/jumeirah/common/mapper/MerchantRoleMapper.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.jumeirah.common.entity.MerchantRole
;
import
com.jumeirah.common.param.MerchantRolePageParam
;
import
com.jumeirah.common.vo.MerchantRoleQueryVo
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
java.io.Serializable
;
/**
* 商家角色 Mapper 接口
*
* @author wei
* @since 2020-09-28
*/
@Repository
public
interface
MerchantRoleMapper
extends
BaseMapper
<
MerchantRole
>
{
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
MerchantRoleQueryVo
getMerchantRoleById
(
Serializable
id
);
/**
* 获取分页对象
*
* @param page
* @param merchantRolePageParam
* @return
*/
IPage
<
MerchantRoleQueryVo
>
getMerchantRolePageList
(
@Param
(
"page"
)
Page
page
,
@Param
(
"param"
)
MerchantRolePageParam
merchantRolePageParam
);
}
common/src/main/java/com/jumeirah/common/mapper/MerchantRolePermissionMapper.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jumeirah.common.entity.MerchantRolePermission
;
import
com.jumeirah.common.param.MerchantRolePermissionPageParam
;
import
com.jumeirah.common.vo.MerchantRolePermissionQueryVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.io.Serializable
;
import
java.util.Set
;
/**
* 商家角色权限关系 Mapper 接口
*
* @author wei
* @since 2020-09-28
*/
@Repository
public
interface
MerchantRolePermissionMapper
extends
BaseMapper
<
MerchantRolePermission
>
{
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
MerchantRolePermissionQueryVo
getMerchantRolePermissionById
(
Serializable
id
);
/**
* 根据角色id获取可用的权限编码
*
* @param roleId
* @return
*/
Set
<
String
>
getPermissionCodesByRoleId
(
@Param
(
"roleId"
)
Long
roleId
);
/**
* 获取分页对象
*
* @param page
* @param merchantRolePermissionPageParam
* @return
*/
IPage
<
MerchantRolePermissionQueryVo
>
getMerchantRolePermissionPageList
(
@Param
(
"page"
)
Page
page
,
@Param
(
"param"
)
MerchantRolePermissionPageParam
merchantRolePermissionPageParam
);
}
common/src/main/java/com/jumeirah/common/mapper/MerchantUserMapper.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.jumeirah.common.entity.MerchantUser
;
import
com.jumeirah.common.param.MerchantUserPageParam
;
import
com.jumeirah.common.vo.MerchantUserQueryVo
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
java.io.Serializable
;
/**
* 商家 Mapper 接口
*
* @author wei
* @since 2020-09-28
*/
@Repository
public
interface
MerchantUserMapper
extends
BaseMapper
<
MerchantUser
>
{
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
MerchantUserQueryVo
getMerchantUserById
(
Serializable
id
);
/**
* 获取分页对象
*
* @param page
* @param merchantUserPageParam
* @return
*/
IPage
<
MerchantUserQueryVo
>
getMerchantUserPageList
(
@Param
(
"page"
)
Page
page
,
@Param
(
"param"
)
MerchantUserPageParam
merchantUserPageParam
);
}
common/src/main/java/com/jumeirah/common/param/MerchantPermissionPageParam.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
param
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam
;
/**
* <pre>
* 商家权限 分页参数对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"商家权限分页参数"
)
public
class
MerchantPermissionPageParam
extends
BasePageOrderParam
{
private
static
final
long
serialVersionUID
=
1L
;
}
common/src/main/java/com/jumeirah/common/param/MerchantRolePageParam.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
param
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam
;
/**
* <pre>
* 商家角色 分页参数对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"商家角色分页参数"
)
public
class
MerchantRolePageParam
extends
BasePageOrderParam
{
private
static
final
long
serialVersionUID
=
1L
;
}
common/src/main/java/com/jumeirah/common/param/MerchantRolePermissionPageParam.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
param
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam
;
/**
* <pre>
* 商家角色权限关系 分页参数对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"商家角色权限关系分页参数"
)
public
class
MerchantRolePermissionPageParam
extends
BasePageOrderParam
{
private
static
final
long
serialVersionUID
=
1L
;
}
common/src/main/java/com/jumeirah/common/param/MerchantUserPageParam.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
param
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam
;
/**
* <pre>
* 商家 分页参数对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"商家分页参数"
)
public
class
MerchantUserPageParam
extends
BasePageOrderParam
{
private
static
final
long
serialVersionUID
=
1L
;
}
common/src/main/java/com/jumeirah/common/service/MerchantPermissionService.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
;
import
com.jumeirah.common.entity.MerchantPermission
;
import
com.jumeirah.common.param.MerchantPermissionPageParam
;
import
io.geekidea.springbootplus.framework.common.service.BaseService
;
import
com.jumeirah.common.vo.MerchantPermissionQueryVo
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
/**
* 商家权限 服务类
*
* @author wei
* @since 2020-09-28
*/
public
interface
MerchantPermissionService
extends
BaseService
<
MerchantPermission
>
{
/**
* 保存
*
* @param merchantPermission
* @return
* @throws Exception
*/
boolean
saveMerchantPermission
(
MerchantPermission
merchantPermission
)
throws
Exception
;
/**
* 修改
*
* @param merchantPermission
* @return
* @throws Exception
*/
boolean
updateMerchantPermission
(
MerchantPermission
merchantPermission
)
throws
Exception
;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean
deleteMerchantPermission
(
Long
id
)
throws
Exception
;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
MerchantPermissionQueryVo
getMerchantPermissionById
(
Long
id
)
throws
Exception
;
/**
* 获取分页对象
*
* @param merchantPermissionPageParam
* @return
* @throws Exception
*/
Paging
<
MerchantPermissionQueryVo
>
getMerchantPermissionPageList
(
MerchantPermissionPageParam
merchantPermissionPageParam
)
throws
Exception
;
}
common/src/main/java/com/jumeirah/common/service/MerchantRolePermissionService.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
;
import
com.jumeirah.common.entity.MerchantRolePermission
;
import
com.jumeirah.common.param.MerchantRolePermissionPageParam
;
import
com.jumeirah.common.vo.MerchantRolePermissionQueryVo
;
import
io.geekidea.springbootplus.framework.common.service.BaseService
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
java.util.Set
;
/**
* 商家角色权限关系 服务类
*
* @author wei
* @since 2020-09-28
*/
public
interface
MerchantRolePermissionService
extends
BaseService
<
MerchantRolePermission
>
{
/**
* 保存
*
* @param merchantRolePermission
* @return
* @throws Exception
*/
boolean
saveMerchantRolePermission
(
MerchantRolePermission
merchantRolePermission
)
throws
Exception
;
/**
* 修改
*
* @param merchantRolePermission
* @return
* @throws Exception
*/
boolean
updateMerchantRolePermission
(
MerchantRolePermission
merchantRolePermission
)
throws
Exception
;
/**
* 根据角色id获取可用的权限编码
*
* @param roleId
* @return
* @throws Exception
*/
Set
<
String
>
getPermissionCodesByRoleId
(
Long
roleId
)
throws
Exception
;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean
deleteMerchantRolePermission
(
Long
id
)
throws
Exception
;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
MerchantRolePermissionQueryVo
getMerchantRolePermissionById
(
Long
id
)
throws
Exception
;
/**
* 获取分页对象
*
* @param merchantRolePermissionPageParam
* @return
* @throws Exception
*/
Paging
<
MerchantRolePermissionQueryVo
>
getMerchantRolePermissionPageList
(
MerchantRolePermissionPageParam
merchantRolePermissionPageParam
)
throws
Exception
;
}
common/src/main/java/com/jumeirah/common/service/MerchantRoleService.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
;
import
com.jumeirah.common.entity.MerchantRole
;
import
com.jumeirah.common.param.MerchantRolePageParam
;
import
io.geekidea.springbootplus.framework.common.service.BaseService
;
import
com.jumeirah.common.vo.MerchantRoleQueryVo
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
/**
* 商家角色 服务类
*
* @author wei
* @since 2020-09-28
*/
public
interface
MerchantRoleService
extends
BaseService
<
MerchantRole
>
{
/**
* 保存
*
* @param merchantRole
* @return
* @throws Exception
*/
boolean
saveMerchantRole
(
MerchantRole
merchantRole
)
throws
Exception
;
/**
* 修改
*
* @param merchantRole
* @return
* @throws Exception
*/
boolean
updateMerchantRole
(
MerchantRole
merchantRole
)
throws
Exception
;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean
deleteMerchantRole
(
Long
id
)
throws
Exception
;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
MerchantRoleQueryVo
getMerchantRoleById
(
Long
id
)
throws
Exception
;
/**
* 获取分页对象
*
* @param merchantRolePageParam
* @return
* @throws Exception
*/
Paging
<
MerchantRoleQueryVo
>
getMerchantRolePageList
(
MerchantRolePageParam
merchantRolePageParam
)
throws
Exception
;
}
common/src/main/java/com/jumeirah/common/service/MerchantUserService.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
;
import
com.jumeirah.common.entity.MerchantUser
;
import
com.jumeirah.common.param.LoginParam
;
import
com.jumeirah.common.param.MerchantUserPageParam
;
import
com.jumeirah.common.vo.LoginSysUserTokenVo
;
import
com.jumeirah.common.vo.MerchantUserQueryVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.service.BaseService
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 商家 服务类
*
* @author wei
* @since 2020-09-28
*/
public
interface
MerchantUserService
extends
BaseService
<
MerchantUser
>
{
/**
* 保存
*
* @param merchantUser
* @return
* @throws Exception
*/
boolean
saveMerchantUser
(
MerchantUser
merchantUser
)
throws
Exception
;
/**
* 登录
*
* @param loginParam
* @return
* @throws Exception
*/
ApiResult
<
LoginSysUserTokenVo
>
login
(
LoginParam
loginParam
,
HttpServletResponse
response
,
String
language
)
throws
Exception
;
/**
* 修改
*
* @param merchantUser
* @return
* @throws Exception
*/
boolean
updateMerchantUser
(
MerchantUser
merchantUser
)
throws
Exception
;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean
deleteMerchantUser
(
Long
id
)
throws
Exception
;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
MerchantUserQueryVo
getMerchantUserById
(
Long
id
)
throws
Exception
;
/**
* 获取分页对象
*
* @param merchantUserPageParam
* @return
* @throws Exception
*/
Paging
<
MerchantUserQueryVo
>
getMerchantUserPageList
(
MerchantUserPageParam
merchantUserPageParam
)
throws
Exception
;
}
common/src/main/java/com/jumeirah/common/service/impl/MerchantPermissionServiceImpl.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
.
impl
;
import
com.jumeirah.common.entity.MerchantPermission
;
import
com.jumeirah.common.mapper.MerchantPermissionMapper
;
import
com.jumeirah.common.service.MerchantPermissionService
;
import
com.jumeirah.common.param.MerchantPermissionPageParam
;
import
com.jumeirah.common.vo.MerchantPermissionQueryVo
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.pagination.PageInfo
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.springframework.transaction.annotation.Transactional
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
* 商家权限 服务实现类
*
* @author wei
* @since 2020-09-28
*/
@Slf4j
@Service
public
class
MerchantPermissionServiceImpl
extends
BaseServiceImpl
<
MerchantPermissionMapper
,
MerchantPermission
>
implements
MerchantPermissionService
{
@Autowired
private
MerchantPermissionMapper
merchantPermissionMapper
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
saveMerchantPermission
(
MerchantPermission
merchantPermission
)
throws
Exception
{
return
super
.
save
(
merchantPermission
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
updateMerchantPermission
(
MerchantPermission
merchantPermission
)
throws
Exception
{
return
super
.
updateById
(
merchantPermission
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
deleteMerchantPermission
(
Long
id
)
throws
Exception
{
return
super
.
removeById
(
id
);
}
@Override
public
MerchantPermissionQueryVo
getMerchantPermissionById
(
Long
id
)
throws
Exception
{
return
merchantPermissionMapper
.
getMerchantPermissionById
(
id
);
}
@Override
public
Paging
<
MerchantPermissionQueryVo
>
getMerchantPermissionPageList
(
MerchantPermissionPageParam
merchantPermissionPageParam
)
throws
Exception
{
Page
<
MerchantPermissionQueryVo
>
page
=
new
PageInfo
<>(
merchantPermissionPageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
MerchantPermission:
:
getCreateTime
)));
IPage
<
MerchantPermissionQueryVo
>
iPage
=
merchantPermissionMapper
.
getMerchantPermissionPageList
(
page
,
merchantPermissionPageParam
);
return
new
Paging
<
MerchantPermissionQueryVo
>(
iPage
);
}
}
common/src/main/java/com/jumeirah/common/service/impl/MerchantRolePermissionServiceImpl.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jumeirah.common.entity.MerchantRolePermission
;
import
com.jumeirah.common.mapper.MerchantRolePermissionMapper
;
import
com.jumeirah.common.param.MerchantRolePermissionPageParam
;
import
com.jumeirah.common.service.MerchantRolePermissionService
;
import
com.jumeirah.common.vo.MerchantRolePermissionQueryVo
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
io.geekidea.springbootplus.framework.core.pagination.PageInfo
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Set
;
/**
* 商家角色权限关系 服务实现类
*
* @author wei
* @since 2020-09-28
*/
@Slf4j
@Service
public
class
MerchantRolePermissionServiceImpl
extends
BaseServiceImpl
<
MerchantRolePermissionMapper
,
MerchantRolePermission
>
implements
MerchantRolePermissionService
{
@Autowired
private
MerchantRolePermissionMapper
merchantRolePermissionMapper
;
@Override
public
Set
<
String
>
getPermissionCodesByRoleId
(
Long
roleId
)
throws
Exception
{
return
merchantRolePermissionMapper
.
getPermissionCodesByRoleId
(
roleId
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
saveMerchantRolePermission
(
MerchantRolePermission
merchantRolePermission
)
throws
Exception
{
return
super
.
save
(
merchantRolePermission
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
updateMerchantRolePermission
(
MerchantRolePermission
merchantRolePermission
)
throws
Exception
{
return
super
.
updateById
(
merchantRolePermission
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
deleteMerchantRolePermission
(
Long
id
)
throws
Exception
{
return
super
.
removeById
(
id
);
}
@Override
public
MerchantRolePermissionQueryVo
getMerchantRolePermissionById
(
Long
id
)
throws
Exception
{
return
merchantRolePermissionMapper
.
getMerchantRolePermissionById
(
id
);
}
@Override
public
Paging
<
MerchantRolePermissionQueryVo
>
getMerchantRolePermissionPageList
(
MerchantRolePermissionPageParam
merchantRolePermissionPageParam
)
throws
Exception
{
Page
<
MerchantRolePermissionQueryVo
>
page
=
new
PageInfo
<>(
merchantRolePermissionPageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
MerchantRolePermission:
:
getCreateTime
)));
IPage
<
MerchantRolePermissionQueryVo
>
iPage
=
merchantRolePermissionMapper
.
getMerchantRolePermissionPageList
(
page
,
merchantRolePermissionPageParam
);
return
new
Paging
<
MerchantRolePermissionQueryVo
>(
iPage
);
}
}
common/src/main/java/com/jumeirah/common/service/impl/MerchantRoleServiceImpl.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
.
impl
;
import
com.jumeirah.common.entity.MerchantRole
;
import
com.jumeirah.common.mapper.MerchantRoleMapper
;
import
com.jumeirah.common.service.MerchantRoleService
;
import
com.jumeirah.common.param.MerchantRolePageParam
;
import
com.jumeirah.common.vo.MerchantRoleQueryVo
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.pagination.PageInfo
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.springframework.transaction.annotation.Transactional
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
* 商家角色 服务实现类
*
* @author wei
* @since 2020-09-28
*/
@Slf4j
@Service
public
class
MerchantRoleServiceImpl
extends
BaseServiceImpl
<
MerchantRoleMapper
,
MerchantRole
>
implements
MerchantRoleService
{
@Autowired
private
MerchantRoleMapper
merchantRoleMapper
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
saveMerchantRole
(
MerchantRole
merchantRole
)
throws
Exception
{
return
super
.
save
(
merchantRole
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
updateMerchantRole
(
MerchantRole
merchantRole
)
throws
Exception
{
return
super
.
updateById
(
merchantRole
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
deleteMerchantRole
(
Long
id
)
throws
Exception
{
return
super
.
removeById
(
id
);
}
@Override
public
MerchantRoleQueryVo
getMerchantRoleById
(
Long
id
)
throws
Exception
{
return
merchantRoleMapper
.
getMerchantRoleById
(
id
);
}
@Override
public
Paging
<
MerchantRoleQueryVo
>
getMerchantRolePageList
(
MerchantRolePageParam
merchantRolePageParam
)
throws
Exception
{
Page
<
MerchantRoleQueryVo
>
page
=
new
PageInfo
<>(
merchantRolePageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
MerchantRole:
:
getCreateTime
)));
IPage
<
MerchantRoleQueryVo
>
iPage
=
merchantRoleMapper
.
getMerchantRolePageList
(
page
,
merchantRolePageParam
);
return
new
Paging
<
MerchantRoleQueryVo
>(
iPage
);
}
}
common/src/main/java/com/jumeirah/common/service/impl/MerchantUserServiceImpl.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jumeirah.common.convert.SysUserConvert
;
import
com.jumeirah.common.entity.MerchantRole
;
import
com.jumeirah.common.entity.MerchantUser
;
import
com.jumeirah.common.enums.StateEnum
;
import
com.jumeirah.common.mapper.MerchantUserMapper
;
import
com.jumeirah.common.param.LoginParam
;
import
com.jumeirah.common.param.MerchantUserPageParam
;
import
com.jumeirah.common.service.MerchantRolePermissionService
;
import
com.jumeirah.common.service.MerchantRoleService
;
import
com.jumeirah.common.service.MerchantUserService
;
import
com.jumeirah.common.vo.LoginSysUserTokenVo
;
import
com.jumeirah.common.vo.MerchantUserQueryVo
;
import
io.geekidea.springbootplus.config.properties.JwtProperties
;
import
io.geekidea.springbootplus.config.properties.SpringBootPlusProperties
;
import
io.geekidea.springbootplus.framework.common.api.ApiCode
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
io.geekidea.springbootplus.framework.core.pagination.PageInfo
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.shiro.cache.MerchantLoginRedisService
;
import
io.geekidea.springbootplus.framework.shiro.jwt.JwtToken
;
import
io.geekidea.springbootplus.framework.shiro.util.JwtTokenUtil
;
import
io.geekidea.springbootplus.framework.shiro.util.JwtUtil
;
import
io.geekidea.springbootplus.framework.shiro.util.SaltUtil
;
import
io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo
;
import
io.geekidea.springbootplus.framework.util.PasswordUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.apache.shiro.subject.Subject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletResponse
;
import
java.time.Duration
;
import
java.util.Set
;
/**
* 商家 服务实现类
*
* @author wei
* @since 2020-09-28
*/
@Slf4j
@Service
public
class
MerchantUserServiceImpl
extends
BaseServiceImpl
<
MerchantUserMapper
,
MerchantUser
>
implements
MerchantUserService
{
@Lazy
@Autowired
private
SpringBootPlusProperties
springBootPlusProperties
;
@Lazy
@Autowired
private
RedisTemplate
redisTemplate
;
@Lazy
@Autowired
private
MerchantLoginRedisService
merchantLoginRedisService
;
@Lazy
@Autowired
private
JwtProperties
jwtProperties
;
@Autowired
private
MerchantUserMapper
merchantUserMapper
;
@Autowired
private
MerchantRoleService
merchantRoleService
;
@Autowired
private
MerchantRolePermissionService
merchantRolePermissionService
;
public
MerchantUser
getSysUserByUsername
(
String
username
)
throws
Exception
{
MerchantUser
sysUser
=
new
MerchantUser
().
setUsername
(
username
);
return
merchantUserMapper
.
selectOne
(
new
QueryWrapper
<
MerchantUser
>(
sysUser
));
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ApiResult
<
LoginSysUserTokenVo
>
login
(
LoginParam
loginParam
,
HttpServletResponse
response
,
String
language
)
throws
Exception
{
// // 校验验证码
// checkVerifyCode(loginParam.getVerifyToken(), loginParam.getCode());
String
username
=
loginParam
.
getUsername
();
// 从数据库中获取登录用户信息
MerchantUser
merchantUser
=
getSysUserByUsername
(
username
);
if
(
merchantUser
==
null
)
{
log
.
error
(
"登录失败,loginParam:{}"
,
loginParam
);
// throw new AuthenticationException("用户名或密码错误");
return
ApiResult
.
fail
(
ApiCode
.
PWD_OR_USERNAME_ERROR
,
language
);
}
if
(
StateEnum
.
DISABLE
.
getCode
().
equals
(
merchantUser
.
getState
()))
{
throw
new
AuthenticationException
(
"账号已禁用"
);
}
// 实际项目中,前端传过来的密码应先加密
// 原始密码明文:123456
// 原始密码前端加密:sha256(123456)
// 后台加密规则:sha256(sha256(123456) + salt)
String
encryptPassword
=
PasswordUtil
.
encrypt
(
loginParam
.
getPassword
(),
merchantUser
.
getSalt
());
if
(!
encryptPassword
.
equals
(
merchantUser
.
getPassword
()))
{
return
ApiResult
.
fail
(
ApiCode
.
PWD_OR_USERNAME_ERROR
,
language
);
}
// 将系统用户对象转换成登录用户对象
LoginSysUserVo
loginSysUserVo
=
SysUserConvert
.
INSTANCE
.
merchantUserToLoginSysUserVo
(
merchantUser
);
// // 获取部门
// SysDepartment sysDepartment = sysDepartmentService.getById(merchantUser.getDepartmentId());
// if (sysDepartment == null) {
// throw new AuthenticationException("部门不存在");
// }
// if (!StateEnum.ENABLE.getCode().equals(sysDepartment.getState())) {
// throw new AuthenticationException("部门已禁用");
// }
// loginSysUserVo.setDepartmentId(sysDepartment.getId())
// .setDepartmentName(sysDepartment.getName());
// 获取当前用户角色
Long
roleId
=
merchantUser
.
getRoleId
();
MerchantRole
merchantRole
=
merchantRoleService
.
getById
(
roleId
);
if
(
merchantRole
==
null
)
{
throw
new
AuthenticationException
(
"角色不存在"
);
}
if
(
StateEnum
.
DISABLE
.
getCode
().
equals
(
merchantRole
.
getState
()))
{
throw
new
AuthenticationException
(
"角色已禁用"
);
}
loginSysUserVo
.
setRoleId
(
merchantRole
.
getId
())
.
setRoleName
(
merchantRole
.
getName
())
.
setRoleCode
(
merchantRole
.
getCode
());
// 获取当前用户权限
Set
<
String
>
permissionCodes
=
merchantRolePermissionService
.
getPermissionCodesByRoleId
(
roleId
);
// if (CollectionUtils.isEmpty(permissionCodes)) {
// throw new AuthenticationException("权限列表不能为空");
// }
loginSysUserVo
.
setPermissionCodes
(
permissionCodes
);
// 获取数据库中保存的盐值
String
newSalt
=
SaltUtil
.
getSalt
(
merchantUser
.
getSalt
(),
jwtProperties
);
// 生成token字符串并返回
Long
expireSecond
=
jwtProperties
.
getExpireSecond
();
String
token
=
JwtUtil
.
generateToken
(
username
,
newSalt
,
Duration
.
ofSeconds
(
expireSecond
));
log
.
debug
(
"token:{}"
,
token
);
// 创建AuthenticationToken
JwtToken
jwtToken
=
JwtToken
.
build
(
token
,
username
,
newSalt
,
expireSecond
,
"mer"
);
boolean
enableShiro
=
springBootPlusProperties
.
getShiro
().
isEnable
();
if
(
enableShiro
)
{
// 从SecurityUtils里边创建一个 subject
Subject
subject
=
SecurityUtils
.
getSubject
();
// 执行认证登录
subject
.
login
(
jwtToken
);
}
else
{
log
.
warn
(
"未启用Shiro"
);
}
// 缓存登录信息到Redis
merchantLoginRedisService
.
cacheLoginInfo
(
jwtToken
,
loginSysUserVo
);
log
.
debug
(
"登录成功,username:{}"
,
username
);
/* // 缓存登录信息到redis
String tokenSha256 = DigestUtils.sha256Hex(token);
redisTemplate.opsForValue().set(tokenSha256, loginSysUserVo, 1, TimeUnit.DAYS);*/
// 返回token和登录用户信息对象
LoginSysUserTokenVo
loginSysUserTokenVo
=
new
LoginSysUserTokenVo
();
loginSysUserTokenVo
.
setToken
(
token
);
loginSysUserTokenVo
.
setLoginSysUserVo
(
loginSysUserVo
);
// 设置token响应头
response
.
setHeader
(
JwtTokenUtil
.
getTokenName
(),
loginSysUserTokenVo
.
getToken
());
return
ApiResult
.
ok
(
loginSysUserTokenVo
,
language
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
saveMerchantUser
(
MerchantUser
merchantUser
)
throws
Exception
{
return
super
.
save
(
merchantUser
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
updateMerchantUser
(
MerchantUser
merchantUser
)
throws
Exception
{
return
super
.
updateById
(
merchantUser
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
deleteMerchantUser
(
Long
id
)
throws
Exception
{
return
super
.
removeById
(
id
);
}
@Override
public
MerchantUserQueryVo
getMerchantUserById
(
Long
id
)
throws
Exception
{
return
merchantUserMapper
.
getMerchantUserById
(
id
);
}
@Override
public
Paging
<
MerchantUserQueryVo
>
getMerchantUserPageList
(
MerchantUserPageParam
merchantUserPageParam
)
throws
Exception
{
Page
<
MerchantUserQueryVo
>
page
=
new
PageInfo
<>(
merchantUserPageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
MerchantUser:
:
getCreateTime
)));
IPage
<
MerchantUserQueryVo
>
iPage
=
merchantUserMapper
.
getMerchantUserPageList
(
page
,
merchantUserPageParam
);
return
new
Paging
<
MerchantUserQueryVo
>(
iPage
);
}
}
common/src/main/java/com/jumeirah/common/service/impl/SysLoginServiceImpl.java
View file @
57fea55b
...
@@ -44,7 +44,6 @@ import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo;
...
@@ -44,7 +44,6 @@ import io.geekidea.springbootplus.framework.shiro.vo.LoginSysUserVo;
import
io.geekidea.springbootplus.framework.util.PasswordUtil
;
import
io.geekidea.springbootplus.framework.util.PasswordUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.apache.shiro.authc.AuthenticationException
;
...
@@ -59,7 +58,6 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -59,7 +58,6 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* <p>
* <p>
...
@@ -194,9 +192,9 @@ public class SysLoginServiceImpl implements SysLoginService {
...
@@ -194,9 +192,9 @@ public class SysLoginServiceImpl implements SysLoginService {
loginRedisService
.
cacheLoginInfo
(
jwtToken
,
loginSysUserVo
);
loginRedisService
.
cacheLoginInfo
(
jwtToken
,
loginSysUserVo
);
log
.
debug
(
"登录成功,username:{}"
,
username
);
log
.
debug
(
"登录成功,username:{}"
,
username
);
// 缓存登录信息到redis
/*
// 缓存登录信息到redis
String tokenSha256 = DigestUtils.sha256Hex(token);
String tokenSha256 = DigestUtils.sha256Hex(token);
redisTemplate
.
opsForValue
().
set
(
tokenSha256
,
loginSysUserVo
,
1
,
TimeUnit
.
DAYS
);
redisTemplate.opsForValue().set(tokenSha256, loginSysUserVo, 1, TimeUnit.DAYS);
*/
// 返回token和登录用户信息对象
// 返回token和登录用户信息对象
LoginSysUserTokenVo
loginSysUserTokenVo
=
new
LoginSysUserTokenVo
();
LoginSysUserTokenVo
loginSysUserTokenVo
=
new
LoginSysUserTokenVo
();
...
...
common/src/main/java/com/jumeirah/common/vo/MerchantPermissionQueryVo.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <pre>
* 商家权限 查询结果对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"MerchantPermissionQueryVo对象"
)
public
class
MerchantPermissionQueryVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"权限名称"
)
private
String
name
;
@ApiModelProperty
(
"父id"
)
private
Long
parentId
;
@ApiModelProperty
(
"路径"
)
private
String
url
;
@ApiModelProperty
(
"唯一编码"
)
private
String
code
;
@ApiModelProperty
(
"图标"
)
private
String
icon
;
@ApiModelProperty
(
"类型,1:菜单,2:按钮"
)
private
Integer
type
;
@ApiModelProperty
(
"层级,1:第一级,2:第二级,N:第N级"
)
private
Integer
level
;
@ApiModelProperty
(
"状态,0:禁用,1:启用"
)
private
Integer
state
;
@ApiModelProperty
(
"排序"
)
private
Integer
sort
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"版本"
)
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
\ No newline at end of file
common/src/main/java/com/jumeirah/common/vo/MerchantRolePermissionQueryVo.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <pre>
* 商家角色权限关系 查询结果对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"MerchantRolePermissionQueryVo对象"
)
public
class
MerchantRolePermissionQueryVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"角色id"
)
private
Long
roleId
;
@ApiModelProperty
(
"权限id"
)
private
Long
permissionId
;
@ApiModelProperty
(
"状态,0:禁用,1:启用"
)
private
Integer
state
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"版本"
)
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
\ No newline at end of file
common/src/main/java/com/jumeirah/common/vo/MerchantRoleQueryVo.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <pre>
* 商家角色 查询结果对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"MerchantRoleQueryVo对象"
)
public
class
MerchantRoleQueryVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"角色名称"
)
private
String
name
;
@ApiModelProperty
(
"角色唯一编码"
)
private
String
code
;
@ApiModelProperty
(
"角色类型"
)
private
Integer
type
;
@ApiModelProperty
(
"角色状态,0:禁用,1:启用"
)
private
Integer
state
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"版本"
)
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
\ No newline at end of file
common/src/main/java/com/jumeirah/common/vo/MerchantUserQueryVo.java
0 → 100644
View file @
57fea55b
package
com
.
jumeirah
.
common
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <pre>
* 商家 查询结果对象
* </pre>
*
* @author wei
* @date 2020-09-28
*/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"MerchantUserQueryVo对象"
)
public
class
MerchantUserQueryVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"用户名"
)
private
String
username
;
@ApiModelProperty
(
"昵称"
)
private
String
nickname
;
@ApiModelProperty
(
"密码"
)
private
String
password
;
@ApiModelProperty
(
"盐值"
)
private
String
salt
;
@ApiModelProperty
(
"手机号码"
)
private
String
phone
;
@ApiModelProperty
(
"手机区号"
)
private
String
phoneArea
;
@ApiModelProperty
(
"性别,0:女,1:男,默认1"
)
private
Integer
gender
;
@ApiModelProperty
(
"头像"
)
private
String
head
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"状态,0:禁用,1:启用,2:锁定"
)
private
Integer
state
;
@ApiModelProperty
(
"部门id"
)
private
Long
departmentId
;
@ApiModelProperty
(
"角色id"
)
private
Long
roleId
;
@ApiModelProperty
(
"逻辑删除,0:未删除,1:已删除"
)
private
Integer
deleted
;
@ApiModelProperty
(
"版本"
)
private
Integer
version
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"修改时间"
)
private
Date
updateTime
;
}
\ No newline at end of file
common/src/main/resources/mapper/merchant/MerchantPermissionMapper.xml
0 → 100644
View file @
57fea55b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jumeirah.common.mapper.MerchantPermissionMapper"
>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, name, parent_id, url, code, icon, type, level, state, sort, remark, version, create_time, update_time
</sql>
<select
id=
"getMerchantPermissionById"
resultType=
"com.jumeirah.common.vo.MerchantPermissionQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_permission where id = #{id}
</select>
<select
id=
"getMerchantPermissionPageList"
parameterType=
"com.jumeirah.common.param.MerchantPermissionPageParam"
resultType=
"com.jumeirah.common.vo.MerchantPermissionQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_permission
</select>
</mapper>
common/src/main/resources/mapper/merchant/MerchantRoleMapper.xml
0 → 100644
View file @
57fea55b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jumeirah.common.mapper.MerchantRoleMapper"
>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, name, code, type, state, remark, version, create_time, update_time
</sql>
<select
id=
"getMerchantRoleById"
resultType=
"com.jumeirah.common.vo.MerchantRoleQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_role where id = #{id}
</select>
<select
id=
"getMerchantRolePageList"
parameterType=
"com.jumeirah.common.param.MerchantRolePageParam"
resultType=
"com.jumeirah.common.vo.MerchantRoleQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_role
</select>
</mapper>
common/src/main/resources/mapper/merchant/MerchantRolePermissionMapper.xml
0 → 100644
View file @
57fea55b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jumeirah.common.mapper.MerchantRolePermissionMapper"
>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, role_id, permission_id, state, remark, version, create_time, update_time
</sql>
<select
id=
"getMerchantRolePermissionById"
resultType=
"com.jumeirah.common.vo.MerchantRolePermissionQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_role_permission where id = #{id}
</select>
<select
id=
"getPermissionCodesByRoleId"
resultType=
"java.lang.String"
>
select p.code
from merchant_role r
inner join merchant_role_permission rp
on r.id = rp.role_id
inner join merchant_permission p
on rp.permission_id = p.id
where r.state = 1
and rp.state = 1
and p.state = 1
and r.id = #{roleId};
</select>
<select
id=
"getMerchantRolePermissionPageList"
parameterType=
"com.jumeirah.common.param.MerchantRolePermissionPageParam"
resultType=
"com.jumeirah.common.vo.MerchantRolePermissionQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_role_permission
</select>
</mapper>
common/src/main/resources/mapper/merchant/MerchantUserMapper.xml
0 → 100644
View file @
57fea55b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jumeirah.common.mapper.MerchantUserMapper"
>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, username, nickname, password, salt, phone, phone_area, gender, head, remark, state, department_id, role_id, deleted, version, create_time, update_time
</sql>
<select
id=
"getMerchantUserById"
resultType=
"com.jumeirah.common.vo.MerchantUserQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_user where id = #{id}
</select>
<select
id=
"getMerchantUserPageList"
parameterType=
"com.jumeirah.common.param.MerchantUserPageParam"
resultType=
"com.jumeirah.common.vo.MerchantUserQueryVo"
>
select
<include
refid=
"Base_Column_List"
/>
from merchant_user
</select>
</mapper>
config/src/main/resources/config/application.yml
View file @
57fea55b
...
@@ -183,7 +183,7 @@ spring-boot-plus:
...
@@ -183,7 +183,7 @@ spring-boot-plus:
# 权限配置
# 权限配置
anon
:
anon
:
# 排除登录 注册 登出
# 排除登录 注册 登出
-
/app/user/register,/app/user/phoneLogin,/app/user/login,/sys/login,/sys/logout,/sys/register
-
/app/user/register,/app/user/phoneLogin,/app/user/login,/sys/login,/sys/logout,/sys/register
,/merchantUser/login
# 排除静态资源
# 排除静态资源
-
/static/**,/templates/**
-
/static/**,/templates/**
# 排除Swagger
# 排除Swagger
...
@@ -214,8 +214,8 @@ spring-boot-plus:
...
@@ -214,8 +214,8 @@ spring-boot-plus:
issuer
:
${spring.application.name}
issuer
:
${spring.application.name}
# 观众
# 观众
audience
:
web
audience
:
web
# 默认过期时间
1小时
,单位:秒
# 默认过期时间
60天
,单位:秒
expire-second
:
36
000
expire-second
:
5184
000
# 是否刷新token
# 是否刷新token
refresh-token
:
true
refresh-token
:
true
# 刷新token的时间间隔,默认10分钟,单位:秒
# 刷新token的时间间隔,默认10分钟,单位:秒
...
@@ -223,7 +223,7 @@ spring-boot-plus:
...
@@ -223,7 +223,7 @@ spring-boot-plus:
# redis校验jwt token是否存在,可选
# redis校验jwt token是否存在,可选
redis-check
:
true
redis-check
:
true
# true: 同一个账号只能是最后一次登录token有效,false:同一个账号可多次登录
# true: 同一个账号只能是最后一次登录token有效,false:同一个账号可多次登录
single-login
:
fals
e
single-login
:
tru
e
# 盐值校验,如果不加自定义盐值,则使用secret校验
# 盐值校验,如果不加自定义盐值,则使用secret校验
salt-check
:
true
salt-check
:
true
############################ JWT end ###############################
############################ JWT end ###############################
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtFilter.java
View file @
57fea55b
...
@@ -65,6 +65,7 @@ public class JwtFilter extends AuthenticatingFilter {
...
@@ -65,6 +65,7 @@ public class JwtFilter extends AuthenticatingFilter {
/**
/**
* 将JWT Token包装成AuthenticationToken
* 将JWT Token包装成AuthenticationToken
* 从http请求头中取得token,并从redis中取出token相关信息
*
*
* @param servletRequest
* @param servletRequest
* @param servletResponse
* @param servletResponse
...
@@ -73,6 +74,7 @@ public class JwtFilter extends AuthenticatingFilter {
...
@@ -73,6 +74,7 @@ public class JwtFilter extends AuthenticatingFilter {
*/
*/
@Override
@Override
protected
AuthenticationToken
createToken
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
)
throws
Exception
{
protected
AuthenticationToken
createToken
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
)
throws
Exception
{
// 从http请求头中取得token
String
token
=
JwtTokenUtil
.
getToken
();
String
token
=
JwtTokenUtil
.
getToken
();
if
(
StringUtils
.
isBlank
(
token
))
{
if
(
StringUtils
.
isBlank
(
token
))
{
throw
new
AuthenticationException
(
"token不能为空"
);
throw
new
AuthenticationException
(
"token不能为空"
);
...
@@ -82,6 +84,7 @@ public class JwtFilter extends AuthenticatingFilter {
...
@@ -82,6 +84,7 @@ public class JwtFilter extends AuthenticatingFilter {
}
}
Object
jwtTokenRedisVo
=
null
;
Object
jwtTokenRedisVo
=
null
;
// 如果开启redis二次校验,或者设置为单个用户token登录,则先在redis中判断token是否存在
// 如果开启redis二次校验,或者设置为单个用户token登录,则先在redis中判断token是否存在
if
(
jwtProperties
.
isRedisCheck
()
||
jwtProperties
.
isSingleLogin
())
{
if
(
jwtProperties
.
isRedisCheck
()
||
jwtProperties
.
isSingleLogin
())
{
String
tokenMd5
=
DigestUtils
.
md5Hex
(
token
);
String
tokenMd5
=
DigestUtils
.
md5Hex
(
token
);
...
@@ -92,10 +95,8 @@ public class JwtFilter extends AuthenticatingFilter {
...
@@ -92,10 +95,8 @@ public class JwtFilter extends AuthenticatingFilter {
}
}
}
}
String
username
=
JwtUtil
.
getUsername
(
token
);
String
username
=
JwtUtil
.
getUsername
(
token
);
String
salt
;
String
salt
;
if
(
jwtProperties
.
isSaltCheck
())
{
if
(
jwtProperties
.
isSaltCheck
())
{
salt
=
sysLoginRedisService
.
getSalt
(
username
);
salt
=
sysLoginRedisService
.
getSalt
(
username
);
...
@@ -172,7 +173,7 @@ public class JwtFilter extends AuthenticatingFilter {
...
@@ -172,7 +173,7 @@ public class JwtFilter extends AuthenticatingFilter {
// 刷新token
// 刷新token
JwtToken
jwtToken
=
(
JwtToken
)
token
;
JwtToken
jwtToken
=
(
JwtToken
)
token
;
HttpServletResponse
httpServletResponse
=
WebUtils
.
toHttp
(
response
);
HttpServletResponse
httpServletResponse
=
WebUtils
.
toHttp
(
response
);
shiroLoginService
.
refreshToken
(
jwtToken
,
httpServletResponse
);
//
shiroLoginService.refreshToken(jwtToken, httpServletResponse);
return
true
;
return
true
;
}
}
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/realm/JwtRealmSystem.java
View file @
57fea55b
...
@@ -80,7 +80,7 @@ public class JwtRealmSystem extends AuthorizingRealm {
...
@@ -80,7 +80,7 @@ public class JwtRealmSystem extends AuthorizingRealm {
}
}
/**
/**
* 登录认证
* 登录认证
, 校验密码等, 这里项目使用了jwt , 所以验证JWT就行
*
*
* @param authenticationToken
* @param authenticationToken
* @return
* @return
...
...
generator/src/main/java/io/geekidea/springbootplus/generator/SpringBootPlusGenerator.java
View file @
57fea55b
...
@@ -40,6 +40,10 @@ public class SpringBootPlusGenerator {
...
@@ -40,6 +40,10 @@ public class SpringBootPlusGenerator {
* @param args
* @param args
*/
*/
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
getCode
(
"123"
);
}
private
static
void
getCode
(
String
tableName
)
{
GeneratorProperties
generatorProperties
=
new
GeneratorProperties
();
GeneratorProperties
generatorProperties
=
new
GeneratorProperties
();
// 设置基本信息
// 设置基本信息
...
@@ -51,7 +55,7 @@ public class SpringBootPlusGenerator {
...
@@ -51,7 +55,7 @@ public class SpringBootPlusGenerator {
.
setFileOverride
(
true
);
.
setFileOverride
(
true
);
// 设置表信息
// 设置表信息
generatorProperties
.
addTable
(
"app_user"
,
"id"
);
generatorProperties
.
addTable
(
tableName
,
"id"
);
// 设置表前缀
// 设置表前缀
// generatorProperties.setTablePrefix(Arrays.asList("tb_"));
// generatorProperties.setTablePrefix(Arrays.asList("tb_"));
...
@@ -100,7 +104,6 @@ public class SpringBootPlusGenerator {
...
@@ -100,7 +104,6 @@ public class SpringBootPlusGenerator {
// 生成代码
// 生成代码
CodeGenerator
codeGenerator
=
new
CodeGenerator
();
CodeGenerator
codeGenerator
=
new
CodeGenerator
();
codeGenerator
.
generator
(
generatorProperties
);
codeGenerator
.
generator
(
generatorProperties
);
}
}
...
...
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