标识时间段

static void setFlag(String recordStartTime,String recordEndTime,String startTime,String endTime,List<ReservableVo.DataDTO.MeetingReservationRecord> hourList){
        StringBuilder sb1 = new StringBuilder();
        sb1.append("2000-01-01");
        sb1.append(" ");
        StringBuilder sb2 = new StringBuilder();
        sb2.append("2000-01-01");
        sb2.append(" ");
        StringBuilder sb3 = new StringBuilder();
        sb3.append("2000-01-01");
        sb3.append(" ");
        StringBuilder sb4 = new StringBuilder();
        sb4.append("2000-01-01");
        sb4.append(" ");
        StringBuilder sb5 = new StringBuilder();
        sb5.append("2000-01-01");
        sb5.append(" ");
        StringBuilder sb6 = new StringBuilder();
        sb6.append("2000-01-01");
        sb6.append(" ");

        Date recordStartDate = DateTimeUnits.StringFormatDate2(sb1.append(recordStartTime).toString());
        Date recordEndDate = DateTimeUnits.StringFormatDate2(sb2.append(recordEndTime).toString());
        Date meetStartDate = DateTimeUnits.StringFormatDate2(sb3.append(startTime).toString());
        Date meetEndDate = DateTimeUnits.StringFormatDate2(sb4.append(endTime).toString());
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
        //预约记录开始小时
        int recordStartHourInt = Integer.valueOf(simpleDateFormat.format(DateTimeUnits.StringFormatDate2(sb1.toString())));
        //预约记录结束小时
        int recordEndHourInt = 0;
        String endMinute = recordEndTime.substring(3);
        Integer endMinutes = Integer.valueOf(endMinute);
        if (endMinutes > 0){
            recordEndHourInt = Integer.valueOf(simpleDateFormat.format(DateTimeUnits.addTime(DateTimeUnits.StringFormatDate2(sb2.toString()), 1)));
        } else if (endMinute.equals("00")) {
            recordEndHourInt = Integer.valueOf(simpleDateFormat.format(DateTimeUnits.StringFormatDate2(sb2.toString())));
        }
        if (recordEndHourInt == 0){
            recordEndHourInt = 24;
        }
        String recordStartHourString = String.valueOf(recordStartHourInt) + ":00";
        if (recordStartHourInt >= 0 && recordStartHourInt <= 9){
            recordStartHourString = "0" + recordStartHourString;
        }
        String recordEndHourString = String.valueOf(recordEndHourInt) + ":00";
        if (recordEndHourInt >= 0 && recordEndHourInt <= 9){
            recordEndHourString = "0" + recordEndHourString;
        }
        Date recordStartHourDate = DateTimeUnits.StringFormatDate2(sb5.append(recordStartHourString).toString());
        Date recordEndHourDate = DateTimeUnits.StringFormatDate2(sb6.append(recordEndHourString).toString());
        if ( meetStartDate.compareTo(recordStartDate) <= 0 && recordEndDate.compareTo(meetEndDate) <= 0 && recordStartDate.compareTo(recordEndDate) <= 0 && meetStartDate.compareTo(meetEndDate) <= 0){
            for (ReservableVo.DataDTO.MeetingReservationRecord hour : hourList) {
                String startHour = hour.getStartHour();
                String endHour = hour.getEndHour();
                StringBuilder sb7 = new StringBuilder();
                sb7.append("2000-01-01");
                sb7.append(" ");
                StringBuilder sb8 = new StringBuilder();
                sb8.append("2000-01-01");
                sb8.append(" ");
                Date startHourDate = DateTimeUnits.StringFormatDate2(sb7.append(startHour).toString());
                Date endHourDate = DateTimeUnits.StringFormatDate2(sb8.append(endHour).toString());
                if (recordStartHourDate.compareTo(startHourDate) <= 0 && endHourDate.compareTo(recordEndHourDate) <= 0 && recordStartDate.compareTo(recordEndDate) <= 0 && startHourDate.compareTo(endHourDate) <= 0){
//                    hour.setFlag(1);
                }else {
//                    hour.setFlag(0);
                }
            }
        }
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值