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
51d0c1c7
Commit
51d0c1c7
authored
Mar 05, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
9d8b385d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
118 additions
and
76 deletions
+118
-76
BASE_RESP_CODE_ENUM.java
...wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
+1
-0
WorkProjectMapper.xml
...gy-mapper/src/main/resources/mapper/WorkProjectMapper.xml
+85
-72
WorkTimeOrderDto.java
...rc/main/java/cn/wisenergy/model/dto/WorkTimeOrderDto.java
+8
-0
ChangeTypeEnum.java
...rc/main/java/cn/wisenergy/model/enums/ChangeTypeEnum.java
+1
-1
ModifyProjectVo.java
.../src/main/java/cn/wisenergy/model/vo/ModifyProjectVo.java
+4
-0
WorkProjectServiceImpl.java
...ava/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
+19
-3
No files found.
wisenergy-common/src/main/java/cn/wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
View file @
51d0c1c7
...
...
@@ -80,6 +80,7 @@ public enum BASE_RESP_CODE_ENUM {
DEPARTMENT_MANAGER_ALREADY_EXISTS
(
"660"
,
"该部门已有部门负责人"
),
CENTERMANAGERALREADYEXISTS
(
"661"
,
"该中心已经有中心负责人"
),
ROLE_CANNOTBE_EMPTY
(
"662"
,
"设置的角色不能为空"
),
NOADMIN_ISTRATIVE_RIGHTS
(
"663"
,
"设置的负责人没有管理权限"
),
;
...
...
wisenergy-mapper/src/main/resources/mapper/WorkProjectMapper.xml
View file @
51d0c1c7
...
...
@@ -4,19 +4,19 @@
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"cn.wisenergy.model.app.WorkProject"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"oa_project_id"
property=
"oaProjectId"
/>
<result
column=
"project_name"
property=
"projectName"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"manager_id"
property=
"managerId"
/>
<result
column=
"dept_id"
property=
"deptId"
/>
<result
column=
"work_time"
property=
"workTime"
/>
<result
column=
"cost_budget"
property=
"costBudget"
/>
<result
column=
"is_conclusion"
property=
"isConclusion"
/>
<result
column=
"start_time"
property=
"startTime"
/>
<result
column=
"end_time"
property=
"endTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"modify_time"
property=
"modifyTime"
/>
<id
column=
"id"
property=
"id"
/>
<result
column=
"oa_project_id"
property=
"oaProjectId"
/>
<result
column=
"project_name"
property=
"projectName"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"manager_id"
property=
"managerId"
/>
<result
column=
"dept_id"
property=
"deptId"
/>
<result
column=
"work_time"
property=
"workTime"
/>
<result
column=
"cost_budget"
property=
"costBudget"
/>
<result
column=
"is_conclusion"
property=
"isConclusion"
/>
<result
column=
"start_time"
property=
"startTime"
/>
<result
column=
"end_time"
property=
"endTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"modify_time"
property=
"modifyTime"
/>
</resultMap>
<!-- 通用查询结果列 -->
...
...
@@ -48,7 +48,7 @@
UPDATE
<include
refid=
"table"
/>
SET is_conclusion = 0
WHERE
id = #{id}
WHERE id = #{id}
</update>
<update
id=
"updateProject"
>
UPDATE
...
...
@@ -66,6 +66,9 @@
<if
test=
"null != costBudget"
>
cost_budget =#{costBudget},
</if>
<if
test=
"null != managerId"
>
manager_id = #{managerId},
</if>
modify_time = now()
</set>
<where>
...
...
@@ -79,30 +82,34 @@
</update>
<select
id=
"getProjectsByCriteria"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"table"
/>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"table"
/>
<where>
<if
test=
"isConclusion != null"
>
is_conclusion = #{isConclusion}
</if>
<if
test=
"managerId != null"
>
AND
manager_id = #{managerId}
</if>
<if
test=
"deptId != null"
>
OR dept_id = #{deptId}
</if>
<if
test=
"deptIds != null"
>
OR dept_id IN
<foreach
collection=
"deptIds"
item=
"deptId"
separator=
","
open=
"("
close=
")"
>
#{deptId}
</foreach>
</if>
<if
test=
"isConclusion != null"
>
is_conclusion = #{isConclusion}
</if>
<if
test=
"managerId != null"
>
AND
manager_id = #{managerId}
</if>
<if
test=
"deptId != null"
>
OR dept_id = #{deptId}
</if>
<if
test=
"deptIds != null"
>
OR dept_id IN
<foreach
collection=
"deptIds"
item=
"deptId"
separator=
","
open=
"("
close=
")"
>
#{deptId}
</foreach>
</if>
</where>
</select>
<select
id=
"getProjectsByIds"
resultType=
"cn.wisenergy.model.app.WorkProject"
>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"table"
/>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"table"
/>
<where>
<if
test=
"ids != null"
>
...
...
@@ -117,66 +124,72 @@
</where>
</select>
<select
id=
"getManagerProjectsDto"
resultType=
"cn.wisenergy.model.dto.ManagerProjectsDto"
>
select p.id,p.oa_project_id,p.project_name,p.type,p.create_time,p.is_conclusion,
GROUP_CONCAT(DISTINCT(u.name)) as 'participants',p.cost_budget,p.work_time,p.start_time,p.end_time,
if(cost is NULL,0,0 + cast(cost as char)) as 'currentLaborCost',if(total_time is NULL,0,0 + cast(total_time as char)) as 'totalCurrentWorkingHours',
if(p.end_time>=curdate(),'否','是') as 'isItOverdue',
if(p.create_time = p.modify_time,'否','是') as 'isThereABudgetChange'
select
p.id,p.oa_project_id,p.project_name,p.manager_id,p.dept_id,p.modify_time,p.type,p.create_time,p.is_conclusion,
GROUP_CONCAT(DISTINCT(u.name)) as 'participants',p.cost_budget,p.work_time,p.start_time,p.end_time,
if(cost is NULL,0,0 + cast(cost as char)) as 'currentLaborCost',if(total_time is NULL,0,0 + cast(total_time as
char)) as 'totalCurrentWorkingHours',
if(p.end_time>=curdate(),'否','是') as 'isItOverdue',
if(p.create_time = p.modify_time,'否','是') as 'isThereABudgetChange'
from work_project p LEFT JOIN (select project_id,SUM(total_time) as 'total_time',SUM(cost)/10000 as 'cost'
FROM work_project_time_cost
GROUP BY project_id) o on p.id = o.project_id
LEFT JOIN work_user_project up ON p.id = up.project_id
LEFT JOIN work_user u on u.id = up.user_id
<where>
<if
test=
"null != userId"
>
AND p.manager_id = #{userId}
</if>
<if
test=
"null !=type"
>
AND p.type = #{type}
</if>
<if
test=
"null !=isConclusion"
>
AND p.is_conclusion = #{isConclusion}
</if>
<if
test=
"deptIds != null"
>
OR (p.dept_id IN
<foreach
collection=
"deptIds"
item=
"deptId"
separator=
","
open=
"("
close=
")"
>
#{deptId}
</foreach>
<if
test=
"null !=isConclusion"
>
AND p.is_conclusion = #{isConclusion}
</if>
<if
test=
"null !=type"
>
AND p.type = #{type}
</if>
)
</if>
<where>
</where>
<if
test=
"null != userId"
>
AND p.manager_id = #{userId}
</if>
<if
test=
"null !=type"
>
AND p.type = #{type}
</if>
<if
test=
"null !=isConclusion"
>
AND p.is_conclusion = #{isConclusion}
</if>
GROUP BY p.id
ORDER BY p.is_conclusion DESC, p.create_time DESC
<if
test=
"deptIds != null"
>
OR (p.dept_id IN
<foreach
collection=
"deptIds"
item=
"deptId"
separator=
","
open=
"("
close=
")"
>
#{deptId}
</foreach>
<if
test=
"null !=isConclusion"
>
AND p.is_conclusion = #{isConclusion}
</if>
<if
test=
"null !=type"
>
AND p.type = #{type}
</if>
)
</if>
</where>
GROUP BY p.id
ORDER BY p.is_conclusion DESC, p.create_time DESC
</select>
<select
id=
"getListByCriteria"
resultType=
"cn.wisenergy.model.app.WorkProject"
>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"table"
/>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"table"
/>
<where>
<include
refid=
"criteria"
/>
</where>
</select>
<select
id=
"getProjectIdByManager"
resultType=
"java.lang.Integer"
>
select id
from
<include
refid=
"table"
/>
where manager_id = #{userId}
select id
from
<include
refid=
"table"
/>
where manager_id = #{userId}
</select>
<select
id=
"getListByCentreIdAndIsConclusion"
resultType=
"cn.wisenergy.model.app.WorkProject"
>
select
<include
refid=
"Base_Column_List"
/>
select
<include
refid=
"Base_Column_List"
/>
from work_project p join work_dept d on p.dept_id = d.id
where centre_id = #{centreId}
<if
test=
"isConclusion != null"
>
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/dto/WorkTimeOrderDto.java
View file @
51d0c1c7
...
...
@@ -61,6 +61,14 @@ public class WorkTimeOrderDto {
@ApiModelProperty
(
name
=
"isOvertime"
,
value
=
"0:正常工时,1:加班"
)
private
Integer
isOvertime
;
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
)
@ApiModelProperty
(
name
=
"createTime"
,
value
=
"工单创建时间"
)
private
Date
createTime
;
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
)
@ApiModelProperty
(
name
=
"modifyTime"
,
value
=
"审批时间"
)
private
Date
modifyTime
;
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
)
@ApiModelProperty
(
name
=
"rejectTime"
,
value
=
"驳回时间"
)
private
Date
rejectTime
;
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/enums/ChangeTypeEnum.java
View file @
51d0c1c7
...
...
@@ -9,7 +9,7 @@ public enum ChangeTypeEnum {
WORKINGHOURSBUDGET
(
2
,
"工时预算(人/天)"
),
STARTINGTIME
(
3
,
"预计开始时间"
),
ENDTIME
(
4
,
"预计结束时间"
),
MANAGER
(
5
,
"项目/商机负责人"
)
;
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/vo/ModifyProjectVo.java
View file @
51d0c1c7
...
...
@@ -18,6 +18,10 @@ import java.util.List;
@ApiModel
(
value
=
"ModifyProjectVo"
,
description
=
"项目编辑VO"
)
public
class
ModifyProjectVo
{
private
Integer
managerId
;
private
String
manageIdReason
;
private
Integer
projectId
;
private
List
<
Integer
>
userIds
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
View file @
51d0c1c7
...
...
@@ -316,15 +316,25 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if
(!
StringUtils
.
isBlank
(
modifyProjectVo
.
getStartTimeReason
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getEndTimeReason
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getWorkTimeReason
())
||
!
StringUtils
.
isBlank
(
modifyProjectVo
.
getCostBudgetReason
())
!
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
.
getManageIdReason
()))
{
WorkProjectChange
workProjectChange
=
new
WorkProjectChange
();
workProjectChange
.
setProjectId
(
modifyProjectVo
.
getProjectId
());
workProjectChange
.
setModifyTime
(
new
Date
());
workProjectChange
.
setChangeType
(
5
);
workProjectChange
.
setModifyBefore
(
workUserService
.
getById
(
workProject
.
getManagerId
()).
getName
());
workProjectChange
.
setModifyAfter
(
workUserService
.
getById
(
modifyProjectVo
.
getManagerId
()).
getName
());
workProjectChange
.
setReason
(
modifyProjectVo
.
getManageIdReason
());
workProjectChanges
.
add
(
workProjectChange
);
}
if
(!
StringUtils
.
isBlank
(
modifyProjectVo
.
getStartTimeReason
()))
{
WorkProjectChange
workProjectChange
=
new
WorkProjectChange
();
workProjectChange
.
setProjectId
(
modifyProjectVo
.
getProjectId
());
...
...
@@ -498,8 +508,14 @@ public class WorkProjectServiceImpl implements WorkProjectService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
theNewContent_IsEqual_ToTheOriginal_Content
);
}
}
if
(
null
!=
modifyProjectVo
.
getManagerId
())
{
List
<
Integer
>
role
=
UserRoleLevelUtils
.
getRole
(
modifyProjectVo
.
getManagerId
());
if
(
1
==
role
.
size
()
&&
role
.
get
(
0
).
equals
(
0
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
NOADMIN_ISTRATIVE_RIGHTS
);
}
}
if
(
null
==
modifyProjectVo
.
getStartTime
()
&&
null
==
modifyProjectVo
.
getEndTime
()
&&
null
==
modifyProjectVo
.
getCostBudget
()
&&
null
==
modifyProjectVo
.
getWorkTime
())
{
if
(
null
==
modifyProjectVo
.
getStartTime
()
&&
null
==
modifyProjectVo
.
getEndTime
()
&&
null
==
modifyProjectVo
.
getCostBudget
()
&&
null
==
modifyProjectVo
.
getWorkTime
()
&&
null
==
modifyProjectVo
.
getManagerId
()
)
{
if
(
userIds
.
containsAll
(
modifyProjectVo
.
getUserIds
())
&&
modifyProjectVo
.
getUserIds
().
containsAll
(
userIds
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
theNewContent_IsEqual_ToTheOriginal_Content
);
...
...
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