Socket项目

This commit is contained in:
谢洪龙
2017-07-06 18:12:01 +08:00
commit f557cca7cc
60 changed files with 7671 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
target/
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.6-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>
</properties>
</project-shared-configuration>
+227
View File
@@ -0,0 +1,227 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ifish</groupId>
<artifactId>IfishSocketEnglish</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>IfishSocketEnglish</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-tools -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.10</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20170516</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mina/mina-core -->
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
<version>2.0.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.csource</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.25</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/fastdfs-client-java-1.25.jar</systemPath>
</dependency>
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.4.RELEASE</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.8.RELEASE</version>
<type>jar</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jiguang-common</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.6.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.13</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,49 @@
/*
* 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.io.Serializable;
import java.util.Date;
/**
*
* @author Administrator
*/
public class LoginRecord implements Serializable {
private static final long serialVersionUID = -5292867602998823697L;
//ID
private Integer recordId;
//mac地址
private String macAddress;
//登录时间
private Date loginTime;
public Integer getRecordId() {
return recordId;
}
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
public String getMacAddress() {
return macAddress;
}
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
public Date getLoginTime() {
return loginTime;
}
public void setLoginTime(Date loginTime) {
this.loginTime = loginTime;
}
}
@@ -0,0 +1,508 @@
/*
* 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_device)
*
* @author Administrator
*/
@Entity
@Table(name = "tbl_device")
public class Tbl_Device implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = 3405700970095511149L;
/**
* 设备Id
*/
@Id
@Column(name = "device_id", unique = true, nullable = false, length = 10)
private Integer deviceId;
/**
* 服务器IP
*/
@Column(name = "server_ip", nullable = true, length = 50)
private String serverIp;
/**
* 设备IP
*/
@Column(name = "device_ip", nullable = true, length = 50)
private String deviceIp;
/**
* 是否为摄像头:1是,0否
*/
@Column(name = "is_camera", nullable = true, length = 1)
private String isCamera;
/**
* 设备Mac地址
*/
@Column(name = "mac_address", unique = true, nullable = true, length = 50)
private String macAddress;
/**
* 登陆时间
*/
@Column(name = "login_time", nullable = true)
private Date loginTime;
/**
* 是否在黑名单:1不在、0在
*/
@Column(name = "is_blacklist", nullable = true, length = 1)
private String isBlacklist;
/**
* 设备型号
*/
@Column(name = "hardware_type", nullable = true, length = 10)
private String hardwareType;
/**
* 是否推送
*/
@Column(name = "on_off", nullable = true, length = 1)
private String onOff;
/**
* 今天是否提醒:1提醒、0不提醒
*/
@Column(name = "today_remind", nullable = true, length = 1)
private String todayRemind;
/**
* 是否开启换水提醒:1开启、0不开启
*/
@Column(name = "water_remind", nullable = true, length = 1)
private String waterRemind;
/**
* 换水提醒日期
*/
@Column(name = "remind_date", nullable = true)
private Date remindDate;
/**
* 换水周期
*/
@Column(name = "remind_cycle", nullable = true, length = 10)
private Integer remindCycle;
/**
* 电子厂代码
*/
@Column(name = "factory_code", nullable = true, length = 20)
private String factoryCode;
/**
* 鱼缸场代码
*/
@Column(name = "brand_code", nullable = true, length = 20)
private String brandCode;
/**
* 摄像头ID
*/
@Column(name = "camera_id", nullable = true, length = 20)
private String cameraId;
/**
* 创建时间
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 摄像头激活码
*/
@Column(name = "active_code", nullable = true, length = 50)
private String activeCode;
/**
* 摄像头激活时间
*/
@Column(name = "active_time", nullable = true)
private Date activeTime;
/**
* 修改时间
*/
@Column(name = "update_time", nullable = true)
private Date updateTime;
/**
* 获取设备Id
*
* @return 设备Id
*/
public Integer getDeviceId() {
return this.deviceId;
}
/**
* 设置设备Id
*
* @param deviceId 设备Id
*/
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
/**
* 获取服务器IP
*
* @return 服务器IP
*/
public String getServerIp() {
return this.serverIp;
}
/**
* 设置服务器IP
*
* @param serverIp 服务器IP
*/
public void setServerIp(String serverIp) {
this.serverIp = serverIp;
}
/**
* 获取设备IP
*
* @return 设备IP
*/
public String getDeviceIp() {
return this.deviceIp;
}
/**
* 设置设备IP
*
* @param deviceIp 设备IP
*/
public void setDeviceIp(String deviceIp) {
this.deviceIp = deviceIp;
}
/**
* 获取是否为摄像头:1是,0否
*
* @return 是否为摄像头:1是
*/
public String getIsCamera() {
return this.isCamera;
}
/**
* 设置是否为摄像头:1是,0否
*
* @param isCamera 是否为摄像头:1是,0否
*/
public void setIsCamera(String isCamera) {
this.isCamera = isCamera;
}
/**
* 获取设备Mac地址
*
* @return 设备Mac地址
*/
public String getMacAddress() {
return this.macAddress;
}
/**
* 设置设备Mac地址
*
* @param macAddress 设备Mac地址
*/
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
/**
* 获取登陆时间
*
* @return 登陆时间
*/
public Date getLoginTime() {
return this.loginTime;
}
/**
* 设置登陆时间
*
* @param loginTime 登陆时间
*/
public void setLoginTime(Date loginTime) {
this.loginTime = loginTime;
}
/**
* 获取是否在黑名单:1不在、0在
*
* @return 是否在黑名单
*/
public String getIsBlacklist() {
return this.isBlacklist;
}
/**
* 设置是否在黑名单:1不在、0在
*
* @param isBlacklist 是否在黑名单:1不在、0在
*/
public void setIsBlacklist(String isBlacklist) {
this.isBlacklist = isBlacklist;
}
/**
* 获取设备型号
*
* @return 设备型号
*/
public String getHardwareType() {
return this.hardwareType;
}
/**
* 设置设备型号
*
* @param hardwareType 设备型号
*/
public void setHardwareType(String hardwareType) {
this.hardwareType = hardwareType;
}
/**
* 获取是否推送
*
* @return 是否推送
*/
public String getOnOff() {
return this.onOff;
}
/**
* 设置是否推送
*
* @param onOff 是否推送
*/
public void setOnOff(String onOff) {
this.onOff = onOff;
}
/**
* 获取今天是否提醒:1提醒、0不提醒
*
* @return 今天是否提醒
*/
public String getTodayRemind() {
return this.todayRemind;
}
/**
* 设置今天是否提醒:1提醒、0不提醒
*
* @param todayRemind 今天是否提醒:1提醒、0不提醒
*/
public void setTodayRemind(String todayRemind) {
this.todayRemind = todayRemind;
}
/**
* 获取是否开启换水提醒:1开启、0不开启
*
* @return 是否开启换水提醒
*/
public String getWaterRemind() {
return this.waterRemind;
}
/**
* 设置是否开启换水提醒:1开启、0不开启
*
* @param waterRemind 是否开启换水提醒:1开启、0不开启
*/
public void setWaterRemind(String waterRemind) {
this.waterRemind = waterRemind;
}
/**
* 获取换水提醒日期
*
* @return 换水提醒日期
*/
public Date getRemindDate() {
return this.remindDate;
}
/**
* 设置换水提醒日期
*
* @param remindDate 换水提醒日期
*/
public void setRemindDate(Date remindDate) {
this.remindDate = remindDate;
}
/**
* 获取换水周期
*
* @return 换水周期
*/
public Integer getRemindCycle() {
return this.remindCycle;
}
/**
* 设置换水周期
*
* @param remindCycle 换水周期
*/
public void setRemindCycle(Integer remindCycle) {
this.remindCycle = remindCycle;
}
/**
* 获取电子厂代码
*
* @return 电子厂代码
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* 设置电子厂代码
*
* @param factoryCode 电子厂代码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* 获取鱼缸场代码
*
* @return 鱼缸场代码
*/
public String getBrandCode() {
return this.brandCode;
}
/**
* 设置鱼缸场代码
*
* @param brandCode 鱼缸场代码
*/
public void setBrandCode(String brandCode) {
this.brandCode = brandCode;
}
/**
* 获取摄像头ID
*
* @return 摄像头ID
*/
public String getCameraId() {
return this.cameraId;
}
/**
* 设置摄像头ID
*
* @param cameraId 摄像头ID
*/
public void setCameraId(String cameraId) {
this.cameraId = cameraId;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取摄像头激活码
*
* @return 摄像头激活码
*/
public String getActiveCode() {
return this.activeCode;
}
/**
* 设置摄像头激活码
*
* @param activeCode 摄像头激活码
*/
public void setActiveCode(String activeCode) {
this.activeCode = activeCode;
}
/**
* 获取摄像头激活时间
*
* @return 摄像头激活时间
*/
public Date getActiveTime() {
return this.activeTime;
}
/**
* 设置摄像头激活时间
*
* @param activeTime 摄像头激活时间
*/
public void setActiveTime(Date activeTime) {
this.activeTime = activeTime;
}
/**
* 获取修改时间
*
* @return 修改时间
*/
public Date getUpdateTime() {
return this.updateTime;
}
/**
* 设置修改时间
*
* @param updateTime 修改时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
@@ -0,0 +1,630 @@
/*
* 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_device_statistics)
*
* @author bianj
* @version 1.0.0 2017-06-29
*/
@Entity
@Table(name = "tbl_device_statistics")
public class Tbl_Device_Statistics implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = 1215383532220649875L;
/**
* id
*/
@Id
@Column(name = "id", unique = true, nullable = false, length = 10)
private Integer id;
/**
* 设备ID
*/
@Id
@Column(name = "device_id", unique = true, nullable = false, length = 10)
private Integer deviceId;
/**
* 设备MAC地址
*/
@Column(name = "mac_address", nullable = true, length = 50)
private String macAddress;
/**
* 登陆次数
*/
@Column(name = "login_count", nullable = true, length = 11)
private int loginCount;
/**
* 最后登陆时间
*/
@Column(name = "login_time", nullable = true)
private Date loginTime;
/**
* 首次激活时间
*/
@Column(name = "first_activate", nullable = true)
private Date firstActivate;
/**
* 创建时间
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 是否收费
*/
@Column(name = "is_charge", nullable = true, length = 1)
private String isCharge;
/**
* sdk版本
*/
@Column(name = "sdk_version", nullable = true, length = 10)
private String sdkVersion;
/**
* sdk时间
*/
@Column(name = "sdk_time", nullable = true)
private Date sdkTime;
/**
* 分配日期
*/
@Column(name = "create_date", nullable = true)
private Date createDate;
/**
* 是否升级
*/
@Column(name = "is_upgrade", nullable = true, length = 1)
private String isUpgrade;
/**
* 更新版本
*/
@Column(name = "upgrade_version", nullable = true, length = 10)
private String upgradeVersion;
/**
* 更新时间
*/
@Column(name = "upgrade_time", nullable = true)
private Date upgradeTime;
/**
* 授权时间
*/
@Column(name = "authorize_time", nullable = true)
private Date authorizeTime;
/**
* 编号
*/
@Column(name = "create_code", nullable = true, length = 50)
private String createCode;
/**
* MCU启动次数
*/
@Column(name = "mcu_count", nullable = true, length = 10)
private Integer mcuCount;
/**
* 模块启动次数
*/
@Column(name = "module_count", nullable = true, length = 10)
private Integer moduleCount;
/**
* 连接路由器次数
*/
@Column(name = "router_count", nullable = true, length = 10)
private Integer routerCount;
/**
* 成功连接服务器次数
*/
@Column(name = "server_count", nullable = true, length = 10)
private Integer serverCount;
/**
* 尝试连接服务器次数
*/
@Column(name = "server_try_count", nullable = true, length = 10)
private Integer serverTryCount;
/**
* mcu版本
*/
@Column(name = "software_version", nullable = true, length = 10)
private String softwareVersion;
/**
* 硬件型号
*/
@Column(name = "hardware_type", nullable = true, length = 10)
private String hardwareType;
/**
* 电子厂代码
*/
@Column(name = "factory_code", nullable = true, length = 20)
private String factoryCode;
/**
* 鱼缸场代码
*/
@Column(name = "brand_code", nullable = true, length = 20)
private String brandCode;
/**
* 获取id
*
* @return id
*/
public Integer getId() {
return this.id;
}
/**
* 设置id
*
* @param id id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取设备ID
*
* @return 设备ID
*/
public Integer getDeviceId() {
return this.deviceId;
}
/**
* 设置设备ID
*
* @param deviceId 设备ID
*/
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
/**
* 获取设备MAC地址
*
* @return 设备MAC地址
*/
public String getMacAddress() {
return this.macAddress;
}
/**
* 设置设备MAC地址
*
* @param macAddress 设备MAC地址
*/
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
/**
* 获取登陆次数
*
* @return 登陆次数
*/
public Integer getLoginCount() {
return this.loginCount;
}
/**
* 设置登陆次数
*
* @param loginCount 登陆次数
*/
public void setLoginCount(Integer loginCount) {
this.loginCount = loginCount;
}
/**
* 获取最后登陆时间
*
* @return 最后登陆时间
*/
public Date getLoginTime() {
return this.loginTime;
}
/**
* 设置最后登陆时间
*
* @param loginTime 最后登陆时间
*/
public void setLoginTime(Date loginTime) {
this.loginTime = loginTime;
}
/**
* 获取首次激活时间
*
* @return 首次激活时间
*/
public Date getFirstActivate() {
return this.firstActivate;
}
/**
* 设置首次激活时间
*
* @param firstActivate 首次激活时间
*/
public void setFirstActivate(Date firstActivate) {
this.firstActivate = firstActivate;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取是否收费
*
* @return 是否收费
*/
public String getIsCharge() {
return this.isCharge;
}
/**
* 设置是否收费
*
* @param isCharge 是否收费
*/
public void setIsCharge(String isCharge) {
this.isCharge = isCharge;
}
/**
* 获取sdk版本
*
* @return sdk版本
*/
public String getSdkVersion() {
return this.sdkVersion;
}
/**
* 设置sdk版本
*
* @param sdkVersion sdk版本
*/
public void setSdkVersion(String sdkVersion) {
this.sdkVersion = sdkVersion;
}
/**
* 获取sdk时间
*
* @return sdk时间
*/
public Date getSdkTime() {
return this.sdkTime;
}
/**
* 设置sdk时间
*
* @param sdkTime sdk时间
*/
public void setSdkTime(Date sdkTime) {
this.sdkTime = sdkTime;
}
/**
* 获取分配日期
*
* @return 分配日期
*/
public Date getCreateDate() {
return this.createDate;
}
/**
* 设置分配日期
*
* @param createDate 分配日期
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* 获取是否升级
*
* @return 是否升级
*/
public String getIsUpgrade() {
return this.isUpgrade;
}
/**
* 设置是否升级
*
* @param isUpgrade 是否升级
*/
public void setIsUpgrade(String isUpgrade) {
this.isUpgrade = isUpgrade;
}
/**
* 获取更新版本
*
* @return 更新版本
*/
public String getUpgradeVersion() {
return this.upgradeVersion;
}
/**
* 设置更新版本
*
* @param upgradeVersion 更新版本
*/
public void setUpgradeVersion(String upgradeVersion) {
this.upgradeVersion = upgradeVersion;
}
/**
* 获取更新时间
*
* @return 更新时间
*/
public Date getUpgradeTime() {
return this.upgradeTime;
}
/**
* 设置更新时间
*
* @param upgradeTime 更新时间
*/
public void setUpgradeTime(Date upgradeTime) {
this.upgradeTime = upgradeTime;
}
/**
* 获取授权时间
*
* @return 授权时间
*/
public Date getAuthorizeTime() {
return this.authorizeTime;
}
/**
* 设置授权时间
*
* @param authorizeTime 授权时间
*/
public void setAuthorizeTime(Date authorizeTime) {
this.authorizeTime = authorizeTime;
}
/**
* 获取编号
*
* @return 编号
*/
public String getCreateCode() {
return this.createCode;
}
/**
* 设置编号
*
* @param createCode 编号
*/
public void setCreateCode(String createCode) {
this.createCode = createCode;
}
/**
* 获取MCU启动次数
*
* @return MCU启动次数
*/
public Integer getMcuCount() {
return this.mcuCount;
}
/**
* 设置MCU启动次数
*
* @param mcuCount MCU启动次数
*/
public void setMcuCount(Integer mcuCount) {
this.mcuCount = mcuCount;
}
/**
* 获取模块启动次数
*
* @return 模块启动次数
*/
public Integer getModuleCount() {
return this.moduleCount;
}
/**
* 设置模块启动次数
*
* @param moduleCount 模块启动次数
*/
public void setModuleCount(Integer moduleCount) {
this.moduleCount = moduleCount;
}
/**
* 获取连接路由器次数
*
* @return 连接路由器次数
*/
public Integer getRouterCount() {
return this.routerCount;
}
/**
* 设置连接路由器次数
*
* @param routerCount 连接路由器次数
*/
public void setRouterCount(Integer routerCount) {
this.routerCount = routerCount;
}
/**
* 获取成功连接服务器次数
*
* @return 成功连接服务器次数
*/
public Integer getServerCount() {
return this.serverCount;
}
/**
* 设置成功连接服务器次数
*
* @param serverCount 成功连接服务器次数
*/
public void setServerCount(Integer serverCount) {
this.serverCount = serverCount;
}
/**
* 获取尝试连接服务器次数
*
* @return 尝试连接服务器次数
*/
public Integer getServerTryCount() {
return this.serverTryCount;
}
/**
* 设置尝试连接服务器次数
*
* @param serverTryCount 尝试连接服务器次数
*/
public void setServerTryCount(Integer serverTryCount) {
this.serverTryCount = serverTryCount;
}
/**
* 获取mcu版本
*
* @return mcu版本
*/
public String getSoftwareVersion() {
return this.softwareVersion;
}
/**
* 设置mcu版本
*
* @param softwareVersion mcu版本
*/
public void setSoftwareVersion(String softwareVersion) {
this.softwareVersion = softwareVersion;
}
/**
* 获取硬件型号
*
* @return 硬件型号
*/
public String getHardwareType() {
return this.hardwareType;
}
/**
* 设置硬件型号
*
* @param hardwareType 硬件型号
*/
public void setHardwareType(String hardwareType) {
this.hardwareType = hardwareType;
}
/**
* 获取电子厂代码
*
* @return 电子厂代码
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* 设置电子厂代码
*
* @param factoryCode 电子厂代码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* 获取鱼缸场代码
*
* @return 鱼缸场代码
*/
public String getBrandCode() {
return this.brandCode;
}
/**
* 设置鱼缸场代码
*
* @param brandCode 鱼缸场代码
*/
public void setBrandCode(String brandCode) {
this.brandCode = brandCode;
}
}
@@ -0,0 +1,293 @@
/*
* 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_device_user)
*
* @author bianj
* @version 1.0.0 2017-06-27
*/
@Entity
@Table(name = "tbl_device_user")
public class Tbl_Device_User implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = -4018159739383033383L;
/**
* id
*/
@Id
@Column(name = "id", unique = true, nullable = false, length = 10)
private Integer id;
/**
* 用户Id
*/
@Column(name = "user_id", unique = true, nullable = false, length = 10)
private Integer userId;
/**
* 设备Id
*/
@Column(name = "device_id", unique = true, nullable = false, length = 10)
private Integer deviceId;
/**
* 是否主控:1、主控制权,0、被分享者
*/
@Column(name = "is_master", nullable = true, length = 1)
private String isMaster;
/**
* 显示名称
*/
@Column(name = "show_name", nullable = true, length = 50)
private String showName;
/**
* 创建时间
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 修改时间
*/
@Column(name = "update_time", nullable = true)
private Date updateTime;
/**
* 保存的显示图标
*/
@Column(name = "custom_icon_name", nullable = true, length = 100)
private String customIconName;
/**
* 保存的显示名称
*/
@Column(name = "custom_show_name", nullable = true, length = 100)
private String customShowName;
/**
* 是否看护
*/
@Column(name = "is_look", nullable = true, length = 1)
private String isLook;
/**
* 是否直播
*/
@Column(name = "is_live", nullable = true, length = 1)
private String isLive;
/**
* 获取id
*
* @return id
*/
public Integer getId() {
return this.id;
}
/**
* 设置id
*
* @param id id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取用户Id
*
* @return 用户Id
*/
public Integer getUserId() {
return this.userId;
}
/**
* 设置用户Id
*
* @param userId 用户Id
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* 获取设备Id
*
* @return 设备Id
*/
public Integer getDeviceId() {
return this.deviceId;
}
/**
* 设置设备Id
*
* @param deviceId 设备Id
*/
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
/**
* 获取是否主控:1、主控制权,0、被分享者
*
* @return 是否主控:1、主控制权
*/
public String getIsMaster() {
return this.isMaster;
}
/**
* 设置是否主控:1、主控制权,0、被分享者
*
* @param isMaster 是否主控:1、主控制权,0、被分享者
*/
public void setIsMaster(String isMaster) {
this.isMaster = isMaster;
}
/**
* 获取显示名称
*
* @return 显示名称
*/
public String getShowName() {
return this.showName;
}
/**
* 设置显示名称
*
* @param showName 显示名称
*/
public void setShowName(String showName) {
this.showName = showName;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取修改时间
*
* @return 修改时间
*/
public Date getUpdateTime() {
return this.updateTime;
}
/**
* 设置修改时间
*
* @param updateTime 修改时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取保存的显示图标
*
* @return 保存的显示图标
*/
public String getCustomIconName() {
return this.customIconName;
}
/**
* 设置保存的显示图标
*
* @param customIconName 保存的显示图标
*/
public void setCustomIconName(String customIconName) {
this.customIconName = customIconName;
}
/**
* 获取保存的显示名称
*
* @return 保存的显示名称
*/
public String getCustomShowName() {
return this.customShowName;
}
/**
* 设置保存的显示名称
*
* @param customShowName 保存的显示名称
*/
public void setCustomShowName(String customShowName) {
this.customShowName = customShowName;
}
/**
* 获取是否看护
*
* @return 是否看护
*/
public String getIsLook() {
return this.isLook;
}
/**
* 设置是否看护
*
* @param isLook 是否看护
*/
public void setIsLook(String isLook) {
this.isLook = isLook;
}
/**
* 获取是否直播
*
* @return 是否直播
*/
public String getIsLive() {
return this.isLive;
}
/**
* 设置是否直播
*
* @param isLive 是否直播
*/
public void setIsLive(String isLive) {
this.isLive = isLive;
}
}
@@ -0,0 +1,125 @@
/*
* 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_factory_list)
*
* @author bianj
* @version 1.0.0 2017-07-03
*/
@Entity
@Table(name = "tbl_factory_list")
public class Tbl_Factory_List implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = -8290320819344778436L;
/**
* 电子厂代码
*/
@Id
@Column(name = "factory_code", unique = true, nullable = false, length = 20)
private String factoryCode;
/**
* 电子厂名称
*/
@Column(name = "factory_name", nullable = false, length = 20)
private String factoryName;
/**
* 创建时间
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 是否收税:1收、0不收
*/
@Column(name = "is_tax", nullable = true, length = 1)
private String isTax;
/**
* 获取电子厂代码
*
* @return 电子厂代码
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* 设置电子厂代码
*
* @param factoryCode 电子厂代码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* 获取电子厂名称
*
* @return 电子厂名称
*/
public String getFactoryName() {
return this.factoryName;
}
/**
* 设置电子厂名称
*
* @param factoryName 电子厂名称
*/
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取是否收税:1收、0不收
*
* @return 是否收税
*/
public String getIsTax() {
return this.isTax;
}
/**
* 设置是否收税:1收、0不收
*
* @param isTax 是否收税:1收、0不收
*/
public void setIsTax(String isTax) {
this.isTax = isTax;
}
}
@@ -0,0 +1,437 @@
/*
* 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_hardware_type)
*
* @author bianj
* @version 1.0.0 2017-06-27
*/
@Entity
@Table(name = "tbl_hardware_type")
public class Tbl_HardWare_Type implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = 7870932947017585134L;
/**
* 设备型号代码
*/
@Id
@Column(name = "hardware_type", unique = true, nullable = false, length = 10)
private String hardwareType;
/**
* 电子厂代码
*/
@Column(name = "factory_code", nullable = true, length = 20)
private String factoryCode;
/**
* 设备名称
*/
@Column(name = "hardware_name", nullable = false, length = 20)
private String hardwareName;
/**
* 描述
*/
@Column(name = "hardware_desc", nullable = true, length = 100)
private String hardwareDesc;
/**
* 创建时间
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 控制个数
*/
@Column(name = "control_amount", nullable = true, length = 10)
private Integer controlAmount;
/**
* 定时器个数
*/
@Column(name = "timer_amount", nullable = true, length = 10)
private Integer timerAmount;
/**
* 是否自定义图标:1是、0否
*/
@Column(name = "is_custom_icon", nullable = true, length = 1)
private String isCustomIcon;
/**
* 自定义图标根地址
*/
@Column(name = "icon_link", nullable = true, length = 200)
private String iconLink;
/**
* 根地址下图标名称
*/
@Column(name = "all_icon_name", nullable = true, length = 200)
private String allIconName;
/**
* 修改时间
*/
@Column(name = "update_time", nullable = true)
private Date updateTime;
/**
* 是否有背光:1是、0否
*/
@Column(name = "is_lightness", nullable = true, length = 1)
private String isLightness;
/**
* 是否有柜灯:1是、0否
*/
@Column(name = "is_sark_lamp", nullable = true, length = 1)
private String isSarkLamp;
/**
* 是否有工作模式:1是、0否
*/
@Column(name = "is_work_model", nullable = true, length = 1)
private String isWorkModel;
/**
* 显示名称
*/
@Column(name = "all_show_name", nullable = true, length = 200)
private String allShowName;
/**
* 默认名称
*/
@Column(name = "default_show_name", nullable = true, length = 200)
private String defaultShowName;
/**
* 默认图标
*/
@Column(name = "default_icon_name", nullable = true, length = 200)
private String defaultIconName;
/**
* 获取设备型号代码
*
* @return 设备型号代码
*/
public String getHardwareType() {
return this.hardwareType;
}
/**
* 设置设备型号代码
*
* @param hardwareType 设备型号代码
*/
public void setHardwareType(String hardwareType) {
this.hardwareType = hardwareType;
}
/**
* 获取电子厂代码
*
* @return 电子厂代码
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* 设置电子厂代码
*
* @param factoryCode 电子厂代码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* 获取设备名称
*
* @return 设备名称
*/
public String getHardwareName() {
return this.hardwareName;
}
/**
* 设置设备名称
*
* @param hardwareName 设备名称
*/
public void setHardwareName(String hardwareName) {
this.hardwareName = hardwareName;
}
/**
* 获取描述
*
* @return 描述
*/
public String getHardwareDesc() {
return this.hardwareDesc;
}
/**
* 设置描述
*
* @param hardwareDesc 描述
*/
public void setHardwareDesc(String hardwareDesc) {
this.hardwareDesc = hardwareDesc;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取控制个数
*
* @return 控制个数
*/
public Integer getControlAmount() {
return this.controlAmount;
}
/**
* 设置控制个数
*
* @param controlAmount 控制个数
*/
public void setControlAmount(Integer controlAmount) {
this.controlAmount = controlAmount;
}
/**
* 获取定时器个数
*
* @return 定时器个数
*/
public Integer getTimerAmount() {
return this.timerAmount;
}
/**
* 设置定时器个数
*
* @param timerAmount 定时器个数
*/
public void setTimerAmount(Integer timerAmount) {
this.timerAmount = timerAmount;
}
/**
* 获取是否自定义图标:1是、0否
*
* @return 是否自定义图标
*/
public String getIsCustomIcon() {
return this.isCustomIcon;
}
/**
* 设置是否自定义图标:1是、0否
*
* @param isCustomIcon 是否自定义图标:1是、0否
*/
public void setIsCustomIcon(String isCustomIcon) {
this.isCustomIcon = isCustomIcon;
}
/**
* 获取自定义图标根地址
*
* @return 自定义图标根地址
*/
public String getIconLink() {
return this.iconLink;
}
/**
* 设置自定义图标根地址
*
* @param iconLink 自定义图标根地址
*/
public void setIconLink(String iconLink) {
this.iconLink = iconLink;
}
/**
* 获取根地址下图标名称
*
* @return 根地址下图标名称
*/
public String getAllIconName() {
return this.allIconName;
}
/**
* 设置根地址下图标名称
*
* @param allIconName 根地址下图标名称
*/
public void setAllIconName(String allIconName) {
this.allIconName = allIconName;
}
/**
* 获取修改时间
*
* @return 修改时间
*/
public Date getUpdateTime() {
return this.updateTime;
}
/**
* 设置修改时间
*
* @param updateTime 修改时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取是否有背光:1是、0否
*
* @return 是否有背光
*/
public String getIsLightness() {
return this.isLightness;
}
/**
* 设置是否有背光:1是、0否
*
* @param isLightness 是否有背光:1是、0否
*/
public void setIsLightness(String isLightness) {
this.isLightness = isLightness;
}
/**
* 获取是否有柜灯:1是、0否
*
* @return 是否有柜灯
*/
public String getIsSarkLamp() {
return this.isSarkLamp;
}
/**
* 设置是否有柜灯:1是、0否
*
* @param isSarkLamp 是否有柜灯:1是、0否
*/
public void setIsSarkLamp(String isSarkLamp) {
this.isSarkLamp = isSarkLamp;
}
/**
* 获取是否有工作模式:1是、0否
*
* @return 是否有工作模式
*/
public String getIsWorkModel() {
return this.isWorkModel;
}
/**
* 设置是否有工作模式:1是、0否
*
* @param isWorkModel 是否有工作模式:1是、0否
*/
public void setIsWorkModel(String isWorkModel) {
this.isWorkModel = isWorkModel;
}
/**
* 获取显示名称
*
* @return 显示名称
*/
public String getAllShowName() {
return this.allShowName;
}
/**
* 设置显示名称
*
* @param allShowName 显示名称
*/
public void setAllShowName(String allShowName) {
this.allShowName = allShowName;
}
/**
* 获取默认名称
*
* @return 默认名称
*/
public String getDefaultShowName() {
return this.defaultShowName;
}
/**
* 设置默认名称
*
* @param defaultShowName 默认名称
*/
public void setDefaultShowName(String defaultShowName) {
this.defaultShowName = defaultShowName;
}
/**
* 获取默认图标
*
* @return 默认图标
*/
public String getDefaultIconName() {
return this.defaultIconName;
}
/**
* 设置默认图标
*
* @param defaultIconName 默认图标
*/
public void setDefaultIconName(String defaultIconName) {
this.defaultIconName = defaultIconName;
}
}
@@ -0,0 +1,465 @@
/*
* 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_push_list)
*
* @author bianj
* @version 1.0.0 2017-07-03
*/
@Entity
@Table(name = "tbl_push_list")
public class Tbl_Push_List implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = -7760764975977010045L;
/**
* ID
*/
@Id
@Column(name = "push_id", unique = true, nullable = false, length = 10)
private Integer pushId;
/**
* 用户Id
*/
@Column(name = "user_id", nullable = true, length = 10)
private Integer userId;
/**
* 设备Id
*/
@Column(name = "device_id", nullable = true, length = 10)
private Integer deviceId;
/**
* 显示名称
*/
@Column(name = "show_name", nullable = true, length = 20)
private String showName;
/**
* 推送手机类型
*/
@Column(name = "phone_type", nullable = true, length = 20)
private String phoneType;
/**
* 推送消息类型
* 1."remove_device","解绑通知";2."wendu_warn","温度预警;3."qu_reply","问题反馈";4."app_update","IOS更新推送";5."remind_water","换水提醒";6."offline_push","离线通知";7."send_report","看护报告";8."shops_push","看护通知";9."all_push","所有用户推送"
*/
@Column(name = "push_type", nullable = true, length = 20)
private String pushType;
/**
* 推送标题
*/
@Column(name = "push_title", nullable = true, length = 100)
private String pushTitle;
/**
* 推送内容
*/
@Column(name = "push_context", nullable = true, length = 200)
private String pushContext;
/**
* 创建时间
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 链接
*/
@Column(name = "push_link", nullable = false, length = 100)
private String pushLink;
/**
* 极光推送状态
*/
@Column(name = "jpush_status", nullable = true, length = 1)
private String jpushStatus;
/**
* 谷歌推送状态
*/
@Column(name = "google_status", nullable = true, length = 1)
private String googleStatus;
/**
* 看护报告Id
*/
@Column(name = "report_id", nullable = true, length = 10)
private Integer reportId;
/**
* MCU启动次数
*/
@Column(name = "mcu_count", nullable = true, length = 10)
private Integer mcuCount;
/**
* 模块启动次数
*/
@Column(name = "modular_count", nullable = true, length = 10)
private Integer modularCount;
/**
* 连接路由器次数
*/
@Column(name = "router_count", nullable = true, length = 10)
private Integer routerCount;
/**
* 成功连接服务器次数
*/
@Column(name = "server_count", nullable = true, length = 10)
private Integer serverCount;
/**
* 尝试连接服务器次数
*/
@Column(name = "server_try_count", nullable = true, length = 10)
private Integer serverTryCount;
/**
* 获取ID
*
* @return ID
*/
public Integer getPushId() {
return this.pushId;
}
/**
* 设置ID
*
* @param pushId ID
*/
public void setPushId(Integer pushId) {
this.pushId = pushId;
}
/**
* 获取用户Id
*
* @return 用户Id
*/
public Integer getUserId() {
return this.userId;
}
/**
* 设置用户Id
*
* @param userId 用户Id
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* 获取设备Id
*
* @return 设备Id
*/
public Integer getDeviceId() {
return this.deviceId;
}
/**
* 设置设备Id
*
* @param deviceId 设备Id
*/
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
/**
* 获取显示名称
*
* @return 显示名称
*/
public String getShowName() {
return this.showName;
}
/**
* 设置显示名称
*
* @param showName 显示名称
*/
public void setShowName(String showName) {
this.showName = showName;
}
/**
* 获取推送手机类型
*
* @return 推送手机类型
*/
public String getPhoneType() {
return this.phoneType;
}
/**
* 设置推送手机类型
*
* @param phoneType 推送手机类型
*/
public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
}
/**
* 获取推送消息类型
* 1."remove_device","解绑通知";2."wendu_warn","温度预警;3."qu_reply","问题反馈";4."app_update","IOS更新推送";5."remind_water","换水提醒";6."offline_push","离线通知";7."send_report","看护报告";8."shops_push","看护通知";9."all_push","所有用户推送"
*
* @return 推送消息类型 1."remove_device"
*/
public String getPushType() {
return this.pushType;
}
/**
* 设置推送消息类型
* 1."remove_device","解绑通知";2."wendu_warn","温度预警;3."qu_reply","问题反馈";4."app_update","IOS更新推送";5."remind_water","换水提醒";6."offline_push","离线通知";7."send_report","看护报告";8."shops_push","看护通知";9."all_push","所有用户推送"
*
* @param pushType 推送消息类型
* 1."remove_device","解绑通知";2."wendu_warn","温度预警;3."qu_reply","问题反馈";4."app_update","IOS更新推送";5."remind_water","换水提醒";6."offline_push","离线通知";7."send_report","看护报告";8."shops_push","看护通知";9."all_push","所有用户推送"
*/
public void setPushType(String pushType) {
this.pushType = pushType;
}
/**
* 获取推送标题
*
* @return 推送标题
*/
public String getPushTitle() {
return this.pushTitle;
}
/**
* 设置推送标题
*
* @param pushTitle 推送标题
*/
public void setPushTitle(String pushTitle) {
this.pushTitle = pushTitle;
}
/**
* 获取推送内容
*
* @return 推送内容
*/
public String getPushContext() {
return this.pushContext;
}
/**
* 设置推送内容
*
* @param pushContext 推送内容
*/
public void setPushContext(String pushContext) {
this.pushContext = pushContext;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取链接
*
* @return 链接
*/
public String getPushLink() {
return this.pushLink;
}
/**
* 设置链接
*
* @param pushLink 链接
*/
public void setPushLink(String pushLink) {
this.pushLink = pushLink;
}
/**
* 获取极光推送状态
*
* @return 极光推送状态
*/
public String getJpushStatus() {
return this.jpushStatus;
}
/**
* 设置极光推送状态
*
* @param jpushStatus 极光推送状态
*/
public void setJpushStatus(String jpushStatus) {
this.jpushStatus = jpushStatus;
}
/**
* 获取谷歌推送状态
*
* @return 谷歌推送状态
*/
public String getGoogleStatus() {
return this.googleStatus;
}
/**
* 设置谷歌推送状态
*
* @param googleStatus 谷歌推送状态
*/
public void setGoogleStatus(String googleStatus) {
this.googleStatus = googleStatus;
}
/**
* 获取看护报告Id
*
* @return 看护报告Id
*/
public Integer getReportId() {
return this.reportId;
}
/**
* 设置看护报告Id
*
* @param reportId 看护报告Id
*/
public void setReportId(Integer reportId) {
this.reportId = reportId;
}
/**
* 获取MCU启动次数
*
* @return MCU启动次数
*/
public Integer getMcuCount() {
return this.mcuCount;
}
/**
* 设置MCU启动次数
*
* @param mcuCount MCU启动次数
*/
public void setMcuCount(Integer mcuCount) {
this.mcuCount = mcuCount;
}
/**
* 获取模块启动次数
*
* @return 模块启动次数
*/
public Integer getModularCount() {
return this.modularCount;
}
/**
* 设置模块启动次数
*
* @param modularCount 模块启动次数
*/
public void setModularCount(Integer modularCount) {
this.modularCount = modularCount;
}
/**
* 获取连接路由器次数
*
* @return 连接路由器次数
*/
public Integer getRouterCount() {
return this.routerCount;
}
/**
* 设置连接路由器次数
*
* @param routerCount 连接路由器次数
*/
public void setRouterCount(Integer routerCount) {
this.routerCount = routerCount;
}
/**
* 获取成功连接服务器次数
*
* @return 成功连接服务器次数
*/
public Integer getServerCount() {
return this.serverCount;
}
/**
* 设置成功连接服务器次数
*
* @param serverCount 成功连接服务器次数
*/
public void setServerCount(Integer serverCount) {
this.serverCount = serverCount;
}
/**
* 获取尝试连接服务器次数
*
* @return 尝试连接服务器次数
*/
public Integer getServerTryCount() {
return this.serverTryCount;
}
/**
* 设置尝试连接服务器次数
*
* @param serverTryCount 尝试连接服务器次数
*/
public void setServerTryCount(Integer serverTryCount) {
this.serverTryCount = serverTryCount;
}
}
+557
View File
@@ -0,0 +1,557 @@
/*
* 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_user)
*
* @author bianj
* @version 1.0.0 2017-06-28
*/
@Entity
@Table(name = "tbl_user")
public class Tbl_User implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = -3293426131332327827L;
/**
* 用户Id
*/
@Id
@Column(name = "user_id", unique = true, nullable = false, length = 10)
private Integer userId;
/**
* 昵称
*/
@Column(name = "nick_name", nullable = true, length = 20)
private String nickName;
/**
* 密码
*/
@Column(name = "user_password", nullable = true, length = 32)
private String userPassword;
/**
* 手机
*/
@Column(name = "phone_number", unique = true, nullable = true, length = 11)
private String phoneNumber;
/**
* 邮箱
*/
@Column(name = "user_email", unique = true, nullable = true, length = 50)
private String userEmail;
/**
* 用户类型
*/
@Column(name = "user_type", nullable = false, length = 1)
private String userType;
/**
* 头像
*/
@Column(name = "user_img", nullable = true, length = 100)
private String userImg;
/**
* 性别
*/
@Column(name = "user_sex", nullable = true, length = 1)
private String userSex;
/**
* 登陆次数
*/
@Column(name = "login_count", nullable = true, length = 10)
private Integer loginCount;
/**
* 修改时间
*/
@Column(name = "update_time", nullable = true)
private Date updateTime;
/**
* 登陆时间
*/
@Column(name = "login_time", nullable = true)
private Date loginTime;
/**
* 注册时间
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 登陆手机类型
*/
@Column(name = "login_type", nullable = true, length = 10)
private String loginType;
/**
* 备注
*/
@Column(name = "remarks", nullable = true, length = 100)
private String remarks;
/**
* 地址
*/
@Column(name = "address", nullable = true, length = 200)
private String address;
/**
* 技威Code1
*/
@Column(name = "p2pverify_code1", nullable = true, length = 50)
private String p2pverifyCode1;
/**
* 技威Code2
*/
@Column(name = "p2pverify_code2", nullable = true, length = 50)
private String p2pverifyCode2;
/**
* 技威用户ID
*/
@Column(name = "gwell_userid", nullable = true, length = 50)
private String gwellUserid;
/**
* 是否注册技威:1已注册、0未注册
*/
@Column(name = "is_register_gwell", nullable = true, length = 1)
private String isRegisterGwell;
/**
* 极光用户ID
*/
@Column(name = "jiguang_userid", nullable = true, length = 50)
private String jiguangUserid;
/**
* 经度
*/
@Column(name = "longitude", nullable = true)
private Double longitude;
/**
* 纬度
*/
@Column(name = "latitude", nullable = true)
private Double latitude;
/**
* 获取用户Id
*
* @return 用户Id
*/
public Integer getUserId() {
return this.userId;
}
/**
* 设置用户Id
*
* @param userId 用户Id
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* 获取昵称
*
* @return 昵称
*/
public String getNickName() {
return this.nickName;
}
/**
* 设置昵称
*
* @param nickName 昵称
*/
public void setNickName(String nickName) {
this.nickName = nickName;
}
/**
* 获取密码
*
* @return 密码
*/
public String getUserPassword() {
return this.userPassword;
}
/**
* 设置密码
*
* @param userPassword 密码
*/
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
/**
* 获取手机
*
* @return 手机
*/
public String getPhoneNumber() {
return this.phoneNumber;
}
/**
* 设置手机
*
* @param phoneNumber 手机
*/
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
/**
* 获取邮箱
*
* @return 邮箱
*/
public String getUserEmail() {
return this.userEmail;
}
/**
* 设置邮箱
*
* @param userEmail 邮箱
*/
public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}
/**
* 获取用户类型
*
* @return 用户类型
*/
public String getUserType() {
return this.userType;
}
/**
* 设置用户类型
*
* @param userType 用户类型
*/
public void setUserType(String userType) {
this.userType = userType;
}
/**
* 获取头像
*
* @return 头像
*/
public String getUserImg() {
return this.userImg;
}
/**
* 设置头像
*
* @param userImg 头像
*/
public void setUserImg(String userImg) {
this.userImg = userImg;
}
/**
* 获取性别
*
* @return 性别
*/
public String getUserSex() {
return this.userSex;
}
/**
* 设置性别
*
* @param userSex 性别
*/
public void setUserSex(String userSex) {
this.userSex = userSex;
}
/**
* 获取登陆次数
*
* @return 登陆次数
*/
public Integer getLoginCount() {
return this.loginCount;
}
/**
* 设置登陆次数
*
* @param loginCount 登陆次数
*/
public void setLoginCount(Integer loginCount) {
this.loginCount = loginCount;
}
/**
* 获取修改时间
*
* @return 修改时间
*/
public Date getUpdateTime() {
return this.updateTime;
}
/**
* 设置修改时间
*
* @param updateTime 修改时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取登陆时间
*
* @return 登陆时间
*/
public Date getLoginTime() {
return this.loginTime;
}
/**
* 设置登陆时间
*
* @param loginTime 登陆时间
*/
public void setLoginTime(Date loginTime) {
this.loginTime = loginTime;
}
/**
* 获取注册时间
*
* @return 注册时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置注册时间
*
* @param createTime 注册时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取登陆手机类型
*
* @return 登陆手机类型
*/
public String getLoginType() {
return this.loginType;
}
/**
* 设置登陆手机类型
*
* @param loginType 登陆手机类型
*/
public void setLoginType(String loginType) {
this.loginType = loginType;
}
/**
* 获取备注
*
* @return 备注
*/
public String getRemarks() {
return this.remarks;
}
/**
* 设置备注
*
* @param remarks 备注
*/
public void setRemarks(String remarks) {
this.remarks = remarks;
}
/**
* 获取地址
*
* @return 地址
*/
public String getAddress() {
return this.address;
}
/**
* 设置地址
*
* @param address 地址
*/
public void setAddress(String address) {
this.address = address;
}
/**
* 获取技威Code1
*
* @return 技威Code1
*/
public String getP2pverifyCode1() {
return this.p2pverifyCode1;
}
/**
* 设置技威Code1
*
* @param p2pverifyCode1 技威Code1
*/
public void setP2pverifyCode1(String p2pverifyCode1) {
this.p2pverifyCode1 = p2pverifyCode1;
}
/**
* 获取技威Code2
*
* @return 技威Code2
*/
public String getP2pverifyCode2() {
return this.p2pverifyCode2;
}
/**
* 设置技威Code2
*
* @param p2pverifyCode2 技威Code2
*/
public void setP2pverifyCode2(String p2pverifyCode2) {
this.p2pverifyCode2 = p2pverifyCode2;
}
/**
* 获取技威用户ID
*
* @return 技威用户ID
*/
public String getGwellUserid() {
return this.gwellUserid;
}
/**
* 设置技威用户ID
*
* @param gwellUserid 技威用户ID
*/
public void setGwellUserid(String gwellUserid) {
this.gwellUserid = gwellUserid;
}
/**
* 获取是否注册技威:1已注册、0未注册
*
* @return 是否注册技威
*/
public String getIsRegisterGwell() {
return this.isRegisterGwell;
}
/**
* 设置是否注册技威:1已注册、0未注册
*
* @param isRegisterGwell 是否注册技威:1已注册、0未注册
*/
public void setIsRegisterGwell(String isRegisterGwell) {
this.isRegisterGwell = isRegisterGwell;
}
/**
* 获取极光用户ID
*
* @return 极光用户ID
*/
public String getJiguangUserid() {
return this.jiguangUserid;
}
/**
* 设置极光用户ID
*
* @param jiguangUserid 极光用户ID
*/
public void setJiguangUserid(String jiguangUserid) {
this.jiguangUserid = jiguangUserid;
}
/**
* 获取经度
*
* @return 经度
*/
public Double getLongitude() {
return this.longitude;
}
/**
* 设置经度
*
* @param longitude 经度
*/
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
/**
* 获取纬度
*
* @return 纬度
*/
public Double getLatitude() {
return this.latitude;
}
/**
* 设置纬度
*
* @param latitude 纬度
*/
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
}
@@ -0,0 +1,139 @@
/*
* 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.config;
import com.ifish.socket.codeFactory.ServerCodecFactory;
import com.ifish.socket.config.JobFactory;
import com.ifish.socket.config.MinaServerHandler;
import com.ifish.socket.config.MyInetSocketAddress;
import com.ifish.socket.config.ScheduleJob;
import com.ifish.socket.config.SomeServer;
import com.ifish.socket.webService.ServiceBean;
import com.ifish.util.IfishFilePath;
import java.util.HashMap;
import java.util.Map;
import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.springframework.context.annotation.Bean;
/**
*
* @author Administrator
*/
public class MinaConfig {
/**
* webService
*
* @return
*/
@Bean
public ServiceBean serviceBean() {
return new ServiceBean();
}
/**
* 消息处理类
*
* @return
*/
@Bean
public SomeServer someServer() {
return new SomeServer();
}
/**
* 实现job中注入bean
*
* @return
*/
@Bean
public JobFactory jobFactory() {
return new JobFactory();
}
/**
* 调度任务
*
* @return
*/
@Bean
public ScheduleJob scheduleJob() {
return new ScheduleJob();
}
/**
* 自定义的serverHandler
*
* @return
*/
@Bean
public MinaServerHandler serverHandler() {
return new MinaServerHandler();
}
/**
* 指定服务端地址和端口
*
* @return
*/
@Bean
public MyInetSocketAddress address() {
MyInetSocketAddress myInetSocketAddress = new MyInetSocketAddress(IfishFilePath.ifiship, IfishFilePath.ifishport);
return myInetSocketAddress;
}
/**
* 编码filter
*
* @return
*/
@Bean
public ProtocolCodecFilter codecFilter() {
return new ProtocolCodecFilter(new ServerCodecFactory());
}
/**
* 日志filter
*
* @return
*/
@Bean
public LoggingFilter loggingFilter() {
return new LoggingFilter();
}
/**
* 过滤器链
*
* @return
*/
@Bean
public DefaultIoFilterChainBuilder filterChainBuilder() {
DefaultIoFilterChainBuilder defaultIoFilterChainBuilder = new DefaultIoFilterChainBuilder();
Map map = new HashMap();
map.put("codecFilter", codecFilter());
defaultIoFilterChainBuilder.setFilters(map);
return defaultIoFilterChainBuilder;
}
/**
* 开始运行socket服务
* @return
*/
@Bean(initMethod = "bind", destroyMethod = "unbind")
public NioSocketAcceptor ioAcceptor() {
NioSocketAcceptor nioSocketAcceptor = new NioSocketAcceptor();
nioSocketAcceptor.setHandler(serverHandler());
nioSocketAcceptor.setDefaultLocalAddress(address().getSocketAddress());
nioSocketAcceptor.setFilterChainBuilder(filterChainBuilder());
nioSocketAcceptor.setReuseAddress(true);
nioSocketAcceptor.getSessionConfig().setBothIdleTime(0);
return nioSocketAcceptor;
}
}
@@ -0,0 +1,14 @@
/*
* 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.config;
/**
*
* @author Administrator
*/
public class MyWSServletContextListener {
}
@@ -0,0 +1,86 @@
/*
* 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.config;
import javax.sql.DataSource;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
*
* @author Administrator
*/
@Configuration
@EnableTransactionManagement
public class MybatisConfig {
@Bean
public DataSource dataSource() {
// try {
// ComboPooledDataSource datasourc = new ComboPooledDataSource();
// datasourc.setDriverClass(JdbcProperties.driverClassName);
// datasourc.setJdbcUrl(JdbcProperties.url);
// datasourc.setUser(JdbcProperties.username);
// datasourc.setPassword(JdbcProperties.password);
// datasourc.setAutoCommitOnClose(JdbcProperties.autoCommitOnClose);
// datasourc.setInitialPoolSize(JdbcProperties.initialPoolSize);
// datasourc.setMinPoolSize(JdbcProperties.minPoolSize);
// datasourc.setMaxPoolSize(JdbcProperties.maxPoolSize);
// datasourc.setAcquireIncrement(JdbcProperties.acquireIncrement);
// datasourc.setCheckoutTimeout(JdbcProperties.checkoutTimeout);
// datasourc.setMaxIdleTime(JdbcProperties.maxIdleTime);
// datasourc.setIdleConnectionTestPeriod(JdbcProperties.idleConnectionTestPeriod);
// return datasourc;
// } catch (Exception e) {
//
// }
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
//线上生产数据库连接
dataSource.setUsername("ifish");
dataSource.setPassword("ifish7pwd");
dataSource.setUrl("jdbc:mysql://localhost:3306/myfishdbenglish?characterEncoding=UTF-8");
return dataSource;
}
@Bean(name = "sqlSessionFactory")
public SqlSessionFactoryBean sqlSessionFactory() {
SqlSessionFactoryBean ssfb = new SqlSessionFactoryBean();
ssfb.setDataSource(dataSource());
ssfb.setTypeAliasesPackage("com.ifish.bean");
try {
org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
configuration.setMapUnderscoreToCamelCase(true);
ssfb.setConfiguration(configuration);
} catch (Exception e) {
}
return ssfb;
}
@Bean
public MapperScannerConfigurer mpperScannnerConfigurer() {
MapperScannerConfigurer msc = new MapperScannerConfigurer();
msc.setSqlSessionFactoryBeanName("sqlSessionFactory");
msc.setBasePackage("com.ifish.mapper");
return msc;
}
@Bean
PlatformTransactionManager transactionManager() {
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
transactionManager.setDataSource(dataSource());
return transactionManager;
}
}
@@ -0,0 +1,58 @@
/*
* 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.config;
import com.ifish.util.IfishFilePath;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
*
* @author Administrator
*/
@Configuration
public class RedisConfig {
@Bean
public RedisConnectionFactory redisCF() {
JedisConnectionFactory cf = new JedisConnectionFactory();
// //获取当前操作系统(servers_os为服务器设置的属性JAVA_OPTS=%JAVA_OPTS% -Dservers_os=online84)
// String servers_os = System.getProperty("servers_os") == null ? "" : System.getProperty("servers_os");
if (IfishFilePath.link_img_head.contains("ifish7")) {
//站点线上服务器
cf.setHostName("120.55.190.56");
cf.setPort(3796);
cf.setPassword("ifish7myredis");
} else {
//站点测试服务器
cf.setHostName("139.196.24.156");
cf.setPort(3796);
cf.setPassword("ifish7myredis");
// FileUtil.writeLinesByLog("测试缓存连接");
}
return cf;
}
@Bean
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory cf) {
RedisTemplate<String, String> redis = new RedisTemplate<String, String>();
redis.setConnectionFactory(cf);
return redis;
}
@Bean
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory cf) {
StringRedisTemplate redis = new StringRedisTemplate();
redis.setConnectionFactory(cf);
return redis;
}
}
@@ -0,0 +1,26 @@
/*
* 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.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/**
*
* @author Administrator
*/
@Configuration
//@Import(MybatisConfig.class) //导入数据库文件配置
@ComponentScan(basePackages = {"com.ifish.*"},
excludeFilters = {
@Filter(type = FilterType.ANNOTATION, value = EnableWebMvc.class)})
public class RootConfig {
}
@@ -0,0 +1,46 @@
/*
* 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.config;
import javax.servlet.Filter;
import org.springframework.context.annotation.Bean;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
/**
*
* @author Administrator
*/
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[]{RootConfig.class, MybatisConfig.class,MinaConfig.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[]{WebConfig.class};
}
@Override
protected String[] getServletMappings() {
return new String[]{"/api/*"};
}
@Override
protected Filter[] getServletFilters() {
return null;
}
@Bean
public Filter characterEncodingFilter() {
CharacterEncodingFilter filter = new CharacterEncodingFilter();
filter.setEncoding("UTF-8");
filter.setForceEncoding(true);
return filter;
}
}
@@ -0,0 +1,59 @@
/*
* 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.config;
import com.ifish.util.IfishFilePath;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
/**
*
* @author Administrator
*/
@Configuration
/**
* 启动SpringMVC
*/
@EnableWebMvc
/**
* 启动组件扫描器,com.mymvc.controller是包
*/
@ComponentScan("com.ifish.controller")
public class WebConfig extends WebMvcConfigurerAdapter {
/**
* 配置视图解析器
*
* @return
*/
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
resolver.setExposeContextBeansAsAttributes(true);
return resolver;
}
/**
* 配置静态资源的处理
*
* @param configurer
*/
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();;
}
}
@@ -0,0 +1,33 @@
package com.ifish.enums;
public enum PushTypeEnum {
remove_device("remove_device","解绑通知"),
wendu_warn("wendu_warn","温度报警"),
qu_reply("qu_reply","问题反馈"),
app_update("app_update","IOS更新推送"),
remind_water("remind_water","换水提醒"),
offline_push("offline_push","离线通知");
private PushTypeEnum(String key,String value){
this.key = key;
this.value = value;
}
private String key;
private String value;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -0,0 +1,45 @@
/*
* 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 SubDirectoryEnum {
headImage("app/", "头像"),
banner("banner/", "banner图"),
look("look/", "看护报告"),
ueditorHtml("ueditorHtml/", "后台生成的网页"),
adInfo("Img/adInfo/", "广告图片"),
information("Img/information/", "资讯图片"),
ifishGoods("Img/goods/", "商品图片"),
ifishCommodity("Img/commodity/", "商家商品介绍图");
private SubDirectoryEnum(String key, String value) {
this.key = key;
this.value = value;
}
private String key;
private String value;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -0,0 +1,41 @@
/*
* 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.LoginRecord;
import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_User;
import com.ifish.bean.Tbl_Factory_List;
import com.ifish.bean.Tbl_HardWare_Type;
import com.ifish.socket.model.send.DeviceLoginContextLength24;
import java.util.List;
/**
*
* @author Administrator
*/
public interface DeviceHelperI {
public Tbl_Device update(Tbl_Device device);
public Tbl_Device update(DeviceLoginContextLength24 model);
public void updateWarnOnoff(String macAddress, String onOff);
public Tbl_Device getUniqueByProperty(String property, Object value);
public List<Tbl_Device> getByProperty(String property, Object value);
public Tbl_Device_User getUniqueByProperty(String macAddress);
public List<Tbl_Device_User> getListByProperty(Integer deviceId);
public LoginRecord save(LoginRecord loginRecord);
public Tbl_Factory_List getFactoryListById(String factoryCode);
public Tbl_HardWare_Type getHardwareTypeById(String typeCode);
}
@@ -0,0 +1,20 @@
/*
* 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_Push_List;
import com.ifish.bean.Tbl_User;
/**
*
* @author Administrator
*/
public interface UserHelperI {
public Tbl_User findById(Integer userId);
public Tbl_Push_List save(Tbl_Push_List pushList);
}
@@ -0,0 +1,58 @@
/*
* 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.socket.codeFactory;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import org.apache.mina.core.buffer.IoBuffer;
/**
*
* @author Administrator
*/
public class Context {
private final CharsetDecoder decoder;
private IoBuffer buf;
private int matchCount = 0;
private int overflowPosition = 0;
public Context(Charset charset) {
decoder = charset.newDecoder();
buf = IoBuffer.allocate(100).setAutoExpand(true);
//buf.order(ByteOrder.LITTLE_ENDIAN);
}
public CharsetDecoder getDecoder() {
return decoder;
}
public IoBuffer getBuffer() {
return buf;
}
public int getOverflowPosition() {
return overflowPosition;
}
public int getMatchCount() {
return matchCount;
}
public void setMatchCount(int matchCount) {
this.matchCount = matchCount;
}
public void reset() {
overflowPosition = 0;
matchCount = 0;
decoder.reset();
}
public void append(IoBuffer in) {
getBuffer().put(in);
}
}
@@ -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.socket.codeFactory;
import java.nio.charset.Charset;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;
/**
*
* @author Administrator
*/
public class ServerCodecFactory implements ProtocolCodecFactory {
private static final Charset charset = Charset.forName("UTF-8");
@Override
public ProtocolDecoder getDecoder(IoSession session) throws Exception {
return new ServerDecode(charset);
}
@Override
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return new ServerEncode(charset);
}
}
@@ -0,0 +1,385 @@
/*
* 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.socket.codeFactory;
import com.ifish.socket.model.send.DeviceLoginContextLength24;
import com.ifish.socket.model.send.APPLoginContextLength25;
import com.ifish.socket.model.send.ModelVersionLength22;
import com.ifish.socket.model.send.ModelVersionLength38;
import com.ifish.socket.model.send.TemperatureAlarmLength22;
import com.ifish.socket.model.send.TemperatureSwitchLength22;
import java.nio.charset.Charset;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.AttributeKey;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 解码
*
* @author
*/
public class ServerDecode implements ProtocolDecoder {
private final AttributeKey CONTEXT = new AttributeKey(getClass(), "context");
private final Charset charset;
private static Logger log = LoggerFactory.getLogger(ServerDecode.class);
public ServerDecode() {
this(Charset.defaultCharset());
}
public ServerDecode(Charset charset) {
this.charset = charset;
}
private Context getContext(IoSession session) {
Context ctx = (Context) session.getAttribute(CONTEXT);
if (ctx == null) {
ctx = new Context(charset);
session.setAttribute(CONTEXT, ctx);
}
return ctx;
}
@Override
public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
// 小端模式
//in.order(ByteOrder.LITTLE_ENDIAN);
// 先获取上次的处理上下文,其中可能有未处理完的数据
Context ctx = getContext(session);
// 先把当前buffer中的数据追加到Context的buffer当中
ctx.append(in);
IoBuffer buf = ctx.getBuffer();
buf.flip();
//验证
getValid(session, buf, out);
}
/**
* 验证协议
*
* @param session
* @param buf
* @param out
*/
private void getValid(IoSession session, IoBuffer buf, ProtocolDecoderOutput out) {
int limit = buf.remaining();
int check_code = buf.position(1).get() & 0xff;
int length = buf.position(14).get() & 0xff;
buf.position(0);
//计算包长度
if (buf.hasRemaining() && limit == length && length >= 17) {
//字节转成对象
doDecode(buf, out, length, check_code);
} else {
log.info("length errorlength:【{}】,limit:【{}】,HexDump:【{}】", length, limit, buf.getHexDump());
}
buf.position(0);
buf.clear();
}
/**
* 解码成对象
*
* @param buf
* @param out
* @param length
*/
private void doDecode(IoBuffer buf, ProtocolDecoderOutput out, int length, int check_code) {
//字节
byte[] bytes = new byte[length];
buf.get(bytes);
buf.flip();
//log.info("length:【{}】;limit:【{}】,HexDump:【{}】",length,buf.limit(),buf.getHexDump());
//crc16校验
//boolean bln = CRC16.calcCrc16(ByteUtil.hexStringToBytes(hexDump));
switch (length) {
//长度为22
case 22: {
//设置报警温度开关
if (check_code == 5) {
TemperatureSwitch(buf, out);
} //设备报警
else if (check_code == 9) {
TemperatureAlarm(buf, out);
} //模块版本指令
else if (check_code == 16) {
ModelVersion(buf, out);
} else {
out.write(bytes);
}
break;
}
//长度为24,设备发登录请求
case 24: {
if (check_code == 1) {
DeviceLogin(buf, out);
}
break;
}
//长度为25,手机发登录请求
case 25: {
if (check_code == 0) {
AppLogin(buf, out);
}
break;
}
//模块版本指令
case 42: {
if (check_code == 17) {
ModelVersion17(buf, out);
}
break;
}
default: {
out.write(bytes);
}
}
}
/**
* 设备登陆服务器
*
* @param buf
* @param out
*/
private void DeviceLogin(IoBuffer buf, ProtocolDecoderOutput out) {
DeviceLoginContextLength24 model = new DeviceLoginContextLength24();
//15字节数据包头
model.setType(buf.get());
model.setCheck_code(buf.get());
byte[] src = model.getSrc();
for (int i = 0; i < src.length; i++) {
src[i] = buf.get();
}
model.setSrc(src);
byte[] dest = model.getDest();
for (int i = 0; i < dest.length; i++) {
dest[i] = buf.get();
}
model.setDest(dest);
model.setRemote_len(buf.get());
//登陆信息
model.setVendor(buf.get());
model.setHardware_type(buf.get());
model.setVersion(buf.get());
byte[] login_ip = model.getLogin_ip();
for (int i = 0; i < login_ip.length; i++) {
login_ip[i] = buf.get();
}
model.setLogin_ip(login_ip);
byte[] crc16_code = model.getCrc16_code();
for (int i = 0; i < crc16_code.length; i++) {
crc16_code[i] = buf.get();
}
out.write(model);
}
/**
* APP登陆服务器
*
* @param buf
* @param out
*/
private void AppLogin(IoBuffer buf, ProtocolDecoderOutput out) {
APPLoginContextLength25 model = new APPLoginContextLength25();
//15字节数据包头
model.setType(buf.get());
model.setCheck_code(buf.get());
byte[] src = model.getSrc();
for (int i = 0; i < src.length; i++) {
src[i] = buf.get();
}
model.setSrc(src);
byte[] dest = model.getDest();
for (int i = 0; i < dest.length; i++) {
dest[i] = buf.get();
}
model.setDest(dest);
model.setRemote_len(buf.get());
//时间
model.setLongtime(buf.getLong());
byte[] crc16_code = model.getCrc16_code();
for (int i = 0; i < crc16_code.length; i++) {
crc16_code[i] = buf.get();
}
out.write(model);
}
/**
* 设置报警温度开关
*
* @param buf
* @param out
*/
private void TemperatureSwitch(IoBuffer buf, ProtocolDecoderOutput out) {
TemperatureSwitchLength22 model = new TemperatureSwitchLength22();
//15字节数据包头
model.setType(buf.get());
model.setCheck_code(buf.get());
byte[] src = model.getSrc();
for (int i = 0; i < src.length; i++) {
src[i] = buf.get();
}
model.setSrc(src);
byte[] dest = model.getDest();
for (int i = 0; i < dest.length; i++) {
dest[i] = buf.get();
}
model.setDest(dest);
model.setRemote_len(buf.get());
//开启关闭报警,00关,01开,02设置温度
model.setOnoff(buf.get());
//低温报警温度
model.setLow_wendu(buf.getShort());
//高温报警温度
model.setHight_wendu(buf.getShort());
byte[] crc16_code = model.getCrc16_code();
for (int i = 0; i < crc16_code.length; i++) {
crc16_code[i] = buf.get();
}
out.write(model);
}
/**
* 模块版本号
*
* @param buf
* @param out
*/
private void ModelVersion(IoBuffer buf, ProtocolDecoderOutput out) {
ModelVersionLength22 model = new ModelVersionLength22();
//15字节数据包头
model.setType(buf.get());
model.setCheck_code(buf.get());
byte[] src = model.getSrc();
for (int i = 0; i < src.length; i++) {
src[i] = buf.get();
}
model.setSrc(src);
byte[] dest = model.getDest();
for (int i = 0; i < dest.length; i++) {
dest[i] = buf.get();
}
model.setDest(dest);
model.setRemote_len(buf.get());
//版本
model.setVersion(buf.get());
//年
model.setYear(buf.getShort());
//月
model.setMonth(buf.get());
//日
model.setDay(buf.get());
byte[] crc16_code = model.getCrc16_code();
for (int i = 0; i < crc16_code.length; i++) {
crc16_code[i] = buf.get();
}
out.write(model);
}
/**
* 模块版本号
*
* @param buf
* @param out
*/
private void ModelVersion17(IoBuffer buf, ProtocolDecoderOutput out) {
ModelVersionLength38 model = new ModelVersionLength38();
//15字节数据包头
model.setType(buf.get());
model.setCheck_code(buf.get());
byte[] src = model.getSrc();
for (int i = 0; i < src.length; i++) {
src[i] = buf.get();
}
model.setSrc(src);
byte[] dest = model.getDest();
for (int i = 0; i < dest.length; i++) {
dest[i] = buf.get();
}
model.setDest(dest);
model.setRemote_len(buf.get());
//版本
model.setVersion(buf.get());
//年
model.setYear(buf.getShort());
//月
model.setMonth(buf.get());
//日
model.setDay(buf.get());
//MCU启动次数
model.setNumber1(buf.getInt());
//模块启动次数
model.setNumber2(buf.getInt());
//连接路由器次数
model.setNumber3(buf.getInt());
//成功连接服务器次数
model.setNumber4(buf.getInt());
//尝试连接服务器次数
model.setNumber5(buf.getInt());
byte[] crc16_code = model.getCrc16_code();
for (int i = 0; i < crc16_code.length; i++) {
crc16_code[i] = buf.get();
}
out.write(model);
}
/**
* 设备温度报警
*
* @param buf
* @param out
*/
private void TemperatureAlarm(IoBuffer buf, ProtocolDecoderOutput out) {
TemperatureAlarmLength22 model = new TemperatureAlarmLength22();
//15字节数据包头
model.setType(buf.get());
model.setCheck_code(buf.get());
byte[] src = model.getSrc();
for (int i = 0; i < src.length; i++) {
src[i] = buf.get();
}
model.setSrc(src);
byte[] dest = model.getDest();
for (int i = 0; i < dest.length; i++) {
dest[i] = buf.get();
}
model.setDest(dest);
model.setRemote_len(buf.get());
//报警温度类型,0是低温报警,1是高温报警
model.setWarn_type(buf.get());
//当前设备温度
model.setWendu(buf.getShort());
//报警温度
model.setWarn_wendu(buf.getShort());
byte[] crc16_code = model.getCrc16_code();
for (int i = 0; i < crc16_code.length; i++) {
crc16_code[i] = buf.get();
}
out.write(model);
}
@Override
public void dispose(IoSession session) throws Exception {
Context ctx = (Context) session.getAttribute(CONTEXT);
if (ctx != null) {
session.removeAttribute(CONTEXT);
}
}
@Override
public void finishDecode(IoSession session, ProtocolDecoderOutput out)
throws Exception {
}
}
@@ -0,0 +1,137 @@
/*
* 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.socket.codeFactory;
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.UpgradeVersionLength78;
import com.ifish.socket.model.send.TemperatureSwitchLength22;
import java.nio.charset.Charset;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 编码
*
* @author
*/
public class ServerEncode implements ProtocolEncoder {
private final Charset charset;
private static Logger log = LoggerFactory.getLogger(ServerEncode.class);
public ServerEncode() {
this(Charset.defaultCharset());
}
public ServerEncode(Charset charset) {
this.charset = charset;
}
/* 这个message来自哪? */
@Override
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
IoBuffer buffer = IoBuffer.allocate(100).setAutoExpand(true);
//修改此缓冲区的字节顺序,小端模式
//buffer.order(ByteOrder.LITTLE_ENDIAN);
//转发不做处理的数据
if (message instanceof byte[]) {
byte[] bytes = (byte[]) message;
buffer.put(bytes);
} //响应心跳
else if (message instanceof ServerHeartbeatLength17) {
ServerHeartbeatLength17 model = (ServerHeartbeatLength17) message;
//15字节数据包头
buffer.put(model.getType());
buffer.put(model.getCheck_code());
buffer.put(model.getSrc());
buffer.put(model.getDest());
buffer.put(model.getRemote_len());
//crc16校验码
buffer.put(model.getCrc16_code());
} //设置报警温度
else if (message instanceof TemperatureSwitchLength22) {
TemperatureSwitchLength22 model = (TemperatureSwitchLength22) message;
//15字节数据包头
buffer.put(model.getType());
buffer.put(model.getCheck_code());
buffer.put(model.getSrc());
buffer.put(model.getDest());
buffer.put(model.getRemote_len());
//开关
buffer.put(model.getOnoff());
//温度类型
buffer.putShort(model.getLow_wendu());
//报警温度
buffer.putShort(model.getHight_wendu());
//crc16校验码
buffer.put(model.getCrc16_code());
} //APP登录响应
else if (message instanceof APPLoginResponseLength26) {
APPLoginResponseLength26 model = (APPLoginResponseLength26) message;
//15字节数据包头
buffer.put(model.getType());
buffer.put(model.getCheck_code());
buffer.put(model.getSrc());
buffer.put(model.getDest());
buffer.put(model.getRemote_len());
//状态
buffer.put(model.getLogin_status());
//时间
buffer.putLong(model.getSysTime());
//crc16校验码
buffer.put(model.getCrc16_code());
} //设备登陆返回
else if (message instanceof DeviceLoginResponseLength25) {
DeviceLoginResponseLength25 model = (DeviceLoginResponseLength25) message;
//15字节数据包头
buffer.put(model.getType());
buffer.put(model.getCheck_code());
buffer.put(model.getSrc());
buffer.put(model.getDest());
buffer.put(model.getRemote_len());
//系统时间
buffer.put(model.getSysTime());
//crc16校验码
buffer.put(model.getCrc16_code());
} //升级
else if (message instanceof UpgradeVersionLength78) {
UpgradeVersionLength78 model = (UpgradeVersionLength78) message;
//15字节数据包头
buffer.put(model.getType());
buffer.put(model.getCheck_code());
buffer.put(model.getSrc());
buffer.put(model.getDest());
buffer.put(model.getRemote_len());
//版本
buffer.put(model.getVersion());
//地址
buffer.put(model.getAddress());
//crc16校验码
buffer.put(model.getCrc16_code());
}
buffer.flip();
/*
* 编码的方式就是按照短信协议拼 装字符串到IoBuffer 缓冲区,然后调用ProtocolEncoderOutput
* 的write()方法输出字节 流
*/
//log.info("limit:【{}】,HexDump:【{}】",buffer.limit(),buffer.getHexDump());
out.write(buffer);
out.flush();
buffer.free();
}
@Override
public void dispose(IoSession session) throws Exception {
}
}
@@ -0,0 +1,119 @@
/*
* 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.socket.config;
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_Push_List;
import com.ifish.bean.Tbl_User;
import com.ifish.enums.PushTypeEnum;
import com.ifish.helper.DeviceHelperI;
import com.ifish.helper.UserHelperI;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.mina.core.session.IoSession;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @author Administrator
*/
public class ExecuteJob implements Job {
private static Logger log = LoggerFactory.getLogger(ExecuteJob.class);
//@Autowired
//private NeteaseIM neteaseIM;
@Autowired
private UserHelperI userHelperI;
@Autowired
private DeviceHelperI deviceHelperI;
public void execute(JobExecutionContext context) throws JobExecutionException {
//任务传递的参数
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
String macAddress = dataMap.getString("macAddress");
String timestamp = dataMap.getString("timestamp");
try {
//移除为null的连接
IoSession session_cz = SomeServer.sessions_cz.get(macAddress);
if (session_cz == null || session_cz.getRemoteAddress() == null) {
SomeServer.sessions_cz.remove(macAddress);
}
//设备是否存在
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", macAddress);
Tbl_Device_Statistics device_Statistics = null;
if (device != null) {
//记录次数
Integer number1 = device_Statistics.getMcuCount();
Integer number2 = device_Statistics.getModuleCount();
Integer number3 = device_Statistics.getRouterCount();
Integer number4 = device_Statistics.getServerCount();
Integer number5 = device_Statistics.getServerTryCount();
List<Tbl_Device_User> list = deviceHelperI.getListByProperty(device.getDeviceId());
//是否被绑定
if (list != null) {
for (Tbl_Device_User deviceUser : list) {
Integer userId = deviceUser.getUserId();
String showName = deviceUser.getShowName();
String title = PushTypeEnum.offline_push.getValue();
String msg = "" + title + "】你的水族箱“" + showName + "”于" + timestamp + "离线,请及时查看!";
//发送云信消息
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();
Integer deviceId = deviceUser.getDeviceId();
Tbl_User user = userHelperI.findById(userId);
if (user != null) {
String loginType = user.getLoginType();
if (loginType != null) {
Map<String, String> map = new HashMap<String, String>();
map.put("device_id", deviceId.toString());
map.put("device_name", showName);
map.put("timestamp", timestamp);
map.put("msg_type", PushTypeEnum.offline_push.getKey());
//推送记录
pushList.setUserId(userId);
pushList.setDeviceId(deviceId);
pushList.setPhoneType(loginType.toLowerCase());
pushList.setShowName(showName);
pushList.setPushType(PushTypeEnum.offline_push.getKey());
pushList.setJpushStatus(neteaseBln ? "1" : "0");
pushList.setPushTitle(title);
pushList.setPushContext(msg);
pushList.setCreateTime(new Date());
pushList.setMcuCount(number1);
pushList.setModularCount(number2);
pushList.setRouterCount(number3);
pushList.setServerCount(number4);
pushList.setServerTryCount(number5);
userHelperI.save(pushList);
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("error msg:{}", e.toString());
}
}
}
@@ -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.socket.config;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.scheduling.quartz.AdaptableJobFactory;
/**
*
* @author Administrator
*/
public class JobFactory extends AdaptableJobFactory {
@Autowired
private AutowireCapableBeanFactory capableBeanFactory;
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
//调用父类的方法
Object jobInstance = super.createJobInstance(bundle);
//进行注入
capableBeanFactory.autowireBean(jobInstance);
return jobInstance;
}
}
@@ -0,0 +1,126 @@
/*
* 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.socket.config;
import com.ifish.socket.model.JobGroup;
import com.ifish.util.IfishUtil;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @author Administrator
*/
public class MinaServerHandler extends IoHandlerAdapter {
private final AtomicInteger atomicInt = new AtomicInteger();
private static Logger log = LoggerFactory.getLogger(MinaServerHandler.class);
@Autowired
private SomeServer someServer;
@Autowired
private ScheduleJob scheduleJob;
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
cause.printStackTrace();
log.error("{}服务器-客户端session异常:{}", session.getRemoteAddress(), cause.toString());
}
/**
* 服务端接收消息处理
*/
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
someServer.doSome(session, message);
}
/**
* 客户端连接的会话创建
*/
@Override
public void sessionCreated(IoSession session) throws Exception {
log.info("{}:会话创建,在线数:{}", session.getRemoteAddress(), atomicInt.incrementAndGet());
}
/**
* 客户端连接关闭
*/
@Override
public void sessionClosed(IoSession session) throws Exception {
log.warn("{}:会话关闭,连接数:{}", session.getRemoteAddress(), atomicInt.decrementAndGet());
//旧连接关闭,获取设备mac地址
String oldConnect = session.getRemoteAddress().toString();
String macAddress = SomeServer.remoteAddress.get(oldConnect);
if (macAddress != null) {
//移除关闭的连接
SomeServer.remoteAddress.remove(oldConnect);
//设备当前连接
IoSession nowIoSession = SomeServer.sessions_cz.get(macAddress);
if (nowIoSession != null && nowIoSession.getRemoteAddress() != null) {
String nowConnect = nowIoSession.getRemoteAddress().toString();
//如果当前连接和关闭的连接是相同的,说明设备没有重连,10分钟内还未连接,则推送通知用户
if (nowConnect.equals(oldConnect)) {
offlinePush(macAddress);
}
} //当前没有连接,10分钟内还未连接,则推送通知用户
else {
offlinePush(macAddress);
}
}
}
/**
* 延时10分钟推送离线通知,10分钟内重新连接上则移除推送,详见SomeServer
*
* @param macAddress
*/
public void offlinePush(String macAddress) {
JobGroup jobGroup = new JobGroup();
jobGroup.setJobName(macAddress);
jobGroup.setTriggerName(macAddress);
jobGroup.setMacAddress(macAddress);
//离线时间
jobGroup.setTimestamp(IfishUtil.format(new Date()));
//10分钟后推送
jobGroup.setStartTime(new Date(new Date().getTime() + 600000L));
scheduleJob.addJob(jobGroup);
}
/**
* 给客户端发送消息
*/
@Override
public void messageSent(IoSession session, Object message) {
//System.out.println("messageSent");
}
/**
* 空闲超时,主动关闭客户端连接
*/
@Override
public void sessionIdle(IoSession session, IdleStatus status)
throws Exception {
log.warn("空闲超时,服务器主动关闭连接{}", session.getRemoteAddress());
session.close(true);
}
/**
* 客户端连接打开
*/
@Override
public void sessionOpened(IoSession session) throws Exception {
//log.info("session open!!!");
}
}
@@ -0,0 +1,53 @@
/*
* 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.socket.config;
import java.net.InetSocketAddress;
/**
*
* @author Administrator
*/
public class MyInetSocketAddress {
private InetSocketAddress socketAddress = null;
private String ip = "";
private int serverPort = 9955;
public MyInetSocketAddress(String ip, int serverPort) {
try {
this.ip = ip;
this.serverPort = serverPort;
socketAddress = new InetSocketAddress(ip, serverPort);
} catch (Exception e) {
e.printStackTrace();
}
}
public InetSocketAddress getSocketAddress() {
return socketAddress;
}
public void setSocketAddress(InetSocketAddress socketAddress) {
this.socketAddress = socketAddress;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getServerPort() {
return serverPort;
}
public void setServerPort(int serverPort) {
this.serverPort = serverPort;
}
}
@@ -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.socket.config;
import com.ifish.socket.model.JobGroup;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.TriggerKey;
import org.quartz.impl.StdSchedulerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @author Administrator
*/
public class ScheduleJob {
private static Logger log = LoggerFactory.getLogger(ScheduleJob.class);
//调度
private Scheduler scheduler = null;
@Autowired
private JobFactory jobFactory;
@PostConstruct //初始化方法的注解方式 等同与init-method=init
public void init() {
try {
//调度任务开启
SchedulerFactory sf = new StdSchedulerFactory();
scheduler = sf.getScheduler();
//实现job中注入bean
scheduler.setJobFactory(jobFactory);
scheduler.start();
} catch (SchedulerException e) {
log.error("start scheduler error:{}", e.toString());
}
}
/**
* 添加任务
*
* @param jobGroup
* @throws SchedulerException
*/
public void addJob(JobGroup jobGroup) {
try {
log.info("添加任务:{}.{}", jobGroup.getJobName(), jobGroup.getTriggerName());
//任务
JobDetail jobDetail = JobBuilder.newJob(ExecuteJob.class)
.usingJobData("macAddress", jobGroup.getMacAddress())
.usingJobData("timestamp", jobGroup.getTimestamp())
.withIdentity(jobGroup.getJobName(), jobGroup.getJobName())
.build();
//触发器
Trigger trigger = TriggerBuilder.newTrigger()
.withIdentity(jobGroup.getTriggerName(), jobGroup.getTriggerGroup())
.startAt(jobGroup.getStartTime()).build();
//添加触发器
scheduler.scheduleJob(jobDetail, trigger);
} catch (SchedulerException e) {
log.error("addJob error【macAddress:{},jobGroup:{},triggerGroup:{},errMsg:{}】", jobGroup.getMacAddress(), jobGroup.getJobName(), jobGroup.getTriggerGroup(), e.toString());
}
}
/**
* 移除任务
*
* @param jobGroup
* @throws SchedulerException
*/
public void deleteJob(JobGroup jobGroup) {
try {
log.info("移除任务:{}.{}", jobGroup.getJobName(), jobGroup.getTriggerName());
//触发器
TriggerKey triggerKey = TriggerKey.triggerKey(jobGroup.getTriggerName(), jobGroup.getTriggerGroup());
//停止触发器
scheduler.pauseTrigger(triggerKey);
//移除触发器
scheduler.unscheduleJob(triggerKey);
//任务
JobKey jobKey = JobKey.jobKey(jobGroup.getJobName(), jobGroup.getJobGroup());
//删除任务
scheduler.deleteJob(jobKey);
} catch (SchedulerException e) {
log.error("deleteJob error【macAddress:{},jobGroup:{},triggerGroup:{},errMsg:{}】", jobGroup.getMacAddress(), jobGroup.getJobName(), jobGroup.getTriggerGroup(), e.toString());
}
}
/**
* 关闭调度任务
*/
@PreDestroy //销毁方法的注解方式 等同于destory-method=destory222
public void shutdown() {
try {
//关闭任务
scheduler.shutdown();
} catch (SchedulerException e) {
log.error("shutdown scheduler error:{}", e.toString());
}
}
}
@@ -0,0 +1,364 @@
/*
* 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.socket.config;
import com.ifish.bean.LoginRecord;
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_Push_List;
import com.ifish.bean.Tbl_User;
import com.ifish.enums.PushTypeEnum;
import com.ifish.helper.DeviceHelperI;
import com.ifish.helper.UserHelperI;
import com.ifish.socket.model.JobGroup;
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.DeviceLoginContextLength24;
import com.ifish.socket.model.send.ModelVersionLength22;
import com.ifish.socket.model.send.ModelVersionLength38;
import com.ifish.socket.model.send.TemperatureAlarmLength22;
import com.ifish.socket.model.send.TemperatureSwitchLength22;
import com.ifish.socket.model.send.UpgradeVersionLength78;
import com.ifish.util.ByteUtil;
import com.ifish.util.IfishUtil;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @author Administrator
*/
public class SomeServer {
@Autowired
private UserHelperI userHelperI;
@Autowired
private DeviceHelperI deviceHelperI;
@Autowired
private ScheduleJob scheduleJob;
// @Autowired
// private NeteaseIM neteaseIM;
//是否回复心跳
public static boolean isReplay = true;
private static Logger log = LoggerFactory.getLogger(SomeServer.class);
public static ConcurrentHashMap<String, String> remoteAddress = new ConcurrentHashMap<String, String>();
public static ConcurrentHashMap<String, IoSession> sessions_cz = new ConcurrentHashMap<String, IoSession>();
private ConcurrentHashMap<String, CopyOnWriteArraySet<IoSession>> sessions_sjs = new ConcurrentHashMap<String, CopyOnWriteArraySet<IoSession>>();
/**
* 过滤收到的数据 服务器收到数据,进行协议类型匹配,如果不匹配,则不执行相应操作。
*
* @param session
* @param message
*/
public void doSome(IoSession session, Object message) {
//通配字符串
if (message instanceof byte[]) {
byte[] bytes = (byte[]) message;
//长度
int length = bytes[14] & 0xff;
//mac地址
byte[] srcByte = new byte[6];
for (int i = 2; i < 8; i++) {
srcByte[i - 2] = bytes[i];
}
String strSrc = ByteUtil.bytesToHexString(srcByte);
//心跳
if (length >= 28) {
sendToApp(session, strSrc, message);
} else {
sendToDevice(session, strSrc, message);
}
} //设置设备温度报警
else if (message instanceof TemperatureSwitchLength22) {
TemperatureSwitchLength22 receive = (TemperatureSwitchLength22) message;
String strDest = ByteUtil.bytesToHexString(receive.getDest());
sendToDevice(session, strDest, message);
try {
Integer Onoff = receive.getOnoff() & 0xff;
if (Onoff == 1 || Onoff == 0) {
deviceHelperI.updateWarnOnoff(strDest, Onoff.toString());
} else {
log.error("error Onoff:{},macAddress:{}", Onoff, strDest);
}
} catch (Exception e) {
log.warn("set OrderSetWarnModel error:macAddress:{},error msg:{}", strDest, e.toString());
}
} //设备温度报警
else if (message instanceof TemperatureAlarmLength22) {
TemperatureAlarmLength22 receive = (TemperatureAlarmLength22) message;
String strSrc = ByteUtil.bytesToHexString(receive.getSrc());
//推送类型
Integer warnType = receive.getWarn_type() & 0xff;
if (warnType == 0) {
pushNotifcation(strSrc, PushTypeEnum.wendu_warn.getValue(), "温度达到" + (float) receive.getWendu() / 10f + "℃,已低于" + (float) receive.getWarn_wendu() / 10f + "℃,请及时查看!");
} else if (warnType == 1) {
pushNotifcation(strSrc, PushTypeEnum.wendu_warn.getValue(), "温度达到" + (float) receive.getWendu() / 10f + "℃,已高于" + (float) receive.getWarn_wendu() / 10f + "℃,请及时查看!");
} else {
log.error("error warn_type:{},macAddress:{}", warnType, strSrc);
}
} //设备登录服务器
else if (message instanceof DeviceLoginContextLength24) {
DeviceLoginContextLength24 receive = (DeviceLoginContextLength24) message;
byte[] srcBytes = receive.getSrc();
byte[] destBytes = receive.getDest();
String strSrc = ByteUtil.bytesToHexString(srcBytes);
//服务器回复设备登录请求
DeviceLoginResponseLength25 model = OrderModel.DeviceLoginResponseLength25(destBytes, srcBytes);
//直接往本次session写回去
session.write(model);
//保存连接
sessions_cz.put(strSrc, session);
remoteAddress.put(session.getRemoteAddress().toString(), strSrc);
//设备重新连接上,则移除延时推送的任务
JobGroup jobGroup = new JobGroup();
jobGroup.setJobName(strSrc);
jobGroup.setTriggerName(strSrc);
scheduleJob.deleteJob(jobGroup);
try {
//更新设备信息
deviceHelperI.update(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) {
log.warn("save device login error:macAddress:{},error msg:{}", strSrc, e.toString());
}
} //APP登录服务器
else if (message instanceof APPLoginResponseLength26) {
APPLoginResponseLength26 receive = (APPLoginResponseLength26) message;
byte[] srcBytes = receive.getSrc();
byte[] destBytes = receive.getDest();
String strDest = ByteUtil.bytesToHexString(receive.getDest());
//设备是否在线
IoSession tmpSession = sessions_cz.get(strDest);
//1表示在线,0表示离线
byte login_status = 0;
if (tmpSession != null && tmpSession.getRemoteAddress() != null) {
login_status = 1;
} else {
login_status = 0;
}
//服务器回复APP登录请求
APPLoginResponseLength26 model = OrderModel.APPLoginResponseLength26(destBytes, srcBytes, login_status);
session.write(model);
//保存APP连接
CopyOnWriteArraySet<IoSession> sessionSet = sessions_sjs.get(strDest);
if (sessionSet == null) {
sessionSet = new CopyOnWriteArraySet<IoSession>();
sessionSet.add(session);
sessions_sjs.put(strDest, sessionSet);
} else {
for (IoSession ioSession : sessionSet) {
if (ioSession == null || ioSession.getRemoteAddress() == null) {
sessionSet.remove(ioSession);
}
}
sessionSet.add(session);
}
} //模块版本号
else if (message instanceof ModelVersionLength22) {
ModelVersionLength22 receive = (ModelVersionLength22) message;
byte[] macBytes = receive.getSrc();
String strSrc = ByteUtil.bytesToHexString(macBytes);
try {
//查找设备
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", strSrc);
Tbl_Device_Statistics device_Statistics = null;
if (device != null) {
//是否升级
if (device_Statistics.getIsUpgrade().equals("1")) {
device_Statistics.setIsUpgrade("0");
device_Statistics.setUpgradeTime(new Date());
//升级版本
int upgradeVersion = Integer.valueOf(device_Statistics.getUpgradeVersion());
UpgradeVersionLength78 model = OrderModel.UpgradeVersionLength78(macBytes, upgradeVersion);
session.write(model);
}
//记录参数
device_Statistics.setSdkVersion(String.valueOf(receive.getVersion() & 0xff));
device_Statistics.setSdkTime(IfishUtil.StrToDate(receive.getYear() + "-" + (receive.getMonth() & 0xff) + "-" + (receive.getDay() & 0xff)));
deviceHelperI.update(device);
}
} catch (Exception e) {
log.warn("save device sdk version16 error:macAddress:{},error msg:{}", strSrc, e.toString());
}
} //模块版本号
else if (message instanceof ModelVersionLength38) {
ModelVersionLength38 receive = (ModelVersionLength38) message;
byte[] macBytes = receive.getSrc();
String strSrc = ByteUtil.bytesToHexString(macBytes);
try {
//查找设备
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", strSrc);
Tbl_Device_Statistics device_Statistics = null;
if (device != null) {
//是否升级
if (device_Statistics.getIsUpgrade().equals("1")) {
device_Statistics.setIsUpgrade("0");
device_Statistics.setUpgradeTime(new Date());
//升级版本
int upgradeVersion = Integer.parseInt(device_Statistics.getUpgradeVersion());
UpgradeVersionLength78 model = OrderModel.UpgradeVersionLength78(macBytes, upgradeVersion);
session.write(model);
}
//记录参数
device_Statistics.setSdkVersion(String.valueOf(receive.getVersion() & 0xff));
device_Statistics.setSdkTime(IfishUtil.StrToDate(receive.getYear() + "-" + (receive.getMonth() & 0xff) + "-" + (receive.getDay() & 0xff)));
device_Statistics.setMcuCount(receive.getNumber1());
device_Statistics.setModuleCount(receive.getNumber2());
device_Statistics.setRouterCount(receive.getNumber3());
device_Statistics.setServerCount(receive.getNumber4());
device_Statistics.setServerTryCount(receive.getNumber5());
deviceHelperI.update(device);
}
} catch (Exception e) {
log.warn("save device sdk version17 error:macAddress:{},error msg:{}", strSrc, e.toString());
}
}
}
/**
* 发送数据APP
*
* @param dest 目的地
* @param message 发送对象
* @return
*/
public void sendToApp(IoSession session, String strDest, Object message) {
//回复设备
if (isReplay) {
ServerHeartbeatLength17 model = OrderModel.ServerHeartbeatLength17(strDest);
session.write(model);
}
//转发给APP
CopyOnWriteArraySet<IoSession> sessionSet = sessions_sjs.get(strDest);
if (sessionSet != null && sessionSet.size() > 0) {
for (IoSession sj_session : sessionSet) {
if (sj_session != null && sj_session.getRemoteAddress() != null) {
sj_session.write(message);
} else {
sessionSet.remove(sj_session);
}
}
}
}
/**
* 发送数据给设备
*
* @param dest 目的地
* @param message 发送对象
* @return
*/
public void sendToDevice(IoSession session, String strDest, Object message) {
IoSession cz_session = sessions_cz.get(strDest);
if (cz_session != null && cz_session.getRemoteAddress() != null) {
cz_session.write(message);
} else {
//设备离线
byte[] bytes = ByteUtil.hexStringToBytes2(strDest);
APPLoginResponseLength26 model = OrderModel.APPLoginResponseLength26(bytes, bytes, (byte) 0);
session.write(model);
}
}
/**
* 温度预警推送
*
* @param strSrc
* @param title
* @param contont
*/
public void pushNotifcation(String strSrc, String title, String contont) {
try {
//Device device = deviceService.getUniqueByProperty("macAddress", strSrc);
Tbl_Device device = deviceHelperI.getUniqueByProperty("macAddress", strSrc);
Tbl_Device_Statistics device_Statistics = null;
if (device != null) {
Integer deviceId = device.getDeviceId();
//是否开启预警
String onOff = device.getOnOff();
if (onOff != null && onOff.equals("1")) {
//绑定设备的用户
List<Tbl_Device_User> list = deviceHelperI.getListByProperty(device.getDeviceId());
for (Tbl_Device_User deviceUser : list) {
Integer userId = deviceUser.getUserId();
String showName = deviceUser.getShowName();
String timestamp = IfishUtil.format(new Date());
String msg = "" + title + "】你的水族箱“" + showName + "”在" + timestamp + contont;
Tbl_User user = userHelperI.findById(userId);
if (user != null) {
//云信推送
boolean neteaseBln = false;
//极光推送
boolean jpushIosBln = 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();
if (loginType != null) {
//推送记录
Tbl_Push_List pushList = new Tbl_Push_List();
Map<String, String> map = new HashMap<String, String>();
map.put("device_id", deviceId.toString());
map.put("device_name", showName);
map.put("timestamp", timestamp);
map.put("msg_type", PushTypeEnum.wendu_warn.getKey());
//记录推送
if (jpushIosBln || jpushAndroidBln || neteaseBln) {
pushList.setUserId(userId);
pushList.setDeviceId(deviceId);
pushList.setPhoneType(loginType.toLowerCase());
pushList.setShowName(showName);
pushList.setPushType(PushTypeEnum.wendu_warn.getKey());
pushList.setPushTitle(title);
pushList.setPushContext(msg);
pushList.setJpushStatus(neteaseBln ? "1" : "0");
pushList.setCreateTime(new Date());
pushList.setMcuCount(device_Statistics.getMcuCount());
pushList.setModularCount(device_Statistics.getModuleCount());
pushList.setRouterCount(device_Statistics.getRouterCount());
pushList.setServerCount(device_Statistics.getServerCount());
pushList.setServerTryCount(device_Statistics.getServerTryCount());
userHelperI.save(pushList);
}
}
}
}
}
}
} catch (Exception e) {
log.warn("pushNotifcation error:macAddress:{},error msg:{}", strSrc, e.toString());
}
}
}
@@ -0,0 +1,500 @@
/*
* 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.socket.model;
import java.io.Serializable;
/**
*
* @author Administrator
*/
public class DeviceResponseLength99 extends HeadModel implements Serializable {
private static final long serialVersionUID = -2334084294686976805L;
//工作模式
private byte work_model;
/**
* *******灯和开关(10字节)*********
*/
//灯编号1
private byte number1;
//灯编号2
private byte number2;
//灯编号3
private byte number3;
//灯编号4
private byte number4;
//灯编号5
private byte number5;
//灯1开关
private byte onoff1;
//灯2开关
private byte onoff2;
//灯3开关
private byte onoff3;
//灯4开关
private byte onoff4;
//灯5开关
private byte onoff5;
/**
* *******定时器编号(10字节)灯1对应定时器1-2,灯2对应定时器3-4,灯3对应定时器5-6*********
*/
//定时器1编号
private byte timer_number1;
//定时器2编号
private byte timer_number2;
//定时器3编号
private byte timer_number3;
//定时器4编号
private byte timer_number4;
//定时器5编号
private byte timer_number5;
//定时器6编号
private byte timer_number6;
//定时器7编号
private byte timer_number7;
//定时器8编号
private byte timer_number8;
//定时器9编号
private byte timer_number9;
//定时器10编号
private byte timer_number10;
/**
* *******定时器开关(10字节)*********
*/
//定时器1开关
private byte timer_onoff1;
//定时器2开关
private byte timer_onoff2;
//定时器3开关
private byte timer_onoff3;
//定时器4开关
private byte timer_onoff4;
//定时器5开关
private byte timer_onoff5;
//定时器6开关
private byte timer_onoff6;
//定时器7开关
private byte timer_onoff7;
//定时器8开关
private byte timer_onoff8;
//定时器9开关
private byte timer_onoff9;
//定时器10开关
private byte timer_onoff10;
/**
* *******定时器时间(40字节)*********
*/
//定时器1时间
private byte[] timer_time1 = new byte[4];
//定时器2时间
private byte[] timer_time2 = new byte[4];
//定时器3时间
private byte[] timer_time3 = new byte[4];
//定时器4时间
private byte[] timer_time4 = new byte[4];
//定时器5时间
private byte[] timer_time5 = new byte[4];
//定时器6时间
private byte[] timer_time6 = new byte[4];
//定时器7时间
private byte[] timer_time7 = new byte[4];
//定时器8时间
private byte[] timer_time8 = new byte[4];
//定时器9时间
private byte[] timer_time9 = new byte[4];
//定时器10时间
private byte[] timer_time10 = new byte[4];
//温度
private short wendu;
//ph
private short ph_value;
//湿度
private short shidu;
//报警开关,0关,1开
private byte warn_onoff;
//最低报警温度
private short low_wendu;
//最高报警温度
private short high_wendu;
public short getWendu() {
return wendu;
}
public void setWendu(short wendu) {
this.wendu = wendu;
}
public byte getWork_model() {
return work_model;
}
public void setWork_model(byte work_model) {
this.work_model = work_model;
}
public byte getNumber1() {
return number1;
}
public void setNumber1(byte number1) {
this.number1 = number1;
}
public byte getOnoff1() {
return onoff1;
}
public void setOnoff1(byte onoff1) {
this.onoff1 = onoff1;
}
public byte getNumber2() {
return number2;
}
public void setNumber2(byte number2) {
this.number2 = number2;
}
public byte getOnoff2() {
return onoff2;
}
public void setOnoff2(byte onoff2) {
this.onoff2 = onoff2;
}
public byte getNumber3() {
return number3;
}
public void setNumber3(byte number3) {
this.number3 = number3;
}
public byte getOnoff3() {
return onoff3;
}
public void setOnoff3(byte onoff3) {
this.onoff3 = onoff3;
}
public byte getTimer_number1() {
return timer_number1;
}
public void setTimer_number1(byte timer_number1) {
this.timer_number1 = timer_number1;
}
public byte getTimer_number2() {
return timer_number2;
}
public void setTimer_number2(byte timer_number2) {
this.timer_number2 = timer_number2;
}
public byte getTimer_number3() {
return timer_number3;
}
public void setTimer_number3(byte timer_number3) {
this.timer_number3 = timer_number3;
}
public byte getTimer_number4() {
return timer_number4;
}
public void setTimer_number4(byte timer_number4) {
this.timer_number4 = timer_number4;
}
public byte getTimer_number5() {
return timer_number5;
}
public void setTimer_number5(byte timer_number5) {
this.timer_number5 = timer_number5;
}
public byte getTimer_number6() {
return timer_number6;
}
public void setTimer_number6(byte timer_number6) {
this.timer_number6 = timer_number6;
}
public byte getTimer_number7() {
return timer_number7;
}
public void setTimer_number7(byte timer_number7) {
this.timer_number7 = timer_number7;
}
public byte getTimer_number8() {
return timer_number8;
}
public void setTimer_number8(byte timer_number8) {
this.timer_number8 = timer_number8;
}
public byte getTimer_number9() {
return timer_number9;
}
public void setTimer_number9(byte timer_number9) {
this.timer_number9 = timer_number9;
}
public byte[] getTimer_time1() {
return timer_time1;
}
public void setTimer_time1(byte[] timer_time1) {
this.timer_time1 = timer_time1;
}
public byte[] getTimer_time2() {
return timer_time2;
}
public void setTimer_time2(byte[] timer_time2) {
this.timer_time2 = timer_time2;
}
public byte[] getTimer_time3() {
return timer_time3;
}
public void setTimer_time3(byte[] timer_time3) {
this.timer_time3 = timer_time3;
}
public byte[] getTimer_time4() {
return timer_time4;
}
public void setTimer_time4(byte[] timer_time4) {
this.timer_time4 = timer_time4;
}
public byte[] getTimer_time5() {
return timer_time5;
}
public void setTimer_time5(byte[] timer_time5) {
this.timer_time5 = timer_time5;
}
public byte[] getTimer_time6() {
return timer_time6;
}
public void setTimer_time6(byte[] timer_time6) {
this.timer_time6 = timer_time6;
}
public byte[] getTimer_time7() {
return timer_time7;
}
public void setTimer_time7(byte[] timer_time7) {
this.timer_time7 = timer_time7;
}
public byte[] getTimer_time8() {
return timer_time8;
}
public void setTimer_time8(byte[] timer_time8) {
this.timer_time8 = timer_time8;
}
public byte[] getTimer_time9() {
return timer_time9;
}
public void setTimer_time9(byte[] timer_time9) {
this.timer_time9 = timer_time9;
}
public short getPh_value() {
return ph_value;
}
public void setPh_value(short ph_value) {
this.ph_value = ph_value;
}
public short getShidu() {
return shidu;
}
public void setShidu(short shidu) {
this.shidu = shidu;
}
public byte getWarn_onoff() {
return warn_onoff;
}
public void setWarn_onoff(byte warn_onoff) {
this.warn_onoff = warn_onoff;
}
public short getLow_wendu() {
return low_wendu;
}
public void setLow_wendu(short low_wendu) {
this.low_wendu = low_wendu;
}
public short getHigh_wendu() {
return high_wendu;
}
public void setHigh_wendu(short high_wendu) {
this.high_wendu = high_wendu;
}
public byte getOnoff4() {
return onoff4;
}
public void setOnoff4(byte onoff4) {
this.onoff4 = onoff4;
}
public byte getOnoff5() {
return onoff5;
}
public void setOnoff5(byte onoff5) {
this.onoff5 = onoff5;
}
public byte getTimer_number10() {
return timer_number10;
}
public void setTimer_number10(byte timer_number10) {
this.timer_number10 = timer_number10;
}
public byte[] getTimer_time10() {
return timer_time10;
}
public void setTimer_time10(byte[] timer_time10) {
this.timer_time10 = timer_time10;
}
public byte getNumber4() {
return number4;
}
public void setNumber4(byte number4) {
this.number4 = number4;
}
public byte getNumber5() {
return number5;
}
public void setNumber5(byte number5) {
this.number5 = number5;
}
public byte getTimer_onoff1() {
return timer_onoff1;
}
public void setTimer_onoff1(byte timer_onoff1) {
this.timer_onoff1 = timer_onoff1;
}
public byte getTimer_onoff2() {
return timer_onoff2;
}
public void setTimer_onoff2(byte timer_onoff2) {
this.timer_onoff2 = timer_onoff2;
}
public byte getTimer_onoff3() {
return timer_onoff3;
}
public void setTimer_onoff3(byte timer_onoff3) {
this.timer_onoff3 = timer_onoff3;
}
public byte getTimer_onoff4() {
return timer_onoff4;
}
public void setTimer_onoff4(byte timer_onoff4) {
this.timer_onoff4 = timer_onoff4;
}
public byte getTimer_onoff5() {
return timer_onoff5;
}
public void setTimer_onoff5(byte timer_onoff5) {
this.timer_onoff5 = timer_onoff5;
}
public byte getTimer_onoff6() {
return timer_onoff6;
}
public void setTimer_onoff6(byte timer_onoff6) {
this.timer_onoff6 = timer_onoff6;
}
public byte getTimer_onoff7() {
return timer_onoff7;
}
public void setTimer_onoff7(byte timer_onoff7) {
this.timer_onoff7 = timer_onoff7;
}
public byte getTimer_onoff8() {
return timer_onoff8;
}
public void setTimer_onoff8(byte timer_onoff8) {
this.timer_onoff8 = timer_onoff8;
}
public byte getTimer_onoff9() {
return timer_onoff9;
}
public void setTimer_onoff9(byte timer_onoff9) {
this.timer_onoff9 = timer_onoff9;
}
public byte getTimer_onoff10() {
return timer_onoff10;
}
public void setTimer_onoff10(byte timer_onoff10) {
this.timer_onoff10 = timer_onoff10;
}
}
@@ -0,0 +1,80 @@
/*
* 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.socket.model;
import java.io.Serializable;
/**
* 所有请求的数据包头,15字节数据包头+CRC16校验码2字节
*
* @author guogw
*
*/
public class HeadModel implements Serializable {
private static final long serialVersionUID = 7351497431272185642L;
//发送消息类型,1回复类型,0发送类型
private byte type;
//功能码
private byte check_code;
//6位为发送端的mac地址,高16位为0001
private byte[] src = new byte[6];
//6位为接收端的mac地址,高16位为0001
private byte[] dest = new byte[6];
//整个包长度
private byte remote_len;
//CRC16校验码
private byte[] crc16_code = new byte[2];
public byte getType() {
return type;
}
public void setType(byte type) {
this.type = type;
}
public byte getCheck_code() {
return check_code;
}
public void setCheck_code(byte check_code) {
this.check_code = check_code;
}
public void setRemote_len(byte remote_len) {
this.remote_len = remote_len;
}
public byte[] getSrc() {
return src;
}
public void setSrc(byte[] src) {
this.src = src;
}
public byte[] getDest() {
return dest;
}
public void setDest(byte[] dest) {
this.dest = dest;
}
public byte getRemote_len() {
return remote_len;
}
public byte[] getCrc16_code() {
return crc16_code;
}
public void setCrc16_code(byte[] crc16_code) {
this.crc16_code = crc16_code;
}
}
@@ -0,0 +1,107 @@
/*
* 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.socket.model;
import java.util.Date;
/**
*
* @author Administrator
*/
public class JobGroup {
/**
* 任务名称 *
*/
private String jobName;
/**
* 任务分组 *
*/
private String jobGroup = "offlinePushGroup";
/**
* 触发器名称 *
*/
private String triggerName;
/**
* 触发器分组 *
*/
private String triggerGroup = "offlinePushGroup";
/**
* mac地址 *
*/
private String macAddress;
/**
* 执行时间 *
*/
private Date startTime;
/**
* 离线时间 *
*/
private String timestamp;
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public String getJobGroup() {
return jobGroup;
}
public void setJobGroup(String jobGroup) {
this.jobGroup = jobGroup;
}
public String getTriggerName() {
return triggerName;
}
public void setTriggerName(String triggerName) {
this.triggerName = triggerName;
}
public String getTriggerGroup() {
return triggerGroup;
}
public void setTriggerGroup(String triggerGroup) {
this.triggerGroup = triggerGroup;
}
public String getMacAddress() {
return macAddress;
}
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
}
@@ -0,0 +1,101 @@
/*
* 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.socket.model;
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.UpgradeVersionLength78;
import com.ifish.util.ByteUtil;
/**
*
* @author Administrator
*/
public class OrderModel {
/**
* 服务器回复设备登录请求指令
*
* @param src
* @param dest
* @return
*/
public final static DeviceLoginResponseLength25 DeviceLoginResponseLength25(byte[] src, byte[] dest) {
DeviceLoginResponseLength25 model = new DeviceLoginResponseLength25();
model.setType((byte) 1);
model.setCheck_code((byte) 1);
model.setSrc(src);
model.setDest(dest);
model.setRemote_len((byte) 25);
model.setSysTime(ByteUtil.hexSysTime());
return model;
}
/**
* 服务器回复APP登录请求指令
*
* @param src
* @param dest
* @return
*/
public final static APPLoginResponseLength26 APPLoginResponseLength26(byte[] src, byte[] dest, byte login_status) {
APPLoginResponseLength26 model = new APPLoginResponseLength26();
model.setType((byte) 1);
model.setSrc(src);
model.setDest(dest);
model.setRemote_len((byte) 26);
model.setLogin_status(login_status);
model.setSysTime(System.currentTimeMillis());
return model;
}
/**
* 获取查询命令
*
* @param type
* @param macAddress
* @return
*/
public final static ServerHeartbeatLength17 ServerHeartbeatLength17(String macAddress) {
ServerHeartbeatLength17 model = new ServerHeartbeatLength17();
//15字节数据包头
model.setType((byte) 1);
model.setCheck_code((byte) 8);
model.setSrc(ByteUtil.hexStringToBytes2(macAddress));
model.setDest(ByteUtil.hexStringToBytes2(macAddress));
model.setRemote_len((byte) 17);
return model;
}
/**
* 升级
*
* @param type
* @param macAddress
* @param timer_number
* @param time
* @return
*/
public final static UpgradeVersionLength78 UpgradeVersionLength78(byte[] macAddress, int version) {
UpgradeVersionLength78 model = new UpgradeVersionLength78();
//15字节数据包头
model.setType((byte) 0);
model.setCheck_code((byte) 15);
model.setSrc(macAddress);
model.setDest(macAddress);
model.setRemote_len((byte) 78);
model.setVersion((byte) version);
//地址
byte[] addressByte = model.getAddress();
byte[] bytes = "/download/sdk/".getBytes();
for (int i = 0; i < bytes.length; i++) {
addressByte[i] = bytes[i];
}
model.setAddress(addressByte);
return model;
}
}
@@ -0,0 +1,41 @@
/*
* 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.socket.model.receive;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 服务器回复手机端的登录请求26字节(17字节头+9字节)
*
* @author guogw
*
*/
public class APPLoginResponseLength26 extends HeadModel implements Serializable {
private static final long serialVersionUID = 656305903606196100L;
//0表示设备还未连接服务器,1表示已连接
private byte login_status;
//系统时间
private long sysTime;
public byte getLogin_status() {
return login_status;
}
public void setLogin_status(byte login_status) {
this.login_status = login_status;
}
public long getSysTime() {
return sysTime;
}
public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
}
@@ -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.socket.model.receive;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 服务器回复插座的登录请求25字节(15字节头+8字节时间+2字节)
*
* @author guogw
*
*/
public class DeviceLoginResponseLength25 extends HeadModel implements Serializable {
private static final long serialVersionUID = 1L;
//系统时间
private byte[] sysTime = new byte[8];
public byte[] getSysTime() {
return sysTime;
}
public void setSysTime(byte[] sysTime) {
this.sysTime = sysTime;
}
}
@@ -0,0 +1,21 @@
/*
* 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.socket.model.receive;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 服务器响应心跳17字节(15字节头+2校验码)
*
* @author guogw
*
*/
public class ServerHeartbeatLength17 extends HeadModel implements Serializable {
private static final long serialVersionUID = 8470317692571925603L;
}
@@ -0,0 +1,30 @@
/*
* 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.socket.model.send;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 手机登录请求25字节(17字节头+8字节登陆信息)
*
* @author guogw
*
*/
public class APPLoginContextLength25 extends HeadModel implements Serializable {
private static final long serialVersionUID = 5899193914651159511L;
//时间
private long longtime;
public long getLongtime() {
return longtime;
}
public void setLongtime(long longtime) {
this.longtime = longtime;
}
}
@@ -0,0 +1,61 @@
/*
* 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.socket.model.send;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 设备登录服务器(24字节=17+7字节登陆信息)
*
* @author guogw
*
*/
public class DeviceLoginContextLength24 extends HeadModel implements Serializable {
private static final long serialVersionUID = 5329299292101065390L;
//厂商
private byte vendor;
//硬件型号
private byte hardware_type;
//版本
private byte version;
//登陆IP
private byte[] login_ip = new byte[4];
public byte getVendor() {
return vendor;
}
public void setVendor(byte vendor) {
this.vendor = vendor;
}
public byte getHardware_type() {
return hardware_type;
}
public void setHardware_type(byte hardware_type) {
this.hardware_type = hardware_type;
}
public byte getVersion() {
return version;
}
public void setVersion(byte version) {
this.version = version;
}
public byte[] getLogin_ip() {
return login_ip;
}
public void setLogin_ip(byte[] login_ip) {
this.login_ip = login_ip;
}
}
@@ -0,0 +1,60 @@
/*
* 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.socket.model.send;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 模块版本号,日期
*
* @author Administrator
*/
public class ModelVersionLength22 extends HeadModel implements Serializable {
private static final long serialVersionUID = -6712376303551767331L;
//版本
private byte version;
//年
private short year;
//月
private byte month;
//日
private byte day;
public byte getVersion() {
return version;
}
public void setVersion(byte version) {
this.version = version;
}
public short getYear() {
return year;
}
public void setYear(short year) {
this.year = year;
}
public byte getMonth() {
return month;
}
public void setMonth(byte month) {
this.month = month;
}
public byte getDay() {
return day;
}
public void setDay(byte day) {
this.day = day;
}
}
@@ -0,0 +1,111 @@
/*
* 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.socket.model.send;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 模块版本号,日期,38字节(17字节头+21字节)
*
* @author guogw
*
*/
public class ModelVersionLength38 extends HeadModel implements Serializable {
private static final long serialVersionUID = -6712376303551767331L;
//版本
private byte version;
//年
private short year;
//月
private byte month;
//日
private byte day;
//MCU启动次数
private int number1;
//模块启动次数
private int number2;
//连接路由器次数
private int number3;
//成功连接服务器次数
private int number4;
//尝试连接服务器次数
private int number5;
public byte getVersion() {
return version;
}
public void setVersion(byte version) {
this.version = version;
}
public short getYear() {
return year;
}
public void setYear(short year) {
this.year = year;
}
public byte getMonth() {
return month;
}
public void setMonth(byte month) {
this.month = month;
}
public byte getDay() {
return day;
}
public void setDay(byte day) {
this.day = day;
}
public int getNumber1() {
return number1;
}
public void setNumber1(int number1) {
this.number1 = number1;
}
public int getNumber2() {
return number2;
}
public void setNumber2(int number2) {
this.number2 = number2;
}
public int getNumber3() {
return number3;
}
public void setNumber3(int number3) {
this.number3 = number3;
}
public int getNumber4() {
return number4;
}
public void setNumber4(int number4) {
this.number4 = number4;
}
public int getNumber5() {
return number5;
}
public void setNumber5(int number5) {
this.number5 = number5;
}
}
@@ -0,0 +1,51 @@
/*
* 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.socket.model.send;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 温度报警工作模式和温度指令22字节(17字节头+5字节)
*
* @author guogw
*
*/
public class TemperatureAlarmLength22 extends HeadModel implements Serializable {
private static final long serialVersionUID = -6712376303551767331L;
//报警温度类型,0是低温报警,1是高温报警
private byte warn_type;
//当前设备温度
private short wendu;
//报警温度
private short warn_wendu;
public byte getWarn_type() {
return warn_type;
}
public void setWarn_type(byte warn_type) {
this.warn_type = warn_type;
}
public short getWendu() {
return wendu;
}
public void setWendu(short wendu) {
this.wendu = wendu;
}
public short getWarn_wendu() {
return warn_wendu;
}
public void setWarn_wendu(short warn_wendu) {
this.warn_wendu = warn_wendu;
}
}
@@ -0,0 +1,51 @@
/*
* 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.socket.model.send;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 设置报警温度开关指令22字节(17字节头+5字节)
*
* @author guogw
*
*/
public class TemperatureSwitchLength22 extends HeadModel implements Serializable {
private static final long serialVersionUID = -6712376303551767331L;
//开启关闭报警,00关,01开,02设置温度
private byte onoff;
//报警温度
private short low_wendu;
//报警温度
private short hight_wendu;
public byte getOnoff() {
return onoff;
}
public void setOnoff(byte onoff) {
this.onoff = onoff;
}
public short getLow_wendu() {
return low_wendu;
}
public void setLow_wendu(short low_wendu) {
this.low_wendu = low_wendu;
}
public short getHight_wendu() {
return hight_wendu;
}
public void setHight_wendu(short hight_wendu) {
this.hight_wendu = hight_wendu;
}
}
@@ -0,0 +1,41 @@
/*
* 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.socket.model.send;
import com.ifish.socket.model.HeadModel;
import java.io.Serializable;
/**
* 升级命令78字节(17字节头+61字节)
*
* @author guogw
*
*/
public class UpgradeVersionLength78 extends HeadModel implements Serializable {
private static final long serialVersionUID = 3696291654504951296L;
//版本
private byte version;
//地址
private byte[] address = new byte[60];
public byte getVersion() {
return version;
}
public void setVersion(byte version) {
this.version = version;
}
public byte[] getAddress() {
return address;
}
public void setAddress(byte[] address) {
this.address = address;
}
}
@@ -0,0 +1,54 @@
/*
* 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.socket.webService;
import com.ifish.socket.config.SomeServer;
import com.ifish.socket.model.OrderModel;
import com.ifish.socket.model.send.UpgradeVersionLength78;
import com.ifish.util.ByteUtil;
import javax.jws.WebService;
import org.apache.mina.core.session.IoSession;
/**
*
* @author Administrator
*/
@WebService
public class MyService {
//查询设备是否在线
public boolean deviceIsOnline(String macAddress) {
if (macAddress != null && macAddress.length() > 0) {
IoSession session = SomeServer.sessions_cz.get(macAddress);
if (session != null) {
if (session.getRemoteAddress() != null) {
return true;
}
}
}
return false;
}
//查询在线设备数量
public Integer getLineDeviceNumber() {
return SomeServer.sessions_cz.size();
}
//在线升级
public boolean onlineUpgrade(String macAddress, Integer upgradeVersion) {
if (macAddress != null && macAddress.length() > 0 && upgradeVersion != null) {
IoSession session = SomeServer.sessions_cz.get(macAddress);
if (session != null) {
if (session.getRemoteAddress() != null) {
UpgradeVersionLength78 model = OrderModel.UpgradeVersionLength78(ByteUtil.hexStringToBytes2(macAddress), upgradeVersion);
session.write(model);
return true;
}
}
}
return false;
}
}
@@ -0,0 +1,19 @@
/*
* 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.socket.webService;
import javax.xml.ws.Endpoint;
/**
*
* @author Administrator
*/
public class ServiceBean {
public ServiceBean() {
Endpoint.publish("http://localhost:9001/Service/webService", new MyService());
}
}
+196
View File
@@ -0,0 +1,196 @@
package com.ifish.util;
import com.ifish.socket.model.DeviceResponseLength99;
import java.util.Calendar;
import org.apache.mina.core.buffer.IoBuffer;
import org.json.JSONException;
import org.json.JSONObject;
public class ByteUtil {
/**
* 将IoBuffer转换成byte
*
* @param str
*/
public static byte[] ioBufferToByte(IoBuffer ioBuffer) {
byte[] b = new byte[ioBuffer.limit()];
ioBuffer.get(b, 0, b.length);
return b;
}
/**
* 将byte[]转换成IoBuffer
*
* @param str
*/
public static IoBuffer byteToIoBuffer(byte[] bt, int length) {
IoBuffer ioBuffer = IoBuffer.allocate(100).setAutoExpand(true);
//ioBuffer.order(ByteOrder.LITTLE_ENDIAN);// 修改此缓冲区的字节顺大端模式
ioBuffer.put(bt, 0, length);
ioBuffer.flip();
return ioBuffer;
}
/**
* 16进制字节数组转16进制字符
*
* @param hexString
* @return byte[]
*/
public static String bytesToHexString(byte[] src) {
StringBuilder stringBuilder = new StringBuilder();
if (src == null || src.length <= 0) {
return null;
}
for (int i = 0; i < src.length; i++) {
int v = src[i] & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
stringBuilder.append(0);
}
stringBuilder.append(hv);
}
return stringBuilder.toString();
}
/**
* 16进制字符串转换成字节数组(带空格)
*
* @param hexString
* @return byte[]
*/
public static byte[] hexStringToBytes(String hexString) {
hexString = hexString.toLowerCase();
String[] hexStrings = hexString.split(" ");
byte[] bytes = new byte[hexStrings.length];
for (int i = 0; i < hexStrings.length; i++) {
char[] hexChars = hexStrings[i].toCharArray();
bytes[i] = (byte) (charToByte(hexChars[0]) << 4 | charToByte(hexChars[1]));
}
return bytes;
}
private static byte charToByte(char c) {
return (byte) "0123456789abcdef".indexOf(c);
}
/**
* 16进制字符串转换成字节数组(不带空格)
*
* @param hexString
* @return byte[]
*/
public static byte[] hexStringToBytes2(String hex) {
hex = hex.toLowerCase();
int len = (hex.length() / 2);
byte[] result = new byte[len];
char[] achar = hex.toCharArray();
for (int i = 0; i < len; i++) {
int pos = i * 2;
result[i] = (byte) (charToByte(achar[pos]) << 4 | charToByte(achar[pos + 1]));
}
return result;
}
/**
* 把byte 转化为两位十六进制数
*
* @param b
* @return
*/
public static String toHex(byte b) {
String result = Integer.toHexString(b & 0xFF);
if (result.length() == 1) {
result = '0' + result;
}
return result;
}
/**
* 当前16进制时间
*
* @return
*/
public static byte[] hexSysTime() {
Calendar calendar = Calendar.getInstance();
String hexYear = String.format("%04x", calendar.get(Calendar.YEAR));
String hexMonth = String.format("%02x", (calendar.get(Calendar.MONTH) + 1));
String hexDate = String.format("%02x", calendar.get(Calendar.DATE));
String hexHours = String.format("%02x", calendar.get(Calendar.HOUR_OF_DAY));
String hexMinutes = String.format("%02x", calendar.get(Calendar.MINUTE));
String hexSeconds = String.format("%02x", calendar.get(Calendar.SECOND));
int hexDay = calendar.get(Calendar.DAY_OF_WEEK);
String dayOfWeek = String.format("%02x", hexDay == 1 ? 7 : hexDay - 1);
byte[] sysTime = hexStringToBytes2(hexYear + hexMonth + hexDate + hexHours + hexMinutes + hexSeconds + dayOfWeek);
return sysTime;
}
/**
* 将byte定时器转换成String
*
* @param str
*/
public static String BytesToTimer(byte[] bys) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < bys.length; i++) {
if (i == 1) {
s.append(String.format("%02d", (int) bys[i]) + "-");
} else if (i == 3) {
s.append(String.format("%02d", (int) bys[i]));
} else {
s.append(String.format("%02d", (int) bys[i]) + ":");
}
}
return s.toString();
}
/**
* 设备信息
*
* @return
*/
public static String formatDeviceInfo(DeviceResponseLength99 model) {
String macAddress = ByteUtil.bytesToHexString(model.getSrc());
String wendu = (float) model.getWendu() / 10f + "";
String low_wendu = (float) model.getLow_wendu() / 10f + "";
String height_wendu = (float) model.getHigh_wendu() / 10f + "";
String warn_onoff = String.valueOf(model.getWarn_onoff());
String onff1 = String.valueOf(model.getOnoff1());
String onff2 = String.valueOf(model.getOnoff2());
String onff3 = String.valueOf(model.getOnoff3());
String timer_time1 = BytesToTimer(model.getTimer_time1());
String timer_time2 = BytesToTimer(model.getTimer_time2());
String timer_time3 = BytesToTimer(model.getTimer_time3());
String timer_time4 = BytesToTimer(model.getTimer_time4());
String timer_time5 = BytesToTimer(model.getTimer_time5());
String timer_time6 = BytesToTimer(model.getTimer_time6());
String timer_time7 = BytesToTimer(model.getTimer_time7());
String timer_time8 = BytesToTimer(model.getTimer_time8());
String timer_time9 = BytesToTimer(model.getTimer_time9());
JSONObject json = new JSONObject();
try {
json.put("macAddress", macAddress);
json.put("wendu", wendu);
json.put("low_wendu", low_wendu);
json.put("height_wendu", height_wendu);
json.put("warn_onoff", warn_onoff);
json.put("onff1", onff1);
json.put("onff2", onff2);
json.put("onff3", onff3);
json.put("timer_time1", timer_time1);
json.put("timer_time2", timer_time2);
json.put("timer_time3", timer_time3);
json.put("timer_time4", timer_time4);
json.put("timer_time5", timer_time5);
json.put("timer_time6", timer_time6);
json.put("timer_time7", timer_time7);
json.put("timer_time8", timer_time8);
json.put("timer_time9", timer_time9);
} catch (JSONException e) {
e.printStackTrace();
}
return json.toString();
}
}
@@ -0,0 +1,113 @@
/*
* 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.util;
import com.ifish.enums.SubDirectoryEnum;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.Properties;
/**
*
* @author Administrator
*/
public class IfishFilePath {
//头像地址
public static String path_img;
/**
* 图片头地址
*/
public static String link_img_head;
//商家图片地址
public static String path_shops;
//商品介绍图片
public static String path_commodity;
//微信分享页面
public static String path_share_html;
//微信分享页图片
public static String path_share_img;
//看护报告页面
public static String path_look_html;
//看护报告图片
public static String path_look_img;
//html名字
public static String html_name;
//图片上传格式
public static String check_style;
//云信爱鱼奇官方帐号
public static String ifish_account;
//IM官方手机号
public static String netease_phone;
//直播间封面
public static String path_room_img;
//FastDFS商家视频上传URL访问路径(本地和测试环境)
public static String fastDFS_url_local;
//FastDFS商家视频上传URL访问路径(正式环境)
public static String fastDFS_url_app;
//开发模式
public static boolean devModel;
//本机IP
public static String ifiship;
//本机端口
public static int ifishport;
static {
Properties prop = new Properties();
InputStream in = IfishFilePath.class.getResourceAsStream("/property.properties");
try {
prop.load(in);
//利用反射机制给属性赋值
Field[] fields = IfishFilePath.class.getDeclaredFields();
for (Field field : fields) {
String name = field.getName();
//获取property.properties的值
String value = prop.getProperty(name).trim();
//判断这个值希望塞入的变量类型,并进行转换
Object value1 = getValue(value, field);
//转换完成后塞入此变量
field.set(IfishFilePath.class, value1);
}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 验证图片格式
*/
public static String checkImgName(String fileName) {
//对格式进行验证
int index = fileName.lastIndexOf(".");
String extEndName = fileName.substring(++index, fileName.length());
if (check_style.indexOf(extEndName.toUpperCase()) == -1) {
return null;
}
//返回格式.png
return "." + extEndName;
}
/**
* 获取图片链接地址
*
* @param type
* @return
*/
public static String getPath(SubDirectoryEnum pictureEnum, String fileName) {
return link_img_head + pictureEnum.getKey() + fileName;
}
private static Object getValue(String value, Field field) {
if (field.getType().equals(int.class)) {
return Integer.valueOf(value);
} else if (field.getType().equals(boolean.class)) {
return Boolean.valueOf(value);
}
return value;
}
}
+454
View File
@@ -0,0 +1,454 @@
/*
* 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.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.JavaType;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author Administrator
*/
public class IfishUtil {
private static final String formatDate = "yyyy-MM-dd HH:mm:ss";
private static final String formatDate3 = "MM-dd HH:mm";
private static final String formatDate2 = "yyyy-MM-dd HH:mm";
private static final String formatDate1 = "yyyy-MM-dd";
/**
* 测试缓存时间:一分钟;单位:秒
*/
public static final int CacheTime_Test_SECONDS = 60;
/**
* 缓存时间:一秒;单位:秒
*/
public static final int CacheTime_SECONDS = 1;
/**
* 缓存时间:一分钟;单位:分
*/
public static final int CacheTime_MINUTES = 1;
/**
* 缓存时间:一小时;单位:小时
*/
public static final int CacheTime_HOURS = 1;
/**
* 缓存时间:一天;单位:天
*/
public static final int CacheTime_DAYS = 1;
/**
* Object转Json
*/
public static String ObjectToJson(Object value) {
try {
if (value == null) {
return null;
}
ObjectMapper mapper = new ObjectMapper();
String js = mapper.writeValueAsString(value);
return js;
} catch (Exception ex) {
System.out.println("【异常信息】 >>> " + ex.toString());
return "Error";
}
}
/**
* Json转ObjectList
*
* @param json 需要转换的JSON字符串
* @param bean JavaBean,
* @return 拿到结果需要强转一次,因为你拿到的是Object, 例如这样调用和强转: List&lt;School&gt; lst
* =(List&lt;School&gt;)StringUtil.JsonToObjectList(value, School.class);
*/
public static Object JsonToList(String json, Class<?> bean) throws Exception {
ObjectMapper mapper = new ObjectMapper();
JavaType javaType = mapper.getTypeFactory().constructParametricType(List.class, bean);
return mapper.readValue(json, javaType);
}
/**
* Json转ObjectJavaBean
*
* @param json 需要转换的JSON字符串
* @param bean JavaBean,
* @return 拿到结果需要强转一次,因为你拿到的是Object, 例如这样调用和强转: School lst
* =(School)StringUtil.JsonToObjectList(value, School.class);
*/
public static Object JsonToBean(String json, Class<?> bean) throws Exception {
ObjectMapper mapper = new ObjectMapper();
JavaType javaType = mapper.getTypeFactory().uncheckedSimpleType(bean);
return mapper.readValue(json, javaType);
}
/**
* 将json格式的字符串解析成Map对象
*/
public static Map<String, Map<String, String>> JsonToMap(String json) {
try {
ObjectMapper mapper = new ObjectMapper();
Map<String, Map<String, String>> maps = mapper.readValue(json, Map.class);
return maps;
} catch (Exception e) {
System.out.println("【异常信息】 >>> " + e.toString());
return null;
}
}
public static Map<String, Map> JsonToMapContainMap(String json) {
try {
ObjectMapper mapper = new ObjectMapper();
Map<String, Map> maps = mapper.readValue(json, Map.class);
return maps;
} catch (Exception e) {
System.out.println("【异常信息】 >>> " + e.toString());
return null;
}
}
public static Map JsonToRealMap(String json) {
try {
ObjectMapper mapper = new ObjectMapper();
Map maps = mapper.readValue(json, Map.class);
return maps;
} catch (Exception e) {
System.out.println("【异常信息】 >>> " + e.toString());
return null;
}
}
//返回时分秒的时间字符串
public static String TimestampToStringAndSecond(Object timestamp) {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return (format.format(timestamp));
} catch (Exception e) {
System.out.println("【isGaokaoYearExpire 异常】:" + e);
return "";
}
}
//返回时分秒的时间字符串
public static String TimestampToStringAndSecond(Object timestamp, String geshi) {
DateFormat format = new SimpleDateFormat(geshi);
try {
return (format.format(timestamp));
} catch (Exception e) {
System.out.println("【isGaokaoYearExpire 异常】:" + e);
return "";
}
}
/**
* 返回当前日期yyyy-MM-dd
*
* @return
* @throws ParseException
*/
public static Date getCurDate() {
DateFormat df = DateFormat.getDateInstance();
try {
return df.parse(df.format(new Date()));
} catch (ParseException e) {
}
return null;
}
/**
* 格式化日期yyyy-MM-dd HH:mm:ss
*
* @param date
* @return
*/
public static String format(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate);
return format.format(date);
}
/**
* 格式化日期
*
* @param date
* @return
*/
public static String format1(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate1);
return format.format(date);
}
/**
* 格式化日期
*
* @param date
* @return
*/
public static String format2(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate2);
return format.format(date);
}
/**
* 格式化日期
*
* @param date
* @return
*/
public static String format3(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate3);
return format.format(date);
}
/**
* 字符串转换成日期
*
* @param str
* @return date
*/
public static Date StrToDate(String str) {
SimpleDateFormat format = new SimpleDateFormat(formatDate1);
Date date = null;
try {
date = format.parse(str);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
/**
* 随机生成字母与数字组合
*
* @param length
* @return
*/
public static String getCharAndNumr(int length) {
String val = "";
Random random = new Random();
for (int i = 0; i < length; i++) {
// 输出字母还是数字
String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num";
// 字符串
if ("char".equalsIgnoreCase(charOrNum)) {
// 取得大写字母还是小写字母
int choice = random.nextInt(2) % 2 == 0 ? 65 : 97;
val += (char) (choice + random.nextInt(26));
// 数字
} else if ("num".equalsIgnoreCase(charOrNum)) {
val += String.valueOf(random.nextInt(10));
}
}
return val;
}
/**
* 返回json数据
*
* @param str
* @return
*/
public static Map<String, Object> returnJson(String key, Object value) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("result", key);
if (value.equals("")) {
map.put("data", null);
} else {
map.put("data", value);
}
return map;
}
/**
* 返回json数据
*
* @param str
* @return
*/
public static Map<String, Object> toJson(String key, Object value) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("result", key);
if (value.equals("")) {
map.put("data", null);
} else {
map.put("data", value);
}
return map;
}
/**
* 上传图片文件
*
* @param fileUpload
* @param path
* @return
*/
public static String uploadFile(MultipartFile fileUpload, String path) {
//根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileName = String.valueOf(calendar.getTimeInMillis());
//保存文件
if (fileUpload == null) {
return "base/default.png";
}
if (!fileUpload.isEmpty()) {
try {
if (!fileUpload.getOriginalFilename().equals("")) {
File picFile = new File(path, fileName + ".png");
//不存在则创建
if (!picFile.exists()) {
picFile.mkdirs();
}
//保存
fileUpload.transferTo(picFile);
}
return "share/" + fileName + ".png";
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return "";
}
/**
* 生成微信分享页面
*
* @param title
* @param base64
* @return
*/
public static String getHtmlFile(String title, String pngName, String modelFile, String filePath) {
try {
if (pngName != null && !pngName.equals("")) {
//读取模板文件
FileInputStream fileinputstream = new FileInputStream(filePath + modelFile);
int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
String templateContent = new String(bytes);
//替换掉模板中相应的地方
templateContent = templateContent.replaceAll("###title###", title);
templateContent = templateContent.replaceAll("###fileName###", pngName);
//根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileName = String.valueOf(calendar.getTimeInMillis());
fileName = fileName + ".html";
//建立文件输出流
FileOutputStream fileoutputstream = new FileOutputStream(filePath + fileName);
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
return fileName;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return "";
}
/**
* 随即区间整数
*
* @param min
* @param max
* @return
*/
public static int getRandom(int min, int max) {
int r = new Random().nextInt(max - min);
return r + min;
}
/**
* URL 解码
*
* @return String
* @author lifq
* @date 2015-3-17 下午04:09:51
*/
public static String getURLDecoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLDecoder.decode(str, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}
/**
* URL 转码
*
* @return String
* @author lifq
* @date 2015-3-17 下午04:10:28
*/
public static String getURLEncoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLEncoder.encode(str, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}
/**
* 正则表达式截取字符串
*
* @param str
* @param regex
* @return
*/
public static String regex(String str, String regex) {
Matcher matcher = Pattern.compile(regex).matcher(str);
if (matcher.find()) {
return matcher.group(0);
} else {
return "";
}
}
public static String regexToChinese(String str) {
String regex = "([\\u4e00-\\u9fa5]+)";
return regex(str, regex);
}
/**
* 验证当前系统是windows(本地,返回true),还是unix(服务器,返回false)
*
* @return
*/
public static boolean IsWinOrUnix() {
String os = System.getProperty("os.name");//获取当前操作系统
return os.toLowerCase().startsWith("win");
}
}
@@ -0,0 +1,61 @@
/*
* 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.util;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.Properties;
/**
*
* @author Administrator
*/
public class JdbcProperties {
public static String driverClassName;
public static String url;
public static String username;
public static String password;
public static boolean autoCommitOnClose;
public static int initialPoolSize;
public static int minPoolSize;
public static int maxPoolSize;
public static int acquireIncrement;
public static int checkoutTimeout;
public static int maxIdleTime;
public static int idleConnectionTestPeriod;
static {
Properties prop = new Properties();
InputStream in = IfishFilePath.class.getResourceAsStream("/jdbc.properties");
try {
prop.load(in);
//利用反射机制给属性赋值
Field[] fields = JdbcProperties.class.getDeclaredFields();
for (Field field : fields) {
String name = field.getName();
//获取property.properties的值
String value = prop.getProperty(name).trim();
//判断这个值希望塞入的变量类型,并进行转换
Object value1 = getValue(value, field);
//转换完成后塞入此变量
field.set(IfishFilePath.class, value1);
}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private static Object getValue(String value, Field field) {
if (field.getType().equals(int.class)) {
return Integer.valueOf(value);
} else if (field.getType().equals(boolean.class)) {
return Boolean.valueOf(value);
}
return value;
}
}
@@ -0,0 +1,78 @@
/*
* 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.util;
/**
*
* @author Administrator
*/
public class RedisKey {
/**
* 用户缓存前缀
*/
public static final String User_Key = "userE:";
/**
* 商家信息缓存前缀
*/
public static final String ShopsInfo_Key = "shopsInfoE:";
/**
* 用户绑定设备缓存前缀
*/
public static final String DeviceUser_Key = "deviceUserE:";
/**
* 设备绑定摄像头缓存前缀
*/
public static final String DeviceCamera_key = "deviceCameraE:";
/**
* 设备详情缓存前缀
*/
public static final String Device_key = "deviceE:";
/**
* 设备类型缓存前缀
*/
public static final String HardWareType_key = "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:";
}
@@ -0,0 +1,7 @@
connect_timeout = 2
network_timeout = 30
charset = UTF-8
http.tracker_http_port = 85
http.anti_steal_token = no
http.secret_key = FastDFS1234567890
tracker_server = 120.55.190.56:22131
@@ -0,0 +1,8 @@
connect_timeout = 2
network_timeout = 30
charset = UTF-8
http.tracker_http_port = 8017
http.anti_steal_token = no
http.secret_key = FastDFS1234567890
tracker_server = 139.196.24.156:22122
+40
View File
@@ -0,0 +1,40 @@
#c3p0.driverClassName=com.mysql.jdbc.Driver
#c3p0.url=jdbc\:mysql\://localhost\:3306/myfishdbenglish?characterEncoding\=UTF-8
#c3p0.username=ifish
#c3p0.password=ifish7pwd
#c3p0.autoCommitOnClose=true
#c3p0.initialPoolSize=20
#c3p0.minPoolSize=20
#c3p0.maxPoolSize=50
#c3p0.acquireIncrement=3
#c3p0.checkoutTimeout=5000
#c3p0.maxIdleTime=7200
#c3p0.idleConnectionTestPeriod=18000
#c3p0.maxIdleTimeExcessConnections=1800
#c3p0.automaticTestTable=C3P0TestTable
#c3p0.testConnectionOnCheckout=false
#c3p0.testConnectionOnCheckin=false
#\u8fd9\u91cc\u662f\u4e0a\u9762\u53d6\u6d88\u524d\u7f00\u7684\u5f15\u7528,\u5982\u679c\u4fee\u6539\uff0c\u8bf7\u4fee\u6539\u8fd9\u91cc
driverClassName=com.mysql.jdbc.Driver
url=jdbc\:mysql\://localhost\:3306/myfishdbenglish?characterEncoding\=UTF-8
username=ifish
password=ifish7pwd
autoCommitOnClose=true
initialPoolSize=20
minPoolSize=20
maxPoolSize=50
acquireIncrement=3
checkoutTimeout=5000
maxIdleTime=7200
idleConnectionTestPeriod=18000
#org.hibernate.dialect.MySQLInnoDBDialect
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.hbm2ddl.auto=false
hibernate.jdbc.batch_size=50
hibernate.query.substitutions=true 1,false 0
+44
View File
@@ -0,0 +1,44 @@
#\u5934\u50cf\u5b58\u50a8\u8def\u5f84
path_img=/mydata/tmp/Img/app
#\u5546\u5bb6\u8ba4\u8bc1\u56fe\u7247
path_shops=/mydata/tmp/Img/shops
#\u5546\u54c1\u4ecb\u7ecd\u56fe\u7247
path_commodity=/mydata/tmp/Img/commodity
#\u76f4\u64ad\u95f4\u5c01\u9762
path_room_img=/mydata/tmp/Img/room
#\u5fae\u4fe1\u5206\u4eab\u9875\u9762
path_share_html=/mydata/tmp/html/
#\u5fae\u4fe1\u5206\u4eab\u9875\u56fe\u7247
path_share_img=/mydata/tmp/html/images/share
#\u770b\u62a4\u62a5\u544a\u9875\u9762
path_look_html=/mydata/tmp/look/
#\u770b\u62a4\u62a5\u544a\u56fe\u7247
path_look_img=/mydata/tmp/look/images/share
#\u770b\u62a4\u62a5\u544a\u6a21\u7248html\u540d\u5b57
html_name=index.html
#\u4e91\u4fe1\u7231\u9c7c\u5947\u5b98\u65b9\u5e10\u53f7
ifish_account=ifish
#IM\u5b98\u65b9\u624b\u673a\u53f7
netease_phone=18501773036
#FastDFS\u6587\u4ef6URL\u8bbf\u95ee\u8def\u5f84(\u672c\u5730\u548c\u6d4b\u8bd5\u73af\u5883)
fastDFS_url_local=https://app.zhangxinyanv5.top/
#FastDFS\u6587\u4ef6URL\u8bbf\u95ee\u8def\u5f84(\u6b63\u5f0f\u73af\u5883)
fastDFS_url_app=http://app.ifish7.com/
#\u672c\u5730
#link_img_head=http://192.168.61.128:81/
#\u6d4b\u8bd5\u73af\u5883
#link_img_head=https://app.zhangxinyanv5.top/
#\u6b63\u5f0f\u73af\u5883
link_img_head=https://app.ifish7.com/
#\u56fe\u7247\u683c\u5f0f\u9a8c\u8bc1
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
devModel=true
#\u672c\u5730
ifiship=192.168.199.129
#\u6d4b\u8bd5\u4e91
#ifiship=139.196.24.156
#\u6b63\u5f0f\u4e91
#ifiship=120.55.190.56
#\u670d\u52a1\u5668\u7aef\u53e3
ifishport=9956
+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/IfishSocketEnglish"/>
+13
View File
@@ -0,0 +1,13 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Socket</title>
</head>
<body>
<h1 style="text-align: center">访问正常!</h1>
</body>
</html>