会议
This commit is contained in:
1 parent
bcb4b20744
commit
8198bd7484
8 files changed
+84
-13
No files matched your search
+5
@@ -90,5 +90,10 @@ public class CanteenErpMaterialEntity extends Model<CanteenErpMaterialEntity> {
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
/**
|
||||
* 采购价格
|
||||
*/
|
||||
@Schema(description="采购价格")
|
||||
private Integer purchasePrice;
|
||||
|
||||
}
|
||||
+1
@@ -14,6 +14,7 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="purchasePrice" column="purchase_price"/>
|
||||
</resultMap>
|
||||
<select id="selectPageDataByScope" resultType="com.bsd.pjcloud.canteen.vo.erp.CanteenErpMaterialVO">
|
||||
SELECT
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.integrated.vo.meeting.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class EquipmentVo {
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Schema(description="设备名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 设备数量
|
||||
*/
|
||||
@Schema(description="设备数量")
|
||||
private Integer quantity;
|
||||
}
|
||||
+2
@@ -68,6 +68,8 @@ public class MeetingRoomPageVo {
|
||||
private String availableTime;
|
||||
|
||||
|
||||
@Schema(description="设备名称")
|
||||
private List<EquipmentVo> equipmentNames;
|
||||
|
||||
|
||||
}
|
||||
+2
-2
@@ -143,10 +143,10 @@ public class MeetingRoomController {
|
||||
|
||||
|
||||
/**---------------------------APP------------------------------*/
|
||||
@GetMapping("/app/list")
|
||||
@GetMapping("/app/page")
|
||||
public R<Page<MeetingRoomPageVo>> appList(@ParameterObject Page page, @ParameterObject MeetingRoomEntity meetingRoom) {
|
||||
LambdaQueryWrapper<MeetingRoomEntity> meetingRoomEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
meetingRoomEntityLambdaQueryWrapper.eq(MeetingRoomEntity::getStatus, YesNoEnum.YES.getCode());
|
||||
meetingRoomEntityLambdaQueryWrapper.eq(MeetingRoomEntity::getStatus, YesNoEnum.NO.getCode());
|
||||
meetingRoomEntityLambdaQueryWrapper.orderByDesc(MeetingRoomEntity::getSort).orderByDesc(MeetingRoomEntity::getId);
|
||||
|
||||
Page<MeetingRoomPageVo> pageData = meetingRoomService.MeetingRoomPageScope(page, meetingRoomEntityLambdaQueryWrapper);
|
||||
|
||||
+6
@@ -4,8 +4,14 @@ import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MeetingBookingMapper extends PjcloudBaseMapper<MeetingBookingEntity> {
|
||||
|
||||
|
||||
|
||||
|
||||
List<MeetingBookingEntity> findByRoomIdAndDate(Long roomId, LocalDate date);
|
||||
}
|
||||
+44
-11
@@ -4,13 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
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.mapper.MeetingBookingMapper;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingEquipmentMapper;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingRoomEquipmentMapper;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingRoomMapper;
|
||||
import com.bsd.pjcloud.integrated.service.MeetingRoomService;
|
||||
import com.bsd.pjcloud.integrated.vo.meeting.app.EquipmentVo;
|
||||
import com.bsd.pjcloud.integrated.vo.meeting.app.MeetingRoomPageVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -18,10 +21,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,7 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
private final MeetingRoomEquipmentMapper meetingRoomEquipmentMapper;
|
||||
private final MeetingEquipmentMapper meetingEquipmentMapper;
|
||||
|
||||
private final MeetingBookingMapper meetingBookingMapper ;
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<MeetingRoomEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
@@ -157,21 +159,31 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 3.1 批量查询设备关联信息
|
||||
// Map<Long, List<MeetingRoomEquipmentEntity>> equipmentMap = getRoomEquipmentMap(roomIds);
|
||||
Map<Long, List<MeetingRoomEquipmentEntity>> equipmentMap = getRoomEquipmentMap(roomIds);
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
// 4. 转换记录列表
|
||||
List<MeetingRoomPageVo> voRecords = entityPage.getRecords().stream().map(entity -> {
|
||||
List<String> timeline = buildTimelineForRoom(entity.getId(), today);
|
||||
|
||||
MeetingRoomPageVo vo = new MeetingRoomPageVo();
|
||||
// 4.1 基础字段拷贝
|
||||
BeanUtils.copyProperties(entity, vo);
|
||||
|
||||
// 4.2 设置设备信息
|
||||
// List<MeetingRoomEquipmentEntity> equipments = equipmentMap.get(entity.getId());
|
||||
// if (!CollectionUtils.isEmpty(equipments)) {
|
||||
// vo.setEquipmentNames(equipments.stream()
|
||||
// .map(MeetingRoomEquipmentEntity::getEquipmentName)
|
||||
// .collect(Collectors.toList()));
|
||||
// }
|
||||
List<MeetingRoomEquipmentEntity> equipments = equipmentMap.get(entity.getId());
|
||||
List<EquipmentVo> equipmentVos = new ArrayList<EquipmentVo>();
|
||||
|
||||
if (!CollectionUtils.isEmpty(equipments)) {
|
||||
equipments.forEach(roomEquip -> {
|
||||
EquipmentVo equipmentVo = new EquipmentVo();
|
||||
equipmentVo.setName(roomEquip.getEquipmentName());
|
||||
equipmentVo.setQuantity(roomEquip.getQuantity());
|
||||
equipmentVos.add(equipmentVo);
|
||||
});
|
||||
|
||||
}
|
||||
vo.setEquipmentNames(equipmentVos);
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
@@ -179,6 +191,7 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
voPage.setRecords(voRecords);
|
||||
return voPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取会议室设备关联信息
|
||||
*/
|
||||
@@ -214,4 +227,24 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
return equipmentList.stream()
|
||||
.collect(Collectors.groupingBy(MeetingRoomEquipmentEntity::getRoomId));
|
||||
}
|
||||
|
||||
|
||||
public List<String> buildTimelineForRoom(Long roomId, LocalDate date) {
|
||||
int startHour = 8, endHour = 24, slotCount = endHour - startHour;
|
||||
List<String> timeline = new ArrayList<>(Collections.nCopies(slotCount, "free"));
|
||||
List<MeetingBookingEntity> bookings = meetingBookingMapper.findByRoomIdAndDate(roomId, date);
|
||||
for (MeetingBookingEntity booking : bookings) {
|
||||
int bookingStart = booking.getStartTime().getHour();
|
||||
int bookingEnd = booking.getEndTime().getHour();
|
||||
for (int h = bookingStart; h < bookingEnd; h++) {
|
||||
int idx = h - startHour;
|
||||
if (idx >= 0 && idx < slotCount) {
|
||||
timeline.set(idx, "busy");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 例:12:00-13:00 不可用
|
||||
timeline.set(4, "disabled");
|
||||
return timeline;
|
||||
}
|
||||
}
|
||||
+3
@@ -21,4 +21,7 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
<select id="findByRoomIdAndDate" resultType="com.bsd.pjcloud.integrated.entity.MeetingBookingEntity">
|
||||
SELECT * FROM meeting_booking WHERE room_id = #{roomId} AND start_time >= #{startTime} AND start_time <= #{endTime}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user