Compare commits
No commits in common. "d8bff2e17e8d7b16d05416062182ed7dba5c5a61" and "2c342eb0877e0bb044c783c677c1a59511156899" have entirely different histories.
d8bff2e17e
...
2c342eb087
|
@ -59,8 +59,6 @@ public class BookMeetingRoomController {
|
||||||
@ApiImplicitParam(name = "bookDate", value = "预约开始时间", paramType = "query", dataType = "String"),
|
@ApiImplicitParam(name = "bookDate", value = "预约开始时间", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "startTime", value = "预约开始时间", paramType = "query", dataType = "String"),
|
@ApiImplicitParam(name = "startTime", value = "预约开始时间", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "endTime", value = "预约结束时间", paramType = "query", dataType = "String"),
|
@ApiImplicitParam(name = "endTime", value = "预约结束时间", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
|
|
||||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
|
|
||||||
})
|
})
|
||||||
public Result<PageData<TMeetingroomDTO>> list(@ApiIgnore @RequestParam Map<String, Object> params) {
|
public Result<PageData<TMeetingroomDTO>> list(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
PageData<TMeetingroomDTO> list = tMeetingroomService.selectFreeRoom(params);
|
PageData<TMeetingroomDTO> list = tMeetingroomService.selectFreeRoom(params);
|
||||||
|
|
|
@ -36,6 +36,4 @@ public interface TMeetingroomBookMapper extends BaseDao<TMeetingroomBook> {
|
||||||
List<TMeetingroomBook> selectInvalid(Date date);
|
List<TMeetingroomBook> selectInvalid(Date date);
|
||||||
|
|
||||||
List<Long> selectBookIdByRoomId(Long id);
|
List<Long> selectBookIdByRoomId(Long id);
|
||||||
|
|
||||||
Long countApply(Long id);
|
|
||||||
}
|
}
|
|
@ -42,8 +42,6 @@ public class TMeetingroomDTO implements Serializable {
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
@ApiModelProperty(value = "价格")
|
@ApiModelProperty(value = "价格")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
@ApiModelProperty(value = "申请成功次数")
|
|
||||||
private Long applyCount;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -15,11 +15,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TMeetingroomServiceImpl extends CrudServiceImpl<TMeetingroomMapper, TMeetingroom, TMeetingroomDTO> implements TMeetingroomService {
|
public class TMeetingroomServiceImpl extends CrudServiceImpl<TMeetingroomMapper, TMeetingroom, TMeetingroomDTO> implements TMeetingroomService {
|
||||||
|
@ -88,39 +86,20 @@ public class TMeetingroomServiceImpl extends CrudServiceImpl<TMeetingroomMapper,
|
||||||
String finalBookDate = bookDate + " 00:00:00";
|
String finalBookDate = bookDate + " 00:00:00";
|
||||||
String finalStartTime = "1970-01-01 " + startTime;
|
String finalStartTime = "1970-01-01 " + startTime;
|
||||||
String finalEndTime = "1970-01-01 " + endTime;
|
String finalEndTime = "1970-01-01 " + endTime;
|
||||||
Stream<TMeetingroomDTO> temp = tMeetingroomDTOS.stream().filter(room -> {
|
tMeetingroomDTOS = tMeetingroomDTOS.stream().filter(room -> {
|
||||||
// 如果有时间,根据时间段去预约表搜,如果搜不到,那就芜湖起飞
|
// 如果有时间,根据时间段去预约表搜,如果搜不到,那就芜湖起飞
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
if ("null 00:00:00".equals(finalBookDate) || "1970-01-01 ".equals(finalStartTime) || "1970-01-01 ".equals(finalEndTime)) {
|
if ("null 00:00:00".equals(finalBookDate) || "1970-01-01 ".equals(finalStartTime) || "1970-01-01 ".equals(finalEndTime)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TMeetingroomBookDTO> meetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(room.getId(), finalBookDate,
|
List<TMeetingroomBookDTO> meetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(room.getId(), finalBookDate,
|
||||||
finalStartTime, finalEndTime);
|
finalStartTime, finalEndTime);
|
||||||
if (CollectionUtils.isEmpty(meetingroomBookDTOS)) {
|
if (CollectionUtils.isEmpty(meetingroomBookDTOS)) {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}).map(index -> {
|
}).collect(Collectors.toList());
|
||||||
index.setApplyCount(tMeetingroomBookMapper.countApply(index.getId()));
|
|
||||||
return index;
|
|
||||||
});
|
|
||||||
// 增加排序
|
|
||||||
if (params.containsKey("orderField") && params.containsKey("orderType")) {
|
|
||||||
if ("applyCount".equals(params.get("orderField"))) {
|
|
||||||
if ("DESC".equals(params.get("orderType"))) {
|
|
||||||
tMeetingroomDTOS = temp.sorted(Comparator.comparing(x -> {
|
|
||||||
TMeetingroomDTO index = (TMeetingroomDTO) x;
|
|
||||||
return index.getApplyCount();
|
|
||||||
}).reversed()).collect(Collectors.toList());
|
|
||||||
} else {
|
|
||||||
tMeetingroomDTOS = temp.sorted(Comparator.comparing(x -> x.getApplyCount())).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tMeetingroomDTOS = temp.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tMeetingroomDTOS = temp.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<TMeetingroomDTO> pageSizeDataForRelations = PageUtil.getPageSizeDataForRelations(tMeetingroomDTOS, pageSize, page);
|
List<TMeetingroomDTO> pageSizeDataForRelations = PageUtil.getPageSizeDataForRelations(tMeetingroomDTOS, pageSize, page);
|
||||||
|
|
||||||
|
|
|
@ -148,8 +148,5 @@
|
||||||
<select id="selectBookIdByRoomId" resultType="java.lang.Long">
|
<select id="selectBookIdByRoomId" resultType="java.lang.Long">
|
||||||
SELECT id FROM t_meetingroom_book WHERE room_id = #{id}
|
SELECT id FROM t_meetingroom_book WHERE room_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="countApply" resultType="java.lang.Long">
|
|
||||||
SELECT COUNT(id) FROM t_meetingroom_book WHERE room_id = #{id} AND state = 2;
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue