|
@@ -1,16 +1,20 @@
|
|
|
package com.idea.buildManage.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.idea.buildManage.mapper.ParkRoomBindDoorMapper;
|
|
|
+import com.idea.buildManage.model.ParkRoom;
|
|
|
import com.idea.buildManage.model.ParkRoomBindDoor;
|
|
|
import com.idea.buildManage.model.ParkRoomBindDoorExample;
|
|
|
+import com.idea.util.ApartmentUtil;
|
|
|
import com.rockstar.common.base.BaseService;
|
|
|
import com.rockstar.common.support.Convert;
|
|
|
import com.rockstar.frame.model.extend.DateTrans;
|
|
|
import com.rockstar.frame.model.extend.Tablepar;
|
|
|
import com.rockstar.util.SnowflakeIdWorker;
|
|
|
import com.rockstar.util.StringUtils;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -23,6 +27,8 @@ public class ParkRoomBindDoorService implements BaseService<ParkRoomBindDoor, Pa
|
|
|
|
|
|
@Autowired
|
|
|
private ParkRoomBindDoorMapper modelMapper;
|
|
|
+ @Autowired
|
|
|
+ private ParkRoomService parkRoomService;
|
|
|
|
|
|
public PageInfo<ParkRoomBindDoor> list(Tablepar tablepar, ParkRoomBindDoor model, DateTrans dt) {
|
|
|
PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
|
|
@@ -115,6 +121,12 @@ public class ParkRoomBindDoorService implements BaseService<ParkRoomBindDoor, Pa
|
|
|
}
|
|
|
|
|
|
public int roomBindDoor(String roomId, String doorId, String userId){
|
|
|
+ ParkRoomBindDoorExample example = new ParkRoomBindDoorExample();
|
|
|
+ example.createCriteria().andDoorPassIdEqualTo(doorId);
|
|
|
+ List<ParkRoomBindDoor> list = modelMapper.selectByExample(example);
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
+ modelMapper.deleteByExample(example);
|
|
|
+ }
|
|
|
ParkRoomBindDoor data = new ParkRoomBindDoor();
|
|
|
data.setParkRoomId(roomId);
|
|
|
data.setDoorPassId(doorId);
|
|
@@ -122,4 +134,28 @@ public class ParkRoomBindDoorService implements BaseService<ParkRoomBindDoor, Pa
|
|
|
return insert(data);
|
|
|
}
|
|
|
|
|
|
+ public JSONObject getDoorDetailByRoomId(String roomId) throws Exception{
|
|
|
+ JSONObject jsonObject = null;
|
|
|
+ ParkRoomBindDoorExample example = new ParkRoomBindDoorExample();
|
|
|
+ example.createCriteria().andParkRoomIdEqualTo(roomId);
|
|
|
+ List<ParkRoomBindDoor> list = modelMapper.selectByExample(example);
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
+ ParkRoomBindDoor parkRoomBindDoor = list.get(0);
|
|
|
+ String token = ApartmentUtil.getToken();
|
|
|
+ jsonObject = ApartmentUtil.getRoomDetail(parkRoomBindDoor.getDoorPassId(), token);
|
|
|
+ }
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ParkRoom checkBindDoor(String doorId) {
|
|
|
+ ParkRoomBindDoorExample example = new ParkRoomBindDoorExample();
|
|
|
+ example.createCriteria().andDoorPassIdEqualTo(doorId);
|
|
|
+ List<ParkRoomBindDoor> list = modelMapper.selectByExample(example);
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
+ ParkRoomBindDoor parkRoomBindDoor = list.get(0);
|
|
|
+ return parkRoomService.selectByPrimaryKey(parkRoomBindDoor.getParkRoomId());
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|