From 60de94e0d8ad7397a5c16456e43e0a383c3c8999 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, 23 Aug 2017 12:14:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ifish/bean/LoginRecord.java | 49 -------- .../java/com/ifish/bean/Tbl_Login_Record.java | 107 ++++++++++++++++++ .../java/com/ifish/config/RedisConfig.java | 4 +- .../java/com/ifish/helper/DeviceHelperI.java | 1 - .../java/com/ifish/helper/JpushHelper.java | 13 ++- .../com/ifish/socket/config/SomeServer.java | 1 - .../java/com/ifish/util/IfishFilePath.java | 36 ++---- src/main/java/com/ifish/util/IfishUtil.java | 14 ++- src/main/resources/property.properties | 37 ++---- 9 files changed, 149 insertions(+), 113 deletions(-) delete mode 100644 src/main/java/com/ifish/bean/LoginRecord.java create mode 100644 src/main/java/com/ifish/bean/Tbl_Login_Record.java diff --git a/src/main/java/com/ifish/bean/LoginRecord.java b/src/main/java/com/ifish/bean/LoginRecord.java deleted file mode 100644 index 46f9eb2..0000000 --- a/src/main/java/com/ifish/bean/LoginRecord.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package com.ifish.bean; - -import java.io.Serializable; -import java.util.Date; - -/** - * - * @author Administrator - */ -public class LoginRecord implements Serializable { - - private static final long serialVersionUID = -5292867602998823697L; - //ID - private Integer recordId; - //mac地址 - private String macAddress; - //登录时间 - private Date loginTime; - - public Integer getRecordId() { - return recordId; - } - - public void setRecordId(Integer recordId) { - this.recordId = recordId; - } - - public String getMacAddress() { - return macAddress; - } - - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - public Date getLoginTime() { - return loginTime; - } - - public void setLoginTime(Date loginTime) { - this.loginTime = loginTime; - } - -} diff --git a/src/main/java/com/ifish/bean/Tbl_Login_Record.java b/src/main/java/com/ifish/bean/Tbl_Login_Record.java new file mode 100644 index 0000000..920d307 --- /dev/null +++ b/src/main/java/com/ifish/bean/Tbl_Login_Record.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.bean; + +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * + * @author Administrator + */ +/** + * 设备登陆记录表(tbl_login_record) + * + * @author bianj + * @version 1.0.0 2017-08-14 + */ +@Entity +@Table(name = "tbl_login_record") +public class Tbl_Login_Record implements java.io.Serializable { + + /** + * 版本号 + */ + private static final long serialVersionUID = -3544525221392465793L; + + /** + * 记录Id + */ + @Id + @Column(name = "record_id", unique = true, nullable = false, length = 10) + private Integer recordId; + + /** + * 设备Mac地址 + */ + @Column(name = "mac_address", nullable = false, length = 255) + private String macAddress; + + /** + * 登陆时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Column(name = "login_time", nullable = true) + private Date loginTime; + + /** + * 获取记录Id + * + * @return 记录Id + */ + public Integer getRecordId() { + return this.recordId; + } + + /** + * 设置记录Id + * + * @param recordId 记录Id + */ + public void setRecordId(Integer recordId) { + this.recordId = recordId; + } + + /** + * 获取设备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; + } +} diff --git a/src/main/java/com/ifish/config/RedisConfig.java b/src/main/java/com/ifish/config/RedisConfig.java index 1d37213..ed155be 100644 --- a/src/main/java/com/ifish/config/RedisConfig.java +++ b/src/main/java/com/ifish/config/RedisConfig.java @@ -5,7 +5,7 @@ */ package com.ifish.config; -import com.ifish.util.IfishFilePath; +import com.ifish.util.IfishUtil; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -26,7 +26,7 @@ public class RedisConfig { // //获取当前操作系统(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")) { + if (IfishUtil.isOnLine()) { //站点线上服务器 cf.setHostName("120.55.190.56"); cf.setPort(3796); diff --git a/src/main/java/com/ifish/helper/DeviceHelperI.java b/src/main/java/com/ifish/helper/DeviceHelperI.java index 2daba2a..cba41e1 100644 --- a/src/main/java/com/ifish/helper/DeviceHelperI.java +++ b/src/main/java/com/ifish/helper/DeviceHelperI.java @@ -5,7 +5,6 @@ */ package com.ifish.helper; -import com.ifish.bean.LoginRecord; import com.ifish.bean.Tbl_Device; import com.ifish.bean.Tbl_Device_Statistics; import com.ifish.bean.Tbl_Device_User; diff --git a/src/main/java/com/ifish/helper/JpushHelper.java b/src/main/java/com/ifish/helper/JpushHelper.java index 854cfd1..c6f6acb 100644 --- a/src/main/java/com/ifish/helper/JpushHelper.java +++ b/src/main/java/com/ifish/helper/JpushHelper.java @@ -14,6 +14,8 @@ import cn.jpush.api.push.model.PushPayload; import cn.jpush.api.push.model.audience.Audience; import cn.jpush.api.push.model.notification.IosNotification; import cn.jpush.api.push.model.notification.Notification; +import com.ifish.util.IfishFilePath; +import com.ifish.util.IfishUtil; import java.util.Map; import org.springframework.stereotype.Component; @@ -29,10 +31,17 @@ public class JpushHelper implements JpushHelperI { // private static final String masterSecret = "60162c8cf195ce9f4dc76629"; // private static final String appKey = "d970d5e193cb2a0bbe41653c"; //测试 - private final static String masterSecret = "4f759a0609dcd9d2edb06125"; - private final static String appKey = "6e5e9d757570859b3f274bb8"; + private static String masterSecret = "4f759a0609dcd9d2edb06125"; + private static String appKey = "6e5e9d757570859b3f274bb8"; static { + if (IfishUtil.isOnLine()) { + appKey = IfishFilePath.AppKeyFormal; + masterSecret = IfishFilePath.MasterSecretFormal; + } else { + appKey = IfishFilePath.AppKeyFormal; + masterSecret = IfishFilePath.MasterSecretFormal; + } jPushClient = new JPushClient(masterSecret, appKey); } diff --git a/src/main/java/com/ifish/socket/config/SomeServer.java b/src/main/java/com/ifish/socket/config/SomeServer.java index 31629f0..73b8fdc 100644 --- a/src/main/java/com/ifish/socket/config/SomeServer.java +++ b/src/main/java/com/ifish/socket/config/SomeServer.java @@ -5,7 +5,6 @@ */ package com.ifish.socket.config; -import com.ifish.bean.LoginRecord; import com.ifish.bean.Tbl_Device; import com.ifish.bean.Tbl_Device_Statistics; import com.ifish.bean.Tbl_Device_User; diff --git a/src/main/java/com/ifish/util/IfishFilePath.java b/src/main/java/com/ifish/util/IfishFilePath.java index 65f72ed..c171398 100644 --- a/src/main/java/com/ifish/util/IfishFilePath.java +++ b/src/main/java/com/ifish/util/IfishFilePath.java @@ -16,40 +16,20 @@ import java.util.Properties; */ public class IfishFilePath { - //头像地址 - public static String path_img; /** * 图片头地址 */ public static String link_img_head; - //商家图片地址 - public static String path_shops; - //商品介绍图片 - public static String path_commodity; - //微信分享页面 - public static String path_share_html; - //微信分享页图片 - public static String path_share_img; - //看护报告页面 - public static String path_look_html; - //看护报告图片 - public static String path_look_img; - //html名字 - public static String html_name; //图片上传格式 public static String check_style; - //云信爱鱼奇官方帐号 - public static String ifish_account; - //IM官方手机号 - public static String netease_phone; - //直播间封面 - public static String path_room_img; - //FastDFS商家视频上传URL访问路径(本地和测试环境) - public static String fastDFS_url_local; - //FastDFS商家视频上传URL访问路径(正式环境) - public static String fastDFS_url_app; - //开发模式 - public static boolean devModel; + + public static String AppKeyFormal; + + public static String MasterSecretFormal; + + public static String AppKey; + + public static String MasterSecret; //本机IP public static String ifiship; //本机端口 diff --git a/src/main/java/com/ifish/util/IfishUtil.java b/src/main/java/com/ifish/util/IfishUtil.java index 3ea006d..c7e41af 100644 --- a/src/main/java/com/ifish/util/IfishUtil.java +++ b/src/main/java/com/ifish/util/IfishUtil.java @@ -59,6 +59,19 @@ public class IfishUtil { */ public static final int CacheTime_DAYS = 1; + /** + * 是否在线上运行,true在线上,false在测试环境 + * + * @return + */ + public static boolean isOnLine() { + if (IfishFilePath.link_img_head.contains("ifish7")) { + return true; + } else { + return false; + } + } + /** * Object转Json */ @@ -140,7 +153,6 @@ public class IfishUtil { } } - //返回时分秒的时间字符串 public static String TimestampToStringAndSecond(Object timestamp) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); diff --git a/src/main/resources/property.properties b/src/main/resources/property.properties index 933e56a..60a7a85 100644 --- a/src/main/resources/property.properties +++ b/src/main/resources/property.properties @@ -1,29 +1,11 @@ -#\u5934\u50cf\u5b58\u50a8\u8def\u5f84 -path_img=/mydata/tmp/Img/app -#\u5546\u5bb6\u8ba4\u8bc1\u56fe\u7247 -path_shops=/mydata/tmp/Img/shops -#\u5546\u54c1\u4ecb\u7ecd\u56fe\u7247 -path_commodity=/mydata/tmp/Img/commodity -#\u76f4\u64ad\u95f4\u5c01\u9762 -path_room_img=/mydata/tmp/Img/room -#\u5fae\u4fe1\u5206\u4eab\u9875\u9762 -path_share_html=/mydata/tmp/html/ -#\u5fae\u4fe1\u5206\u4eab\u9875\u56fe\u7247 -path_share_img=/mydata/tmp/html/images/share -#\u770b\u62a4\u62a5\u544a\u9875\u9762 -path_look_html=/mydata/tmp/look/ -#\u770b\u62a4\u62a5\u544a\u56fe\u7247 -path_look_img=/mydata/tmp/look/images/share -#\u770b\u62a4\u62a5\u544a\u6a21\u7248html\u540d\u5b57 -html_name=index.html -#\u4e91\u4fe1\u7231\u9c7c\u5947\u5b98\u65b9\u5e10\u53f7 -ifish_account=ifish -#IM\u5b98\u65b9\u624b\u673a\u53f7 -netease_phone=18501773036 -#FastDFS\u6587\u4ef6URL\u8bbf\u95ee\u8def\u5f84(\u672c\u5730\u548c\u6d4b\u8bd5\u73af\u5883) -fastDFS_url_local=https://app.zhangxinyanv5.top/ -#FastDFS\u6587\u4ef6URL\u8bbf\u95ee\u8def\u5f84(\u6b63\u5f0f\u73af\u5883) -fastDFS_url_app=http://app.ifish7.com/ +#\u6b63\u5f0f\u73af\u5883\u6781\u5149AppKey +AppKeyFormal=123 +#\u6b63\u5f0f\u73af\u5883\u6781\u5149Master Secret +MasterSecretFormal=123 +#\u6d4b\u8bd5\u73af\u5883\u6781\u5149AppKey +AppKey=6e5e9d757570859b3f274bb8 +#\u6d4b\u8bd5\u73af\u5883\u6781\u5149Master Secret +MasterSecret=4f759a0609dcd9d2edb06125 #\u672c\u5730 #link_img_head=http://192.168.61.128:81/ #\u6d4b\u8bd5\u73af\u5883 @@ -32,11 +14,8 @@ fastDFS_url_app=http://app.ifish7.com/ link_img_head=https://app.ifish7.com/ #\u56fe\u7247\u683c\u5f0f\u9a8c\u8bc1 check_style=GIF,PNG,BMP,JPG,JPEG -#\u662f\u5426\u5f00\u53d1\u6a21\u5f0f\uff0cfalse\u5219\u4ee3\u8868\u8981\u53d1\u5e03\u5230\u6d4b\u8bd5\u6216\u8005\u6b63\u5f0f\u73af\u5883\uff0c\u4f1a\u8fdb\u884c\u5168\u5c40\u5934\u90e8\u9a8c\u8bc1\uff0ctrue\u4ee3\u8868\u5728\u672c\u5730\u8fdb\u884c\u4ee3\u7801\u7f16\u5199\uff0c\u4e0d\u4f1a\u8fdb\u884c\u9a8c\u8bc1 -devModel=true #\u672c\u5730 ifiship=192.168.199.129 -#ifiship=192.168.2.146 #\u6d4b\u8bd5\u4e91 #ifiship=139.196.24.156 #\u6b63\u5f0f\u4e91