Commit 096b2f0b by 刘鑫

feat(工作日历):工作日历新增是否全天字段-变更

1 parent e2c8ee1c
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;
} }
......
...@@ -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("开始/结束时间输入错误");
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!