Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SiEn
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
SiEn
Commits
892a540e
Commit
892a540e
authored
Oct 19, 2020
by
zhangjw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://119.28.51.83/hewei/Jumeirah
into Jw
parents
50a6a48d
a1573ab5
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
369 additions
and
199 deletions
+369
-199
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantHelloWorldController.java
+15
-3
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantPermissionController.java
+1
-1
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRegisterController.java
+0
-62
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRoleController.java
+1
-1
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRolePermissionController.java
+1
-1
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantSmsController.java
+3
-3
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantUserController.java
+32
-31
api-system/src/main/java/com/jumeirah/api/system/controller/MerchantForSysController.java
+1
-1
common/src/main/java/com/jumeirah/common/convert/UserConvert.java
+2
-2
common/src/main/java/com/jumeirah/common/entity/Merchant.java
+20
-5
common/src/main/java/com/jumeirah/common/entity/MerchantUser.java
+8
-1
common/src/main/java/com/jumeirah/common/mapper/MerchantMapper.java
+1
-1
common/src/main/java/com/jumeirah/common/param/MerchantLoginParam.java
+46
-0
common/src/main/java/com/jumeirah/common/param/MerchantPageParam.java
+3
-3
common/src/main/java/com/jumeirah/common/param/MerchantRegisterParam.java
+65
-0
common/src/main/java/com/jumeirah/common/service/MerchantService.java
+1
-1
common/src/main/java/com/jumeirah/common/service/MerchantUserService.java
+7
-6
common/src/main/java/com/jumeirah/common/service/impl/AppUserServiceImpl.java
+1
-1
common/src/main/java/com/jumeirah/common/service/impl/MerchantRoleServiceImpl.java
+9
-9
common/src/main/java/com/jumeirah/common/service/impl/MerchantServiceImpl.java
+1
-1
common/src/main/java/com/jumeirah/common/service/impl/MerchantSmsService.java
+1
-1
common/src/main/java/com/jumeirah/common/service/impl/MerchantSmsServiceImpl.java
+1
-1
common/src/main/java/com/jumeirah/common/service/impl/MerchantUserServiceImpl.java
+58
-40
common/src/main/java/com/jumeirah/common/service/impl/SysLoginServiceImpl.java
+3
-3
common/src/main/java/com/jumeirah/common/vo/LoginMerUserTokenVo.java
+44
-0
common/src/main/resources/mapper/BusinessPlainMapper.xml
+1
-0
common/src/main/resources/mapper/CharterIntroductionMapper.xml
+3
-0
common/src/main/resources/mapper/MerchantMapper.xml
+4
-1
common/src/main/resources/mapper/merchant/MerchantUserMapper.xml
+1
-1
config/src/main/resources/config/application-test.yml
+5
-5
config/src/main/resources/config/application.yml
+4
-4
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/impl/MerchantLoginRedisServiceImpl.java
+6
-6
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtFilter.java
+1
-1
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtToken.java
+11
-2
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/impl/ShiroLoginServiceImpl.java
+1
-1
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/JwtTokenRedisVo.java
+7
-0
No files found.
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantHelloWorldController.java
View file @
892a540e
...
...
@@ -2,9 +2,11 @@ package com.jumeirah.api.merchant.controller;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.shiro.jwt.JwtToken
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -19,13 +21,15 @@ import java.io.IOException;
@Slf4j
@Api
(
value
=
"Hello World2"
,
tags
=
{
"商户Hello World2"
})
@RestController
@RequestMapping
(
"/merchant/"
)
@RequestMapping
(
"/merchant/
hello
"
)
public
class
MerchantHelloWorldController
{
@GetMapping
(
value
=
"/world"
)
@OperationLog
(
name
=
"helloWorld"
)
@ApiOperation
(
value
=
"Hello World"
,
response
=
String
.
class
)
public
ApiResult
<
String
>
helloWorld
()
throws
IOException
{
JwtToken
jwtToken
=
(
JwtToken
)
SecurityUtils
.
getSubject
().
getPrincipal
();
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World app merchant"
);
}
...
...
@@ -34,6 +38,8 @@ public class MerchantHelloWorldController {
@OperationLog
(
name
=
"needRole"
)
@ApiOperation
(
value
=
"needRole"
,
response
=
String
.
class
)
public
ApiResult
<
String
>
needRole
()
throws
IOException
{
JwtToken
jwtToken
=
(
JwtToken
)
SecurityUtils
.
getSubject
().
getPrincipal
();
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World app"
);
}
...
...
@@ -41,8 +47,10 @@ public class MerchantHelloWorldController {
@GetMapping
(
value
=
"/needRoleAdmin"
)
@OperationLog
(
name
=
"needRoleAdmin"
)
@ApiOperation
(
value
=
"needRoleAdmin"
,
response
=
String
.
class
)
@RequiresPermissions
(
"mer:admin"
)
@RequiresPermissions
(
"mer
chant
:admin"
)
public
ApiResult
<
String
>
needRoleAdmin
()
throws
IOException
{
JwtToken
jwtToken
=
(
JwtToken
)
SecurityUtils
.
getSubject
().
getPrincipal
();
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World needRoleAdmin"
);
}
...
...
@@ -50,8 +58,10 @@ public class MerchantHelloWorldController {
@GetMapping
(
value
=
"/needRoleAll"
)
@OperationLog
(
name
=
"needRoleAll"
)
@ApiOperation
(
value
=
"needRoleAll"
,
response
=
String
.
class
)
@RequiresRoles
(
"
app
:all"
)
@RequiresRoles
(
"
merchant
:all"
)
public
ApiResult
<
String
>
needRoleAll
()
throws
IOException
{
JwtToken
jwtToken
=
(
JwtToken
)
SecurityUtils
.
getSubject
().
getPrincipal
();
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World needRoleAll"
);
}
...
...
@@ -60,6 +70,8 @@ public class MerchantHelloWorldController {
@OperationLog
(
name
=
"noRole"
)
@ApiOperation
(
value
=
"noRole"
,
response
=
String
.
class
)
public
ApiResult
<
String
>
noRole
()
throws
IOException
{
JwtToken
jwtToken
=
(
JwtToken
)
SecurityUtils
.
getSubject
().
getPrincipal
();
log
.
debug
(
"Hello World...app"
);
return
ApiResult
.
ok
(
"Hello World app noRole"
);
}
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantPermissionController.java
View file @
892a540e
...
...
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Slf4j
@RestController
@RequestMapping
(
"/merchant
P
ermission"
)
@RequestMapping
(
"/merchant
/p
ermission"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家权限API"
,
tags
=
{
"商家权限"
})
public
class
MerchantPermissionController
extends
BaseController
{
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRegisterController.java
deleted
100755 → 0
View file @
50a6a48d
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.common.param.RegisterParam
;
import
com.jumeirah.common.service.SysRegisterService
;
import
com.jumeirah.common.vo.LoginSysUserTokenVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.log.annotation.Module
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore
;
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.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 geekidea
* @date 2019-09-28
* @since 1.3.0.RELEASE
**/
@Slf4j
@RestController
@Module
(
"system"
)
@Api
(
value
=
"商户注册API"
,
tags
=
{
"商户注册"
})
@RequestMapping
(
"/merchant/"
)
public
class
MerchantRegisterController
{
@Autowired
private
SysRegisterService
registerService
;
@PostMapping
(
"/register"
)
@OperationLogIgnore
@ApiOperation
(
value
=
"注册"
,
notes
=
"商户注册"
,
response
=
LoginSysUserTokenVo
.
class
)
public
ApiResult
<
LoginSysUserTokenVo
>
register
(
@Validated
@RequestBody
RegisterParam
registerParam
,
HttpServletResponse
response
,
@RequestHeader
(
required
=
false
)
String
language
)
throws
Exception
{
return
registerService
.
register
(
registerParam
,
response
,
language
);
}
}
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRoleController.java
View file @
892a540e
...
...
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Slf4j
@RestController
@RequestMapping
(
"/merchant
R
ole"
)
@RequestMapping
(
"/merchant
/r
ole"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家角色API"
,
tags
=
{
"商家角色"
})
public
class
MerchantRoleController
extends
BaseController
{
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantRolePermissionController.java
View file @
892a540e
...
...
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Slf4j
@RestController
@RequestMapping
(
"/merchant
R
olePermission"
)
@RequestMapping
(
"/merchant
/r
olePermission"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家角色权限关系API"
,
tags
=
{
"商家角色权限关系"
})
public
class
MerchantRolePermissionController
extends
BaseController
{
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantSmsController.java
View file @
892a540e
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.
api.merchant.service
.MerchantSmsService
;
import
com.jumeirah.
common.service.impl
.MerchantSmsService
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
...
...
@@ -23,8 +23,8 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
//@Module("api-app")
@Api
(
value
=
"短信验证码"
,
tags
=
{
"APP短信验证码相关"
})
@RequestMapping
(
"/
app
/sms/"
)
@Api
(
value
=
"短信验证码"
,
tags
=
{
"APP短信验证码相关"
}
,
hidden
=
true
)
@RequestMapping
(
"/
merchant
/sms/"
)
public
class
MerchantSmsController
extends
BaseController
{
@Autowired
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/controller/MerchantUserController.java
View file @
892a540e
package
com
.
jumeirah
.
api
.
merchant
.
controller
;
import
com.jumeirah.common.entity.MerchantUser
;
import
com.jumeirah.common.param.LoginParam
;
import
com.jumeirah.common.param.
Merchant
LoginParam
;
import
com.jumeirah.common.param.MerchantUserPageParam
;
import
com.jumeirah.common.service.MerchantService
;
import
com.jumeirah.common.service.MerchantUserService
;
import
com.jumeirah.common.vo.Login
Sys
UserTokenVo
;
import
com.jumeirah.common.vo.Login
Mer
UserTokenVo
;
import
com.jumeirah.common.vo.MerchantUserQueryVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
...
...
@@ -24,78 +25,79 @@ 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
(
"/merchant
U
ser"
)
@RequestMapping
(
"/merchant
/u
ser"
)
@Module
(
"${cfg.module}"
)
@Api
(
value
=
"商家
API"
,
tags
=
{
"商家
"
})
@Api
(
value
=
"商家
用户API"
,
tags
=
{
"商家用户表
"
})
public
class
MerchantUserController
extends
BaseController
{
@Autowired
private
MerchantUserService
merchantUserService
;
@Autowired
private
MerchantService
merchantService
;
/**
* 添加商家
* 添加商家
用户
*/
@PostMapping
(
"/add"
)
@OperationLog
(
name
=
"添加商家"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"添加商家"
,
response
=
ApiResult
.
class
)
@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
)
@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
)
@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
)
@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
)
@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
);
...
...
@@ -103,17 +105,16 @@ public class MerchantUserController extends BaseController {
@PostMapping
(
"/login"
)
@OperationLogIgnore
@ApiOperation
(
value
=
"登录"
,
notes
=
"商家
登录"
,
response
=
LoginSysUserTokenVo
.
class
)
public
ApiResult
<
Login
SysUserTokenVo
>
login
(
@Validated
@RequestBody
LoginParam
loginParam
,
HttpServletResponse
response
,
@RequestHeader
(
required
=
false
)
String
languag
e
)
throws
Exception
{
return
merchantUserService
.
login
(
loginParam
,
response
,
language
);
@ApiOperation
(
value
=
"登录"
,
notes
=
"商家
用户登录"
)
public
ApiResult
<
Login
MerUserTokenVo
>
login
(
@Validated
@RequestBody
MerchantLoginParam
merchantLoginParam
,
HttpServletResponse
respons
e
)
throws
Exception
{
return
merchantUserService
.
login
(
merchantLoginParam
);
}
@PostMapping
(
"/register"
)
@OperationLogIgnore
@ApiOperation
(
value
=
"注册"
,
notes
=
"商家注册"
,
response
=
LoginSysUserTokenVo
.
class
)
public
ApiResult
<
LoginSysUserTokenVo
>
register
(
@Validated
@RequestBody
LoginParam
loginParam
,
HttpServletResponse
response
,
@RequestHeader
(
required
=
false
)
String
language
)
throws
Exception
{
return
merchantUserService
.
login
(
loginParam
,
response
,
language
);
}
// @PostMapping("/register")
// @OperationLogIgnore
// @ApiOperation(value = "注册", notes = "商家注册")
// public ApiResult<Boolean> register(@Validated @RequestBody MerchantRegisterParam merchantRegisterParam, HttpServletResponse response) throws Exception {
// return merchantUserService.register(merchantRegisterParam);
// }
}
api-system/src/main/java/com/jumeirah/api/system/controller/MerchantController.java
→
api-system/src/main/java/com/jumeirah/api/system/controller/Merchant
ForSys
Controller.java
View file @
892a540e
...
...
@@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"/sys/merchant"
)
@Api
(
value
=
"航空公司商家表API"
,
tags
=
{
"航空公司商家表"
})
public
class
MerchantController
extends
BaseController
{
public
class
Merchant
ForSys
Controller
extends
BaseController
{
@Autowired
private
MerchantService
merchantService
;
...
...
common/src/main/java/com/jumeirah/common/convert/
Sys
UserConvert.java
→
common/src/main/java/com/jumeirah/common/convert/UserConvert.java
View file @
892a540e
...
...
@@ -29,9 +29,9 @@ import org.mapstruct.factory.Mappers;
* @date 2019-10-05
**/
@Mapper
public
interface
Sys
UserConvert
{
public
interface
UserConvert
{
SysUserConvert
INSTANCE
=
Mappers
.
getMapper
(
Sys
UserConvert
.
class
);
UserConvert
INSTANCE
=
Mappers
.
getMapper
(
UserConvert
.
class
);
/**
* 系统用户实体对象转换成登录用户VO对象
...
...
common/src/main/java/com/jumeirah/common/entity/Merchant.java
View file @
892a540e
...
...
@@ -18,7 +18,7 @@ import java.util.Date;
* 航空公司商家表
*
* @author giao
* @since 2020-10-1
3
* @since 2020-10-1
6
*/
@Data
@Accessors
(
chain
=
true
)
...
...
@@ -72,6 +72,14 @@ public class Merchant extends BaseEntity {
@ApiModelProperty
(
"在列表展示的图片url"
)
private
String
imageListUrl
;
@NotNull
(
message
=
"在列表展示的图片高度不能为空"
)
@ApiModelProperty
(
"在列表展示的图片高度"
)
private
Long
imageListHeight
;
@NotNull
(
message
=
"在列表展示的图片宽度不能为空"
)
@ApiModelProperty
(
"在列表展示的图片宽度"
)
private
Long
imageListWidth
;
@ApiModelProperty
(
"公司介绍图片url"
)
private
String
imageCompanyIntroductionUrl
;
...
...
@@ -93,9 +101,16 @@ public class Merchant extends BaseEntity {
@ApiModelProperty
(
"航空公司名称"
)
private
String
airlineName
;
@ApiModelProperty
(
"列表图片高"
)
private
Long
imageListHeight
;
@ApiModelProperty
(
"列表图片宽"
)
private
Long
imageListWidth
;
@ApiModelProperty
(
"公司所在地址"
)
private
String
location
;
@ApiModelProperty
(
"邮箱"
)
private
String
email
;
@ApiModelProperty
(
"营业执照图片url"
)
private
String
imageBusinessLicenseUrl
;
@ApiModelProperty
(
"审核注册状态 0未审核,1审核成功"
)
private
Integer
auditRegisterStatus
;
}
common/src/main/java/com/jumeirah/common/entity/MerchantUser.java
View file @
892a540e
...
...
@@ -24,7 +24,7 @@ import java.util.Date;
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"MerchantUser对象"
)
public
class
MerchantUser
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -34,6 +34,13 @@ public class MerchantUser extends BaseEntity {
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
@NotNull
(
message
=
"商家id不能为空"
)
@ApiModelProperty
(
"商家id"
)
private
Long
mcId
;
@ApiModelProperty
(
"是否为管理员,0:普通,1:超级管理员"
)
private
Integer
isAdmin
;
@ApiModelProperty
(
"用户名"
)
private
String
username
;
...
...
common/src/main/java/com/jumeirah/common/mapper/MerchantMapper.java
View file @
892a540e
...
...
@@ -15,7 +15,7 @@ import java.io.Serializable;
* 航空公司商家表 Mapper 接口
*
* @author giao
* @since 2020-10-1
3
* @since 2020-10-1
6
*/
@Repository
public
interface
MerchantMapper
extends
BaseMapper
<
Merchant
>
{
...
...
common/src/main/java/com/jumeirah/common/param/MerchantLoginParam.java
0 → 100755
View file @
892a540e
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
jumeirah
.
common
.
param
;
import
io.geekidea.springbootplus.framework.shiro.service.LoginUsername
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
/**
* 登录参数
*
* @author geekidea
* @date 2019-05-15
**/
@Data
@ApiModel
(
"登录参数"
)
public
class
MerchantLoginParam
implements
LoginUsername
{
private
static
final
long
serialVersionUID
=
2854217576695117356L
;
@NotBlank
(
message
=
"请输入账号"
)
@ApiModelProperty
(
value
=
"账号"
,
example
=
"zhuomeiya"
)
private
String
username
;
@NotBlank
(
message
=
"请输入密码"
)
@ApiModelProperty
(
value
=
"密码"
,
example
=
"123456"
)
private
String
password
;
}
common/src/main/java/com/jumeirah/common/param/MerchantPageParam.java
View file @
892a540e
...
...
@@ -12,12 +12,12 @@ import lombok.experimental.Accessors;
* </pre>
*
* @author giao
* @date 2020-10-1
3
* @date 2020-10-1
6
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"商家表分页参数"
)
@ApiModel
(
value
=
"
航空公司
商家表分页参数"
)
public
class
MerchantPageParam
extends
BasePageOrderParam
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
common/src/main/java/com/jumeirah/common/param/MerchantRegisterParam.java
0 → 100755
View file @
892a540e
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
jumeirah
.
common
.
param
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
/**
* 注册参数
*
* @author geekidea
* @date 2019-05-15
**/
@Data
@ApiModel
(
"注册参数"
)
public
class
MerchantRegisterParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2854217576695117357L
;
@NotBlank
(
message
=
"请输入密码"
)
@ApiModelProperty
(
value
=
"密码"
,
example
=
"123456"
)
private
String
password
;
@NotBlank
(
message
=
"参数不能为空"
)
@ApiModelProperty
(
"验证码"
)
private
String
smsCode
;
@ApiModelProperty
(
"商家名称"
)
@NotBlank
(
message
=
"参数不能为空"
)
private
String
name
;
@ApiModelProperty
(
"联系人手机号码"
)
@NotBlank
(
message
=
"请输入手机号"
)
private
String
phone
;
@ApiModelProperty
(
"联系人手机区号"
)
private
String
phoneArea
;
@ApiModelProperty
(
"公司所在地址"
)
private
String
location
;
@ApiModelProperty
(
"邮箱"
)
private
String
email
;
@ApiModelProperty
(
"营业执照图片url, 为多张可以传入数组"
)
private
String
imageBusinessLicenseUrl
;
}
common/src/main/java/com/jumeirah/common/service/MerchantService.java
View file @
892a540e
...
...
@@ -10,7 +10,7 @@ import io.geekidea.springbootplus.framework.core.pagination.Paging;
* 航空公司商家表 服务类
*
* @author giao
* @since 2020-10-1
3
* @since 2020-10-1
6
*/
public
interface
MerchantService
extends
BaseService
<
Merchant
>
{
...
...
common/src/main/java/com/jumeirah/common/service/MerchantUserService.java
View file @
892a540e
package
com
.
jumeirah
.
common
.
service
;
import
com.jumeirah.common.entity.MerchantUser
;
import
com.jumeirah.common.param.LoginParam
;
import
com.jumeirah.common.param.MerchantLoginParam
;
import
com.jumeirah.common.param.MerchantRegisterParam
;
import
com.jumeirah.common.param.MerchantUserPageParam
;
import
com.jumeirah.common.vo.Login
Sys
UserTokenVo
;
import
com.jumeirah.common.vo.Login
Mer
UserTokenVo
;
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
;
/**
* 商家 服务类
*
...
...
@@ -32,11 +31,13 @@ public interface MerchantUserService extends BaseService<MerchantUser> {
/**
* 登录
*
* @param loginParam
* @return
* @throws Exception
*/
ApiResult
<
LoginSysUserTokenVo
>
login
(
LoginParam
loginParam
,
HttpServletResponse
response
,
String
language
)
throws
Exception
;
ApiResult
<
LoginMerUserTokenVo
>
login
(
MerchantLoginParam
merchantLoginParam
)
throws
Exception
;
ApiResult
<
Boolean
>
register
(
MerchantRegisterParam
merchantRegisterParam
)
throws
Exception
;
/**
...
...
common/src/main/java/com/jumeirah/common/service/impl/AppUserServiceImpl.java
View file @
892a540e
...
...
@@ -116,7 +116,7 @@ public class AppUserServiceImpl extends BaseServiceImpl<AppUserMapper, AppUser>
log
.
debug
(
"token:{}"
,
token
);
// 创建AuthenticationToken
JwtToken
jwtToken
=
JwtToken
.
build
(
token
,
appUser
.
getId
().
toString
(),
appUser
.
getId
(),
newSalt
,
expireSecond
,
LoginClientTypeEnum
.
APP
.
getType
());
JwtToken
jwtToken
=
JwtToken
.
build
(
token
,
appUser
.
getId
().
toString
(),
appUser
.
getId
(),
newSalt
,
expireSecond
,
LoginClientTypeEnum
.
APP
.
getType
()
,
null
);
boolean
enableShiro
=
springBootPlusProperties
.
getShiro
().
isEnable
();
if
(
enableShiro
)
{
...
...
common/src/main/java/com/jumeirah/common/service/impl/MerchantRoleServiceImpl.java
View file @
892a540e
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.MerchantRole
;
import
com.jumeirah.common.mapper.MerchantRoleMapper
;
import
com.jumeirah.common.param.MerchantRolePageParam
;
import
com.jumeirah.common.service.MerchantRoleService
;
import
com.jumeirah.common.param.MerchantRolePageParam
;
import
com.jumeirah.common.vo.MerchantRoleQueryVo
;
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
io.geekidea.springbootplus.framework.core.pagination.PageInfo
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 商家角色 服务实现类
...
...
common/src/main/java/com/jumeirah/common/service/impl/MerchantServiceImpl.java
View file @
892a540e
...
...
@@ -20,7 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
* 航空公司商家表 服务实现类
*
* @author giao
* @since 2020-10-1
3
* @since 2020-10-1
6
*/
@Slf4j
@Service
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/service
/MerchantSmsService.java
→
common/src/main/java/com/jumeirah/common/service/impl
/MerchantSmsService.java
View file @
892a540e
package
com
.
jumeirah
.
api
.
merchant
.
service
;
package
com
.
jumeirah
.
common
.
service
.
impl
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
...
...
api-merchant/src/main/java/com/jumeirah/api/merchant/service
/MerchantSmsServiceImpl.java
→
common/src/main/java/com/jumeirah/common/service/impl
/MerchantSmsServiceImpl.java
View file @
892a540e
package
com
.
jumeirah
.
api
.
merchant
.
service
;
package
com
.
jumeirah
.
common
.
service
.
impl
;
import
cn.hutool.core.util.RandomUtil
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
...
...
common/src/main/java/com/jumeirah/common/service/impl/MerchantUserServiceImpl.java
View file @
892a540e
...
...
@@ -4,17 +4,20 @@ 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.convert.UserConvert
;
import
com.jumeirah.common.entity.Merchant
;
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.MerchantLoginParam
;
import
com.jumeirah.common.param.MerchantRegisterParam
;
import
com.jumeirah.common.param.MerchantUserPageParam
;
import
com.jumeirah.common.service.MerchantRolePermissionService
;
import
com.jumeirah.common.service.MerchantRoleService
;
import
com.jumeirah.common.service.MerchantService
;
import
com.jumeirah.common.service.MerchantUserService
;
import
com.jumeirah.common.vo.Login
Sys
UserTokenVo
;
import
com.jumeirah.common.vo.Login
Mer
UserTokenVo
;
import
com.jumeirah.common.vo.MerchantUserQueryVo
;
import
io.geekidea.springbootplus.config.properties.JwtProperties
;
import
io.geekidea.springbootplus.config.properties.SpringBootPlusProperties
;
...
...
@@ -26,7 +29,6 @@ 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.jwt.realm.LoginClientTypeEnum
;
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.LoginUserVo
;
...
...
@@ -35,13 +37,13 @@ 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.BeanUtils
;
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
;
...
...
@@ -77,56 +79,47 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
private
MerchantRoleService
merchantRoleService
;
@Autowired
private
MerchantService
merchantService
;
@Autowired
private
MerchantSmsService
merchantSmsService
;
@Autowired
private
MerchantRolePermissionService
merchantRolePermissionService
;
public
MerchantUser
get
Sys
UserByUsername
(
String
username
)
throws
Exception
{
public
MerchantUser
get
Mer
UserByUsername
(
String
username
)
throws
Exception
{
MerchantUser
sysUser
=
new
MerchantUser
().
setUsername
(
username
);
return
merchantUserMapper
.
selectOne
(
new
QueryWrapper
<
MerchantUser
>(
sysUser
));
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ApiResult
<
Login
SysUserTokenVo
>
login
(
LoginParam
loginParam
,
HttpServletResponse
response
,
String
language
)
throws
Exception
{
public
ApiResult
<
Login
MerUserTokenVo
>
login
(
MerchantLoginParam
merchantLoginParam
)
throws
Exception
{
// // 校验验证码
// checkVerifyCode(loginParam.getVerifyToken(), loginParam.getCode());
String
username
=
loginParam
.
getUsername
();
String
username
=
merchantLoginParam
.
getUsername
();
// 从数据库中获取登录用户信息
MerchantUser
merchantUser
=
get
Sys
UserByUsername
(
username
);
MerchantUser
merchantUser
=
get
Mer
UserByUsername
(
username
);
if
(
merchantUser
==
null
)
{
log
.
error
(
"登录失败,loginParam:{}"
,
loginParam
);
// throw new AuthenticationException("用户名或密码错误");
return
ApiResult
.
fail
(
ApiCode
.
PWD_OR_USERNAME_ERROR
,
language
);
log
.
error
(
"登录失败,用户名或密码错误merchantLoginParam:{}"
,
merchantLoginParam
);
return
ApiResult
.
result
(
ApiCode
.
PWD_OR_USERNAME_ERROR
,
null
);
}
if
(
StateEnum
.
DISABLE
.
getCode
().
equals
(
merchantUser
.
getState
()))
{
throw
new
AuthenticationException
(
"账号已禁用"
);
log
.
error
(
"登录失败,禁用:{}"
,
merchantLoginParam
);
return
ApiResult
.
result
(
ApiCode
.
LOGIN_EXCEPTION
,
null
);
}
// 实际项目中,前端传过来的密码应先加密
// 原始密码明文:123456
// 原始密码前端加密:sha256(123456)
// 后台加密规则:sha256(sha256(123456) + salt)
String
encryptPassword
=
PasswordUtil
.
encrypt
(
l
oginParam
.
getPassword
(),
merchantUser
.
getSalt
());
String
encryptPassword
=
PasswordUtil
.
encrypt
(
merchantL
oginParam
.
getPassword
(),
merchantUser
.
getSalt
());
if
(!
encryptPassword
.
equals
(
merchantUser
.
getPassword
()))
{
return
ApiResult
.
fail
(
ApiCode
.
PWD_OR_USERNAME_ERROR
,
language
);
return
ApiResult
.
result
(
ApiCode
.
PWD_OR_USERNAME_ERROR
,
null
);
}
// 将系统用户对象转换成登录用户对象
LoginUserVo
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());
LoginUserVo
loginSysUserVo
=
UserConvert
.
INSTANCE
.
merchantUserToLoginSysUserVo
(
merchantUser
);
// 获取当前用户角色
Long
roleId
=
merchantUser
.
getRoleId
();
...
...
@@ -143,9 +136,6 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
// 获取当前用户权限
Set
<
String
>
permissionCodes
=
merchantRolePermissionService
.
getPermissionCodesByRoleId
(
roleId
);
// if (CollectionUtils.isEmpty(permissionCodes)) {
// throw new AuthenticationException("权限列表不能为空");
// }
loginSysUserVo
.
setPermissionCodes
(
permissionCodes
);
// 获取数据库中保存的盐值
...
...
@@ -157,7 +147,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
log
.
debug
(
"token:{}"
,
token
);
// 创建AuthenticationToken
JwtToken
jwtToken
=
JwtToken
.
build
(
token
,
username
,
merchantUser
.
getId
(),
newSalt
,
expireSecond
,
LoginClientTypeEnum
.
MERCHANT
.
getType
());
JwtToken
jwtToken
=
JwtToken
.
build
(
token
,
username
,
merchantUser
.
getId
(),
newSalt
,
expireSecond
,
LoginClientTypeEnum
.
MERCHANT
.
getType
(),
merchantUser
.
getMcId
());
boolean
enableShiro
=
springBootPlusProperties
.
getShiro
().
isEnable
();
if
(
enableShiro
)
{
...
...
@@ -178,16 +168,44 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
redisTemplate.opsForValue().set(tokenSha256, loginSysUserVo, 1, TimeUnit.DAYS);*/
// 返回token和登录用户信息对象
Login
SysUserTokenVo
loginSysUserTokenVo
=
new
LoginSys
UserTokenVo
();
Login
MerUserTokenVo
loginSysUserTokenVo
=
new
LoginMer
UserTokenVo
();
loginSysUserTokenVo
.
setToken
(
token
);
loginSysUserTokenVo
.
setLoginSysUserVo
(
loginSysUserVo
);
// 设置token响应头
response
.
setHeader
(
JwtTokenUtil
.
getTokenName
(),
loginSysUserTokenVo
.
getToken
());
return
ApiResult
.
ok
(
loginSysUserTokenVo
);
}
@Override
public
ApiResult
<
Boolean
>
register
(
MerchantRegisterParam
merchantRegisterPram
)
throws
Exception
{
// 校验验证码
boolean
equalsRegisterCode
=
merchantSmsService
.
equalsRegisterCode
(
merchantRegisterPram
.
getPhoneArea
(),
merchantRegisterPram
.
getPhone
(),
merchantRegisterPram
.
getSmsCode
());
if
(!
equalsRegisterCode
)
{
return
ApiResult
.
fail
(
ApiCode
.
SMS_CODE_ERROR
);
}
// 删除已使用的验证码
merchantSmsService
.
deleteRegisterCode
(
merchantRegisterPram
.
getPhoneArea
(),
merchantRegisterPram
.
getPhone
());
// 判断是否已经注册
// if (appUserService.hasUserByPhoneNumer(loginParam.getPhoneArea(), loginParam.getPhone())) {
// // 如果已经注册直接走登陆的代码
// return appUserService.login(loginParam, language, true);
// }
// 没注册则先保存到数据库
Merchant
merchant
=
new
Merchant
();
BeanUtils
.
copyProperties
(
merchantRegisterPram
,
merchant
);
merchant
.
setAuditRegisterStatus
(
0
);
merchant
.
setState
(
1
);
boolean
isDbOk
=
merchantService
.
saveMerchant
(
merchant
);
if
(!
isDbOk
)
{
return
ApiResult
.
fail
(
ApiCode
.
SPRING_BOOT_PLUS_EXCEPTION
);
}
// 创建一个该公司默认的管理员账号
return
ApiResult
.
ok
();
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
...
...
common/src/main/java/com/jumeirah/common/service/impl/SysLoginServiceImpl.java
View file @
892a540e
...
...
@@ -2,7 +2,7 @@
package
com
.
jumeirah
.
common
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jumeirah.common.convert.
Sys
UserConvert
;
import
com.jumeirah.common.convert.UserConvert
;
import
com.jumeirah.common.entity.SysDepartment
;
import
com.jumeirah.common.entity.SysRole
;
import
com.jumeirah.common.entity.SysUser
;
...
...
@@ -120,7 +120,7 @@ public class SysLoginServiceImpl implements SysLoginService {
}
// 将系统用户对象转换成登录用户对象
LoginUserVo
loginSysUserVo
=
Sys
UserConvert
.
INSTANCE
.
sysUserToLoginSysUserVo
(
sysUser
);
LoginUserVo
loginSysUserVo
=
UserConvert
.
INSTANCE
.
sysUserToLoginSysUserVo
(
sysUser
);
// 获取部门
SysDepartment
sysDepartment
=
sysDepartmentService
.
getById
(
sysUser
.
getDepartmentId
());
...
...
@@ -162,7 +162,7 @@ public class SysLoginServiceImpl implements SysLoginService {
log
.
debug
(
"token:{}"
,
token
);
// 创建AuthenticationToken
JwtToken
jwtToken
=
JwtToken
.
build
(
token
,
username
,
sysUser
.
getId
(),
newSalt
,
expireSecond
,
LoginClientTypeEnum
.
SYSTEM
.
getType
());
JwtToken
jwtToken
=
JwtToken
.
build
(
token
,
username
,
sysUser
.
getId
(),
newSalt
,
expireSecond
,
LoginClientTypeEnum
.
SYSTEM
.
getType
()
,
null
);
boolean
enableShiro
=
springBootPlusProperties
.
getShiro
().
isEnable
();
if
(
enableShiro
)
{
...
...
common/src/main/java/com/jumeirah/common/vo/LoginMerUserTokenVo.java
0 → 100755
View file @
892a540e
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
jumeirah
.
common
.
vo
;
import
io.geekidea.springbootplus.framework.shiro.service.LoginToken
;
import
io.geekidea.springbootplus.framework.shiro.vo.LoginUserVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* @author geekidea
* @date 2019-10-26
**/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
"登录用户信息TokenVO"
)
public
class
LoginMerUserTokenVo
implements
LoginToken
{
private
static
final
long
serialVersionUID
=
-
2138450422989081056L
;
@ApiModelProperty
(
"token"
)
private
String
token
;
/**
* 登录用户对象
*/
private
LoginUserVo
loginSysUserVo
;
}
common/src/main/resources/mapper/BusinessPlainMapper.xml
View file @
892a540e
...
...
@@ -31,6 +31,7 @@
from business_plain bp
INNER JOIN merchant m ON bp.mc_id=m.id
where bp.business_type=#{param.type}
AND m.state=1 and m.audit_register_status=1
</select>
</mapper>
common/src/main/resources/mapper/CharterIntroductionMapper.xml
View file @
892a540e
...
...
@@ -31,6 +31,9 @@
from charter_introduction ci
INNER JOIN merchant m ON ci.mc_id=m.id
where ci.type = #{param.type}
AND m.state=1 and m.audit_register_status=1
</select>
...
...
common/src/main/resources/mapper/MerchantMapper.xml
View file @
892a540e
...
...
@@ -4,7 +4,7 @@
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, name, phone, phone_area, head, remark, state, deleted, create_time, update_time, recharge_bank, recharge_name, recharge_bank_number, image_list_url, image_
company_introduction_url, image_team_introduction_url, image_advantage_url, text_company_introduction, text_team_introduction, text_advantage, airline_name,image_list_height,image_list_width
id, name, phone, phone_area, head, remark, state, deleted, create_time, update_time, recharge_bank, recharge_name, recharge_bank_number, image_list_url, image_
list_height, image_list_width, image_company_introduction_url, image_team_introduction_url, image_advantage_url, text_company_introduction, text_team_introduction, text_advantage, airline_name, location, email, image_business_license_url, audit_register_status
</sql>
<select
id=
"getMerchantById"
resultType=
"com.jumeirah.common.vo.MerchantQueryVo"
>
...
...
@@ -18,6 +18,9 @@
select
<include
refid=
"Base_Column_List"
/>
from merchant
<where>
state=1 and audit_register_status=1
</where>
</select>
</mapper>
common/src/main/resources/mapper/merchant/MerchantUserMapper.xml
View file @
892a540e
...
...
@@ -4,7 +4,7 @@
<!-- 通用查询结果列 -->
<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
id,
mc_id,is_admin,
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"
>
...
...
config/src/main/resources/config/application-test.yml
View file @
892a540e
...
...
@@ -2,7 +2,7 @@ spring-boot-plus:
# 是否启用ansi控制台输出有颜色的字体,local环境建议开启,服务器环境设置为false
enable-ansi
:
false
# 当前环境服务IP地址
server-ip
:
47.
105.159.10
server-ip
:
47.
99.47.225
# 文件上传下载配置
upload-path
:
/opt/upload/
# AOP配置
...
...
@@ -15,15 +15,15 @@ spring-boot-plus:
spring
:
datasource
:
url
:
jdbc:mysql://
mysql57
:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://
47.99.47.225
:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username
:
root
password
:
123
password
:
temple123456
# Redis配置
redis
:
database
:
0
host
:
redis6
password
:
host
:
127.0.0.1
password
:
temple123456
port
:
6379
# 打印SQL语句和结果集,本地开发环境可开启,线上注释掉
...
...
config/src/main/resources/config/application.yml
View file @
892a540e
...
...
@@ -185,8 +185,8 @@ spring-boot-plus:
# 排除登录 注册 登出
-
/app/user/registerOrLogin,/app/user/login
-
/sys/login,/sys/logout,/sys/register
-
/merchant
User/login
-
/app/sms/registerOrLoginCode
-
/merchant
/user/login,/merchant/user/register
-
/app/sms/registerOrLoginCode
,/merchant/sms/registerCode
# 排除静态资源
-
/static/**,/templates/**
# 排除Swagger
...
...
@@ -195,7 +195,7 @@ spring-boot-plus:
# - /actuator/**
-
# 排除首页
-
/,/index.html
-
/app/noRole
-
/app/noRole
,/merchant/hello/world
# 航空公司介绍分页列表
-
/app/airline/getPageList
# 公务机出售托管表分页列表
...
...
@@ -282,7 +282,7 @@ spring:
elideSetAutoCommits
:
true
maintainTimeStats
:
false
hikari
:
minimum-idle
:
10
minimum-idle
:
5
maximum-pool-size
:
20
idle-timeout
:
10000
max-lifetime
:
1800000
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/cache/impl/MerchantLoginRedisServiceImpl.java
View file @
892a540e
...
...
@@ -42,11 +42,11 @@ public class MerchantLoginRedisServiceImpl implements MerchantLoginRedisService
* username:num
*/
@Override
public
void
cacheLoginInfo
(
JwtToken
jwtToken
,
LoginUserVo
login
Sys
UserVo
)
{
public
void
cacheLoginInfo
(
JwtToken
jwtToken
,
LoginUserVo
loginUserVo
)
{
if
(
jwtToken
==
null
)
{
throw
new
IllegalArgumentException
(
"jwtToken不能为空"
);
}
if
(
login
Sys
UserVo
==
null
)
{
if
(
loginUserVo
==
null
)
{
throw
new
IllegalArgumentException
(
"loginSysUserVo不能为空"
);
}
// token
...
...
@@ -54,20 +54,20 @@ public class MerchantLoginRedisServiceImpl implements MerchantLoginRedisService
// 盐值
String
salt
=
jwtToken
.
getSalt
();
// 登录用户名称
String
username
=
login
Sys
UserVo
.
getUsername
();
String
username
=
loginUserVo
.
getUsername
();
// token md5值
String
tokenMd5
=
DigestUtils
.
md5Hex
(
token
);
// Redis缓存JWT Token信息
JwtTokenRedisVo
jwtTokenRedisVo
=
ShiroMapstructConvert
.
INSTANCE
.
jwtTokenToJwtTokenRedisVo
(
jwtToken
);
jwtTokenRedisVo
.
setUserId
(
login
Sys
UserVo
.
getId
());
jwtTokenRedisVo
.
setUserId
(
loginUserVo
.
getId
());
jwtTokenRedisVo
.
setMcId
(
jwtToken
.
getMcId
());
// 用户客户端信息
ClientInfo
clientInfo
=
ClientInfoUtil
.
get
(
HttpServletRequestUtil
.
getRequest
());
// Redis缓存登录用户信息
// 将LoginSysUserVo对象复制到LoginSysUserRedisVo,使用mapstruct进行对象属性复制
LoginUserRedisVo
loginSysUserRedisVo
=
LoginSysUserVoConvert
.
INSTANCE
.
voToRedisVo
(
login
Sys
UserVo
);
LoginUserRedisVo
loginSysUserRedisVo
=
LoginSysUserVoConvert
.
INSTANCE
.
voToRedisVo
(
loginUserVo
);
loginSysUserRedisVo
.
setSalt
(
salt
);
loginSysUserRedisVo
.
setClientInfo
(
clientInfo
);
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtFilter.java
View file @
892a540e
...
...
@@ -80,7 +80,7 @@ public class JwtFilter extends AuthenticatingFilter {
String
username
=
JwtUtil
.
getUsername
(
token
);
return
JwtToken
.
build
(
token
,
username
,
jwt
.
getUserId
(),
shiroLoginService
.
getSalt
(
token
),
jwtProperties
.
getExpireSecond
(),
jwt
.
getType
());
return
JwtToken
.
build
(
token
,
username
,
jwt
.
getUserId
(),
shiroLoginService
.
getSalt
(
token
),
jwtProperties
.
getExpireSecond
(),
jwt
.
getType
()
,
jwt
.
getMcId
()
);
}
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/jwt/JwtToken.java
View file @
892a540e
...
...
@@ -37,9 +37,17 @@ import java.util.Date;
public
class
JwtToken
implements
HostAuthenticationToken
{
private
static
final
long
serialVersionUID
=
5101247566043093405L
;
/**
* 客户端类型
*/
private
String
type
;
/**
* mcId
*/
private
Long
mcId
;
/**
* 登录ip
*/
private
String
host
;
...
...
@@ -78,7 +86,7 @@ public class JwtToken implements HostAuthenticationToken {
private
String
credentials
;
public
static
JwtToken
build
(
String
token
,
String
username
,
Long
userId
,
String
salt
,
long
expireSecond
,
String
type
)
{
public
static
JwtToken
build
(
String
token
,
String
username
,
Long
userId
,
String
salt
,
long
expireSecond
,
String
type
,
Long
mcId
)
{
DecodedJWT
decodedJwt
=
JwtUtil
.
getJwtInfo
(
token
);
Date
createDate
=
decodedJwt
.
getIssuedAt
();
Date
expireDate
=
decodedJwt
.
getExpiresAt
();
...
...
@@ -91,7 +99,8 @@ public class JwtToken implements HostAuthenticationToken {
.
setType
(
type
)
.
setCreateDate
(
createDate
)
.
setExpireSecond
(
expireSecond
)
.
setExpireDate
(
expireDate
);
.
setExpireDate
(
expireDate
)
.
setMcId
(
mcId
);
}
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/service/impl/ShiroLoginServiceImpl.java
View file @
892a540e
...
...
@@ -100,7 +100,7 @@ public class ShiroLoginServiceImpl implements ShiroLoginService {
// 生成新token字符串
String
newToken
=
JwtUtil
.
generateToken
(
username
,
salt
,
Duration
.
ofSeconds
(
expireSecond
));
// 生成新JwtToken对象
JwtToken
newJwtToken
=
JwtToken
.
build
(
newToken
,
username
,
jwtToken
.
getUserId
(),
salt
,
expireSecond
,
jwtToken
.
getType
());
JwtToken
newJwtToken
=
JwtToken
.
build
(
newToken
,
username
,
jwtToken
.
getUserId
(),
salt
,
expireSecond
,
jwtToken
.
getType
()
,
null
);
// 更新redis缓存
sysLoginRedisService
.
refreshLoginInfo
(
token
,
username
,
newJwtToken
);
log
.
debug
(
"刷新token成功,原token:{},新token:{}"
,
token
,
newToken
);
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/shiro/vo/JwtTokenRedisVo.java
View file @
892a540e
...
...
@@ -33,9 +33,16 @@ import java.util.Date;
public
class
JwtTokenRedisVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1831633309466775223L
;
/**
* 客户端类型
*/
private
String
type
;
/**
* mcId
*/
private
Long
mcId
;
/**
* 登录ip
*/
private
String
host
;
...
...
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