修改了对应企业的bug

This commit is contained in:
chendaze 2024-06-12 15:48:10 +08:00
parent d35bfa64e3
commit 7abb49419b
6 changed files with 43 additions and 15 deletions

View File

@ -272,13 +272,22 @@ public class RoomContentController extends BaseController {
room.setDeleteFlag(0);
room.setBuildingDetailIds(room.getBuildingDetailIds());
List<Room> rooms = roomService.selectRoomList(room);
if (CollUtil.isNotEmpty(room.getIds()) ){
for (Long id : room.getIds()) {
Room room1 = roomService.selectRoomById(id);
String customerId = room.getCustomerId();
Customer customer = customerService.selectCustomerById(Long.valueOf(customerId));
String roomId = customer.getRoomId();
List<String> roomIds = StrUtil.split(roomId, ',');
if (CollUtil.isNotEmpty(roomIds) ){
for (String id : roomIds) {
Room room1 = roomService.selectRoomById(Long.valueOf(id));
if (null != room1){
rooms.add(room1);
}
}
}
return R.ok().put("data",rooms);
}

View File

@ -324,4 +324,7 @@ public class Room extends BaseEntity<Room> {
@TableField(exist = false)
private List<Long> ids;
@TableField(exist = false)
private String customerId;
}

View File

@ -36,4 +36,7 @@ public class RoomRecord extends BaseEntity<RoomRecord> {
private String type;
@TableField(exist = false)
private String equipmentType;
}

View File

@ -155,9 +155,10 @@ public class UserEquipmentServiceImpl extends ServiceImpl<UserEquipmentMapper, U
if (CollUtil.isEmpty(list)) {
return list;
}
List<Equipment> equipment = equipmentService.selectEquipmentList(new Equipment());
// List<Equipment> equipment = equipmentService.selectEquipmentList(new Equipment());
updateDeviceDataSource(equipment);
//todo 查看对应的设备的状态
// updateDeviceDataSource(equipment);
ArrayList<Equipment> equipments = new ArrayList<>();

View File

@ -46,7 +46,6 @@ public class ShowroomServiceImpl extends ServiceImpl<ShowroomMapper, Showroom> i
queryWrapper.eq(showroom.getMeetingName() !=null,"meeting_name", showroom.getMeetingName());
queryWrapper.eq(showroom.getTenantId() !=null,"tenant_id", showroom.getTenantId());
queryWrapper.eq(showroom.getRoomId() !=null,"room_id", showroom.getRoomId());
queryWrapper.eq("is_show",0);
queryWrapper.in(showroom.getRoomIds() !=null,"room_id", showroom.getRoomIds());
return showroomMapper.selectList(queryWrapper);

View File

@ -167,18 +167,31 @@ public class ApiEquipmentController extends BaseController {
@GetMapping("/scanOpenDoor")
public R scanOpenDoor( RoomRecord roomRecord){
// long currentUserId = getCurrentUserId();
// roomRecord.setUserId(currentUserId);
// 对比personId 和用户 id
// 对比equipmentId 和设备id
// log.info("ip地址为{}",ip);
log.info("用户id为{}",roomRecord.getUserId());
log.info("房间id为{}",roomRecord.getRoomId());
// String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp();
// log.info("ip地址为{}",ip);
// log.info("用户id为{}",roomRecord.getUserId());
// log.info("房间id为{}",roomRecord.getRoomId());
if (roomRecord.getEquipmentType().equals("displayScreen")){
Long deviceId = roomRecord.getDeviceId();
Long userId = roomRecord.getUserId();
UserEquipment userEquipment = userEquipmentService.selectUserAndEquipment(userId, deviceId);
if (null == userEquipment){
return R.error("您没有该设备的权限");
}
String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp();
String openlock = DeviceUtils.openlock(ip);
JSONObject jsonObject = JSONUtil.parseObj(openlock);
Integer code = (Integer) jsonObject.get("status");
Assert.isTrue(code == 0,"开门失败");
int i = roomRecordService.insertRoomRecord(roomRecord);
Assert.isTrue(i == 1,"开门失败");
}
// String openlock = DeviceUtils.openlock(ip);
// JSONObject jsonObject = JSONUtil.parseObj(openlock);