From 164a872e40aa1bb88427d37262a8697c2b8caa6a Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 18 十月 2024 18:44:52 +0800 Subject: [PATCH] 代码初始化 --- server/meeting/meeting_service/src/main/java/com/doumee/service/business/impl/BookingsServiceImpl.java | 43 ++++++++++++++++++++++++++++++++++--------- 1 files changed, 34 insertions(+), 9 deletions(-) diff --git a/server/meeting/meeting_service/src/main/java/com/doumee/service/business/impl/BookingsServiceImpl.java b/server/meeting/meeting_service/src/main/java/com/doumee/service/business/impl/BookingsServiceImpl.java index dd0a9bb..db0499c 100644 --- a/server/meeting/meeting_service/src/main/java/com/doumee/service/business/impl/BookingsServiceImpl.java +++ b/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())); } } -- Gitblit v1.9.3