Commit 9b60af50 by 刘鑫

fix(ID1004147):博西PEA_V1.0-工作日历:新增日程失败,提示有冲突 日历日程显示不考虑是否挂靠工作队

1 parent 0c5828bd
...@@ -450,12 +450,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -450,12 +450,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
@Override @Override
public EngineerCalendarResultDTO queryEngineerCalendar(String engineerCode, LocalDate startDate, LocalDate endDate) { public EngineerCalendarResultDTO queryEngineerCalendar(String engineerCode, LocalDate startDate, LocalDate endDate) {
List<String> teamIds = orgTeamEngineerDao.getTeamIdsByEngineerCode(engineerCode);
if (CollectionUtils.isEmpty(teamIds)) {
//TODO 未查到小队信息如何返回
return null;
}
List<LocalDate> dateRange = Stream.iterate(startDate, date -> date.plusDays(1)) List<LocalDate> dateRange = Stream.iterate(startDate, date -> date.plusDays(1))
.limit(ChronoUnit.DAYS.between(startDate, endDate.plusDays(1))) .limit(ChronoUnit.DAYS.between(startDate, endDate.plusDays(1)))
.collect(Collectors.toList()); .collect(Collectors.toList());
...@@ -468,14 +462,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -468,14 +462,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
Map<String, List<CapacityEngineerCalendarEntity>> configs = calendarEntityList.stream() Map<String, List<CapacityEngineerCalendarEntity>> configs = calendarEntityList.stream()
.collect(Collectors.groupingBy(CapacityEngineerCalendarEntity::getWorkday)); .collect(Collectors.groupingBy(CapacityEngineerCalendarEntity::getWorkday));
//取teamID
final String teamId = teamIds.get(0);
// 初始化一天的日历
final OrgTeamEntity orgTeam = orgTeamDao.getByTeamId(teamId);
String[] workDayArray = orgTeam.getWorkdays().split(",");
List<String> workDayList = new ArrayList<>(Arrays.asList(workDayArray));
List<EngineerCalendar> engineerCalendarResultList = dateRange.stream().map(date -> { List<EngineerCalendar> engineerCalendarResultList = dateRange.stream().map(date -> {
final String strDate = LocalDateTimeUtil.format(date, PATTERN_DATE); final String strDate = LocalDateTimeUtil.format(date, PATTERN_DATE);
final Instant instant = Timestamp.valueOf(date.atTime(LocalTime.MIDNIGHT)).toInstant(); final Instant instant = Timestamp.valueOf(date.atTime(LocalTime.MIDNIGHT)).toInstant();
...@@ -500,13 +486,12 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -500,13 +486,12 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
calendars.addAll(engineerCalendars); calendars.addAll(engineerCalendars);
} else { } else {
EngineerCalendar engineerCalendar = new EngineerCalendar(); EngineerCalendar engineerCalendar = new EngineerCalendar();
int dayOfWeek = date.getDayOfWeek().getValue();
Instant startInstant = LocalDateTime.of(date, LocalTime.MIN).atZone(ZoneId.of("+8")).toInstant(); Instant startInstant = LocalDateTime.of(date, LocalTime.MIN).atZone(ZoneId.of("+8")).toInstant();
engineerCalendar.setBeginTime(Date.from(startInstant)); engineerCalendar.setBeginTime(Date.from(startInstant));
Instant endInstant = LocalDateTime.of(date, LocalTime.MAX).atZone(ZoneId.of("+8")).toInstant(); Instant endInstant = LocalDateTime.of(date, LocalTime.MAX).atZone(ZoneId.of("+8")).toInstant();
engineerCalendar.setEndTime(Date.from(endInstant)); engineerCalendar.setEndTime(Date.from(endInstant));
engineerCalendar.setDate(Date.from(instant)); engineerCalendar.setDate(Date.from(instant));
if (!workDayList.contains(String.valueOf(dayOfWeek))) { if (!engineerWorkDay(engineerCode,date)) {
engineerCalendar.setEventType("REST"); engineerCalendar.setEventType("REST");
engineerCalendar.setEvent("休息"); engineerCalendar.setEvent("休息");
engineerCalendar.setContent("休息"); engineerCalendar.setContent("休息");
...@@ -527,11 +512,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -527,11 +512,6 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
private List<EngineerCalendarDTO.Calendar> getOneEngineerCalendars(String engineerCode, String bdate, String edate) { private List<EngineerCalendarDTO.Calendar> getOneEngineerCalendars(String engineerCode, String bdate, String edate) {
// 返回某一个技术员,日期范围内的日历列表 // 返回某一个技术员,日期范围内的日历列表
List<EngineerCalendarDTO.Calendar> calendars = new ArrayList<>(); List<EngineerCalendarDTO.Calendar> calendars = new ArrayList<>();
List<String> teamIds = orgTeamEngineerDao.getTeamIdsByEngineerCode(engineerCode);
if (teamIds == null || teamIds.isEmpty()) {
return new ArrayList<>();
}
LocalDate startDate = DateUtils.localDateFromStr(bdate); LocalDate startDate = DateUtils.localDateFromStr(bdate);
LocalDate endDate = DateUtils.localDateFromStr(edate); LocalDate endDate = DateUtils.localDateFromStr(edate);
List<LocalDate> datesInRange = Stream.iterate(startDate, date -> date.plusDays(1)) List<LocalDate> datesInRange = Stream.iterate(startDate, date -> date.plusDays(1))
...@@ -543,7 +523,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -543,7 +523,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
for (LocalDate date : datesInRange) { for (LocalDate date : datesInRange) {
String sDate = LocalDateTimeUtil.format(date, PATTERN_DATE); String sDate = LocalDateTimeUtil.format(date, PATTERN_DATE);
EngineerCalendarDTO.Calendar calander = null; EngineerCalendarDTO.Calendar calander = null;
calander = getEmptyCalendar(teamIds.get(0), sDate); calander = getEmptyCalendar(sDate);
if (configs.containsKey(sDate)) { if (configs.containsKey(sDate)) {
List<EngineerCalendarDTO.Content> contents = new ArrayList<>(); List<EngineerCalendarDTO.Content> contents = new ArrayList<>();
// 有配置 // 有配置
...@@ -760,7 +740,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService { ...@@ -760,7 +740,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
return !CollectionUtils.isEmpty(configs); return !CollectionUtils.isEmpty(configs);
} }
private EngineerCalendarDTO.Calendar getEmptyCalendar(String teamId, String date) { private EngineerCalendarDTO.Calendar getEmptyCalendar(String date) {
// 初始化一天的日历 // 初始化一天的日历
EngineerCalendarDTO.Calendar calendar = new EngineerCalendarDTO.Calendar(); EngineerCalendarDTO.Calendar calendar = new EngineerCalendarDTO.Calendar();
calendar.setDate(date); calendar.setDate(date);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!