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
f261e857
Commit
f261e857
authored
Mar 17, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
0ac2a96d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
6 deletions
+25
-6
DateUtils.java
...on/src/main/java/cn/wisenergy/common/utils/DateUtils.java
+10
-0
WorkTimeOrderMapper.xml
...-mapper/src/main/resources/mapper/WorkTimeOrderMapper.xml
+4
-2
DeptUserCollectDto.java
.../main/java/cn/wisenergy/model/dto/DeptUserCollectDto.java
+1
-0
WorkCollectServiceImpl.java
...ava/cn/wisenergy/service/impl/WorkCollectServiceImpl.java
+7
-4
WorkTimeOrderServiceImpl.java
...a/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
+3
-0
No files found.
wisenergy-common/src/main/java/cn/wisenergy/common/utils/DateUtils.java
View file @
f261e857
...
...
@@ -153,6 +153,16 @@ public class DateUtils {
}
}
public
static
Date
bigDateToShortDate
(
Date
date
)
{
String
s
=
dateToShortString
(
date
);
try
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
return
simpleDateFormat
.
parse
(
s
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* return date value of specified string value in format: HH:mm:ss
*
...
...
wisenergy-mapper/src/main/resources/mapper/WorkTimeOrderMapper.xml
View file @
f261e857
...
...
@@ -417,6 +417,7 @@
<result
property=
"userName"
column=
"user_name"
/>
<result
property=
"deptId"
column=
"dept_id"
/>
<result
property=
"deptName"
column=
"dept_name"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<collection
property=
"workDay"
javaType=
"ArrayList"
ofType =
"java.util.Date"
>
...
...
@@ -426,13 +427,14 @@
<select
id=
"getDeptNotOrderInfo"
resultMap=
"DeptUserCollectDto"
>
select d.id as 'dept_id'
,d.dept_name,u.id as 'user_id',u.name as 'user_name'
,c.work_day
select d.id as 'dept_id'
,d.dept_name,u.id as 'user_id',u.name as 'user_name',u.create_time
,c.work_day
from work_user u LEFT JOIN work_collect c ON u.id = c.user_id LEFT JOIN work_dept d on u.dept_id = d.id
<where>
u.submit_order = 1 and u.`status` = 1 and c.`status` !=3 and c.total_time = 8
u.submit_order = 1 and u.`status` = 1 and
(
c.`status` !=3 and c.total_time = 8
<if
test=
" startDate !=null and endDate !=null"
>
and c.work_day between #{startDate} and #{endDate}
</if>
) or (c.work_day is null and u.submit_order = 1 and u.`status` = 1)
<if
test=
"depts !=null and depts.size()>0"
>
AND d.id in
<foreach
collection=
"depts"
item=
"dept"
open=
"("
close=
")"
separator=
","
>
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/dto/DeptUserCollectDto.java
View file @
f261e857
...
...
@@ -13,6 +13,7 @@ import java.util.List;
public
class
DeptUserCollectDto
{
private
Integer
userId
;
private
String
userName
;
private
Date
createTime
;
private
Integer
deptId
;
private
String
deptName
;
List
<
Date
>
workDay
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkCollectServiceImpl.java
View file @
f261e857
package
cn
.
wisenergy
.
service
.
impl
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.common.utils.DateUtils
;
import
cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM
;
import
cn.wisenergy.common.utils.exception.BaseCustomException
;
import
cn.wisenergy.mapper.WorkCollectMapper
;
...
...
@@ -97,7 +98,7 @@ public class WorkCollectServiceImpl implements WorkCollectService {
// 如果查询的日期大于本月的日期,则不查询
if
(
1
==
user
.
getSubmitOrder
()
&&
workMonth
.
compareTo
(
new
Date
())<=
0
)
{
List
<
Date
>
notCompletedByMonth
=
getNotCompletedByMonth
(
user
Id
,
workMonth
);
List
<
Date
>
notCompletedByMonth
=
getNotCompletedByMonth
(
user
,
workMonth
);
StringBuffer
sb
=
new
StringBuffer
();
if
(!
CollectionUtils
.
isEmpty
(
notCompletedByMonth
))
{
notCompletedByMonth
.
forEach
(
notComplete
->
sb
.
append
(
DateUtil
.
getDay
(
notComplete
)).
append
(
"日,"
)
);
...
...
@@ -187,14 +188,16 @@ public class WorkCollectServiceImpl implements WorkCollectService {
/**
* 获取当月已经填的并满8小时
* @param user
Id 用户id
* @param user
用户
* @param month 日期
* @return 日期集合
*/
private
List
<
Date
>
getNotCompletedByMonth
(
Integer
userId
,
Date
month
)
{
private
List
<
Date
>
getNotCompletedByMonth
(
WorkUser
user
,
Date
month
)
{
boolean
flag
=
DateUtil
.
isYearAndMonthEqual
(
month
,
new
Date
());
List
<
Date
>
workDays
=
statisticsService
.
currentMonthWorkDays
(
month
,
flag
);
List
<
WorkCollect
>
completedCollect
=
workCollectMapper
.
getCompletedByUserIdAndMonth
(
userId
,
month
);
Date
createDate
=
DateUtils
.
bigDateToShortDate
(
user
.
getCreateTime
());
workDays
.
removeIf
(
date1
->
date1
.
compareTo
(
createDate
)
<
0
);
List
<
WorkCollect
>
completedCollect
=
workCollectMapper
.
getCompletedByUserIdAndMonth
(
user
.
getId
(),
month
);
List
<
Date
>
completedDays
=
new
ArrayList
<>();
completedCollect
.
forEach
(
collect
->
completedDays
.
add
(
collect
.
getWorkDay
()));
workDays
.
removeAll
(
completedDays
);
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
View file @
f261e857
package
cn
.
wisenergy
.
service
.
impl
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.common.utils.DateUtils
;
import
cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM
;
import
cn.wisenergy.common.utils.exception.BaseCustomException
;
import
cn.wisenergy.mapper.WorkProjectMapper
;
...
...
@@ -1003,6 +1004,8 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
for
(
DeptUserCollectDto
deptUserCollectDto
:
deptNotOrderInfo
)
{
UserDto
userDto
=
new
UserDto
();
List
<
Date
>
workDays1
=
new
ArrayList
<>(
workDays
);
Date
createDate
=
DateUtils
.
bigDateToShortDate
(
deptUserCollectDto
.
getCreateTime
());
workDays1
.
removeIf
(
date1
->
date1
.
compareTo
(
createDate
)
<
0
);
userDto
.
setId
(
deptUserCollectDto
.
getUserId
());
userDto
.
setName
(
deptUserCollectDto
.
getUserName
());
workDays1
.
removeAll
(
deptUserCollectDto
.
getWorkDay
());
...
...
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