Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
69e136a8
Commit
69e136a8
authored
Mar 06, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
01dc286d
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
150 additions
and
124 deletions
+150
-124
BASE_RESP_CODE_ENUM.java
...wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
+1
-1
WorkProjectMapper.xml
...gy-mapper/src/main/resources/mapper/WorkProjectMapper.xml
+14
-1
WorkUserRoleMapper.xml
...y-mapper/src/main/resources/mapper/WorkUserRoleMapper.xml
+2
-1
WorkProject.java
...del/src/main/java/cn/wisenergy/model/app/WorkProject.java
+6
-0
ManagerProjectsDto.java
.../main/java/cn/wisenergy/model/dto/ManagerProjectsDto.java
+7
-1
ChangeTypeEnum.java
...rc/main/java/cn/wisenergy/model/enums/ChangeTypeEnum.java
+2
-1
WorkOrderType.java
...src/main/java/cn/wisenergy/model/enums/WorkOrderType.java
+0
-43
CreateProjectVo.java
.../src/main/java/cn/wisenergy/model/vo/CreateProjectVo.java
+6
-0
ModifyProjectVo.java
.../src/main/java/cn/wisenergy/model/vo/ModifyProjectVo.java
+8
-0
WorkProjectServiceImpl.java
...ava/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
+98
-72
UserRoleLevelUtils.java
...n/java/cn/wisenergy/service/utils/UserRoleLevelUtils.java
+6
-4
No files found.
wisenergy-common/src/main/java/cn/wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
View file @
69e136a8
...
...
@@ -81,7 +81,7 @@ public enum BASE_RESP_CODE_ENUM {
CENTERMANAGERALREADYEXISTS
(
"661"
,
"该中心已经有中心负责人"
),
ROLE_CANNOTBE_EMPTY
(
"662"
,
"设置的角色不能为空"
),
NOADMIN_ISTRATIVE_RIGHTS
(
"663"
,
"设置的负责人没有管理权限"
),
NON_PROJECT_OPPORTUNITYNUMBERNAME_ISEMPTY
(
"664"
,
"非项目,无商机属性"
)
;
...
...
wisenergy-mapper/src/main/resources/mapper/WorkProjectMapper.xml
View file @
69e136a8
...
...
@@ -17,11 +17,13 @@
<result
column=
"end_time"
property=
"endTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"modify_time"
property=
"modifyTime"
/>
<result
column=
"business_id"
property=
"businessId"
/>
<result
column=
"business_name"
property=
"businessName"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, oa_project_id, project_name, type, manager_id, dept_id, work_time, cost_budget, is_conclusion,start_time,end_time, create_time, modify_time
id, oa_project_id, project_name,
business_id,business_name,
type, manager_id, dept_id, work_time, cost_budget, is_conclusion,start_time,end_time, create_time, modify_time
</sql>
<sql
id=
"table"
>
...
...
@@ -32,6 +34,8 @@
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"oaProjectId != null"
>
and oa_project_id = #{oaProjectId}
</if>
<if
test=
"projectName != null"
>
and project_name = #{projectName}
</if>
<if
test=
"businessId !=null"
>
and business_id = #{businessId}
</if>
<if
test=
"businessName !=null"
>
and business_name = #{businessName}
</if>
<if
test=
"type != null"
>
and `type` =#{type}
</if>
<if
test=
"managerId != null"
>
and manager_id = #{managerId}
</if>
<if
test=
"deptId != null"
>
and dept_id = #{deptId}
</if>
...
...
@@ -69,6 +73,15 @@
<if
test=
"null != managerId"
>
manager_id = #{managerId},
</if>
<if
test=
"null != deptId"
>
dept_id = #{deptId},
</if>
<if
test=
"null != businessId"
>
business_id = #{businessId},
</if>
<if
test=
"null != businessName"
>
business_name = #{businessName},
</if>
modify_time = now()
</set>
<where>
...
...
wisenergy-mapper/src/main/resources/mapper/WorkUserRoleMapper.xml
View file @
69e136a8
...
...
@@ -37,8 +37,9 @@ ORDER BY rank desc
select u.id,u.name,u.dept_id
from work_user_role r left JOIN work_user u on r.user_id = u.id
<where>
u.status = 1
<if
test=
"null != roleId"
>
r.role_id = #{roleId}
AND
r.role_id = #{roleId}
</if>
group by r.user_id
</where>
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/WorkProject.java
View file @
69e136a8
...
...
@@ -37,6 +37,12 @@ public class WorkProject implements Serializable {
@ApiModelProperty
(
name
=
"projectName"
,
value
=
"项目名称"
)
private
String
projectName
;
@ApiModelProperty
(
name
=
"businessId"
,
value
=
"商机编号"
)
private
String
businessId
;
@ApiModelProperty
(
name
=
"businessName"
,
value
=
"商机名称"
)
private
String
businessName
;
@ApiModelProperty
(
name
=
"type"
,
value
=
"1:项目,2:商机"
)
private
Integer
type
;
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/dto/ManagerProjectsDto.java
View file @
69e136a8
...
...
@@ -31,11 +31,17 @@ public class ManagerProjectsDto implements Serializable {
@ApiModelProperty
(
name
=
"projectName"
,
value
=
"项目名称"
)
private
String
projectName
;
@ApiModelProperty
(
name
=
"businessId"
,
value
=
"商机编号"
)
private
String
businessId
;
@ApiModelProperty
(
name
=
"businessName"
,
value
=
"商机名称"
)
private
String
businessName
;
@ApiModelProperty
(
name
=
"type"
,
value
=
"1:项目,2:商机"
)
private
Integer
type
;
@ApiModelProperty
(
name
=
"managerId"
,
value
=
"项目负责人id"
)
private
Integer
managerId
;
private
String
managerId
;
@ApiModelProperty
(
name
=
"managerName"
,
value
=
"项目负责人名字"
)
private
String
managerName
;
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/enums/ChangeTypeEnum.java
View file @
69e136a8
...
...
@@ -9,7 +9,8 @@ public enum ChangeTypeEnum {
WORKINGHOURSBUDGET
(
2
,
"工时预算(人/天)"
),
STARTINGTIME
(
3
,
"预计开始时间"
),
ENDTIME
(
4
,
"预计结束时间"
),
MANAGER
(
5
,
"项目/商机负责人"
)
MANAGER
(
5
,
"项目/商机负责人"
),
DEPARTMENT
(
6
,
"项目/商机所属部门"
)
;
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/enums/WorkOrderType.java
deleted
100644 → 0
View file @
01dc286d
package
cn
.
wisenergy
.
model
.
enums
;
public
enum
WorkOrderType
{
PROJECT
(
1
,
"项目"
),
BUSINESS
(
2
,
"商机"
),
LEAVE
(
3
,
"请假"
),
CONMPENSATORY_LEAVE
(
4
,
"调休"
),
EXTERNAL_WORK
(
5
,
"外部商务、技术交流"
),
INTERNAL_WORK
(
6
,
"内部培训、技术准备、管理"
),
OTHER_NOT_PROJECT_BUSINESS
(
7
,
"其他非项目、商机工作"
);
private
Integer
code
;
private
String
desc
;
WorkOrderType
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
wisenergy-model/src/main/java/cn/wisenergy/model/vo/CreateProjectVo.java
View file @
69e136a8
...
...
@@ -47,4 +47,10 @@ public class CreateProjectVo {
@ApiModelProperty
(
name
=
"deptId"
,
value
=
"部门id"
)
private
Integer
deptId
;
@ApiModelProperty
(
name
=
"businessId"
,
value
=
"商机编号"
)
private
String
businessId
;
@ApiModelProperty
(
name
=
"businessName"
,
value
=
"商机名称"
)
private
String
businessName
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/vo/ModifyProjectVo.java
View file @
69e136a8
...
...
@@ -26,6 +26,10 @@ public class ModifyProjectVo {
private
List
<
Integer
>
userIds
;
private
Integer
deptId
;
private
String
deptIdReason
;
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
)
private
Date
startTime
;
...
...
@@ -43,4 +47,8 @@ public class ModifyProjectVo {
private
BigDecimal
costBudget
;
private
String
costBudgetReason
;
private
String
businessId
;
private
String
businessName
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
View file @
69e136a8
...
...
@@ -16,10 +16,7 @@ import cn.wisenergy.model.enums.ManagerEnum;
import
cn.wisenergy.model.vo.CreateProjectVo
;
import
cn.wisenergy.model.vo.GetManagerProjectsVo
;
import
cn.wisenergy.model.vo.ModifyProjectVo
;
import
cn.wisenergy.service.WorkProjectChangeService
;
import
cn.wisenergy.service.WorkProjectService
;
import
cn.wisenergy.service.WorkUserProjectService
;
import
cn.wisenergy.service.WorkUserService
;
import
cn.wisenergy.service.*
;
import
cn.wisenergy.service.utils.UserRoleLevelUtils
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.github.pagehelper.PageHelper
;
...
...
@@ -60,6 +57,9 @@ public class WorkProjectServiceImpl implements WorkProjectService {
@Autowired
private
WorkDeptMapper
workDeptMapper
;
@Autowired
private
WorkDeptService
workDeptService
;
@Autowired
private
WorkCentreMapper
workCentreMapper
;
...
...
@@ -313,18 +313,23 @@ public class WorkProjectServiceImpl implements WorkProjectService {
// 2.更新表数据
// 更新workProject数据
if
(!
StringUtils
.
isBlank
(
modifyProjectVo
.
getStartTimeReason
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getEndTimeReason
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getWorkTimeReason
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getCostBudgetReason
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getManageIdReason
())
)
{
int
i
=
workProjectMapper
.
updateProject
(
modifyProjectVo
);
if
(
i
==
0
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
UPDATE_DATA_FAIL
);
}
// 向workProjectChange插入内容
List
<
WorkProjectChange
>
workProjectChanges
=
new
ArrayList
<>();
if
(!
StringUtils
.
isBlank
(
modifyProjectVo
.
getDeptIdReason
()))
{
WorkProjectChange
workProjectChange
=
new
WorkProjectChange
();
workProjectChange
.
setProjectId
(
modifyProjectVo
.
getProjectId
());
workProjectChange
.
setModifyTime
(
new
Date
());
workProjectChange
.
setChangeType
(
6
);
workProjectChange
.
setModifyBefore
(
workDeptService
.
getById
(
workProject
.
getDeptId
()).
getDeptName
());
workProjectChange
.
setModifyAfter
(
workDeptService
.
getById
(
modifyProjectVo
.
getDeptId
()).
getDeptName
());
workProjectChange
.
setReason
(
modifyProjectVo
.
getDeptIdReason
());
workProjectChanges
.
add
(
workProjectChange
);
}
if
(!
StringUtils
.
isBlank
(
modifyProjectVo
.
getManageIdReason
()))
{
WorkProjectChange
workProjectChange
=
new
WorkProjectChange
();
workProjectChange
.
setProjectId
(
modifyProjectVo
.
getProjectId
());
...
...
@@ -376,10 +381,10 @@ public class WorkProjectServiceImpl implements WorkProjectService {
workProjectChange
.
setReason
(
modifyProjectVo
.
getCostBudgetReason
());
workProjectChanges
.
add
(
workProjectChange
);
}
if
(!
CollectionUtils
.
isEmpty
(
workProjectChanges
))
{
workProjectChangeService
.
insertbatch
(
workProjectChanges
);
}
// 更新workUserProject数据
if
(!
userIds
.
containsAll
(
modifyProjectVo
.
getUserIds
())
||
!
modifyProjectVo
.
getUserIds
().
containsAll
(
userIds
))
{
// 先删除,后插入
...
...
@@ -402,7 +407,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if
(
null
==
createProjectVo
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
if
(
null
==
createProjectVo
.
getManagerId
()
||
null
==
createProjectVo
.
getStartTime
()
||
null
==
createProjectVo
.
getEndTime
()
||
StringUtils
.
isBlank
(
createProjectVo
.
getOaProjectId
())
||
null
==
createProjectVo
.
getWorkTime
()
||
null
==
createProjectVo
.
getCostBudget
()
||
if
(
null
==
createProjectVo
.
getManagerId
()
||
null
==
createProjectVo
.
getStartTime
()
||
null
==
createProjectVo
.
getEndTime
()
||
StringUtils
.
isBlank
(
createProjectVo
.
getOaProjectId
())
||
null
==
createProjectVo
.
getWorkTime
()
||
null
==
createProjectVo
.
getCostBudget
()
||
null
==
createProjectVo
.
getDeptId
()
||
StringUtils
.
isBlank
(
createProjectVo
.
getProjectName
())
||
CollectionUtils
.
isEmpty
(
createProjectVo
.
getUserIds
())
||
null
==
createProjectVo
.
getDeptId
())
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
...
...
@@ -452,6 +457,19 @@ public class WorkProjectServiceImpl implements WorkProjectService {
* 判断更变内容是否等于原内容
*/
private
void
verificationItem
(
ModifyProjectVo
modifyProjectVo
,
WorkProject
workProject
,
List
<
Integer
>
userIds
)
{
// 校验商机编号/商机名称(只有项目才能编辑)
if
(
1
!=
workProject
.
getType
()
&&
(!
StringUtils
.
isBlank
(
modifyProjectVo
.
getBusinessId
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getBusinessName
())))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
NON_PROJECT_OPPORTUNITYNUMBERNAME_ISEMPTY
);
}
// 校验部门
if
(!
workProject
.
getDeptId
().
equals
(
modifyProjectVo
.
getDeptId
()))
{
if
(
StringUtils
.
isBlank
(
modifyProjectVo
.
getDeptIdReason
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
REASON_CANNOT_BE_EMPTY
);
}
}
// 校验开始时间
if
(
null
!=
modifyProjectVo
.
getStartTime
())
{
if
(
StringUtils
.
isBlank
(
modifyProjectVo
.
getStartTimeReason
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
REASON_CANNOT_BE_EMPTY
);
...
...
@@ -469,6 +487,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
theNewContent_IsEqual_ToTheOriginal_Content
);
}
}
// 校验结束时间
if
(
null
!=
modifyProjectVo
.
getEndTime
())
{
if
(
StringUtils
.
isBlank
(
modifyProjectVo
.
getEndTimeReason
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
REASON_CANNOT_BE_EMPTY
);
...
...
@@ -486,6 +505,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
theNewContent_IsEqual_ToTheOriginal_Content
);
}
}
// 校验成本预算
if
(
null
!=
modifyProjectVo
.
getCostBudget
())
{
if
(
BigDecimal
.
ZERO
.
compareTo
(
modifyProjectVo
.
getCostBudget
())
>
0
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
BUDGET_CANNOT_BELESSTHAN_ZERO
);
...
...
@@ -497,6 +517,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
theNewContent_IsEqual_ToTheOriginal_Content
);
}
}
// 校验工时预算
if
(
null
!=
modifyProjectVo
.
getWorkTime
())
{
if
(
BigDecimal
.
ZERO
.
compareTo
(
modifyProjectVo
.
getWorkTime
())
>
0
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
BUDGET_CANNOT_BELESSTHAN_ZERO
);
...
...
@@ -508,7 +529,11 @@ public class WorkProjectServiceImpl implements WorkProjectService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
theNewContent_IsEqual_ToTheOriginal_Content
);
}
}
if
(
null
!=
modifyProjectVo
.
getManagerId
())
{
// 校验负责人
if
(!
workProject
.
getManagerId
().
equals
(
modifyProjectVo
.
getManagerId
()))
{
if
(
StringUtils
.
isBlank
(
modifyProjectVo
.
getManageIdReason
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
REASON_CANNOT_BE_EMPTY
);
}
List
<
Integer
>
roles
=
UserRoleLevelUtils
.
getRole
(
modifyProjectVo
.
getManagerId
());
int
index
=
0
;
for
(
Integer
role
:
roles
)
{
...
...
@@ -521,12 +546,13 @@ public class WorkProjectServiceImpl implements WorkProjectService {
}
}
if
(
null
==
modifyProjectVo
.
getStartTime
()
&&
null
==
modifyProjectVo
.
getEndTime
()
&&
null
==
modifyProjectVo
.
getCostBudget
()
&&
null
==
modifyProjectVo
.
getWorkTime
()
&&
null
==
modifyProjectVo
.
getManagerId
())
{
/*if (null == modifyProjectVo.getStartTime() && null == modifyProjectVo.getEndTime() && null == modifyProjectVo.getCostBudget() && null == modifyProjectVo.getWorkTime() && workProject.getDeptId().equals(modifyProjectVo.getDeptId()) && workProject.getManagerId().equals(modifyProjectVo.getManagerId()) ) {
if (userIds.containsAll(modifyProjectVo.getUserIds()) &&
modifyProjectVo.getUserIds().containsAll(userIds)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.theNewContent_IsEqual_ToTheOriginal_Content);
}
}
}
*/
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/utils/UserRoleLevelUtils.java
View file @
69e136a8
...
...
@@ -172,12 +172,14 @@ public class UserRoleLevelUtils {
}
List
<
Integer
>
getlevelIds
=
getlevelIds
(
roles
);
Set
<
Integer
>
hashSet
=
new
HashSet
<>();
if
(!
CollectionUtils
.
isEmpty
(
getlevelIds
))
{
for
(
Integer
id
:
getlevelIds
)
{
if
(!
hashSet
.
add
(
id
)){
//有重复值
return
true
;
}
}
}
return
false
;
}
...
...
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