From c56f07a61741c5a83991fe8708c25b67ab95203f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B0=A2=E6=B4=AA=E9=BE=99?= <599179587@qq.com>
Date: Wed, 5 Jul 2017 09:56:34 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
nb-configuration.xml | 19 +
pom.xml | 213 ++++++
.../java/com/ifish/API/CheckSumBuilder.java | 51 ++
src/main/java/com/ifish/API/GwellApi.java | 225 +++++++
src/main/java/com/ifish/API/JiGuangPush.java | 14 +
src/main/java/com/ifish/API/Mail.java | 206 ++++++
.../ifish/Interceptor/CheckSumBuilder.java | 52 ++
.../com/ifish/Interceptor/IfishException.java | 28 +
.../SecurityValidateInterceptor.java | 79 +++
.../java/com/ifish/bean/LiveRoomPageInfo.java | 209 ++++++
src/main/java/com/ifish/bean/PageResult.java | 88 +++
.../java/com/ifish/bean/Tbl_Activa_Code.java | 127 ++++
src/main/java/com/ifish/bean/Tbl_Device.java | 508 ++++++++++++++
.../com/ifish/bean/Tbl_Device_Statistics.java | 630 ++++++++++++++++++
.../java/com/ifish/bean/Tbl_Device_User.java | 293 ++++++++
.../com/ifish/bean/Tbl_HardWare_Type.java | 437 ++++++++++++
.../java/com/ifish/bean/Tbl_Live_Message.java | 231 +++++++
.../java/com/ifish/bean/Tbl_Live_Room.java | 317 +++++++++
.../java/com/ifish/bean/Tbl_Push_List.java | 465 +++++++++++++
src/main/java/com/ifish/bean/Tbl_User.java | 557 ++++++++++++++++
src/main/java/com/ifish/bean/Tbl_Vender.java | 270 ++++++++
.../java/com/ifish/config/MybatisConfig.java | 86 +++
.../java/com/ifish/config/RedisConfig.java | 58 ++
.../java/com/ifish/config/RootConfig.java | 26 +
.../com/ifish/config/WebAppInitializer.java | 46 ++
src/main/java/com/ifish/config/WebConfig.java | 71 ++
.../java/com/ifish/controller/Device.java | 142 ++++
src/main/java/com/ifish/controller/Index.java | 23 +
.../java/com/ifish/controller/LiveRoom.java | 107 +++
src/main/java/com/ifish/controller/Login.java | 46 ++
.../com/ifish/controller/PushMessage.java | 65 ++
src/main/java/com/ifish/enums/GwellEnum.java | 41 ++
.../java/com/ifish/enums/PushTypeEnum.java | 58 ++
src/main/java/com/ifish/enums/ResultEnum.java | 66 ++
.../com/ifish/enums/SubDirectoryEnum.java | 45 ++
.../java/com/ifish/helper/DeviceHelper.java | 592 ++++++++++++++++
.../java/com/ifish/helper/DeviceHelperI.java | 124 ++++
.../java/com/ifish/helper/FastDFSClient.java | 145 ++++
.../java/com/ifish/helper/FastDFSClientI.java | 55 ++
.../com/ifish/helper/HardWareTypeHelper.java | 66 ++
.../com/ifish/helper/HardWareTypeHelperI.java | 34 +
.../java/com/ifish/helper/LiveRoomHelper.java | 429 ++++++++++++
.../com/ifish/helper/LiveRoomHelperI.java | 62 ++
.../com/ifish/helper/PushMessageHelper.java | 110 +++
.../com/ifish/helper/PushMessageHelperI.java | 33 +
.../java/com/ifish/helper/RedisHelper.java | 172 +++++
.../java/com/ifish/helper/RedisHelperI.java | 69 ++
.../java/com/ifish/helper/UserHelper.java | 473 +++++++++++++
.../java/com/ifish/helper/UserHelperI.java | 53 ++
.../com/ifish/mapper/Tbl_Device_Mapper.java | 199 ++++++
.../ifish/mapper/Tbl_Device_MapperSql.java | 269 ++++++++
.../mapper/Tbl_Hardware_Type_Mapper.java | 38 ++
.../ifish/mapper/Tbl_Live_Room_Mapper.java | 112 ++++
.../ifish/mapper/Tbl_Push_List_Mapper.java | 63 ++
.../ifish/mapper/Tbl_Push_List_MapperSql.java | 30 +
.../com/ifish/mapper/Tbl_User_Mapper.java | 79 +++
.../com/ifish/mapper/Tbl_User_MapperSql.java | 101 +++
.../java/com/ifish/util/IfishFilePath.java | 109 +++
src/main/java/com/ifish/util/IfishUtil.java | 470 +++++++++++++
.../java/com/ifish/util/JdbcProperties.java | 61 ++
src/main/java/com/ifish/util/RedisKey.java | 73 ++
src/main/resources/fdfs_client_ifish7.conf | 7 +
.../resources/fdfs_client_zhangxinyanv5.conf | 8 +
src/main/resources/jdbc.properties | 40 ++
src/main/resources/property.properties | 36 +
src/main/webapp/META-INF/context.xml | 2 +
.../WEB-INF/lib/fastdfs-client-java-1.25.jar | Bin 0 -> 91061 bytes
src/main/webapp/index.jsp | 13 +
69 files changed, 10027 insertions(+)
create mode 100644 .gitignore
create mode 100644 nb-configuration.xml
create mode 100644 pom.xml
create mode 100644 src/main/java/com/ifish/API/CheckSumBuilder.java
create mode 100644 src/main/java/com/ifish/API/GwellApi.java
create mode 100644 src/main/java/com/ifish/API/JiGuangPush.java
create mode 100644 src/main/java/com/ifish/API/Mail.java
create mode 100644 src/main/java/com/ifish/Interceptor/CheckSumBuilder.java
create mode 100644 src/main/java/com/ifish/Interceptor/IfishException.java
create mode 100644 src/main/java/com/ifish/Interceptor/SecurityValidateInterceptor.java
create mode 100644 src/main/java/com/ifish/bean/LiveRoomPageInfo.java
create mode 100644 src/main/java/com/ifish/bean/PageResult.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Activa_Code.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Device.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Device_Statistics.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Device_User.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_HardWare_Type.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Live_Message.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Live_Room.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Push_List.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_User.java
create mode 100644 src/main/java/com/ifish/bean/Tbl_Vender.java
create mode 100644 src/main/java/com/ifish/config/MybatisConfig.java
create mode 100644 src/main/java/com/ifish/config/RedisConfig.java
create mode 100644 src/main/java/com/ifish/config/RootConfig.java
create mode 100644 src/main/java/com/ifish/config/WebAppInitializer.java
create mode 100644 src/main/java/com/ifish/config/WebConfig.java
create mode 100644 src/main/java/com/ifish/controller/Device.java
create mode 100644 src/main/java/com/ifish/controller/Index.java
create mode 100644 src/main/java/com/ifish/controller/LiveRoom.java
create mode 100644 src/main/java/com/ifish/controller/Login.java
create mode 100644 src/main/java/com/ifish/controller/PushMessage.java
create mode 100644 src/main/java/com/ifish/enums/GwellEnum.java
create mode 100644 src/main/java/com/ifish/enums/PushTypeEnum.java
create mode 100644 src/main/java/com/ifish/enums/ResultEnum.java
create mode 100644 src/main/java/com/ifish/enums/SubDirectoryEnum.java
create mode 100644 src/main/java/com/ifish/helper/DeviceHelper.java
create mode 100644 src/main/java/com/ifish/helper/DeviceHelperI.java
create mode 100644 src/main/java/com/ifish/helper/FastDFSClient.java
create mode 100644 src/main/java/com/ifish/helper/FastDFSClientI.java
create mode 100644 src/main/java/com/ifish/helper/HardWareTypeHelper.java
create mode 100644 src/main/java/com/ifish/helper/HardWareTypeHelperI.java
create mode 100644 src/main/java/com/ifish/helper/LiveRoomHelper.java
create mode 100644 src/main/java/com/ifish/helper/LiveRoomHelperI.java
create mode 100644 src/main/java/com/ifish/helper/PushMessageHelper.java
create mode 100644 src/main/java/com/ifish/helper/PushMessageHelperI.java
create mode 100644 src/main/java/com/ifish/helper/RedisHelper.java
create mode 100644 src/main/java/com/ifish/helper/RedisHelperI.java
create mode 100644 src/main/java/com/ifish/helper/UserHelper.java
create mode 100644 src/main/java/com/ifish/helper/UserHelperI.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_Device_Mapper.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_Device_MapperSql.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_Hardware_Type_Mapper.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_Live_Room_Mapper.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_Push_List_Mapper.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_Push_List_MapperSql.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_User_Mapper.java
create mode 100644 src/main/java/com/ifish/mapper/Tbl_User_MapperSql.java
create mode 100644 src/main/java/com/ifish/util/IfishFilePath.java
create mode 100644 src/main/java/com/ifish/util/IfishUtil.java
create mode 100644 src/main/java/com/ifish/util/JdbcProperties.java
create mode 100644 src/main/java/com/ifish/util/RedisKey.java
create mode 100644 src/main/resources/fdfs_client_ifish7.conf
create mode 100644 src/main/resources/fdfs_client_zhangxinyanv5.conf
create mode 100644 src/main/resources/jdbc.properties
create mode 100644 src/main/resources/property.properties
create mode 100644 src/main/webapp/META-INF/context.xml
create mode 100644 src/main/webapp/WEB-INF/lib/fastdfs-client-java-1.25.jar
create mode 100644 src/main/webapp/index.jsp
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c8b241f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+target/*
\ No newline at end of file
diff --git a/nb-configuration.xml b/nb-configuration.xml
new file mode 100644
index 0000000..99174dc
--- /dev/null
+++ b/nb-configuration.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+ 1.6-web
+ Tomcat
+
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..989defd
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,213 @@
+
+ 4.0.0
+
+ com.ifish
+ ifish_english
+ 1.0-SNAPSHOT
+ war
+
+ ifish_english
+
+
+ ${project.build.directory}/endorsed
+ UTF-8
+
+
+
+
+ org.csource
+ fastdfs-client-java
+ 1.25
+ system
+ ${basedir}/src/main/webapp/WEB-INF/lib/fastdfs-client-java-1.25.jar
+
+
+ cn.jpush.api
+ jpush-client
+ 3.2.17
+
+
+ org.apache.commons
+ commons-lang3
+ 3.5
+ jar
+
+
+ org.codehaus.jackson
+ jackson-mapper-asl
+ 1.9.13
+ jar
+
+
+ com.alibaba
+ fastjson
+ 1.2.28
+ jar
+
+
+ org.springframework.data
+ spring-data-redis
+ 1.8.4.RELEASE
+ jar
+
+
+ org.apache.commons
+ commons-pool2
+ 2.4.2
+ jar
+
+
+ redis.clients
+ jedis
+ 2.9.0
+ jar
+
+
+ c3p0
+ c3p0
+ 0.9.1.2
+ jar
+
+
+ javax
+ javaee-web-api
+ 6.0
+ provided
+
+
+
+ org.springframework
+ spring-context
+ 4.3.9.RELEASE
+
+
+
+ org.springframework
+ spring-beans
+ 4.3.9.RELEASE
+
+
+
+ org.springframework
+ spring-core
+ 4.3.9.RELEASE
+
+
+
+ org.springframework
+ spring-web
+ 4.3.9.RELEASE
+
+
+
+ org.springframework
+ spring-webmvc
+ 4.3.8.RELEASE
+ jar
+
+
+
+ org.springframework
+ spring-jdbc
+ 4.3.9.RELEASE
+
+
+
+ org.mybatis
+ mybatis
+ 3.4.4
+
+
+
+ org.mybatis
+ mybatis-spring
+ 1.3.1
+
+
+ cn.jpush.api
+ jiguang-common
+ 1.0.3
+
+
+ io.netty
+ netty-all
+ 4.1.6.Final
+ compile
+
+
+ com.google.code.gson
+ gson
+ 2.3
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.13
+ jar
+
+
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.7.7
+
+
+ log4j
+ log4j
+ 1.2.17
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+ ${endorsed.dir}
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 2.1.1
+
+ false
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.1
+
+
+ validate
+
+ copy
+
+
+ ${endorsed.dir}
+ true
+
+
+ javax
+ javaee-endorsed-api
+ 6.0
+ jar
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/ifish/API/CheckSumBuilder.java b/src/main/java/com/ifish/API/CheckSumBuilder.java
new file mode 100644
index 0000000..5494209
--- /dev/null
+++ b/src/main/java/com/ifish/API/CheckSumBuilder.java
@@ -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.API;
+
+import java.security.MessageDigest;
+
+/**
+ *
+ * @author Administrator
+ */
+public class CheckSumBuilder {
+
+ // 计算并获取CheckSum
+ public static String getCheckSum(String appSecret, String nonce, String curTime) {
+ return encode("sha1", appSecret + nonce + curTime);
+ }
+
+ // 计算并获取md5值
+ public static String getMD5(String requestBody) {
+ return encode("md5", requestBody);
+ }
+
+ private static String encode(String algorithm, String value) {
+ if (value == null) {
+ return null;
+ }
+ try {
+ MessageDigest messageDigest
+ = MessageDigest.getInstance(algorithm);
+ messageDigest.update(value.getBytes());
+ return getFormattedText(messageDigest.digest());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static String getFormattedText(byte[] bytes) {
+ int len = bytes.length;
+ StringBuilder buf = new StringBuilder(len * 2);
+ for (int j = 0; j < len; j++) {
+ buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+ buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+ }
+ return buf.toString();
+ }
+
+ private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+}
diff --git a/src/main/java/com/ifish/API/GwellApi.java b/src/main/java/com/ifish/API/GwellApi.java
new file mode 100644
index 0000000..690505b
--- /dev/null
+++ b/src/main/java/com/ifish/API/GwellApi.java
@@ -0,0 +1,225 @@
+/*
+ * 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.API;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.ifish.enums.GwellEnum;
+
+/**
+ *
+ * @author Administrator
+ */
+public class GwellApi {
+
+ private static Logger log = LoggerFactory.getLogger(GwellApi.class);
+
+ /**
+ * 注册
+ *
+ * @param phoneNumber
+ * @return
+ */
+ public static Map Register(String phoneNumber) {
+ String email = getEmail(phoneNumber);
+ String pwd = getPwd(phoneNumber);
+ Map map = new HashMap();
+ URL url = null;
+ HttpURLConnection httpurlconnection = null;
+ try {
+ if (url == null) {
+ url = new URL("http://api1.cloudlinks.cn/Users/RegisterCheck.ashx");
+ }
+ if (httpurlconnection == null) {
+ //以post方式请求
+ httpurlconnection = (HttpURLConnection) url.openConnection();
+ httpurlconnection.setReadTimeout(30000);
+ httpurlconnection.setConnectTimeout(30000);
+ //是否输入参数
+ httpurlconnection.setDoOutput(true);
+ //提交模式
+ httpurlconnection.setRequestMethod("POST");
+ }
+ StringBuffer params = new StringBuffer();
+ params.append("Email=" + email + "&");
+ params.append("Pwd=" + pwd + "&");
+ params.append("RePwd=" + pwd + "&");
+ params.append("VersionFlag=1&");
+ params.append("CountryCode=&");
+ params.append("IgnoreSafeWarning=1");
+ OutputStream out = httpurlconnection.getOutputStream();
+ out.write(params.toString().getBytes());
+ out.flush();
+ out.close();
+ //获取响应代码
+ int code = httpurlconnection.getResponseCode();
+ if (code == 200) {
+ //获取页面内容
+ InputStream in = httpurlconnection.getInputStream();
+ BufferedReader breader = new BufferedReader(new InputStreamReader(in, "utf-8"));
+ String jsonStr = "";
+ String str = breader.readLine();
+ while (str != null) {
+ jsonStr += str;
+ str = breader.readLine();
+ }
+ breader.close();
+ in.close();
+ //System.out.println(jsonStr);
+ JSONObject json = JSON.parseObject(jsonStr);
+ String error_code = json.getString("error_code");
+ //注册成功
+ if (error_code.equals("0")) {
+ String P2PVerifyCode1 = json.getString("P2PVerifyCode1");
+ String P2PVerifyCode2 = json.getString("P2PVerifyCode2");
+ String UserID = json.getString("UserID");
+ map.put("result", GwellEnum.success.getKey());
+ map.put("P2PVerifyCode1", P2PVerifyCode1);
+ map.put("P2PVerifyCode2", P2PVerifyCode2);
+ map.put("UserID", UserID);
+ return map;
+ } //邮箱已被注册
+ else if (error_code.equals("7")) {
+ String error = json.getString("error");
+ map.put("result", GwellEnum.repeat.getKey());
+ map.put("error", error);
+ } //失败
+ else if (error_code.equals("1")) {
+ //发送邮件
+ Mail.send(phoneNumber + "注册技威失败了", "注册技威失败!错误信息:" + jsonStr);
+ String error = json.getString("error");
+ map.put("result", GwellEnum.fail.getKey());
+ map.put("error", error);
+ return map;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error(e.toString());
+ } finally {
+ if (httpurlconnection != null) {
+ httpurlconnection.disconnect();
+ }
+ }
+ return map;
+ }
+
+ /**
+ * 登陆
+ *
+ * @param phoneNumber
+ * @return
+ */
+ public static Map Login(String phoneNumber) {
+ String email = getEmail(phoneNumber);
+ String pwd = getPwd(phoneNumber);
+ Map map = new HashMap();
+ URL url = null;
+ HttpURLConnection httpurlconnection = null;
+ try {
+ if (url == null) {
+ url = new URL("http://api1.cloudlinks.cn/Users/LoginCheck.ashx");
+ }
+ if (httpurlconnection == null) {
+ //以post方式请求
+ httpurlconnection = (HttpURLConnection) url.openConnection();
+ httpurlconnection.setReadTimeout(30000);
+ httpurlconnection.setConnectTimeout(30000);
+ //是否输入参数
+ httpurlconnection.setDoOutput(true);
+ //提交模式
+ httpurlconnection.setRequestMethod("POST");
+ }
+ StringBuffer params = new StringBuffer();
+ params.append("User=" + email + "&");
+ params.append("Pwd=" + pwd + "&");
+ params.append("VersionFlag=1&");
+ params.append("AppVersion=3014666&");
+ params.append("AppOS=3");
+ OutputStream out = httpurlconnection.getOutputStream();
+ out.write(params.toString().getBytes());
+ out.flush();
+ out.close();
+ //获取响应代码
+ int code = httpurlconnection.getResponseCode();
+ if (code == 200) {
+ //获取页面内容
+ InputStream in = httpurlconnection.getInputStream();
+ BufferedReader breader = new BufferedReader(new InputStreamReader(in, "utf-8"));
+ String jsonStr = "";
+ String str = breader.readLine();
+ while (str != null) {
+ jsonStr += str;
+ str = breader.readLine();
+ }
+ breader.close();
+ in.close();
+ //System.out.println(jsonStr);
+ JSONObject json = JSON.parseObject(jsonStr);
+ String error_code = json.getString("error_code");
+ if (error_code.equals("0")) {
+ String P2PVerifyCode1 = json.getString("P2PVerifyCode1");
+ String P2PVerifyCode2 = json.getString("P2PVerifyCode2");
+ String UserID = json.getString("UserID");
+ map.put("result", GwellEnum.success.getKey());
+ map.put("P2PVerifyCode1", P2PVerifyCode1);
+ map.put("P2PVerifyCode2", P2PVerifyCode2);
+ map.put("UserID", UserID);
+ return map;
+ } else {
+ String error = json.getString("error");
+ map.put("result", GwellEnum.fail.getKey());
+ map.put("error", error);
+ return map;
+ }
+ }
+ } catch (Exception e) {
+ log.error(e.toString());
+ } finally {
+ if (httpurlconnection != null) {
+ httpurlconnection.disconnect();
+ }
+ }
+ return map;
+ }
+
+ /**
+ * 获取用户名
+ *
+ * @param phoneNumber
+ * @return
+ */
+ public static String getEmail(String phoneNumber) {
+ String email = "ifish7" + phoneNumber + "@ifish7.com";
+ return email;
+ }
+
+ /**
+ * 获取密码
+ *
+ * @param phoneNumber
+ * @return
+ */
+ public static String getPwd(String phoneNumber) {
+ String pwd = CheckSumBuilder.getMD5("ifish" + phoneNumber);
+ return pwd;
+ }
+
+ public static void main(String[] args) {
+ Register("15216102193");
+ }
+
+}
diff --git a/src/main/java/com/ifish/API/JiGuangPush.java b/src/main/java/com/ifish/API/JiGuangPush.java
new file mode 100644
index 0000000..e0d5079
--- /dev/null
+++ b/src/main/java/com/ifish/API/JiGuangPush.java
@@ -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.API;
+
+/**
+ *
+ * @author Administrator
+ */
+public class JiGuangPush {
+
+}
diff --git a/src/main/java/com/ifish/API/Mail.java b/src/main/java/com/ifish/API/Mail.java
new file mode 100644
index 0000000..c3c3f6b
--- /dev/null
+++ b/src/main/java/com/ifish/API/Mail.java
@@ -0,0 +1,206 @@
+/*
+ * 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.API;
+
+import java.util.Properties;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.Multipart;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Administrator
+ */
+public class Mail {
+
+ private MimeMessage mimeMsg; //MIME邮件对象
+ private Session session; //邮件会话对象
+ private Properties props; //系统属性
+ private Multipart mp; //Multipart对象,邮件内容,标题,附件等内容均添加到其中后再生成MimeMessage对象
+ private static boolean needAuth = true;//smtp是否需要认证
+ private static boolean isDebug = false;//是否开启调试
+ //smtp认证用户名和密码
+ private static String smtp = "smtp.qq.com";//SMTP服务器
+ private static String username = "service@ifish7.com";
+ private static String password = "Ifish72015";
+ private static String from = "service@ifish7.com";
+ //private static String to = "fun@ifish7.com";
+ private static String to = "help@ifish7.com";
+ private static Logger log = LoggerFactory.getLogger(Mail.class);
+
+ /**
+ * Constructor
+ *
+ * @param smtp 邮件发送服务器
+ */
+ public Mail(String smtp) {
+ setSmtpHost(smtp);
+ createMimeMessage();
+ }
+
+ /**
+ * 设置邮件发送服务器
+ *
+ * @param hostName String
+ */
+ public void setSmtpHost(String hostName) {
+ if (props == null) {
+ props = System.getProperties(); //获得系统属性对象
+ }
+ //设置SMTP主机
+ props.put("mail.smtp.host", hostName);
+ //设置SMTP是否需要验证
+ props.put("mail.smtp.auth", needAuth);
+ props.put("mail.smtp.starttls.enable", needAuth);
+ }
+
+ /**
+ * 创建MIME邮件对象
+ *
+ * @return
+ */
+ public boolean createMimeMessage() {
+ try {
+ session = Session.getDefaultInstance(props, null); //获得邮件会话对象
+ } catch (Exception e) {
+ log.error("获取邮件会话对象时发生错误!" + e.toString());
+ return false;
+ }
+ try {
+ mimeMsg = new MimeMessage(session); //创建MIME邮件对象
+ mp = new MimeMultipart();
+ return true;
+ } catch (Exception e) {
+ log.error("创建MIME邮件对象失败!" + e.toString());
+ return false;
+ }
+ }
+
+ /**
+ * 设置邮件主题
+ *
+ * @param mailSubject
+ * @return
+ */
+ public boolean setSubject(String mailSubject) {
+ try {
+ mimeMsg.setSubject(mailSubject);
+ return true;
+ } catch (Exception e) {
+ log.error("设置邮件主题失败" + e.toString());
+ return false;
+ }
+ }
+
+ /**
+ * 设置邮件正文
+ *
+ * @param mailBody String
+ */
+ public boolean setBody(String mailBody) {
+ try {
+ BodyPart bp = new MimeBodyPart();
+ bp.setContent(mailBody, "text/html;charset=GBK");
+ mp.addBodyPart(bp);
+ return true;
+ } catch (Exception e) {
+ log.error("设置邮件正文失败" + e.toString());
+ return false;
+ }
+ }
+
+ /**
+ * 设置发信人
+ *
+ * @param from String
+ */
+ public boolean setFrom(String from) {
+ try {
+ mimeMsg.setFrom(new InternetAddress(from)); //设置发信人
+ return true;
+ } catch (Exception e) {
+ log.error("设置发信人失败" + e.toString());
+ return false;
+ }
+ }
+
+ /**
+ * 设置收信人
+ *
+ * @param to String
+ */
+ public boolean setTo(String to) {
+ try {
+ mimeMsg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
+ return true;
+ } catch (Exception e) {
+ log.error("设置收信人失败" + e.toString());
+ return false;
+ }
+ }
+
+ /**
+ * 发送邮件
+ */
+ public boolean sendOut() {
+ try {
+ mimeMsg.setContent(mp);
+ mimeMsg.saveChanges();
+ Session mailSession = Session.getInstance(props, null);
+ mailSession.setDebug(isDebug);
+ Transport transport = mailSession.getTransport("smtp");
+ transport.connect((String) props.get("mail.smtp.host"), username, password);
+ transport.sendMessage(mimeMsg, mimeMsg.getRecipients(Message.RecipientType.TO));
+ //transport.send(mimeMsg);
+ transport.close();
+ return true;
+ } catch (Exception e) {
+ log.error("发送邮件失败" + e.toString());
+ return false;
+ }
+ }
+
+ /**
+ * 调用sendOut方法完成邮件发送
+ *
+ * @param smtp
+ * @param from
+ * @param to
+ * @param subject
+ * @param content
+ * @param username
+ * @param password
+ * @return boolean
+ */
+ public static boolean send(String subject, String content) {
+ Mail theMail = new Mail(smtp);
+
+ if (!theMail.setSubject(subject)) {
+ return false;
+ }
+ if (!theMail.setFrom(from)) {
+ return false;
+ }
+ if (!theMail.setTo(to)) {
+ return false;
+ }
+ if (!theMail.setBody(content)) {
+ return false;
+ }
+ if (!theMail.sendOut()) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/com/ifish/Interceptor/CheckSumBuilder.java b/src/main/java/com/ifish/Interceptor/CheckSumBuilder.java
new file mode 100644
index 0000000..2545bb2
--- /dev/null
+++ b/src/main/java/com/ifish/Interceptor/CheckSumBuilder.java
@@ -0,0 +1,52 @@
+/*
+ * 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.Interceptor;
+
+import java.security.MessageDigest;
+
+/**
+ *
+ * @author Administrator
+ */
+public class CheckSumBuilder {
+
+ // 计算并获取CheckSum
+ public static String getCheckSum(String appSecret, String nonce, String curTime) {
+ return encode("sha1", appSecret + nonce + curTime);
+ }
+
+ // 计算并获取md5值
+ public static String getMD5(String requestBody) {
+ return encode("md5", requestBody);
+ }
+
+ private static String encode(String algorithm, String value) {
+ if (value == null) {
+ return null;
+ }
+ try {
+ MessageDigest messageDigest
+ = MessageDigest.getInstance(algorithm);
+ messageDigest.update(value.getBytes());
+ return getFormattedText(messageDigest.digest());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static String getFormattedText(byte[] bytes) {
+ int len = bytes.length;
+ StringBuilder buf = new StringBuilder(len * 2);
+ for (int j = 0; j < len; j++) {
+ buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+ buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+ }
+ return buf.toString();
+ }
+
+ private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+}
diff --git a/src/main/java/com/ifish/Interceptor/IfishException.java b/src/main/java/com/ifish/Interceptor/IfishException.java
new file mode 100644
index 0000000..a9d5e6a
--- /dev/null
+++ b/src/main/java/com/ifish/Interceptor/IfishException.java
@@ -0,0 +1,28 @@
+/*
+ * 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.Interceptor;
+
+import com.ifish.enums.ResultEnum;
+
+/**
+ *
+ * @author Administrator
+ */
+public class IfishException extends RuntimeException {
+
+ private static final long serialVersionUID = 4182058914725642218L;
+
+ private String result;
+
+ public IfishException(ResultEnum resultEnum) {
+ super(resultEnum.getValue());
+ this.result = resultEnum.getKey();
+ }
+
+ public String getResult() {
+ return result;
+ }
+}
diff --git a/src/main/java/com/ifish/Interceptor/SecurityValidateInterceptor.java b/src/main/java/com/ifish/Interceptor/SecurityValidateInterceptor.java
new file mode 100644
index 0000000..67ef91e
--- /dev/null
+++ b/src/main/java/com/ifish/Interceptor/SecurityValidateInterceptor.java
@@ -0,0 +1,79 @@
+/*
+ * 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.Interceptor;
+
+import com.ifish.enums.ResultEnum;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+/**
+ *
+ * @author Administrator
+ */
+public class SecurityValidateInterceptor extends HandlerInterceptorAdapter {
+
+ public SecurityValidateInterceptor(boolean devModel) {
+ this.devModel = devModel;
+ }
+
+ //appKey(ifishAppKey1)MD5
+ private final String ifishAppKey = "5fc7bdada110e3a6eefd3065b8d8d995";
+ //appSecret(ifishAppSecret1)MD5前12位
+ private final String ifishAppSecret = "9596b393ab0f";
+ //开发模式
+ private boolean devModel = false;
+
+ //不需要验证的url
+ private static List urlList = new ArrayList();
+
+ //添加不需要验证url
+ static {
+ urlList.add("/user/");
+ urlList.add("/updateUser/");
+ urlList.add("/pageList/");
+ urlList.add("/information/v3/findCommentsByUeditorId.do");
+ urlList.add("/information/v3/saveComment.do");
+ }
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
+ //开发模式
+ if (!devModel) {
+
+ String url = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getServletPath();
+ //部分url不需要拦截器进行验证
+ for (String string : urlList) {
+ if (url.contains(string)) {
+ return true;
+ }
+ }
+
+ String nonce = request.getHeader("nonce");
+ String appKey = request.getHeader("appKey");
+ String curTime = request.getHeader("curTime");
+ String checkSum = request.getHeader("checkSum");
+ //校验参数完整性
+ if (StringUtils.isNotBlank(checkSum) && StringUtils.isNotBlank(appKey) && StringUtils.isNotBlank(nonce) && StringUtils.isNotBlank(curTime)) {
+ //校验appKey
+ if (appKey.equals(ifishAppKey)) {
+ //计算md5
+ String md5Sum = CheckSumBuilder.getMD5(ifishAppSecret + nonce + curTime);
+ if (md5Sum.equals(checkSum)) {
+ return true;
+ }
+ }
+ }
+ throw new IfishException(ResultEnum.error400);
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/com/ifish/bean/LiveRoomPageInfo.java b/src/main/java/com/ifish/bean/LiveRoomPageInfo.java
new file mode 100644
index 0000000..be768b4
--- /dev/null
+++ b/src/main/java/com/ifish/bean/LiveRoomPageInfo.java
@@ -0,0 +1,209 @@
+/*
+ * 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.math.BigDecimal;
+import java.util.Date;
+
+/**
+ *
+ * @author Administrator
+ */
+public class LiveRoomPageInfo implements Serializable {
+
+ private static final long serialVersionUID = 2438713198151455034L;
+ //直播间ID
+ private Integer roomId;
+ //用户ID
+ private Integer userId;
+ //用户类型
+ private String userType;
+ //昵称
+ private String nickName;
+ //用户头像
+ private String userImg;
+ //用户最后一次登录时间
+ private Date loginTime;
+ //摄像头ID
+ private String cameraId;
+ //直播间名称
+ private String roomName;
+ //直播宣言
+ private String roomDesc;
+ //人气值
+ private Integer popularityValue;
+ //活跃度
+ private String liveness;
+ //直播天数
+ private Integer numberDays;
+ //距离
+ private Double distance;
+ //创建时间
+ private Date createTime;
+ //评论数
+ private Integer pinglunNum;
+ //点赞数量
+ private Integer zanNum;
+ //是否点过赞
+ private String isZan;
+ //打赏金币数量
+ private BigDecimal totalGoldValue;
+ //等级
+ private Integer gradeNum;
+
+ public Integer getRoomId() {
+ return roomId;
+ }
+
+ public void setRoomId(Integer roomId) {
+ this.roomId = roomId;
+ }
+
+ public String getNickName() {
+ return nickName;
+ }
+
+ public void setNickName(String nickName) {
+ this.nickName = nickName;
+ }
+
+ public String getCameraId() {
+ return cameraId;
+ }
+
+ public void setCameraId(String cameraId) {
+ this.cameraId = cameraId;
+ }
+
+ public String getRoomName() {
+ return roomName;
+ }
+
+ public void setRoomName(String roomName) {
+ this.roomName = roomName;
+ }
+
+ public String getRoomDesc() {
+ return roomDesc;
+ }
+
+ public void setRoomDesc(String roomDesc) {
+ this.roomDesc = roomDesc;
+ }
+
+ public Integer getPopularityValue() {
+ return popularityValue;
+ }
+
+ public void setPopularityValue(Integer popularityValue) {
+ this.popularityValue = popularityValue;
+ }
+
+ public Integer getNumberDays() {
+ return numberDays;
+ }
+
+ public void setNumberDays(Integer numberDays) {
+ this.numberDays = numberDays;
+ }
+
+ public Double getDistance() {
+ return distance;
+ }
+
+ public void setDistance(Double distance) {
+ this.distance = distance;
+ }
+
+ public String getUserImg() {
+ return userImg;
+ }
+
+ public void setUserImg(String userImg) {
+ this.userImg = userImg;
+ }
+
+ public String getLiveness() {
+ return liveness;
+ }
+
+ public void setLiveness(String liveness) {
+ this.liveness = liveness;
+ }
+
+ public Date getLoginTime() {
+ return loginTime;
+ }
+
+ public void setLoginTime(Date loginTime) {
+ this.loginTime = loginTime;
+ }
+
+ public Integer getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Integer userId) {
+ this.userId = userId;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public String getUserType() {
+ return userType;
+ }
+
+ public void setUserType(String userType) {
+ this.userType = userType;
+ }
+
+ public Integer getPinglunNum() {
+ return pinglunNum;
+ }
+
+ public void setPinglunNum(Integer pinglunNum) {
+ this.pinglunNum = pinglunNum;
+ }
+
+ public String getIsZan() {
+ return isZan;
+ }
+
+ public void setIsZan(String isZan) {
+ this.isZan = isZan;
+ }
+
+ public Integer getGradeNum() {
+ return gradeNum;
+ }
+
+ public void setGradeNum(Integer gradeNum) {
+ this.gradeNum = gradeNum;
+ }
+
+ public Integer getZanNum() {
+ return zanNum;
+ }
+
+ public void setZanNum(Integer zanNum) {
+ this.zanNum = zanNum;
+ }
+
+ public BigDecimal getTotalGoldValue() {
+ return totalGoldValue;
+ }
+
+ public void setTotalGoldValue(BigDecimal totalGoldValue) {
+ this.totalGoldValue = totalGoldValue;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/PageResult.java b/src/main/java/com/ifish/bean/PageResult.java
new file mode 100644
index 0000000..253c84e
--- /dev/null
+++ b/src/main/java/com/ifish/bean/PageResult.java
@@ -0,0 +1,88 @@
+/*
+ * 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.List;
+
+/**
+ *
+ * @author Administrator
+ */
+public class PageResult implements java.io.Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private int totalCount = 0;
+ private int pageSize = 10;
+ private int pageNo = 1;
+ private int DEF_COUNT = 10;
+ private List list;
+
+ public PageResult() {
+
+ }
+
+ public PageResult(int pageNo, int pageSize, int totalCount) {
+ setTotalCount(totalCount);
+ setPageSize(pageSize);
+ setPageNo(pageNo);
+ }
+
+ public PageResult(int pageNo, int pageSize, int totalCount, List list) {
+ setTotalCount(totalCount);
+ setPageSize(pageSize);
+ setPageNo(pageNo);
+ this.list = list;
+ }
+
+ public void setTotalCount(int totalCount) {
+ if (totalCount < 0) {
+ this.totalCount = 0;
+ } else {
+ this.totalCount = totalCount;
+ }
+ }
+
+ public int getTotalCount() {
+ return totalCount;
+ }
+
+ public void setPageSize(int pageSize) {
+ if (pageSize < 1) {
+ this.pageSize = DEF_COUNT;
+ } else {
+ this.pageSize = pageSize;
+ }
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageNo(int pageNo) {
+ if (pageNo < 1) {
+ this.pageNo = 1;
+ } else {
+ this.pageNo = pageNo;
+ }
+ }
+
+ public int getPageNo() {
+ return pageNo;
+ }
+
+ public int getFirstResult() {
+ return (pageNo - 1) * pageSize;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Activa_Code.java b/src/main/java/com/ifish/bean/Tbl_Activa_Code.java
new file mode 100644
index 0000000..20e487a
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Activa_Code.java
@@ -0,0 +1,127 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.ifish.bean;
+
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * 摄像头激活码(tbl_activa_code)
+ *
+ * @author bianj
+ * @version 1.0.0 2017-07-03
+ */
+@Entity
+@Table(name = "tbl_activa_code")
+public class Tbl_Activa_Code implements java.io.Serializable {
+
+ /**
+ * 版本号
+ */
+ private static final long serialVersionUID = -2477544371712460934L;
+
+ /**
+ * 激活码
+ */
+ @Id
+ @Column(name = "active_code", unique = true, nullable = false, length = 50)
+ private String activeCode;
+
+ /**
+ * 批次号
+ */
+ @Column(name = "batch_code", nullable = true, length = 50)
+ private String batchCode;
+
+ /**
+ *
+ */
+ @Column(name = "is_used", nullable = true, length = 1)
+ private String isUsed;
+
+ /**
+ *
+ */
+ @Column(name = "create_time", nullable = true)
+ private Date createTime;
+
+ /**
+ * 获取激活码
+ *
+ * @return 激活码
+ */
+ public String getActiveCode() {
+ return this.activeCode;
+ }
+
+ /**
+ * 设置激活码
+ *
+ * @param activeCode 激活码
+ */
+ public void setActiveCode(String activeCode) {
+ this.activeCode = activeCode;
+ }
+
+ /**
+ * 获取批次号
+ *
+ * @return 批次号
+ */
+ public String getBatchCode() {
+ return this.batchCode;
+ }
+
+ /**
+ * 设置批次号
+ *
+ * @param batchCode 批次号
+ */
+ public void setBatchCode(String batchCode) {
+ this.batchCode = batchCode;
+ }
+
+ /**
+ * 获取
+ *
+ * @return
+ */
+ public String getIsUsed() {
+ return this.isUsed;
+ }
+
+ /**
+ * 设置
+ *
+ * @param isUsed
+ *
+ */
+ public void setIsUsed(String isUsed) {
+ this.isUsed = isUsed;
+ }
+
+ /**
+ * 获取
+ *
+ * @return
+ */
+ public Date getCreateTime() {
+ return this.createTime;
+ }
+
+ /**
+ * 设置
+ *
+ * @param createTime
+ *
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Device.java b/src/main/java/com/ifish/bean/Tbl_Device.java
new file mode 100644
index 0000000..ffcb840
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Device.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Device_Statistics.java b/src/main/java/com/ifish/bean/Tbl_Device_Statistics.java
new file mode 100644
index 0000000..a5df6aa
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Device_Statistics.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Device_User.java b/src/main/java/com/ifish/bean/Tbl_Device_User.java
new file mode 100644
index 0000000..08184a0
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Device_User.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_HardWare_Type.java b/src/main/java/com/ifish/bean/Tbl_HardWare_Type.java
new file mode 100644
index 0000000..7760168
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_HardWare_Type.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Live_Message.java b/src/main/java/com/ifish/bean/Tbl_Live_Message.java
new file mode 100644
index 0000000..5b915b7
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Live_Message.java
@@ -0,0 +1,231 @@
+/*
+ * 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_live_message)
+ *
+ * @author bianj
+ * @version 1.0.0 2017-07-03
+ */
+@Entity
+@Table(name = "tbl_live_message")
+public class Tbl_Live_Message implements java.io.Serializable {
+
+ /**
+ * 版本号
+ */
+ private static final long serialVersionUID = 4867709378808071267L;
+
+ /**
+ * 评论Id
+ */
+ @Id
+ @Column(name = "message_id", unique = true, nullable = false, length = 10)
+ private Integer messageId;
+
+ /**
+ * 直播间Id
+ */
+ @Column(name = "room_id", nullable = false, length = 10)
+ private Integer roomId;
+
+ /**
+ * 评论用户Id
+ */
+ @Column(name = "user_id", nullable = false, length = 10)
+ private Integer userId;
+
+ /**
+ * @用户Id
+ */
+ @Column(name = "as_user_id", nullable = true, length = 10)
+ private Integer asUserId;
+
+ /**
+ * 评论内容
+ */
+ @Column(name = "message_content", nullable = true, length = 200)
+ private String messageContent;
+
+ /**
+ * 评论时间
+ */
+ @Column(name = "create_time", nullable = true)
+ private Date createTime;
+
+ /**
+ * @人的用户名
+ */
+ private String asUserName;
+
+ /**
+ * 创建人的头像
+ */
+ private String userImg;
+
+ /**
+ * 创建人的用户名
+ */
+ private String userName;
+
+ /**
+ * @return the asUserName
+ */
+ public String getAsUserName() {
+ return asUserName;
+ }
+
+ /**
+ * @param asUserName the asUserName to set
+ */
+ public void setAsUserName(String asUserName) {
+ this.asUserName = asUserName;
+ }
+
+ /**
+ * @return the userImg
+ */
+ public String getUserImg() {
+ return userImg;
+ }
+
+ /**
+ * @param userImg the userImg to set
+ */
+ public void setUserImg(String userImg) {
+ this.userImg = userImg;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * 获取评论Id
+ *
+ * @return 评论Id
+ */
+ public Integer getMessageId() {
+ return this.messageId;
+ }
+
+ /**
+ * 设置评论Id
+ *
+ * @param messageId 评论Id
+ */
+ public void setMessageId(Integer messageId) {
+ this.messageId = messageId;
+ }
+
+ /**
+ * 获取直播间Id
+ *
+ * @return 直播间Id
+ */
+ public Integer getRoomId() {
+ return this.roomId;
+ }
+
+ /**
+ * 设置直播间Id
+ *
+ * @param roomId 直播间Id
+ */
+ public void setRoomId(Integer roomId) {
+ this.roomId = roomId;
+ }
+
+ /**
+ * 获取评论用户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 getAsUserId() {
+ return this.asUserId;
+ }
+
+ /**
+ * 设置@用户Id
+ *
+ * @param asUserId
+ * @用户Id
+ */
+ public void setAsUserId(Integer asUserId) {
+ this.asUserId = asUserId;
+ }
+
+ /**
+ * 获取评论内容
+ *
+ * @return 评论内容
+ */
+ public String getMessageContent() {
+ return this.messageContent;
+ }
+
+ /**
+ * 设置评论内容
+ *
+ * @param messageContent 评论内容
+ */
+ public void setMessageContent(String messageContent) {
+ this.messageContent = messageContent;
+ }
+
+ /**
+ * 获取评论时间
+ *
+ * @return 评论时间
+ */
+ public Date getCreateTime() {
+ return this.createTime;
+ }
+
+ /**
+ * 设置评论时间
+ *
+ * @param createTime 评论时间
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Live_Room.java b/src/main/java/com/ifish/bean/Tbl_Live_Room.java
new file mode 100644
index 0000000..723b43b
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Live_Room.java
@@ -0,0 +1,317 @@
+/*
+ * 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_live_room)
+ *
+ * @author bianj
+ * @version 1.0.0 2017-07-03
+ */
+@Entity
+@Table(name = "tbl_live_room")
+public class Tbl_Live_Room implements java.io.Serializable {
+
+ /**
+ * 版本号
+ */
+ private static final long serialVersionUID = -4747733838201318438L;
+
+ /**
+ * 直播间Id
+ */
+ @Id
+ @Column(name = "room_id", unique = true, nullable = false, length = 10)
+ private Integer roomId;
+
+ /**
+ * 用户Id
+ */
+ @Column(name = "user_id", unique = true, nullable = false, length = 10)
+ private Integer userId;
+
+ /**
+ * 摄像头ID
+ */
+ @Column(name = "camera_id", nullable = true, length = 20)
+ private String cameraId;
+
+ /**
+ * 直播间名称
+ */
+ @Column(name = "room_name", nullable = true, length = 20)
+ private String roomName;
+
+ /**
+ * 直播间描述
+ */
+ @Column(name = "room_desc", nullable = true, length = 70)
+ private String roomDesc;
+
+ /**
+ * */
+ @Column(name = "room_img", nullable = true, length = 50)
+ private String roomImg;
+
+ /**
+ * 直播间状态:1直播、0关闭
+ */
+ @Column(name = "room_status", nullable = true, length = 1)
+ private String roomStatus;
+
+ /**
+ * 人气值
+ */
+ @Column(name = "popularity_value", nullable = false, length = 10)
+ private Integer popularityValue;
+
+ /**
+ * 创建时间
+ */
+ @Column(name = "create_time", nullable = true)
+ private Date createTime;
+
+ /**
+ * 是否推荐
+ */
+ @Column(name = "is_tuijian", nullable = false, length = 1)
+ private Integer isTuijian;
+
+ /**
+ * 推荐排序
+ */
+ @Column(name = "tuijian_num", nullable = true, length = 10)
+ private Integer tuijianNum;
+
+ /**
+ * 首次分享
+ */
+ @Column(name = "first_share", nullable = false, length = 1)
+ private Integer firstShare;
+
+ /**
+ * 获取直播间Id
+ *
+ * @return 直播间Id
+ */
+ public Integer getRoomId() {
+ return this.roomId;
+ }
+
+ /**
+ * 设置直播间Id
+ *
+ * @param roomId 直播间Id
+ */
+ public void setRoomId(Integer roomId) {
+ this.roomId = roomId;
+ }
+
+ /**
+ * 获取用户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 String getCameraId() {
+ return this.cameraId;
+ }
+
+ /**
+ * 设置摄像头ID
+ *
+ * @param cameraId 摄像头ID
+ */
+ public void setCameraId(String cameraId) {
+ this.cameraId = cameraId;
+ }
+
+ /**
+ * 获取直播间名称
+ *
+ * @return 直播间名称
+ */
+ public String getRoomName() {
+ return this.roomName;
+ }
+
+ /**
+ * 设置直播间名称
+ *
+ * @param roomName 直播间名称
+ */
+ public void setRoomName(String roomName) {
+ this.roomName = roomName;
+ }
+
+ /**
+ * 获取直播间描述
+ *
+ * @return 直播间描述
+ */
+ public String getRoomDesc() {
+ return this.roomDesc;
+ }
+
+ /**
+ * 设置直播间描述
+ *
+ * @param roomDesc 直播间描述
+ */
+ public void setRoomDesc(String roomDesc) {
+ this.roomDesc = roomDesc;
+ }
+
+ /**
+ * 获取
+ *
+ * @return
+ */
+ public String getRoomImg() {
+ return this.roomImg;
+ }
+
+ /**
+ * 设置
+ *
+ * @param roomImg
+ *
+ */
+ public void setRoomImg(String roomImg) {
+ this.roomImg = roomImg;
+ }
+
+ /**
+ * 获取直播间状态:1直播、0关闭
+ *
+ * @return 直播间状态
+ */
+ public String getRoomStatus() {
+ return this.roomStatus;
+ }
+
+ /**
+ * 设置直播间状态:1直播、0关闭
+ *
+ * @param roomStatus 直播间状态:1直播、0关闭
+ */
+ public void setRoomStatus(String roomStatus) {
+ this.roomStatus = roomStatus;
+ }
+
+ /**
+ * 获取人气值
+ *
+ * @return 人气值
+ */
+ public Integer getPopularityValue() {
+ return this.popularityValue;
+ }
+
+ /**
+ * 设置人气值
+ *
+ * @param popularityValue 人气值
+ */
+ public void setPopularityValue(Integer popularityValue) {
+ this.popularityValue = popularityValue;
+ }
+
+ /**
+ * 获取创建时间
+ *
+ * @return 创建时间
+ */
+ public Date getCreateTime() {
+ return this.createTime;
+ }
+
+ /**
+ * 设置创建时间
+ *
+ * @param createTime 创建时间
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ /**
+ * 获取是否推荐
+ *
+ * @return 是否推荐
+ */
+ public Integer getIsTuijian() {
+ return this.isTuijian;
+ }
+
+ /**
+ * 设置是否推荐
+ *
+ * @param isTuijian 是否推荐
+ */
+ public void setIsTuijian(Integer isTuijian) {
+ this.isTuijian = isTuijian;
+ }
+
+ /**
+ * 获取推荐排序
+ *
+ * @return 推荐排序
+ */
+ public Integer getTuijianNum() {
+ return this.tuijianNum;
+ }
+
+ /**
+ * 设置推荐排序
+ *
+ * @param tuijianNum 推荐排序
+ */
+ public void setTuijianNum(Integer tuijianNum) {
+ this.tuijianNum = tuijianNum;
+ }
+
+ /**
+ * 获取首次分享
+ *
+ * @return 首次分享
+ */
+ public Integer getFirstShare() {
+ return this.firstShare;
+ }
+
+ /**
+ * 设置首次分享
+ *
+ * @param firstShare 首次分享
+ */
+ public void setFirstShare(Integer firstShare) {
+ this.firstShare = firstShare;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Push_List.java b/src/main/java/com/ifish/bean/Tbl_Push_List.java
new file mode 100644
index 0000000..8bfa849
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Push_List.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_User.java b/src/main/java/com/ifish/bean/Tbl_User.java
new file mode 100644
index 0000000..57cb9af
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_User.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/ifish/bean/Tbl_Vender.java b/src/main/java/com/ifish/bean/Tbl_Vender.java
new file mode 100644
index 0000000..da691c8
--- /dev/null
+++ b/src/main/java/com/ifish/bean/Tbl_Vender.java
@@ -0,0 +1,270 @@
+/*
+ * 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_vender_list)
+ *
+ * @author bianj
+ * @version 1.0.0 2017-06-27
+ */
+@Entity
+@Table(name = "tbl_vender_list")
+public class Tbl_Vender implements java.io.Serializable {
+
+ /**
+ * 版本号
+ */
+ private static final long serialVersionUID = -487543106603936914L;
+
+ /**
+ * 鱼缸厂编号
+ */
+ @Id
+ @Column(name = "brand_code", unique = true, nullable = false, length = 20)
+ private String brandCode;
+
+ /**
+ * 电子厂代码
+ */
+ @Id
+ @Column(name = "factory_code", unique = true, nullable = false, length = 20)
+ private String factoryCode;
+
+ /**
+ * logo
+ */
+ @Column(name = "brand_logo", nullable = true, length = 100)
+ private String brandLogo;
+
+ /**
+ * 鱼缸厂名称
+ */
+ @Column(name = "brand_name", nullable = false, length = 20)
+ private String brandName;
+
+ /**
+ * 品牌介绍
+ */
+ @Column(name = "brand_introduce", nullable = true, length = 100)
+ private String brandIntroduce;
+
+ /**
+ * app展示
+ */
+ @Column(name = "app_show", nullable = true, length = 1)
+ private String appShow;
+
+ /**
+ * 联系电话
+ */
+ @Column(name = "contact_phone", nullable = true, length = 30)
+ private String contactPhone;
+
+ /**
+ * 联系地址
+ */
+ @Column(name = "contact_address", nullable = true, length = 50)
+ private String contactAddress;
+
+ /**
+ * 更新时间
+ */
+ @Column(name = "update_time", nullable = true)
+ private Date updateTime;
+
+ /**
+ * 创建时间
+ */
+ @Column(name = "create_time", nullable = true)
+ private Date createTime;
+
+ /**
+ * 获取鱼缸厂编号
+ *
+ * @return 鱼缸厂编号
+ */
+ public String getBrandCode() {
+ return this.brandCode;
+ }
+
+ /**
+ * 设置鱼缸厂编号
+ *
+ * @param brandCode 鱼缸厂编号
+ */
+ public void setBrandCode(String brandCode) {
+ this.brandCode = brandCode;
+ }
+
+ /**
+ * 获取电子厂代码
+ *
+ * @return 电子厂代码
+ */
+ public String getFactoryCode() {
+ return this.factoryCode;
+ }
+
+ /**
+ * 设置电子厂代码
+ *
+ * @param factoryCode 电子厂代码
+ */
+ public void setFactoryCode(String factoryCode) {
+ this.factoryCode = factoryCode;
+ }
+
+ /**
+ * 获取logo
+ *
+ * @return logo
+ */
+ public String getBrandLogo() {
+ return this.brandLogo;
+ }
+
+ /**
+ * 设置logo
+ *
+ * @param brandLogo logo
+ */
+ public void setBrandLogo(String brandLogo) {
+ this.brandLogo = brandLogo;
+ }
+
+ /**
+ * 获取鱼缸厂名称
+ *
+ * @return 鱼缸厂名称
+ */
+ public String getBrandName() {
+ return this.brandName;
+ }
+
+ /**
+ * 设置鱼缸厂名称
+ *
+ * @param brandName 鱼缸厂名称
+ */
+ public void setBrandName(String brandName) {
+ this.brandName = brandName;
+ }
+
+ /**
+ * 获取品牌介绍
+ *
+ * @return 品牌介绍
+ */
+ public String getBrandIntroduce() {
+ return this.brandIntroduce;
+ }
+
+ /**
+ * 设置品牌介绍
+ *
+ * @param brandIntroduce 品牌介绍
+ */
+ public void setBrandIntroduce(String brandIntroduce) {
+ this.brandIntroduce = brandIntroduce;
+ }
+
+ /**
+ * 获取app展示
+ *
+ * @return app展示
+ */
+ public String getAppShow() {
+ return this.appShow;
+ }
+
+ /**
+ * 设置app展示
+ *
+ * @param appShow app展示
+ */
+ public void setAppShow(String appShow) {
+ this.appShow = appShow;
+ }
+
+ /**
+ * 获取联系电话
+ *
+ * @return 联系电话
+ */
+ public String getContactPhone() {
+ return this.contactPhone;
+ }
+
+ /**
+ * 设置联系电话
+ *
+ * @param contactPhone 联系电话
+ */
+ public void setContactPhone(String contactPhone) {
+ this.contactPhone = contactPhone;
+ }
+
+ /**
+ * 获取联系地址
+ *
+ * @return 联系地址
+ */
+ public String getContactAddress() {
+ return this.contactAddress;
+ }
+
+ /**
+ * 设置联系地址
+ *
+ * @param contactAddress 联系地址
+ */
+ public void setContactAddress(String contactAddress) {
+ this.contactAddress = contactAddress;
+ }
+
+ /**
+ * 获取更新时间
+ *
+ * @return 更新时间
+ */
+ public Date getUpdateTime() {
+ return this.updateTime;
+ }
+
+ /**
+ * 设置更新时间
+ *
+ * @param updateTime 更新时间
+ */
+ public void setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ /**
+ * 获取创建时间
+ *
+ * @return 创建时间
+ */
+ public Date getCreateTime() {
+ return this.createTime;
+ }
+
+ /**
+ * 设置创建时间
+ *
+ * @param createTime 创建时间
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+}
diff --git a/src/main/java/com/ifish/config/MybatisConfig.java b/src/main/java/com/ifish/config/MybatisConfig.java
new file mode 100644
index 0000000..235479f
--- /dev/null
+++ b/src/main/java/com/ifish/config/MybatisConfig.java
@@ -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;
+ }
+
+}
diff --git a/src/main/java/com/ifish/config/RedisConfig.java b/src/main/java/com/ifish/config/RedisConfig.java
new file mode 100644
index 0000000..1d37213
--- /dev/null
+++ b/src/main/java/com/ifish/config/RedisConfig.java
@@ -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 redisTemplate(RedisConnectionFactory cf) {
+ RedisTemplate redis = new RedisTemplate();
+ redis.setConnectionFactory(cf);
+ return redis;
+ }
+
+ @Bean
+ public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory cf) {
+ StringRedisTemplate redis = new StringRedisTemplate();
+ redis.setConnectionFactory(cf);
+ return redis;
+ }
+}
diff --git a/src/main/java/com/ifish/config/RootConfig.java b/src/main/java/com/ifish/config/RootConfig.java
new file mode 100644
index 0000000..f2aaaa3
--- /dev/null
+++ b/src/main/java/com/ifish/config/RootConfig.java
@@ -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 {
+
+}
diff --git a/src/main/java/com/ifish/config/WebAppInitializer.java b/src/main/java/com/ifish/config/WebAppInitializer.java
new file mode 100644
index 0000000..c963f53
--- /dev/null
+++ b/src/main/java/com/ifish/config/WebAppInitializer.java
@@ -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};
+ }
+
+ @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;
+ }
+}
diff --git a/src/main/java/com/ifish/config/WebConfig.java b/src/main/java/com/ifish/config/WebConfig.java
new file mode 100644
index 0000000..0062765
--- /dev/null
+++ b/src/main/java/com/ifish/config/WebConfig.java
@@ -0,0 +1,71 @@
+/*
+ * 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.Interceptor.SecurityValidateInterceptor;
+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();;
+ }
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(MyInterceptor());
+ super.addInterceptors(registry);
+ }
+
+ @Bean
+ public SecurityValidateInterceptor MyInterceptor() {
+ boolean devModel = IfishFilePath.devModel;
+ return new SecurityValidateInterceptor(devModel);
+ }
+
+}
diff --git a/src/main/java/com/ifish/controller/Device.java b/src/main/java/com/ifish/controller/Device.java
new file mode 100644
index 0000000..7028c28
--- /dev/null
+++ b/src/main/java/com/ifish/controller/Device.java
@@ -0,0 +1,142 @@
+/*
+ * 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.controller;
+
+import com.ifish.bean.Tbl_Device;
+import com.ifish.bean.Tbl_Device_User;
+import com.ifish.bean.Tbl_User;
+import com.ifish.enums.ResultEnum;
+import com.ifish.helper.DeviceHelperI;
+import com.ifish.util.IfishUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ * @author Administrator
+ */
+@RestController
+public class Device {
+
+ @Autowired
+ private DeviceHelperI deviceHelperI;
+
+ /**
+ * 绑定设备
+ *
+ * @param userId
+ * @param macAddress
+ * @return
+ */
+ @RequestMapping(value = "/bindDevice.do", method = RequestMethod.POST)
+ public Object bindDevice(Integer userId, String macAddress) {
+ try {
+ return deviceHelperI.bindDevice(userId, macAddress);
+ } catch (Exception e) {
+
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 绑定摄像头
+ *
+ * @param userId
+ * @param cameraId
+ * @return
+ */
+ @RequestMapping(value = "/bindCamera.do", method = RequestMethod.POST)
+ public Object bindCamera(Integer userId, String cameraId) {
+ try {
+ return deviceHelperI.bindCamera(userId, cameraId);
+ } catch (Exception e) {
+
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 激活摄像头
+ *
+ * @param activeCode
+ * @param cameraId
+ * @return
+ */
+ @RequestMapping(value = "/activeCamera.do", method = RequestMethod.POST)
+ public Object activeCamera(String activeCode, String cameraId) {
+ try {
+ return deviceHelperI.activeCamera(activeCode, cameraId);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 修改设备显示名称
+ *
+ * @param device
+ * @param userId
+ * @return
+ */
+ @RequestMapping(value = "/updateDeviceUser.do", method = RequestMethod.POST)
+ public Object updateDeviceUser(Tbl_Device_User device) {
+ try {
+ return deviceHelperI.updateDeviceUser(device);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 修改摄像头信息
+ *
+ * @param cameraId
+ * @param device_User
+ * @return
+ */
+ @RequestMapping(value = "/updateCameraUser.do", method = RequestMethod.POST)
+ public Object updateCameraUser(Integer cameraId, Tbl_Device_User device_User) {
+ try {
+ return deviceHelperI.updateCameraUser(cameraId, device_User);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 删除绑定的设备
+ *
+ * @param deviceUser
+ * @return
+ */
+ @RequestMapping(value = "/deleteDeviceUser.do", method = RequestMethod.POST)
+ public Object deleteDeviceUser(Tbl_Device_User deviceUser) {
+ try {
+ return deviceHelperI.deleteDeviceUser(deviceUser);
+ } catch (Exception e) {
+
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 删除绑定的摄像头
+ *
+ * @param deviceUser
+ * @return
+ */
+ @RequestMapping(value = "/deleteCameraUser.do", method = RequestMethod.POST)
+ public Object deleteCameraUser(Integer userId, String cameraId) {
+ try {
+ return deviceHelperI.deleteCameraUser(userId, cameraId);
+ } catch (Exception e) {
+
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+}
diff --git a/src/main/java/com/ifish/controller/Index.java b/src/main/java/com/ifish/controller/Index.java
new file mode 100644
index 0000000..591d78c
--- /dev/null
+++ b/src/main/java/com/ifish/controller/Index.java
@@ -0,0 +1,23 @@
+/*
+ * 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.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ *
+ * @author Administrator
+ */
+@Controller
+public class Index {
+
+ @RequestMapping(value = "/", method = RequestMethod.GET) //处理路由的请求
+ public String index() {
+ return "index"; //返回的视图名为index(指向/WEB-INF/Views/index.jsp)
+ }
+}
diff --git a/src/main/java/com/ifish/controller/LiveRoom.java b/src/main/java/com/ifish/controller/LiveRoom.java
new file mode 100644
index 0000000..3860fd5
--- /dev/null
+++ b/src/main/java/com/ifish/controller/LiveRoom.java
@@ -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.controller;
+
+import com.ifish.bean.Tbl_Live_Message;
+import com.ifish.bean.Tbl_Live_Room;
+import com.ifish.enums.ResultEnum;
+import com.ifish.helper.LiveRoomHelperI;
+import com.ifish.util.IfishUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ *
+ * @author Administrator
+ */
+@RestController
+public class LiveRoom {
+
+ @Autowired
+ private LiveRoomHelperI liveRoomHelperI;
+
+ /**
+ * 新增直播间
+ *
+ * @param liveRoom
+ * @param fileUpload
+ * @return
+ */
+ @RequestMapping(value = "/liveRoom/v3/addLiveRoom.do", method = RequestMethod.POST)
+ public Object addLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom) {
+ try {
+ return liveRoomHelperI.addLiveRoom(fileUpload, liveRoom);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 直播间点赞
+ *
+ * @param roomId
+ * @param userId
+ * @return
+ */
+ @RequestMapping(value = "/liveRoomZan/{roomId}/{userId}", method = RequestMethod.POST)
+ public Object liveRoomsZan(@PathVariable Integer roomId, @PathVariable Integer userId) {
+ try {
+ return liveRoomHelperI.liveRoomsZan(roomId, userId);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 直播间留言
+ *
+ * @param liveMessage
+ * @return
+ */
+ @RequestMapping(value = "/liveRoom/v3/leaveMessage.do", method = RequestMethod.POST)
+ public Object leaveMessage(Tbl_Live_Message liveMessage) {
+ try {
+ return liveRoomHelperI.leaveMessage(liveMessage);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 获取直播间信息
+ *
+ * @param roomId
+ * @return
+ */
+ @RequestMapping(value = "/liveRoom/v3/getLiveRoomInfo.do", method = RequestMethod.GET)
+ public Object getLiveRoomInfo(Integer userId) {
+ try {
+ return liveRoomHelperI.getLiveRoomInfo(userId);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 获取直播列表
+ *
+ * @param firstResult
+ * @param pageSize
+ * @return
+ */
+ @RequestMapping(value = "/liveRoom/v3/getLiveRooms.do", method = RequestMethod.GET)
+ public Object getLiveRooms(Integer firstResult, Integer pageSize, Integer userId, String orders) {
+ try {
+ return liveRoomHelperI.getLiveRooms(firstResult, pageSize, userId, orders);
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+}
diff --git a/src/main/java/com/ifish/controller/Login.java b/src/main/java/com/ifish/controller/Login.java
new file mode 100644
index 0000000..37ad256
--- /dev/null
+++ b/src/main/java/com/ifish/controller/Login.java
@@ -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.controller;
+
+import com.ifish.bean.Tbl_User;
+import com.ifish.helper.UserHelperI;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ *
+ * @author Administrator
+ */
+@RestController
+public class Login {
+
+ @Autowired
+ private UserHelperI userHelperI;
+
+ /**
+ * 用户登陆
+ *
+ * @param user
+ * @return
+ */
+ @RequestMapping(value = "/userLogin.do", method = RequestMethod.GET)
+ public Object userLogin(Tbl_User user) {
+ return userHelperI.login(user);
+ }
+
+ /**
+ * 游客注册
+ *
+ * @return
+ */
+ @RequestMapping(value = "/touristLogin.do", method = RequestMethod.POST)
+ public Object touristLogin() {
+ return userHelperI.touristRegister();
+ }
+
+}
diff --git a/src/main/java/com/ifish/controller/PushMessage.java b/src/main/java/com/ifish/controller/PushMessage.java
new file mode 100644
index 0000000..022d1f4
--- /dev/null
+++ b/src/main/java/com/ifish/controller/PushMessage.java
@@ -0,0 +1,65 @@
+/*
+ * 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.controller;
+
+import com.ifish.bean.PageResult;
+import com.ifish.bean.Tbl_Push_List;
+import com.ifish.enums.ResultEnum;
+import com.ifish.helper.PushMessageHelperI;
+import com.ifish.util.IfishUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ * @author Administrator
+ */
+@RestController
+@RequestMapping("/push")
+public class PushMessage {
+
+ @Autowired
+ private PushMessageHelperI pushMessageHelperI;
+
+ /**
+ * 获取推送消息列表
+ *
+ * @param pushId
+ * @param userId
+ * @param firstResult
+ * @param pageSize
+ * @return
+ */
+ @RequestMapping(value = "/getPushList", method = RequestMethod.GET)
+ public Object pushListInf(String pushType, Integer userId, Integer firstResult, Integer pageSize) {
+
+ try {
+ return pushMessageHelperI.getPushList(pushType, userId, firstResult, pageSize);
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 删除推送消息
+ *
+ * @param userId
+ * @param pushId
+ * @return
+ */
+ @RequestMapping(value = "/deletePushList", method = RequestMethod.GET)
+ public Object deletePushList(Integer userId, Integer pushId) {
+
+ try {
+ return pushMessageHelperI.deletePushList(userId, pushId);
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+}
diff --git a/src/main/java/com/ifish/enums/GwellEnum.java b/src/main/java/com/ifish/enums/GwellEnum.java
new file mode 100644
index 0000000..ed918b3
--- /dev/null
+++ b/src/main/java/com/ifish/enums/GwellEnum.java
@@ -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.enums;
+
+/**
+ *
+ * @author Administrator
+ */
+public enum GwellEnum {
+
+ success("0", "注册成功"),//注册成功
+ fail("1", "注册失败"),//注册失败
+ repeat("7", "邮箱已被注册");//邮箱已被注册
+
+ private GwellEnum(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;
+ }
+}
diff --git a/src/main/java/com/ifish/enums/PushTypeEnum.java b/src/main/java/com/ifish/enums/PushTypeEnum.java
new file mode 100644
index 0000000..5e209a9
--- /dev/null
+++ b/src/main/java/com/ifish/enums/PushTypeEnum.java
@@ -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.enums;
+
+/**
+ * 推送消息类型
+ *
+ * @author Administrator
+ */
+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", "离线通知"),
+ send_report("send_report", "看护报告"),
+ shops_push("shops_push", "看护通知"),
+ all_push("all_push", "所有用户推送");
+
+ private PushTypeEnum(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ private String key;
+ private String value;
+
+ //普通方法
+ public static String getValue(String key) {
+ for (PushTypeEnum c : PushTypeEnum.values()) {
+ if (c.getKey().equals(key)) {
+ return c.getValue();
+ }
+ }
+ return null;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/src/main/java/com/ifish/enums/ResultEnum.java b/src/main/java/com/ifish/enums/ResultEnum.java
new file mode 100644
index 0000000..853dad8
--- /dev/null
+++ b/src/main/java/com/ifish/enums/ResultEnum.java
@@ -0,0 +1,66 @@
+/*
+ * 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 ResultEnum {
+ success("100", "成功"),
+ fail101("101", "失败"),
+ warn201("201", "手机已经注册过"),
+ warn202("202", "手机未注册"),
+ warn203("203", "未知操作"),//获取验证码时
+ warn204("204", "密码不正确"),
+ warn205("205", "图片格式不正确"),
+ warn206("206", "上传图片太大"),
+ warn207("207", "设备不存在"),
+ warn208("208", "激活码已被使用"),
+ warn209("209", "无效的激活码"),
+ warn210("210", "摄像头不存在"),
+ warn211("211", "用户ID不存在"),
+ warn212("212", "请填写正确的商家手机号"),
+ warn213("213", "包含敏感词"),
+ warn214("214", "直播间已存在"),
+ warn215("215", "金币不足"),
+ warn216("216", "金币规则不存在"),
+ warn217("217", "打赏金额错误"),
+ warn218("218", "没有商家"),
+ warn219("219", "优惠券已停止兑换"),
+ warn220("220", "用户能兑换数量达到上限"),
+ warn221("221", "优惠券已全部兑换完"),
+ warn222("222", "请上传正确的商品介绍图"),
+ warn223("223", "请上传正确的商品介绍视频"),
+ error400("400", "安全校验失败"),
+ error401("401", "参数校验失败"),
+ error402("402", "参数不存在");
+
+ private ResultEnum(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;
+ }
+
+}
diff --git a/src/main/java/com/ifish/enums/SubDirectoryEnum.java b/src/main/java/com/ifish/enums/SubDirectoryEnum.java
new file mode 100644
index 0000000..2715c25
--- /dev/null
+++ b/src/main/java/com/ifish/enums/SubDirectoryEnum.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/ifish/helper/DeviceHelper.java b/src/main/java/com/ifish/helper/DeviceHelper.java
new file mode 100644
index 0000000..17181d1
--- /dev/null
+++ b/src/main/java/com/ifish/helper/DeviceHelper.java
@@ -0,0 +1,592 @@
+/*
+ * 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_Activa_Code;
+import com.ifish.bean.Tbl_Device;
+import com.ifish.bean.Tbl_Device_Statistics;
+import com.ifish.bean.Tbl_Device_User;
+import com.ifish.bean.Tbl_User;
+import com.ifish.enums.PushTypeEnum;
+import com.ifish.enums.ResultEnum;
+import com.ifish.mapper.Tbl_Device_Mapper;
+import com.ifish.util.IfishUtil;
+import com.ifish.util.RedisKey;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * @author Administrator
+ */
+@Component
+public class DeviceHelper implements DeviceHelperI {
+
+ @Autowired
+ private RedisHelperI redisHelperI;
+
+ @Autowired
+ private Tbl_Device_Mapper tbl_Device_Mapper;
+
+ @Autowired
+ private UserHelperI userHelperI;
+
+ /**
+ * 根据用户Id获取绑定设备集合
+ *
+ * @param userId
+ * @return
+ */
+ @Override
+ public List getDeviceUsersByUserId(Integer userId) throws Exception {
+ List deviceUserList = null;
+ String key = RedisKey.DeviceUser_Key + userId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ deviceUserList = (List) IfishUtil.JsonToList(redisString, Tbl_Device_User.class);
+ } else {
+ deviceUserList = tbl_Device_Mapper.getDeviceUsersByUserId(userId);
+ if (deviceUserList != null && deviceUserList.size() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(deviceUserList));
+ }
+ }
+ return deviceUserList;
+ }
+
+ /**
+ * 根据用户ID和设备ID获取此设备和此用户的关系
+ *
+ * @param userId
+ * @param deviceId
+ * @return
+ * @throws Exception
+ */
+ public Tbl_Device_User getDeviceUserByUserId_DeviceId(Integer userId, Integer deviceId) throws Exception {
+ Tbl_Device_User device = null;
+ String key = RedisKey.DeviceUser_Key + "d" + deviceId + "_u" + userId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ device = (Tbl_Device_User) IfishUtil.JsonToBean(redisString, Tbl_Device_User.class);
+ } else {
+ device = tbl_Device_Mapper.getDeviceUsersByUserIdAndDeviceId(userId, deviceId);
+ if (device != null && device.getDeviceId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
+ }
+ }
+ return device;
+ }
+
+ /**
+ * 根据用户ID和摄像头ID获取此摄像头和用户的关系
+ *
+ * @param userId
+ * @param deviceId
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public Tbl_Device_User getDeviceUserByUserId_CameraId(Integer userId, String cameraId) throws Exception {
+ Tbl_Device device = getDeviceByCameraId(cameraId);
+ if (device == null) {
+ return null;
+ }
+ return getDeviceUserByUserId_DeviceId(userId, device.getDeviceId());
+ }
+
+ /**
+ * 根据设备Id获取设备详情
+ *
+ * @param deviceId
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public Tbl_Device getDeviceById(Integer deviceId) throws Exception {
+ Tbl_Device device = null;
+ String key = RedisKey.Device_key + deviceId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class);
+ } else {
+ device = tbl_Device_Mapper.getDeviceById(deviceId);
+ if (device != null && device.getDeviceId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
+ }
+ }
+ return device;
+ }
+
+ /**
+ * 根据摄像头ID从缓存中取得设备信息
+ *
+ * @param cameraId
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public Tbl_Device getDeviceByCameraId(String cameraId) throws Exception {
+ Tbl_Device device = null;
+ String key = RedisKey.Camera_key + cameraId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class);
+ } else {
+ device = tbl_Device_Mapper.getDeviceByCameraId(cameraId);
+ if (device != null && device.getDeviceId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
+ }
+ }
+ return device;
+ }
+
+ /**
+ * 根据设备mac地址获取设备详情
+ *
+ * @param macAddress
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public Tbl_Device getDeviceByMacAddress(String macAddress) throws Exception {
+ Tbl_Device device = null;
+ String key = RedisKey.Device_key + macAddress;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class);
+ } else {
+ device = tbl_Device_Mapper.getDeviceByMacAddress(macAddress);
+ if (device != null && device.getDeviceId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
+ }
+ }
+ return device;
+ }
+
+ /**
+ * 根据设备ID获取设备统计信息
+ *
+ * @param deviceId
+ * @return
+ * @throws Exception
+ */
+ public Tbl_Device_Statistics getDeviceStatisticsByDeviceId(Integer deviceId) throws Exception {
+ Tbl_Device_Statistics device = null;
+ String key = RedisKey.DeviceStatistic_key + deviceId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ device = (Tbl_Device_Statistics) IfishUtil.JsonToBean(redisString, Tbl_Device_Statistics.class);
+ } else {
+ device = tbl_Device_Mapper.getDevStatisticsByDeviceId(deviceId);
+ if (device != null && device.getDeviceId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
+ }
+ }
+ return device;
+ }
+
+ /**
+ * 绑定设备
+ *
+ * @param userId
+ * @param user
+ * @param mackAddress
+ * @return
+ */
+ @Override
+ public Object bindDevice(Integer userId, String mackAddress) {
+
+ try {
+ Tbl_User tmpUser = userHelperI.getUserById(userId);
+ //用户存在
+ if (tmpUser != null) {
+ //新增用户拥有设备
+ Tbl_Device_User deviceUser = new Tbl_Device_User();
+ Tbl_Device device = getDeviceByMacAddress(mackAddress);
+ boolean bln = false;
+ //设备存在
+ if (device != null) {
+ //关联用户-设备
+ deviceUser.setUserId(tmpUser.getUserId());
+ deviceUser.setDeviceId(device.getDeviceId());
+ //已关联设备的其他用户,这里的用户ID查询条件是不等于<>
+ List deviceUserList = tbl_Device_Mapper.getOtherDeviceUsersByOtherUserIdAndDeviceId(tmpUser.getUserId(), device.getDeviceId());
+ //是否已关联这里的用户ID查询是等于=
+ Tbl_Device_User tmpDdeviceUser = tbl_Device_Mapper.getDeviceUsersByUserIdAndDeviceId(tmpUser.getUserId(), device.getDeviceId());
+ //已关联
+ if (tmpDdeviceUser != null) {
+ //原先不是主控制,则删除其他用户关联关系
+ if (!tmpDdeviceUser.getIsMaster().equals("1")) {
+
+ for (Tbl_Device_User du : deviceUserList) {
+ Integer userid = du.getUserId();
+ Integer deviceId = du.getDeviceId();
+ Tbl_User tu = userHelperI.getUserById(userid);
+ if (tu != null) {
+ String timestamp = IfishUtil.format(new Date());
+ //基本参数
+ Map baseMap = new HashMap();
+ baseMap.put("title", PushTypeEnum.remove_device.getValue());
+ baseMap.put("content", "你已于" + timestamp + "失去对“" + du.getShowName() + "”设备的控制权");
+ baseMap.put("user_id", tu.getUserId().toString());
+ baseMap.put("loginType", tu.getLoginType());
+ //推送参数
+ Map pushMap = new HashMap();
+ pushMap.put("device_id", deviceId.toString());
+ pushMap.put("device_name", du.getShowName());
+ pushMap.put("timestamp", timestamp);
+ pushMap.put("msg_type", PushTypeEnum.remove_device.getKey());
+ //推送消息
+ jPushNotifcation(baseMap, pushMap);
+ }
+ tbl_Device_Mapper.deleteDeviceUserById(du.getId());
+
+ }
+ }
+ //变更为主控
+ tmpDdeviceUser.setIsMaster("1");
+ Date date = new Date();
+ tmpDdeviceUser.setUpdateTime(date);
+ tmpDdeviceUser.setCreateTime(date);
+ tbl_Device_Mapper.updateTblDeviceUser(tmpDdeviceUser);
+
+ deviceUser.setShowName(tmpDdeviceUser.getShowName());
+ deviceUser.setIsMaster(tmpDdeviceUser.getIsMaster());
+ } //未绑定过
+ else {
+ //删除其他用户控制权
+ for (Tbl_Device_User du : deviceUserList) {
+ Integer userid = du.getUserId();
+ Integer deviceId = du.getDeviceId();
+ Tbl_User tu = userHelperI.getUserById(userid);
+ if (tu != null) {
+ String timestamp = IfishUtil.format(new Date());
+ //基本参数
+ Map baseMap = new HashMap();
+ baseMap.put("title", PushTypeEnum.remove_device.getValue());
+ baseMap.put("content", "你已于" + timestamp + "失去对“" + du.getShowName() + "”设备的控制权");
+ baseMap.put("user_id", tu.getUserId().toString());
+ baseMap.put("loginType", tu.getLoginType());
+ //推送参数
+ Map pushMap = new HashMap();
+ pushMap.put("device_id", deviceId.toString());
+ pushMap.put("device_name", du.getShowName());
+ pushMap.put("timestamp", timestamp);
+ pushMap.put("msg_type", PushTypeEnum.remove_device.getKey());
+ //推送消息
+ jPushNotifcation(baseMap, pushMap);
+ }
+ tbl_Device_Mapper.deleteDeviceUserById(du.getId());
+ }
+ //需要新增
+ bln = true;
+ //查询设备统计信息
+ Tbl_Device_Statistics ds = getDeviceStatisticsByDeviceId(device.getDeviceId());
+ //如果设备统计信息为空,新增
+ if (ds == null || ds.getId() <= 0) {
+ ds = new Tbl_Device_Statistics();
+ ds.setDeviceId(device.getDeviceId());
+ ds.setMacAddress(StringUtils.isBlank(device.getMacAddress()) ? null : device.getMacAddress());
+ ds.setLoginCount(1);
+ ds.setLoginTime(new Date());
+ ds.setFirstActivate(new Date());
+ ds.setCreateTime(new Date());
+ ds.setIsCharge("0");
+ ds.setHardwareType(StringUtils.isBlank(device.getHardwareType()) ? null : device.getHardwareType());
+ ds.setFactoryCode(StringUtils.isBlank(device.getFactoryCode()) ? null : device.getFactoryCode());
+ ds.setBrandCode(StringUtils.isBlank(device.getBrandCode()) ? null : device.getBrandCode());
+ tbl_Device_Mapper.insertDeviceStatistics(ds);
+ } else {
+ //修改设备统计信息
+ ds.setFirstActivate(new Date());
+ tbl_Device_Mapper.updateDeviceStatistics(ds);
+ }
+ }
+ } //设备不存在
+ else {
+ //新增设备信息
+ device = new Tbl_Device();
+ device.setIsBlacklist("1");
+ device.setMacAddress(mackAddress);
+ Date date = new Date();
+ device.setCreateTime(date);
+ int i = tbl_Device_Mapper.insertDevice(device);
+ if (i > 0) {
+ Tbl_Device_Statistics tds = new Tbl_Device_Statistics();
+ tds.setLoginCount(0);
+ tds.setMacAddress(mackAddress);
+ tds.setDeviceId(device.getDeviceId());
+ tds.setFirstActivate(date);
+ tds.setCreateDate(date);
+ tds.setCreateTime(date);
+ tbl_Device_Mapper.insertDeviceStatistics(tds);
+ bln = true;
+ deviceUser.setUserId(tmpUser.getUserId());
+ deviceUser.setDeviceId(device.getDeviceId());
+ }
+ }
+ //需要新增
+ if (bln) {
+ //新增关联关系
+ deviceUser.setShowName("鱼缸" + (int) (Math.random() * 9000 + 1000));
+ deviceUser.setIsMaster("1");
+ Date date = new Date();
+ deviceUser.setUpdateTime(date);
+ deviceUser.setCreateTime(date);
+ tbl_Device_Mapper.insertDeviceUser(deviceUser);
+ }
+ //封装设备返回信息
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), userHelperI.getDeviceInfo(device, deviceUser));
+ } else {
+ return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
+ }
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 绑定摄像头
+ *
+ * @param userId
+ * @param cameraId
+ * @return
+ */
+ @Override
+ public Object bindCamera(Integer userId, String cameraId) {
+ try {
+ Tbl_User user = userHelperI.getUserById(userId);
+ Tbl_Device camera = getDeviceByCameraId(cameraId);
+ //返回数据
+ Map dataMap = new HashMap();
+ //用户存在
+ if (user != null) {
+ //摄像头存在
+ if (camera != null) {
+ //已关联摄像头的用户
+ List CameraUserList = tbl_Device_Mapper.getDeviceUsersByDeviceId(camera.getDeviceId());
+ //删除摄像头与用户关系
+ for (Tbl_Device_User cu : CameraUserList) {
+ //删除摄像头和用户的关系
+ tbl_Device_Mapper.deleteDeviceUserById(cu.getId());
+ }
+ } else {
+ //摄像头不存在
+ camera = new Tbl_Device();
+ camera.setCameraId(cameraId);
+ camera.setCreateTime(new Date());
+ camera.setIsCamera("1");
+ tbl_Device_Mapper.insertDevice(camera);
+ }
+ //建立关系
+ Tbl_Device_User device_User = new Tbl_Device_User();
+ device_User.setUserId(userId);
+ device_User.setIsMaster("1");
+ device_User.setIsLook("0");
+ device_User.setIsLive("0");
+ device_User.setDeviceId(camera.getDeviceId());
+ device_User.setShowName("摄像头" + (int) (Math.random() * 900 + 100));
+ device_User.setCreateTime(new Date());
+ tbl_Device_Mapper.insertDeviceUser(device_User);
+ //返回数据
+ dataMap.put("cameraId", cameraId);
+ dataMap.put("showName", device_User.getShowName());
+ dataMap.put("isMaster", device_User.getIsMaster());
+ dataMap.put("isLook", device_User.getIsLook());
+ dataMap.put("isLive", device_User.getIsLive());
+ dataMap.put("isActive", camera.getActiveCode() != null && !camera.getActiveCode().equals("") ? "1" : "0");
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
+ } else {
+ return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
+ }
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 激活摄像头
+ */
+ @Override
+ public Object activeCamera(String activeCode, String cameraId) {
+ try {
+ Tbl_Activa_Code activa_Code = tbl_Device_Mapper.getActiva_CodeByCode(activeCode);
+ if (activa_Code != null) {
+ if (activa_Code.getIsUsed().equals("1")) {
+ return IfishUtil.returnJson(ResultEnum.warn208.getKey(), "");
+ } else {
+ Tbl_Device camera = tbl_Device_Mapper.getDeviceByCameraId(cameraId);
+ if (camera != null) {
+ if (StringUtils.isNotBlank(camera.getActiveCode())) {
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
+ } else {
+ Date date = new Date();
+ camera.setActiveCode(activeCode);
+ camera.setActiveTime(date);
+ camera.setUpdateTime(date);
+ int i = tbl_Device_Mapper.updateTbl_Device(camera);
+
+ activa_Code.setIsUsed("1");
+ tbl_Device_Mapper.updateTblActivaCodeIsUse(activeCode);
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
+ }
+ } else {
+ return IfishUtil.returnJson(ResultEnum.warn210.getKey(), "");
+ }
+ }
+ } else {
+ return IfishUtil.returnJson(ResultEnum.warn209.getKey(), "");
+ }
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 修改设备和用户的关系数据
+ *
+ * @param device
+ * @param userId
+ * @return
+ */
+ @Override
+ public Object updateDeviceUser(Tbl_Device_User device) {
+
+ try {
+ Tbl_Device_User olDevice_User = getDeviceUserByUserId_DeviceId(device.getUserId(), device.getDeviceId());
+ String key = RedisKey.DeviceUser_Key + device.getUserId();
+ String key2 = RedisKey.DeviceUser_Key + "d" + device.getDeviceId() + "_u" + device.getUserId();
+ if (device != null) {
+ if (olDevice_User != null) {
+ device.setId(olDevice_User.getId());
+ int i = tbl_Device_Mapper.updateTblDeviceUser(device);
+ if (i > 0) {
+ redisHelperI.deleteRedis(key);
+ redisHelperI.deleteRedis(key2);
+ Tbl_Device device1 = getDeviceById(device.getDeviceId());
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), userHelperI.getDeviceInfo(device1, device));
+ }
+ }
+ return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
+ } else {
+ return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
+ }
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 修改摄像头信息
+ *
+ * @param cameraId
+ * @param device_User
+ * @return
+ */
+ @Override
+ public Object updateCameraUser(Integer cameraId, Tbl_Device_User device_User) {
+ try {
+ Tbl_Device_User olDevice_User = getDeviceUserByUserId_CameraId(device_User.getUserId(), cameraId.toString());
+ if (olDevice_User != null) {
+ if (olDevice_User != null) {
+ String key = RedisKey.DeviceUser_Key + device_User.getUserId();
+ String key2 = RedisKey.DeviceUser_Key + "d" + olDevice_User.getDeviceId() + "_u" + device_User.getUserId();
+ device_User.setId(olDevice_User.getId());
+ int i = tbl_Device_Mapper.updateTblDeviceUser(device_User);
+ if (i > 0) {
+ redisHelperI.deleteRedis(key);
+ redisHelperI.deleteRedis(key2);
+ Map dataMap = new HashMap();
+ dataMap.put("cameraId", cameraId);
+ dataMap.put("showName", device_User.getShowName());
+ dataMap.put("isMaster", device_User.getIsMaster());
+ dataMap.put("isLook", device_User.getIsLook());
+ dataMap.put("isLive", device_User.getIsLive());
+ Tbl_Device camera = getDeviceById(olDevice_User.getDeviceId());
+ dataMap.put("isActive", camera.getActiveCode() != null && !camera.getActiveCode().equals("") ? "1" : "0");
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
+ }
+ }
+ return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
+ } else {
+ return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
+ }
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 解除绑定设备
+ *
+ * @param deviceUser
+ * @return
+ */
+ @Override
+ public Object deleteDeviceUser(Tbl_Device_User deviceUser) {
+ try {
+ Tbl_Device_User device_User = getDeviceUserByUserId_DeviceId(deviceUser.getUserId(), deviceUser.getDeviceId());
+ if (device_User != null) {
+ int i = tbl_Device_Mapper.deleteDeviceUserById(device_User.getId());
+ if (i > 0) {
+ String key = RedisKey.DeviceUser_Key + device_User.getUserId();
+ String key2 = RedisKey.DeviceUser_Key + "d" + device_User.getDeviceId() + "_u" + device_User.getUserId();
+ redisHelperI.deleteRedis(key);
+ redisHelperI.deleteRedis(key2);
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
+ }
+ }
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 删除绑定摄像头
+ *
+ * @param userId
+ * @param cameraId
+ * @return
+ */
+ @Override
+ public Object deleteCameraUser(Integer userId, String cameraId) {
+ try {
+ Tbl_Device_User device_User = getDeviceUserByUserId_CameraId(userId, cameraId);
+ if (device_User != null) {
+ int i = tbl_Device_Mapper.deleteDeviceUserById(device_User.getId());
+ if (i > 0) {
+ String key = RedisKey.DeviceUser_Key + device_User.getUserId();
+ String key2 = RedisKey.DeviceUser_Key + "d" + device_User.getDeviceId() + "_u" + device_User.getUserId();
+ String key3 = RedisKey.Camera_key + cameraId;
+ redisHelperI.deleteRedis(key);
+ redisHelperI.deleteRedis(key2);
+ redisHelperI.deleteRedis(key3);
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
+ }
+ }
+ } catch (Exception e) {
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 极光推送
+ *
+ * @param userId
+ */
+ public boolean jPushNotifcation(Map baseMap, Map pushMap) {
+ try {
+
+ } catch (Exception e) {
+ throw new RuntimeException();
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/ifish/helper/DeviceHelperI.java b/src/main/java/com/ifish/helper/DeviceHelperI.java
new file mode 100644
index 0000000..bc83b8d
--- /dev/null
+++ b/src/main/java/com/ifish/helper/DeviceHelperI.java
@@ -0,0 +1,124 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.ifish.helper;
+
+import com.ifish.bean.Tbl_Device;
+import com.ifish.bean.Tbl_Device_User;
+import com.ifish.bean.Tbl_User;
+import java.util.List;
+
+/**
+ *
+ * @author Administrator
+ */
+public interface DeviceHelperI {
+
+ /**
+ * 根据用户Id获取绑定设备集合
+ *
+ * @param userId
+ * @return
+ * @throws java.lang.Exception
+ */
+ List getDeviceUsersByUserId(Integer userId) throws Exception;
+
+ /**
+ * 根据用户ID和摄像头信息获取用户关联数据
+ *
+ * @return
+ */
+ Tbl_Device_User getDeviceUserByUserId_CameraId(Integer userId, String cameraId) throws Exception;
+
+ /**
+ * 根据设备Id获取设备详情
+ *
+ * @param deviceId
+ * @return
+ * @throws Exception
+ */
+ Tbl_Device getDeviceById(Integer deviceId) throws Exception;
+
+ /**
+ * 根据设备MacAddress获取设备详情
+ *
+ * @param macAddress
+ * @param deviceId
+ * @return
+ * @throws Exception
+ */
+ Tbl_Device getDeviceByMacAddress(String macAddress) throws Exception;
+
+ /**
+ * 绑定设备
+ *
+ * @param userId
+ * @param mackAddress
+ * @return
+ */
+ Object bindDevice(Integer userId, String mackAddress);
+
+ /**
+ * 激活摄像头
+ *
+ * @param activeCode
+ * @param cameraId
+ * @return
+ */
+ Object activeCamera(String activeCode, String cameraId);
+
+ /**
+ * 绑定摄像头
+ *
+ * @param userId
+ * @param cameraId
+ * @return
+ */
+ Object bindCamera(Integer userId, String cameraId);
+
+ /**
+ * 根据摄像头ID获取设备信息
+ *
+ * @param cameraId
+ * @return
+ */
+ Tbl_Device getDeviceByCameraId(String cameraId) throws Exception;
+
+ /**
+ * 修改设备信息
+ *
+ * @param device
+ * @param userId
+ * @return
+ */
+ Object updateDeviceUser(Tbl_Device_User device);
+
+ /**
+ * 修改摄像头信息
+ *
+ * @param cameraId
+ * @param device_User
+ * @return
+ */
+ Object updateCameraUser(Integer cameraId, Tbl_Device_User device_User);
+
+ /**
+ * 删除绑定摄像头
+ *
+ * @param userId
+ * @param cameraId
+ * @return
+ */
+ Object deleteCameraUser(Integer userId, String cameraId);
+
+ /**
+ * 删除绑定的设备
+ *
+ * @param deviceUser
+ * @return
+ */
+ Object deleteDeviceUser(Tbl_Device_User deviceUser);
+
+}
diff --git a/src/main/java/com/ifish/helper/FastDFSClient.java b/src/main/java/com/ifish/helper/FastDFSClient.java
new file mode 100644
index 0000000..04a5ea9
--- /dev/null
+++ b/src/main/java/com/ifish/helper/FastDFSClient.java
@@ -0,0 +1,145 @@
+/*
+ * 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.util.IfishFilePath;
+import com.ifish.util.IfishUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.csource.fastdfs.ClientGlobal;
+import org.csource.fastdfs.StorageClient1;
+import org.csource.fastdfs.StorageServer;
+import org.csource.fastdfs.TrackerClient;
+import org.csource.fastdfs.TrackerServer;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+@Component
+public class FastDFSClient implements FastDFSClientI {
+
+ private TrackerClient trackerClient = null;
+ private TrackerServer trackerServer = null;
+ private StorageServer storageServer = null;
+ //使用StorageClient1进行上传
+ private StorageClient1 storageClient1 = null;
+
+ public FastDFSClient() throws Exception {
+ //获取classpath路径下配置文件"fdfs_client.conf"的路径
+ //conf直接写相对于classpath的位置,不需要写classpath:
+ String conf = "";
+ if (IfishFilePath.link_img_head.contains("ifish7")) {
+ conf = "fdfs_client_ifish7.conf";
+ } else {
+ conf = "fdfs_client_zhangxinyanv5.conf";
+ }
+
+ String configPath = this.getClass().getClassLoader().getResource(conf).getFile();
+ System.out.println(configPath);
+ ClientGlobal.init(configPath);
+
+ trackerClient = new TrackerClient();
+ trackerServer = trackerClient.getConnection();
+ storageServer = trackerClient.getStoreStorage(trackerServer);
+ storageClient1 = new StorageClient1(trackerServer, storageServer);
+ }
+
+ /**
+ * 上传一个字节型文件
+ *
+ * @param file_buff 字节数组
+ * @param file_ext_name 文件后缀
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public String uploadFile(byte[] file_buff, String file_ext_name) throws Exception {
+
+ String result = "";
+
+ try {
+ result = storageClient1.upload_file1(file_buff, file_ext_name, null);
+ } catch (Exception e) {
+ try {
+ result = storageClient1.upload_file1(file_buff, file_ext_name, null);
+ } catch (Exception a) {
+ return "";
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * 上传一个本地文件
+ *
+ * @param local_filename 本地文件名(路径+文件名+后缀)
+ * @param file_ext_name 文件后缀
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public String uploadFile(String local_filename, String file_ext_name) throws Exception {
+
+ String result = storageClient1.upload_file1(local_filename, file_ext_name, null);
+
+ return result;
+ }
+
+ /**
+ * 上传一个文件
+ *
+ * @param group_name 指定位置
+ * @param local_filename 本地文件名(路径+文件名+后缀)
+ * @param file_ext_name 文件后缀
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public String uploadFile(String group_name, String local_filename, String file_ext_name) throws Exception {
+
+ String result = storageClient1.upload_file1(group_name, local_filename, file_ext_name, null);
+
+ return result;
+ }
+
+ public String getFileType(MultipartFile file) {
+ String[] allowTypes = new String[]{".mp4", ".png", ".jpg", ".bmp"};
+ String filename = file.getOriginalFilename();
+ if (StringUtils.isNotBlank(filename)) {
+ for (String allowType : allowTypes) {
+ if (filename.contains(allowType)) {
+ return allowType.replace(".", "");
+ }
+ }
+ }
+ return "";
+ }
+
+ @Override
+ public String uploadFileToFastDFS(MultipartFile file) {
+ try {
+ String type = getFileType(file);
+ if (StringUtils.isBlank(type)) {
+ return null;
+ }
+ byte[] bt = file.getBytes();
+ String url = uploadFile(bt, type);
+ if (url.contains("group1/M00/")) {
+ url = url.replace("group1/M00/", "");
+ } else {
+ return "";
+ }
+ //本地返回测试环境fastfds,线上返回正式服务器部署的fastfds
+ if (IfishUtil.IsWinOrUnix()) {
+ return IfishFilePath.fastDFS_url_app + url;
+ } else {
+ return IfishFilePath.link_img_head + url;
+ }
+
+ } catch (Exception e) {
+ return "";
+ }
+ }
+}
diff --git a/src/main/java/com/ifish/helper/FastDFSClientI.java b/src/main/java/com/ifish/helper/FastDFSClientI.java
new file mode 100644
index 0000000..a937ff3
--- /dev/null
+++ b/src/main/java/com/ifish/helper/FastDFSClientI.java
@@ -0,0 +1,55 @@
+/*
+ * 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 org.springframework.web.multipart.MultipartFile;
+
+/**
+ * FastDFS分布式文件管理系统接口方法
+ *
+ * @author Administrator
+ */
+public interface FastDFSClientI {
+
+ /**
+ * 上传一个字节型文件
+ *
+ * @param file_buff 字节数组
+ * @param file_ext_name 文件后缀
+ * @return
+ * @throws Exception
+ */
+ String uploadFile(byte[] file_buff, String file_ext_name) throws Exception;
+
+ /**
+ * 上传一个本地文件
+ *
+ * @param local_filename 本地文件名(路径+文件名+后缀)
+ * @param file_ext_name 文件后缀
+ * @return
+ * @throws Exception
+ */
+ String uploadFile(String local_filename, String file_ext_name) throws Exception;
+
+ /**
+ * 上传一个文件
+ *
+ * @param group_name 指定位置
+ * @param local_filename 本地文件名(路径+文件名+后缀)
+ * @param file_ext_name 文件后缀
+ * @return
+ * @throws Exception
+ */
+ String uploadFile(String group_name, String local_filename, String file_ext_name) throws Exception;
+
+ /**
+ * 上传一个MultipartFile类型文件,返回成功后文件路径,适用于保存完整路径方法
+ *
+ * @param file
+ * @return
+ */
+ String uploadFileToFastDFS(MultipartFile file);
+}
diff --git a/src/main/java/com/ifish/helper/HardWareTypeHelper.java b/src/main/java/com/ifish/helper/HardWareTypeHelper.java
new file mode 100644
index 0000000..c293548
--- /dev/null
+++ b/src/main/java/com/ifish/helper/HardWareTypeHelper.java
@@ -0,0 +1,66 @@
+/*
+ * 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_HardWare_Type;
+import com.ifish.bean.Tbl_Vender;
+import com.ifish.mapper.Tbl_Hardware_Type_Mapper;
+import com.ifish.util.IfishUtil;
+import com.ifish.util.RedisKey;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * @author Administrator
+ */
+@Component
+public class HardWareTypeHelper implements HardWareTypeHelperI {
+
+ /**
+ * 所有tbl_Hardware_Type表的操作方法接口
+ */
+ @Autowired
+ private Tbl_Hardware_Type_Mapper tbl_Hardware_Type_Mapper;
+
+ /**
+ * redis缓存服务器方法接口
+ */
+ @Autowired
+ private RedisHelperI redisHelperI;
+
+ @Override
+ public Tbl_HardWare_Type getHardwareTypeByTypeCode(String code) throws Exception {
+ Tbl_HardWare_Type hardwareType = null;
+ String key = RedisKey.HardWareType_key + code;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ hardwareType = (Tbl_HardWare_Type) IfishUtil.JsonToBean(redisString, Tbl_HardWare_Type.class);
+ } else {
+ hardwareType = tbl_Hardware_Type_Mapper.getHardwareTypeByTypeCode(code);
+ if (hardwareType != null && StringUtils.isNotBlank(hardwareType.getHardwareType())) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(hardwareType));
+ }
+ }
+ return hardwareType;
+ }
+
+ @Override
+ public Tbl_Vender getVenderListByBrandCode(String code) throws Exception {
+ Tbl_Vender venderList = new Tbl_Vender();
+ String key = RedisKey.VenderList_key + code;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ venderList = (Tbl_Vender) IfishUtil.JsonToBean(redisString, Tbl_Vender.class);
+ } else {
+ venderList = tbl_Hardware_Type_Mapper.getVenderListByBrandCode(code);
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(venderList));
+ }
+ return venderList;
+ }
+}
+
diff --git a/src/main/java/com/ifish/helper/HardWareTypeHelperI.java b/src/main/java/com/ifish/helper/HardWareTypeHelperI.java
new file mode 100644
index 0000000..284a9d5
--- /dev/null
+++ b/src/main/java/com/ifish/helper/HardWareTypeHelperI.java
@@ -0,0 +1,34 @@
+/*
+ * 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_HardWare_Type;
+import com.ifish.bean.Tbl_Vender;
+
+/**
+ *
+ * @author Administrator
+ */
+public interface HardWareTypeHelperI {
+
+ /**
+ * 根据设备型号获取设备类型参数
+ *
+ * @param code
+ * @return
+ */
+ Tbl_HardWare_Type getHardwareTypeByTypeCode(String code) throws Exception;
+
+ /**
+ * 根据厂家code获取厂家信息
+ *
+ * @param code
+ * @return
+ * @throws Exception
+ */
+ Tbl_Vender getVenderListByBrandCode(String code) throws Exception;
+
+}
diff --git a/src/main/java/com/ifish/helper/LiveRoomHelper.java b/src/main/java/com/ifish/helper/LiveRoomHelper.java
new file mode 100644
index 0000000..56b9c29
--- /dev/null
+++ b/src/main/java/com/ifish/helper/LiveRoomHelper.java
@@ -0,0 +1,429 @@
+/*
+ * 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.Interceptor.IfishException;
+import com.ifish.bean.LiveRoomPageInfo;
+import com.ifish.bean.Tbl_Device_User;
+import com.ifish.bean.Tbl_Live_Message;
+import com.ifish.bean.Tbl_Live_Room;
+import com.ifish.bean.Tbl_User;
+import com.ifish.enums.ResultEnum;
+import com.ifish.mapper.Tbl_Live_Room_Mapper;
+import com.ifish.util.IfishUtil;
+import com.ifish.util.RedisKey;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import static org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.json;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ *
+ * @author Administrator
+ */
+@Component
+public class LiveRoomHelper implements LiveRoomHelperI {
+
+ @Autowired
+ private FastDFSClientI fastDFSClientI;
+
+ @Autowired
+ private Tbl_Live_Room_Mapper tbl_Live_Room_Mapper;
+
+ @Autowired
+ private UserHelperI userHelperI;
+
+ @Autowired
+ private DeviceHelperI deviceHelperI;
+
+ @Autowired
+ private RedisHelperI redisHelperI;
+
+ /**
+ * 新增直播间
+ *
+ * @param fileUpload
+ * @param liveRoom
+ */
+ @Override
+ public Object addLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom) {
+ try {
+ if (liveRoom.getUserId() == null || liveRoom.getUserId() <= 0) {
+ throw new IfishException(ResultEnum.error401);
+ }
+ if (StringUtils.isBlank(liveRoom.getRoomName()) || liveRoom.getRoomName().length() > 20) {
+ throw new IfishException(ResultEnum.error401);
+ }
+ if (StringUtils.isBlank(liveRoom.getRoomDesc()) || liveRoom.getRoomDesc().length() > 70) {
+ throw new IfishException(ResultEnum.error401);
+ }
+ if (StringUtils.isBlank(liveRoom.getRoomStatus()) || liveRoom.getRoomStatus().length() > 1) {
+ throw new IfishException(ResultEnum.error401);
+ }
+ if (StringUtils.isBlank(liveRoom.getCameraId()) || liveRoom.getCameraId().length() > 20) {
+ throw new IfishException(ResultEnum.error401);
+ }
+ if (fileUpload == null || fileUpload.getSize() > 1048576) {
+ //throw new IfishException(ResultEnum.warn206);
+ }
+ String file = fastDFSClientI.uploadFileToFastDFS(fileUpload);
+ if (StringUtils.isNotBlank(file)) {
+ liveRoom.setRoomImg(file);
+ }
+
+ //用户ID
+ Integer userId = liveRoom.getUserId();
+ Tbl_User user = userHelperI.getUserById(userId);
+ if (user == null) {
+ throw new IfishException(ResultEnum.error402);
+ }
+ //用户是否绑定摄像头
+ String cameraId = liveRoom.getCameraId();
+ Tbl_Device_User cameraUser = deviceHelperI.getDeviceUserByUserId_CameraId(userId, cameraId);
+
+ if (cameraUser == null) {
+ throw new IfishException(ResultEnum.error402);
+ }
+ //原来不是开启状态
+ Boolean cameraChange = false;
+ if (cameraUser.getIsLive().equals("0")) {
+ cameraUser.setIsLive("1");
+ cameraChange = true;
+ }
+ //新增直播间
+ liveRoom.setCreateTime(new Date());
+ liveRoom.setFirstShare(0);
+ liveRoom.setPopularityValue(0);
+ int i = tbl_Live_Room_Mapper.insertLiveRoom(liveRoom);
+ if (i > 0) {
+ if (cameraChange) {
+ deviceHelperI.updateDeviceUser(cameraUser);
+ }
+ Map map = new HashMap();
+ map.put("cameraId", cameraId);
+ map.put("isLive", cameraUser.getIsLive());
+ map.put("roomId", liveRoom.getRoomId());
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ }
+
+ /**
+ * 根据直播间ID获取直播间详情
+ *
+ * @param roomId
+ * @return
+ */
+ public Tbl_Live_Room getLive_RoomById(Integer roomId) throws Exception {
+ Tbl_Live_Room live_Room = null;
+ String key = RedisKey.LiveRoom_key + roomId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ live_Room = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
+ } else {
+ live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomById(roomId);
+ if (live_Room != null && live_Room.getRoomId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(live_Room));
+ }
+ }
+ return live_Room;
+ }
+
+ /**
+ * 根据用户ID获取直播间详情
+ *
+ * @param roomId
+ * @return
+ */
+ public Tbl_Live_Room getLive_RoomByUserId(Integer userId) throws Exception {
+ Tbl_Live_Room live_Room = null;
+ String key = RedisKey.LiveRoom_key + "u_" + userId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ live_Room = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
+ } else {
+ live_Room = tbl_Live_Room_Mapper.getLive_RoomByUserId(userId);
+ if (live_Room != null && live_Room.getRoomId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(live_Room));
+ }
+ }
+ return live_Room;
+ }
+
+ /**
+ * 根据房间ID查询直播间
+ *
+ * @param roomId
+ * @return
+ */
+ public Tbl_Live_Room getTbl_Live_RoomById(Integer roomId) throws Exception {
+ Tbl_Live_Room device = null;
+ String key = RedisKey.LiveRoom_key + roomId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ device = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
+ } else {
+ device = tbl_Live_Room_Mapper.getTbl_Live_RoomById(roomId);
+ if (device != null && device.getRoomId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
+ }
+ }
+ return device;
+ }
+
+ /**
+ * 直播间点赞
+ *
+ * @param roomId
+ * @param userId
+ * @return
+ */
+ @Override
+ public Object liveRoomsZan(Integer roomId, Integer userId) {
+ try {
+ //点赞和人气值不一样,人气值只此直播间点击数,点赞指观看此直播并点赞的人数
+ Tbl_Live_Room room = getTbl_Live_RoomById(roomId);
+ if (room == null) {
+ throw new IfishException(ResultEnum.error402);
+ }
+ Tbl_User user = userHelperI.getUserById(userId);
+ if (user == null) {
+ throw new IfishException(ResultEnum.error402);
+ }
+ //点赞数量
+ Integer zanNum = tbl_Live_Room_Mapper.getLiveRoomZanCountByRoomId(roomId);
+ //是否点过赞
+ int i = tbl_Live_Room_Mapper.IsZan(roomId, userId);
+ Map map = new HashMap();
+ //点赞过,取消点赞
+ if (i > 0) {
+ int j = tbl_Live_Room_Mapper.cancelZan(roomId, userId);
+ //成功取消
+ if (j > 0) {
+ zanNum--;
+ map.put("isZan", 0);
+ map.put("zanNum", zanNum);
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
+ }
+ } //没有点赞,点赞一次
+ else {
+ int j = tbl_Live_Room_Mapper.ImplementZan(roomId, userId);
+ if (j > 0) {
+ zanNum++;
+ map.put("isZan", 1);
+ map.put("zanNum", zanNum);
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
+ }
+ }
+
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ /**
+ * 直播间留言
+ *
+ * @param liveMessage
+ * @return
+ */
+ @Override
+ public Object leaveMessage(Tbl_Live_Message liveMessage) {
+ try {
+ Integer roomId = liveMessage.getRoomId();
+ Integer userId = liveMessage.getUserId();
+ String messageContent = new String(liveMessage.getMessageContent().getBytes("ISO-8859-1"), "UTF-8");
+ liveMessage.setMessageContent(messageContent);
+ if (roomId != null && userId != null && StringUtils.isNotBlank(messageContent)) {
+ Tbl_Live_Room live_Room = getLive_RoomById(roomId);
+ Tbl_User user = userHelperI.getUserById(userId);
+ if (live_Room != null && user != null) {
+ liveMessage.setCreateTime(new Date());
+ int i = tbl_Live_Room_Mapper.insertLiveMessage(liveMessage);
+ if (i > 0) {
+ liveMessage.setUserName(user.getNickName());
+ liveMessage.setUserImg(user.getUserImg());
+ }
+ liveMessage.setUserName(user.getNickName());
+ liveMessage.setUserImg(user.getUserImg());
+ Integer asUserId = liveMessage.getAsUserId();
+ if (asUserId != null) {
+ Tbl_User asUser = userHelperI.getUserById(asUserId);
+ if (asUser != null) {
+ liveMessage.setAsUserName(asUser.getNickName());
+ if (!asUserId.equals(userId)) {
+ //发送云信消息给所@的用户
+ //neteaseIM.sendMsg(userId.toString(), asUserId.toString(), "来自爱鱼看看的回复:" + messageContent, "");
+ }
+ } else {
+ Integer roomUserId = live_Room.getUserId();
+ if (!roomUserId.equals(userId)) {
+ //发送云信消息给房主
+ //neteaseIM.sendMsg(userId.toString(), roomUserId.toString(), "来自爱鱼看看的留言:" + messageContent, "");
+ }
+ }
+ }
+ return IfishUtil.toJson(ResultEnum.success.getKey(), liveMessage);
+ }
+ }
+ return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
+ } catch (Exception e) {
+ return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 根据用户ID获取直播间信息
+ *
+ * @param userId
+ * @return
+ */
+ @Override
+ public Object getLiveRoomInfo(Integer userId) {
+ try {
+ if (userId != null) {
+ //查找直播间信息
+ Tbl_Live_Room curLiveRoom = getLive_RoomByUserId(userId);
+ if (curLiveRoom != null) {
+ Map map = new HashMap();
+ Integer roomId = curLiveRoom.getRoomId();
+ map.put("roomId", roomId);
+ map.put("userId", curLiveRoom.getUserId());
+ map.put("roomName", curLiveRoom.getRoomName());
+ map.put("roomDesc", curLiveRoom.getRoomDesc());
+ map.put("popularityValue", curLiveRoom.getPopularityValue());
+ map.put("roomStatus", curLiveRoom.getRoomStatus());
+ return IfishUtil.toJson(ResultEnum.success.getKey(), map);
+ }
+ }
+ return IfishUtil.toJson(ResultEnum.success.getKey(), "");
+ } catch (Exception e) {
+ return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 根据条件查询直播间列表
+ *
+ * @param firstResult
+ * @param pageSize
+ * @param userId
+ * @param orders
+ * @return
+ */
+ @Override
+ public Object getLiveRooms(Integer firstResult, Integer pageSize, Integer userId, String orders) {
+ try {
+ if (firstResult != null && pageSize != null && userId != null) {
+ Map returnMap = new HashMap();
+ Map map = new HashMap();
+ if (firstResult == 0) {
+ Tbl_User user = userHelperI.getUserById(userId);
+ if (user != null) {
+ //经度
+ Double longitude = user.getLongitude();
+ //纬度
+ Double latitude = user.getLatitude();
+ //距离用户最近的前5条记录
+ List distanceList = tbl_Live_Room_Mapper.getLiveRoomListByLongLat(longitude, latitude);
+ for (LiveRoomPageInfo liveRoomInfo : distanceList) {
+ Integer roomId = liveRoomInfo.getRoomId();
+ map.put(roomId, liveRoomInfo);
+ }
+ //获取用户最近浏览的5条记录
+ List browseList = this.liveRoomDao.findByBrowse(userId);
+ for (LiveRoomPageInfo liveRoomInfo : browseList) {
+ Integer roomId = liveRoomInfo.getRoomId();
+ map.put(roomId, liveRoomInfo);
+ }
+ //获取人气值最高的5条记录
+ List popularityList = this.liveRoomDao.findByPopularityValue();
+ for (LiveRoomPageInfo liveRoomInfo : popularityList) {
+ Integer roomId = liveRoomInfo.getRoomId();
+ map.put(roomId, liveRoomInfo);
+ }
+ //去重条件
+ orders = StringUtils.join(map.keySet().toArray(), ",");
+ //根据开播时间倒序排列
+ Pagination page = this.liveRoomDao.findByTime(firstResult, pageSize, orders);
+ List timeList = page.getList();
+ for (LiveRoomPageInfo liveRoomInfo : timeList) {
+ Integer roomId = liveRoomInfo.getRoomId();
+ map.put(roomId, liveRoomInfo);
+ }
+ List list = new ArrayList();
+ Long curTime = new Date().getTime();
+ //计算活跃值
+ for (LiveRoomPageInfo liveRoomInfo : map.values()) {
+ Long loginTime = liveRoomInfo.getLoginTime().getTime();
+ //最近登录天数
+ Integer days = (int) ((curTime - loginTime) / (1000 * 60 * 60 * 24));
+ //小于一周
+ if (days <= 7) {
+ liveRoomInfo.setLiveness("优");
+ } //一周至半个月
+ else if (days > 7 && days <= 15) {
+ liveRoomInfo.setLiveness("良");
+ } //半个月至一个月
+ else if (days > 15 && days <= 30) {
+ liveRoomInfo.setLiveness("中");
+ } else {
+ liveRoomInfo.setLiveness("差");
+ }
+ list.add(liveRoomInfo);
+ }
+ returnMap.put("orders", orders);
+ returnMap.put("total", page.getTotalCount());
+ returnMap.put("liveRoomInfo", list);
+ return IfishUtil.toJson(ResultEnum.success.getKey(), returnMap);
+ }
+ } else {
+ //根据开播时间倒序排列
+ Pagination page = this.liveRoomDao.findByTime(firstResult, pageSize, orders);
+ List timeList = page.getList();
+ Long curTime = new Date().getTime();
+ //计算活跃值
+ for (LiveRoomPageInfo liveRoomInfo : timeList) {
+ Long loginTime = liveRoomInfo.getLoginTime().getTime();
+ //最近登录天数
+ Integer days = (int) ((curTime - loginTime) / (1000 * 60 * 60 * 24));
+ //小于一周
+ if (days <= 7) {
+ liveRoomInfo.setLiveness("优");
+ } //一周至半个月
+ else if (days > 7 && days <= 15) {
+ liveRoomInfo.setLiveness("良");
+ } //半个月至一个月
+ else if (days > 15 && days <= 30) {
+ liveRoomInfo.setLiveness("中");
+ } else {
+ liveRoomInfo.setLiveness("差");
+ }
+ }
+ returnMap.put("orders", orders);
+ returnMap.put("total", page.getTotalCount());
+ returnMap.put("liveRoomInfo", timeList);
+ return IfishUtil.toJson(ResultEnum.success.getKey(), returnMap);
+ }
+ }
+ return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
+ } catch (Exception e) {
+ return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+}
diff --git a/src/main/java/com/ifish/helper/LiveRoomHelperI.java b/src/main/java/com/ifish/helper/LiveRoomHelperI.java
new file mode 100644
index 0000000..2234d45
--- /dev/null
+++ b/src/main/java/com/ifish/helper/LiveRoomHelperI.java
@@ -0,0 +1,62 @@
+/*
+ * 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_Live_Message;
+import com.ifish.bean.Tbl_Live_Room;
+import com.ifish.controller.LiveRoom;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ *
+ * @author Administrator
+ */
+public interface LiveRoomHelperI {
+
+ /**
+ * 新增直播间
+ *
+ * @param fileUpload
+ * @param liveRoom
+ */
+ Object addLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom);
+
+ /**
+ * 直播间点赞
+ *
+ * @param roomId
+ * @param userId
+ * @return
+ */
+ Object liveRoomsZan(Integer roomId, Integer userId);
+
+ /**
+ * 直播间留言
+ *
+ * @param liveMessage
+ * @return
+ */
+ Object leaveMessage(Tbl_Live_Message liveMessage);
+
+ /**
+ * 根据用户ID获取直播间信息
+ *
+ * @param userId
+ * @return
+ */
+ Object getLiveRoomInfo(Integer userId);
+
+ /**
+ * 根据条件查询直播间列表
+ *
+ * @param firstResult
+ * @param pageSize
+ * @param userId
+ * @param orders
+ * @return
+ */
+ Object getLiveRooms(Integer firstResult, Integer pageSize, Integer userId, String orders);
+}
diff --git a/src/main/java/com/ifish/helper/PushMessageHelper.java b/src/main/java/com/ifish/helper/PushMessageHelper.java
new file mode 100644
index 0000000..93e3e9b
--- /dev/null
+++ b/src/main/java/com/ifish/helper/PushMessageHelper.java
@@ -0,0 +1,110 @@
+/*
+ * 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.PageResult;
+import com.ifish.bean.Tbl_Push_List;
+import com.ifish.enums.ResultEnum;
+import com.ifish.mapper.Tbl_Push_List_Mapper;
+import com.ifish.util.IfishUtil;
+import com.ifish.util.RedisKey;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * @author Administrator
+ */
+@Component
+public class PushMessageHelper implements PushMessageHelperI {
+
+ @Autowired
+ private Tbl_Push_List_Mapper tbl_Push_List_Mapper;
+
+ @Autowired
+ private RedisHelperI redisHelperI;
+
+ /**
+ * 根据条件获取推送列表
+ *
+ * @param pushId
+ * @param userId
+ * @param firstResult
+ * @param pageSize
+ * @return
+ */
+ @Override
+ public Object getPushList(String pushType, Integer userId, Integer firstResult, Integer pageSize) {
+ try {
+ if (firstResult == null) {
+ firstResult = 0;
+ }
+ if (pageSize == null) {
+ pageSize = 10;
+ }
+ if (userId == null) {
+ return IfishUtil.returnJson(ResultEnum.error401.getKey(), "");
+ }
+ List list = tbl_Push_List_Mapper.getPushList(userId, pushType, pageSize, firstResult);
+ int count = tbl_Push_List_Mapper.getPushListCount(userId, pushType, pageSize, firstResult);
+ PageResult page = new PageResult();
+ page.setList(list);
+ page.setPageNo(firstResult);
+ page.setPageSize(pageSize);
+ page.setTotalCount(count);
+ return IfishUtil.returnPageData(page, ResultEnum.success.getKey());
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 删除推送消息
+ *
+ * @param userId
+ * @param pushId
+ * @return
+ */
+ @Override
+ public Object deletePushList(Integer userId, Integer pushId) {
+ try {
+ Tbl_Push_List tpl = getPush_ListById(pushId);
+ if (tpl.getUserId().equals(userId)) {
+ int i = tbl_Push_List_Mapper.deletePushListById(pushId);
+ if (i > 0) {
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
+ }
+ }
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 根据ID从缓存中获取推送消息对象
+ *
+ * @param pushId
+ * @return
+ * @throws Exception
+ */
+ public Tbl_Push_List getPush_ListById(Integer pushId) throws Exception {
+ Tbl_Push_List list = null;
+ String key = RedisKey.PUSHLIST_KEY + pushId;
+ String redisString = redisHelperI.getRedis(key);
+ if (StringUtils.isNotBlank(redisString)) {
+ list = (Tbl_Push_List) IfishUtil.JsonToBean(redisString, Tbl_Push_List.class);
+ } else {
+ list = tbl_Push_List_Mapper.getPush_ListById(pushId);
+ if (list != null && list.getPushId() > 0) {
+ redisHelperI.setRedis(key, IfishUtil.ObjectToJson(list));
+ }
+ }
+ return list;
+ }
+}
diff --git a/src/main/java/com/ifish/helper/PushMessageHelperI.java b/src/main/java/com/ifish/helper/PushMessageHelperI.java
new file mode 100644
index 0000000..00a6aa0
--- /dev/null
+++ b/src/main/java/com/ifish/helper/PushMessageHelperI.java
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ *
+ * @author Administrator
+ */
+public interface PushMessageHelperI {
+
+ /**
+ * 根据条件获取推送列表
+ *
+ * @param pushId
+ * @param userId
+ * @param firstResult
+ * @param pageSize
+ * @return
+ */
+ Object getPushList(String pushType, Integer userId, Integer firstResult, Integer pageSize);
+
+ /**
+ * 删除推送消息
+ *
+ * @param userId
+ * @param pushId
+ * @return
+ */
+ Object deletePushList(Integer userId, Integer pushId);
+}
diff --git a/src/main/java/com/ifish/helper/RedisHelper.java b/src/main/java/com/ifish/helper/RedisHelper.java
new file mode 100644
index 0000000..5f8f512
--- /dev/null
+++ b/src/main/java/com/ifish/helper/RedisHelper.java
@@ -0,0 +1,172 @@
+/*
+ * 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.util.IfishUtil;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+/**
+ * redis缓存服务器所有接口方法
+ *
+ * @author Administrator
+ */
+@Component
+public class RedisHelper implements RedisHelperI {
+
+ @Autowired
+ private StringRedisTemplate redis;
+
+ /*
+ *获取缓存值
+ */
+ @Override
+ public String getRedis(String key) {
+ try {
+ String result = redis.opsForValue().get(key.toLowerCase());
+ return result;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /*
+ *设置缓存(默认时间为1天)
+ */
+ @Override
+ public void setRedis(String key, String value) {
+ if (value == null) {
+ return;
+ }
+ try {
+ redis.opsForValue().set(key.toLowerCase(), value, IfishUtil.CacheTime_DAYS, TimeUnit.DAYS);
+ } catch (Exception e) {
+ }
+ }
+
+ /*设置自定义时效缓存
+ *key 缓存名称,value缓存值(string),time(保存时间),unit(时间类型)
+ */
+ @Override
+ public void setRedis(String key, String value, int time, TimeUnit unit) {
+ if (value == null) {
+ return;
+ }
+ try {
+ redis.opsForValue().set(key.toLowerCase(), value, time, unit);
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ *设置按天时效缓存
+ */
+ @Override
+ public void setRedisToDAYS(String key, String value) {
+ if (value == null) {
+ return;
+ }
+ try {
+ redis.opsForValue().set(key.toLowerCase(), value, IfishUtil.CacheTime_DAYS, TimeUnit.DAYS);
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ *设置按时时效缓存
+ */
+ @Override
+ public void setRedisToHOURS(String key, String value) {
+ if (value == null) {
+ return;
+ }
+ try {
+ redis.opsForValue().set(key.toLowerCase(), value, IfishUtil.CacheTime_HOURS, TimeUnit.HOURS);
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ *设置按分时效缓存
+ */
+ @Override
+ public void setRedisToMINUTES(String key, String value) {
+ if (value == null) {
+ return;
+ }
+ try {
+ redis.opsForValue().set(key.toLowerCase(), value, IfishUtil.CacheTime_MINUTES, TimeUnit.MINUTES);
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ *设置按秒时效缓存
+ */
+ @Override
+ public void setRedisToSECONDS(String key, String value) {
+ if (value == null) {
+ return;
+ }
+ try {
+ redis.opsForValue().set(key.toLowerCase(), value, IfishUtil.CacheTime_SECONDS, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ *删除缓存值
+ */
+ @Override
+ public void deleteRedis(String key) {
+ try {
+ redis.delete(key.toLowerCase());
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ *删除带前缀的批量缓存
+ *tagkey 缓存前缀
+ *如省份缓存 province:10,前缀为province
+ */
+ @Override
+ public void delRedisByTagKey(String tagkey) {
+ try {
+ Set set = redis.keys(tagkey.toLowerCase() + "*");
+ Iterator it = set.iterator();
+ while (it.hasNext()) {
+ String keyStr = it.next();
+ redis.delete(keyStr);
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ * 删除当前缓存数据库所有的key
+ * 排除系数设置缓存
+ */
+ @Override
+ public void deleteDBRedis() {
+ try {
+ Set set = redis.keys("*");
+ Iterator it = set.iterator();
+ while (it.hasNext()) {
+ String keyStr = it.next();
+ //排除系数设置缓存
+ if (!keyStr.contains("recommendsetting:")) {
+ redis.delete(keyStr);
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+}
diff --git a/src/main/java/com/ifish/helper/RedisHelperI.java b/src/main/java/com/ifish/helper/RedisHelperI.java
new file mode 100644
index 0000000..0faa9cb
--- /dev/null
+++ b/src/main/java/com/ifish/helper/RedisHelperI.java
@@ -0,0 +1,69 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.ifish.helper;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * redis缓存服务器所有接口方法
+ *
+ * @author Administrator
+ */
+public interface RedisHelperI {
+
+ /*
+ *删除带前缀的批量缓存
+ *tagkey 缓存前缀
+ *如省份缓存 province:10,前缀为province
+ */
+ void delRedisByTagKey(String tagkey);
+
+ /*
+ *删除缓存值
+ */
+ void deleteRedis(String key);
+
+ /*
+ *删除当前缓存数据库所有的key
+ */
+ void deleteDBRedis();
+
+ /*
+ *获取缓存值
+ */
+ String getRedis(String key);
+
+ /*
+ *设置缓存(有效时间默认为1天)
+ */
+ void setRedis(String key, String value);
+
+ /*设置自定义时效缓存
+ *key 缓存名称,value缓存值(string),time(保存时间),unit(时间类型)
+ */
+ void setRedis(String key, String value, int time, TimeUnit unit);
+
+ /*
+ *设置按天时效缓存
+ */
+ void setRedisToDAYS(String key, String value);
+
+ /*
+ *设置按时时效缓存
+ */
+ void setRedisToHOURS(String key, String value);
+
+ /*
+ *设置按分时效缓存
+ */
+ void setRedisToMINUTES(String key, String value);
+
+ /*
+ *设置按秒时效缓存
+ */
+ void setRedisToSECONDS(String key, String value);
+
+}
diff --git a/src/main/java/com/ifish/helper/UserHelper.java b/src/main/java/com/ifish/helper/UserHelper.java
new file mode 100644
index 0000000..703f4e8
--- /dev/null
+++ b/src/main/java/com/ifish/helper/UserHelper.java
@@ -0,0 +1,473 @@
+/*
+ * 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.API.GwellApi;
+import com.ifish.bean.Tbl_Device;
+import com.ifish.bean.Tbl_Device_User;
+import com.ifish.bean.Tbl_HardWare_Type;
+import com.ifish.bean.Tbl_User;
+import com.ifish.bean.Tbl_Vender;
+import com.ifish.enums.GwellEnum;
+import com.ifish.enums.ResultEnum;
+import com.ifish.mapper.Tbl_Hardware_Type_Mapper;
+import com.ifish.mapper.Tbl_User_Mapper;
+import com.ifish.util.IfishUtil;
+import com.ifish.util.RedisKey;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * @author Administrator
+ */
+@Component
+public class UserHelper implements UserHelperI {
+
+ /**
+ * redis缓存服务器方法接口
+ */
+ @Autowired
+ private RedisHelperI redisHelperI;
+
+ /**
+ * 所有tbl_user表的操作方法接口
+ */
+ @Autowired
+ private Tbl_User_Mapper tbl_User_Mapper;
+
+ @Autowired
+ private DeviceHelperI deviceHelperI;
+
+ @Autowired
+ private HardWareTypeHelperI hardWareTypeHelperI;
+
+ /**
+ * 登陆接口
+ *
+ * @param user
+ * @return
+ */
+ @Override
+ public Object login(Tbl_User user) {
+ try {
+ Tbl_User tmpUser = null;
+ //如果用户手机不为空,进行手机登陆
+ if (StringUtils.isNotBlank(user.getPhoneNumber())) {
+ tmpUser = tbl_User_Mapper.getUserByPhoneNumber(user.getPhoneNumber());
+ return checkUserPassword(tmpUser, user);
+ } //如果用户邮箱不为空,进行邮箱登陆
+ else if (StringUtils.isNotBlank(user.getUserEmail())) {
+ tmpUser = tbl_User_Mapper.getUserByUserEmail(user.getPhoneNumber());
+ return checkUserPassword(tmpUser, user);
+ } //如果用户手机邮箱都为空,用户ID不为空,则进行游客登陆
+ else if (user.getUserId() != null && user.getUserId() > 0) {
+ tmpUser = getUserById(user.getUserId());
+ return touristLogin(tmpUser);
+ }
+ //密码不正确
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ } catch (Exception e) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 根据用户ID从缓存中获取用户对象
+ *
+ * @param userId
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public Tbl_User getUserById(Integer userId) throws Exception {
+ Tbl_User tmpUser = null;
+ String userKey = RedisKey.User_Key + userId;
+ String userString = redisHelperI.getRedis(userKey);
+ //1.从数据库或缓存中读取用户对象
+ if (StringUtils.isNotBlank(userString)) {
+ tmpUser = (Tbl_User) IfishUtil.JsonToBean(userString, Tbl_User.class);
+ } else {
+ tmpUser = tbl_User_Mapper.getUserByUserId(userId + "");
+ saveUserToRedis(tmpUser);
+ }
+ return tmpUser;
+ }
+
+ /**
+ * 游客注册接口
+ *
+ * @return
+ */
+ @Override
+ public Object touristRegister() {
+ Tbl_User user = new Tbl_User();
+ user.setUserType("0");
+ int i = tbl_User_Mapper.insertUser(user);
+ Map result = new HashMap();
+ if (i > 0 && user.getUserId() > 0) {
+ //4.1未注册技威,则注册获取code1,code2
+ Map gwellMap = registUserGWell(user, false);
+ user = (Tbl_User) gwellMap.get("user");
+ Integer updateInteger = tbl_User_Mapper.updateUser(user);
+ //如果修改失败,返回错误信息
+ if (updateInteger <= 0) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+
+ try {
+ saveUserToRedis(user);
+ } catch (Exception e) {
+ }
+
+ result.put("userId", user.getUserId());
+ result.put("P2PVerifyCode1", user.getP2pverifyCode1());
+ result.put("P2PVerifyCode2", user.getP2pverifyCode2());
+ result.put("gwellUserID", user.getGwellUserid());
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), result);
+ } else {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ }
+
+ /**
+ * 邮箱和手机登陆用户,需要进行密码验证,游客登陆不需要
+ *
+ * @param tmpUser
+ * @param user
+ * @return
+ * @throws Exception
+ */
+ private Object checkUserPassword(Tbl_User tmpUser, Tbl_User user) throws Exception {
+ //2.如果都为空,则没有此用户,返回未注册信息
+ if (tmpUser == null) {
+ //用户不存在
+ return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
+ }
+ //3.验证密码是否正确
+ if (tmpUser.getUserPassword().equals(user.getUserPassword())) {
+ //4.如果密码正确,确认是否更新用户信息
+
+ //是否更新
+ boolean isUpdate = false;
+
+ //4.1未注册技威,则注册获取code1,code2
+ Map gwellMap = registUserGWell(tmpUser, isUpdate);
+ tmpUser = (Tbl_User) gwellMap.get("user");
+ isUpdate = (Boolean) gwellMap.get("isUpdate");
+
+ //4.3登陆次数修改
+ Integer logincount = tbl_User_Mapper.executeLoginUpdate(tmpUser.getUserId(), user.getLoginType());
+ //修改失败,返回错误信息
+ if (logincount <= 0) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ //4.4验证是否需要修改技威等信息,如果需要则进行修改
+ if (isUpdate) {
+ Integer updateInteger = tbl_User_Mapper.updateUser(tmpUser);
+ //如果修改失败,返回错误信息
+ if (updateInteger <= 0) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ saveUserToRedis(tmpUser);
+ }
+
+ //4.5 获取用户数据
+ Map userMap = getUserMap(tmpUser);
+ //4.8获取用户绑定设备信息和摄像头信息
+ Map deviceMap = getDeviceList(tmpUser);
+ Map dataMap = new HashMap();
+ dataMap.put("user", userMap);
+ dataMap.put("device", deviceMap.get("list"));
+ dataMap.put("camera", deviceMap.get("list2"));
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
+ } else {
+ //密码不正确
+ return IfishUtil.returnJson(ResultEnum.warn204.getKey(), "");
+ }
+ }
+
+ /**
+ * 游客登陆接口
+ *
+ * @param tmpUser
+ * @return
+ * @throws Exception
+ */
+ private Object touristLogin(Tbl_User tmpUser) throws Exception {
+ //2.如果为空,则没有此用户,返回未注册信息
+ if (tmpUser == null) {
+ //用户不存在
+ return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
+ }
+
+ //是否更新
+ boolean isUpdate = false;
+
+ //4.1未注册技威,则注册获取code1,code2
+ Map gwellMap = registUserGWell(tmpUser, isUpdate);
+ tmpUser = (Tbl_User) gwellMap.get("user");
+ isUpdate = (Boolean) gwellMap.get("isUpdate");
+
+ //4.4验证是否需要修改技威等信息,如果需要则进行修改
+ if (isUpdate) {
+ Integer updateInteger = tbl_User_Mapper.updateUser(tmpUser);
+ //如果修改失败,返回错误信息
+ if (updateInteger <= 0) {
+ return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
+ }
+ saveUserToRedis(tmpUser);
+ }
+
+ //4.5 获取用户数据
+ Map userMap = getUserMap(tmpUser);
+ //4.8获取用户绑定设备信息和摄像头信息
+ Map deviceMap = getDeviceList(tmpUser);
+ Map dataMap = new HashMap();
+ dataMap.put("user", userMap);
+ dataMap.put("device", deviceMap.get("list"));
+ dataMap.put("camera", deviceMap.get("list2"));
+ return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
+
+ }
+
+ /**
+ * 未注册技威,则注册获取code1,code2
+ *
+ * @param tmpUser
+ * @param isUpdate
+ * @return
+ */
+ private Map registUserGWell(Tbl_User tmpUser, boolean isUpdate) {
+ //4.1未注册技威,则注册获取code1,code2
+ if (StringUtils.isBlank(tmpUser.getIsRegisterGwell()) || tmpUser.getIsRegisterGwell().equals("0")) {
+ String code = "";
+ //如果有手机用手机号注册,否则用用户ID注册
+ if (StringUtils.isBlank(tmpUser.getPhoneNumber())) {
+ code = tmpUser.getUserId() + "";
+ } else {
+ code = tmpUser.getPhoneNumber();
+ }
+ //注册技威
+ Map map = GwellApi.Register(code);
+ String result = map.get("result");
+ if (result != null) {
+ //注册成功
+ if (result.equals(GwellEnum.success.getKey())) {
+ String P2PVerifyCode1 = map.get("P2PVerifyCode1");
+ String P2PVerifyCode2 = map.get("P2PVerifyCode2");
+ String gwellUserID = map.get("UserID");
+ tmpUser.setIsRegisterGwell("1");
+ tmpUser.setP2pverifyCode1(P2PVerifyCode1);
+ tmpUser.setP2pverifyCode2(P2PVerifyCode2);
+ tmpUser.setGwellUserid(gwellUserID);
+ isUpdate = true;
+ } //已经注册过
+ else if (GwellEnum.repeat.getKey().equals(result)) {
+ tmpUser.setIsRegisterGwell("1");
+ isUpdate = true;
+ }
+ }
+ }//已经注册过技威
+ else if (tmpUser.getIsRegisterGwell().equals("1")) {
+ //code1和code2为空则重新登陆获取
+ String P2PVerifyCode1 = tmpUser.getP2pverifyCode1();
+ String P2PVerifyCode2 = tmpUser.getP2pverifyCode2();
+ String gwellUserID = tmpUser.getGwellUserid();
+ if (P2PVerifyCode1.equals("") || P2PVerifyCode2.equals("") || gwellUserID.equals("")) {
+ Map map = GwellApi.Login(tmpUser.getPhoneNumber());
+ String result = map.get("result");
+ //登陆成功
+ if (result != null && result.equals(GwellEnum.success.getKey())) {
+ P2PVerifyCode1 = map.get("P2PVerifyCode1");
+ P2PVerifyCode2 = map.get("P2PVerifyCode2");
+ gwellUserID = map.get("UserID");
+ tmpUser.setP2pverifyCode1(P2PVerifyCode1);
+ tmpUser.setP2pverifyCode2(P2PVerifyCode2);
+ tmpUser.setGwellUserid(gwellUserID);
+ isUpdate = true;
+ }
+ }
+ }
+ Map resultMap = new HashMap();
+ resultMap.put("user", tmpUser);
+ resultMap.put("isUpdate", isUpdate);
+ return resultMap;
+ }
+
+ /**
+ * 登录成功,返回给App数据
+ *
+ * @param tmpUser
+ * @return
+ */
+ private Map getUserMap(Tbl_User tmpUser) {
+ //登录成功,返回给App数据
+ Map userMap = new HashMap();
+ userMap.put("userId", tmpUser.getUserId().toString());
+ //如果手机号不为空
+ if (StringUtils.isNotBlank(tmpUser.getPhoneNumber())) {
+ userMap.put("phoneNumber", tmpUser.getPhoneNumber());
+ }
+ //如果邮箱不为空
+ if (StringUtils.isNotBlank(tmpUser.getUserEmail())) {
+ userMap.put("userEmail", tmpUser.getUserEmail());
+ }
+ userMap.put("nickName", tmpUser.getNickName());
+ userMap.put("userSex", tmpUser.getUserSex());
+ userMap.put("userImg", tmpUser.getUserImg());
+ userMap.put("P2PVerifyCode1", tmpUser.getP2pverifyCode1());
+ userMap.put("P2PVerifyCode2", tmpUser.getP2pverifyCode2());
+ userMap.put("gwellUserID", tmpUser.getGwellUserid());
+ userMap.put("userType", tmpUser.getUserType());
+ if (tmpUser.getUpdateTime() != null) {
+ userMap.put("updateTime", IfishUtil.format(tmpUser.getUpdateTime()));
+ }
+
+ return userMap;
+ }
+
+ /**
+ * 获取用户绑定设备信息
+ *
+ * @param tmpUser
+ * @return
+ */
+ private Map getDeviceList(Tbl_User tmpUser) throws Exception {
+ //设备信息
+ List