推送文案修改

This commit is contained in:
谢洪龙 2017-08-04 16:52:56 +08:00
parent ea697c781f
commit e4def06bd1
9 changed files with 201 additions and 35 deletions

View File

@ -0,0 +1,127 @@
/*
* 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.bean;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 摄像头激活码(tbl_activa_code)
*
* @author bianj
* @version 1.0.0 2017-07-03
*/
@Entity
@Table(name = "tbl_activa_code")
public class Tbl_Activa_Code implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = -2477544371712460934L;
/**
* 激活码
*/
@Id
@Column(name = "active_code", unique = true, nullable = false, length = 50)
private String activeCode;
/**
* 批次号
*/
@Column(name = "batch_code", nullable = true, length = 50)
private String batchCode;
/**
*
*/
@Column(name = "is_used", nullable = true, length = 1)
private String isUsed;
/**
*
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 获取激活码
*
* @return 激活码
*/
public String getActiveCode() {
return this.activeCode;
}
/**
* 设置激活码
*
* @param activeCode 激活码
*/
public void setActiveCode(String activeCode) {
this.activeCode = activeCode;
}
/**
* 获取批次号
*
* @return 批次号
*/
public String getBatchCode() {
return this.batchCode;
}
/**
* 设置批次号
*
* @param batchCode 批次号
*/
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
/**
* 获取
*
* @return
*/
public String getIsUsed() {
return this.isUsed;
}
/**
* 设置
*
* @param isUsed
*
*/
public void setIsUsed(String isUsed) {
this.isUsed = isUsed;
}
/**
* 获取
*
* @return
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置
*
* @param createTime
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -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不提醒
*

View File

@ -1,12 +1,12 @@
package com.ifish.enums;
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", "所有用户推送"),

View File

@ -103,4 +103,5 @@ public interface DeviceHelperI {
* @throws Exception
*/
public Tbl_Device_Statistics getDeviceStatisticsByDeviceId(Integer deviceId) throws Exception;
}

View File

