针对华亿的部署过程中,着重调试分析mqtt连接问题,收发消息的问题
parent
57d741b898
commit
5458043bf4
|
|
@ -6,24 +6,29 @@
|
||||||
*/
|
*/
|
||||||
package com.lp;
|
package com.lp;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.springframework.web.servlet.DispatcherServlet;
|
|
||||||
|
|
||||||
import com.lp.authority.AuthorityIntercept;
|
import com.lp.authority.AuthorityIntercept;
|
||||||
import com.lp.authority.WechatAuthorityIntercept;
|
import com.lp.authority.WechatAuthorityIntercept;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.servlet.DispatcherServlet;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
public class Dispatcher extends DispatcherServlet {
|
public class Dispatcher extends DispatcherServlet {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected final static Logger LOGGER = LoggerFactory.getLogger(Dispatcher.class);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doDispatch(HttpServletRequest req, HttpServletResponse response) throws Exception {
|
protected void doDispatch(HttpServletRequest req, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
// 微信公众号授权拦截
|
// 微信公众号授权拦截
|
||||||
int statusCode = WechatAuthorityIntercept.AutjorityIntercept(req, response) ;
|
int statusCode = WechatAuthorityIntercept.AutjorityIntercept(req, response) ;
|
||||||
|
LogUtil4j.debugLogger.debug("---------------++++++++++++++++++++statusCode is {}", statusCode);
|
||||||
if(statusCode == 0 ){
|
if(statusCode == 0 ){
|
||||||
super.doDispatch(req, response);
|
super.doDispatch(req, response);
|
||||||
}else if(statusCode == 1){
|
}else if(statusCode == 1){
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,7 @@ import com.lp.cache.CacheName;
|
||||||
import com.lp.cache.ProCacheUtil;
|
import com.lp.cache.ProCacheUtil;
|
||||||
import com.lp.cfg.ProConfig;
|
import com.lp.cfg.ProConfig;
|
||||||
import com.lp.common.Code;
|
import com.lp.common.Code;
|
||||||
import com.lp.util.CommonUtil;
|
import com.lp.util.*;
|
||||||
import com.lp.util.LogUtil;
|
|
||||||
import com.lp.util.ObjectUtil;
|
|
||||||
import com.lp.util.ResultMapUtils;
|
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -44,11 +41,15 @@ public class AuthorityIntercept {
|
||||||
String requestMethod = req.getMethod();
|
String requestMethod = req.getMethod();
|
||||||
// key -- GET请求不包含KEY WEB请求的时候,全部包含Session
|
// key -- GET请求不包含KEY WEB请求的时候,全部包含Session
|
||||||
String userKey = req.getHeader(ResultMapUtils.USER_KEY);
|
String userKey = req.getHeader(ResultMapUtils.USER_KEY);
|
||||||
|
|
||||||
|
LogUtil4j.debugLogger.debug("----------------+++++++++++++++++++AutjorityIntercept is called with ({})------({})------({})------({})"
|
||||||
|
, requestUri, requestUrl, requestMethod, userKey);
|
||||||
try {
|
try {
|
||||||
if (requestUrl.contains("/login") || requestUrl.contains("/register") || requestUrl.contains("/password") ||
|
if (requestUrl.contains("/login") || requestUrl.contains("/register") || requestUrl.contains("/password") ||
|
||||||
requestUrl.contains("/validate/code") || requestUrl.contains("/security_code") || requestUrl.contains("/upload")
|
requestUrl.contains("/validate/code") || requestUrl.contains("/security_code") || requestUrl.contains("/upload")
|
||||||
|| requestUrl.contains("/mail") || requestUrl.contains("/bind") || requestUrl.contains("/live") ||
|
|| requestUrl.contains("/mail") || requestUrl.contains("/bind") || requestUrl.contains("/live") ||
|
||||||
requestUrl.contains("/mqtt") || requestUrl.contains("/baidu") || requestUrl.contains("/vp") ||requestUrl.contains("/noauth") || requestUrl.endsWith("/") ) {
|
requestUrl.contains("/mqtt") || requestUrl.contains("/baidu") || requestUrl.contains("/vp") ||requestUrl.contains("/noauth")
|
||||||
|
|| requestUrl.endsWith("/") || requestUrl.contains("/yinzy")) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (ObjectUtil.isNotEmpty(userKey) || requestMethod.equals("PUT") || requestMethod.equals("POST")
|
if (ObjectUtil.isNotEmpty(userKey) || requestMethod.equals("PUT") || requestMethod.equals("POST")
|
||||||
|
|
@ -57,7 +58,7 @@ public class AuthorityIntercept {
|
||||||
if (ObjectUtil.isNotEmpty(ProCacheUtil.getCache(CacheName.USERINFO, userKey,new Object()) )) {
|
if (ObjectUtil.isNotEmpty(ProCacheUtil.getCache(CacheName.USERINFO, userKey,new Object()) )) {
|
||||||
return true ;
|
return true ;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug("AutjorityIntercept with {}{} is called with user {}{}", requestUrl, requestMethod, userKey, ProCacheUtil.getCache(CacheName.USERINFO, userKey,new Object()));
|
LogUtil4j.debugLogger.debug("AutjorityIntercept with {}{} is called with user {}{}", requestUrl, requestMethod, userKey, ProCacheUtil.getCache(CacheName.USERINFO, userKey,new Object()));
|
||||||
JSONObject resultData = new JSONObject();
|
JSONObject resultData = new JSONObject();
|
||||||
resultData.put("status", Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
resultData.put("status", Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||||
resultData.put("statusMsg", "NO ACCESS");
|
resultData.put("statusMsg", "NO ACCESS");
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,21 @@
|
||||||
*/
|
*/
|
||||||
package com.lp.authority;
|
package com.lp.authority;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.lp.bo.UserInfoBO;
|
import com.lp.bo.UserInfoBO;
|
||||||
import com.lp.cfg.ProConfig;
|
import com.lp.cfg.ProConfig;
|
||||||
import com.lp.util.LogUtil;
|
import com.lp.util.LogUtil;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
|
|
||||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl;
|
import me.chanjar.weixin.mp.api.WxMpServiceImpl;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
public class WechatAuthorityIntercept {
|
public class WechatAuthorityIntercept {
|
||||||
|
|
||||||
|
protected final static Logger LOGGER = LoggerFactory.getLogger(WechatAuthorityIntercept.class);
|
||||||
/**
|
/**
|
||||||
* 是否是微信浏览器
|
* 是否是微信浏览器
|
||||||
*
|
*
|
||||||
|
|
@ -25,6 +28,9 @@ public class WechatAuthorityIntercept {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean isWeixin(HttpServletRequest request) {
|
public static boolean isWeixin(HttpServletRequest request) {
|
||||||
|
|
||||||
|
LogUtil4j.debugLogger.debug("-------------+++++++++++++++isWeixin is called with request {} "
|
||||||
|
, ((HttpServletRequest) request).getHeader("user-agent"));
|
||||||
if (((HttpServletRequest) request).getHeader("user-agent") == null) {
|
if (((HttpServletRequest) request).getHeader("user-agent") == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -48,11 +54,14 @@ public class WechatAuthorityIntercept {
|
||||||
String requestUrl = req.getRequestURL().toString();
|
String requestUrl = req.getRequestURL().toString();
|
||||||
String queryString = req.getQueryString();
|
String queryString = req.getQueryString();
|
||||||
// 是否需要微信授权信息
|
// 是否需要微信授权信息
|
||||||
Boolean is_auth = false ;
|
Boolean is_auth = false;
|
||||||
|
|
||||||
if(ObjectUtil.isNotEmpty(queryString)){
|
if(ObjectUtil.isNotEmpty(queryString)){
|
||||||
requestUrl+= '?'+queryString.replace("&", "*") ;
|
requestUrl+= '?'+queryString.replace("&", "*") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogUtil4j.debugLogger.debug("----------------------++++++++++++++++++++++++AutjorityIntercept is called with {}---{}###"
|
||||||
|
, requestUrl, queryString);
|
||||||
try{
|
try{
|
||||||
if ((isWeixin(req))
|
if ((isWeixin(req))
|
||||||
&& !requestUrl.toString().contains(ProConfig.WEIXIN.MP_OAUTH2_REDIRECT_URI) ) {
|
&& !requestUrl.toString().contains(ProConfig.WEIXIN.MP_OAUTH2_REDIRECT_URI) ) {
|
||||||
|
|
@ -60,6 +69,8 @@ public class WechatAuthorityIntercept {
|
||||||
UserInfoBO userInfo = (UserInfoBO) req.getSession().getAttribute("user");
|
UserInfoBO userInfo = (UserInfoBO) req.getSession().getAttribute("user");
|
||||||
Object openid = req.getSession().getAttribute("open_id") ;
|
Object openid = req.getSession().getAttribute("open_id") ;
|
||||||
|
|
||||||
|
LogUtil4j.debugLogger.debug("----------------------++++++++++++++++++++++++AutjorityIntercept get wx with {}---{}###"
|
||||||
|
, userInfo, openid);
|
||||||
if ( ObjectUtil.isEmpty(userInfo) ) {
|
if ( ObjectUtil.isEmpty(userInfo) ) {
|
||||||
if(requestUrl.contains("login") || requestUrl.contains("login_sms")
|
if(requestUrl.contains("login") || requestUrl.contains("login_sms")
|
||||||
|| requestUrl.contains("validate/code") || requestUrl.contains("/security_code") ){
|
|| requestUrl.contains("validate/code") || requestUrl.contains("/security_code") ){
|
||||||
|
|
@ -96,6 +107,8 @@ public class WechatAuthorityIntercept {
|
||||||
/**
|
/**
|
||||||
* 2.开始发起授权
|
* 2.开始发起授权
|
||||||
*/
|
*/
|
||||||
|
LogUtil4j.debugLogger.debug("----------------------++++++++++++++++++++++++AutjorityIntercept will redirect to {} ###"
|
||||||
|
, authorization_url);
|
||||||
response.sendRedirect(authorization_url);
|
response.sendRedirect(authorization_url);
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +116,7 @@ public class WechatAuthorityIntercept {
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}else{
|
}else{
|
||||||
if( requestUrl.toString().contains(ProConfig.WEIXIN.MP_OAUTH2_REDIRECT_URI)
|
if( requestUrl.toString().contains(ProConfig.WEIXIN.MP_OAUTH2_REDIRECT_URI)
|
||||||
|| requestUrl.toString().contains("/service/weixin/mp/msg") ){
|
|| requestUrl.toString().contains("/service/weixin/mp/msg") || requestUrl.toString().contains("/yinzy")){
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,22 @@
|
||||||
package com.lp.cache;
|
package com.lp.cache;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.lp.bo.*;
|
||||||
import java.util.List;
|
import com.lp.cfg.ProConfig;
|
||||||
import java.util.Map;
|
import com.lp.dao.BaseDao;
|
||||||
|
import com.lp.ezuiz.EzuizService;
|
||||||
import javax.annotation.PostConstruct;
|
import com.lp.util.LogUtil4j;
|
||||||
|
import com.lp.util.ObjectUtil;
|
||||||
|
import com.lp.util.ResultMapUtils;
|
||||||
import org.apache.commons.collections.map.HashedMap;
|
import org.apache.commons.collections.map.HashedMap;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
import org.springframework.context.annotation.DependsOn;
|
||||||
import org.springframework.core.task.TaskExecutor;
|
import org.springframework.core.task.TaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.lp.bean.IotLpmInfo;
|
import javax.annotation.PostConstruct;
|
||||||
import com.lp.bo.IotNodeInfoBO;
|
import java.util.ArrayList;
|
||||||
import com.lp.bo.IotSceneInfoBO;
|
import java.util.List;
|
||||||
import com.lp.bo.IotSensorInfoBO;
|
import java.util.Map;
|
||||||
import com.lp.bo.IotTriggerInfoBO;
|
|
||||||
import com.lp.bo.IotVideoInfoBO;
|
|
||||||
import com.lp.bo.ProDictionaryInfoBO;
|
|
||||||
import com.lp.bo.SysConfigInfoBO;
|
|
||||||
import com.lp.bo.UserAccountInfoBO;
|
|
||||||
import com.lp.bo.UserInfoBO;
|
|
||||||
import com.lp.cfg.ProConfig;
|
|
||||||
import com.lp.dao.BaseDao;
|
|
||||||
import com.lp.ezuiz.EzuizService;
|
|
||||||
import com.lp.util.ObjectUtil;
|
|
||||||
import com.lp.util.ResultMapUtils;
|
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -258,6 +248,8 @@ public class ProCache extends ResultMapUtils {
|
||||||
if( ObjectUtil.isNotEmpty(iotSensorInfoList) ){
|
if( ObjectUtil.isNotEmpty(iotSensorInfoList) ){
|
||||||
for(IotSensorInfoBO obj: iotSensorInfoList){
|
for(IotSensorInfoBO obj: iotSensorInfoList){
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO, obj.getId()+"", obj);
|
ProCacheUtil.addCache(CacheName.SENSORINFO, obj.getId()+"", obj);
|
||||||
|
LogUtil4j.debugLogger.debug("add cache {}---{}", CacheName.SENSORINFO_NSP
|
||||||
|
, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id());
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP,
|
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP,
|
||||||
obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,5 @@
|
||||||
package com.lp.controller;
|
package com.lp.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import com.lp.bo.UserInfoBO;
|
import com.lp.bo.UserInfoBO;
|
||||||
import com.lp.cache.CacheName;
|
import com.lp.cache.CacheName;
|
||||||
import com.lp.cache.ProCacheUtil;
|
import com.lp.cache.ProCacheUtil;
|
||||||
|
|
@ -20,6 +7,17 @@ import com.lp.service.BaseService;
|
||||||
import com.lp.util.ExcelUtil;
|
import com.lp.util.ExcelUtil;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.ResultMapUtils;
|
import com.lp.util.ResultMapUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,6 +45,7 @@ public class BaseController extends ResultMapUtils {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected UserInfoBO getUserInfoBySession(HttpServletRequest req) {
|
protected UserInfoBO getUserInfoBySession(HttpServletRequest req) {
|
||||||
|
LOGGER.info("getUserInfoBySession");
|
||||||
return (UserInfoBO) req.getSession().getAttribute("user");
|
return (UserInfoBO) req.getSession().getAttribute("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ public class FileInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
// 转存文件
|
// 转存文件
|
||||||
String icoFileName = ProConfig.LOCAL_FILE_PATH + "/sensor_icos/" + code + suffix_name;
|
String icoFileName = ProConfig.LOCAL_FILE_PATH + "/sensor_icos/" + code + suffix_name;
|
||||||
LOGGER.debug("{} call upload from {} to {} "
|
LogUtil4j.debugLogger.debug("{} call upload from {} to {} "
|
||||||
, RequestURL.FileInfo.FILE_SENSOR_ICO, file.getOriginalFilename(), icoFileName);
|
, RequestURL.FileInfo.FILE_SENSOR_ICO, file.getOriginalFilename(), icoFileName);
|
||||||
// file.transferTo(new File(rootPath+"/image/oss/iot/"+ code + suffix_name ));
|
// file.transferTo(new File(rootPath+"/image/oss/iot/"+ code + suffix_name ));
|
||||||
file.transferTo(new File(icoFileName));
|
file.transferTo(new File(icoFileName));
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ public class UserController extends BaseController {
|
||||||
public ModelAndView userLogin(HttpServletRequest req, HttpServletResponse resp,
|
public ModelAndView userLogin(HttpServletRequest req, HttpServletResponse resp,
|
||||||
@RequestBody UserInfoBO user) {
|
@RequestBody UserInfoBO user) {
|
||||||
Map<String, Object> resultMap = getResultMap();
|
Map<String, Object> resultMap = getResultMap();
|
||||||
LOGGER.debug("aaaa{}", user);
|
LogUtil4j.debugLogger.debug("login request with name: ({})", user.getName());
|
||||||
try {
|
try {
|
||||||
if(CommonUtil.isBlank(user.getName()) || CommonUtil.isBlank(user.getPassword())){
|
if(CommonUtil.isBlank(user.getName()) || CommonUtil.isBlank(user.getPassword())){
|
||||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.USERNAME_OR_PASSWORD_ERROR);
|
putStatusCode(resultMap, Code.ResponseCode.UserInfo.USERNAME_OR_PASSWORD_ERROR);
|
||||||
|
|
@ -390,7 +390,7 @@ public class UserController extends BaseController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
super.exception(e, resultMap);
|
super.exception(e, resultMap);
|
||||||
}
|
}
|
||||||
LOGGER.debug("bbbb{}", resultMap);
|
LogUtil4j.debugLogger.debug("login response with name: ({})---{}", user.getName(), resultMap);
|
||||||
return getModelAndView(resp, resultMap);
|
return getModelAndView(resp, resultMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.lp.cfg.ProConfig;
|
||||||
import com.lp.common.Code;
|
import com.lp.common.Code;
|
||||||
import com.lp.service.base.FileInfoService;
|
import com.lp.service.base.FileInfoService;
|
||||||
import com.lp.util.LogUtil;
|
import com.lp.util.LogUtil;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.ResultMapUtils;
|
import com.lp.util.ResultMapUtils;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
|
|
@ -68,7 +69,7 @@ public class WxMpController extends BaseController {
|
||||||
@RequestParam(value = "nonce", required = false) String nonce,
|
@RequestParam(value = "nonce", required = false) String nonce,
|
||||||
@RequestParam(value = "echostr", required = false) String echostr, HttpServletRequest req,
|
@RequestParam(value = "echostr", required = false) String echostr, HttpServletRequest req,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
LOGGER.debug("get echostr with {}", echostr);
|
LogUtil4j.debugLogger.debug("get echostr with {}", echostr);
|
||||||
PrintWriter out = response.getWriter();
|
PrintWriter out = response.getWriter();
|
||||||
out.write(echostr);
|
out.write(echostr);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
@ -121,6 +122,7 @@ public class WxMpController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "weixin/mp/menu/create")
|
@RequestMapping(method = RequestMethod.GET, value = "weixin/mp/menu/create")
|
||||||
public void menuCreate(HttpServletRequest req, HttpServletResponse response) throws IOException, WxErrorException {
|
public void menuCreate(HttpServletRequest req, HttpServletResponse response) throws IOException, WxErrorException {
|
||||||
|
LogUtil4j.debugLogger.debug("------------------+++++++++++++++++ menuCreate");
|
||||||
PrintWriter out = response.getWriter();
|
PrintWriter out = response.getWriter();
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
createMenu(out);
|
createMenu(out);
|
||||||
|
|
@ -142,6 +144,7 @@ public class WxMpController extends BaseController {
|
||||||
public String authCallback(HttpServletRequest req, HttpServletResponse response,
|
public String authCallback(HttpServletRequest req, HttpServletResponse response,
|
||||||
@RequestParam(required = false) String state, @RequestParam(required = false) String code)
|
@RequestParam(required = false) String state, @RequestParam(required = false) String code)
|
||||||
throws IOException, WxErrorException {
|
throws IOException, WxErrorException {
|
||||||
|
LogUtil4j.debugLogger.debug("------------------+++++++++++++++++ authCallback called with {}---{}", state, code);
|
||||||
if (!StringUtils.isEmpty(code)) {
|
if (!StringUtils.isEmpty(code)) {
|
||||||
// 通过code换取网页授权access_token
|
// 通过code换取网页授权access_token
|
||||||
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
|
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
|
||||||
|
|
@ -149,9 +152,10 @@ public class WxMpController extends BaseController {
|
||||||
String openid = wxMpOAuth2AccessToken.getOpenId();
|
String openid = wxMpOAuth2AccessToken.getOpenId();
|
||||||
// 设置到session中
|
// 设置到session中
|
||||||
req.getSession().setAttribute("open_id", openid);
|
req.getSession().setAttribute("open_id", openid);
|
||||||
|
LogUtil4j.debugLogger.debug("------------------+++++++++++++++++ authCallback get openid {}", openid);
|
||||||
if(state.contains("cbind")){
|
if(state.contains("cbind")){
|
||||||
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
|
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
|
||||||
|
LogUtil4j.debugLogger.debug("------------------+++++++++++++++++ authCallback get wxMpUser {}", wxMpUser);
|
||||||
// 联系人信息绑定
|
// 联系人信息绑定
|
||||||
UserInfoBO userx = new UserInfoBO() ;
|
UserInfoBO userx = new UserInfoBO() ;
|
||||||
userx.setWx_open_id(openid);
|
userx.setWx_open_id(openid);
|
||||||
|
|
@ -172,7 +176,7 @@ public class WxMpController extends BaseController {
|
||||||
if( ObjectUtil.isEmpty(user) ){
|
if( ObjectUtil.isEmpty(user) ){
|
||||||
// 获取用户更多的信息,snap_userinfo 授权
|
// 获取用户更多的信息,snap_userinfo 授权
|
||||||
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
|
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
|
||||||
|
LogUtil4j.debugLogger.debug("------------------+++++++++++++++++ authCallback get wxMpUser {}", wxMpUser);
|
||||||
if( state.contains("bind") ){
|
if( state.contains("bind") ){
|
||||||
// 账户绑定,将微信或者url
|
// 账户绑定,将微信或者url
|
||||||
if(wxMpUser.getHeadImgUrl().length() < 180){
|
if(wxMpUser.getHeadImgUrl().length() < 180){
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.lp.common.Code;
|
||||||
import com.lp.common.Constants;
|
import com.lp.common.Constants;
|
||||||
import com.lp.common.RequestURLIOT;
|
import com.lp.common.RequestURLIOT;
|
||||||
import com.lp.controller.BaseController;
|
import com.lp.controller.BaseController;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.QRCodeUtil;
|
import com.lp.util.QRCodeUtil;
|
||||||
import com.lp.util.ResultMapUtils;
|
import com.lp.util.ResultMapUtils;
|
||||||
|
|
@ -60,7 +61,7 @@ public class ContactUserInfoController extends BaseController {
|
||||||
obj.setUser_id(user.getId());
|
obj.setUser_id(user.getId());
|
||||||
resultMap = service.insert("ContactUserInfo.insert", obj) ;
|
resultMap = service.insert("ContactUserInfo.insert", obj) ;
|
||||||
if(isOk(resultMap)){
|
if(isOk(resultMap)){
|
||||||
LOGGER.debug("{} save is called with {}", RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO, obj);
|
LogUtil4j.debugLogger.debug("{} save is called with {}", RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO, obj);
|
||||||
// 增加二维码,提供微信公众号绑定 [ 增加新的文件储存隔离系统 ]
|
// 增加二维码,提供微信公众号绑定 [ 增加新的文件储存隔离系统 ]
|
||||||
QRCodeUtil.encode(ProConfig.LOCAL_DOMAIN +"/service/wiot/cbind?id="+obj.getId() ,null,
|
QRCodeUtil.encode(ProConfig.LOCAL_DOMAIN +"/service/wiot/cbind?id="+obj.getId() ,null,
|
||||||
ProConfig.LOCAL_FILE_PATH+"/"+Constants.FileRealPath.QRCODE+"/"+ (int) (obj.getId()/100+1)*100
|
ProConfig.LOCAL_FILE_PATH+"/"+Constants.FileRealPath.QRCODE+"/"+ (int) (obj.getId()/100+1)*100
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,7 @@ import com.lp.common.Constants;
|
||||||
import com.lp.common.RequestURLIOT;
|
import com.lp.common.RequestURLIOT;
|
||||||
import com.lp.controller.BaseController;
|
import com.lp.controller.BaseController;
|
||||||
import com.lp.service.IotHistorySensorDataService;
|
import com.lp.service.IotHistorySensorDataService;
|
||||||
import com.lp.util.DateUtils;
|
import com.lp.util.*;
|
||||||
import com.lp.util.ObjectUtil;
|
|
||||||
import com.lp.util.PageBean;
|
|
||||||
import com.lp.util.ResultMapUtils;
|
|
||||||
import org.apache.commons.csv.CSVFormat;
|
import org.apache.commons.csv.CSVFormat;
|
||||||
import org.apache.commons.csv.CSVPrinter;
|
import org.apache.commons.csv.CSVPrinter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -75,7 +72,7 @@ public class IotHistorySensorInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
PageBean data = (PageBean) getData(resultMap);
|
PageBean data = (PageBean) getData(resultMap);
|
||||||
List<IotHistorySensorDataBO> data1 = (List<IotHistorySensorDataBO>) data.getData();
|
List<IotHistorySensorDataBO> data1 = (List<IotHistorySensorDataBO>) data.getData();
|
||||||
LOGGER.debug("/page/sensor/history selectPage return: {}", resultMap);
|
LogUtil4j.debugLogger.debug("/page/sensor/history selectPage return: {}", resultMap);
|
||||||
return getModelAndView(response, resultMap);
|
return getModelAndView(response, resultMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -286,7 +283,7 @@ public class IotHistorySensorInfoController extends BaseController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
exception(e,resultMap, id);
|
exception(e,resultMap, id);
|
||||||
}
|
}
|
||||||
LOGGER.debug("{} selectOne return {}", RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO, resultMap);
|
LogUtil4j.debugLogger.debug("{} selectOne return {}", RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO, resultMap);
|
||||||
return getModelAndView(response, resultMap);
|
return getModelAndView(response, resultMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.lp.common.CodeIot;
|
||||||
import com.lp.common.RequestURLIOT;
|
import com.lp.common.RequestURLIOT;
|
||||||
import com.lp.controller.BaseController;
|
import com.lp.controller.BaseController;
|
||||||
import com.lp.service.IotNodeInfoService;
|
import com.lp.service.IotNodeInfoService;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.ResultMapUtils;
|
import com.lp.util.ResultMapUtils;
|
||||||
import com.lp.util.iot.ProtocolUtil;
|
import com.lp.util.iot.ProtocolUtil;
|
||||||
|
|
@ -55,7 +56,9 @@ public class IotNodeInfoController extends BaseController {
|
||||||
Map<String, Object> resultMap = getResultMap();
|
Map<String, Object> resultMap = getResultMap();
|
||||||
try {
|
try {
|
||||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||||
|
// if(user.getType() != Code.UserType.SUPER ){
|
||||||
obj.setUser_id(user.getId());
|
obj.setUser_id(user.getId());
|
||||||
|
// }
|
||||||
resultMap = service.selectPageList("IotNodeInfo.selectPage",getPageBean(paged,pageSize), obj);
|
resultMap = service.selectPageList("IotNodeInfo.selectPage",getPageBean(paged,pageSize), obj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
exception(e,resultMap, obj);
|
exception(e,resultMap, obj);
|
||||||
|
|
@ -300,6 +303,7 @@ public class IotNodeInfoController extends BaseController {
|
||||||
ProCacheUtil.addCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code(), obj);
|
ProCacheUtil.addCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code(), obj);
|
||||||
}else{
|
}else{
|
||||||
ProCacheUtil.addCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code(), obj);
|
ProCacheUtil.addCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code(), obj);
|
||||||
|
LogUtil4j.debugLogger.debug("ProCacheUtil.removeCache NodeInfoDeviceCode with {}", obj.getDevice_code());
|
||||||
ProCacheUtil.removeCache(CacheName.NODEINFO_DEVICECODE, pre.getDevice_code());
|
ProCacheUtil.removeCache(CacheName.NODEINFO_DEVICECODE, pre.getDevice_code());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,7 +350,6 @@ public class IotNodeInfoController extends BaseController {
|
||||||
try {
|
try {
|
||||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||||
obj.setUser_id(user.getId());
|
obj.setUser_id(user.getId());
|
||||||
|
|
||||||
resultMap = service.selectList("IotNodeInfo.selectNodeSensorList", obj);
|
resultMap = service.selectList("IotNodeInfo.selectNodeSensorList", obj);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -369,7 +372,7 @@ public class IotNodeInfoController extends BaseController {
|
||||||
try {
|
try {
|
||||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||||
obj.setUser_id(user.getId());
|
obj.setUser_id(user.getId());
|
||||||
LOGGER.debug("selectNodeSensorListPages is called with {}", obj);
|
LogUtil4j.debugLogger.debug("selectNodeSensorListPages is called with {}", obj);
|
||||||
resultMap = service.selectPageList("IotNodeInfo.selectNodeSensorList",getPageBean(paged,pageSize), obj);
|
resultMap = service.selectPageList("IotNodeInfo.selectNodeSensorList",getPageBean(paged,pageSize), obj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
exception(e,resultMap, obj);
|
exception(e,resultMap, obj);
|
||||||
|
|
@ -417,6 +420,7 @@ public class IotNodeInfoController extends BaseController {
|
||||||
// obj 获取缓存
|
// obj 获取缓存
|
||||||
obj = ProCacheUtil.getCache(CacheName.NODEINFO, obj.getId().toString());
|
obj = ProCacheUtil.getCache(CacheName.NODEINFO, obj.getId().toString());
|
||||||
ProCacheUtil.removeCache(CacheName.NODEINFO, obj.getId().toString());
|
ProCacheUtil.removeCache(CacheName.NODEINFO, obj.getId().toString());
|
||||||
|
LogUtil4j.debugLogger.debug("ProCacheUtil.removeCache NodeInfoDeviceCode with {}", obj.getDevice_code());
|
||||||
ProCacheUtil.removeCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code());
|
ProCacheUtil.removeCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -467,5 +471,14 @@ public class IotNodeInfoController extends BaseController {
|
||||||
return getModelAndView(response, resultMap);
|
return getModelAndView(response, resultMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "/yinzy/getcacheinfo")
|
||||||
|
public String getCacheInfo(HttpServletResponse response,
|
||||||
|
@PathVariable String deviceCode ) {
|
||||||
|
IotNodeInfoBO nodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, deviceCode );
|
||||||
|
if(ObjectUtil.isEmpty(nodeInfo)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else return nodeInfo.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import com.lp.common.Constants;
|
||||||
import com.lp.common.RequestURLIOT;
|
import com.lp.common.RequestURLIOT;
|
||||||
import com.lp.controller.BaseController;
|
import com.lp.controller.BaseController;
|
||||||
import com.lp.service.IotSceneInfoService;
|
import com.lp.service.IotSceneInfoService;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.PageBean;
|
import com.lp.util.PageBean;
|
||||||
import com.lp.util.ResultMapUtils;
|
import com.lp.util.ResultMapUtils;
|
||||||
|
|
@ -47,7 +48,9 @@ public class IotSceneInfoController extends BaseController {
|
||||||
Map<String, Object> resultMap = getResultMap();
|
Map<String, Object> resultMap = getResultMap();
|
||||||
try {
|
try {
|
||||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||||
|
// if(user.getType() != Code.UserType.SUPER ){
|
||||||
obj.setUser_id(user.getId());
|
obj.setUser_id(user.getId());
|
||||||
|
// }
|
||||||
resultMap = service.selectPageList("IotSceneInfo.select",getPageBean(paged,pageSize), obj);
|
resultMap = service.selectPageList("IotSceneInfo.select",getPageBean(paged,pageSize), obj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
exception(e,resultMap, obj);
|
exception(e,resultMap, obj);
|
||||||
|
|
@ -99,7 +102,7 @@ public class IotSceneInfoController extends BaseController {
|
||||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||||
obj.setUser_id(user.getId());
|
obj.setUser_id(user.getId());
|
||||||
resultMap = service.selectPageList("IotSceneInfo.selectSceneInfo",getPageBean(paged,pageSize), obj);
|
resultMap = service.selectPageList("IotSceneInfo.selectSceneInfo",getPageBean(paged,pageSize), obj);
|
||||||
LOGGER.debug("{} call selectSelfPage with {} ret: {}"
|
LogUtil4j.debugLogger.debug("{} call selectSelfPage with {} ret: {}"
|
||||||
, RequestURLIOT.SceneInfo.SELF_SCENE_INFO_PAGE ,obj
|
, RequestURLIOT.SceneInfo.SELF_SCENE_INFO_PAGE ,obj
|
||||||
, ((PageBean)getData(resultMap)).getData());
|
, ((PageBean)getData(resultMap)).getData());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,26 @@
|
||||||
package com.lp.controller.iot;
|
package com.lp.controller.iot;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import com.lp.bo.IotNodeInfoBO;
|
|
||||||
import com.lp.bo.IotSensorDeviceInfoBO;
|
import com.lp.bo.IotSensorDeviceInfoBO;
|
||||||
import com.lp.bo.IotSensorInfoBO;
|
import com.lp.bo.IotSensorInfoBO;
|
||||||
import com.lp.bo.IotTriggerInfoBO;
|
import com.lp.bo.IotTriggerInfoBO;
|
||||||
import com.lp.bo.UserInfoBO;
|
import com.lp.bo.UserInfoBO;
|
||||||
import com.lp.cache.CacheName;
|
import com.lp.cache.CacheName;
|
||||||
import com.lp.cache.ProCacheUtil;
|
import com.lp.cache.ProCacheUtil;
|
||||||
import com.lp.common.Constants;
|
|
||||||
|
|
||||||
import com.lp.common.Code;
|
import com.lp.common.Code;
|
||||||
import com.lp.common.CodeIot;
|
import com.lp.common.CodeIot;
|
||||||
import com.lp.common.RequestURLIOT;
|
import com.lp.common.RequestURLIOT;
|
||||||
import com.lp.controller.BaseController;
|
import com.lp.controller.BaseController;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.ResultMapUtils;
|
import com.lp.util.ResultMapUtils;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
|
|
||||||
|
|
@ -107,6 +99,8 @@ public class IotSensorDeviceInfoController extends BaseController {
|
||||||
service.insert("IotSensorInfo.insert", sensor) ;
|
service.insert("IotSensorInfo.insert", sensor) ;
|
||||||
|
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO, sensor.getId().toString(), sensor);
|
ProCacheUtil.addCache(CacheName.SENSORINFO, sensor.getId().toString(), sensor);
|
||||||
|
LogUtil4j.debugLogger.debug("add cache {}---{}", CacheName.SENSORINFO_NSP
|
||||||
|
, sensor.getNode_id()+"-"+sensor.getSensor_device_id()+"-"+sensor.getPort_id());
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, sensor.getNode_id()+"-"+
|
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, sensor.getNode_id()+"-"+
|
||||||
sensor.getSensor_device_id()+"-"+sensor.getPort_id(), sensor);
|
sensor.getSensor_device_id()+"-"+sensor.getPort_id(), sensor);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package com.lp.controller.iot;
|
package com.lp.controller.iot;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import com.lp.bo.IotNodeInfoBO;
|
import com.lp.bo.IotNodeInfoBO;
|
||||||
import com.lp.bo.IotSensorInfoBO;
|
import com.lp.bo.IotSensorInfoBO;
|
||||||
import com.lp.bo.UserInfoBO;
|
import com.lp.bo.UserInfoBO;
|
||||||
|
|
@ -33,9 +18,19 @@ import com.lp.common.RequestURLIOT;
|
||||||
import com.lp.controller.BaseController;
|
import com.lp.controller.BaseController;
|
||||||
import com.lp.mqtt.MqttService;
|
import com.lp.mqtt.MqttService;
|
||||||
import com.lp.service.IotSensorInfoService;
|
import com.lp.service.IotSensorInfoService;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.ResultMapUtils;
|
import com.lp.util.ResultMapUtils;
|
||||||
import com.lp.util.iot.ProtocolUtil;
|
import com.lp.util.iot.ProtocolUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
|
|
@ -98,6 +93,9 @@ public class IotSensorInfoController extends BaseController {
|
||||||
resultMap = service.insert("IotSensorInfo.insert", obj) ;
|
resultMap = service.insert("IotSensorInfo.insert", obj) ;
|
||||||
if(isOk(resultMap)){
|
if(isOk(resultMap)){
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO, obj.getId().toString(), obj);
|
ProCacheUtil.addCache(CacheName.SENSORINFO, obj.getId().toString(), obj);
|
||||||
|
|
||||||
|
LogUtil4j.debugLogger.debug("add cache {}---{}", CacheName.SENSORINFO_NSP
|
||||||
|
, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id());
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
||||||
|
|
||||||
// 这边获取到网关的缓存信息,如果是modbus设备,则更新下发的缓存
|
// 这边获取到网关的缓存信息,如果是modbus设备,则更新下发的缓存
|
||||||
|
|
@ -375,6 +373,8 @@ public class IotSensorInfoController extends BaseController {
|
||||||
resultMap = service.update("IotSensorInfo.update", obj) ;
|
resultMap = service.update("IotSensorInfo.update", obj) ;
|
||||||
if(isOk(resultMap)){
|
if(isOk(resultMap)){
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO, obj.getId().toString(), obj);
|
ProCacheUtil.addCache(CacheName.SENSORINFO, obj.getId().toString(), obj);
|
||||||
|
LogUtil4j.debugLogger.debug("add cache {}---{}", CacheName.SENSORINFO_NSP
|
||||||
|
, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id());
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
||||||
|
|
||||||
// 这边获取到网关的缓存信息,如果是modbus设备,则更新下发的缓存
|
// 这边获取到网关的缓存信息,如果是modbus设备,则更新下发的缓存
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,16 @@
|
||||||
package com.lp.controller.iot;
|
package com.lp.controller.iot;
|
||||||
|
|
||||||
import java.util.Map;
|
import com.lp.bo.ContactUserInfoBO;
|
||||||
|
import com.lp.bo.IotVideoInfoBO;
|
||||||
import javax.annotation.Resource;
|
import com.lp.bo.UserInfoBO;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import com.lp.controller.BaseController;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import com.lp.util.BrowserJudge;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
|
import com.lp.util.ObjectUtil;
|
||||||
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpServiceImpl;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
@ -13,20 +18,16 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import com.lp.bo.ContactUserInfoBO;
|
import javax.annotation.Resource;
|
||||||
import com.lp.bo.IotVideoInfoBO;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.lp.bo.UserInfoBO;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import com.lp.controller.BaseController;
|
import java.util.Map;
|
||||||
import com.lp.util.BrowserJudge;
|
|
||||||
import com.lp.util.ObjectUtil;
|
|
||||||
|
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
|
||||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl;
|
|
||||||
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class IotWechatViewController extends BaseController {
|
public class IotWechatViewController extends BaseController {
|
||||||
|
|
||||||
|
protected final static Logger LOGGER = LoggerFactory.getLogger(IotWechatViewController.class);
|
||||||
|
|
||||||
private final static String VIEW_PATH = "/wechat/iot/" ;
|
private final static String VIEW_PATH = "/wechat/iot/" ;
|
||||||
|
|
||||||
|
|
@ -56,6 +57,7 @@ public class IotWechatViewController extends BaseController {
|
||||||
public String wechatPage(HttpServletRequest req, HttpServletResponse resp,
|
public String wechatPage(HttpServletRequest req, HttpServletResponse resp,
|
||||||
@PathVariable String viewName) {
|
@PathVariable String viewName) {
|
||||||
setModelWeb(req,viewName);
|
setModelWeb(req,viewName);
|
||||||
|
LogUtil4j.debugLogger.debug("------------------++++++++++++++++++ get view {}", viewName);
|
||||||
return VIEW_PATH + viewName;
|
return VIEW_PATH + viewName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,8 @@
|
||||||
package com.lp.cronservice;
|
package com.lp.cronservice;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.task.TaskExecutor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.lp.bean.TableSystem;
|
import com.lp.bean.TableSystem;
|
||||||
import com.lp.bo.BussinessTriggerBO;
|
import com.lp.bo.*;
|
||||||
import com.lp.bo.IotNodeInfoBO;
|
|
||||||
import com.lp.bo.IotSceneInfoBO;
|
|
||||||
import com.lp.bo.IotSensorInfoBO;
|
|
||||||
import com.lp.bo.IotTriggerInfoBO;
|
|
||||||
import com.lp.cache.CacheName;
|
import com.lp.cache.CacheName;
|
||||||
import com.lp.cache.EhcacheUtil;
|
import com.lp.cache.EhcacheUtil;
|
||||||
import com.lp.cache.ProCacheUtil;
|
import com.lp.cache.ProCacheUtil;
|
||||||
|
|
@ -26,13 +10,17 @@ import com.lp.common.CodeIot;
|
||||||
import com.lp.dao.BaseDao;
|
import com.lp.dao.BaseDao;
|
||||||
import com.lp.mqtt.MessageCallback;
|
import com.lp.mqtt.MessageCallback;
|
||||||
import com.lp.mqtt.MqttService;
|
import com.lp.mqtt.MqttService;
|
||||||
import com.lp.util.DateUtils;
|
import com.lp.util.*;
|
||||||
import com.lp.util.LogUtil;
|
|
||||||
import com.lp.util.ObjectUtil;
|
|
||||||
import com.lp.util.PropertiesUtil;
|
|
||||||
import com.lp.util.iot.IotTrigger;
|
import com.lp.util.iot.IotTrigger;
|
||||||
|
|
||||||
import net.sf.ehcache.Cache;
|
import net.sf.ehcache.Cache;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.task.TaskExecutor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 版权所有 @鸿名物联
|
* 版权所有 @鸿名物联
|
||||||
|
|
@ -265,16 +253,22 @@ public class CronServiceThread {
|
||||||
private TaskExecutor taskExecutor ;
|
private TaskExecutor taskExecutor ;
|
||||||
|
|
||||||
public void connect() {
|
public void connect() {
|
||||||
|
if(MqttService.autoReconn == true){
|
||||||
|
return;
|
||||||
|
}
|
||||||
MqttConnectOptions options = new MqttConnectOptions();
|
MqttConnectOptions options = new MqttConnectOptions();
|
||||||
options.setCleanSession(false);
|
options.setCleanSession(false);
|
||||||
options.setUserName(MqttService.userName);
|
options.setUserName(MqttService.userName);
|
||||||
options.setPassword(MqttService.passWord.toCharArray());
|
options.setPassword(MqttService.passWord.toCharArray());
|
||||||
// 设置超时时间
|
if(StringUtils.isNumeric(MqttService.timeout)){
|
||||||
options.setConnectionTimeout(20);
|
options.setConnectionTimeout(Integer.parseInt(MqttService.timeout));
|
||||||
|
}
|
||||||
// 设置会话心跳时间
|
// 设置会话心跳时间
|
||||||
options.setKeepAliveInterval(30);
|
if(StringUtils.isNumeric(MqttService.keepalive)){
|
||||||
|
options.setKeepAliveInterval(Integer.parseInt(MqttService.keepalive));
|
||||||
|
}
|
||||||
// 重连
|
// 重连
|
||||||
options.setAutomaticReconnect(false);
|
options.setAutomaticReconnect(MqttService.autoReconn);
|
||||||
// 清楚缓存
|
// 清楚缓存
|
||||||
options.setCleanSession(MqttService.cleanSession);
|
options.setCleanSession(MqttService.cleanSession);
|
||||||
try {
|
try {
|
||||||
|
|
@ -294,8 +288,11 @@ public class CronServiceThread {
|
||||||
public class SysHealthCheck implements Runnable {
|
public class SysHealthCheck implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
LogUtil4j.debugLogger.debug("SysHealthCheck");
|
||||||
if(ObjectUtil.isNotEmpty(MqttService.client) ){
|
if(ObjectUtil.isNotEmpty(MqttService.client) ){
|
||||||
|
LogUtil4j.debugLogger.debug("SysHealthCheck mqtt client {}---{}", MqttService.client.getClientId(), MqttService.client.getDebug().toString());
|
||||||
if( ! MqttService.client.isConnected() ){
|
if( ! MqttService.client.isConnected() ){
|
||||||
|
LogUtil4j.debugLogger.debug("SysHealthCheck mqtt client {} is disconnected", MqttService.client.getClientId());
|
||||||
connect();
|
connect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -317,8 +314,10 @@ public class CronServiceThread {
|
||||||
obj = ProCacheUtil.getCache(CacheName.NODEINFO, obj.getId().toString() ) ;
|
obj = ProCacheUtil.getCache(CacheName.NODEINFO, obj.getId().toString() ) ;
|
||||||
if( DateUtils.getMinusFromCurrent( obj.getMtime() , obj.getFrequency()+ 30 ) > 0 ){
|
if( DateUtils.getMinusFromCurrent( obj.getMtime() , obj.getFrequency()+ 30 ) > 0 ){
|
||||||
// 设备离线
|
// 设备离线
|
||||||
|
// ProCacheUtil.addCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code(), obj);
|
||||||
obj.setIot_node_status(CodeIot.DEVICE_STATUS.OFFLINE);
|
obj.setIot_node_status(CodeIot.DEVICE_STATUS.OFFLINE);
|
||||||
baseDao.update("IotNodeInfo.updateNodeStatusById", obj);
|
baseDao.update("IotNodeInfo.updateNodeStatusById", obj);
|
||||||
|
LogUtil4j.debugLogger.debug("DeviceStatusMaintain will offline {}", obj.getDevice_code());
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
log.error("error info:"+ e.getMessage()+",param=" + JSON.toJSONString(obj) );
|
log.error("error info:"+ e.getMessage()+",param=" + JSON.toJSONString(obj) );
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,7 @@ import com.lp.cache.CacheName;
|
||||||
import com.lp.cache.ProCacheUtil;
|
import com.lp.cache.ProCacheUtil;
|
||||||
import com.lp.common.Constants.CodeType;
|
import com.lp.common.Constants.CodeType;
|
||||||
import com.lp.dao.BaseDao;
|
import com.lp.dao.BaseDao;
|
||||||
import com.lp.util.LogUtil;
|
import com.lp.util.*;
|
||||||
import com.lp.util.ObjectUtil;
|
|
||||||
import com.lp.util.PageBean;
|
|
||||||
import com.lp.util.ResultMapUtils;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -60,7 +57,7 @@ public class BaseDaoImpl extends ResultMapUtils implements BaseDao {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> List<T> selectList(String statement, Object obj, PageBean pageBean) {
|
public <T> List<T> selectList(String statement, Object obj, PageBean pageBean) {
|
||||||
LOGGER.debug("selectList is called");
|
LogUtil4j.debugLogger.debug("selectList is called");
|
||||||
List<T> o = null ;
|
List<T> o = null ;
|
||||||
try {
|
try {
|
||||||
pageBean.setPageParam4Mysql(obj);
|
pageBean.setPageParam4Mysql(obj);
|
||||||
|
|
@ -188,7 +185,7 @@ public class BaseDaoImpl extends ResultMapUtils implements BaseDao {
|
||||||
}
|
}
|
||||||
String code_value =null ;
|
String code_value =null ;
|
||||||
try{
|
try{
|
||||||
LOGGER.debug("dictionaryValue with {}---{}", valueSdata, value);
|
LogUtil4j.debugLogger.debug("dictionaryValue with {}---{}", valueSdata, value);
|
||||||
code_value = ObjectUtil.dictionaryValue( Double.parseDouble(String.valueOf(valueSdata)), value);
|
code_value = ObjectUtil.dictionaryValue( Double.parseDouble(String.valueOf(valueSdata)), value);
|
||||||
annotationedFieldMap.put(f.getField().getName(), code_value);
|
annotationedFieldMap.put(f.getField().getName(), code_value);
|
||||||
}catch(NumberFormatException e){
|
}catch(NumberFormatException e){
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,19 @@
|
||||||
*/
|
*/
|
||||||
package com.lp.mqtt;
|
package com.lp.mqtt;
|
||||||
|
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
|
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.task.TaskExecutor;
|
import org.springframework.core.task.TaskExecutor;
|
||||||
|
|
||||||
|
|
||||||
public class MessageCallback implements MqttCallbackExtended {
|
public class MessageCallback implements MqttCallbackExtended {
|
||||||
|
|
||||||
private TaskExecutor taskExecutor ;
|
private TaskExecutor taskExecutor ;
|
||||||
|
protected final static Logger LOGGER = LoggerFactory.getLogger(MessageCallback.class);
|
||||||
|
|
||||||
public MessageCallback(TaskExecutor taskExecutor2) {
|
public MessageCallback(TaskExecutor taskExecutor2) {
|
||||||
super();
|
super();
|
||||||
|
|
@ -23,11 +27,13 @@ public class MessageCallback implements MqttCallbackExtended {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionLost(Throwable arg0) {
|
public void connectionLost(Throwable arg0) {
|
||||||
|
LogUtil4j.debugLogger.debug("connectionLost {}", arg0.getLocalizedMessage());
|
||||||
// TODO 连接断开,可以做重连,目前重连失败,还没有设置
|
// TODO 连接断开,可以做重连,目前重连失败,还没有设置
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||||
|
LogUtil4j.debugLogger.debug("deliveryComplete {}", token.getTopics());
|
||||||
// TODO delivery 传送OK
|
// TODO delivery 传送OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,6 +45,7 @@ public class MessageCallback implements MqttCallbackExtended {
|
||||||
taskExecutor.execute(new MessageHandler(message.getPayload() ,
|
taskExecutor.execute(new MessageHandler(message.getPayload() ,
|
||||||
new String(message.getPayload()), topic));
|
new String(message.getPayload()), topic));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
LOGGER.error("messageArrived error: ", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +53,7 @@ public class MessageCallback implements MqttCallbackExtended {
|
||||||
@Override
|
@Override
|
||||||
public void connectComplete(boolean arg0, String arg1) {
|
public void connectComplete(boolean arg0, String arg1) {
|
||||||
// 连接成功后,重新订阅自己的主题
|
// 连接成功后,重新订阅自己的主题
|
||||||
|
LogUtil4j.debugLogger.debug("connectComplete with ({})({})", arg0, arg1);
|
||||||
MqttService.subscribe();
|
MqttService.subscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@
|
||||||
package com.lp.mqtt;
|
package com.lp.mqtt;
|
||||||
|
|
||||||
import com.lp.util.LogUtil;
|
import com.lp.util.LogUtil;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.PropertiesUtil;
|
import com.lp.util.PropertiesUtil;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||||
|
|
@ -40,6 +42,9 @@ public class MqttService {
|
||||||
public static final String passWord = PropertiesUtil.getProperty("mqtt.config" ,"mqtt.password");
|
public static final String passWord = PropertiesUtil.getProperty("mqtt.config" ,"mqtt.password");
|
||||||
|
|
||||||
public static final Boolean cleanSession = "true".equalsIgnoreCase(PropertiesUtil.getProperty("mqtt.config" ,"mqtt.cleanSession")) ;
|
public static final Boolean cleanSession = "true".equalsIgnoreCase(PropertiesUtil.getProperty("mqtt.config" ,"mqtt.cleanSession")) ;
|
||||||
|
public static final Boolean autoReconn = "true".equalsIgnoreCase(PropertiesUtil.getProperty("mqtt.config" ,"mqtt.autoReconnect")) ;
|
||||||
|
public static final String keepalive = PropertiesUtil.getProperty("mqtt.config" ,"mqtt.keepalive") ;
|
||||||
|
public static final String timeout = PropertiesUtil.getProperty("mqtt.config" ,"mqtt.timeout") ;
|
||||||
|
|
||||||
public static Logger LOGGER = (Logger) LoggerFactory.getLogger(MqttService.class);
|
public static Logger LOGGER = (Logger) LoggerFactory.getLogger(MqttService.class);
|
||||||
|
|
||||||
|
|
@ -69,11 +74,15 @@ public class MqttService {
|
||||||
options.setUserName(userName);
|
options.setUserName(userName);
|
||||||
options.setPassword(passWord.toCharArray());
|
options.setPassword(passWord.toCharArray());
|
||||||
// 设置超时时间
|
// 设置超时时间
|
||||||
options.setConnectionTimeout(20);
|
if(StringUtils.isNumeric(timeout)){
|
||||||
|
options.setConnectionTimeout(Integer.parseInt(timeout));
|
||||||
|
}
|
||||||
// 设置会话心跳时间
|
// 设置会话心跳时间
|
||||||
options.setKeepAliveInterval(30);
|
if(StringUtils.isNumeric(keepalive)){
|
||||||
|
options.setKeepAliveInterval(Integer.parseInt(keepalive));
|
||||||
|
}
|
||||||
// 重连
|
// 重连
|
||||||
options.setAutomaticReconnect(false);
|
options.setAutomaticReconnect(autoReconn);
|
||||||
// 清楚缓存
|
// 清楚缓存
|
||||||
options.setCleanSession(cleanSession);
|
options.setCleanSession(cleanSession);
|
||||||
try {
|
try {
|
||||||
|
|
@ -93,7 +102,7 @@ public class MqttService {
|
||||||
Qos[i] =1 ;
|
Qos[i] =1 ;
|
||||||
}
|
}
|
||||||
client.subscribe(topic1, Qos);
|
client.subscribe(topic1, Qos);
|
||||||
LOGGER.debug("subscribe with {}", topic1);
|
LogUtil4j.debugLogger.debug("subscribe with {}", topic1);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
LOGGER.error("subscribe error", e);
|
LOGGER.error("subscribe error", e);
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +120,7 @@ public class MqttService {
|
||||||
try {
|
try {
|
||||||
client.publish(topic, mess);
|
client.publish(topic, mess);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.errorLog(e);
|
LOGGER.error("pubMessage", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +137,7 @@ public class MqttService {
|
||||||
try {
|
try {
|
||||||
client.publish(topic, mess);
|
client.publish(topic, mess);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.errorLog(e);
|
LOGGER.error("pubMessage", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.lp.common.CodeIot;
|
||||||
import com.lp.mqtt.MqttService;
|
import com.lp.mqtt.MqttService;
|
||||||
import com.lp.service.impl.IotNodeInfoServerImpl;
|
import com.lp.service.impl.IotNodeInfoServerImpl;
|
||||||
import com.lp.service.impl.IotSensorInfoServiceImpl;
|
import com.lp.service.impl.IotSensorInfoServiceImpl;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.SpringApplicationContext;
|
import com.lp.util.SpringApplicationContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -26,7 +27,7 @@ public class ProtocalMing implements Iprotocal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void analysisData(String topic, byte[] data, String msg) {
|
public void analysisData(String topic, byte[] data, String msg) {
|
||||||
LOGGER.debug("analysisData get {}---{}---{}", topic, data, msg);
|
|
||||||
// 这边可以保证主题都是 /dev/coo/device_id
|
// 这边可以保证主题都是 /dev/coo/device_id
|
||||||
msg =msg.replaceAll("\r|\n", "");
|
msg =msg.replaceAll("\r|\n", "");
|
||||||
|
|
||||||
|
|
@ -38,7 +39,7 @@ public class ProtocalMing implements Iprotocal {
|
||||||
List<SimpleProtocolMqtt> tmpList = JSON.parseArray(msg, SimpleProtocolMqtt.class);
|
List<SimpleProtocolMqtt> tmpList = JSON.parseArray(msg, SimpleProtocolMqtt.class);
|
||||||
// 对象转换
|
// 对象转换
|
||||||
for(SimpleProtocolMqtt dt : tmpList ){
|
for(SimpleProtocolMqtt dt : tmpList ){
|
||||||
LOGGER.debug("analysisData msg from json {}", dt.toString());
|
LogUtil4j.debugLogger.debug("analysisData msg from json {}", dt.toString());
|
||||||
IotSensorInfoBO tp = new IotSensorInfoBO();
|
IotSensorInfoBO tp = new IotSensorInfoBO();
|
||||||
tp.setSensor_device_id(dt.getSid());
|
tp.setSensor_device_id(dt.getSid());
|
||||||
tp.setPort_id(dt.getPid());
|
tp.setPort_id(dt.getPid());
|
||||||
|
|
@ -51,12 +52,12 @@ public class ProtocalMing implements Iprotocal {
|
||||||
|
|
||||||
String[] tmp = topic.split("/");
|
String[] tmp = topic.split("/");
|
||||||
String deviceCode = tmp[tmp.length -1];
|
String deviceCode = tmp[tmp.length -1];
|
||||||
|
LogUtil4j.debugLogger.debug("analysisData get msg from topic:{}---device:{}", topic, deviceCode);
|
||||||
IotNodeInfoBO nodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, deviceCode );
|
IotNodeInfoBO nodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, deviceCode );
|
||||||
LOGGER.debug("get nodeInfo with {}---{}", deviceCode, nodeInfo.toString());
|
|
||||||
if(ObjectUtil.isEmpty(nodeInfo)){
|
if(ObjectUtil.isEmpty(nodeInfo)){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
LogUtil4j.debugLogger.debug("get nodeInfo with {}---{}({})", deviceCode, nodeInfo.getName(), nodeInfo.getIot_node_status());
|
||||||
|
|
||||||
if(nodeInfo.getIot_node_status() != CodeIot.DEVICE_STATUS.ONLINE){
|
if(nodeInfo.getIot_node_status() != CodeIot.DEVICE_STATUS.ONLINE){
|
||||||
IotNodeInfoBO nodB = new IotNodeInfoBO() ;
|
IotNodeInfoBO nodB = new IotNodeInfoBO() ;
|
||||||
|
|
@ -65,7 +66,7 @@ public class ProtocalMing implements Iprotocal {
|
||||||
IotNodeInfoServerImpl nodeTmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
IotNodeInfoServerImpl nodeTmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
||||||
nodeTmp.updateNodeStatus(nodB);
|
nodeTmp.updateNodeStatus(nodB);
|
||||||
}
|
}
|
||||||
LOGGER.debug("get IotSensorInfoBO list {}", list.toString());
|
LogUtil4j.debugLogger.debug("get IotSensorInfoBO list ({}){}", list.size(), list.isEmpty() ? null : list.get(0).getSensor_device_id());
|
||||||
for(IotSensorInfoBO sensorInfo : list){
|
for(IotSensorInfoBO sensorInfo : list){
|
||||||
sensorInfo.setDevice_code(deviceCode);
|
sensorInfo.setDevice_code(deviceCode);
|
||||||
sensorInfo.setRequest_sdata(sensorInfo.getSdata());
|
sensorInfo.setRequest_sdata(sensorInfo.getSdata());
|
||||||
|
|
@ -75,7 +76,8 @@ public class ProtocalMing implements Iprotocal {
|
||||||
if(ObjectUtil.isEmpty(sensorInfo.getMtime())){
|
if(ObjectUtil.isEmpty(sensorInfo.getMtime())){
|
||||||
sensorInfo.setMtime(new Date());
|
sensorInfo.setMtime(new Date());
|
||||||
}
|
}
|
||||||
LOGGER.debug("get IotSensorInfoBO from list {}", sensorInfo.toString());
|
LogUtil4j.debugLogger.debug("get IotSensorInfoBO from list ({}---{}---{})"
|
||||||
|
, sensorInfo.getDevice_code(), sensorInfo.getRequest_sdata(), sensorInfo.getPort_id());
|
||||||
// 传感器处理
|
// 传感器处理
|
||||||
IotSensorInfoServiceImpl app = (IotSensorInfoServiceImpl) SpringApplicationContext.getBean("iotSensorInfoServiceImpl") ;
|
IotSensorInfoServiceImpl app = (IotSensorInfoServiceImpl) SpringApplicationContext.getBean("iotSensorInfoServiceImpl") ;
|
||||||
app.updateRealTimeData(sensorInfo) ;
|
app.updateRealTimeData(sensorInfo) ;
|
||||||
|
|
@ -88,10 +90,12 @@ public class ProtocalMing implements Iprotocal {
|
||||||
if(ObjectUtil.isNotEmpty(iotNodeInfo)){
|
if(ObjectUtil.isNotEmpty(iotNodeInfo)){
|
||||||
String scene_id = ProCacheUtil.getCache(CacheName.SCENE_IPDATE_FLAG , "scene_" + iotNodeInfo.getScene_id() );
|
String scene_id = ProCacheUtil.getCache(CacheName.SCENE_IPDATE_FLAG , "scene_" + iotNodeInfo.getScene_id() );
|
||||||
if(ObjectUtil.isNotEmpty(scene_id)){
|
if(ObjectUtil.isNotEmpty(scene_id)){
|
||||||
|
LogUtil4j.debugLogger.debug("will send msg to /scene/update/{}", iotNodeInfo.getScene_id());
|
||||||
MqttService.pubMessage( "1", "/scene/update/"+ iotNodeInfo.getScene_id() );
|
MqttService.pubMessage( "1", "/scene/update/"+ iotNodeInfo.getScene_id() );
|
||||||
}
|
}
|
||||||
String node_id = ProCacheUtil.getCache(CacheName.SCENE_IPDATE_FLAG , "node_" + iotNodeInfo.getId() );
|
String node_id = ProCacheUtil.getCache(CacheName.SCENE_IPDATE_FLAG , "node_" + iotNodeInfo.getId() );
|
||||||
if(ObjectUtil.isNotEmpty(node_id)){
|
if(ObjectUtil.isNotEmpty(node_id)){
|
||||||
|
LogUtil4j.debugLogger.debug("will send msg to /node/update/{}", iotNodeInfo.getId());
|
||||||
MqttService.pubMessage( "1", "/node/update/"+ iotNodeInfo.getId() );
|
MqttService.pubMessage( "1", "/node/update/"+ iotNodeInfo.getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -100,12 +104,13 @@ public class ProtocalMing implements Iprotocal {
|
||||||
@Override
|
@Override
|
||||||
public void handbert(String topic) {
|
public void handbert(String topic) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
LogUtil4j.debugLogger.debug("handbert");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loginProtocal(Object obj) {
|
public void loginProtocal(Object obj) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
LogUtil4j.debugLogger.debug("loginProtocal");
|
||||||
IotNodeInfoServerImpl tmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
IotNodeInfoServerImpl tmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
||||||
tmp.updateNodeStatus(((IotNodeInfoBO) obj));
|
tmp.updateNodeStatus(((IotNodeInfoBO) obj));
|
||||||
}
|
}
|
||||||
|
|
@ -113,12 +118,14 @@ public class ProtocalMing implements Iprotocal {
|
||||||
@Override
|
@Override
|
||||||
public void logout(Object obj) {
|
public void logout(Object obj) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
LogUtil4j.debugLogger.debug("logout");
|
||||||
IotNodeInfoServerImpl tmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
IotNodeInfoServerImpl tmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
||||||
tmp.updateNodeStatus(((IotNodeInfoBO) obj));
|
tmp.updateNodeStatus(((IotNodeInfoBO) obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer execServerControll(IotSensorInfoBO sensor, IotNodeInfoBO node) {
|
public Integer execServerControll(IotSensorInfoBO sensor, IotNodeInfoBO node) {
|
||||||
|
LogUtil4j.debugLogger.debug("execServerControll");
|
||||||
if(node.getIot_node_status() == CodeIot.DEVICE_STATUS.ONLINE+0){
|
if(node.getIot_node_status() == CodeIot.DEVICE_STATUS.ONLINE+0){
|
||||||
MqttService.pubMessage("{\"sensor_device_id\":\""+ sensor.getSensor_device_id()
|
MqttService.pubMessage("{\"sensor_device_id\":\""+ sensor.getSensor_device_id()
|
||||||
+"\",\"port_id\":"+sensor.getPort_id()+",\"sdata\":"+sensor.getRequest_sdata() +"}",
|
+"\",\"port_id\":"+sensor.getPort_id()+",\"sdata\":"+sensor.getRequest_sdata() +"}",
|
||||||
|
|
@ -131,6 +138,7 @@ public class ProtocalMing implements Iprotocal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer execServerParamWrite(IotSensorInfoBO sensor, IotNodeInfoBO node) {
|
public Integer execServerParamWrite(IotSensorInfoBO sensor, IotNodeInfoBO node) {
|
||||||
|
LogUtil4j.debugLogger.debug("execServerParamWrite");
|
||||||
if(node.getIot_node_status() == CodeIot.DEVICE_STATUS.ONLINE+0){
|
if(node.getIot_node_status() == CodeIot.DEVICE_STATUS.ONLINE+0){
|
||||||
MqttService.pubMessage("{\"sensor_device_id\":\""+ sensor.getSensor_device_id()
|
MqttService.pubMessage("{\"sensor_device_id\":\""+ sensor.getSensor_device_id()
|
||||||
+"\",\"port_id\":"+sensor.getPort_id()+",\"sdata\":"+sensor.getRequest_sdata() +"}",
|
+"\",\"port_id\":"+sensor.getPort_id()+",\"sdata\":"+sensor.getRequest_sdata() +"}",
|
||||||
|
|
@ -143,6 +151,7 @@ public class ProtocalMing implements Iprotocal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer execServerParamRead(IotSensorInfoBO sensorInfo, IotNodeInfoBO node) {
|
public Integer execServerParamRead(IotSensorInfoBO sensorInfo, IotNodeInfoBO node) {
|
||||||
|
LogUtil4j.debugLogger.debug("execServerParamRead");
|
||||||
if(node.getIot_node_status() == CodeIot.DEVICE_STATUS.ONLINE+0){
|
if(node.getIot_node_status() == CodeIot.DEVICE_STATUS.ONLINE+0){
|
||||||
MqttService.pubMessage("{\"sensor_device_id\":\""+ sensorInfo.getSensor_device_id()
|
MqttService.pubMessage("{\"sensor_device_id\":\""+ sensorInfo.getSensor_device_id()
|
||||||
+"\",\"port_id\":"+sensorInfo.getPort_id() +"}",
|
+"\",\"port_id\":"+sensorInfo.getPort_id() +"}",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.lp.common.CodeIot;
|
||||||
import com.lp.mqtt.MqttService;
|
import com.lp.mqtt.MqttService;
|
||||||
import com.lp.service.impl.IotNodeInfoServerImpl;
|
import com.lp.service.impl.IotNodeInfoServerImpl;
|
||||||
import com.lp.service.impl.IotSensorInfoServiceImpl;
|
import com.lp.service.impl.IotSensorInfoServiceImpl;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.SpringApplicationContext;
|
import com.lp.util.SpringApplicationContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -26,7 +27,7 @@ public class ProtocalXinaoV1 implements Iprotocal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void analysisData(String topic, byte[] data, String msg) {
|
public void analysisData(String topic, byte[] data, String msg) {
|
||||||
LOGGER.debug("analysisData get {}---{}---{}", topic, data, msg);
|
LogUtil4j.debugLogger.debug("analysisData get {}---{}---{}", topic, data, msg);
|
||||||
// 这边可以保证主题都是 /dev/coo/device_id
|
// 这边可以保证主题都是 /dev/coo/device_id
|
||||||
msg =msg.replaceAll("\r|\n", "");
|
msg =msg.replaceAll("\r|\n", "");
|
||||||
|
|
||||||
|
|
@ -38,7 +39,7 @@ public class ProtocalXinaoV1 implements Iprotocal {
|
||||||
List<SimpleProtocolMqtt> tmpList = JSON.parseArray(msg, SimpleProtocolMqtt.class);
|
List<SimpleProtocolMqtt> tmpList = JSON.parseArray(msg, SimpleProtocolMqtt.class);
|
||||||
// 对象转换
|
// 对象转换
|
||||||
for(SimpleProtocolMqtt dt : tmpList ){
|
for(SimpleProtocolMqtt dt : tmpList ){
|
||||||
LOGGER.debug("analysisData msg from json {}", dt.toString());
|
LogUtil4j.debugLogger.debug("analysisData msg from json {}", dt.toString());
|
||||||
IotSensorInfoBO tp = new IotSensorInfoBO();
|
IotSensorInfoBO tp = new IotSensorInfoBO();
|
||||||
tp.setSensor_device_id(dt.getSid());
|
tp.setSensor_device_id(dt.getSid());
|
||||||
tp.setPort_id(dt.getPid());
|
tp.setPort_id(dt.getPid());
|
||||||
|
|
@ -53,7 +54,7 @@ public class ProtocalXinaoV1 implements Iprotocal {
|
||||||
String deviceCode = tmp[tmp.length -1];
|
String deviceCode = tmp[tmp.length -1];
|
||||||
|
|
||||||
IotNodeInfoBO nodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, deviceCode );
|
IotNodeInfoBO nodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, deviceCode );
|
||||||
LOGGER.debug("get nodeInfo with {}---{}", deviceCode, nodeInfo.toString());
|
LogUtil4j.debugLogger.debug("get nodeInfo with {}---{}", deviceCode, nodeInfo.toString());
|
||||||
if(ObjectUtil.isEmpty(nodeInfo)){
|
if(ObjectUtil.isEmpty(nodeInfo)){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +66,7 @@ public class ProtocalXinaoV1 implements Iprotocal {
|
||||||
IotNodeInfoServerImpl nodeTmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
IotNodeInfoServerImpl nodeTmp = SpringApplicationContext.getBeanType("iotNodeInfoServerImpl") ;
|
||||||
nodeTmp.updateNodeStatus(nodB);
|
nodeTmp.updateNodeStatus(nodB);
|
||||||
}
|
}
|
||||||
LOGGER.debug("get IotSensorInfoBO list {}", list.toString());
|
LogUtil4j.debugLogger.debug("get IotSensorInfoBO list {}", list.toString());
|
||||||
for(IotSensorInfoBO sensorInfo : list){
|
for(IotSensorInfoBO sensorInfo : list){
|
||||||
sensorInfo.setDevice_code(deviceCode);
|
sensorInfo.setDevice_code(deviceCode);
|
||||||
sensorInfo.setRequest_sdata(sensorInfo.getSdata());
|
sensorInfo.setRequest_sdata(sensorInfo.getSdata());
|
||||||
|
|
@ -75,7 +76,7 @@ public class ProtocalXinaoV1 implements Iprotocal {
|
||||||
if(ObjectUtil.isEmpty(sensorInfo.getMtime())){
|
if(ObjectUtil.isEmpty(sensorInfo.getMtime())){
|
||||||
sensorInfo.setMtime(new Date());
|
sensorInfo.setMtime(new Date());
|
||||||
}
|
}
|
||||||
LOGGER.debug("get IotSensorInfoBO from list {}", sensorInfo.toString());
|
LogUtil4j.debugLogger.debug("get IotSensorInfoBO from list {}", sensorInfo.toString());
|
||||||
// 传感器处理
|
// 传感器处理
|
||||||
IotSensorInfoServiceImpl app = (IotSensorInfoServiceImpl) SpringApplicationContext.getBean("iotSensorInfoServiceImpl") ;
|
IotSensorInfoServiceImpl app = (IotSensorInfoServiceImpl) SpringApplicationContext.getBean("iotSensorInfoServiceImpl") ;
|
||||||
app.updateRealTimeData(sensorInfo) ;
|
app.updateRealTimeData(sensorInfo) ;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.lp.cache.CacheName;
|
||||||
import com.lp.cache.ProCacheUtil;
|
import com.lp.cache.ProCacheUtil;
|
||||||
import com.lp.common.Code;
|
import com.lp.common.Code;
|
||||||
import com.lp.service.IotHistorySensorDataService;
|
import com.lp.service.IotHistorySensorDataService;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -23,7 +24,7 @@ public class IotHistorySensorDataServiceImpl extends BaseServiceImpl implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getHistorySensorData(IotHistorySensorDataBO obj) {
|
public Map<String, Object> getHistorySensorData(IotHistorySensorDataBO obj) {
|
||||||
LOGGER.debug("getHistorySensorData is called with IotHistorySensorDataBO({})", obj);
|
LogUtil4j.debugLogger.debug("getHistorySensorData is called with IotHistorySensorDataBO({})", obj);
|
||||||
Map<String, Object> resultMap = getResultMap();
|
Map<String, Object> resultMap = getResultMap();
|
||||||
try{
|
try{
|
||||||
List<IotSensorInfoBO> list = new ArrayList<>();
|
List<IotSensorInfoBO> list = new ArrayList<>();
|
||||||
|
|
@ -45,7 +46,7 @@ public class IotHistorySensorDataServiceImpl extends BaseServiceImpl implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resultMap.put("totalPage", max);
|
resultMap.put("totalPage", max);
|
||||||
LOGGER.debug("getHistorySensorData is called get res: ({}) items, with ids: ({})", list.size(), obj.getIds());
|
LogUtil4j.debugLogger.debug("getHistorySensorData is called get res: ({}) items, with ids: ({})", list.size(), obj.getIds());
|
||||||
putData(resultMap, list);
|
putData(resultMap, list);
|
||||||
}else{
|
}else{
|
||||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR) ;
|
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR) ;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,5 @@
|
||||||
package com.lp.service.impl;
|
package com.lp.service.impl;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import com.lp.bo.IotImportNodeInfoBO;
|
import com.lp.bo.IotImportNodeInfoBO;
|
||||||
import com.lp.bo.IotNodeInfoBO;
|
import com.lp.bo.IotNodeInfoBO;
|
||||||
import com.lp.bo.IotSensorInfoBO;
|
import com.lp.bo.IotSensorInfoBO;
|
||||||
|
|
@ -21,10 +12,11 @@ import com.lp.common.CodeIot;
|
||||||
import com.lp.common.Constants;
|
import com.lp.common.Constants;
|
||||||
import com.lp.mqtt.MqttService;
|
import com.lp.mqtt.MqttService;
|
||||||
import com.lp.service.IotNodeInfoService;
|
import com.lp.service.IotNodeInfoService;
|
||||||
import com.lp.util.ExcelUtil;
|
import com.lp.util.*;
|
||||||
import com.lp.util.LogUtil;
|
import org.springframework.stereotype.Service;
|
||||||
import com.lp.util.ObjectUtil;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.lp.util.QRCodeUtil;
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class IotNodeInfoServerImpl extends BaseServiceImpl implements IotNodeInfoService {
|
public class IotNodeInfoServerImpl extends BaseServiceImpl implements IotNodeInfoService {
|
||||||
|
|
@ -155,6 +147,8 @@ public class IotNodeInfoServerImpl extends BaseServiceImpl implements IotNodeInf
|
||||||
int re = dao.insert("IotSensorInfo.insert", sensor) ;
|
int re = dao.insert("IotSensorInfo.insert", sensor) ;
|
||||||
if(re>0){
|
if(re>0){
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO, sensor.getId().toString(), sensor);
|
ProCacheUtil.addCache(CacheName.SENSORINFO, sensor.getId().toString(), sensor);
|
||||||
|
LogUtil4j.debugLogger.debug("add cache {}---{}", CacheName.SENSORINFO_NSP
|
||||||
|
, sensor.getNode_id()+"-"+sensor.getSensor_device_id()+"-"+sensor.getPort_id());
|
||||||
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, sensor.getNode_id()+"-"+
|
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP, sensor.getNode_id()+"-"+
|
||||||
sensor.getSensor_device_id()+"-"+sensor.getPort_id(), sensor);
|
sensor.getSensor_device_id()+"-"+sensor.getPort_id(), sensor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import com.lp.common.CodeIot;
|
||||||
import com.lp.service.IotSensorInfoService;
|
import com.lp.service.IotSensorInfoService;
|
||||||
import com.lp.util.Calculator;
|
import com.lp.util.Calculator;
|
||||||
import com.lp.util.DateUtils;
|
import com.lp.util.DateUtils;
|
||||||
|
import com.lp.util.LogUtil4j;
|
||||||
import com.lp.util.ObjectUtil;
|
import com.lp.util.ObjectUtil;
|
||||||
import com.lp.util.iot.IotTrigger;
|
import com.lp.util.iot.IotTrigger;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -25,32 +26,35 @@ import java.util.Map;
|
||||||
public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSensorInfoService {
|
public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSensorInfoService {
|
||||||
|
|
||||||
protected final static Logger LOGGER = LoggerFactory.getLogger(IotSensorInfoServiceImpl.class);
|
protected final static Logger LOGGER = LoggerFactory.getLogger(IotSensorInfoServiceImpl.class);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> updateRealTimeData(IotSensorInfoBO obj) {
|
public Map<String, Object> updateRealTimeData(IotSensorInfoBO obj) {
|
||||||
LOGGER.debug("updateRealTimeData is called with {}", obj);
|
LogUtil4j.debugLogger.debug("updateRealTimeData is called with ({}---{}---{})"
|
||||||
|
, obj.getDevice_code() + "-" + obj.getSensor_device_id(), obj.getPort_id(), obj.getRequest_sdata());
|
||||||
Map<String, Object> resultMap = getResultMap();
|
Map<String, Object> resultMap = getResultMap();
|
||||||
try{
|
try{
|
||||||
// 通过网关缓存 deviceCode -> nodeInfo -> id (or nodeId)
|
// 通过网关缓存 deviceCode -> nodeInfo -> id (or nodeId)
|
||||||
IotNodeInfoBO iotNodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code());
|
IotNodeInfoBO iotNodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code());
|
||||||
|
|
||||||
if(ObjectUtil.isEmpty(iotNodeInfo)){
|
if(ObjectUtil.isEmpty(iotNodeInfo)){
|
||||||
LOGGER.warn("updateRealTimeData is called with {} no IotNodeInfoBO", obj);
|
LogUtil4j.debugLogger.warn("updateRealTimeData is called with {} no IotNodeInfoBO", obj.getDevice_code());
|
||||||
// 这个设备已经离线了;返回错误,让用户重新登录;
|
// 这个设备已经离线了;返回错误,让用户重新登录;
|
||||||
putStatusCode(resultMap, CodeIot.DEVICE_STATUS.OFFLINE);
|
putStatusCode(resultMap, CodeIot.DEVICE_STATUS.OFFLINE);
|
||||||
// 服务端发送重新登录的命令
|
// 服务端发送重新登录的命令
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ObjectUtil.isEmpty(iotNodeInfo.getIot_node_status()) || iotNodeInfo.getIot_node_status() != 16 ){
|
IotNodeInfoBO tmpnode = dao.selectOne("IotNodeInfo.selectOne", iotNodeInfo);
|
||||||
|
|
||||||
|
if( ObjectUtil.isEmpty(iotNodeInfo.getIot_node_status()) || iotNodeInfo.getIot_node_status() != 16
|
||||||
|
|| ObjectUtil.isEmpty(tmpnode.getIot_node_status()) || tmpnode.getIot_node_status() != CodeIot.DEVICE_STATUS.ONLINE){
|
||||||
// 缓存在线
|
// 缓存在线
|
||||||
iotNodeInfo.setIot_node_status(CodeIot.DEVICE_STATUS.ONLINE);
|
iotNodeInfo.setIot_node_status(CodeIot.DEVICE_STATUS.ONLINE);
|
||||||
iotNodeInfo.setMtime(new Date());
|
iotNodeInfo.setMtime(new Date());
|
||||||
|
LogUtil4j.debugLogger.warn("iotNodeInfo({}) is offline, will online", iotNodeInfo.getDevice_code());
|
||||||
// 如果设备不在线,则让设备在线
|
// 如果设备不在线,则让设备在线
|
||||||
dao.update("IotNodeInfo.updateNodeStatus", iotNodeInfo);
|
dao.update("IotNodeInfo.updateNodeStatus", iotNodeInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -58,17 +62,18 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
// 网关没有项目信息
|
// 网关没有项目信息
|
||||||
IotSceneInfoBO sceneBo = ProCacheUtil.getCache(CacheName.SCENEINFO, iotNodeInfo.getScene_id().toString() );
|
IotSceneInfoBO sceneBo = ProCacheUtil.getCache(CacheName.SCENEINFO, iotNodeInfo.getScene_id().toString() );
|
||||||
if(ObjectUtil.isEmpty(sceneBo)){
|
if(ObjectUtil.isEmpty(sceneBo)){
|
||||||
LOGGER.warn("updateRealTimeData is called with {} no IotSceneInfoBO", obj);
|
LogUtil4j.debugLogger.warn("updateRealTimeData is called with {} no IotSceneInfoBO", obj);
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.setNode_name(iotNodeInfo.getName());
|
obj.setNode_name(iotNodeInfo.getName());
|
||||||
obj.setNode_id( iotNodeInfo.getId() );
|
obj.setNode_id( iotNodeInfo.getId() );
|
||||||
|
LogUtil4j.debugLogger.debug("get sensorinfo with key: {}", obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id());
|
||||||
// 获取传感器缓存信息
|
// 获取传感器缓存信息
|
||||||
IotSensorInfoBO sensorInfo = ProCacheUtil.getCache(CacheName.SENSORINFO_NSP, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
IotSensorInfoBO sensorInfo = ProCacheUtil.getCache(CacheName.SENSORINFO_NSP, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
||||||
|
|
||||||
if( ObjectUtil.isEmpty(sensorInfo) ){
|
if( ObjectUtil.isEmpty(sensorInfo) ){
|
||||||
LOGGER.warn("updateRealTimeData is called with {} no IotSensorInfoBO", obj);
|
LOGGER.warn("updateRealTimeData is called with {} no IotSensorInfoBO", obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id());
|
||||||
// 不存在的数据
|
// 不存在的数据
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +81,7 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
|
|
||||||
// 这边判断如果是经纬度的传感器信息,则需要更新网关信息的经纬度数据
|
// 这边判断如果是经纬度的传感器信息,则需要更新网关信息的经纬度数据
|
||||||
if( sensorInfo.getIot_sensor_type()!=null && sensorInfo.getIot_sensor_type() == CodeIot.SENSOR_TYPE.POSITION +0 ){
|
if( sensorInfo.getIot_sensor_type()!=null && sensorInfo.getIot_sensor_type() == CodeIot.SENSOR_TYPE.POSITION +0 ){
|
||||||
iotNodeInfo.setLonLat( obj.getStr_sdata() );
|
iotNodeInfo.setLonLat( obj.getStr_sdata());
|
||||||
dao.update("IotNodeInfo.update", iotNodeInfo) ;
|
dao.update("IotNodeInfo.update", iotNodeInfo) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +101,7 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
obj.setSdata(ft);
|
obj.setSdata(ft);
|
||||||
obj.setRequest_sdata(obj.getSdata());
|
obj.setRequest_sdata(obj.getSdata());
|
||||||
}
|
}
|
||||||
LOGGER.debug("updateRealTimeData is called with {} with {}", obj, sensorInfo);
|
// LogUtil4j.debugLogger.debug("updateRealTimeData is called with {} with {}", obj.getDevice_code(), sensorInfo.getSensor_device_id());
|
||||||
//*** 20190405 如果是配置数据,则直接更新数据库,并更新缓存,数据不进入历史表里面
|
//*** 20190405 如果是配置数据,则直接更新数据库,并更新缓存,数据不进入历史表里面
|
||||||
if( sensorInfo.getData_type() == 1 ){
|
if( sensorInfo.getData_type() == 1 ){
|
||||||
|
|
||||||
|
|
@ -126,6 +131,8 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
// 设置传感器id
|
// 设置传感器id
|
||||||
obj.setId(sensorInfo.getId());
|
obj.setId(sensorInfo.getId());
|
||||||
Integer num = dao.update("IotSensorInfo.updateRealTimeData_byid", obj);
|
Integer num = dao.update("IotSensorInfo.updateRealTimeData_byid", obj);
|
||||||
|
LogUtil4j.debugLogger.debug("IotSensorInfo.updateRealTimeData_byid is call with {}---{}---{}({})"
|
||||||
|
, obj.getSensor_device_id(), obj.getPort_id(), obj.getSdata(), num);
|
||||||
if(num > 0 ){
|
if(num > 0 ){
|
||||||
// 传感器数据更新成功
|
// 传感器数据更新成功
|
||||||
IotSensorInfoBO sensor = ProCacheUtil.getCache(CacheName.SENSORINFO, sensorInfo.getId().toString() );
|
IotSensorInfoBO sensor = ProCacheUtil.getCache(CacheName.SENSORINFO, sensorInfo.getId().toString() );
|
||||||
|
|
@ -137,7 +144,7 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
iotSensorHistory.setSensor_id(sensor.getId());
|
iotSensorHistory.setSensor_id(sensor.getId());
|
||||||
iotSensorHistory.setSdata(obj.getStr_sdata());
|
iotSensorHistory.setSdata(obj.getStr_sdata());
|
||||||
iotSensorHistory.setAtime(obj.getMtime());
|
iotSensorHistory.setAtime(obj.getMtime());
|
||||||
LOGGER.debug("updateRealTimeData is called with {} insert IotHistorySensorData with {}", obj, iotSensorHistory);
|
LogUtil4j.debugLogger.debug("updateRealTimeData is called with {} insert IotHistorySensorData with {}", obj, iotSensorHistory);
|
||||||
dao.insert("IotHistorySensorData.insert", iotSensorHistory);
|
dao.insert("IotHistorySensorData.insert", iotSensorHistory);
|
||||||
}
|
}
|
||||||
sensor.setStr_sdata( obj.getStr_sdata() );
|
sensor.setStr_sdata( obj.getStr_sdata() );
|
||||||
|
|
@ -145,16 +152,19 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
else{
|
else{
|
||||||
// 正常行 sdata
|
// 正常行 sdata
|
||||||
if(sensor.getSdata() == null ){
|
if(sensor.getSdata() == null ){
|
||||||
|
LogUtil4j.debugLogger.debug("IotSensorInfoBO{} without sdata", sensor.getDevice_code() + "-" + sensor.getSensor_device_id());
|
||||||
sensor.setSdata(-11111f);
|
sensor.setSdata(-11111f);
|
||||||
}
|
}
|
||||||
if( sensorDataStratety(obj.getSdata() ,sensor.getSdata() ,sensor) ){
|
LogUtil4j.debugLogger.debug("sensor({}) check change with ({}), ({})"
|
||||||
|
, sensor.getSensor_device_id(), obj.getSdata() ,sensor.getSdata());
|
||||||
|
if( sensorDataStratety(sensor.getSdata(), obj.getSdata(), sensor) ){
|
||||||
// 添加历史数据。目前只添加变化的历史数据
|
// 添加历史数据。目前只添加变化的历史数据
|
||||||
IotHistorySensorData iotSensorHistory = new IotHistorySensorData();
|
IotHistorySensorData iotSensorHistory = new IotHistorySensorData();
|
||||||
iotSensorHistory.setSensor_id(sensor.getId());
|
iotSensorHistory.setSensor_id(sensor.getId());
|
||||||
iotSensorHistory.setSdata(obj.getSdata().toString());
|
iotSensorHistory.setSdata(obj.getSdata().toString());
|
||||||
iotSensorHistory.setAtime(obj.getMtime());
|
iotSensorHistory.setAtime(obj.getMtime());
|
||||||
LOGGER.debug("updateRealTimeData is called with {} insert IotHistorySensorData with {}", obj, iotSensorHistory);
|
num = dao.insert("IotHistorySensorData.insert", iotSensorHistory);
|
||||||
dao.insert("IotHistorySensorData.insert", iotSensorHistory);
|
LogUtil4j.debugLogger.debug("IotHistorySensorData.insert with ({})", iotSensorHistory);
|
||||||
}
|
}
|
||||||
sensor.setSdata(obj.getSdata());
|
sensor.setSdata(obj.getSdata());
|
||||||
sensor.setRequest_sdata(obj.getRequest_sdata());
|
sensor.setRequest_sdata(obj.getRequest_sdata());
|
||||||
|
|
@ -171,6 +181,7 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean sensorDataStratety(Object oldvalue , Object newValue ,IotSensorInfoBO sensor ){
|
private Boolean sensorDataStratety(Object oldvalue , Object newValue ,IotSensorInfoBO sensor ){
|
||||||
|
|
||||||
if( ObjectUtil.isEmpty(sensor.getStoreTime() ) ){
|
if( ObjectUtil.isEmpty(sensor.getStoreTime() ) ){
|
||||||
sensor.setStoreTime(new Date());
|
sensor.setStoreTime(new Date());
|
||||||
}
|
}
|
||||||
|
|
@ -228,6 +239,10 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
||||||
if(flag){
|
if(flag){
|
||||||
sensor.setStoreTime(new Date());
|
sensor.setStoreTime(new Date());
|
||||||
}
|
}
|
||||||
|
LogUtil4j.debugLogger.debug("called with {} ret: {}"
|
||||||
|
, sensor.getSensor_device_id() + "-" + sensor.getPort_id() + "-" + sensor.getStore_strage()
|
||||||
|
+ "-" + sensor.getStoreTime() + ":" + oldvalue + "-" + newValue, flag);
|
||||||
|
|
||||||
return flag ;
|
return flag ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
package com.lp.util;
|
package com.lp.util;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.management.ManagementFactory;
|
|
||||||
import java.lang.management.RuntimeMXBean;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.codehaus.jackson.JsonGenerationException;
|
import org.codehaus.jackson.JsonGenerationException;
|
||||||
import org.codehaus.jackson.map.JsonMappingException;
|
import org.codehaus.jackson.map.JsonMappingException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.lang.management.RuntimeMXBean;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class LogUtil{
|
public class LogUtil{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ public class QRCodeUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void encode(String content, String imgPath, String destPath, boolean needCompress,String fileName) throws Exception {
|
public static void encode(String content, String imgPath, String destPath, boolean needCompress,String fileName) throws Exception {
|
||||||
LOGGER.debug("{} encode is called with {}---{}---{}---{}"
|
LogUtil4j.debugLogger.debug("{} encode is called with {}---{}---{}---{}"
|
||||||
, QRCodeUtil.class, content, imgPath, destPath, fileName);
|
, QRCodeUtil.class, content, imgPath, destPath, fileName);
|
||||||
BufferedImage image = QRCodeUtil.createImage(content, imgPath, needCompress);
|
BufferedImage image = QRCodeUtil.createImage(content, imgPath, needCompress);
|
||||||
mkdirs(destPath);
|
mkdirs(destPath);
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public class IotTrigger {
|
||||||
// trigger 不能为空
|
// trigger 不能为空
|
||||||
if( iotSensorInfoBo!=null && ObjectUtil.isNotEmpty(iotSensorInfoBo.getTriggerList()) && ObjectUtil.isNotEmpty(obj.getSdata()) ){
|
if( iotSensorInfoBo!=null && ObjectUtil.isNotEmpty(iotSensorInfoBo.getTriggerList()) && ObjectUtil.isNotEmpty(obj.getSdata()) ){
|
||||||
List<IotTriggerInfoBO> triggerList = iotSensorInfoBo.getTriggerList();
|
List<IotTriggerInfoBO> triggerList = iotSensorInfoBo.getTriggerList();
|
||||||
|
LogUtil4j.debugLogger.debug("will trigger with sensor:({}---{}) with ({})triggers"
|
||||||
|
, obj.getDevice_code(), sensorDevicePort, triggerList.size());
|
||||||
for( IotTriggerInfoBO trigger : triggerList ){
|
for( IotTriggerInfoBO trigger : triggerList ){
|
||||||
Boolean trigger_flag = false;
|
Boolean trigger_flag = false;
|
||||||
String message ="" ;
|
String message ="" ;
|
||||||
|
|
@ -523,6 +525,8 @@ public class IotTrigger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LogUtil4j.debugLogger.debug("sensor:({}---{}) trigger with ({})"
|
||||||
|
, obj.getDevice_code(), sensorDevicePort, exception_flag);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
LogUtil.errorLog(e);
|
LogUtil.errorLog(e);
|
||||||
return -1 ;
|
return -1 ;
|
||||||
|
|
@ -885,7 +889,7 @@ public class IotTrigger {
|
||||||
return "" ;
|
return "" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.debug("sendWechat is called with IotSensorInfoBO({})---IotTriggerInfoBO({})---BussinessTriggerBO({})---BaseDao({})---flag({})"
|
LogUtil4j.debugLogger.debug("sendWechat is called with IotSensorInfoBO({})---IotTriggerInfoBO({})---BussinessTriggerBO({})---BaseDao({})---flag({})"
|
||||||
, param, trigger, message, dao, flag);
|
, param, trigger, message, dao, flag);
|
||||||
// 将string 转json
|
// 将string 转json
|
||||||
ContactorBO contactor = JSON.parseObject(trigger.getAction_params(), ContactorBO.class);
|
ContactorBO contactor = JSON.parseObject(trigger.getAction_params(), ContactorBO.class);
|
||||||
|
|
@ -942,7 +946,7 @@ public class IotTrigger {
|
||||||
// wxTemplate.setTemplateId(ProConfig.WEIXIN.NOTICE_2);
|
// wxTemplate.setTemplateId(ProConfig.WEIXIN.NOTICE_2);
|
||||||
try {
|
try {
|
||||||
String ret = wxMpserver.templateSend(wxTemplate);
|
String ret = wxMpserver.templateSend(wxTemplate);
|
||||||
LOGGER.debug("wxMpserver.templateSend is called {} res: ({})", wxTemplate, ret);
|
LogUtil4j.debugLogger.debug("wxMpserver.templateSend is called {} res: ({})", wxTemplate, ret);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("wxMpserver.templateSend", e);
|
LOGGER.error("wxMpserver.templateSend", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,19 @@ jdbc.maxActive=200
|
||||||
jdbc.maxWait=500
|
jdbc.maxWait=500
|
||||||
jdbc.defaultAutoCommit=true
|
jdbc.defaultAutoCommit=true
|
||||||
|
|
||||||
jdbc.url=jdbc:mysql://192.168.3.5:35007/easyiot?characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
#\u6D4B\u8BD5 1
|
||||||
|
#jdbc.url=jdbc:mysql://192.168.3.5:35007/easyiot?characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||||
|
|
||||||
|
#\u6D4B\u8BD5 2
|
||||||
|
#jdbc.url=jdbc:mysql://192.168.1.222:3306/easyiot?characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||||
|
|
||||||
jdbc.username=easyiot
|
jdbc.username=easyiot
|
||||||
jdbc.password=easyiot
|
|
||||||
|
# \u6D4B\u8BD5 1
|
||||||
|
#jdbc.password=easyiot
|
||||||
|
|
||||||
|
#\u6D4B\u8BD5 2
|
||||||
|
#jdbc.password=nnSf2aySKrt7xe6z
|
||||||
|
|
||||||
#\u8FDE\u63A5\u521D\u59CB\u503C\uFF0C\u8FDE\u63A5\u6C60\u542F\u52A8\u65F6\u521B\u5EFA\u7684\u8FDE\u63A5\u6570\u91CF\u7684\u521D\u59CB\u503C \u9ED8\u8BA4\u503C\u662F0
|
#\u8FDE\u63A5\u521D\u59CB\u503C\uFF0C\u8FDE\u63A5\u6C60\u542F\u52A8\u65F6\u521B\u5EFA\u7684\u8FDE\u63A5\u6570\u91CF\u7684\u521D\u59CB\u503C \u9ED8\u8BA4\u503C\u662F0
|
||||||
jdbc.initialSize=10
|
jdbc.initialSize=10
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
|
mqtt.clientId=iot_platform_hy
|
||||||
mqtt.username=yinzy
|
mqtt.username=yinzy
|
||||||
mqtt.password=yzy123456
|
mqtt.password=yzy123456
|
||||||
mqtt.cleanSession=true
|
mqtt.cleanSession=false
|
||||||
|
mqtt.autoReconnect=true
|
||||||
|
mqtt.keepalive=3600
|
||||||
|
mqtt.timeout=30
|
||||||
mqtt.serverURI1=tcp://192.168.3.5:35883
|
mqtt.serverURI1=tcp://192.168.3.5:35883
|
||||||
mqtt.clientId=iot_platform_1
|
mqtt.simpleURI=wss://iot.hy-ec.cn/mqtt
|
||||||
mqtt.service.topic=/dev/coo/+,/edge/+,/sys/update/+
|
mqtt.service.topic=/dev/coo/+,/edge/+,/sys/update/+
|
||||||
|
|
@ -2,19 +2,23 @@
|
||||||
|
|
||||||
#mp \u516C\u4F17\u53F7\u914D\u7F6E
|
#mp \u516C\u4F17\u53F7\u914D\u7F6E
|
||||||
#weixin.mp.appid=wxcda55f09127119f9
|
#weixin.mp.appid=wxcda55f09127119f9
|
||||||
weixin.mp.appid=wxff7e4d874e52241a
|
#weixin.mp.appid=wxff7e4d874e52241a
|
||||||
weixin.mp.secret=acb909da964498dc9b1b76c1031aaca9
|
#weixin.mp.appid=wx00b6998a595762a0
|
||||||
#weixin.mp.secret=f126999b83b902b697aaee8c7128839c
|
#weixin.mp.secret=f126999b83b902b697aaee8c7128839c
|
||||||
|
#weixin.mp.secret=acb909da964498dc9b1b76c1031aaca9
|
||||||
|
#weixin.mp.secret=c6700a2962dae167ef4dac3b9494357e
|
||||||
weixin.mp.token=iotadmin
|
weixin.mp.token=iotadmin
|
||||||
#weixin.mp.aesKey=71AJPXUTBFje7YctbndixEoNrUfQxyHH56EWoRlY8Cd
|
#weixin.mp.aesKey=71AJPXUTBFje7YctbndixEoNrUfQxyHH56EWoRlY8Cd
|
||||||
weixin.mp.aesKey=7MhltzJjl4J7E9YbY5lk3azXBx4LmuZX9Cl7lkLyaH5
|
#weixin.mp.aesKey=7MhltzJjl4J7E9YbY5lk3azXBx4LmuZX9Cl7lkLyaH5
|
||||||
|
#weixin.mp.aesKey=o0EXvGbPWG4F24WiibiiUw0Sn7su3FrOfOjNg9i3JFL
|
||||||
|
|
||||||
#mch \u5546\u6237 \u4FE1\u606F
|
#mch \u5546\u6237 \u4FE1\u606F
|
||||||
weixin.mp.mch.id=1523933151
|
weixin.mp.mch.id=1523933151
|
||||||
weixin.mp.mch.key=
|
weixin.mp.mch.key=
|
||||||
|
|
||||||
#\u8BF7\u6C42URL
|
#\u8BF7\u6C42URL
|
||||||
local.domain=http://iotadmin.segsvip.com
|
#local.domain=https://iotadmin.segsvip.com
|
||||||
|
#local.domain=https://iot.hy-ec.cn
|
||||||
#
|
#
|
||||||
# local.domain=http://127.0.0.1:8080/lpro
|
# local.domain=http://127.0.0.1:8080/lpro
|
||||||
|
|
||||||
|
|
@ -26,8 +30,8 @@ weixin.mp.oauth2.redirect_uri=/service/oauth2/authorize/weixin/mp
|
||||||
|
|
||||||
#----------------------\u5FAE\u4FE1\u6D88\u606F\u6A21\u677F\u53F7----------------------------
|
#----------------------\u5FAE\u4FE1\u6D88\u606F\u6A21\u677F\u53F7----------------------------
|
||||||
weixin.msg.tpl.NOTICE_1=2xuSdxuFrfJidejIEYSVA7nXDC0PYU2bwow0Gm90pnU
|
weixin.msg.tpl.NOTICE_1=2xuSdxuFrfJidejIEYSVA7nXDC0PYU2bwow0Gm90pnU
|
||||||
weixin.msg.tpl.NOTICE_2=2xuSdxuFrfJidejIEYSVA7nXDC0PYU2bwow0Gm90pnU
|
weixin.msg.tpl.NOTICE_2=hjtAb8aVxzsC6c-ZpuZ47F3AC-2txpUxHOrUdewsCPU
|
||||||
weixin.msg.tpl.NOTICE_3=hjtAb8aVxzsC6c-ZpuZ47F3AC-2txpUxHOrUdewsCPU
|
weixin.msg.tpl.NOTICE_3=JyO2orI0NMHU2wVfNnHP0jeiaR1XXLJXDJ3snNpwa9U
|
||||||
weixin.msg.tpl.NOTICE_4=
|
weixin.msg.tpl.NOTICE_4=
|
||||||
weixin.msg.tpl.NOTICE_5=
|
weixin.msg.tpl.NOTICE_5=
|
||||||
weixin.msg.tpl.NOTICE_6=
|
weixin.msg.tpl.NOTICE_6=
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ log4j.appender.Threshold=DEBUG
|
||||||
|
|
||||||
|
|
||||||
#JDBC config
|
#JDBC config
|
||||||
log4j.logger.com.mybatis=DEBUG
|
log4j.logger.com.mybatis=OFF
|
||||||
log4j.logger.com.mybatis.common.jdbc.SimpleDataSource=OFF
|
log4j.logger.com.mybatis.common.jdbc.SimpleDataSource=OFF
|
||||||
log4j.logger.com.mybatis.common.jdbc.ScriptRunner=OFF
|
log4j.logger.com.mybatis.common.jdbc.ScriptRunner=OFF
|
||||||
log4j.logger.com.mybatis.sqlmap.engine.impl.SqlMapClientDelegate=OFF
|
log4j.logger.com.mybatis.sqlmap.engine.impl.SqlMapClientDelegate=OFF
|
||||||
|
|
@ -56,15 +56,34 @@ log4j.appender.LOG_FILE.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.LOG_FILE.layout.ConversionPattern=%d %p [%t] %C.%M(%F:%L) - %m%n
|
log4j.appender.LOG_FILE.layout.ConversionPattern=%d %p [%t] %C.%M(%F:%L) - %m%n
|
||||||
|
|
||||||
|
|
||||||
|
# SQL\u65E5\u5FD7
|
||||||
|
log4j.logger.sql=DEBUG,sql
|
||||||
|
log4j.appender.sql=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.sql.File=/data/lpro/logs/sql.log
|
||||||
|
log4j.appender.sql.DatePattern='_'yyyy-MM-dd'.log'
|
||||||
|
log4j.appender.sql.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.sql.layout.ConversionPattern=%d %p [%c %L %l] - %m%n
|
||||||
|
log4j.additivity.sql=false
|
||||||
|
|
||||||
#\u5176\u4ED6\u884C\u4E3A\u7684\u65E5\u5FD7\u6587\u4EF6\uFF0C\u5982\u652F\u4ED8\u8BB0\u5F55\u7B49
|
#\u5176\u4ED6\u884C\u4E3A\u7684\u65E5\u5FD7\u6587\u4EF6\uFF0C\u5982\u652F\u4ED8\u8BB0\u5F55\u7B49
|
||||||
log4j.logger.other=INFO,other
|
log4j.logger.other=DEBUG,other
|
||||||
log4j.appender.other=org.apache.log4j.DailyRollingFileAppender
|
log4j.appender.other=org.apache.log4j.DailyRollingFileAppender
|
||||||
log4j.appender.other.File=/data/lpro/logs/other.log
|
log4j.appender.other.File=/data/lpro/logs/other.log
|
||||||
log4j.appender.other.DatePattern='_'yyyy-MM-dd'.log'
|
log4j.appender.other.DatePattern='_'yyyy-MM-dd'.log'
|
||||||
log4j.appender.other.layout=org.apache.log4j.PatternLayout
|
log4j.appender.other.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.other.layout.ConversionPattern=%d %p [%c %L %l] - %m%n
|
log4j.appender.other.layout.ConversionPattern=%d %p %C.%M(%F:%L) - %m%n
|
||||||
log4j.additivity.other=true
|
log4j.additivity.other=false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#\u5176\u4ED6\u884C\u4E3A\u7684\u65E5\u5FD7\u6587\u4EF6\uFF0C\u5982\u652F\u4ED8\u8BB0\u5F55\u7B49
|
||||||
|
log4j.logger.debug=DEBUG, debug
|
||||||
|
log4j.appender.debug=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.debug.File=/data/lpro/logs/debug.log
|
||||||
|
log4j.appender.debug.DatePattern='_'yyyy-MM-dd'.log'
|
||||||
|
log4j.appender.debug.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.debug.layout.ConversionPattern=%d %p %C.%M(%F:%L) - %m%n
|
||||||
|
log4j.additivity.debug=false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@
|
||||||
var base_domain="http://"+window.location.host+"<%=basePath%>";
|
var base_domain="http://"+window.location.host+"<%=basePath%>";
|
||||||
var userKey= "${user.user_key}";
|
var userKey= "${user.user_key}";
|
||||||
var websocket_url = 'ws://' + window.location.host + '<%=ProConfig.PROJECT_NAME%>/service/websocket';
|
var websocket_url = 'ws://' + window.location.host + '<%=ProConfig.PROJECT_NAME%>/service/websocket';
|
||||||
|
var mqttUserName = '<%=ProConfig.MQTT.USERNAME%>'
|
||||||
|
var mqttPassword = '<%=ProConfig.MQTT.PASSWORD%>'
|
||||||
|
var mqttUrl = '<%=ProConfig.MQTT.MQTTSIMPLEURI%>';
|
||||||
var videoUrl = "<%=ProConfig.VIDEO_DOMAIN%>";
|
var videoUrl = "<%=ProConfig.VIDEO_DOMAIN%>";
|
||||||
var status_code = {
|
var status_code = {
|
||||||
'OK' : <%=Code.ResponseCode.SystemCode.OK%> ,
|
'OK' : <%=Code.ResponseCode.SystemCode.OK%> ,
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@
|
||||||
username: '<%=ProConfig.MQTT.USERNAME%>',
|
username: '<%=ProConfig.MQTT.USERNAME%>',
|
||||||
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
||||||
}
|
}
|
||||||
client = mqtt.connect('ws://221.195.106.155:35884/mqtt', options) ;
|
client = mqtt.connect('<%=ProConfig.MQTT.MQTTSIMPLEURI%>', options) ;
|
||||||
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
||||||
client.on('reconnect', function(error) {
|
client.on('reconnect', function(error) {
|
||||||
$("#init-table").tableAdaptor( $(".curr").html() );
|
$("#init-table").tableAdaptor( $(".curr").html() );
|
||||||
|
|
|
||||||
|
|
@ -373,9 +373,13 @@ function searchDeviceInfo(dataParam){
|
||||||
if(isOK(data)){
|
if(isOK(data)){
|
||||||
var dataObj = data.data ;
|
var dataObj = data.data ;
|
||||||
for(var i=0; i <dataObj.length;i++){
|
for(var i=0; i <dataObj.length;i++){
|
||||||
$(".sceneList-info").append($("#template0").html().format( dataObj[i].name ,
|
$(".sceneList-info").append($("#template0").html().format(
|
||||||
|
dataObj[i].name,
|
||||||
nodeStatusInfo(dataObj[i].iot_node_status ,dataObj[i].iot_node_status) ,
|
nodeStatusInfo(dataObj[i].iot_node_status ,dataObj[i].iot_node_status) ,
|
||||||
dataObj[i].device_code, getSensorListHtml( dataObj[i].iotSensorList, dataParam.scene_id ,dataObj[i].iot_node_status ) ,dataObj[i].id ) );
|
dataObj[i].device_code,
|
||||||
|
getSensorListHtml( dataObj[i].iotSensorList, dataParam.scene_id ,dataObj[i].iot_node_status ) ,
|
||||||
|
dataObj[i].id
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -386,7 +390,7 @@ function getSensorListHtml(dataT,sid , node_status){
|
||||||
var src1 = 'src="<%=sensorImg%>/on.png"';
|
var src1 = 'src="<%=sensorImg%>/on.png"';
|
||||||
var src2 = 'src="<%=sensorImg%>/off.png"';
|
var src2 = 'src="<%=sensorImg%>/off.png"';
|
||||||
// console.log(dataT);
|
// console.log(dataT);
|
||||||
console.log("monitor getSensorListHtml with %s, %o", sid, dataT);
|
console.log("monitor getSensorListHtml with %s, %o, %s", sid, dataT, node_status);
|
||||||
for(var i=0;i<dataT.length;i++){
|
for(var i=0;i<dataT.length;i++){
|
||||||
// 传感器logo数据
|
// 传感器logo数据
|
||||||
var sensorLogo = dataT[i].measure_unit_type ;
|
var sensorLogo = dataT[i].measure_unit_type ;
|
||||||
|
|
@ -483,9 +487,9 @@ function getMoreSwitch(data,dataType,sensor_id){
|
||||||
|
|
||||||
function nodeStatusInfo(code,value){
|
function nodeStatusInfo(code,value){
|
||||||
if(code == 16){
|
if(code == 16){
|
||||||
return "<span class='blue-span'>"+value+"</span>" ;
|
return "<span class='blue-span'>"+'在线'+"</span>" ;
|
||||||
}else{
|
}else{
|
||||||
return "<span class='red-span'>"+value+"</span>" ;
|
return "<span class='red-span'>"+'离线'+"</span>" ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -550,8 +554,9 @@ function mqttInit(){
|
||||||
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
||||||
}
|
}
|
||||||
// client = mqtt.connect('ws://'+document.domain+':35883', options) ;
|
// client = mqtt.connect('ws://'+document.domain+':35883', options) ;
|
||||||
client = mqtt.connect('ws://221.195.106.155:35884/mqtt', options) ;
|
client = mqtt.connect('<%=ProConfig.MQTT.MQTTSIMPLEURI%>', options) ;
|
||||||
client.on('reconnect', function(error) {
|
client.on('reconnect', function(error) {
|
||||||
|
console.log('mqtt reconnect')
|
||||||
reflash( $(".dashboard-menu li.active").attr("sid"));
|
reflash( $(".dashboard-menu li.active").attr("sid"));
|
||||||
})
|
})
|
||||||
client.on('error', function(error) {
|
client.on('error', function(error) {
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@
|
||||||
username: '<%=ProConfig.MQTT.USERNAME%>',
|
username: '<%=ProConfig.MQTT.USERNAME%>',
|
||||||
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
||||||
}
|
}
|
||||||
client = mqtt.connect('ws://221.195.106.155:35884/mqtt', options) ;
|
client = mqtt.connect('<%=ProConfig.MQTT.MQTTSIMPLEURI%>', options) ;
|
||||||
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
||||||
client.on('reconnect', function(error) {
|
client.on('reconnect', function(error) {
|
||||||
for(var i=1;i< paged;i++){
|
for(var i=1;i< paged;i++){
|
||||||
|
|
@ -255,11 +255,14 @@
|
||||||
if(isOK(data)){
|
if(isOK(data)){
|
||||||
var dataObj = data.data.data ;
|
var dataObj = data.data.data ;
|
||||||
for(var i=0; i <dataObj.length;i++){
|
for(var i=0; i <dataObj.length;i++){
|
||||||
$(".container").append($("#template0").html().format(dataObj[i].name ,dataObj[i].data.iot_node_status
|
$(".container").append($("#template0").html().format(
|
||||||
|
dataObj[i].name
|
||||||
|
,dataObj[i].data.iot_node_status
|
||||||
,disvalue(dataObj[i].device_code,10)
|
,disvalue(dataObj[i].device_code,10)
|
||||||
,getSensorListHtml(dataObj[i].iotSensorList,sid ,dataObj[i].iot_node_status )
|
,getSensorListHtml(dataObj[i].iotSensorList,sid ,dataObj[i].iot_node_status )
|
||||||
, getDeviceState(dataObj[i].iot_node_status),
|
, getDeviceState(dataObj[i].iot_node_status),
|
||||||
dataObj[i].id ) );
|
dataObj[i].id
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.data.totalPage > data.data.paged){
|
if(data.data.totalPage > data.data.paged){
|
||||||
|
|
@ -391,7 +394,7 @@
|
||||||
var src1 = 'src="<%=sensorImg%>/on.png"';
|
var src1 = 'src="<%=sensorImg%>/on.png"';
|
||||||
<%--var src2 = 'src="<%=basePath%>/image/oss/iot/off.png"';--%>
|
<%--var src2 = 'src="<%=basePath%>/image/oss/iot/off.png"';--%>
|
||||||
var src2 = 'src="<%=sensorImg%>/off.png"';
|
var src2 = 'src="<%=sensorImg%>/off.png"';
|
||||||
console.log("device getSensorListHtml with %s, %o", sid, dataT);
|
console.log("device getSensorListHtml with %s, %o, %s", sid, dataT, node_status);
|
||||||
for(var i=0;i<dataT.length;i++){
|
for(var i=0;i<dataT.length;i++){
|
||||||
if( dataT[i].data_type ==2){
|
if( dataT[i].data_type ==2){
|
||||||
continue ;
|
continue ;
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ var baseurl= window.location.href.split("/page")[0] ;
|
||||||
|
|
||||||
var ucode= localStorage.getItem("ucode");
|
var ucode= localStorage.getItem("ucode");
|
||||||
|
|
||||||
var mqttUserName = 'yinzy' ;
|
// var mqttUserName = 'yinzy' ;
|
||||||
var mqttPassword = 'yzy123456' ;
|
// var mqttPassword = 'yzy123456' ;
|
||||||
|
|
||||||
// config end -----------------------------------------------------------------
|
// config end -----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
username: mqttUserName ,
|
username: mqttUserName ,
|
||||||
password: mqttPassword ,
|
password: mqttPassword ,
|
||||||
}
|
}
|
||||||
client = mqtt.connect('ws://221.195.106.155:35884/mqtt', options) ;
|
client = mqtt.connect(mqttUrl, options) ;
|
||||||
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
||||||
client.on('reconnect', function(error) {
|
client.on('reconnect', function(error) {
|
||||||
console.log("reconnect");
|
console.log("reconnect");
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@
|
||||||
password: mqttPassword ,
|
password: mqttPassword ,
|
||||||
protocol: 'ws',
|
protocol: 'ws',
|
||||||
}
|
}
|
||||||
client = mqtt.connect('ws://221.195.106.155:35884/mqtt', options) ;
|
client = mqtt.connect(mqttUrl, options) ;
|
||||||
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
||||||
client.on('reconnect', function(error) {
|
client.on('reconnect', function(error) {
|
||||||
console.log("reconnect " + error);
|
console.log("reconnect " + error);
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@
|
||||||
password: mqttPassword ,
|
password: mqttPassword ,
|
||||||
}
|
}
|
||||||
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
// client = mqtt.connect('ws://'+document.domain+':8083/mqtt', options) ;
|
||||||
client = mqtt.connect('ws://221.195.106.155:35884/mqtt', options) ;
|
client = mqtt.connect(mqttUrl, options) ;
|
||||||
client.on('reconnect', function(error) {
|
client.on('reconnect', function(error) {
|
||||||
console.log("reconnect");
|
console.log("reconnect");
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
nihao hello
|
nihao hello
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
password: '<%=ProConfig.MQTT.PASSWORD%>',
|
||||||
}
|
}
|
||||||
|
|
||||||
var client = mqtt.connect('ws://192.168.3.5:35884/mqtt', options)
|
var client = mqtt.connect('<%=ProConfig.MQTT.MQTTSIMPLEURI%>', options)
|
||||||
|
|
||||||
client.on('reconnect', function(error) {
|
client.on('reconnect', function(error) {
|
||||||
console.log('正在重连:', error)
|
console.log('正在重连:', error)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue