Browse Source

周末顺延

master
xyiege 4 years ago
parent
commit
49087c8907
  1. 6
      src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java
  2. 6
      src/test/java/cn/chjyj/szwh/NewTest.java

6
src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

@ -568,6 +568,12 @@ public class GoodsServiceImpl implements GoodsService {
try {
// 委托开始时间
Date wtStart = sdf.parse(cstart);
// 判断周几
calendar.setTime(wtStart);
int wkday = calendar.get(Calendar.DAY_OF_WEEK);
//周末顺延
// notice:在节假日调休时候,会有变动
day=wkday>5?(wkday-5+1):0;
// 委托终止时间
Date wtEnd = DateUtils.daysAgoOrAfter(wtStart, day);
// 统计该时间段内的节假日

6
src/test/java/cn/chjyj/szwh/NewTest.java

@ -56,6 +56,12 @@ public class NewTest {
int days = festivalsMapper.countDayBetweenDays(date,afdate0,iyear);
Date afdate = DateUtils.daysAgoOrAfter(afdate0,days);
System.out.println(afdate+"以前的节假日天数:"+days);
//判断当前时间是否为周末
calendar.setTime(date);
long weekDate =calendar.get(Calendar.DAY_OF_WEEK);
//Date weekDate = calendar.getTime();
System.out.println("周几:"+weekDate);
//转为localDateTime
LocalDateTime aflocal = DateUtils.convertDateToLocalDateTime(afdate);

Loading…
Cancel
Save