k94314517
2024-10-16 39aea9fa06482f060eb6d1b939b2778156f028fc
server/meeting/meeting_service/src/main/java/com/doumee/service/business/impl/BookingsServiceImpl.java
@@ -142,7 +142,7 @@
        //发送会议预约成功通知
        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();
    }
@@ -464,7 +464,7 @@
        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);
@@ -476,7 +476,6 @@
        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),
@@ -995,7 +994,7 @@
        if (!bookings.getCreator().equals(businessOverDTO.getUserId())) {
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "非你的预约记录,无法进行取消");
        }
        if (System.currentTimeMillis() > bookings.getStartTime().getTime()) {
        if (Objects.nonNull(bookings.getStartTimeReal()) && System.currentTimeMillis() > bookings.getStartTimeReal().getTime()) {
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "会议已开始,无法进行取消");
        }
        if(bookings.getStatus().equals(MeetConstants.ONE)){
@@ -1011,7 +1010,7 @@
        //取消会议 发送取消通知
        this.sendNotice(bookings, 3);
        //发送微信订阅通知
        sendWxMessage.bookingsCancel(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId()));
//        sendWxMessage.bookingsCancel(systemUserMapper.selectById(bookings.getCreator()), bookings, roomsMapper.selectById(bookings.getRoomId()));
    }
@@ -1037,7 +1036,7 @@
        if (!bookings.getCreator().equals(businessOverDTO.getUserId()) && userRelList <= 0) {
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "非你的预约记录,无法进行该操作");
        }
        if (System.currentTimeMillis() < bookings.getStartTime().getTime()) {
        if (System.currentTimeMillis() < bookings.getStartTimeReal().getTime()) {
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "会议未开始,无法进行结束,如需该操作请使用取消功能");
        }
        if (System.currentTimeMillis() > bookings.getEndTime().getTime()) {
@@ -1124,9 +1123,32 @@
            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());
@@ -1138,7 +1160,8 @@
                .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())
        );
@@ -1181,7 +1204,9 @@
                .eq("b.STATUS",MeetConstants.ZERO)
                .eq("a.ISDELETED",MeetConstants.ZERO)
                .eq("a.status",Constants.ZERO)
                .ne("a.status",Constants.TWO)
                .like("a.start_time",DateUtil.getCurrDate())
                .apply(" not exists ( select 1  from  meeting_book mb where mb.END_TIME < now() and  mb.id = a.id and START_TIME_REAL is null  )   ")
                .orderByAsc("a.start_time")
        );
        this.dealMeetingStatus(meetingList);
@@ -1230,7 +1255,7 @@
            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()));
        }
    }