diff --git a/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/constant/IntegratedConstants.java b/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/constant/IntegratedConstants.java index 10e7ad1a7..c1b87c2b3 100644 --- a/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/constant/IntegratedConstants.java +++ b/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/constant/IntegratedConstants.java @@ -74,6 +74,37 @@ public interface IntegratedConstants { */ String DELETED = "1"; } + + /** + * 会议室状态 + */ + interface MeetingRoomStatus { + /** + * 维护中 + */ + String MAINTENANCE = "1"; + + /** + * 可用 + */ + String AVAILABLE = "0"; + } + + /** + * 会务服务需求 + */ + interface NeedService { + /** + * 不需要 + */ + String NO = "0"; + + /** + * 需要 + */ + String YES = "1"; + } + } diff --git a/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/vo/meeting/app/MeetingBookingReqVo.java b/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/vo/meeting/app/MeetingBookingReqVo.java index 35e12e16e..779535412 100644 --- a/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/vo/meeting/app/MeetingBookingReqVo.java +++ b/pjcloud-integrated/pjcloud-integrated-api/src/main/java/com/bsd/pjcloud/integrated/vo/meeting/app/MeetingBookingReqVo.java @@ -30,4 +30,10 @@ public class MeetingBookingReqVo { @Schema(description = "参会人员ID列表") private List attendees; + + @Schema(description = "桌子摆放形态") + private String deskLayout; + + @Schema(description = "是否需要会务服务") + private String needService; } \ No newline at end of file diff --git a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingBookingController.java b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingBookingController.java index 0742db7e5..3373baa38 100644 --- a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingBookingController.java +++ b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingBookingController.java @@ -259,9 +259,9 @@ public class MeetingBookingController { /** * 会议开始之前,通知阿姨需要对会议室桌面和桌椅拜访进行整理 */ - @PostMapping("/app/notice-visit-desk/{bookingId}") - public R noticeVisitDesk(@PathVariable("bookingId") Long bookingId) { - meetingBookingService.noticeVisitDesk(bookingId); - return R.ok(); - } +// @PostMapping("/app/notice-visit-desk/{bookingId}") +// public R noticeVisitDesk(@PathVariable("bookingId") Long bookingId) { +// meetingBookingService.noticeVisitDesk(bookingId); +// return R.ok(); +// } } \ No newline at end of file diff --git a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingRoomController.java b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingRoomController.java index f4917a742..f57fc5016 100644 --- a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingRoomController.java +++ b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/controller/MeetingRoomController.java @@ -20,15 +20,20 @@ import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordParamDto; import com.bsd.pjcloud.flow.task.entity.Process; import com.bsd.pjcloud.flow.task.utils.GetCheckReasonUtils; import com.bsd.pjcloud.flow.task.vo.CheckStatusAndReasonVo; +import com.bsd.pjcloud.integrated.constant.IntegratedConstants; import com.bsd.pjcloud.integrated.constant.IntegratedFlowConstant; import com.bsd.pjcloud.integrated.dto.flow.MeetingFlowDto; import com.bsd.pjcloud.integrated.dto.meeting.app.MeetingPageDto; import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity; +import com.bsd.pjcloud.integrated.entity.MeetingEquipmentEntity; import com.bsd.pjcloud.integrated.entity.MeetingRoomEntity; import com.bsd.pjcloud.integrated.entity.MeetingRoomEquipmentEntity; import com.bsd.pjcloud.integrated.service.MeetingBookingService; +import com.bsd.pjcloud.integrated.service.MeetingEquipmentService; import com.bsd.pjcloud.integrated.service.MeetingRoomEquipmentService; import com.bsd.pjcloud.integrated.service.MeetingRoomService; +import com.bsd.pjcloud.integrated.vo.meeting.app.MeetingBookingDetailVo; +import com.bsd.pjcloud.integrated.vo.meeting.app.MeetingBookingListVo; import com.bsd.pjcloud.integrated.vo.meeting.app.MeetingBookingReqVo; import com.bsd.pjcloud.integrated.vo.meeting.app.MeetingRoomPageVo; import com.bsd.pjcloud.integrated.vo.meeting.app.TimeSlotVo; @@ -70,6 +75,8 @@ public class MeetingRoomController { private final MeetingRoomEquipmentService meetingRoomEquipmentService; + private final MeetingEquipmentService meetingEquipmentService; + private final MeetingBookingService meetingBookingService; private final RemoteFlowApiFlowService remoteFlowApiFlowService; @@ -315,7 +322,8 @@ public class MeetingRoomController { booking.setBookingDate(bookingDate); booking.setStartTime(startTime); booking.setEndTime(endTime); - + booking.setDeskLayout(reqVo.getDeskLayout()); + booking.setNeedService(reqVo.getNeedService()); //发起流程 R processByBusinessKey = remoteFlowApiFlowService.getProcessByBusinessKey(IntegratedFlowConstant.INTEGRATED_MEETING_BOOKING); @@ -349,19 +357,108 @@ public class MeetingRoomController { * @param checkStatus 审核状态(可选),传空查全部 */ @GetMapping("/app/my-bookings") - public R> myBookings(@ParameterObject Page page, @RequestParam(value = "checkStatus", required = false) String checkStatus) { + public R> myBookings(@ParameterObject Page page, @RequestParam(value = "checkStatus", required = false) String checkStatus) { Long userId = SecurityUtils.getUser().getId(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() .eq(MeetingBookingEntity::getApplicantId, userId); if (checkStatus != null && !checkStatus.isEmpty()) { wrapper.eq(MeetingBookingEntity::getCheckStatus, checkStatus); } - wrapper.orderByDesc(MeetingBookingEntity::getBookingDate) + wrapper.orderByDesc(MeetingBookingEntity::getCreateTime) + .orderByDesc(MeetingBookingEntity::getBookingDate) .orderByDesc(MeetingBookingEntity::getStartTime); - Page result = meetingBookingService.page(page, wrapper); - return R.ok(result); + Page entityPage = meetingBookingService.page(page, wrapper); + + // 批量查会议室名称,避免N+1 + List roomIds = entityPage.getRecords().stream().map(MeetingBookingEntity::getRoomId).distinct().toList(); + Map roomNameMap = new HashMap<>(); + if (!roomIds.isEmpty()) { + List rooms = meetingRoomService.listByIds(roomIds); + for (MeetingRoomEntity room : rooms) { + roomNameMap.put(room.getId(), room.getRoomName()); + } + } + + // 转VO + List voList = entityPage.getRecords().stream().map(e -> { + MeetingBookingListVo vo = new MeetingBookingListVo(); + vo.setId(e.getId()); + vo.setTitle(e.getTitle()); + vo.setRoomId(e.getRoomId()); + vo.setRoomName(roomNameMap.get(e.getRoomId())); + vo.setDescription(e.getDescription()); + vo.setCheckStatus(e.getCheckStatus()); + vo.setCheckStatusText(getCheckStatusText(e.getCheckStatus())); + vo.setApplicantId(e.getApplicantId()); + vo.setApplicantName(SecurityUtils.getUser().getUsername()); + vo.setAssigneeName(e.getAssigneeName()); + vo.setBookingDate(e.getBookingDate()); + vo.setStartTime(e.getStartTime()); + vo.setEndTime(e.getEndTime()); + vo.setDuration(calculateDuration(e.getStartTime(), e.getEndTime())); + vo.setNeedService(e.getNeedService()); + vo.setDeskLayout(e.getDeskLayout()); + vo.setCheckReason(e.getCheckReason()); + vo.setIsConfirmEnd(e.getIsConfirmEnd()); + vo.setCreateTime(e.getCreateTime()); + return vo; + }).toList(); + + Page voPage = new Page<>(entityPage.getCurrent(), entityPage.getSize(), entityPage.getTotal()); + voPage.setRecords(voList); + return R.ok(voPage); } + /** + * 获取审核状态描述 + */ + private String getCheckStatusText(String checkStatus) { + if (checkStatus == null) return ""; + switch (checkStatus) { + case "1": return "审核中"; + case "2": return "审核通过"; + case "3": return "审核拒绝"; + case "4": return "已取消"; + case "5": return "取消"; + case "0": return "已到访"; + default: return "未知状态"; + } + } + + /** + * 计算会议时长(分钟) + */ + private Integer calculateDuration(LocalTime startTime, LocalTime endTime) { + if (startTime == null || endTime == null) return 0; + return (int) java.time.Duration.between(startTime, endTime).toMinutes(); + } + + /** + * 获取会议室状态描述 + */ + private String getRoomStatusText(String status) { + if (status == null) return ""; + switch (status) { + case IntegratedConstants.MeetingRoomStatus.MAINTENANCE: return "维护中"; + case IntegratedConstants.MeetingRoomStatus.AVAILABLE: return "可用"; + default: return "未知状态"; + } + } + + /** + * 获取是否需要会务服务描述 + */ + private String getNeedServiceText(String needService) { + if (needService == null) return ""; + switch (needService) { + case IntegratedConstants.NeedService.NO: return "不需要"; + case IntegratedConstants.NeedService.YES: return "需要"; + default: return "未知"; + } + } + + + /** * 取消预约 */ @@ -385,7 +482,7 @@ public class MeetingRoomController { * 预约详情 */ @GetMapping("/app/booking-detail/{bookingId}") - public R bookingDetail(@PathVariable("bookingId") Long bookingId) { + public R bookingDetail(@PathVariable("bookingId") Long bookingId) { Long userId = SecurityUtils.getUser().getId(); MeetingBookingEntity booking = meetingBookingService.getById(bookingId); if (booking == null) { @@ -394,7 +491,82 @@ public class MeetingRoomController { if (!Objects.equals(booking.getApplicantId(), userId)) { return R.failed("无权查看他人预约详情"); } - return R.ok(booking); + + // 查询会议室详细信息 + MeetingRoomEntity room = meetingRoomService.getById(booking.getRoomId()); + if (room == null) { + return R.failed("会议室不存在"); + } + + // 查询会议室设备信息 + List equipmentList = meetingRoomEquipmentService.list( + Wrappers.lambdaQuery() + .eq(MeetingRoomEquipmentEntity::getRoomId, booking.getRoomId()) + ); + + // 构建设备信息字符串 + StringBuilder equipmentInfo = new StringBuilder(); + if (!equipmentList.isEmpty()) { + // 获取所有设备ID + List equipmentIds = equipmentList.stream() + .map(MeetingRoomEquipmentEntity::getEquipId) + .distinct() + .toList(); + + // 批量查询设备信息 + Map equipmentNameMap = new HashMap<>(); + if (!equipmentIds.isEmpty()) { + List equipments = meetingEquipmentService.listByIds(equipmentIds); + for (MeetingEquipmentEntity equipment : equipments) { + equipmentNameMap.put(equipment.getId(), equipment.getName()); + } + } + + // 构建设备信息字符串 + for (MeetingRoomEquipmentEntity roomEquipment : equipmentList) { + if (equipmentInfo.length() > 0) { + equipmentInfo.append("、"); + } + String equipmentName = equipmentNameMap.get(roomEquipment.getEquipId()); + if (equipmentName != null) { + equipmentInfo.append(equipmentName) + .append("(").append(roomEquipment.getQuantity()).append("台)"); + } + } + } + + // 转换为VO + MeetingBookingDetailVo vo = new MeetingBookingDetailVo(); + vo.setId(booking.getId()); + vo.setTitle(booking.getTitle()); + vo.setRoomId(booking.getRoomId()); + vo.setRoomName(room.getRoomName()); + vo.setRoomLocation(room.getLocation()); + vo.setRoomCapacity(room.getCapacity()); + vo.setRoomEquipment(equipmentInfo.toString()); + vo.setRoomPicUrl(room.getPicUrl()); + vo.setRoomDescription(room.getDescription()); + vo.setRoomStatus(room.getStatus()); + vo.setRoomStatusText(getRoomStatusText(room.getStatus())); + vo.setDescription(booking.getDescription()); + vo.setCheckStatus(booking.getCheckStatus()); + vo.setCheckStatusText(getCheckStatusText(booking.getCheckStatus())); + vo.setCheckReason(booking.getCheckReason()); + vo.setApplicantId(booking.getApplicantId()); + vo.setApplicantName(SecurityUtils.getUser().getUsername()); + vo.setAssigneeName(booking.getAssigneeName()); + vo.setBookingDate(booking.getBookingDate()); + vo.setStartTime(booking.getStartTime()); + vo.setEndTime(booking.getEndTime()); + vo.setDuration(calculateDuration(booking.getStartTime(), booking.getEndTime())); + vo.setNeedService(booking.getNeedService()); + vo.setNeedServiceText(getNeedServiceText(booking.getNeedService())); + vo.setDeskLayout(booking.getDeskLayout()); + vo.setDeskLayoutText(booking.getDeskLayout()); + vo.setIsConfirmEnd(booking.getIsConfirmEnd()); + vo.setCreateBy(booking.getCreateBy()); + vo.setCreateTime(booking.getCreateTime()); + return R.ok(vo); } @@ -409,10 +581,23 @@ public class MeetingRoomController { System.out.println(processNodeRecordParamDto.getData()); LambdaQueryWrapper boxesBookingEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); boxesBookingEntityLambdaQueryWrapper.eq(MeetingBookingEntity::getProcessInstanceId, processInstanceId); + MeetingBookingEntity one = meetingBookingService.getOne(boxesBookingEntityLambdaQueryWrapper); + if (null== one){ + return R.failed("流程不存在"); + } CheckStatusAndReasonVo checkReason = GetCheckReasonUtils.getCheckReason(processNodeRecordParamDto); meetingBookingEntity.setCheckStatus(checkReason.getCheckStatus()); meetingBookingEntity.setCheckReason(checkReason.getCheckReason()); - meetingBookingService.update(meetingBookingEntity,boxesBookingEntityLambdaQueryWrapper); + Long id = one.getId(); + meetingBookingEntity.setId(id); + meetingBookingService.updateById(meetingBookingEntity); + + + //发送通知短信,告知会议打扫 + meetingBookingService.noticeVisitDesk(one); + + //告知预约人 + meetingBookingService.noticeVisitor(one); return R.ok(); } diff --git a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/MeetingBookingService.java b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/MeetingBookingService.java index 395f39c5e..11ca9295c 100644 --- a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/MeetingBookingService.java +++ b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/MeetingBookingService.java @@ -27,8 +27,14 @@ public interface MeetingBookingService extends IService { /** * 通知阿姨会议前整理会议室 - * @param bookingId + * @param * @return */ - void noticeVisitDesk(Long bookingId); + void noticeVisitDesk(MeetingBookingEntity meetingBookingEntity); + + /** + * 通知会议预约人 + * @param + */ + void noticeVisitor(MeetingBookingEntity meetingBookingEntity); } \ No newline at end of file diff --git a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/impl/MeetingBookingServiceImpl.java b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/impl/MeetingBookingServiceImpl.java index b0316e51c..abe4dea97 100644 --- a/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/impl/MeetingBookingServiceImpl.java +++ b/pjcloud-integrated/pjcloud-integrated-biz/src/main/java/com/bsd/pjcloud/integrated/service/impl/MeetingBookingServiceImpl.java @@ -66,41 +66,52 @@ public class MeetingBookingServiceImpl extends ServiceImpl stringStringHashMap = new HashMap<>(); stringStringHashMap.put("meetingName", meetingRoomEntity.getRoomName()+",地址:"+meetingRoomEntity.getLocation()); - stringStringHashMap.put("meetingDate", booking.getBookingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - stringStringHashMap.put("deskType", "1"); + String format = meetingBookingEntity.getBookingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + stringStringHashMap.put("meetingDate", format); + stringStringHashMap.put("deskType", meetingBookingEntity.getDeskLayout()==null?"无要求":meetingBookingEntity.getDeskLayout()); reminderThirdPartySmsService.sendParamsMsg(cleanUserEntity.getPhone(), "30758", stringStringHashMap, WebUtils.getIP()); }else { + System.out.println("没有设置阿姨,无法发送短信"); //没有设置阿姨,无法发送短信 } } - - private void sendConfirmEndMeetingSms(VisitorUserEntity visitorUserEntity, VisitorsEntity dataVisitors) { - Map stringStringHashMap = new HashMap<>(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - stringStringHashMap.put("createTime", visitorUserEntity.getCreateTime().format(formatter)); - stringStringHashMap.put("visitorName", visitorUserEntity.getRealName()==null?visitorUserEntity.getPhone():visitorUserEntity.getRealName()); - stringStringHashMap.put("visitorPhone", visitorUserEntity.getPhone()); - stringStringHashMap.put("visitorTime", dataVisitors.getVStartDate() + "至" + dataVisitors.getVEndDate()); - stringStringHashMap.put("visitorLocal", dataVisitors.getDeptName()); + @Override + public void noticeVisitor(MeetingBookingEntity meetingBookingEntity) { - reminderThirdPartySmsService.sendParamsMsg(visitorUserEntity.getPhone(), "20658", stringStringHashMap, WebUtils.getIP()); } + +// private void sendConfirmEndMeetingSms(VisitorUserEntity visitorUserEntity, VisitorsEntity dataVisitors) { +// Map stringStringHashMap = new HashMap<>(); +// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); +// stringStringHashMap.put("createTime", visitorUserEntity.getCreateTime().format(formatter)); +// stringStringHashMap.put("visitorName", visitorUserEntity.getRealName()==null?visitorUserEntity.getPhone():visitorUserEntity.getRealName()); +// stringStringHashMap.put("visitorPhone", visitorUserEntity.getPhone()); +// stringStringHashMap.put("visitorTime", dataVisitors.getVStartDate() + "至" + dataVisitors.getVEndDate()); +// stringStringHashMap.put("visitorLocal", dataVisitors.getDeptName()); +// +// +// reminderThirdPartySmsService.sendParamsMsg(visitorUserEntity.getPhone(), "30757", stringStringHashMap, WebUtils.getIP()); +// } } \ No newline at end of file diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/resources/application.yml b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/resources/application.yml index 65cfbe6f0..387dde7a7 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/resources/application.yml +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/resources/application.yml @@ -140,6 +140,10 @@ sms: content: "阿姨您好!{s20}已完成会议,麻烦您前去做好整洁清理工作。" params: [ "meetingName" ] + 31550: + content: "您于{s20}预约的{s20}会议室,现已通过审核,请提前做好会议安排。" + params: [ "meetingName", "meetingDate" ] + settings: default-ext-code: "" timeout-seconds: 300