宠物笼设备
This commit is contained in:
parent
956227c10c
commit
665ba949a6
|
|
@ -7,6 +7,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ifish.entity.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -20,34 +21,6 @@ import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ifish.domain.JsonResult;
|
import com.ifish.domain.JsonResult;
|
||||||
import com.ifish.entity.Camera;
|
|
||||||
import com.ifish.entity.CameraActive;
|
|
||||||
import com.ifish.entity.CameraUser;
|
|
||||||
import com.ifish.entity.Device;
|
|
||||||
import com.ifish.entity.DeviceUser;
|
|
||||||
import com.ifish.entity.FactoryList;
|
|
||||||
import com.ifish.entity.Grade;
|
|
||||||
import com.ifish.entity.HardwareType;
|
|
||||||
import com.ifish.entity.IfishDoctor;
|
|
||||||
import com.ifish.entity.LiveBanner;
|
|
||||||
import com.ifish.entity.LiveRoom;
|
|
||||||
import com.ifish.entity.LoginRecord;
|
|
||||||
import com.ifish.entity.Menu;
|
|
||||||
import com.ifish.entity.NeteaseUser;
|
|
||||||
import com.ifish.entity.OperateRecord;
|
|
||||||
import com.ifish.entity.PayBill;
|
|
||||||
import com.ifish.entity.PayeeInfo;
|
|
||||||
import com.ifish.entity.PushList;
|
|
||||||
import com.ifish.entity.QuestionsFeedback;
|
|
||||||
import com.ifish.entity.Role;
|
|
||||||
import com.ifish.entity.SecurityUser;
|
|
||||||
import com.ifish.entity.TmpPushRemind;
|
|
||||||
import com.ifish.entity.Ueditor;
|
|
||||||
import com.ifish.entity.UpgradeNotes;
|
|
||||||
import com.ifish.entity.User;
|
|
||||||
import com.ifish.entity.UserAsset;
|
|
||||||
import com.ifish.entity.VenderList;
|
|
||||||
import com.ifish.entity.Version;
|
|
||||||
import com.ifish.enums.BooleanEnum;
|
import com.ifish.enums.BooleanEnum;
|
||||||
import com.ifish.enums.MenuTypeEnum;
|
import com.ifish.enums.MenuTypeEnum;
|
||||||
import com.ifish.enums.RoleEnum;
|
import com.ifish.enums.RoleEnum;
|
||||||
|
|
@ -191,6 +164,7 @@ public class AdminAction {
|
||||||
map.put("status", status);
|
map.put("status", status);
|
||||||
return new ModelAndView("roleAdmin/userDetail", map);
|
return new ModelAndView("roleAdmin/userDetail", map);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
log.error("get userDetail information:error message:{}", e.toString());
|
log.error("get userDetail information:error message:{}", e.toString());
|
||||||
}
|
}
|
||||||
return new ModelAndView("roleAdmin/userDetail");
|
return new ModelAndView("roleAdmin/userDetail");
|
||||||
|
|
@ -311,6 +285,25 @@ public class AdminAction {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定设备
|
||||||
|
*
|
||||||
|
* @param macAddress
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/bindPetDevice.do")
|
||||||
|
@ResponseBody
|
||||||
|
public Object bindPetDevice(String macAddress, Integer userId) {
|
||||||
|
try {
|
||||||
|
return this.adminService.bindPetDevice(macAddress, userId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("bindDevice:error message:{}", e.toString());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解除绑定
|
* 解除绑定
|
||||||
*
|
*
|
||||||
|
|
@ -331,6 +324,26 @@ public class AdminAction {
|
||||||
return new ModelAndView("redirect:/page/admin/userDetail.do", map);
|
return new ModelAndView("redirect:/page/admin/userDetail.do", map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解除绑定
|
||||||
|
*
|
||||||
|
* @param deviceUser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/unbindPet.do")
|
||||||
|
public ModelAndView unbindPet(DevicePetUser deviceUser) {
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
map.put("userId", deviceUser.getPriId().getUserId());
|
||||||
|
try {
|
||||||
|
this.adminService.unbindPet(deviceUser);
|
||||||
|
map.put("status", SysUserEnum.success100.getKey());
|
||||||
|
} catch (Exception e) {
|
||||||
|
map.put("status", SysUserEnum.failed101.getKey());
|
||||||
|
log.error("unbind faild,userId:{},:error message:{}", deviceUser.getPriId().getUserId(), e.toString());
|
||||||
|
}
|
||||||
|
return new ModelAndView("redirect:/page/admin/userDetail.do", map);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权
|
* 授权
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.ifish.dao;
|
||||||
|
|
||||||
|
import com.ifish.entity.DevicePetUser;
|
||||||
|
import com.ifish.entity.DeviceUser;
|
||||||
|
import com.ifish.entity.id.PriId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: DeviceUserDao
|
||||||
|
* @Description: TODO
|
||||||
|
* @author ggw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface DevicePetUserDao extends BaseDao<DevicePetUser, PriId>{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ifish.daoImpl;
|
||||||
|
|
||||||
|
import com.ifish.dao.DevicePetUserDao;
|
||||||
|
import com.ifish.entity.DevicePetUser;
|
||||||
|
import com.ifish.entity.id.PriId;
|
||||||
|
import com.ifish.hibernate.HibernateBaseDao;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: DeviceUserDaoImpl
|
||||||
|
* @Description: TODO
|
||||||
|
* @author ggw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Repository("devicePetUserDao")
|
||||||
|
public class DevicePetUserDaoImpl extends HibernateBaseDao<DevicePetUser, PriId> implements DevicePetUserDao {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DevicePetUser> getEntityClass() {
|
||||||
|
return DevicePetUser.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.ifish.entity;
|
||||||
|
|
||||||
|
import com.ifish.entity.id.PriId;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: tbl_device_user
|
||||||
|
* @date 2015年7月2日 下午16:40:00
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DevicePetUser implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -6056043883433438749L;
|
||||||
|
//ID
|
||||||
|
private PriId priId = new PriId();
|
||||||
|
//显示名称
|
||||||
|
private String showName;
|
||||||
|
private String storeName;
|
||||||
|
private Integer isMaster;
|
||||||
|
//创建时间
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
//用户
|
||||||
|
private User user = new User();
|
||||||
|
//设备
|
||||||
|
private Device device = new Device();
|
||||||
|
public DevicePetUser() {}
|
||||||
|
|
||||||
|
public DevicePetUser(PriId priId, String showName, String storeName) {
|
||||||
|
this.priId = priId;
|
||||||
|
this.showName = showName;
|
||||||
|
this.storeName = storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PriId getPriId() {
|
||||||
|
return priId;
|
||||||
|
}
|
||||||
|
public void setPriId(PriId priId) {
|
||||||
|
this.priId = priId;
|
||||||
|
}
|
||||||
|
public String getShowName() {
|
||||||
|
return showName;
|
||||||
|
}
|
||||||
|
public void setShowName(String showName) {
|
||||||
|
this.showName = showName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStoreName() {
|
||||||
|
return storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoreName(String storeName) {
|
||||||
|
this.storeName = storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsMaster() {
|
||||||
|
return isMaster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsMaster(Integer isMaster) {
|
||||||
|
this.isMaster = isMaster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Device getDevice() {
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDevice(Device device) {
|
||||||
|
this.device = device;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||||
|
<hibernate-mapping package="com.ifish.entity">
|
||||||
|
<class name="DevicePetUser" table="tbl_pet_list" dynamic-insert="true" dynamic-update="true">
|
||||||
|
<meta attribute="sync-DAO">false</meta>
|
||||||
|
<composite-id name="priId" class="com.ifish.entity.id.PriId">
|
||||||
|
<key-property name="userId" column="user_id" type="java.lang.Integer" />
|
||||||
|
<key-property name="deviceId" column="device_id" type="java.lang.Integer" />
|
||||||
|
</composite-id>
|
||||||
|
<property name="showName" column="device_name" type="string" length="255" />
|
||||||
|
<property name="storeName" column="store_name" type="string" length="255" />
|
||||||
|
<property name="isMaster" column="is_master" type="java.lang.Integer" length="10" />
|
||||||
|
<property name="createTime" column="create_time" type="java.util.Date" />
|
||||||
|
<many-to-one name="user" column="user_id" class="com.ifish.entity.User" update="false" insert="false" lazy="false"/>
|
||||||
|
<many-to-one name="device" column="device_id" class="com.ifish.entity.Device" update="false" insert="false" lazy="false"/>
|
||||||
|
</class>
|
||||||
|
</hibernate-mapping>
|
||||||
|
|
@ -3,36 +3,10 @@ package com.ifish.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ifish.entity.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.ifish.domain.JsonResult;
|
import com.ifish.domain.JsonResult;
|
||||||
import com.ifish.entity.Camera;
|
|
||||||
import com.ifish.entity.CameraActive;
|
|
||||||
import com.ifish.entity.CameraUser;
|
|
||||||
import com.ifish.entity.Device;
|
|
||||||
import com.ifish.entity.DeviceUser;
|
|
||||||
import com.ifish.entity.FactoryList;
|
|
||||||
import com.ifish.entity.HardwareType;
|
|
||||||
import com.ifish.entity.IfishDoctor;
|
|
||||||
import com.ifish.entity.LiveBanner;
|
|
||||||
import com.ifish.entity.LiveRoom;
|
|
||||||
import com.ifish.entity.LoginRecord;
|
|
||||||
import com.ifish.entity.Menu;
|
|
||||||
import com.ifish.entity.NeteaseUser;
|
|
||||||
import com.ifish.entity.OperateRecord;
|
|
||||||
import com.ifish.entity.PayBill;
|
|
||||||
import com.ifish.entity.PayeeInfo;
|
|
||||||
import com.ifish.entity.PushList;
|
|
||||||
import com.ifish.entity.QuestionsFeedback;
|
|
||||||
import com.ifish.entity.Role;
|
|
||||||
import com.ifish.entity.SecurityUser;
|
|
||||||
import com.ifish.entity.TmpPushRemind;
|
|
||||||
import com.ifish.entity.Ueditor;
|
|
||||||
import com.ifish.entity.UpgradeNotes;
|
|
||||||
import com.ifish.entity.User;
|
|
||||||
import com.ifish.entity.UserAsset;
|
|
||||||
import com.ifish.entity.VenderList;
|
|
||||||
import com.ifish.entity.Version;
|
|
||||||
import com.ifish.enums.RoleEnum;
|
import com.ifish.enums.RoleEnum;
|
||||||
import com.ifish.hibernate.Pagination;
|
import com.ifish.hibernate.Pagination;
|
||||||
import com.ifish.search.SearchFilter;
|
import com.ifish.search.SearchFilter;
|
||||||
|
|
@ -103,10 +77,12 @@ public interface AdminService {
|
||||||
|
|
||||||
//绑定设备
|
//绑定设备
|
||||||
public boolean bindDevice(String macAddress,Integer userId);
|
public boolean bindDevice(String macAddress,Integer userId);
|
||||||
|
public boolean bindPetDevice(String macAddress,Integer userId);
|
||||||
|
|
||||||
//解除绑定
|
//解除绑定
|
||||||
public void unbind(DeviceUser deviceUser);
|
public void unbind(DeviceUser deviceUser);
|
||||||
|
public void unbindPet(DevicePetUser deviceUser);
|
||||||
|
|
||||||
//设备授权
|
//设备授权
|
||||||
public boolean deviceLicense(Integer deviceId,String isBlacklist);
|
public boolean deviceLicense(Integer deviceId,String isBlacklist);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.ifish.dao.*;
|
||||||
import com.ifish.entity.*;
|
import com.ifish.entity.*;
|
||||||
import com.ifish.entity.event.QueueEventBody;
|
import com.ifish.entity.event.QueueEventBody;
|
||||||
import com.ifish.entity.event.QueueEventEntity;
|
import com.ifish.entity.event.QueueEventEntity;
|
||||||
|
|
@ -30,36 +30,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ifish.dao.CameraActiveDao;
|
|
||||||
import com.ifish.dao.CameraDao;
|
|
||||||
import com.ifish.dao.CameraUserDao;
|
|
||||||
import com.ifish.dao.DeviceCameraDao;
|
|
||||||
import com.ifish.dao.DeviceDao;
|
|
||||||
import com.ifish.dao.DeviceUserDao;
|
|
||||||
import com.ifish.dao.FactoryListDao;
|
|
||||||
import com.ifish.dao.GradeDao;
|
|
||||||
import com.ifish.dao.HardwareTypeDao;
|
|
||||||
import com.ifish.dao.IfishDoctorDao;
|
|
||||||
import com.ifish.dao.InformationDao;
|
|
||||||
import com.ifish.dao.LiveBannerDao;
|
|
||||||
import com.ifish.dao.LiveRoomDao;
|
|
||||||
import com.ifish.dao.LoginRecordDao;
|
|
||||||
import com.ifish.dao.MenuDao;
|
|
||||||
import com.ifish.dao.NeteaseUserDao;
|
|
||||||
import com.ifish.dao.OperateRecordDao;
|
|
||||||
import com.ifish.dao.PayBillDao;
|
|
||||||
import com.ifish.dao.PayeeInfoDao;
|
|
||||||
import com.ifish.dao.PushListDao;
|
|
||||||
import com.ifish.dao.QuestionsFeedbackDao;
|
|
||||||
import com.ifish.dao.RoleDao;
|
|
||||||
import com.ifish.dao.SecurityUserDao;
|
|
||||||
import com.ifish.dao.ShopsInfoDao;
|
|
||||||
import com.ifish.dao.TmpPushRemindDao;
|
|
||||||
import com.ifish.dao.UeditorDao;
|
|
||||||
import com.ifish.dao.UpgradeNotesDao;
|
|
||||||
import com.ifish.dao.UserDao;
|
|
||||||
import com.ifish.dao.VenderListDao;
|
|
||||||
import com.ifish.dao.VersionDao;
|
|
||||||
import com.ifish.domain.FactoryData;
|
import com.ifish.domain.FactoryData;
|
||||||
import com.ifish.domain.FactoryRecordData;
|
import com.ifish.domain.FactoryRecordData;
|
||||||
import com.ifish.domain.HardwareTypeData;
|
import com.ifish.domain.HardwareTypeData;
|
||||||
|
|
@ -108,6 +78,8 @@ public class AdminServiceImpl implements AdminService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceDao deviceDao;
|
private DeviceDao deviceDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private DevicePetUserDao devicePetUserDao;
|
||||||
|
@Autowired
|
||||||
private CameraDao cameraDao;
|
private CameraDao cameraDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private VersionDao versionDao;
|
private VersionDao versionDao;
|
||||||
|
|
@ -485,6 +457,8 @@ public class AdminServiceImpl implements AdminService {
|
||||||
map.put("user", user);
|
map.put("user", user);
|
||||||
List<DeviceUser> deviceUserList = this.deviceUserDao.findByProperty(Restrictions.eq("priId.userId", user.getUserId()));
|
List<DeviceUser> deviceUserList = this.deviceUserDao.findByProperty(Restrictions.eq("priId.userId", user.getUserId()));
|
||||||
map.put("deviceUserList", deviceUserList);
|
map.put("deviceUserList", deviceUserList);
|
||||||
|
List<DevicePetUser> devicePetUserList = this.devicePetUserDao.findByProperty(Restrictions.eq("priId.userId", user.getUserId()));
|
||||||
|
map.put("devicePetUserList", devicePetUserList);
|
||||||
List<CameraUser> cameraUserList = this.cameraUserDao.findByProperty(Restrictions.eq("cameraUserId.userId", user.getUserId()));
|
List<CameraUser> cameraUserList = this.cameraUserDao.findByProperty(Restrictions.eq("cameraUserId.userId", user.getUserId()));
|
||||||
map.put("cameraUserList", cameraUserList);
|
map.put("cameraUserList", cameraUserList);
|
||||||
List<String> cameraIds = new ArrayList<String>();
|
List<String> cameraIds = new ArrayList<String>();
|
||||||
|
|
@ -649,6 +623,36 @@ public class AdminServiceImpl implements AdminService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean bindPetDevice(String macAddress, Integer userId) {
|
||||||
|
if (userId != null && macAddress != null && macAddress.length() > 0) {
|
||||||
|
User user = this.userDao.get(userId);
|
||||||
|
Device device = this.deviceDao.findUniqueByProperty(Restrictions.eq("macAddress", macAddress));
|
||||||
|
if (user != null && device != null) {
|
||||||
|
Integer deviceId = device.getDeviceId();
|
||||||
|
DevicePetUser devicePetUser = new DevicePetUser();
|
||||||
|
devicePetUser.getPriId().setDeviceId(deviceId);
|
||||||
|
devicePetUser.getPriId().setUserId(userId);
|
||||||
|
DevicePetUser tmpDeviceUser = this.devicePetUserDao.get(devicePetUser.getPriId());
|
||||||
|
if (tmpDeviceUser == null) {
|
||||||
|
List<DevicePetUser> DeviceUserList = this.devicePetUserDao.findByProperty(Restrictions.eq("priId.deviceId", deviceId));
|
||||||
|
if (DeviceUserList.size() > 0) {
|
||||||
|
devicePetUser.setIsMaster(1);
|
||||||
|
} else {
|
||||||
|
devicePetUser.setIsMaster(0);
|
||||||
|
}
|
||||||
|
devicePetUser.setStoreName("宠物店" + (int) (Math.random() * 9000 + 1000));
|
||||||
|
devicePetUser.setShowName("宠物笼" + (int) (Math.random() * 9000 + 1000));
|
||||||
|
devicePetUser.setUser(user);
|
||||||
|
devicePetUser.setDevice(device);
|
||||||
|
this.devicePetUserDao.save(devicePetUser);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unbind(DeviceUser deviceUser) {
|
public void unbind(DeviceUser deviceUser) {
|
||||||
deviceUser = this.deviceUserDao.get(deviceUser.getPriId());
|
deviceUser = this.deviceUserDao.get(deviceUser.getPriId());
|
||||||
|
|
@ -665,6 +669,22 @@ public class AdminServiceImpl implements AdminService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unbindPet(DevicePetUser devicePetUser) {
|
||||||
|
devicePetUser = this.devicePetUserDao.get(devicePetUser.getPriId());
|
||||||
|
if (devicePetUser != null) {
|
||||||
|
//是主控,解除所有的绑定
|
||||||
|
if (devicePetUser.getIsMaster().equals(BooleanEnum.YES.getKey())) {
|
||||||
|
List<DevicePetUser> list = this.devicePetUserDao.findByProperty(Restrictions.eq("priId.deviceId", devicePetUser.getPriId().getDeviceId()));
|
||||||
|
for (DevicePetUser curDeviceUser : list) {
|
||||||
|
devicePetUserDao.delete(curDeviceUser);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
devicePetUserDao.delete(devicePetUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deviceLicense(Integer deviceId, String isBlacklist) {
|
public boolean deviceLicense(Integer deviceId, String isBlacklist) {
|
||||||
Device device = this.deviceDao.get(deviceId);
|
Device device = this.deviceDao.get(deviceId);
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,28 @@
|
||||||
jAlert('绑定失败或出错啦!', '提示');
|
jAlert('绑定失败或出错啦!', '提示');
|
||||||
}
|
}
|
||||||
$("#bindDeviceModalBtn").attr("disabled",false);
|
$("#bindDeviceModalBtn").attr("disabled",false);
|
||||||
|
});
|
||||||
|
//绑定设备
|
||||||
|
$("#bindPetDeviceBtn").click(function(){
|
||||||
|
$("#bindPetDeviceModal").modal("show");
|
||||||
|
});
|
||||||
|
$("#bindPetDeviceModalBtn").click(function(){
|
||||||
|
if($("#petMacAddress").val()==""){
|
||||||
|
jAlert("设备Mac不能为空", '提示');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$("#bindPetDeviceModalBtn").attr("disabled",true);
|
||||||
|
$('#form-bindPetDevice').submit();
|
||||||
|
});
|
||||||
|
$('#form-bindPetDevice').ajaxForm(function(data){
|
||||||
|
if(data==true){
|
||||||
|
location.reload();
|
||||||
|
jAlert('绑定成功', '提示');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
jAlert('绑定失败或出错啦!', '提示');
|
||||||
|
}
|
||||||
|
$("#bindPetDeviceModalBtn").attr("disabled",false);
|
||||||
});
|
});
|
||||||
//绑定摄像头
|
//绑定摄像头
|
||||||
$("#bindCameraBtn").click(function(){
|
$("#bindCameraBtn").click(function(){
|
||||||
|
|
@ -125,10 +147,14 @@
|
||||||
dataTable.fnPageChange(--pageNum,true);
|
dataTable.fnPageChange(--pageNum,true);
|
||||||
}
|
}
|
||||||
//解除绑定
|
//解除绑定
|
||||||
function unbind(userId,deviceId){
|
function unbind(userId,deviceId,isdevice){
|
||||||
var r = confirm("确定要解除绑定吗?");
|
var r = confirm("确定要解除绑定吗?");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
location.href="<%=basePath%>page/admin/unbind.do?priId.userId="+userId+"&priId.deviceId="+deviceId;
|
if (isdevice) {
|
||||||
|
location.href="<%=basePath%>page/admin/unbind.do?priId.userId="+userId+"&priId.deviceId="+deviceId;
|
||||||
|
} else {
|
||||||
|
location.href="<%=basePath%>page/admin/unbindPet.do?priId.userId="+userId+"&priId.deviceId="+deviceId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//授权
|
//授权
|
||||||
|
|
@ -284,6 +310,64 @@
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<h4 class="header smaller lighter blue">拥有宠物笼 <button class="btn btn-xs btn-primary" id="bindPetDeviceBtn"><i class="icon-edit"></i>新增</button></h4>
|
||||||
|
<table class="table table-striped table-bordered table-hover">
|
||||||
|
<col>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="center">ID</th>
|
||||||
|
<th>硬件mac</th>
|
||||||
|
<th>方案名称</th>
|
||||||
|
<th>厂家名称</th>
|
||||||
|
<th>连接次数</th>
|
||||||
|
<th>最后一次登陆时间</th>
|
||||||
|
<th>显示名称</th>
|
||||||
|
<th>是否主控</th>
|
||||||
|
<th>绑定时间</th>
|
||||||
|
<th>首次激活时间</th>
|
||||||
|
<th>出厂时间</th>
|
||||||
|
<th>授权</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${devicePetUserList}" var="deviceUser">
|
||||||
|
<tr>
|
||||||
|
<td class="center">${deviceUser.priId.deviceId}</td>
|
||||||
|
<td>${deviceUser.device.macAddress}</td>
|
||||||
|
<c:if test="${deviceUser.device.hardwareType==null }">
|
||||||
|
<td><p style="color:red">...</p></td>
|
||||||
|
</c:if>
|
||||||
|
<c:if test="${deviceUser.device.hardwareType!=null }">
|
||||||
|
<td>${deviceUser.device.hardwareType.hardwareName}</td>
|
||||||
|
</c:if>
|
||||||
|
<td>${deviceUser.device.venderList.brandName}</td>
|
||||||
|
<td>${deviceUser.device.loginCount}</td>
|
||||||
|
<td>${deviceUser.device.loginTime}</td>
|
||||||
|
<td>${deviceUser.storeName}<br/>${deviceUser.showName}</td>
|
||||||
|
<td>${deviceUser.isMaster==0?"<span class='badge label-success'>是</span>":"<span class='badge label-danger'>否</span>"}</td>
|
||||||
|
<td>${deviceUser.createTime}</td>
|
||||||
|
<td>${deviceUser.device.firstActivate}</td>
|
||||||
|
<td>${deviceUser.device.createTime}</td>
|
||||||
|
<td>${deviceUser.device.isBlacklist==1?"<span class='badge label-danger'>NO</span>":"<span class='badge label-success'>OK</span>"}</td>
|
||||||
|
<td class="center">
|
||||||
|
<a href="javascript:void(0);" onclick="unbind('${deviceUser.user.userId}','${deviceUser.device.deviceId}')" class="btn btn-xs btn-danger"><i class="icon-remove">解除绑定</i></a>
|
||||||
|
<c:if test="${deviceUser.device.isBlacklist==1}">
|
||||||
|
<a href="javascript:void(0);" onclick="deviceLicense('${deviceUser.user.userId}','${deviceUser.device.deviceId}','0')" class="btn btn-xs btn-primary"><i class="icon-ok">授予权限</i></a>
|
||||||
|
</c:if>
|
||||||
|
<c:if test="${deviceUser.device.isBlacklist==0}">
|
||||||
|
<c:if test="${deviceUser.device.isCharge==1}">
|
||||||
|
<a href="javascript:void(0);" title="[禁用]" class="btn btn-xs btn-default"><i class="icon-remove">取消授权</i></a>
|
||||||
|
</c:if>
|
||||||
|
<c:if test="${deviceUser.device.isCharge==0}">
|
||||||
|
<a href="javascript:void(0);" onclick="deviceLicense('${deviceUser.user.userId}','${deviceUser.device.deviceId}','1')" class="btn btn-xs btn-danger"><i class="icon-remove">取消授权</i></a>
|
||||||
|
</c:if>
|
||||||
|
</c:if>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<div class="space"></div>
|
<div class="space"></div>
|
||||||
<h4 class="header smaller lighter blue">拥有摄像头 <button class="btn btn-xs btn-primary" id="bindCameraBtn"><i class="icon-edit"></i>新增</button></h4>
|
<h4 class="header smaller lighter blue">拥有摄像头 <button class="btn btn-xs btn-primary" id="bindCameraBtn"><i class="icon-edit"></i>新增</button></h4>
|
||||||
<table class="table table-striped table-bordered table-hover">
|
<table class="table table-striped table-bordered table-hover">
|
||||||
|
|
@ -380,6 +464,40 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<form action="<%=basePath%>page/admin/bindPetDevice.do" class="form-horizontal" method="post" id="form-bindPetDevice">
|
||||||
|
<div class="modal fade" id="bindPetDeviceModal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="closeBtn close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">绑定设备</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-2 control-label no-padding-right">用户ID<span style="color:red;">*</span></label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input type="number" name="userId" value="${user.userId}" readonly="readonly" class="input-medium" required="required">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-2 control-label no-padding-right">设备Mac<span style="color:red;">*</span></label>
|
||||||
|
<div class="col-xs-8">
|
||||||
|
<input type="text" id="petMacAddress" name="macAddress" class="input-medium" required="required" maxlength="20">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="closeBtn btn btn-default">关闭</button>
|
||||||
|
<button id="bindPetDeviceModalBtn" type="submit" class="btn btn-primary">确定</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
<form action="<%=basePath%>page/admin/bindCamera.do" class="form-horizontal" method="post" id="form-bindCamera">
|
<form action="<%=basePath%>page/admin/bindCamera.do" class="form-horizontal" method="post" id="form-bindCamera">
|
||||||
<div class="modal fade" id="bindCameraModal">
|
<div class="modal fade" id="bindCameraModal">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue