设置断电提醒和换水提醒
This commit is contained in:
parent
2c4f2eef65
commit
9aaefa661d
|
|
@ -23,7 +23,7 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final long serialVersionUID = 3405700970095511149L;
|
||||
private static final long serialVersionUID = -7095234476683939631L;
|
||||
|
||||
/**
|
||||
* 设备Id
|
||||
|
|
@ -63,7 +63,7 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
private Date loginTime;
|
||||
|
||||
/**
|
||||
* 是否在黑名单:1不在、0在
|
||||
* 是否在黑名单(是否授权):1未授权,在、0已授权,不在
|
||||
*/
|
||||
@Column(name = "is_blacklist", nullable = true, length = 1)
|
||||
private String isBlacklist;
|
||||
|
|
@ -75,11 +75,17 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
private String hardwareType;
|
||||
|
||||
/**
|
||||
* 是否推送
|
||||
* 是否温度报警
|
||||
*/
|
||||
@Column(name = "on_off", nullable = true, length = 1)
|
||||
private String onOff;
|
||||
|
||||
/**
|
||||
* 是否接收离线通知:1接收,0不接受
|
||||
*/
|
||||
@Column(name = "off_line", nullable = true, length = 1)
|
||||
private String offLine;
|
||||
|
||||
/**
|
||||
* 今天是否提醒:1提醒、0不提醒
|
||||
*/
|
||||
|
|
@ -119,7 +125,7 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
/**
|
||||
* 摄像头ID
|
||||
*/
|
||||
@Column(name = "camera_id", nullable = true, length = 20)
|
||||
@Column(name = "camera_id", unique = true, nullable = true, length = 20)
|
||||
private String cameraId;
|
||||
|
||||
/**
|
||||
|
|
@ -255,18 +261,18 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取是否在黑名单:1不在、0在
|
||||
* 获取是否在黑名单(是否授权):1未授权,在、0已授权,不在
|
||||
*
|
||||
* @return 是否在黑名单
|
||||
* @return 是否在黑名单(是否授权):1未授权
|
||||
*/
|
||||
public String getIsBlacklist() {
|
||||
return this.isBlacklist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否在黑名单:1不在、0在
|
||||
* 设置是否在黑名单(是否授权):1未授权,在、0已授权,不在
|
||||
*
|
||||
* @param isBlacklist 是否在黑名单:1不在、0在
|
||||
* @param isBlacklist 是否在黑名单(是否授权):1未授权,在、0已授权,不在
|
||||
*/
|
||||
public void setIsBlacklist(String isBlacklist) {
|
||||
this.isBlacklist = isBlacklist;
|
||||
|
|
@ -291,23 +297,41 @@ public class Tbl_Device implements java.io.Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取是否推送
|
||||
* 获取是否温度报警
|
||||
*
|
||||
* @return 是否推送
|
||||
* @return 是否温度报警
|
||||
*/
|
||||
public String getOnOff() {
|
||||
return this.onOff;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否推送
|
||||
* 设置是否温度报警
|
||||
*
|
||||
* @param onOff 是否推送
|
||||
* @param onOff 是否温度报警
|
||||
*/
|
||||
public void setOnOff(String onOff) {
|
||||
this.onOff = onOff;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否接收离线通知:1接收,0不接受
|
||||
*
|
||||
* @return 是否接收离线通知:1接收
|
||||
*/
|
||||
public String getOffLine() {
|
||||
return this.offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否接收离线通知:1接收,0不接受
|
||||
*
|
||||
* @param offLine 是否接收离线通知:1接收,0不接受
|
||||
*/
|
||||
public void setOffLine(String offLine) {
|
||||
this.offLine = offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今天是否提醒:1提醒、0不提醒
|
||||
*
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.ifish.bean.Tbl_User;
|
|||
import com.ifish.enums.ResultEnum;
|
||||
import com.ifish.helper.DeviceHelperI;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import java.util.Date;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
|
@ -139,4 +140,31 @@ public class Device {
|
|||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否接收离线通知
|
||||
*
|
||||
* @param macAddress
|
||||
* @param offLive
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/updateDeviceOffLive"}, method = RequestMethod.POST)
|
||||
public Object updateDeviceOffLive(String macAddress, String offLive) {
|
||||
return deviceHelperI.updateDeviceOffLive(macAddress, offLive);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置换水提醒
|
||||
*
|
||||
* @param macAddress 设备mac
|
||||
* @param todayRemind 今天是否提醒
|
||||
* @param waterRemind 是否开启换水提醒
|
||||
* @param remindDate 换水提醒日期
|
||||
* @param remindCycle 换水提醒周期
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/updateDeviceRemind"}, method = RequestMethod.POST)
|
||||
public Object updateDeviceRemind(String macAddress, String todayRemind, String waterRemind, Date remindDate, Integer remindCycle) {
|
||||
return deviceHelperI.updateDeviceRemind(macAddress, todayRemind, waterRemind, remindDate, remindCycle);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,16 @@
|
|||
/*
|
||||
* 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.enums;
|
||||
|
||||
/**
|
||||
* 推送消息类型
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public enum PushTypeEnum {
|
||||
remove_device("remove_device", "解绑通知"),
|
||||
wendu_warn("wendu_warn", "温度预警"),
|
||||
remove_device("remove_device", "OUT OF CONTROL"),//解绑通知
|
||||
wendu_warn("wendu_warn", "TEMPERTURE WARNING"),//温度预警
|
||||
qu_reply("qu_reply", "问题反馈"),
|
||||
app_update("app_update", "IOS更新推送"),
|
||||
remind_water("remind_water", "换水提醒"),
|
||||
offline_push("offline_push", "离线通知"),
|
||||
app_update("app_update", "UPDATE NOTICE"),//IOS更新推送
|
||||
remind_water("remind_water", "WATER CHANGE NOTIEC"),//换水提醒
|
||||
offline_push("offline_push", "OFF-LINE NOTICE"),//离线通知
|
||||
send_report("send_report", "看护报告"),
|
||||
shops_push("shops_push", "看护通知"),
|
||||
all_push("all_push", "所有用户推送"),
|
||||
pinglun_push("pinglun_push","直播间评论");
|
||||
pinglun_push("pinglun_push", "直播间评论");
|
||||
|
||||
private PushTypeEnum(String key, String value) {
|
||||
this.key = key;
|
||||
|
|
@ -30,16 +20,6 @@ public enum PushTypeEnum {
|
|||
private String key;
|
||||
private String value;
|
||||
|
||||
//普通方法
|
||||
public static String getValue(String key) {
|
||||
for (PushTypeEnum c : PushTypeEnum.values()) {
|
||||
if (c.getKey().equals(key)) {
|
||||
return c.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public class DeviceHelper implements DeviceHelperI {
|
|||
//基本参数
|
||||
Map<String, String> baseMap = new HashMap<String, String>();
|
||||
baseMap.put("title", PushTypeEnum.remove_device.getValue());
|
||||
baseMap.put("content", "你已于" + timestamp + "失去对“" + du.getShowName() + "”设备的控制权");
|
||||
baseMap.put("content", "Your aquarium “" + du.getShowName() + "” is out of control at " + timestamp + "!");
|
||||
baseMap.put("user_id", tu.getUserId().toString());
|
||||
baseMap.put("loginType", tu.getLoginType());
|
||||
//推送参数
|
||||
|
|
@ -302,7 +302,7 @@ public class DeviceHelper implements DeviceHelperI {
|
|||
//基本参数
|
||||
Map<String, String> baseMap = new HashMap<String, String>();
|
||||
baseMap.put("title", PushTypeEnum.remove_device.getValue());
|
||||
baseMap.put("content", "你已于" + timestamp + "失去对“" + du.getShowName() + "”设备的控制权");
|
||||
baseMap.put("content", "Your aquarium “" + du.getShowName() + "” is out of control at " + timestamp + "!");
|
||||
baseMap.put("user_id", tu.getUserId().toString());
|
||||
baseMap.put("loginType", tu.getLoginType());
|
||||
//推送参数
|
||||
|
|
@ -668,4 +668,70 @@ public class DeviceHelper implements DeviceHelperI {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置设备是否开启离线提醒
|
||||
*
|
||||
* @param macAddress
|
||||
* @param offLive
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateDeviceOffLive(String macAddress, String offLive) {
|
||||
try {
|
||||
Tbl_Device device = getDeviceByMacAddress(macAddress);
|
||||
if (device != null) {
|
||||
Tbl_Device tbl_Device = new Tbl_Device();
|
||||
tbl_Device.setDeviceId(device.getDeviceId());
|
||||
tbl_Device.setOffLine(offLive);
|
||||
int i = tbl_Device_Mapper.updateTbl_Device(tbl_Device);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Device(device);
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置换水提醒
|
||||
*
|
||||
* @param macAddress
|
||||
* @param todayRemind
|
||||
* @param waterRemind
|
||||
* @param remindDate
|
||||
* @param remindCycle
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateDeviceRemind(String macAddress, String todayRemind, String waterRemind, Date remindDate, Integer remindCycle) {
|
||||
try {
|
||||
Tbl_Device device = getDeviceByMacAddress(macAddress);
|
||||
if (device != null) {
|
||||
Tbl_Device tbl_Device = new Tbl_Device();
|
||||
tbl_Device.setDeviceId(device.getDeviceId());
|
||||
if (StringUtils.isNotBlank(todayRemind)) {
|
||||
tbl_Device.setTodayRemind(todayRemind);
|
||||
}
|
||||
if (StringUtils.isNotBlank(waterRemind)) {
|
||||
tbl_Device.setWaterRemind(waterRemind);
|
||||
}
|
||||
if (remindDate != null) {
|
||||
tbl_Device.setRemindDate(remindDate);
|
||||
}
|
||||
if (remindCycle > 0) {
|
||||
tbl_Device.setRemindCycle(remindCycle);
|
||||
}
|
||||
int i = tbl_Device_Mapper.updateTbl_Device(tbl_Device);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Device(device);
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ 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 java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -140,4 +141,24 @@ public interface DeviceHelperI {
|
|||
*/
|
||||
Object deleteDeviceUser(Tbl_Device_User deviceUser);
|
||||
|
||||
/**
|
||||
* 设置设备是否开启离线提醒
|
||||
*
|
||||
* @param macAddress
|
||||
* @param offLive
|
||||
* @return
|
||||
*/
|
||||
public Object updateDeviceOffLive(String macAddress, String offLive);
|
||||
|
||||
/**
|
||||
* 设置换水提醒
|
||||
*
|
||||
* @param macAddress
|
||||
* @param todayRemind
|
||||
* @param waterRemind
|
||||
* @param remindDate
|
||||
* @param remindCycle
|
||||
* @return
|
||||
*/
|
||||
public Object updateDeviceRemind(String macAddress, String todayRemind, String waterRemind, Date remindDate, Integer remindCycle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -920,6 +920,8 @@ public class UserHelper implements UserHelperI {
|
|||
deviceMap.put("waterRemind", device.getWaterRemind());
|
||||
deviceMap.put("remindDate", device.getRemindDate() != null ? IfishUtil.format1(device.getRemindDate()) : "");
|
||||
deviceMap.put("remindCycle", device.getRemindCycle() != null ? device.getRemindCycle() : "");
|
||||
//是否开启离线通知
|
||||
deviceMap.put("offLine", device.getOffLine());
|
||||
}
|
||||
}
|
||||
//厂家
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE device_id= #{deviceid}")
|
||||
Tbl_Device getDeviceById(@Param("deviceid") Integer deviceid);
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE camera_id= #{cameraID}")
|
||||
Tbl_Device getDeviceByCameraId(@Param("cameraID") String cameraID);
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public interface Tbl_Device_Mapper {
|
|||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE mac_address= #{mac_address}")
|
||||
Tbl_Device getDeviceByMacAddress(@Param("mac_address") String macAddress);
|
||||
|
||||
|
|
|
|||
|
|
@ -234,6 +234,9 @@ public class Tbl_Device_MapperSql {
|
|||
if (StringUtils.isNotBlank(device.getOnOff())) {
|
||||
sb.append("on_off = #{device.onOff}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device.getOffLine())) {
|
||||
sb.append("off_line = #{device.offLine}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device.getTodayRemind())) {
|
||||
sb.append("today_remind = #{device.todayRemind}, ");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue