|
@@ -1,8 +1,11 @@
|
|
|
package com.fdkankan.tk.service;
|
|
|
+import cn.hutool.core.date.DateUnit;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.tk.common.PageInfo;
|
|
|
import com.fdkankan.tk.entity.Room;
|
|
|
import com.fdkankan.tk.entity.RoomNum;
|
|
|
+import com.fdkankan.tk.entity.RoomUser;
|
|
|
import com.fdkankan.tk.response.*;
|
|
|
import com.fdkankan.tk.util.DataCountUtil;
|
|
|
import com.fdkankan.tk.util.Dateutils;
|
|
@@ -32,6 +35,8 @@ public class DataCountService {
|
|
|
IRoomNumService roomNumService;
|
|
|
@Autowired
|
|
|
ISceneService sceneService;
|
|
|
+ @Autowired
|
|
|
+ IRoomUserService roomUserService;
|
|
|
|
|
|
|
|
|
public Object roomData() {
|
|
@@ -160,20 +165,34 @@ public class DataCountService {
|
|
|
list = sceneService.getListByNumList(new ArrayList<>(numList));
|
|
|
list.forEach(entity -> sceneMap.put(entity.getNum(),entity));
|
|
|
}
|
|
|
+
|
|
|
+ List<DataCount> roomList = roomVisitLogService.getGroupByRoomId();
|
|
|
+ HashMap<String,Long> roomManMap = new HashMap<>();
|
|
|
+ roomList.forEach(entity -> roomManMap.put(entity.getDataKey(),entity.getDataCount()));
|
|
|
+
|
|
|
+ List<DataCount> roomShareList = roomShareLogService.getGroupByRoomId();
|
|
|
+ HashMap<String,Long> roomShareMap = new HashMap<>();
|
|
|
+ roomShareList.forEach(entity -> roomShareMap.put(entity.getDataKey(),entity.getDataCount()));
|
|
|
+
|
|
|
for (Room record : page.getRecords()) {
|
|
|
List<RoomNum> roomNums = numRoomMap.get(record.getRoomId());
|
|
|
List<String> sceneTileList = new ArrayList<>();
|
|
|
roomNums.forEach(entity -> {
|
|
|
sceneTileList.add(sceneMap.get(entity.getNum()).getTitle());
|
|
|
});
|
|
|
+ List<RoomUser> roomUserList = roomUserService.getByRoomId(record.getRoomId());
|
|
|
+ Long minute = Dateutils.getLongTime(record.getUseStartTime(), record.getUseEndTime(),DateUnit.MINUTE);
|
|
|
+ for (RoomUser roomUser : roomUserList) {
|
|
|
+ minute += Dateutils.getLongTime(roomUser.getUseStartTime(), roomUser.getUseEndTime(),DateUnit.MINUTE);
|
|
|
+ }
|
|
|
RoomListDataVo roomListDataVo = new RoomListDataVo();
|
|
|
roomListDataVo.setRoomTitle(record.getRoomTitle());
|
|
|
roomListDataVo.setSceneNameList(sceneTileList);
|
|
|
roomListDataVo.setCreateTime(record.getCreateTime());
|
|
|
roomListDataVo.setRoomStatus(record.getRoomStatus());
|
|
|
- roomListDataVo.setLookTime(0L);
|
|
|
- roomListDataVo.setLookManCount(0L);
|
|
|
- roomListDataVo.setShareCount(0L);
|
|
|
+ roomListDataVo.setLookTime(minute);
|
|
|
+ roomListDataVo.setLookManCount(roomManMap.get(record.getRoomId()) == null ? 0L:roomManMap.get(record.getRoomId()) );
|
|
|
+ roomListDataVo.setShareCount(roomShareMap.get(record.getRoomId()) == null ? 0L:roomShareMap.get(record.getRoomId()) );
|
|
|
voList.add(roomListDataVo);
|
|
|
}
|
|
|
Page<RoomListDataVo> pageVo = new Page<>(pageNum,pageSize);
|