项目整合

This commit is contained in:
谢洪龙 2017-07-12 13:04:52 +08:00
parent 5d151d4d8a
commit d0f4f89f9d
18 changed files with 783 additions and 229 deletions

View File

@ -21,5 +21,6 @@ Any value defined here will override the pom.xml file value but is only applicab
--> -->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion> <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server> <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<org-netbeans-modules-maven-jaxws.generate_5f_nonjsr109>false</org-netbeans-modules-maven-jaxws.generate_5f_nonjsr109>
</properties> </properties>
</project-shared-configuration> </project-shared-configuration>

View File

@ -24,7 +24,7 @@ public class Tbl_Vender implements java.io.Serializable {
/** /**
* 版本号 * 版本号
*/ */
private static final long serialVersionUID = -487543106603936914L; private static final long serialVersionUID = 2462685903502867014L;
/** /**
* 鱼缸厂编号 * 鱼缸厂编号
@ -33,13 +33,6 @@ public class Tbl_Vender implements java.io.Serializable {
@Column(name = "brand_code", unique = true, nullable = false, length = 20) @Column(name = "brand_code", unique = true, nullable = false, length = 20)
private String brandCode; private String brandCode;
/**
* 电子厂代码
*/
@Id
@Column(name = "factory_code", unique = true, nullable = false, length = 20)
private String factoryCode;
/** /**
* logo * logo
*/ */
@ -106,24 +99,6 @@ public class Tbl_Vender implements java.io.Serializable {
this.brandCode = brandCode; this.brandCode = brandCode;
} }
/**
* 获取电子厂代码
*
* @return 电子厂代码
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* 设置电子厂代码
*
* @param factoryCode 电子厂代码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/** /**
* 获取logo * 获取logo
* *

View File

@ -5,16 +5,15 @@
*/ */
package com.ifish.helper; package com.ifish.helper;
import com.ifish.bean.LoginRecord;
import com.ifish.bean.Tbl_Device; import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_Statistics;
import com.ifish.bean.Tbl_Device_User; import com.ifish.bean.Tbl_Device_User;
import com.ifish.bean.Tbl_Factory_List;
import com.ifish.bean.Tbl_HardWare_Type;
import com.ifish.mapper.Tbl_Device_Mapper; import com.ifish.mapper.Tbl_Device_Mapper;
import com.ifish.mapper.Tbl_Hardware_Type_Mapper; import com.ifish.mapper.Tbl_Hardware_Type_Mapper;
import com.ifish.socket.model.send.DeviceLoginContextLength24; import com.ifish.socket.model.send.DeviceLoginContextLength24;
import com.ifish.util.ByteUtil;
import com.ifish.util.IfishUtil; import com.ifish.util.IfishUtil;
import com.ifish.util.RedisKey; import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -36,14 +35,27 @@ public class DeviceHelper implements DeviceHelperI {
@Autowired @Autowired
private RedisHelperI redisHelperI; private RedisHelperI redisHelperI;
@Autowired
private RedisKeyHelperI redisKeyHelperI;
@Autowired @Autowired
private Tbl_Device_Mapper tbl_Device_Mapper; private Tbl_Device_Mapper tbl_Device_Mapper;
/**
* 修改设备信息
*
* @param device
* @return
*/
@Override @Override
public Tbl_Device update(Tbl_Device device) { public Tbl_Device update(Tbl_Device device) {
try { try {
if (device.getDeviceId() == 0) {
return null;
}
int i = tbl_Device_Mapper.updateTbl_Device(device); int i = tbl_Device_Mapper.updateTbl_Device(device);
if (i > 0) { if (i > 0) {
redisKeyHelperI.deleteRedisByTbl_Device(device);
return device; return device;
} else { } else {
return null; return null;
@ -53,85 +65,171 @@ public class DeviceHelper implements DeviceHelperI {
} }
} }
/**
* 登陆修改设备的厂家等信息
*
* @param model
* @return
*/
@Override @Override
public Tbl_Device update(DeviceLoginContextLength24 model) { public Tbl_Device updateDeviceWhenLogin(DeviceLoginContextLength24 model) {
try {
//macAddr地址
String stcMac = ByteUtil.bytesToHexString(model.getSrc());
//IP
byte[] log_Ip = model.getLogin_ip();
StringBuilder ipStr = new StringBuilder();
for (int i = 0; i < log_Ip.length; i++) {
int v = log_Ip[i] & 0xff;
if (i == 0) {
ipStr.append(v);
} else {
ipStr.append("." + v);
}
}
//版本
Integer version = model.getVersion() & 0xff;
//电子厂
String factoryCode = ByteUtil.toHex(model.getfactoryCode());
factoryCode = factoryCode.equals("01") ? "0a" : factoryCode;
//硬件类型
String typeCode = ByteUtil.toHex(model.getHardware_type());
Tbl_Device device = getDeviceByMacAddress(stcMac);
if (device != null) {
Tbl_Device_Statistics device_Statistics = getDeviceStatisticsByDeviceId(device.getDeviceId());
Integer loginConut = device_Statistics.getLoginCount();
if (loginConut != null) {
device_Statistics.setLoginCount(++loginConut);
} else {
device_Statistics.setLoginCount(1);
}
device.setFactoryCode(factoryCode);
device_Statistics.setFactoryCode(factoryCode);
device.setHardwareType(typeCode);
device_Statistics.setHardwareType(typeCode);
device_Statistics.setSoftwareVersion(version.toString());
device.setDeviceIp(ipStr.toString());
Date date = new Date();
device.setLoginTime(date);
device_Statistics.setLoginTime(date);
tbl_Device_Mapper.updateTbl_Device(device);
redisKeyHelperI.deleteRedisByTbl_Device(device);
tbl_Device_Mapper.updateDeviceStatistics(device_Statistics);
redisKeyHelperI.deleteRedisByTbl_Device_Statistics(device_Statistics);
return device;
} else {
//新增
//log.warn("macAddress not exist in database:{}",stcMac);
device = new Tbl_Device();
device.setMacAddress(stcMac);
device.setFactoryCode(factoryCode);
device.setHardwareType(typeCode);
device.setDeviceIp(ipStr.toString());
Date date = new Date();
device.setLoginTime(date);
device.setCreateTime(date);
device.setIsCamera("0");
int i = tbl_Device_Mapper.insertDevice(device);
if (i > 0) {
Tbl_Device_Statistics device_Statistics = new Tbl_Device_Statistics();
device_Statistics.setSoftwareVersion(version.toString());
device_Statistics.setLoginCount(1);
device_Statistics.setLoginTime(date);
device_Statistics.setCreateDate(date);
device_Statistics.setCreateTime(date);
device_Statistics.setMacAddress(stcMac);
device_Statistics.setFactoryCode(factoryCode);
device_Statistics.setHardwareType(typeCode);
device_Statistics.setDeviceId(device.getDeviceId());
tbl_Device_Mapper.insertDeviceStatistics(device_Statistics);
}
return device;
}
} catch (Exception e) {
return null;
}
}
/**
* 修改设备统计信息
*
* @param device_Statistics
* @return
*/
public Tbl_Device_Statistics updateDevice_Statistics(Tbl_Device_Statistics device_Statistics) {
try {
if (device_Statistics.getDeviceId() != 0 || StringUtils.isNotBlank(device_Statistics.getMacAddress())) {
int i = tbl_Device_Mapper.updateDeviceStatistics(device_Statistics);
if (i > 0) {
//清楚已缓存的redis
redisKeyHelperI.deleteRedisByTbl_Device_Statistics(device_Statistics);
//返回修改成功的设备统计数据
if (StringUtils.isNotBlank(device_Statistics.getMacAddress())) {
return getDeviceStatisticsByMacAddress(device_Statistics.getMacAddress());
} else if (device_Statistics.getDeviceId() != 0) {
return getDeviceStatisticsByDeviceId(device_Statistics.getDeviceId());
}
}
}
} catch (Exception e) {
}
return null; return null;
} }
/**
* 设置温度是否报警
*
* @param macAddress
* @param onOff
*/
@Override @Override
public void updateWarnOnoff(String macAddress, String onOff) { public void updateWarnOnoff(String macAddress, String onOff) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Tbl_Device getUniqueByProperty(String property, Object value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<Tbl_Device> getByProperty(String property, Object value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Tbl_Device_User getUniqueByProperty(String macAddress) {
Tbl_Device device = getDeviceByMacAddress(macAddress); Tbl_Device device = getDeviceByMacAddress(macAddress);
Tbl_Device_User deviceUser = null; if (device != null) {
device.setOnOff(onOff);
tbl_Device_Mapper.updateTbl_Device(device);
redisKeyHelperI.deleteRedisByTbl_Device(device);
}
}
/**
* 根据设备ID获取此设备所有的用户关系列表
*
* @param deviceId
* @return
*/
@Override
public List<Tbl_Device_User> getTbl_Device_UsersListByDeviceId(Integer deviceId) {
List<Tbl_Device_User> deviceUserList = null;
try { try {
// String key = RedisKey.DeviceUser_Key + "m" + macAddress; String key = redisKeyHelperI.getListTbl_Device_UserKeyByDeviceId(deviceId);
// String redisString = redisHelperI.getRedis(key);
// if (StringUtils.isNotBlank(redisString)) {
// deviceUser = (Tbl_Device_User) IfishUtil.JsonToBean(redisString, Tbl_Device_User.class);
// } else {
// device = tbl_Device_Mapper.getDeviceUsersByUserIdAndDeviceId(device.get, deviceId);
// if (device != null && device.getDeviceId() > 0) {
// redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
// }
// }
} catch (Exception e) {
}
return deviceUser;
}
@Override
public List<Tbl_Device_User> getListByProperty(Integer deviceId) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public LoginRecord save(LoginRecord loginRecord) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Tbl_Factory_List getFactoryListById(String factoryCode) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Tbl_HardWare_Type getHardwareTypeById(String typeCode) {
Tbl_HardWare_Type hardwareType = null;
try {
String key = RedisKey.HardWareType_key + typeCode;
String redisString = redisHelperI.getRedis(key); String redisString = redisHelperI.getRedis(key);
if (StringUtils.isNotBlank(redisString)) { if (StringUtils.isNotBlank(redisString)) {
hardwareType = (Tbl_HardWare_Type) IfishUtil.JsonToBean(redisString, Tbl_HardWare_Type.class); deviceUserList = (List<Tbl_Device_User>) IfishUtil.JsonToList(redisString, Tbl_Device_User.class);
} else { } else {
hardwareType = tbl_Hardware_Type_Mapper.getHardwareTypeByTypeCode(typeCode); deviceUserList = tbl_Device_Mapper.getDeviceUsersByUserId(deviceId);
if (hardwareType != null && StringUtils.isNotBlank(hardwareType.getHardwareType())) { if (deviceUserList != null && deviceUserList.size() > 0) {
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(hardwareType)); redisHelperI.setRedis(key, IfishUtil.ObjectToJson(deviceUserList));
} }
} }
} catch (Exception e) { } catch (Exception e) {
} }
return hardwareType; return deviceUserList;
} }
/**
* 根据mac地址查找设备
*
* @param macAddress
* @return
*/
@Override
public Tbl_Device getDeviceByMacAddress(String macAddress) { public Tbl_Device getDeviceByMacAddress(String macAddress) {
Tbl_Device device = null; Tbl_Device device = null;
try { try {
String key = RedisKey.Device_key + macAddress; String key = redisKeyHelperI.getTbl_DeviceRedisKeyByMacAddress(macAddress);
String redisString = redisHelperI.getRedis(key); String redisString = redisHelperI.getRedis(key);
if (StringUtils.isNotBlank(redisString)) { if (StringUtils.isNotBlank(redisString)) {
device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class); device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class);
@ -146,4 +244,47 @@ public class DeviceHelper implements DeviceHelperI {
return device; return device;
} }
/**
* 根据设备ID获取设备统计信息
*
* @param deviceId
* @return
* @throws Exception
*/
public Tbl_Device_Statistics getDeviceStatisticsByDeviceId(Integer deviceId) throws Exception {
Tbl_Device_Statistics device = null;
String key = redisKeyHelperI.getTbl_Device_StatisticsRedisKeyByDeviceId(deviceId);
String redisString = redisHelperI.getRedis(key);
if (StringUtils.isNotBlank(redisString)) {
device = (Tbl_Device_Statistics) IfishUtil.JsonToBean(redisString, Tbl_Device_Statistics.class);
} else {
device = tbl_Device_Mapper.getDevStatisticsByDeviceId(deviceId);
if (device != null && device.getDeviceId() > 0) {
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
}
}
return device;
}
/**
* 根据设备ID获取设备统计信息
*
* @param deviceId
* @return
* @throws Exception
*/
public Tbl_Device_Statistics getDeviceStatisticsByMacAddress(String macAddress) throws Exception {
Tbl_Device_Statistics device = null;
String key = redisKeyHelperI.getTbl_Device_StatisticsRedisKeyByMacAddress(macAddress);
String redisString = redisHelperI.getRedis(key);
if (StringUtils.isNotBlank(redisString)) {
device = (Tbl_Device_Statistics) IfishUtil.JsonToBean(redisString, Tbl_Device_Statistics.class);
} else {
device = tbl_Device_Mapper.getDevStatisticsByMacAddress(macAddress);
if (device != null && device.getDeviceId() > 0) {
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
}
}
return device;
}
} }

View File

@ -7,6 +7,7 @@ package com.ifish.helper;
import com.ifish.bean.LoginRecord; import com.ifish.bean.LoginRecord;
import com.ifish.bean.Tbl_Device; import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_Statistics;
import com.ifish.bean.Tbl_Device_User; import com.ifish.bean.Tbl_Device_User;
import com.ifish.bean.Tbl_Factory_List; import com.ifish.bean.Tbl_Factory_List;
import com.ifish.bean.Tbl_HardWare_Type; import com.ifish.bean.Tbl_HardWare_Type;
@ -19,23 +20,52 @@ import java.util.List;
*/ */
public interface DeviceHelperI { public interface DeviceHelperI {
/**
* 修改设备信息
*
* @param device
* @return
*/
public Tbl_Device update(Tbl_Device device); public Tbl_Device update(Tbl_Device device);
public Tbl_Device update(DeviceLoginContextLength24 model); /**
* 登陆时修改设备的厂家等信息
*
* @param model
* @return
*/
public Tbl_Device updateDeviceWhenLogin(DeviceLoginContextLength24 model);
/**
* 设置温度是否报警
*
* @param macAddress
* @param onOff
*/
public void updateWarnOnoff(String macAddress, String onOff); public void updateWarnOnoff(String macAddress, String onOff);
public Tbl_Device getUniqueByProperty(String property, Object value); /**
* 根据mac地址查找设备
*
* @param property
* @param value
* @return
*/
public Tbl_Device getDeviceByMacAddress(String macAddress);
public List<Tbl_Device> getByProperty(String property, Object value); /**
* 修改设备统计信息
*
* @param device_Statistics
* @return
*/
public Tbl_Device_Statistics updateDevice_Statistics(Tbl_Device_Statistics device_Statistics);
public Tbl_Device_User getUniqueByProperty(String macAddress); /**
* 根据设备ID获取此设备所有的用户关系列表
public List<Tbl_Device_User> getListByProperty(Integer deviceId); *
* @param deviceId
public LoginRecord save(LoginRecord loginRecord); * @return
*/
public Tbl_Factory_List getFactoryListById(String factoryCode); public List<Tbl_Device_User> getTbl_Device_UsersListByDeviceId(Integer deviceId);
public Tbl_HardWare_Type getHardwareTypeById(String typeCode);
} }

View File

@ -0,0 +1,85 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.helper;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.Notification;
import java.util.Map;
import org.springframework.stereotype.Component;
/**
*
* @author Administrator
*/
@Component
public class JpushHelper implements JpushHelperI {
private static JPushClient jPushClient = null;
//正式
// private static final String masterSecret = "60162c8cf195ce9f4dc76629";
// private static final String appKey = "d970d5e193cb2a0bbe41653c";
//测试
private final static String masterSecret = "a7d41825e75082b13675c326";
private final static String appKey = "d147124018074eb970474e48";
static {
jPushClient = new JPushClient(masterSecret, appKey);
}
/**
* 向安卓手机推送一条信息
*
* @param message
* @return
*/
@Override
public boolean pushMessageByAndroid(String message, String registrationID, Map map) {
try {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.registrationId(registrationID))
.setNotification(Notification.android("爱鱼奇提示", message, map))
.build();
PushResult result = jPushClient.sendPush(payload);
if (result.msg_id > 0 && result.isResultOK()) {
return true;
}
} catch (Exception e) {
}
return false;
}
/**
* 向苹果手机推送一条信息
*
* @param message
* @return
*/
@Override
public boolean pushMessageByIOS(String message, String registrationID, Map map) {
try {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.ios())
.setAudience(Audience.registrationId(registrationID))
.setNotification(Notification.android("爱鱼奇提示", message, map))
.build();
PushResult result = jPushClient.sendPush(payload);
if (result.msg_id > 0 && result.isResultOK()) {
return true;
}
} catch (Exception e) {
}
return false;
}
}

View File

@ -0,0 +1,31 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.helper;
import java.util.Map;
/**
*
* @author Administrator
*/
public interface JpushHelperI {
/**
* 向安卓手机推送一条信息
*
* @param message
* @return
*/
boolean pushMessageByAndroid(String message, String registrationID, Map map);
/**
* 向苹果手机推送一条信息
*
* @param message
* @return
*/
boolean pushMessageByIOS(String message, String registrationID, Map map);
}

View File

@ -0,0 +1,174 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.helper;
import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_Statistics;
import com.ifish.bean.Tbl_Device_User;
import com.ifish.bean.Tbl_User;
import com.ifish.util.RedisKey;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
* @author Administrator
*/
@Component
public class RedisKeyHelper implements RedisKeyHelperI {
@Autowired
private RedisHelperI redisHelperI;
/**
* 根据userId获取Tbl_User用户信息的Redis缓存key键值
*
* @param userId
* @return
*/
public String getTbl_UserRedisKeyByUserId(Integer userId) {
return RedisKey.USER_ID_KEY + userId;
}
/**
* 根据mac地址获取Tbl_Device的redis缓存key键值
*
* @param macAddress
* @return
*/
@Override
public String getTbl_DeviceRedisKeyByMacAddress(String macAddress) {
return RedisKey.DEVICE_KEY_MACADDRESS + macAddress;
}
/**
* 根据Id获取Tbl_Device的redis缓存key键值
*
* @param macAddress
* @return
*/
@Override
public String getTbl_DeviceRedisKeyByDeviceId(Integer deviceId) {
return RedisKey.DEVICE_KEY_DEVICEID + deviceId;
}
/**
* 根据设备ID和用户ID获取Tbl_Device_User的redis缓存key键值
*
* @param userId
* @param deviceId
* @return
*/
@Override
public String getTbl_Device_UserRedisKeyByDeviceIdAndUserId(Integer userId, Integer deviceId) {
return RedisKey.DEVICE_USER_DEVICEID_AND_USERID + "u_" + userId + "_d_" + deviceId;
}
/**
* 根据设备ID获取Tbl_Device_User(列表)的redis缓存key键值
*
* @param userId
* @param deviceId
* @return
*/
@Override
public String getListTbl_Device_UserKeyByDeviceId(Integer deviceId) {
return RedisKey.DEVICE_USER_LIST_DEVICEID + deviceId;
}
/**
* 根据mac地址获取Tbl_Device_Statistics的redis缓存key键值
*
* @param macAddress
* @return
*/
@Override
public String getTbl_Device_StatisticsRedisKeyByMacAddress(String macAddress) {
return RedisKey.DEVICE_STATISTICS_MACADDRESS + macAddress;
}
/**
* 根据Id获取Tbl_Device_Statistics的redis缓存key键值
*
* @param macAddress
* @return
*/
@Override
public String getTbl_Device_StatisticsRedisKeyByDeviceId(Integer deviceId) {
return RedisKey.DEVICE_STATISTICS_DEVICEID + deviceId;
}
/**
* 根据typeCode获取Tbl_HardWare_Type的redis缓存key键值
*
* @param typeCode
* @return
*/
public String getTbl_HardWare_TypeRedisKeyByTypeCode(String typeCode) {
return RedisKey.HARD_WARE_TYPE + typeCode;
}
/**
* 删除redis中某个设备详情Tbl_Device的缓存
*
* @param device
* @return
*/
@Override
public void deleteRedisByTbl_Device(Tbl_Device device) {
if (device.getDeviceId() > 0) {
redisHelperI.deleteRedis(getTbl_DeviceRedisKeyByDeviceId(device.getDeviceId()));
}
if (StringUtils.isNotBlank(device.getMacAddress())) {
redisHelperI.deleteRedis(getTbl_DeviceRedisKeyByMacAddress(device.getMacAddress()));
}
}
/**
* 删除redis中某个设备统计信息Tbl_Device_Statistics的缓存
*
* @param device
* @return
*/
@Override
public void deleteRedisByTbl_Device_Statistics(Tbl_Device_Statistics device) {
if (device.getDeviceId() > 0) {
redisHelperI.deleteRedis(getTbl_DeviceRedisKeyByDeviceId(device.getDeviceId()));
}
if (StringUtils.isNotBlank(device.getMacAddress())) {
redisHelperI.deleteRedis(getTbl_DeviceRedisKeyByMacAddress(device.getMacAddress()));
}
}
/**
* 删除redis中某个设备和用户关系Tbl_Device_User的缓存
*
* @param tbl_Device_User
*/
@Override
public void deleteRedisByTbl_Device_User(Tbl_Device_User tbl_Device_User) {
if (tbl_Device_User.getDeviceId() > 0 && tbl_Device_User.getUserId() > 0) {
redisHelperI.deleteRedis(getTbl_Device_UserRedisKeyByDeviceIdAndUserId(tbl_Device_User.getUserId(), tbl_Device_User.getDeviceId()));
}
if (tbl_Device_User.getDeviceId() > 0) {
redisHelperI.deleteRedis(getListTbl_Device_UserKeyByDeviceId(tbl_Device_User.getDeviceId()));
}
}
/**
* 删除redis中某个用户Tbl_User的缓存
*
* @param tbl_User
*/
@Override
public void deleteRedisByTbl_User(Tbl_User tbl_User) {
if (tbl_User.getUserId() > 0) {
redisHelperI.deleteRedis(getTbl_UserRedisKeyByUserId(tbl_User.getUserId()));
}
}
}

View File

@ -0,0 +1,114 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.helper;
import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_Statistics;
import com.ifish.bean.Tbl_Device_User;
import com.ifish.bean.Tbl_User;
/**
*
* @author Administrator
*/
public interface RedisKeyHelperI {
/**
* 根据userId获取Tbl_User用户信息的Redis缓存key键值
*
* @param userId
* @return
*/
public String getTbl_UserRedisKeyByUserId(Integer userId);
/**
* 根据mac地址获取Tbl_Device的redis缓存key键值
*
* @param macAddress
* @return
*/
public String getTbl_DeviceRedisKeyByMacAddress(String macAddress);
/**
* 根据Id获取Tbl_Device的redis缓存key键值
*
* @param macAddress
* @return
*/
public String getTbl_DeviceRedisKeyByDeviceId(Integer deviceId);
/**
* 根据mac地址获取Tbl_Device_Statistics的redis缓存key键值
*
* @param macAddress
* @return
*/
public String getTbl_Device_StatisticsRedisKeyByMacAddress(String macAddress);
/**
* 根据Id获取Tbl_Device_Statistics的redis缓存key键值
*
* @param macAddress
* @return
*/
public String getTbl_Device_StatisticsRedisKeyByDeviceId(Integer deviceId);
/**
* 根据设备ID和用户ID获取Tbl_Device_User的redis缓存key键值
*
* @param userId
* @param deviceId
* @return
*/
public String getTbl_Device_UserRedisKeyByDeviceIdAndUserId(Integer userId, Integer deviceId);
/**
* 根据设备ID获取Tbl_Device_User(列表)的redis缓存key键值
*
* @param userId
* @param deviceId
* @return
*/
public String getListTbl_Device_UserKeyByDeviceId(Integer deviceId);
/**
* 根据typeCode获取Tbl_HardWare_Type的redis缓存key键值
*
* @param typeCode
* @return
*/
public String getTbl_HardWare_TypeRedisKeyByTypeCode(String typeCode);
/**
* 删除redis中某个设备详情的缓存
*
* @param device
* @return
*/
public void deleteRedisByTbl_Device(Tbl_Device device);
/**
* 删除redis中某个设备统计信息Tbl_Device_Statistics的缓存
*
* @param device
* @return
*/
public void deleteRedisByTbl_Device_Statistics(Tbl_Device_Statistics device);
/**
* 删除redis中某个设备和用户关系Tbl_Device_User的缓存
*
* @param tbl_Device_User
*/
public void deleteRedisByTbl_Device_User(Tbl_Device_User tbl_Device_User);
/**
* 删除redis中某个用户Tbl_User的缓存
*
* @param tbl_User
*/
public void deleteRedisByTbl_User(Tbl_User tbl_User);
}

View File

@ -10,7 +10,6 @@ import com.ifish.bean.Tbl_User;
import com.ifish.mapper.Tbl_Push_List_Mapper; import com.ifish.mapper.Tbl_Push_List_Mapper;
import com.ifish.mapper.Tbl_User_Mapper; import com.ifish.mapper.Tbl_User_Mapper;
import com.ifish.util.IfishUtil; import com.ifish.util.IfishUtil;
import com.ifish.util.RedisKey;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -31,11 +30,14 @@ public class UserHelper implements UserHelperI {
@Autowired @Autowired
private Tbl_Push_List_Mapper tbl_Push_List_Mapper; private Tbl_Push_List_Mapper tbl_Push_List_Mapper;
@Autowired
private RedisKeyHelperI redisKeyHelperI;
@Override @Override
public Tbl_User findById(Integer userId) { public Tbl_User findById(Integer userId) {
Tbl_User tmpUser = null; Tbl_User tmpUser = null;
try { try {
String userKey = RedisKey.User_Key + userId; String userKey = redisKeyHelperI.getTbl_UserRedisKeyByUserId(userId);
String userString = redisHelperI.getRedis(userKey); String userString = redisHelperI.getRedis(userKey);
//1.从数据库或缓存中读取用户对象 //1.从数据库或缓存中读取用户对象
if (StringUtils.isNotBlank(userString)) { if (StringUtils.isNotBlank(userString)) {
@ -69,7 +71,7 @@ public class UserHelper implements UserHelperI {
* @param user * @param user
*/ */
private void saveUserToRedis(Tbl_User user) throws Exception { private void saveUserToRedis(Tbl_User user) throws Exception {
String key = RedisKey.User_Key + user.getUserId(); String key = redisKeyHelperI.getTbl_UserRedisKeyByUserId(user.getUserId());
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(user)); redisHelperI.setRedis(key, IfishUtil.ObjectToJson(user));
} }
} }

View File

@ -120,6 +120,16 @@ public interface Tbl_Device_Mapper {
+ "upgrade_time,authorize_time,create_code,MCU_count,module_count,router_count,server_count,server_try_count,software_version,hardware_type,factory_code,brand_code FROM tbl_device_statistics WHERE device_id=#{deviceid}") + "upgrade_time,authorize_time,create_code,MCU_count,module_count,router_count,server_count,server_try_count,software_version,hardware_type,factory_code,brand_code FROM tbl_device_statistics WHERE device_id=#{deviceid}")
Tbl_Device_Statistics getDevStatisticsByDeviceId(@Param("deviceid") Integer deviceid); Tbl_Device_Statistics getDevStatisticsByDeviceId(@Param("deviceid") Integer deviceid);
/**
* 根据设备ID查询设备统计信息
*
* @param deviceid
* @return
*/
@Select("SELECT id,device_id,mac_address,login_count,login_time,first_activate,create_time,is_charge,sdk_version,sdk_time,create_date,is_upgrade,upgrade_version,"
+ "upgrade_time,authorize_time,create_code,MCU_count,module_count,router_count,server_count,server_try_count,software_version,hardware_type,factory_code,brand_code FROM tbl_device_statistics WHERE mac_address=#{mac}")
Tbl_Device_Statistics getDevStatisticsByMacAddress(@Param("mac") String macAddress);
/** /**
* 插入一条设备统计信息 * 插入一条设备统计信息
* *
@ -168,7 +178,6 @@ public interface Tbl_Device_Mapper {
@Delete("DELETE from tbl_device where id = #{id}") @Delete("DELETE from tbl_device where id = #{id}")
int deleteDeviceById(@Param("id") Integer id); int deleteDeviceById(@Param("id") Integer id);
/** /**
* 修改设备信息 * 修改设备信息
* *

View File

@ -0,0 +1,18 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.push;
import cn.jiguang.common.ClientConfig;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.model.PushPayload;
/**
*
* @author Administrator
*/
public class JiGuangPush {
}

View File

@ -168,7 +168,7 @@ public class ServerDecode implements ProtocolDecoder {
model.setDest(dest); model.setDest(dest);
model.setRemote_len(buf.get()); model.setRemote_len(buf.get());
//登陆信息 //登陆信息
model.setVendor(buf.get()); model.setfactoryCode(buf.get());
model.setHardware_type(buf.get()); model.setHardware_type(buf.get());
model.setVersion(buf.get()); model.setVersion(buf.get());
byte[] login_ip = model.getLogin_ip(); byte[] login_ip = model.getLogin_ip();

View File

@ -13,11 +13,13 @@ import com.ifish.bean.Tbl_Push_List;
import com.ifish.bean.Tbl_User; import com.ifish.bean.Tbl_User;
import com.ifish.enums.PushTypeEnum; import com.ifish.enums.PushTypeEnum;
import com.ifish.helper.DeviceHelperI; import com.ifish.helper.DeviceHelperI;
import com.ifish.helper.JpushHelperI;
import com.ifish.helper.UserHelperI; import com.ifish.helper.UserHelperI;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.mina.core.session.IoSession; import org.apache.mina.core.session.IoSession;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobDataMap; import org.quartz.JobDataMap;
@ -40,6 +42,8 @@ public class ExecuteJob implements Job {
private UserHelperI userHelperI; private UserHelperI userHelperI;
@Autowired @Autowired
private DeviceHelperI deviceHelperI; private DeviceHelperI deviceHelperI;
@Autowired
private JpushHelperI jpushHelperI;
public void execute(JobExecutionContext context) throws JobExecutionException { public void execute(JobExecutionContext context) throws JobExecutionException {
//任务传递的参数 //任务传递的参数
@ -53,7 +57,7 @@ public class ExecuteJob implements Job {
SomeServer.sessions_cz.remove(macAddress); SomeServer.sessions_cz.remove(macAddress);
} }
//设备是否存在 //设备是否存在
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", macAddress); Tbl_Device device = deviceHelperI.getDeviceByMacAddress(macAddress);
Tbl_Device_Statistics device_Statistics = null; Tbl_Device_Statistics device_Statistics = null;
if (device != null) { if (device != null) {
//记录次数 //记录次数
@ -62,7 +66,7 @@ public class ExecuteJob implements Job {
Integer number3 = device_Statistics.getRouterCount(); Integer number3 = device_Statistics.getRouterCount();
Integer number4 = device_Statistics.getServerCount(); Integer number4 = device_Statistics.getServerCount();
Integer number5 = device_Statistics.getServerTryCount(); Integer number5 = device_Statistics.getServerTryCount();
List<Tbl_Device_User> list = deviceHelperI.getListByProperty(device.getDeviceId()); List<Tbl_Device_User> list = deviceHelperI.getTbl_Device_UsersListByDeviceId(device.getDeviceId());
//是否被绑定 //是否被绑定
if (list != null) { if (list != null) {
for (Tbl_Device_User deviceUser : list) { for (Tbl_Device_User deviceUser : list) {
@ -70,33 +74,34 @@ public class ExecuteJob implements Job {
String showName = deviceUser.getShowName(); String showName = deviceUser.getShowName();
String title = PushTypeEnum.offline_push.getValue(); String title = PushTypeEnum.offline_push.getValue();
String msg = "" + title + "】你的水族箱“" + showName + "”于" + timestamp + "离线,请及时查看!"; String msg = "" + title + "】你的水族箱“" + showName + "”于" + timestamp + "离线,请及时查看!";
//发送云信消息 Tbl_User user = userHelperI.findById(userId);
boolean neteaseBln = false;
// Map<String, String> neteaseMap = neteaseIM.sendMsg("ifish", userId.toString(), msg);
// if (neteaseMap != null) {
// neteaseBln = neteaseMap.get("code").equals(NeteaseEnum.status200.getKey());
// }
//IOS极光推送
boolean jpushIosBln = false;
//推送记录 //推送记录
Tbl_Push_List pushList = new Tbl_Push_List(); Tbl_Push_List pushList = new Tbl_Push_List();
Integer deviceId = deviceUser.getDeviceId(); Integer deviceId = deviceUser.getDeviceId();
Tbl_User user = userHelperI.findById(userId);
if (user != null) { if (user != null) {
String loginType = user.getLoginType(); String loginType = user.getLoginType();
if (loginType != null) { String registrationID = user.getJiguangUserid();
if (StringUtils.isNotBlank(loginType) && StringUtils.isNotBlank(registrationID)) {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put("device_id", deviceId.toString()); map.put("device_id", deviceId.toString());
map.put("device_name", showName); map.put("device_name", showName);
map.put("timestamp", timestamp); map.put("timestamp", timestamp);
map.put("msg_type", PushTypeEnum.offline_push.getKey()); map.put("msg_type", PushTypeEnum.offline_push.getKey());
//极光推送
boolean result = false;
if (loginType.equals("android")) {
result = jpushHelperI.pushMessageByAndroid(msg, registrationID, map);
} else if (loginType.equals("ios")) {
result = jpushHelperI.pushMessageByAndroid(msg, registrationID, map);
}
if (result) {
//推送记录 //推送记录
pushList.setUserId(userId); pushList.setUserId(userId);
pushList.setDeviceId(deviceId); pushList.setDeviceId(deviceId);
pushList.setPhoneType(loginType.toLowerCase()); pushList.setPhoneType(loginType.toLowerCase());
pushList.setShowName(showName); pushList.setShowName(showName);
pushList.setPushType(PushTypeEnum.offline_push.getKey()); pushList.setPushType(PushTypeEnum.offline_push.getKey());
pushList.setJpushStatus(neteaseBln ? "1" : "0"); pushList.setJpushStatus(result ? "1" : "0");
pushList.setPushTitle(title); pushList.setPushTitle(title);
pushList.setPushContext(msg); pushList.setPushContext(msg);
pushList.setCreateTime(new Date()); pushList.setCreateTime(new Date());
@ -111,6 +116,7 @@ public class ExecuteJob implements Job {
} }
} }
} }
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("error msg:{}", e.toString()); log.error("error msg:{}", e.toString());

View File

@ -13,6 +13,7 @@ import com.ifish.bean.Tbl_Push_List;
import com.ifish.bean.Tbl_User; import com.ifish.bean.Tbl_User;
import com.ifish.enums.PushTypeEnum; import com.ifish.enums.PushTypeEnum;
import com.ifish.helper.DeviceHelperI; import com.ifish.helper.DeviceHelperI;
import com.ifish.helper.JpushHelperI;
import com.ifish.helper.UserHelperI; import com.ifish.helper.UserHelperI;
import com.ifish.socket.model.JobGroup; import com.ifish.socket.model.JobGroup;
import com.ifish.socket.model.OrderModel; import com.ifish.socket.model.OrderModel;
@ -33,6 +34,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import org.apache.commons.lang3.StringUtils;
import org.apache.mina.core.session.IoSession; import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -53,6 +55,9 @@ public class SomeServer {
// @Autowired // @Autowired
// private NeteaseIM neteaseIM; // private NeteaseIM neteaseIM;
@Autowired
private JpushHelperI jpushHelperI;
//是否回复心跳 //是否回复心跳
public static boolean isReplay = true; public static boolean isReplay = true;
@ -80,6 +85,7 @@ public class SomeServer {
} }
String strSrc = ByteUtil.bytesToHexString(srcByte); String strSrc = ByteUtil.bytesToHexString(srcByte);
//心跳 //心跳
if (length >= 28) { if (length >= 28) {
sendToApp(session, strSrc, message); sendToApp(session, strSrc, message);
} else { } else {
@ -133,19 +139,7 @@ public class SomeServer {
scheduleJob.deleteJob(jobGroup); scheduleJob.deleteJob(jobGroup);
try { try {
//更新设备信息 //更新设备信息
deviceHelperI.update(receive); deviceHelperI.updateDeviceWhenLogin(receive);
// if(device==null){
// String HexDump = ByteUtil.toHex(receive.getType())+ByteUtil.toHex(receive.getCheck_code())+ByteUtil.bytesToHexString(receive.getSrc())+ByteUtil.bytesToHexString(destBytes)+ByteUtil.toHex(receive.getRemote_len())+ByteUtil.toHex(receive.getVendor())+ByteUtil.toHex(receive.getHardware_type())+ByteUtil.toHex(receive.getVersion())+ByteUtil.bytesToHexString(receive.getLogin_ip())+ByteUtil.bytesToHexString(receive.getCrc16_code());
// log.error("HexDump:{}",HexDump);
// log.error("factoryCode or hardwareType not exist:macAddress:{},factoryCode:{},hardwareType:{}",strSrc,ByteUtil.toHex(receive.getVendor()),ByteUtil.toHex(receive.getHardware_type()));
// }
// else{
//记录登录时间
LoginRecord loginRecord = new LoginRecord();
loginRecord.setMacAddress(strSrc);
loginRecord.setLoginTime(new Date());
deviceHelperI.save(loginRecord);
// }
} catch (Exception e) { } catch (Exception e) {
log.warn("save device login error:macAddress:{},error msg:{}", strSrc, e.toString()); log.warn("save device login error:macAddress:{},error msg:{}", strSrc, e.toString());
} }
@ -188,7 +182,7 @@ public class SomeServer {
String strSrc = ByteUtil.bytesToHexString(macBytes); String strSrc = ByteUtil.bytesToHexString(macBytes);
try { try {
//查找设备 //查找设备
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", strSrc); Tbl_Device device = deviceHelperI.getDeviceByMacAddress(strSrc);
Tbl_Device_Statistics device_Statistics = null; Tbl_Device_Statistics device_Statistics = null;
if (device != null) { if (device != null) {
//是否升级 //是否升级
@ -215,7 +209,7 @@ public class SomeServer {
String strSrc = ByteUtil.bytesToHexString(macBytes); String strSrc = ByteUtil.bytesToHexString(macBytes);
try { try {
//查找设备 //查找设备
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", strSrc); Tbl_Device device = deviceHelperI.getDeviceByMacAddress(strSrc);
Tbl_Device_Statistics device_Statistics = null; Tbl_Device_Statistics device_Statistics = null;
if (device != null) { if (device != null) {
//是否升级 //是否升级
@ -297,8 +291,7 @@ public class SomeServer {
*/ */
public void pushNotifcation(String strSrc, String title, String contont) { public void pushNotifcation(String strSrc, String title, String contont) {
try { try {
//Device device = deviceService.getUniqueByProperty("macAddress", strSrc); Tbl_Device device = deviceHelperI.getDeviceByMacAddress(strSrc);
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", strSrc);
Tbl_Device_Statistics device_Statistics = null; Tbl_Device_Statistics device_Statistics = null;
if (device != null) { if (device != null) {
Integer deviceId = device.getDeviceId(); Integer deviceId = device.getDeviceId();
@ -306,7 +299,7 @@ public class SomeServer {
String onOff = device.getOnOff(); String onOff = device.getOnOff();
if (onOff != null && onOff.equals("1")) { if (onOff != null && onOff.equals("1")) {
//绑定设备的用户 //绑定设备的用户
List<Tbl_Device_User> list = deviceHelperI.getListByProperty(device.getDeviceId()); List<Tbl_Device_User> list = deviceHelperI.getTbl_Device_UsersListByDeviceId(device.getDeviceId());
for (Tbl_Device_User deviceUser : list) { for (Tbl_Device_User deviceUser : list) {
Integer userId = deviceUser.getUserId(); Integer userId = deviceUser.getUserId();
String showName = deviceUser.getShowName(); String showName = deviceUser.getShowName();
@ -314,18 +307,11 @@ public class SomeServer {
String msg = "" + title + "】你的水族箱“" + showName + "”在" + timestamp + contont; String msg = "" + title + "】你的水族箱“" + showName + "”在" + timestamp + contont;
Tbl_User user = userHelperI.findById(userId); Tbl_User user = userHelperI.findById(userId);
if (user != null) { if (user != null) {
//云信推送
boolean neteaseBln = false;
//极光推送 //极光推送
boolean jpushIosBln = false; boolean result = false;
boolean jpushAndroidBln = false;
//发送云信消息
// Map<String, String> neteaseMap = neteaseIM.sendMsg("ifish", userId.toString(), msg);
// if (neteaseMap != null) {
// neteaseBln = neteaseMap.get("code").equals(NeteaseEnum.status200.getKey());
// }
String loginType = user.getLoginType(); String loginType = user.getLoginType();
if (loginType != null) { String registrationID = user.getJiguangUserid();
if (StringUtils.isNotBlank(loginType) && StringUtils.isNotBlank(registrationID)) {
//推送记录 //推送记录
Tbl_Push_List pushList = new Tbl_Push_List(); Tbl_Push_List pushList = new Tbl_Push_List();
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
@ -333,8 +319,14 @@ public class SomeServer {
map.put("device_name", showName); map.put("device_name", showName);
map.put("timestamp", timestamp); map.put("timestamp", timestamp);
map.put("msg_type", PushTypeEnum.wendu_warn.getKey()); map.put("msg_type", PushTypeEnum.wendu_warn.getKey());
if (loginType.equals("android")) {
result = jpushHelperI.pushMessageByAndroid(msg, registrationID, map);
} else if (loginType.equals("ios")) {
result = jpushHelperI.pushMessageByAndroid(msg, registrationID, map);
}
//记录推送 //记录推送
if (jpushIosBln || jpushAndroidBln || neteaseBln) { if (result) {
pushList.setUserId(userId); pushList.setUserId(userId);
pushList.setDeviceId(deviceId); pushList.setDeviceId(deviceId);
pushList.setPhoneType(loginType.toLowerCase()); pushList.setPhoneType(loginType.toLowerCase());
@ -342,7 +334,7 @@ public class SomeServer {
pushList.setPushType(PushTypeEnum.wendu_warn.getKey()); pushList.setPushType(PushTypeEnum.wendu_warn.getKey());
pushList.setPushTitle(title); pushList.setPushTitle(title);
pushList.setPushContext(msg); pushList.setPushContext(msg);
pushList.setJpushStatus(neteaseBln ? "1" : "0"); pushList.setJpushStatus(result ? "1" : "0");
pushList.setCreateTime(new Date()); pushList.setCreateTime(new Date());
pushList.setMcuCount(device_Statistics.getMcuCount()); pushList.setMcuCount(device_Statistics.getMcuCount());
pushList.setModularCount(device_Statistics.getModuleCount()); pushList.setModularCount(device_Statistics.getModuleCount());

View File

@ -17,8 +17,8 @@ import java.io.Serializable;
public class DeviceLoginContextLength24 extends HeadModel implements Serializable { public class DeviceLoginContextLength24 extends HeadModel implements Serializable {
private static final long serialVersionUID = 5329299292101065390L; private static final long serialVersionUID = 5329299292101065390L;
//厂商 //鱼缸厂商
private byte vendor; private byte factoryCode;
//硬件型号 //硬件型号
private byte hardware_type; private byte hardware_type;
//版本 //版本
@ -26,12 +26,12 @@ public class DeviceLoginContextLength24 extends HeadModel implements Serializabl
//登陆IP //登陆IP
private byte[] login_ip = new byte[4]; private byte[] login_ip = new byte[4];
public byte getVendor() { public byte getfactoryCode() {
return vendor; return factoryCode;
} }
public void setVendor(byte vendor) { public void setfactoryCode(byte factoryCode) {
this.vendor = vendor; this.factoryCode = factoryCode;
} }
public byte getHardware_type() { public byte getHardware_type() {

View File

@ -16,6 +16,6 @@ public class ServiceBean {
private static boolean push = false; private static boolean push = false;
public ServiceBean() { public ServiceBean() {
Endpoint.publish("http://localhost:9001/Service/webService", new MyService()); Endpoint.publish("http://localhost:9002/Service/webService", new MyService());
} }
} }

View File

@ -12,67 +12,43 @@ package com.ifish.util;
public class RedisKey { public class RedisKey {
/** /**
* 用户缓存前缀 * 用户缓存前缀,以id进行存储
*/ */
public static final String User_Key = "userE:"; public static final String USER_ID_KEY = "userE:id_";
/** /**
* 商家信息缓存前缀 * 设备用户关系缓存前缀以设备ID和用户ID进行存储
*/ */
public static final String ShopsInfo_Key = "shopsInfoE:"; public static final String DEVICE_USER_DEVICEID_AND_USERID = "deviceUserE:";
/** /**
* 用户绑定设备缓存前缀 * 设备用户关系缓存前缀列表以设备ID进行存储
*/ */
public static final String DeviceUser_Key = "deviceUserE:"; public static final String DEVICE_USER_LIST_DEVICEID = "deviceUserlistE:id_";
/** /**
* 设备绑定摄像头缓存前缀 * 设备详情缓存前缀以macAddress进行存储
*/ */
public static final String DeviceCamera_key = "deviceCameraE:"; public static final String DEVICE_KEY_MACADDRESS = "deviceE:mac_";
/** /**
* 设备详情缓存前缀 * 设备详情缓存前缀以deviceId进行存储
*/ */
public static final String Device_key = "deviceE:"; public static final String DEVICE_KEY_DEVICEID = "deviceE:id_";
/**
* 设备统计信息表缓存前缀,以deviceId为前缀
*/
public static final String DEVICE_STATISTICS_DEVICEID = "devicestatiE:id_";
/**
* 设备统计信息表缓存前缀,以mac地址为前缀
*/
public static final String DEVICE_STATISTICS_MACADDRESS = "devicestatiE:mac_";
/** /**
* 设备类型缓存前缀 * 设备类型缓存前缀
*/ */
public static final String HardWareType_key = "hardwaretypeE:"; public static final String HARD_WARE_TYPE = "hardwaretypeE:";
/**
* 厂家列表缓存前缀
*/
public static final String VenderList_key = "venderlistE:";
/**
* 用户和摄像头的绑定关系存前缀
*/
public static final String CameraUser_key = "cameraUserE:";
/**
* 摄像头详情缓存前缀
*/
public static final String Camera_key = "cameraE:";
/**
* 设备统计信息表缓存前缀
*/
public static final String DeviceStatistic_key = "deviceStaticticsE:";
/**
* 直播间详情表缓存前缀
*/
public static final String LiveRoom_key = "liveroomE:";
/**
* 直播间数量缓存前缀
*/
public static final String LIVEROOM_COUNT_KEY = "liveroomcountE:";
/**
* 推送消息缓存前缀
*/
public static final String PUSHLIST_KEY = "pushlistE:";
} }

View File

@ -35,11 +35,11 @@ check_style=GIF,PNG,BMP,JPG,JPEG
#\u662f\u5426\u5f00\u53d1\u6a21\u5f0f\uff0cfalse\u5219\u4ee3\u8868\u8981\u53d1\u5e03\u5230\u6d4b\u8bd5\u6216\u8005\u6b63\u5f0f\u73af\u5883\uff0c\u4f1a\u8fdb\u884c\u5168\u5c40\u5934\u90e8\u9a8c\u8bc1\uff0ctrue\u4ee3\u8868\u5728\u672c\u5730\u8fdb\u884c\u4ee3\u7801\u7f16\u5199\uff0c\u4e0d\u4f1a\u8fdb\u884c\u9a8c\u8bc1 #\u662f\u5426\u5f00\u53d1\u6a21\u5f0f\uff0cfalse\u5219\u4ee3\u8868\u8981\u53d1\u5e03\u5230\u6d4b\u8bd5\u6216\u8005\u6b63\u5f0f\u73af\u5883\uff0c\u4f1a\u8fdb\u884c\u5168\u5c40\u5934\u90e8\u9a8c\u8bc1\uff0ctrue\u4ee3\u8868\u5728\u672c\u5730\u8fdb\u884c\u4ee3\u7801\u7f16\u5199\uff0c\u4e0d\u4f1a\u8fdb\u884c\u9a8c\u8bc1
devModel=true devModel=true
#\u672c\u5730 #\u672c\u5730
#ifiship=192.168.199.129 ifiship=192.168.199.129
ifiship=192.168.2.146 #ifiship=192.168.2.146
#\u6d4b\u8bd5\u4e91 #\u6d4b\u8bd5\u4e91
#ifiship=139.196.24.156 #ifiship=139.196.24.156
#\u6b63\u5f0f\u4e91 #\u6b63\u5f0f\u4e91
#ifiship=120.55.190.56 #ifiship=120.55.190.56
#\u670d\u52a1\u5668\u7aef\u53e3 #\u670d\u52a1\u5668\u7aef\u53e3
ifishport=9955 ifishport=9956