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 096b2f0b
authored
Nov 17, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(工作日历):工作日历新增是否全天字段-变更
1 parent
e2c8ee1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
project-order/src/main/java/com/dituhui/pea/order/dto/CalendarUpdateDTO.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/CalendarUpdateDTO.java
View file @
096b2f0
package
com
.
dituhui
.
pea
.
order
.
dto
;
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
public
class
CalendarUpdateDTO
{
public
class
CalendarUpdateDTO
{
...
@@ -11,15 +13,33 @@ public class CalendarUpdateDTO {
...
@@ -11,15 +13,33 @@ public class CalendarUpdateDTO {
*/
*/
@NotBlank
(
message
=
"请指定日程是否是全天"
)
@NotBlank
(
message
=
"请指定日程是否是全天"
)
private
Boolean
wholeDay
;
private
Boolean
wholeDay
;
/**
* 日程所属日期, 格式: yyyy-MM-dd
*/
@NotNull
(
message
=
"请指定日程所属日期, 格式:yyyy-MM-dd"
)
private
Date
itineraryDate
;
@NotBlank
/**
* 开始时间:HH:mm:ss, wholeDay为true时可不传
*/
private
String
startTime
;
private
String
startTime
;
@NotBlank
/**
* 结束时间:HH:mm:ss, wholeDay为true时可不传
*/
private
String
endTime
;
private
String
endTime
;
/**
* 日程所属工程师编号
*/
@NotBlank
@NotBlank
private
String
engineerCode
;
private
String
engineerCode
;
/**
* 日程计划ID
*/
@NotBlank
@NotBlank
private
String
planId
;
private
String
planId
;
/**
* 备注
*/
private
String
remark
;
private
String
remark
;
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
View file @
096b2f0
...
@@ -170,11 +170,25 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
...
@@ -170,11 +170,25 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
if
(
entity
==
null
)
{
if
(
entity
==
null
)
{
return
Result
.
failed
(
"日历配置信息不存在"
);
return
Result
.
failed
(
"日历配置信息不存在"
);
}
}
final
Date
itineraryDate
=
reqDTO
.
getItineraryDate
();
final
LocalDate
itineraryLocalDate
=
itineraryDate
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
())
.
toLocalDate
();
// 日程所属工程师
// 日程所属工程师
final
String
engineerCode
=
entity
.
getEngineerCode
();
final
String
engineerCode
=
entity
.
getEngineerCode
();
// 业务检查,暂时只需要检查日期时间必须为将来; 后面还需要检查配置项是否与其他配置项在时间上有交叉
// 业务检查,暂时只需要检查日期时间必须为将来; 后面还需要检查配置项是否与其他配置项在时间上有交叉
LocalDateTime
time1
=
DateUtils
.
localDateTimeFromStr
(
reqDTO
.
getStartTime
());
LocalDateTime
time1
,
time2
;
LocalDateTime
time2
=
DateUtils
.
localDateTimeFromStr
(
reqDTO
.
getEndTime
());
if
(
Objects
.
equals
(
Boolean
.
TRUE
,
reqDTO
.
getWholeDay
()))
{
//获取工程师上下班时间
EngineerBusinessEntity
config
=
engineerBusinessDao
.
getByEngineerCode
(
engineerCode
);
LocalTime
startTime
=
LocalTime
.
parse
(
String
.
format
(
"%s:00"
,
config
.
getWorkOn
()),
DateUtil
.
TIME_FORMATTER
);
LocalTime
endTime
=
LocalTime
.
parse
(
String
.
format
(
"%s:00"
,
config
.
getWorkOff
()),
DateUtil
.
TIME_FORMATTER
);
time1
=
LocalDateTime
.
of
(
itineraryLocalDate
,
startTime
);
time2
=
LocalDateTime
.
of
(
itineraryLocalDate
,
endTime
);
}
else
{
time1
=
LocalDateTime
.
of
(
itineraryLocalDate
,
LocalTime
.
parse
(
reqDTO
.
getStartTime
(),
DateUtil
.
TIME_FORMATTER
));
time2
=
LocalDateTime
.
of
(
itineraryLocalDate
,
LocalTime
.
parse
(
reqDTO
.
getEndTime
(),
DateUtil
.
TIME_FORMATTER
));
}
if
(
time1
.
isAfter
(
time2
))
{
if
(
time1
.
isAfter
(
time2
))
{
return
Result
.
failed
(
"开始/结束时间输入错误"
);
return
Result
.
failed
(
"开始/结束时间输入错误"
);
}
}
...
...
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