Browse Source

Merge remote-tracking branch 'origin/dev_ic_mp' into dev_ic_mp

dev_shibei_match
yinzuomei 4 years ago
parent
commit
c994dd5ee0
  1. 123
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  2. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java
  3. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java
  4. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java

123
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -945,4 +945,127 @@ public class DateUtils {
return result; return result;
} }
/**
* @Description 获取工作日时间没有排除节假日
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:51 上午
*/
public static Date getWorkDay(Date startDate, int num) {
Date tomorrow = null;
int delay = 1;
while (delay <= num) {
tomorrow = getTomorrow(startDate);
if (!isWeekend(tomorrow)) {
delay++;
}
startDate = tomorrow;
}
return startDate;
}
/**
* @Description 根据开始时间计算出 当前日期后n个工作日没有排除节假日包括今天
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:20 上午
*/
public static List<String> getWorkDayList(Date startDate, int num) {
List<String> result = new ArrayList<>();
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(startDate);
rightNow.add(Calendar.DATE,-1);
startDate = rightNow.getTime();
Date tomorrow;
Integer tag = 1;
while (tag <= num){
tomorrow = getTomorrow(startDate);
// 返回工作日
if (!isWeekend(tomorrow)) {
result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow));
tag++;
}
startDate = tomorrow;
}
return result;
}
/**
* @Description 根据开始时间计算出 当前日期后n个周末没有排除节假日包括今天
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:20 上午
*/
public static List<String> getWeekendDayList(Date startDate, int num) {
List<String> result = new ArrayList<>();
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(startDate);
rightNow.add(Calendar.DATE,-1);
startDate = rightNow.getTime();
Date tomorrow;
Integer tag = 1;
while (tag <= num){
tomorrow = getTomorrow(startDate);
// 返回周末
if (isWeekend(tomorrow)) {
result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow));
tag++;
}
startDate = tomorrow;
}
return result;
}
/**
* @Description 根据开始时间计算出 当前日期后n天没有排除节假日包括今天
* @param startDate
* @param num
* @author zxc
* @date 2022/1/7 10:20 上午
*/
public static List<String> getEveryDayList(Date startDate, int num) {
List<String> result = new ArrayList<>();
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(startDate);
rightNow.add(Calendar.DATE,-1);
startDate = rightNow.getTime();
Date tomorrow;
Integer tag = 1;
while (tag <= num){
tomorrow = getTomorrow(startDate);
result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow));
tag++;
startDate = tomorrow;
}
return result;
}
/**
* @Description 判断日期字符串是否为周末
* @param date eg:yyyy-MM-dd
* @author zxc
* @date 2022/1/7 10:50 上午
*/
private static boolean isWeekend(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY;
}
/**
* @Description 获取tomorrow的日期
* @param startDate
* @author zxc
* @date 2022/1/7 10:50 上午
*/
private static Date getTomorrow(Date startDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(startDate);
cal.add(Calendar.DAY_OF_MONTH, +1);
return cal.getTime();
}
} }

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java

@ -27,8 +27,11 @@ public class AppointmentTimeResultDTO implements Serializable {
*/ */
private List<TimeDTO> timeDetail; private List<TimeDTO> timeDetail;
private List<String> dateList;
public AppointmentTimeResultDTO() { public AppointmentTimeResultDTO() {
this.appointmentType = ""; this.appointmentType = "";
this.timeDetail = new ArrayList<>(); this.timeDetail = new ArrayList<>();
this.dateList = new ArrayList<>();
} }
} }

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java

@ -13,4 +13,8 @@ public interface PartyServiceCenterConstant {
String APPOINTMENT_STATUS_APPOINTING = "appointing"; String APPOINTMENT_STATUS_APPOINTING = "appointing";
String APPOINTMENT_STATUS_CANCEL = "cancel"; String APPOINTMENT_STATUS_CANCEL = "cancel";
String APPOINTMENT_TYPE_EVERY_DAY = "everyDay";
String APPOINTMENT_TYPE_WORK_DAY = "workDay";
String APPOINTMENT_TYPE_WEEKEND = "weekend";
} }

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java

@ -423,6 +423,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
throw new RenException("事项不存在..."); throw new RenException("事项不存在...");
} }
result.setAppointmentType(matter.getAppointmentType()); result.setAppointmentType(matter.getAppointmentType());
result.setDateList(getDateList(result.getAppointmentType()));
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>();
l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId())
.eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getDate()) .eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getDate())
@ -487,6 +488,23 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
return result; return result;
} }
public List<String> getDateList(String type) {
List<String> result = new ArrayList<>();
if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_EVERY_DAY)){
result = DateUtils.getEveryDayList(new Date(),NumConstant.SEVEN);
}else if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_WORK_DAY)){
result = DateUtils.getWorkDayList(new Date(),NumConstant.SEVEN);
}else {
result = DateUtils.getWeekendDayList(new Date(),NumConstant.SEVEN);
}
return result;
}
public static void main(String[] args) {
Date date = DateUtils.addDateDays(new Date(), 2);
}
/** /**
* @Description 党群服务中心预约记录 * @Description 党群服务中心预约记录
* @param formDTO * @param formDTO

Loading…
Cancel
Save