Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
0c738b1e
"src/vscode:/vscode.git/clone" did not exist on "50852e7f87b290438e9041d7950d3d3a439d11a9"
Commit
0c738b1e
authored
Oct 26, 2019
by
dqjdda
Browse files
代码优化,获取Ip优化
parent
f26342ee
Changes
35
Show whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Role.java
View file @
0c738b1e
...
@@ -4,12 +4,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
...
@@ -4,12 +4,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
me.zhengjie.base.BaseEntity
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java
View file @
0c738b1e
...
@@ -34,7 +34,7 @@ public class User extends BaseEntity {
...
@@ -34,7 +34,7 @@ public class User extends BaseEntity {
private
UserAvatar
userAvatar
;
private
UserAvatar
userAvatar
;
@NotBlank
@NotBlank
@Pattern
(
regexp
=
"([a-z0-9A-Z]+[-|
\\
.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}"
,
message
=
"格式错误"
)
@Pattern
(
regexp
=
"([a-z0-9A-Z]+[-|.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}"
,
message
=
"格式错误"
)
private
String
email
;
private
String
email
;
@NotBlank
@NotBlank
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/domain/UserAvatar.java
View file @
0c738b1e
package
me.zhengjie.modules.system.domain
;
package
me.zhengjie.modules.system.domain
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.sql.Timestamp
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java
View file @
0c738b1e
...
@@ -7,7 +7,6 @@ import me.zhengjie.exception.BadRequestException;
...
@@ -7,7 +7,6 @@ import me.zhengjie.exception.BadRequestException;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java
View file @
0c738b1e
...
@@ -7,7 +7,6 @@ import me.zhengjie.exception.BadRequestException;
...
@@ -7,7 +7,6 @@ import me.zhengjie.exception.BadRequestException;
import
me.zhengjie.modules.system.domain.DictDetail
;
import
me.zhengjie.modules.system.domain.DictDetail
;
import
me.zhengjie.modules.system.service.DictDetailService
;
import
me.zhengjie.modules.system.service.DictDetailService
;
import
me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.web.PageableDefault
;
import
org.springframework.data.web.PageableDefault
;
...
@@ -16,11 +15,8 @@ import org.springframework.http.ResponseEntity;
...
@@ -16,11 +15,8 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -43,8 +39,7 @@ public class DictDetailController {
...
@@ -43,8 +39,7 @@ public class DictDetailController {
@ApiOperation
(
"查询字典详情"
)
@ApiOperation
(
"查询字典详情"
)
@GetMapping
@GetMapping
public
ResponseEntity
getDictDetails
(
DictDetailQueryCriteria
criteria
,
public
ResponseEntity
getDictDetails
(
DictDetailQueryCriteria
criteria
,
@PageableDefault
(
value
=
10
,
sort
=
{
"sort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
@PageableDefault
(
sort
=
{
"sort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
String
[]
names
=
criteria
.
getDictName
().
split
(
","
);
return
new
ResponseEntity
<>(
dictDetailService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
dictDetailService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
}
...
@@ -52,7 +47,7 @@ public class DictDetailController {
...
@@ -52,7 +47,7 @@ public class DictDetailController {
@ApiOperation
(
"查询多个字典详情"
)
@ApiOperation
(
"查询多个字典详情"
)
@GetMapping
(
value
=
"/map"
)
@GetMapping
(
value
=
"/map"
)
public
ResponseEntity
getDictDetailMaps
(
DictDetailQueryCriteria
criteria
,
public
ResponseEntity
getDictDetailMaps
(
DictDetailQueryCriteria
criteria
,
@PageableDefault
(
value
=
10
,
sort
=
{
"sort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
@PageableDefault
(
sort
=
{
"sort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
String
[]
names
=
criteria
.
getDictName
().
split
(
","
);
String
[]
names
=
criteria
.
getDictName
().
split
(
","
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
names
.
length
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
names
.
length
);
for
(
String
name
:
names
)
{
for
(
String
name
:
names
)
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java
View file @
0c738b1e
...
@@ -9,7 +9,6 @@ import me.zhengjie.modules.system.domain.Job;
...
@@ -9,7 +9,6 @@ import me.zhengjie.modules.system.domain.Job;
import
me.zhengjie.modules.system.service.JobService
;
import
me.zhengjie.modules.system.service.JobService
;
import
me.zhengjie.modules.system.service.dto.JobQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.JobQueryCriteria
;
import
me.zhengjie.utils.ThrowableUtil
;
import
me.zhengjie.utils.ThrowableUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -17,8 +16,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
...
@@ -17,8 +16,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Set
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
* @date 2019-03-29
* @date 2019-03-29
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java
View file @
0c738b1e
...
@@ -28,6 +28,7 @@ import java.util.Set;
...
@@ -28,6 +28,7 @@ import java.util.Set;
@Api
(
tags
=
"系统:菜单管理"
)
@Api
(
tags
=
"系统:菜单管理"
)
@RestController
@RestController
@RequestMapping
(
"/api/menus"
)
@RequestMapping
(
"/api/menus"
)
@SuppressWarnings
(
"unchecked"
)
public
class
MenuController
{
public
class
MenuController
{
private
final
MenuService
menuService
;
private
final
MenuService
menuService
;
...
@@ -49,7 +50,8 @@ public class MenuController {
...
@@ -49,7 +50,8 @@ public class MenuController {
public
ResponseEntity
buildMenus
(){
public
ResponseEntity
buildMenus
(){
UserDTO
user
=
userService
.
findByName
(
SecurityUtils
.
getUsername
());
UserDTO
user
=
userService
.
findByName
(
SecurityUtils
.
getUsername
());
List
<
MenuDTO
>
menuDTOList
=
menuService
.
findByRoles
(
roleService
.
findByUsers_Id
(
user
.
getId
()));
List
<
MenuDTO
>
menuDTOList
=
menuService
.
findByRoles
(
roleService
.
findByUsers_Id
(
user
.
getId
()));
return
new
ResponseEntity
<>(
menuService
.
buildMenus
((
List
<
MenuDTO
>)
menuService
.
buildTree
(
menuDTOList
).
get
(
"content"
)),
HttpStatus
.
OK
);
List
<
MenuDTO
>
menuDTOS
=
(
List
<
MenuDTO
>)
menuService
.
buildTree
(
menuDTOList
).
get
(
"content"
);
return
new
ResponseEntity
<>(
menuService
.
buildMenus
(
menuDTOS
),
HttpStatus
.
OK
);
}
}
@ApiOperation
(
"返回全部的菜单"
)
@ApiOperation
(
"返回全部的菜单"
)
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleSmallDTO.java
View file @
0c738b1e
package
me.zhengjie.modules.system.service.dto
;
package
me.zhengjie.modules.system.service.dto
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Set
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictDetailServiceImpl.java
View file @
0c738b1e
...
@@ -17,9 +17,7 @@ import org.springframework.data.domain.Pageable;
...
@@ -17,9 +17,7 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Optional
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
...
eladmin-tools/src/main/java/me/zhengjie/domain/QiniuContent.java
View file @
0c738b1e
...
@@ -22,7 +22,7 @@ public class QiniuContent implements Serializable {
...
@@ -22,7 +22,7 @@ public class QiniuContent implements Serializable {
private
Long
id
;
private
Long
id
;
// 文件名
// 文件名
@Column
(
name
=
"name"
,
unique
=
false
)
@Column
(
name
=
"name"
)
private
String
key
;
private
String
key
;
// 空间名
// 空间名
...
...
eladmin-tools/src/main/java/me/zhengjie/repository/PictureRepository.java
View file @
0c738b1e
...
@@ -10,7 +10,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
...
@@ -10,7 +10,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
*/
*/
public
interface
PictureRepository
extends
JpaRepository
<
Picture
,
Long
>,
JpaSpecificationExecutor
<
Picture
>
{
public
interface
PictureRepository
extends
JpaRepository
<
Picture
,
Long
>,
JpaSpecificationExecutor
<
Picture
>
{
Picture
findByUrl
(
String
url
);
Picture
findByMd5Code
(
String
code
);
Picture
findByMd5Code
(
String
code
);
}
}
eladmin-tools/src/main/java/me/zhengjie/repository/VerificationCodeRepository.java
View file @
0c738b1e
...
@@ -12,9 +12,9 @@ public interface VerificationCodeRepository extends JpaRepository<VerificationCo
...
@@ -12,9 +12,9 @@ public interface VerificationCodeRepository extends JpaRepository<VerificationCo
/**
/**
* 获取有效的验证码
* 获取有效的验证码
* @param scenes 业务场景,如重置密码,重置邮箱等等
* @param scenes 业务场景,如重置密码,重置邮箱等等
* @param type
* @param type
类型
* @param value
* @param value
值
* @return
* @return
VerificationCode
*/
*/
VerificationCode
findByScenesAndTypeAndValueAndStatusIsTrue
(
String
scenes
,
String
type
,
String
value
);
VerificationCode
findByScenesAndTypeAndValueAndStatusIsTrue
(
String
scenes
,
String
type
,
String
value
);
}
}
eladmin-tools/src/main/java/me/zhengjie/service/AlipayService.java
View file @
0c738b1e
...
@@ -2,9 +2,6 @@ package me.zhengjie.service;
...
@@ -2,9 +2,6 @@ package me.zhengjie.service;
import
me.zhengjie.domain.AlipayConfig
;
import
me.zhengjie.domain.AlipayConfig
;
import
me.zhengjie.domain.vo.TradeVo
;
import
me.zhengjie.domain.vo.TradeVo
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CachePut
;
import
org.springframework.cache.annotation.Cacheable
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
...
eladmin-tools/src/main/java/me/zhengjie/service/EmailService.java
View file @
0c738b1e
...
@@ -28,7 +28,7 @@ public interface EmailService {
...
@@ -28,7 +28,7 @@ public interface EmailService {
* 发送邮件
* 发送邮件
* @param emailVo 邮件发送的内容
* @param emailVo 邮件发送的内容
* @param emailConfig 邮件配置
* @param emailConfig 邮件配置
* @throws Exception
* @throws Exception
/
*/
*/
@Async
@Async
void
send
(
EmailVo
emailVo
,
EmailConfig
emailConfig
)
throws
Exception
;
void
send
(
EmailVo
emailVo
,
EmailConfig
emailConfig
)
throws
Exception
;
...
...
eladmin-tools/src/main/java/me/zhengjie/service/mapper/LocalStorageMapper.java
View file @
0c738b1e
...
@@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
...
@@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
* @author Zheng Jie
* @author Zheng Jie
* @date 2019-09-05
* @date 2019-09-05
*/
*/
@Mapper
(
componentModel
=
"spring"
,
uses
=
{},
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
LocalStorageMapper
extends
BaseMapper
<
LocalStorageDTO
,
LocalStorage
>
{
public
interface
LocalStorageMapper
extends
BaseMapper
<
LocalStorageDTO
,
LocalStorage
>
{
}
}
\ No newline at end of file
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment