getWorkDay接口天数判断更新
This commit is contained in:
parent
40076fe110
commit
e349fb0deb
@ -158,39 +158,31 @@ public class CalendarServiceImpl implements CalendarService {
|
||||
int eWorkHour = 0;
|
||||
// 储存返回天数
|
||||
BigDecimal result = null;
|
||||
|
||||
// 获取开始结束时间
|
||||
Integer sHour = workDayVO.getSHour();
|
||||
Integer eHour = workDayVO.getEHour();
|
||||
|
||||
// 判断开始结束时间
|
||||
if (sHour == null || eHour == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取开始日期结束日期传递的isWorkDay参数
|
||||
String sDay = workDayVO.getDate()[0];
|
||||
String eDay = workDayVO.getDate()[1];
|
||||
Integer isWork = workDayVO.getIsWorkday();
|
||||
|
||||
// 设置开始时间vo判断开始天数是否为工作日
|
||||
CalendarPageReqVO sWorkDayVO = new CalendarPageReqVO();
|
||||
sWorkDayVO.setDate(new String[]{sDay, sDay});
|
||||
sWorkDayVO.setIsWorkday(isWork);
|
||||
|
||||
// 设置结束时间vo判断结束天数是否为工作日
|
||||
CalendarPageReqVO eWorkDayVO = new CalendarPageReqVO();
|
||||
eWorkDayVO.setDate(new String[]{eDay, eDay});
|
||||
eWorkDayVO.setIsWorkday(isWork);
|
||||
|
||||
// 获取开始结束工作日天数,获取时间段内工作日天数
|
||||
Long sTotal = calendarMapper.selectPage(sWorkDayVO).getTotal();
|
||||
Long eTotal = calendarMapper.selectPage(eWorkDayVO).getTotal();
|
||||
Long total = calendarMapper.selectPage(workDayVO).getTotal();
|
||||
|
||||
// 判断总过天数不为0时才判断否则直接返回
|
||||
if (total >= 1) {
|
||||
|
||||
// 判断开始天为工作日时才判断
|
||||
if (sTotal > 0) {
|
||||
// 开始日期的时间判断
|
||||
@ -204,7 +196,6 @@ public class CalendarServiceImpl implements CalendarService {
|
||||
day += 1f;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断结束天为工作日时才判断
|
||||
if (eTotal > 0) {
|
||||
// 结束日期的时间判断
|
||||
@ -218,7 +209,6 @@ public class CalendarServiceImpl implements CalendarService {
|
||||
day += 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// 计算开始时间
|
||||
if (sWorkHour == 1) {
|
||||
day += 1F;
|
||||
@ -227,7 +217,6 @@ public class CalendarServiceImpl implements CalendarService {
|
||||
} else if (sWorkHour > 4) {
|
||||
day += 0F;
|
||||
}
|
||||
|
||||
// 计算结束时间
|
||||
if (eWorkHour != 0 && eWorkHour <= 5) {
|
||||
day += 0.5F;
|
||||
@ -238,18 +227,11 @@ public class CalendarServiceImpl implements CalendarService {
|
||||
if (sHour.equals(eHour)) {
|
||||
day = 1;
|
||||
}
|
||||
|
||||
// System.out.println("sWorkHour: " + workHour);
|
||||
// System.out.println("eWorkHour: " + workHour2);
|
||||
// System.out.println("day: " + day);
|
||||
|
||||
}
|
||||
|
||||
// 计算总工作日期,需要减去的对应天数
|
||||
result = BigDecimal.valueOf(total)
|
||||
.subtract(BigDecimal.valueOf(day))
|
||||
.setScale(1, RoundingMode.HALF_UP);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user