Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
JAVA小学生-王铁柱
eladmin
提交
a0596273
E
eladmin
项目概览
JAVA小学生-王铁柱
/
eladmin
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
eladmin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a0596273
编写于
12月 24, 2018
作者:
郑
郑杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
站点统计细节修改,设置默认用户,角色,权限不可删除修改
上级
766c2189
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
57 addition
and
1 deletion
+57
-1
src/main/java/me/zhengjie/monitor/domain/Visits.java
src/main/java/me/zhengjie/monitor/domain/Visits.java
+1
-0
src/main/java/me/zhengjie/monitor/service/impl/VisitsServiceImpl.java
...a/me/zhengjie/monitor/service/impl/VisitsServiceImpl.java
+7
-1
src/main/java/me/zhengjie/system/service/impl/PermissionServiceImpl.java
...e/zhengjie/system/service/impl/PermissionServiceImpl.java
+15
-0
src/main/java/me/zhengjie/system/service/impl/RoleServiceImpl.java
...java/me/zhengjie/system/service/impl/RoleServiceImpl.java
+16
-0
src/main/java/me/zhengjie/system/service/impl/UserServiceImpl.java
...java/me/zhengjie/system/service/impl/UserServiceImpl.java
+18
-0
未找到文件。
src/main/java/me/zhengjie/monitor/domain/Visits.java
浏览文件 @
a0596273
...
...
@@ -21,6 +21,7 @@ public class Visits {
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
unique
=
true
)
private
String
date
;
@Column
(
name
=
"pv_counts"
)
...
...
src/main/java/me/zhengjie/monitor/service/impl/VisitsServiceImpl.java
浏览文件 @
a0596273
package
me.zhengjie.monitor.service.impl
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.common.utils.IpUtil
;
import
me.zhengjie.common.utils.RequestHolder
;
import
me.zhengjie.common.utils.TimeUtil
;
...
...
@@ -24,6 +25,7 @@ import java.util.stream.Collectors;
* @author jie
* @date 2018-12-13
*/
@Slf4j
@Service
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
class
VisitsServiceImpl
implements
VisitsService
{
...
...
@@ -58,7 +60,11 @@ public class VisitsServiceImpl implements VisitsService {
LocalDate
localDate
=
LocalDate
.
now
();
Visits
visits
=
visitsRepository
.
findByDate
(
localDate
.
toString
());
if
(
visits
==
null
){
try
{
save
(
RequestHolder
.
getHttpServletRequest
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
}
}
List
<
Visits
>
list
=
visitsRepository
.
findAllVisits
(
localDate
.
minusDays
(
6
).
toString
(),
localDate
.
plusDays
(
1
).
toString
());
...
...
src/main/java/me/zhengjie/system/service/impl/PermissionServiceImpl.java
浏览文件 @
a0596273
package
me.zhengjie.system.service.impl
;
import
me.zhengjie.common.exception.BadRequestException
;
import
me.zhengjie.common.exception.EntityExistException
;
import
me.zhengjie.common.utils.ValidationUtil
;
import
me.zhengjie.system.domain.Permission
;
...
...
@@ -50,6 +51,14 @@ public class PermissionServiceImpl implements PermissionService {
ValidationUtil
.
isNull
(
optionalPermission
,
"Permission"
,
"id"
,
resources
.
getId
());
Permission
permission
=
optionalPermission
.
get
();
/**
* 根据实际需求修改
*/
if
(
permission
.
getId
().
equals
(
1L
)){
throw
new
BadRequestException
(
"该权限不能被修改"
);
}
Permission
permission1
=
permissionRepository
.
findByName
(
resources
.
getName
());
if
(
permission1
!=
null
&&
!
permission1
.
getId
().
equals
(
permission
.
getId
())){
...
...
@@ -65,6 +74,12 @@ public class PermissionServiceImpl implements PermissionService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
/**
* 根据实际需求修改
*/
if
(
id
.
equals
(
1L
)){
throw
new
BadRequestException
(
"该权限不能被删除"
);
}
List
<
Permission
>
permissionList
=
permissionRepository
.
findByPid
(
id
);
for
(
Permission
permission
:
permissionList
)
{
permissionRepository
.
delete
(
permission
);
...
...
src/main/java/me/zhengjie/system/service/impl/RoleServiceImpl.java
浏览文件 @
a0596273
package
me.zhengjie.system.service.impl
;
import
me.zhengjie.common.exception.BadRequestException
;
import
me.zhengjie.common.exception.EntityExistException
;
import
me.zhengjie.common.utils.ValidationUtil
;
import
me.zhengjie.system.domain.Role
;
...
...
@@ -51,6 +52,14 @@ public class RoleServiceImpl implements RoleService {
ValidationUtil
.
isNull
(
optionalRole
,
"Role"
,
"id"
,
resources
.
getId
());
Role
role
=
optionalRole
.
get
();
/**
* 根据实际需求修改
*/
if
(
role
.
getId
().
equals
(
1L
)){
throw
new
BadRequestException
(
"该角色不能被修改"
);
}
Role
role1
=
roleRepository
.
findByName
(
resources
.
getName
());
if
(
role1
!=
null
&&
!
role1
.
getId
().
equals
(
role
.
getId
())){
...
...
@@ -66,6 +75,13 @@ public class RoleServiceImpl implements RoleService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
/**
* 根据实际需求修改
*/
if
(
id
.
equals
(
1L
)){
throw
new
BadRequestException
(
"该角色不能被删除"
);
}
roleRepository
.
deleteById
(
id
);
}
...
...
src/main/java/me/zhengjie/system/service/impl/UserServiceImpl.java
浏览文件 @
a0596273
...
...
@@ -5,6 +5,7 @@ import me.zhengjie.common.exception.EntityExistException;
import
me.zhengjie.common.exception.EntityNotFoundException
;
import
me.zhengjie.common.utils.ValidationUtil
;
import
me.zhengjie.core.utils.EncryptUtils
;
import
me.zhengjie.core.utils.JwtTokenUtil
;
import
me.zhengjie.system.domain.User
;
import
me.zhengjie.system.repository.UserRepository
;
import
me.zhengjie.system.service.UserService
;
...
...
@@ -30,6 +31,9 @@ public class UserServiceImpl implements UserService {
@Autowired
private
UserMapper
userMapper
;
@Autowired
private
JwtTokenUtil
jwtTokenUtil
;
@Override
public
UserDTO
findById
(
long
id
)
{
Optional
<
User
>
user
=
userRepository
.
findById
(
id
);
...
...
@@ -68,6 +72,13 @@ public class UserServiceImpl implements UserService {
User
user
=
userOptional
.
get
();
/**
* 根据实际需求修改
*/
if
(
user
.
getId
().
equals
(
1L
)){
throw
new
BadRequestException
(
"该账号不能被修改"
);
}
User
user1
=
userRepository
.
findByUsername
(
user
.
getUsername
());
User
user2
=
userRepository
.
findByEmail
(
user
.
getEmail
());
...
...
@@ -94,6 +105,13 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
/**
* 根据实际需求修改
*/
if
(
id
.
equals
(
1L
)){
throw
new
BadRequestException
(
"该账号不能被删除"
);
}
userRepository
.
deleteById
(
id
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录