Commit 501b3971 by 丁伟峰

bugfix:周x;hutool里面,1==>周日;此处自己实现

1 parent dbd42313
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);
}
}
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());
}
......
......@@ -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 week = LocalDate.parse(date).getDayOfWeek().getValue();
calendar.setWeek(Week.of(week).toChinese("周"));
int dayOfWeek = 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(week))) {
if (workdays.contains(String.valueOf(dayOfWeek))) {
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");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!