| | |
| | | public Integer create(Bookings bookings) { |
| | | LoginUserInfo user = bookings.getLoginUserInfo(); |
| | | Rooms rooms = roomsMapper.selectById(bookings.getRoomId()); |
| | | if(rooms==null ){ |
| | | if(rooms==null||Constants.equalsInteger(rooms.getIsdeleted(),Constants.ONE) ){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该会议室暂时无法预约"); |
| | | } |
| | | bookings.setRoomName(rooms.getName()); |
| | |
| | | s.setCreator(user.getId()); |
| | | s.setObjId(bookings.getId()); |
| | | s.setType(MeetConstants.TWO); |
| | | s.setObjType(MeetConstants.ZERO); |
| | | s.setObjType(Constants.MultiFile.MEETING_BOOKS.getKey()); |
| | | multifileJoinMapper.insert(s); |
| | | }); |
| | | } |
| | |
| | | for (int i = 0; i < bookings.getBookingTimeList().size(); i++) { |
| | | BookingTime s = bookings.getBookingTimeList().get(i); |
| | | RoomTime roomTime = roomTimeJoinMapper.selectById(s.getTimeId()); |
| | | if(Objects.isNull(roomTime)){ |
| | | if(Objects.isNull(roomTime) ||Constants.equalsInteger(roomTime.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"存在未查询到的配置日期,请刷新重试"); |
| | | } |
| | | String endRoomTime = gsDate + " " + roomTime.getEndTime()+":00"; |
| | |
| | | userAction.setRemark(info); |
| | | userAction.setMemberId(id+""); |
| | | userActionMapper.insert(userAction); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | Integer s=ids.get(i); |
| | | |
| | | Bookings bkjs = bookingsMapper.selectById(s); |
| | | if (Objects.isNull(bkjs)) { |
| | | if (Objects.isNull(bkjs)||Constants.equalsInteger(bkjs.getIsdeleted(),Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "未查询到预约记录"); |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = {BusinessException.class, Exception.class}) |
| | | public void updateById(Bookings bookings) { |
| | | Bookings dbBookings = bookingsMapper.selectById(bookings.getId()); |
| | | if(dbBookings==null ||Constants.equalsInteger(dbBookings.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(dbBookings.getStatus().equals(MeetConstants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "本次操作失败,预约状态已流转"); |
| | | } |
| | | Rooms rooms = roomsMapper.selectById(dbBookings.getRoomId()); |
| | | if(rooms==null ){ |
| | | if(rooms==null||Constants.equalsInteger(rooms.getIsdeleted(),Constants.ONE) ){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该会议室暂时无法预约"); |
| | | } |
| | | bookings.setRoomName(rooms.getName()); |
| | |
| | | bookingsMapper.updateById(bookings);*/ |
| | | |
| | | Bookings bookings = bookingsMapper.selectById(bs.getId()); |
| | | if (Objects.isNull(bookings)) { |
| | | if (Objects.isNull(bookings)||Constants.equalsInteger(bookings.getIsdeleted(),Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "未查询到预约记录"); |
| | | } |
| | | |
| | |
| | | IPage<Bookings> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<Bookings> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | Integer minute =getNearStartMinut(); |
| | | |
| | | queryWrapper.selectAll(Bookings.class); |
| | | queryWrapper.selectAs(Rooms::getName, Bookings::getRoomName); |
| | |
| | | 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()); |
| | | |
| | | //status 状态 0已预约 1已撤销 2已结束 |
| | | //会议状态: 1=未开始;2=进行中;3=已结束 ; 4=即将开始; 5=已撤销 |
| | | queryWrapper.apply(Objects.nonNull(pageWrap.getModel().getMeetingStatus()) |
| | | &&Constants.equalsInteger(pageWrap.getModel().getMeetingStatus(),Constants.ONE), |
| | | " ( now() < t.START_TIME and t.status = 0 ) " |
| | | " ( now() < t.START_TIME and t.status = 0 AND SUBDATE( now(), INTERVAL -"+minute+" MINUTE ) < t.START_TIME ) " |
| | | ) |
| | | .apply(Objects.nonNull(pageWrap.getModel().getMeetingStatus()) |
| | | &&Constants.equalsInteger(pageWrap.getModel().getMeetingStatus(),Constants.TWO), |
| | | " ( now() >= t.START_TIME and t.END_TIME >= now() and t.status = 0 ) " |
| | | " ( t.status = 0 and t.START_TIME_REAL is not null ) " |
| | | ) |
| | | .apply(Objects.nonNull(pageWrap.getModel().getMeetingStatus()) |
| | | &&Constants.equalsInteger(pageWrap.getModel().getMeetingStatus(),Constants.THREE), |
| | | " ( ( now() > t.END_TIME and t.`STATUS` = 0 ) or t.`STATUS` = 2 ) " |
| | | " ( t.`STATUS` = 2 ) " |
| | | //" ( ( now() > t.END_TIME and t.`STATUS` = 0 ) or t.`STATUS` = 2 ) " |
| | | ) |
| | | .apply(Objects.nonNull(pageWrap.getModel().getMeetingStatus()) |
| | | &&Constants.equalsInteger(pageWrap.getModel().getMeetingStatus(),Constants.FOUR), |
| | | " now() < t.START_TIME AND SUBDATE( t.START_TIME, INTERVAL 120 MINUTE ) < NOW() " |
| | | " (t.status = 0 AND SUBDATE( now(), INTERVAL -"+minute+" MINUTE ) > t.START_TIME and t.START_TIME_REAL is null ) " |
| | | //" now() < t.START_TIME AND SUBDATE( t.START_TIME, INTERVAL "+minute+" MINUTE ) < NOW() " |
| | | ) |
| | | .apply(Objects.nonNull(pageWrap.getModel().getMeetingStatus()) |
| | | &&Constants.equalsInteger(pageWrap.getModel().getMeetingStatus(),Constants.FIVE), |
| | |
| | | SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("HH:mm"); |
| | | IPage<Bookings> result = bookingsJoinMapper.selectJoinPage(page, Bookings.class, queryWrapper); |
| | | Integer minute =getNearStartMinut(); |
| | | result.getRecords().stream().forEach(s -> { |
| | | dealMeetingStatusByModel(s,minute); |
| | | MPJLambdaWrapper<Multifile> bookquery = new MPJLambdaWrapper<>(); |
| | |
| | | s.setSysList(userrelList); |
| | | //会议室管理员 |
| | | MPJLambdaWrapper<UserRel> param = new MPJLambdaWrapper<>(); |
| | | urquery.selectAll(UserRel.class); |
| | | urquery.eq(UserRel::getObjType, MeetConstants.ZERO); |
| | | urquery.eq(UserRel::getIsdeleted, MeetConstants.ZERO); |
| | | urquery.eq(UserRel::getObjId, s.getRoomId()); |
| | | List<UserRel> adminList = userRelJoinMapper.selectJoinList(UserRel.class, urquery); |
| | | param.selectAll(UserRel.class); |
| | | param.eq(UserRel::getObjType, MeetConstants.ZERO); |
| | | param.eq(UserRel::getIsdeleted, MeetConstants.ZERO); |
| | | param.eq(UserRel::getObjId, s.getRoomId()); |
| | | List<UserRel> adminList = userRelJoinMapper.selectJoinList(UserRel.class, param); |
| | | s.setAdminList(adminList); |
| | | |
| | | //查询是否有权限 |
| | | s.setHasRole(getHasRoleByParam(s,userInfo,adminList)); |
| | | /* //服务项 |
| | | /* //服务项 |
| | | MPJLambdaWrapper<ProjectRel> prquery = new MPJLambdaWrapper<>(); |
| | | prquery.selectAll(ProjectRel.class); |
| | | prquery.eq(ProjectRel::getIsdeleted, MeetConstants.ZERO); |
| | |
| | | if(Constants.equalsInteger(userInfo.getId(),s.getCreator()) ){ |
| | | return 1; |
| | | } |
| | | if(adminList!=null){ |
| | | if(adminList!=null && userInfo!=null){ |
| | | for(UserRel u : adminList){ |
| | | if(Constants.equalsInteger(userInfo.getId(),u.getUserId()) ){ |
| | | return 1; |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Bookings bookings = bookingsMapper.selectOne(new QueryWrapper<Bookings>().lambda() |
| | | .eq(Bookings::getIsdeleted,Constants.ZERO) |
| | | .eq(Bookings::getRoomId,bean.getRoomId()) |
| | | .ge(Bookings::getEndTime,DateUtil.getPlusTime(bean.getEndTime())) |
| | | .le(Bookings::getStartTime,DateUtil.getPlusTime(bean.getStartTime())) |
| | |
| | | @Override |
| | | public MeetingDetailResponse getMeetingDetail(Integer id,Integer sysUserId) { |
| | | MeetingDetailResponse meetingDetailResponse = bookingsMapper.meetingDetail(id); |
| | | if (Objects.isNull(meetingDetailResponse)) { |
| | | if (Objects.isNull(meetingDetailResponse) |
| | | || Constants.equalsInteger(meetingDetailResponse.getIsdeleted(),Constants.ONE) ) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "未查询到会议详情"); |
| | | } |
| | | //预约人 |
| | | meetingDetailResponse.setBookingUser(systemUserService.findById(meetingDetailResponse.getBookingUserId())); |
| | | //时间段列表 |
| | | meetingDetailResponse.setBookingTimeList(bookingTimeMapper.selectList(new QueryWrapper<BookingTime>() |
| | | .eq("BOOKING_ID", id) |
| | | .eq("ISDELETED", MeetConstants.ZERO) |
| | | meetingDetailResponse.setBookingTimeList(bookingTimeMapper.selectList(new QueryWrapper<BookingTime>().lambda() |
| | | .eq(BookingTime::getBookingId, id) |
| | | .eq(BookingTime::getIsdeleted, MeetConstants.ZERO) |
| | | )); |
| | | //参会人员列表 |
| | | List<UserResponse> userResponseList = systemUserService.getUserList(id); |
| | |
| | | i.setPrefixUrl(projectsPath); |
| | | }); |
| | | meetingDetailResponse.setProjectsResponseList(projectsResponseList); |
| | | List<Multifile> multiFileList = multifileMapper.selectList(new QueryWrapper<Multifile>() |
| | | .eq("OBJ_ID", id) |
| | | .eq("OBJ_TYPE", MeetConstants.ZERO) |
| | | List<Multifile> multiFileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId, id) |
| | | .eq(Multifile::getObjType, Constants.MultiFile.MEETING_BOOKS.getKey()) |
| | | .eq(Multifile::getIsdeleted, MeetConstants.ZERO) |
| | | ); |
| | | multiFileList.forEach(i -> { |
| | | i.setFileurlFull(projectsPath); |
| | |
| | | //附件信息 |
| | | meetingDetailResponse.setMultiFileList(multiFileList); |
| | | //会议室管理人员 |
| | | List<UserRel> userRelList = userRelMapper.selectList(new QueryWrapper<UserRel>() |
| | | .eq("ISDELETED",MeetConstants.ZERO) |
| | | .eq("OBJ_ID", meetingDetailResponse.getRoomId()) |
| | | .eq("OBJ_TYPE",MeetConstants.ZERO) |
| | | List<UserRel> userRelList = userRelMapper.selectList(new QueryWrapper<UserRel>().lambda() |
| | | .eq(UserRel::getIsdeleted,MeetConstants.ZERO) |
| | | .eq(UserRel::getObjId, meetingDetailResponse.getRoomId()) |
| | | .eq(UserRel::getObjType,MeetConstants.ZERO) |
| | | ); |
| | | if(Constants.equalsInteger(sysUserId,meetingDetailResponse.getBookingUserId())){ |
| | | meetingDetailResponse.setIsAdmin(Constants.ONE); |
| | |
| | | public Integer reservationMeeting(BookingsRequest bookingsRequest) { |
| | | Bookings bookings = new Bookings(); |
| | | BeanUtils.copyProperties(bookingsRequest, bookings); |
| | | bookings.setJoinNotice(bookingsRequest.getJoinNotice()); |
| | | if (Objects.isNull(bookingsRequest.getId())) { |
| | | this.create(bookings); |
| | | return bookings.getId(); |
| | |
| | | if (Objects.isNull(bookings)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "未查询到预约记录"); |
| | | } |
| | | if (!bookings.getCreator().equals(businessOverDTO.getUserId())) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "非你的预约记录,无法进行取消"); |
| | | |
| | | // LoginUserInfo user =(LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | //会议室管理员 |
| | | MPJLambdaWrapper<UserRel> param = new MPJLambdaWrapper<>(); |
| | | param.selectAll(UserRel.class); |
| | | param.eq(UserRel::getObjType, MeetConstants.ZERO); |
| | | param.eq(UserRel::getIsdeleted, MeetConstants.ZERO); |
| | | param.eq(UserRel::getObjId, bookings.getRoomId()); |
| | | List<UserRel> adminList = userRelJoinMapper.selectJoinList(UserRel.class, param); |
| | | Integer hasRole =getHasRoleByParam(bookings,businessOverDTO.getLoginUser(),adminList); |
| | | |
| | | // if (!bookings.getCreator().equals(businessOverDTO.getUserId())) { |
| | | if (!Constants.equalsInteger(hasRole,Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,只有会议室管理员和申请人才能进行该操作哦!"); |
| | | } |
| | | if (Objects.nonNull(bookings.getStartTimeReal()) && System.currentTimeMillis() > bookings.getStartTimeReal().getTime()) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "会议已开始,无法进行取消"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 自动开始会议 |
| | | */ |
| | | @Override |
| | | public void autoStart(){ |
| | | List<Rooms> roomList = roomsMapper.selectList(new QueryWrapper<Rooms>().lambda().eq(Rooms::getIsdeleted,Constants.ZERO).eq(Rooms::getStatus,Constants.ZERO)); |
| | | for (Rooms rooms:roomList) { |
| | | //查询当前会议室是否存在进行中的会议 |
| | | if(bookingsMapper.selectCount(new QueryWrapper<Bookings>().lambda().eq(Bookings::getIsdeleted,Constants.ZERO) |
| | | .eq(Bookings::getStatus,Constants.ZERO).eq(Bookings::getRoomId,rooms.getId()).isNotNull(Bookings::getStartTimeReal). |
| | | apply(" DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(START_TIME, '%Y-%m-%d') ") |
| | | )<=Constants.ZERO){ |
| | | //根据会议室获取可以开启的会议记录(第一条记录) |
| | | Bookings bookings = bookingsMapper.selectOne(new QueryWrapper<Bookings>().lambda() |
| | | .eq(Bookings::getIsdeleted,Constants.ZERO) |
| | | .eq(Bookings::getStatus,Constants.ZERO) |
| | | .eq(Bookings::getRoomId,rooms.getId()) |
| | | .apply(" now() > START_TIME and now() < END_TIME ") |
| | | .isNull(Bookings::getStartTimeReal) |
| | | .orderByAsc(Bookings::getStartTime) |
| | | .last(" limit 1 ") |
| | | ); |
| | | if(Objects.nonNull(bookings)){ |
| | | bookings.setStartTimeReal(new Date()); |
| | | bookings.setEditDate(bookings.getStartTimeReal()); |
| | | bookingsMapper.updateById(bookings); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 提前开始 |
| | | * @param businessOverDTO |
| | | */ |
| | |
| | | .ne(Bookings::getId,bookings.getId()) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在未开启会议,无法开始会议"); |
| | | }; |
| | | } |
| | | |
| | | if(bookingsMapper.selectCount(new QueryWrapper<Bookings>() |
| | | .lambda() |
| | |
| | | .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(),"未到会议申请开始时间,无法开始"); |
| | |
| | | .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) |
| | | .ne(Bookings::getId,bookings.getId()) |
| | | .eq(Bookings::getRoomId,bookings.getRoomId()) |
| | | ); |
| | | |
| | |
| | | .eq(Bookings::getIsdeleted, MeetConstants.ZERO) |
| | | .eq(Bookings::getStatus, MeetConstants.ZERO) |
| | | .eq(Rooms::getId, rooms.getId()) |
| | | .apply("to_days(t.start_time) = to_days(now()) and t.end_time > now()")//子查询当天的 |
| | | .apply(" ( " + |
| | | " to_days(t.start_time) = to_days(now()) " + |
| | | " and ( t.START_TIME_REAL is not null or ( t.end_time > now() and t.START_TIME_REAL is null ) ) " + |
| | | " ) ")//子查询当天的 |
| | | .orderByAsc(Bookings::getStartTime); |
| | | Integer minute =getNearStartMinut(); |
| | | List<Bookings> meetingList =bookingsMapper.selectJoinList(Bookings.class,queryWrapper); |
| | |
| | | .replace("{参会人员姓名}",StringUtils.defaultString(i.getRealName(),"")) |
| | | .replace("{会议主题}",StringUtils.defaultString(bookings.getName(),"")) |
| | | .replace("{会议室名称}",StringUtils.defaultString(bookings.getRoomName(),"")) |
| | | .replace("{会议时间段}",StringUtils.defaultString(timeInfo,""))); |
| | | .replace("{会议时间段}",StringUtils.defaultString(timeInfo,"")) |
| | | .replace("{会议备注}",StringUtils.defaultString(bookings.getRemark(),"无"))); |
| | | smsEmailList.add(smsEmail); |
| | | } |
| | | } |
| | |
| | | .replace("{参会人员姓名}",StringUtils.defaultString(systemUser.getRealname(),"")) |
| | | .replace("{会议主题}",StringUtils.defaultString(bookings.getName(),"")) |
| | | .replace("{会议室名称}",StringUtils.defaultString(bookings.getRoomName(),"")) |
| | | .replace("{会议备注}",StringUtils.defaultString(bookings.getRemark(),"无")) |
| | | .replace("{会议时间段}",StringUtils.defaultString(timeInfo,""))); |
| | | smsEmailList.add(smsEmail); |
| | | } |
| | |
| | | //查询是否处于会议中 |
| | | page.getRecords().forEach(j->{ |
| | | j.setPrefixUrl(path); |
| | | if(bookingsMapper.selectCount(new QueryWrapper<Bookings>() |
| | | if(bookingsMapper.selectCount(new QueryWrapper<Bookings>() .lambda() |
| | | .eq(Bookings::getIsdeleted,Constants.ZERO) |
| | | .exists(" select 1 from meeting_user_rel u where u.OBJ_ID = meeting_book.id and u.USER_ID = '"+j.getId()+"' and u.OBJ_TYPE = 1 ") |
| | | .and(i -> i.between("START_TIME", pageWrap.getModel().getStartTime()+":00",pageWrap.getModel().getEndTime()+":00") |
| | | .or().between("END_TIME", pageWrap.getModel().getStartTime()+":00",pageWrap.getModel().getEndTime()+":00") |
| | | .and(i -> i.between(Bookings::getStartTime, pageWrap.getModel().getStartTime()+":00",pageWrap.getModel().getEndTime()+":00") |
| | | .or().between(Bookings::getEndTime, pageWrap.getModel().getStartTime()+":00",pageWrap.getModel().getEndTime()+":00") |
| | | ) |
| | | )>Constants.ZERO){ |
| | | j.setStatus(Constants.ONE); |