综合服务优化修复

This commit is contained in:
zjf committed 2025-09-16 18:19:47 +08:00
1 parent 2b54d4e632
commit 42557a9bd0
7 files changed
+277 -34

No files matched your search

@@ -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";
}
}
@@ -30,4 +30,10 @@ public class MeetingBookingReqVo {
@Schema(description = "参会人员ID列表")
private List<Long> attendees;
@Schema(description = "桌子摆放形态")
private String deskLayout;
@Schema(description = "是否需要会务服务")
private String needService;
}
@@ -259,9 +259,9 @@ public class MeetingBookingController {
/**
* 会议开始之前,通知阿姨需要对会议室桌面和桌椅拜访进行整理
*/
@PostMapping("/app/notice-visit-desk/{bookingId}")
public R<Boolean> noticeVisitDesk(@PathVariable("bookingId") Long bookingId) {
meetingBookingService.noticeVisitDesk(bookingId);
return R.ok();
}
// @PostMapping("/app/notice-visit-desk/{bookingId}")
// public R<Boolean> noticeVisitDesk(@PathVariable("bookingId") Long bookingId) {
// meetingBookingService.noticeVisitDesk(bookingId);
// return R.ok();
// }
}
@@ -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<Process> processByBusinessKey = remoteFlowApiFlowService.getProcessByBusinessKey(IntegratedFlowConstant.INTEGRATED_MEETING_BOOKING);
@@ -349,19 +357,108 @@ public class MeetingRoomController {
* @param checkStatus 审核状态(可选),传空查全部
*/
@GetMapping("/app/my-bookings")
public R<Page<MeetingBookingEntity>> myBookings(@ParameterObject Page page, @RequestParam(value = "checkStatus", required = false) String checkStatus) {
public R<Page<MeetingBookingListVo>> myBookings(@ParameterObject Page page, @RequestParam(value = "checkStatus", required = false) String checkStatus) {
Long userId = SecurityUtils.getUser().getId();
LambdaQueryWrapper<MeetingBookingEntity> wrapper = Wrappers.<MeetingBookingEntity>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<MeetingBookingEntity> result = meetingBookingService.page(page, wrapper);
return R.ok(result);
Page<MeetingBookingEntity> entityPage = meetingBookingService.page(page, wrapper);
// 批量查会议室名称,避免N+1
List<Long> roomIds = entityPage.getRecords().stream().map(MeetingBookingEntity::getRoomId).distinct().toList();
Map<Long, String> roomNameMap = new HashMap<>();
if (!roomIds.isEmpty()) {
List<MeetingRoomEntity> rooms = meetingRoomService.listByIds(roomIds);
for (MeetingRoomEntity room : rooms) {
roomNameMap.put(room.getId(), room.getRoomName());
}
}
// 转VO
List<MeetingBookingListVo> 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<MeetingBookingListVo> 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<MeetingBookingEntity> bookingDetail(@PathVariable("bookingId") Long bookingId) {
public R<MeetingBookingDetailVo> 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<MeetingRoomEquipmentEntity> equipmentList = meetingRoomEquipmentService.list(
Wrappers.<MeetingRoomEquipmentEntity>lambdaQuery()
.eq(MeetingRoomEquipmentEntity::getRoomId, booking.getRoomId())
);
// 构建设备信息字符串
StringBuilder equipmentInfo = new StringBuilder();
if (!equipmentList.isEmpty()) {
// 获取所有设备ID
List<Long> equipmentIds = equipmentList.stream()
.map(MeetingRoomEquipmentEntity::getEquipId)
.distinct()
.toList();
// 批量查询设备信息
Map<Long, String> equipmentNameMap = new HashMap<>();
if (!equipmentIds.isEmpty()) {
List<MeetingEquipmentEntity> 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<MeetingBookingEntity> 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();
}
@@ -27,8 +27,14 @@ public interface MeetingBookingService extends IService<MeetingBookingEntity> {
/**
* 通知阿姨会议前整理会议室
* @param bookingId
* @param
* @return
*/
void noticeVisitDesk(Long bookingId);
void noticeVisitDesk(MeetingBookingEntity meetingBookingEntity);
/**
* 通知会议预约人
* @param
*/
void noticeVisitor(MeetingBookingEntity meetingBookingEntity);
}
@@ -66,41 +66,52 @@ public class MeetingBookingServiceImpl extends ServiceImpl<MeetingBookingMapper,
return updated;
}
/**
* 通知整理会议室
* @param
*/
@Override
public void noticeVisitDesk(Long bookingId) {
Long currentUserId = SecurityUtils.getUser().getId();
public void noticeVisitDesk(MeetingBookingEntity meetingBookingEntity) {
// Long currentUserId = SecurityUtils.getUser().getId();
//更新会议预约结束状态
MeetingBookingEntity booking = new MeetingBookingEntity();
if (!booking.getApplicantId().equals(currentUserId)){
throw new RuntimeException("无权限操作");
}
// MeetingBookingEntity booking = new MeetingBookingEntity();
// if (!booking.getApplicantId().equals(currentUserId)){
// throw new RuntimeException("无权限操作");
// }
//查询会议室阿姨信息
MeetingRoomEntity meetingRoomEntity = meetingRoomMapper.selectById(booking.getRoomId());
MeetingRoomEntity meetingRoomEntity = meetingRoomMapper.selectById(meetingBookingEntity.getRoomId());
Long cleanUserId = meetingRoomEntity.getCleanUserId();
if (cleanUserId != null){
CleanUserEntity cleanUserEntity = cleanUserMapper.selectById(cleanUserId);
//发送短信通知阿姨
Map<String, String> 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<String, String> 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<String, String> 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());
// }
}
@@ -140,6 +140,10 @@ sms:
content: "阿姨您好!{s20}已完成会议,麻烦您前去做好整洁清理工作。"
params: [ "meetingName" ]
31550:
content: "您于{s20}预约的{s20}会议室,现已通过审核,请提前做好会议安排。"
params: [ "meetingName", "meetingDate" ]
settings:
default-ext-code: ""
timeout-seconds: 300