@ -5,6 +5,7 @@
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_Activa_Code;
import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_Statistics;
import com.ifish.bean.Tbl_Device_User;
@ -29,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);
@ -39,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);
@ -49,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);
@ -178,6 +179,15 @@ public interface Tbl_Device_Mapper {
@Delete("DELETE from tbl_device where id = #{id}")
int deleteDeviceById(@Param("id") Integer id);
/**
* 根据激活码查询激活码对象
*
* @param activeCode
* @return
*/
@Select("SELECT active_code,batch_code,is_used,create_time FROM tbl_activa_code WHERE active_code = #{code}")
Tbl_Activa_Code getActiva_CodeByCode(@Param("code") String activeCode);
/**
* 修改设备信息
*

View File

@ -87,13 +87,13 @@ public class Tbl_Device_MapperSql {
sb.append("UPDATE tbl_device_statistics SET ");
if (device_Statistics.getDeviceId() > 0) {
if (device_Statistics.getDeviceId() != null && device_Statistics.getDeviceId() > 0) {
sb.append("device_id = #{deviceStatistics.deviceId}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getMacAddress())) {
sb.append("mac_address = #{deviceStatistics.macAddress}, ");
}
if (device_Statistics.getLoginCount() > 0) {
if (device_Statistics.getLoginCount() != null && device_Statistics.getLoginCount() > 0) {
sb.append("login_count = #{deviceStatistics.loginCount}, ");
}
if (device_Statistics.getLoginTime() != null && StringUtils.isNotBlank(device_Statistics.getLoginTime().toString())) {
@ -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}, ");
}

View File

@ -73,7 +73,7 @@ public class ExecuteJob implements Job {
Integer userId = deviceUser.getUserId();
String showName = deviceUser.getShowName();
String title = PushTypeEnum.offline_push.getValue();
String msg = "" + title + "你的水族箱" + showName + "" + timestamp + "离线,请及时查看";
String msg = "" + title + "Your aquarium " + showName + "was off-line at" + timestamp + ",please check it with out delay";
Tbl_User user = userHelperI.findById(userId);
//推送记录
Tbl_Push_List pushList = new Tbl_Push_List();

View File

@ -20,6 +20,7 @@ import com.ifish.socket.model.OrderModel;
import com.ifish.socket.model.receive.APPLoginResponseLength26;
import com.ifish.socket.model.receive.DeviceLoginResponseLength25;
import com.ifish.socket.model.receive.ServerHeartbeatLength17;
import com.ifish.socket.model.send.APPLoginContextLength25;
import com.ifish.socket.model.send.DeviceLoginContextLength24;
import com.ifish.socket.model.send.ModelVersionLength22;
import com.ifish.socket.model.send.ModelVersionLength38;
@ -113,9 +114,9 @@ public class SomeServer {
//推送类型
Integer warnType = receive.getWarn_type() & 0xff;
if (warnType == 0) {
pushNotifcation(strSrc, PushTypeEnum.wendu_warn.getValue(), "温度达到" + (float) receive.getWendu() / 10f + "℃,已低于" + (float) receive.getWarn_wendu() / 10f + "℃,请及时查看!");
pushNotifcation(strSrc, PushTypeEnum.wendu_warn.getValue(), "'s temperature is" + (float) receive.getWendu() / 10f + "℃,lower than" + (float) receive.getWarn_wendu() / 10f + "℃,");
} else if (warnType == 1) {
pushNotifcation(strSrc, PushTypeEnum.wendu_warn.getValue(), "温度达到" + (float) receive.getWendu() / 10f + "℃,已高于" + (float) receive.getWarn_wendu() / 10f + "℃,请及时查看!");
pushNotifcation(strSrc, PushTypeEnum.wendu_warn.getValue(), "'s temperature is" + (float) receive.getWendu() / 10f + "℃,high than" + (float) receive.getWarn_wendu() / 10f + "℃,");
} else {
log.error("error warn_type:{},macAddress:{}", warnType, strSrc);
}
@ -144,8 +145,8 @@ public class SomeServer {
log.warn("save device login error:macAddress:{},error msg:{}", strSrc, e.toString());
}
} //APP登录服务器
else if (message instanceof APPLoginResponseLength26) {
APPLoginResponseLength26 receive = (APPLoginResponseLength26) message;
else if (message instanceof APPLoginContextLength25) {
APPLoginContextLength25 receive = (APPLoginContextLength25) message;
byte[] srcBytes = receive.getSrc();
byte[] destBytes = receive.getDest();
String strDest = ByteUtil.bytesToHexString(receive.getDest());
@ -183,10 +184,10 @@ public class SomeServer {
try {
//查找设备
Tbl_Device device = deviceHelperI.getDeviceByMacAddress(strSrc);
Tbl_Device_Statistics device_Statistics = null;
Tbl_Device_Statistics device_Statistics = deviceHelperI.getDeviceStatisticsByMacAddress(strSrc);
if (device != null) {
//是否升级
if (device_Statistics.getIsUpgrade().equals("1")) {
if (StringUtils.isNotBlank(device_Statistics.getIsUpgrade()) && device_Statistics.getIsUpgrade().equals("1")) {
device_Statistics.setIsUpgrade("0");
device_Statistics.setUpgradeTime(new Date());
//升级版本
@ -197,7 +198,7 @@ public class SomeServer {
//记录参数
device_Statistics.setSdkVersion(String.valueOf(receive.getVersion() & 0xff));
device_Statistics.setSdkTime(IfishUtil.StrToDate(receive.getYear() + "-" + (receive.getMonth() & 0xff) + "-" + (receive.getDay() & 0xff)));
deviceHelperI.update(device);
deviceHelperI.updateDevice_Statistics(device_Statistics);
}
} catch (Exception e) {
log.warn("save device sdk version16 error:macAddress:{},error msg:{}", strSrc, e.toString());
@ -210,10 +211,10 @@ public class SomeServer {
try {
//查找设备
Tbl_Device device = deviceHelperI.getDeviceByMacAddress(strSrc);
Tbl_Device_Statistics device_Statistics = null;
Tbl_Device_Statistics device_Statistics = deviceHelperI.getDeviceStatisticsByMacAddress(strSrc);
if (device != null) {
//是否升级
if (device_Statistics.getIsUpgrade().equals("1")) {
if (StringUtils.isNotBlank(device_Statistics.getIsUpgrade()) && device_Statistics.getIsUpgrade().equals("1")) {
device_Statistics.setIsUpgrade("0");
device_Statistics.setUpgradeTime(new Date());
//升级版本
@ -229,7 +230,7 @@ public class SomeServer {
device_Statistics.setRouterCount(receive.getNumber3());
device_Statistics.setServerCount(receive.getNumber4());
device_Statistics.setServerTryCount(receive.getNumber5());
deviceHelperI.update(device);
deviceHelperI.updateDevice_Statistics(device_Statistics);
}
} catch (Exception e) {
log.warn("save device sdk version17 error:macAddress:{},error msg:{}", strSrc, e.toString());
@ -304,7 +305,7 @@ public class SomeServer {
Integer userId = deviceUser.getUserId();
String showName = deviceUser.getShowName();
String timestamp = IfishUtil.format(new Date());
String msg = "" + title + "你的水族箱" + showName + "" + timestamp + contont;
String msg = "" + title + "Your aquarium " + showName + "" + contont + "at" + timestamp + ", please check it with out delay!";
Tbl_User user = userHelperI.findById(userId);
if (user != null) {
//极光推送