Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
work_service
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
work_service
Commits
3ad75783
Commit
3ad75783
authored
Mar 03, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
124f4f03
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
17 deletions
+47
-17
BASE_RESP_CODE_ENUM.java
...wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
+3
-2
WorkLevel.java
...model/src/main/java/cn/wisenergy/model/app/WorkLevel.java
+8
-2
WorkType.java
...-model/src/main/java/cn/wisenergy/model/app/WorkType.java
+3
-3
WorkUserServiceImpl.java
...n/java/cn/wisenergy/service/impl/WorkUserServiceImpl.java
+10
-7
UserRoleLevelUtils.java
...n/java/cn/wisenergy/service/utils/UserRoleLevelUtils.java
+21
-1
application-dev.yml
wisenergy-web-admin/src/main/resources/application-dev.yml
+1
-1
application.yml
wisenergy-web-admin/src/main/resources/application.yml
+1
-1
No files found.
wisenergy-common/src/main/java/cn/wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
View file @
3ad75783
...
...
@@ -46,7 +46,7 @@ public enum BASE_RESP_CODE_ENUM {
PROJECT_NOT_HAVE_USER
(
"624"
,
"该部门下没有项目"
),
USER_LOGIN_NAME_OR_PASSWORD_IS_ERROR
(
"625"
,
"用户名或密码不正确"
),
DELETE_OLD_WORK_ORDER_FAIL
(
"626"
,
"删除旧工单数据失败"
),
WORK_DAY_THAN_DATE
(
"627"
,
"超过3天的工单不能补报
"
),
DUPLICATEROLEPERMISSIONS
(
"627"
,
"角色权限重复!
"
),
DES_NOT_NULL
(
"628"
,
"工作简述不能为空"
),
WORK_PROJECT_IS_NULL
(
"629"
,
"项目或商机为空"
),
WORK_ORDER_END
(
"630"
,
"该项目暂无待审批工单"
),
...
...
@@ -78,7 +78,8 @@ public enum BASE_RESP_CODE_ENUM {
THEPERIOD_CANNOT_BELESS_THANONEDAY
(
"658"
,
"设置的期限不能小于1天"
),
DUPLICATE_HOLIDAY_NAME
(
"659"
,
"节假日名称重复"
),
DEPARTMENT_MANAGER_ALREADY_EXISTS
(
"660"
,
"该部门已有部门负责人"
),
CENTERMANAGERALREADYEXISTS
(
"661"
,
"该中心已经有中心负责人"
)
CENTERMANAGERALREADYEXISTS
(
"661"
,
"该中心已经有中心负责人"
),
ROLE_CANNOTBE_EMPTY
(
"662"
,
"设置的角色不能为空"
),
;
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/WorkLevel.java
View file @
3ad75783
...
...
@@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@ApiModel
(
value
=
"WorkLevel"
,
description
=
"权限实体类"
)
public
class
WorkLevel
{
public
class
WorkLevel
implements
Comparable
<
WorkLevel
>
{
@ApiModelProperty
(
name
=
"id"
,
value
=
"主键"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
...
...
@@ -23,12 +23,18 @@ public class WorkLevel {
@ApiModelProperty
(
name
=
"rank"
,
value
=
"权限等级->1:项目级 2:部门级 3:中心级"
)
private
Integer
rank
;
@ApiModelProperty
(
name
=
"icon"
,
value
=
"图标"
)
private
String
icon
;
@ApiModelProperty
(
name
=
"path"
,
value
=
"路径"
)
private
String
path
;
@ApiModelProperty
(
name
=
"sort"
,
value
=
"排序"
)
private
Integer
sort
;
@Override
public
int
compareTo
(
WorkLevel
o
)
{
return
this
.
sort
-
o
.
sort
;
}
}
wisenergy-model/src/main/java/cn/wisenergy/model/app/WorkType.java
View file @
3ad75783
...
...
@@ -18,7 +18,7 @@ import java.io.Serializable;
@ApiModel
(
value
=
"WorkType"
,
description
=
"项目类型类"
)
public
class
WorkType
implements
Serializable
,
Comparable
{
private
final
static
Integer
[]
TYPE_ORDER
=
{
1
,
2
,
5
,
6
,
7
,
3
,
4
};
private
final
static
Integer
[]
TYPE_ORDER
=
{
1
,
3
,
2
};
private
static
final
long
serialVersionUID
=
8842083047098059912L
;
@ApiModelProperty
(
name
=
"id"
,
value
=
"主键id"
)
...
...
@@ -38,10 +38,10 @@ public class WorkType implements Serializable, Comparable{
int
thisI
=
0
;
int
oI
=
0
;
for
(
int
i
=
0
;
i
<
TYPE_ORDER
.
length
;
i
++)
{
if
(
id
.
equals
(
TYPE_ORDER
[
i
]))
{
if
(
reviewer
.
equals
(
TYPE_ORDER
[
i
]))
{
thisI
=
i
;
}
if
(
workType
.
get
Id
().
equals
(
TYPE_ORDER
[
i
]))
{
if
(
workType
.
get
Reviewer
().
equals
(
TYPE_ORDER
[
i
]))
{
oI
=
i
;
}
}
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkUserServiceImpl.java
View file @
3ad75783
...
...
@@ -28,10 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* <p>
...
...
@@ -191,7 +188,9 @@ public class WorkUserServiceImpl implements WorkUserService {
public
Boolean
modifyRole
(
Integer
userId
,
List
<
Integer
>
roleIds
,
Integer
status
)
{
log
.
info
(
"WorkUserServiceImpl[]modifyRole[].input.param.userId:{},roleIds:{},status:{}"
+
userId
,
roleIds
,
status
);
PageHelper
.
clearPage
();
if
(
UserRoleLevelUtils
.
levelIsRepeat
(
roleIds
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
DUPLICATEROLEPERMISSIONS
);
}
WorkUser
workUser
=
workUserMapper
.
selectById
(
userId
);
if
(
null
==
workUser
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
QUERY_DATA_IS_NULL
);
...
...
@@ -257,7 +256,7 @@ public class WorkUserServiceImpl implements WorkUserService {
}
@Override
public
ResultUser
login
(
String
loginName
,
String
password
,
String
source
)
{
public
ResultUser
login
(
String
loginName
,
String
password
,
String
source
)
{
log
.
info
(
"WorkUserServiceImpl[]login[].input.param"
+
loginName
+
password
+
source
);
if
(
StringUtils
.
isEmpty
(
loginName
)
||
StringUtils
.
isEmpty
(
password
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
...
...
@@ -291,7 +290,11 @@ public class WorkUserServiceImpl implements WorkUserService {
ResultUser
resultUser
=
getResultUser
(
user
);
resultUser
.
setDay
(
byId
.
getSubmitTime
());
List
<
Integer
>
levelIds
=
UserRoleLevelUtils
.
getlevelIds
(
roles
);
resultUser
.
setWorkLevels
(
UserRoleLevelUtils
.
getlevelByIds
(
levelIds
));
List
<
WorkLevel
>
workLevels
=
UserRoleLevelUtils
.
getlevelByIds
(
levelIds
);
if
(!
CollectionUtils
.
isEmpty
(
workLevels
))
{
Collections
.
sort
(
workLevels
);
resultUser
.
setWorkLevels
(
workLevels
);
}
return
resultUser
;
}
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/utils/UserRoleLevelUtils.java
View file @
3ad75783
...
...
@@ -9,7 +9,6 @@ import cn.wisenergy.mapper.WorkUserRoleMapper;
import
cn.wisenergy.model.app.WorkLevel
;
import
cn.wisenergy.model.app.WorkRole
;
import
cn.wisenergy.model.dto.UserRoleLevelDto
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -18,7 +17,9 @@ import org.springframework.util.CollectionUtils;
import
javax.annotation.PostConstruct
;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
@Component
public
class
UserRoleLevelUtils
{
...
...
@@ -162,5 +163,24 @@ public class UserRoleLevelUtils {
return
false
;
}
/**
* 判断权限是否重复
*/
public
static
Boolean
levelIsRepeat
(
List
<
Integer
>
roles
)
{
if
(
CollectionUtils
.
isEmpty
(
roles
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
ROLE_CANNOTBE_EMPTY
);
}
List
<
Integer
>
getlevelIds
=
getlevelIds
(
roles
);
Set
<
Integer
>
hashSet
=
new
HashSet
<>();
for
(
Integer
id
:
getlevelIds
)
{
if
(!
hashSet
.
add
(
id
)){
//有重复值
return
true
;
}
}
return
false
;
}
}
wisenergy-web-admin/src/main/resources/application-dev.yml
View file @
3ad75783
...
...
@@ -3,7 +3,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://192.168.110.84:3306/work_
hours
?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://192.168.110.84:3306/work_
test
?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username
:
root
password
:
admin!@#123
initial-size
:
10
...
...
wisenergy-web-admin/src/main/resources/application.yml
View file @
3ad75783
...
...
@@ -3,7 +3,7 @@ server:
uri-encoding
:
UTF-8
max-threads
:
1000
min-spare-threads
:
30
port
:
808
1
port
:
808
0
connection-timeout
:
5000ms
spring
:
...
...
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