|  |  |  | 
|---|
|  |  |  | //发送会议预约成功通知 | 
|---|
|  |  |  | this.sendNotice(bookings, MeetConstants.TWO); | 
|---|
|  |  |  | //发送微信订阅通知 | 
|---|
|  |  |  | sendWxMessage.bookingsReservation(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  | //        sendWxMessage.bookingsReservation(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return bookings.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | queryWrapper.selectAs(Rooms::getName, Bookings::getRoomName); | 
|---|
|  |  |  | queryWrapper.selectAs(SystemUser::getRealname, Bookings::getRealName); | 
|---|
|  |  |  | queryWrapper.selectAs(Company::getName, Bookings::getDepartmentName); | 
|---|
|  |  |  | queryWrapper.select(" CASE WHEN t.START_TIME > now() AND t.`STATUS` = 0 THEN 1  WHEN ( (t.END_TIME < now()  AND t.`STATUS` = 0 ) or t.`STATUS` = 2 ) THEN 3 WHEN t.`STATUS` = 1 THEN 5 ELSE  2  END meetingStatus "); | 
|---|
|  |  |  | queryWrapper.select(" CASE WHEN t.START_TIME_REAL IS NULL AND t.`STATUS` = 0 THEN 1  WHEN ( ( t.END_TIME < now()  AND t.`STATUS` = 0 ) or t.`STATUS` = 2 ) THEN 3 WHEN t.`STATUS` = 1 THEN 5 ELSE  2  END meetingStatus "); | 
|---|
|  |  |  | queryWrapper.leftJoin(Rooms.class, Rooms::getId, Bookings::getRoomId); | 
|---|
|  |  |  | queryWrapper.leftJoin(SystemUser.class, SystemUser::getId, Bookings::getCreator); | 
|---|
|  |  |  | queryWrapper.leftJoin(Company.class,Company::getId,SystemUser::getCompanyId); | 
|---|
|  |  |  | 
|---|
|  |  |  | queryWrapper.eq(pageWrap.getModel().getStatus() != null, Bookings::getStatus, pageWrap.getModel().getStatus()); | 
|---|
|  |  |  | queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getRealName()), SystemUser::getRealname, pageWrap.getModel().getRealName()); | 
|---|
|  |  |  | queryWrapper.eq(pageWrap.getModel().getDepartmentId() != null, Company::getId, pageWrap.getModel().getDepartmentId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | queryWrapper.apply(Objects.nonNull(pageWrap.getModel().getMeetingStatus()) | 
|---|
|  |  |  | &&Constants.equalsInteger(pageWrap.getModel().getMeetingStatus(),Constants.ONE), | 
|---|
|  |  |  | 
|---|
|  |  |  | if(DateUtil.afterMinutesDate(bookings.getStartTime(),-beforeMinutes).getTime()>System.currentTimeMillis()){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"会议仅可以提前"+beforeMinutes+"分钟开始"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //查询是否存在其他未开始的会议 防止颗粒度与提前开始的问题 | 
|---|
|  |  |  | if(bookingsMapper.selectCount(new QueryWrapper<Bookings>() | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .apply(" now() < START_TIME and   END_TIME <=  '" + DateUtil.DateToStr(bookings.getStartTime(),"yyyy-MM-dd HH:mm:ss") +"'" ) | 
|---|
|  |  |  | .isNull(Bookings::getStartTimeReal) | 
|---|
|  |  |  | .isNull(Bookings::getDoneDate) | 
|---|
|  |  |  | .eq(Bookings::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .eq(Bookings::getRoomId,bookings.getRoomId()) | 
|---|
|  |  |  | .ne(Bookings::getId,bookings.getId()) | 
|---|
|  |  |  | )>Constants.ZERO){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在未开启会议,无法进行开始会议"); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(bookingsMapper.selectCount(new QueryWrapper<Bookings>() | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .apply(" (  END_TIME > now() and START_TIME < now() ) or  ( END_TIME > now() and  START_TIME_REAL < now() )  ") | 
|---|
|  |  |  | .isNotNull(Bookings::getStartTimeReal) | 
|---|
|  |  |  | .isNull(Bookings::getDoneDate) | 
|---|
|  |  |  | .eq(Bookings::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .eq(Bookings::getRoomId,bookings.getRoomId()) | 
|---|
|  |  |  | )>Constants.ZERO){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前开启时间与其他会议存在冲突,无法进行开始会议"); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | if(bookings.getStartTime().getTime() > System.currentTimeMillis()){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未到会议申请开始时间,无法进行开启"); | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未到会议申请开始时间,无法进行开始"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bookings.setStartTimeReal(new Date()); | 
|---|
|  |  |  | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .set(Bookings::getStatus,Constants.TWO) | 
|---|
|  |  |  | .set(Bookings::getDoneDate,new Date()) | 
|---|
|  |  |  | .apply(" END_TIME < now() ") | 
|---|
|  |  |  | .set(Bookings::getDoneInfo,"其他会议开始,自动关闭") | 
|---|
|  |  |  | .apply(" ( END_TIME < now() or ( END_TIME > now() and START_TIME < now() and START_TIME_REAL is null  ) )") | 
|---|
|  |  |  | .eq(Bookings::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .eq(Bookings::getRoomId,bookings.getRoomId()) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | 
|---|
|  |  |  | bookingsMapper.updateById(bookings); | 
|---|
|  |  |  | this.sendNotice(bookings, MeetConstants.ONE); | 
|---|
|  |  |  | //发送微信通知 | 
|---|
|  |  |  | sendWxMessage.bookingsStart(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  | //            sendWxMessage.bookingsStart(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|