Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 501b3971
authored
Jul 11, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix:周x;hutool里面,1==>周日;此处自己实现
1 parent
dbd42313
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
6 deletions
project-order/src/main/java/com/dituhui/pea/order/common/DateUtil.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessTeamServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/common/DateUtil.java
0 → 100644
View file @
501b397
package
com
.
dituhui
.
pea
.
order
.
common
;
import
java.time.DayOfWeek
;
import
java.time.LocalDate
;
import
java.time.format.TextStyle
;
import
java.util.Locale
;
public
class
DateUtil
{
public
static
String
toWeekChinese
(
String
date
)
{
LocalDate
d
=
LocalDate
.
parse
(
date
);
return
DateUtil
.
toWeekChinese
(
d
.
getDayOfWeek
().
getValue
());
}
public
static
String
toWeekChinese
(
int
dayOfWeek
)
{
// TextStyle: SHORT 周一;LONG 星期一;NARROW 一
return
DayOfWeek
.
of
(
dayOfWeek
).
getDisplayName
(
TextStyle
.
SHORT
,
Locale
.
CHINESE
);
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessTeamServiceImpl.java
View file @
501b397
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
cn.hutool.core.date.Week
;
import
cn.hutool.core.util.IdUtil
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.DateUtil
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.entity.OrgGroupEntity
;
...
...
@@ -89,7 +89,7 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
List
<
String
>
days
=
Arrays
.
asList
(
workDays
.
split
(
","
));
Collections
.
sort
(
days
);
return
days
.
stream
().
map
(
e
->
{
return
Week
.
of
(
Integer
.
valueOf
(
e
)).
toChinese
(
"周"
);
return
DateUtil
.
toWeekChinese
(
Integer
.
parseInt
(
e
)
);
}).
collect
(
Collectors
.
toList
());
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
View file @
501b397
...
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service.impl;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
cn.hutool.core.date.Week
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.DateUtil
;
import
com.dituhui.pea.order.common.EngineerUtil
;
import
com.dituhui.pea.order.dao.CapacityEngineerCalendarDao
;
import
com.dituhui.pea.order.dao.OrgTeamDao
;
...
...
@@ -137,13 +138,13 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
OrgTeamEntity
e
=
orgTeamDao
.
getByTeamId
(
teamId
);
EngineerCalendarDTO
.
Calendar
calendar
=
new
EngineerCalendarDTO
.
Calendar
();
calendar
.
setDate
(
date
);
int
w
eek
=
LocalDate
.
parse
(
date
).
getDayOfWeek
().
getValue
();
calendar
.
setWeek
(
Week
.
of
(
week
).
toChinese
(
"周"
));
int
dayOfW
eek
=
LocalDate
.
parse
(
date
).
getDayOfWeek
().
getValue
();
calendar
.
setWeek
(
DateUtil
.
toWeekChinese
(
dayOfWeek
));
EngineerCalendarDTO
.
Content
content
=
new
EngineerCalendarDTO
.
Content
();
List
<
String
>
workdays
=
Arrays
.
asList
(
e
.
getWorkdays
().
split
(
","
));
if
(
workdays
.
contains
(
String
.
valueOf
(
w
eek
)))
{
if
(
workdays
.
contains
(
String
.
valueOf
(
dayOfW
eek
)))
{
content
.
setType
(
"woring"
);
content
.
setTitle
(
String
.
format
(
"
日常出勤
%s-%s"
,
e
.
getWorkOn
(),
e
.
getWorkOff
()));
content
.
setTitle
(
String
.
format
(
"%s-%s"
,
e
.
getWorkOn
(),
e
.
getWorkOff
()));
content
.
setValue
(
getCalendarDuration
(
e
.
getWorkOn
(),
e
.
getWorkOff
()));
}
else
{
content
.
setType
(
"rest"
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment