First Changelist
parent
8aa9b2a0b5
commit
57d741b898
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业用途,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
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.WechatAuthorityIntercept;
|
||||
|
||||
public class Dispatcher extends DispatcherServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void doDispatch(HttpServletRequest req, HttpServletResponse response) throws Exception {
|
||||
|
||||
// 微信公众号授权拦截
|
||||
int statusCode = WechatAuthorityIntercept.AutjorityIntercept(req, response) ;
|
||||
|
||||
if(statusCode == 0 ){
|
||||
super.doDispatch(req, response);
|
||||
}else if(statusCode == 1){
|
||||
return ;
|
||||
}else{
|
||||
// 权限判断
|
||||
if(AuthorityIntercept.AutjorityIntercept(req, response)){
|
||||
super.doDispatch(req, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业用途,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
package com.lp;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class HeaderFilter implements Filter {
|
||||
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest)req;
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
String originHeader = request.getHeader("Origin");
|
||||
response.setHeader("Access-Control-Allow-Origin", originHeader);
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, GET,PUT, OPTIONS, DELETE");
|
||||
response.setHeader("Access-Control-Max-Age", "0");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token,USER-KEY");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("XDomainRequestAllowed","1");
|
||||
response.setHeader("XDomainRequestAllowed","1");
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
public void init(FilterConfig arg0) throws ServletException {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.lp.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* 数据字典用字段注解
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Code {
|
||||
|
||||
/**
|
||||
* 注解类型,不同类型处理不同的业务
|
||||
* @return
|
||||
*/
|
||||
int type() default 0 ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.lp.annotation;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* value用注解实体
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class CodeAnnotationBean {
|
||||
/**
|
||||
* 字段名称
|
||||
*/
|
||||
private Field field;
|
||||
/**
|
||||
* 匹配条件
|
||||
*/
|
||||
private int type;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业用途,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
package com.lp.authority;
|
||||
|
||||
import com.lp.bo.UserInfoBO;
|
||||
import com.lp.cache.CacheName;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.util.CommonUtil;
|
||||
import com.lp.util.LogUtil;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class AuthorityIntercept {
|
||||
|
||||
protected final static Logger LOGGER = LoggerFactory.getLogger(AuthorityIntercept.class);
|
||||
|
||||
/**
|
||||
* 权限判断
|
||||
*
|
||||
* @param req
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
public static Boolean AutjorityIntercept(HttpServletRequest req, HttpServletResponse response) {
|
||||
// uri
|
||||
String requestUri = req.getRequestURI();
|
||||
// url
|
||||
String requestUrl = req.getRequestURL().toString();
|
||||
// method
|
||||
String requestMethod = req.getMethod();
|
||||
// key -- GET请求不包含KEY WEB请求的时候,全部包含Session
|
||||
String userKey = req.getHeader(ResultMapUtils.USER_KEY);
|
||||
try {
|
||||
if (requestUrl.contains("/login") || requestUrl.contains("/register") || requestUrl.contains("/password") ||
|
||||
requestUrl.contains("/validate/code") || requestUrl.contains("/security_code") || requestUrl.contains("/upload")
|
||||
|| requestUrl.contains("/mail") || requestUrl.contains("/bind") || requestUrl.contains("/live") ||
|
||||
requestUrl.contains("/mqtt") || requestUrl.contains("/baidu") || requestUrl.contains("/vp") ||requestUrl.contains("/noauth") || requestUrl.endsWith("/") ) {
|
||||
return true;
|
||||
} else {
|
||||
if (ObjectUtil.isNotEmpty(userKey) || requestMethod.equals("PUT") || requestMethod.equals("POST")
|
||||
|| requestMethod.equals("DELETE")) {
|
||||
// userKey 不能为空
|
||||
if (ObjectUtil.isNotEmpty(ProCacheUtil.getCache(CacheName.USERINFO, userKey,new Object()) )) {
|
||||
return true ;
|
||||
} else {
|
||||
LOGGER.debug("AutjorityIntercept with {}{} is called with user {}{}", requestUrl, requestMethod, userKey, ProCacheUtil.getCache(CacheName.USERINFO, userKey,new Object()));
|
||||
JSONObject resultData = new JSONObject();
|
||||
resultData.put("status", Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
resultData.put("statusMsg", "NO ACCESS");
|
||||
PrintWriter out = response.getWriter();
|
||||
out.write(resultData.toString());
|
||||
out.flush();
|
||||
return false ;
|
||||
}
|
||||
} else {
|
||||
UserInfoBO user = (UserInfoBO) req.getSession().getAttribute("user");
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
if(CommonUtil.checkReqUtil.checkAgentIsMobile(req)){
|
||||
response.sendRedirect( ProConfig.LOCAL_DOMAIN + "/service/wiot/login" );
|
||||
}else{
|
||||
response.sendRedirect( ProConfig.LOCAL_DOMAIN + "/service/iot/login" );
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.errorLog(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业用途,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
package com.lp.authority;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.lp.bo.UserInfoBO;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.util.LogUtil;
|
||||
import com.lp.util.ObjectUtil;
|
||||
|
||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl;
|
||||
|
||||
public class WechatAuthorityIntercept {
|
||||
|
||||
/**
|
||||
* 是否是微信浏览器
|
||||
*
|
||||
* @param request
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isWeixin(HttpServletRequest request) {
|
||||
if (((HttpServletRequest) request).getHeader("user-agent") == null) {
|
||||
return false;
|
||||
}
|
||||
String ua = ((HttpServletRequest) request).getHeader("user-agent").toLowerCase();
|
||||
|
||||
if (ua.indexOf("micromessenger") > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信公众号授权
|
||||
* 0 通过,1 转发其他,-1 跳转到web判断
|
||||
* @param req
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
public static int AutjorityIntercept(HttpServletRequest req, HttpServletResponse response) {
|
||||
// url
|
||||
String requestUrl = req.getRequestURL().toString();
|
||||
String queryString = req.getQueryString();
|
||||
// 是否需要微信授权信息
|
||||
Boolean is_auth = false ;
|
||||
|
||||
if(ObjectUtil.isNotEmpty(queryString)){
|
||||
requestUrl+= '?'+queryString.replace("&", "*") ;
|
||||
}
|
||||
try{
|
||||
if ((isWeixin(req))
|
||||
&& !requestUrl.toString().contains(ProConfig.WEIXIN.MP_OAUTH2_REDIRECT_URI) ) {
|
||||
|
||||
UserInfoBO userInfo = (UserInfoBO) req.getSession().getAttribute("user");
|
||||
Object openid = req.getSession().getAttribute("open_id") ;
|
||||
|
||||
if ( ObjectUtil.isEmpty(userInfo) ) {
|
||||
if(requestUrl.contains("login") || requestUrl.contains("login_sms")
|
||||
|| requestUrl.contains("validate/code") || requestUrl.contains("/security_code") ){
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
if( ObjectUtil.isNotEmpty( openid ) ){
|
||||
if( requestUrl.contains("/bind") || requestUrl.contains("/cbind") || requestUrl.contains("/register") ){
|
||||
return 0 ;
|
||||
}else{
|
||||
response.sendRedirect(ProConfig.LOCAL_DOMAIN + "/service/wiot/bind");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
is_auth = true ;
|
||||
}
|
||||
}else{
|
||||
// 通过用户登录了
|
||||
if( requestUrl.contains("/cbind") && ObjectUtil.isEmpty(openid) ){
|
||||
is_auth = true ;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_auth){
|
||||
/**
|
||||
* 1.构造网页授权url
|
||||
* 以snsapi_base为scope发起的网页授权,是用来获取进入页面的用户的openid的,snsapi_userinfo
|
||||
* / snsapi_base 并且是静默授权并自动跳转到回调页的。用户感知的就是直接进入了回调页 生产环境可能需要改成
|
||||
* request_uri / requestUrl
|
||||
* 如果需要关注公众号,则可以使用snsapi_userinfo,就可以不需要关注公众号也能进行信息的绑定
|
||||
*/
|
||||
String authorization_url = ((WxMpServiceImpl)(ObjectUtil.Spring.getBean("wxMpService")))
|
||||
.oauth2buildAuthorizationUrl("snsapi_userinfo", requestUrl);
|
||||
/**
|
||||
* 2.开始发起授权
|
||||
*/
|
||||
response.sendRedirect(authorization_url);
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
}else{
|
||||
if( requestUrl.toString().contains(ProConfig.WEIXIN.MP_OAUTH2_REDIRECT_URI)
|
||||
|| requestUrl.toString().contains("/service/weixin/mp/msg") ){
|
||||
return 0 ;
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
LogUtil.errorLog(e);
|
||||
return -1 ;
|
||||
}
|
||||
return -1 ;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:AlarmTriggerRecord
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class AlarmTriggerRecord extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**user_id*/
|
||||
private Integer user_id;
|
||||
|
||||
/**触发类型,短信,语音,微信等*/
|
||||
@Code
|
||||
private Integer trigger_type;
|
||||
|
||||
/**remark*/
|
||||
private String remark;
|
||||
|
||||
/**报警内容*/
|
||||
private String content;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:AlarmTriggerStatistic
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class AlarmTriggerStatistic extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**user_id*/
|
||||
private Integer user_id;
|
||||
|
||||
/**触发类型,短信,语音,微信等*/
|
||||
private Integer trigger_type;
|
||||
|
||||
/**数量*/
|
||||
private Integer num;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BaseBean extends IotBaseBean {
|
||||
|
||||
private Integer id ;
|
||||
|
||||
private List<Integer> id_array ;
|
||||
|
||||
/**
|
||||
* 删除标志,0正常,1删除
|
||||
*/
|
||||
private Integer delete_flag = 0 ;
|
||||
|
||||
public Integer offset ;
|
||||
|
||||
public Integer limit ;
|
||||
|
||||
public Map<String, String> data = null;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:ContactUserInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ContactUserInfo extends BaseBean {
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**sex*/
|
||||
private String sex;
|
||||
|
||||
/**phone*/
|
||||
private String phone;
|
||||
|
||||
/**email*/
|
||||
private String email;
|
||||
|
||||
/**address*/
|
||||
private String address;
|
||||
|
||||
/**user_id*/
|
||||
private Integer user_id;
|
||||
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
private String wx_key ;
|
||||
|
||||
private String wx_img ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:FileInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FileInfo extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**fix*/
|
||||
private String fix;
|
||||
|
||||
/**size*/
|
||||
private Integer size;
|
||||
|
||||
/**delete_flag*/
|
||||
private Integer delete_flag;
|
||||
|
||||
/**add_id*/
|
||||
private Integer add_id;
|
||||
|
||||
/**add_time*/
|
||||
private Date add_time;
|
||||
|
||||
private String file_path ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业用途,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:HkAccountInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class HkAccountInfo extends BaseBean {
|
||||
|
||||
/**pk*/
|
||||
private Integer id;
|
||||
|
||||
/**appKey*/
|
||||
private String appKey;
|
||||
|
||||
/**secret*/
|
||||
private String secret;
|
||||
|
||||
/**accessToken*/
|
||||
private String accessToken;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotAlarmInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotAlarmInfo extends BaseBean {
|
||||
|
||||
private String name ;
|
||||
|
||||
/**description*/
|
||||
private String description;
|
||||
|
||||
/**sensor_id*/
|
||||
private Integer sensor_id;
|
||||
|
||||
/**报警级别*/
|
||||
@Code
|
||||
private Integer iot_trigger_alarm_level;
|
||||
|
||||
private Float alarm_sdata ;
|
||||
|
||||
/**sdata*/
|
||||
private Float sdata;
|
||||
|
||||
/**处理标志*/
|
||||
@Code
|
||||
private Integer iot_alarm_process_status;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
// 报警联系人名称
|
||||
private String contact_names ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 放置一些公共业务字段
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class IotBaseBean {
|
||||
|
||||
private String sensor_name ;
|
||||
|
||||
private Integer scene_id ;
|
||||
|
||||
private Integer user_id ;
|
||||
|
||||
private String start_time ;
|
||||
|
||||
private String end_time ;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotHistoryNodeData
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotHistoryNodeData extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**node_id*/
|
||||
private Integer node_id;
|
||||
|
||||
/**sensor_ids*/
|
||||
private String sensor_ids;
|
||||
|
||||
/**sdatas*/
|
||||
private String sdatas;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotHistorySensorData
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotHistorySensorData extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**sensor_id*/
|
||||
private Integer sensor_id;
|
||||
|
||||
/**sdata*/
|
||||
private String sdata;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotHistoryTriggerInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotHistoryTriggerInfo extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**sdata*/
|
||||
private Float sdata;
|
||||
|
||||
/**description*/
|
||||
private String description;
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**源传感器ID*/
|
||||
private Integer from_sensor_id;
|
||||
|
||||
/**目标传感器ID*/
|
||||
private Integer to_sensor_id;
|
||||
|
||||
/**触发条件类型*/
|
||||
@Code
|
||||
private Integer iot_trigger_condition_type;
|
||||
|
||||
/**触发动作类型*/
|
||||
@Code
|
||||
private String iot_trigger_action_type;
|
||||
|
||||
/**触发动作参数*/
|
||||
private String action_params;
|
||||
|
||||
private String trigger_value ;
|
||||
|
||||
/**条件参数*/
|
||||
private String condition_params;
|
||||
|
||||
/**报警级别*/
|
||||
private Integer iot_trigger_alarm_level;
|
||||
|
||||
/**是否报警标志*/
|
||||
private Integer iot_trigger_alarm_flag;
|
||||
|
||||
/**触发间隔*/
|
||||
private Integer trigger_inteval_time;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotLpmInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotLpmInfo extends BaseBean {
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**lpm_key*/
|
||||
private String lpm_key;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*@类:IotNodeInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotNodeInfo extends BaseBean {
|
||||
|
||||
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**device_code*/
|
||||
private String device_code;
|
||||
|
||||
@Code
|
||||
/** 通讯协议,对应界面通信协议类型 数据字典 p_code81*/
|
||||
private Integer iot_node_type;
|
||||
|
||||
/**协议类型, 对应界面的数据协议类型 数据字典 p_code300*/
|
||||
private String iot_protocal_category;
|
||||
|
||||
/**seq*/
|
||||
private Integer seq;
|
||||
|
||||
/**scene_id*/
|
||||
private Integer scene_id;
|
||||
|
||||
/**节点状态*/
|
||||
@Code
|
||||
private Integer iot_node_status;
|
||||
|
||||
/**img_id*/
|
||||
private Integer img_id;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
private Integer template_id ;
|
||||
|
||||
/**
|
||||
* 维保时间
|
||||
*/
|
||||
private Date maintenance_time;
|
||||
|
||||
private String lonLat ;
|
||||
|
||||
private String infos ;
|
||||
|
||||
private Integer frequency ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotSceneInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSceneInfo extends BaseBean {
|
||||
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**父场景号*/
|
||||
private Integer pid;
|
||||
|
||||
/**user_id*/
|
||||
private Integer user_id;
|
||||
|
||||
|
||||
/**lon*/
|
||||
private Double lon;
|
||||
|
||||
/**lat*/
|
||||
private Double lat;
|
||||
|
||||
private String img_id ;
|
||||
|
||||
/**description*/
|
||||
private String description;
|
||||
|
||||
/**场景类型:农业、家居*/
|
||||
private Integer iot_scene_type;
|
||||
|
||||
/**布防状态*/
|
||||
private Integer guard_status;
|
||||
|
||||
/**remark*/
|
||||
private String remark;
|
||||
|
||||
/**seq*/
|
||||
private Integer seq;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 省份代码
|
||||
*/
|
||||
private Integer province_code;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 城市代码
|
||||
*/
|
||||
private Integer city_code;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotSceneUserRelation
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSceneUserRelation extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**scene_id*/
|
||||
private Integer scene_id;
|
||||
|
||||
/**user_id*/
|
||||
private Integer user_id;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotSensorDeviceInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSensorDeviceInfo extends BaseBean {
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**node_id*/
|
||||
private Integer node_id;
|
||||
|
||||
/**address*/
|
||||
private String address;
|
||||
|
||||
@Code
|
||||
private Integer device_status ;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
private Integer seq ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
import com.lp.common.Constants;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotSensorInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSensorInfo extends BaseBean {
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**传感器单位*/
|
||||
@Code(type=Constants.CodeType.DICTIONARY_VALUE)
|
||||
private Integer measure_unit_type;
|
||||
|
||||
/**类型:连续型、开关性等*/
|
||||
@Code
|
||||
private Integer iot_sensor_type;
|
||||
|
||||
/**种类:温度、IO、开关*/
|
||||
private Integer iot_sensor_category;
|
||||
|
||||
/**node_id*/
|
||||
private Integer node_id;
|
||||
|
||||
/**sensor_device_id*/
|
||||
private String sensor_device_id;
|
||||
|
||||
/**port_id*/
|
||||
private Integer port_id;
|
||||
|
||||
/**sdata*/
|
||||
private Float sdata;
|
||||
|
||||
/**seq*/
|
||||
private Integer seq;
|
||||
|
||||
/**传感器状态*/
|
||||
@Code
|
||||
private Integer iot_sensor_status;
|
||||
|
||||
/**request_sdata*/
|
||||
private Float request_sdata;
|
||||
|
||||
/**精度*/
|
||||
private Integer sdata_degree;
|
||||
|
||||
/**直接公式处理,公式可在数据字典选择*/
|
||||
private String formula_up;
|
||||
|
||||
private String formula_down;
|
||||
|
||||
/**register_time*/
|
||||
private Date register_time;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
private String str_sdata ;
|
||||
|
||||
/** 数据类型 0 common 1, 配置 */
|
||||
private Integer data_type = 0 ;
|
||||
|
||||
private String param_names ;
|
||||
|
||||
/**
|
||||
* 配置参数类型
|
||||
*/
|
||||
private Integer param_type ;
|
||||
/**
|
||||
* 配置参数单位
|
||||
*/
|
||||
private String param_config ;
|
||||
|
||||
private String infos ;
|
||||
/**
|
||||
* 储存策略
|
||||
*/
|
||||
@Code
|
||||
private Integer store_strage ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业用途,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotTriggerInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotTriggerInfo extends BaseBean {
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**源传感器ID*/
|
||||
private Integer from_sensor_id;
|
||||
|
||||
/**目标传感器ID*/
|
||||
private Integer to_sensor_id;
|
||||
|
||||
/**触发条件类型*/
|
||||
@Code
|
||||
private Integer iot_trigger_condition_type;
|
||||
|
||||
/**触发动作类型*/
|
||||
@Code
|
||||
private String iot_trigger_action_type;
|
||||
|
||||
/**触发动作参数*/
|
||||
private String action_params;
|
||||
|
||||
/**seq*/
|
||||
private Integer seq;
|
||||
|
||||
/**条件参数*/
|
||||
private String condition_params;
|
||||
|
||||
/**报警级别*/
|
||||
@Code
|
||||
private Integer iot_trigger_alarm_level;
|
||||
|
||||
/**是否报警标志*/
|
||||
@Code
|
||||
private Integer iot_trigger_alarm_flag;
|
||||
|
||||
/**启停状态*/
|
||||
@Code
|
||||
private Integer iot_trigger_status;
|
||||
|
||||
/**触发间隔*/
|
||||
private Integer trigger_inteval_time;
|
||||
|
||||
/** 最近触发时间*/
|
||||
private Date last_trigger_time;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
private Integer recovery ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotVideoInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotVideoInfo extends BaseBean {
|
||||
|
||||
/**pk*/
|
||||
private Integer id;
|
||||
|
||||
/**视频名称*/
|
||||
private String name;
|
||||
|
||||
/**scene_id*/
|
||||
private Integer scene_id;
|
||||
|
||||
/**status*/
|
||||
@Code
|
||||
private Integer status;
|
||||
|
||||
/**image_id*/
|
||||
private Integer image_id;
|
||||
|
||||
/**video_type*/
|
||||
@Code
|
||||
private Integer video_type;
|
||||
|
||||
/**seq*/
|
||||
private Integer seq;
|
||||
|
||||
/**关联账户ID*/
|
||||
private Integer relate_id;
|
||||
|
||||
private String app_name ;
|
||||
|
||||
/**rtmp播放地址*/
|
||||
private String rtmp_url_high;
|
||||
|
||||
/**rtmp正常播放地址*/
|
||||
private String rtmp_url_common;
|
||||
|
||||
/**hls播放地址*/
|
||||
private String hls_url;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
@Code
|
||||
private Integer camera_type ;
|
||||
|
||||
private String username ;
|
||||
|
||||
private String password ;
|
||||
|
||||
private String ip ;
|
||||
|
||||
private String port ;
|
||||
|
||||
private String codectype ;
|
||||
|
||||
private String channel ;
|
||||
|
||||
private String subtype ;
|
||||
|
||||
private String device_serial;
|
||||
|
||||
private String validate_code;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotVideoRecord
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotVideoRecord extends BaseBean {
|
||||
|
||||
/**pk*/
|
||||
private Integer id;
|
||||
|
||||
/**视频id*/
|
||||
private Integer video_id;
|
||||
|
||||
/**名称*/
|
||||
private String name;
|
||||
|
||||
/**开始时间*/
|
||||
private Date start_date;
|
||||
|
||||
/**结束时间*/
|
||||
private Date end_date;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,481 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author thomas.he
|
||||
* @Description:
|
||||
* @date 2021/7/27 21:15
|
||||
*/
|
||||
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
|
||||
public class IotVisualDisplayInfo extends BaseBean {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String keycode;
|
||||
private String description;
|
||||
private Object content;
|
||||
private String config;
|
||||
private Integer seq;
|
||||
private String remark;
|
||||
private Integer scene_id;
|
||||
private Integer aid;
|
||||
private Date atime;
|
||||
private Integer mid;
|
||||
private Date mtime;
|
||||
private Integer dis_type;
|
||||
private Integer node_id;
|
||||
private Integer parent_id;
|
||||
private Integer openflag;
|
||||
private String password;
|
||||
private String visitorname;
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getKeycode() {
|
||||
return this.keycode;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public String getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
public Integer getSeq() {
|
||||
return this.seq;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return this.remark;
|
||||
}
|
||||
|
||||
public Integer getScene_id() {
|
||||
return this.scene_id;
|
||||
}
|
||||
|
||||
public Integer getAid() {
|
||||
return this.aid;
|
||||
}
|
||||
|
||||
public Date getAtime() {
|
||||
return this.atime;
|
||||
}
|
||||
|
||||
public Integer getMid() {
|
||||
return this.mid;
|
||||
}
|
||||
|
||||
public Date getMtime() {
|
||||
return this.mtime;
|
||||
}
|
||||
|
||||
public Integer getDis_type() {
|
||||
return this.dis_type;
|
||||
}
|
||||
|
||||
public Integer getNode_id() {
|
||||
return this.node_id;
|
||||
}
|
||||
|
||||
public Integer getParent_id() {
|
||||
return this.parent_id;
|
||||
}
|
||||
|
||||
public Integer getOpenflag() {
|
||||
return this.openflag;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public String getVisitorname() {
|
||||
return this.visitorname;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setKeycode(String keycode) {
|
||||
this.keycode = keycode;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setContent(Object content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setConfig(String config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void setSeq(Integer seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public void setScene_id(Integer scene_id) {
|
||||
this.scene_id = scene_id;
|
||||
}
|
||||
|
||||
public void setAid(Integer aid) {
|
||||
this.aid = aid;
|
||||
}
|
||||
|
||||
public void setAtime(Date atime) {
|
||||
this.atime = atime;
|
||||
}
|
||||
|
||||
public void setMid(Integer mid) {
|
||||
this.mid = mid;
|
||||
}
|
||||
|
||||
public void setMtime(Date mtime) {
|
||||
this.mtime = mtime;
|
||||
}
|
||||
|
||||
public void setDis_type(Integer dis_type) {
|
||||
this.dis_type = dis_type;
|
||||
}
|
||||
|
||||
public void setNode_id(Integer node_id) {
|
||||
this.node_id = node_id;
|
||||
}
|
||||
|
||||
public void setParent_id(Integer parent_id) {
|
||||
this.parent_id = parent_id;
|
||||
}
|
||||
|
||||
public void setOpenflag(Integer openflag) {
|
||||
this.openflag = openflag;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setVisitorname(String visitorname) {
|
||||
this.visitorname = visitorname;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "IotVisualDisplayInfo(id=" + this.getId() + ", name=" + this.getName() + ", keycode=" + this.getKeycode() + ", description=" + this.getDescription() + ", content=" + this.getContent() + ", config=" + this.getConfig() + ", seq=" + this.getSeq() + ", remark=" + this.getRemark() + ", scene_id=" + this.getScene_id() + ", aid=" + this.getAid() + ", atime=" + this.getAtime() + ", mid=" + this.getMid() + ", mtime=" + this.getMtime() + ", dis_type=" + this.getDis_type() + ", node_id=" + this.getNode_id() + ", parent_id=" + this.getParent_id() + ", openflag=" + this.getOpenflag() + ", password=" + this.getPassword() + ", visitorname=" + this.getVisitorname() + ")";
|
||||
}
|
||||
|
||||
public IotVisualDisplayInfo() {
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
} else if (!(o instanceof IotVisualDisplayInfo)) {
|
||||
return false;
|
||||
} else {
|
||||
IotVisualDisplayInfo other = (IotVisualDisplayInfo)o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
} else {
|
||||
label239: {
|
||||
Object this$id = this.getId();
|
||||
Object other$id = other.getId();
|
||||
if (this$id == null) {
|
||||
if (other$id == null) {
|
||||
break label239;
|
||||
}
|
||||
} else if (this$id.equals(other$id)) {
|
||||
break label239;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$name = this.getName();
|
||||
Object other$name = other.getName();
|
||||
if (this$name == null) {
|
||||
if (other$name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$name.equals(other$name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$keycode = this.getKeycode();
|
||||
Object other$keycode = other.getKeycode();
|
||||
if (this$keycode == null) {
|
||||
if (other$keycode != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$keycode.equals(other$keycode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label218: {
|
||||
Object this$description = this.getDescription();
|
||||
Object other$description = other.getDescription();
|
||||
if (this$description == null) {
|
||||
if (other$description == null) {
|
||||
break label218;
|
||||
}
|
||||
} else if (this$description.equals(other$description)) {
|
||||
break label218;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
label211: {
|
||||
Object this$content = this.getContent();
|
||||
Object other$content = other.getContent();
|
||||
if (this$content == null) {
|
||||
if (other$content == null) {
|
||||
break label211;
|
||||
}
|
||||
} else if (this$content.equals(other$content)) {
|
||||
break label211;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$config = this.getConfig();
|
||||
Object other$config = other.getConfig();
|
||||
if (this$config == null) {
|
||||
if (other$config != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$config.equals(other$config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$seq = this.getSeq();
|
||||
Object other$seq = other.getSeq();
|
||||
if (this$seq == null) {
|
||||
if (other$seq != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$seq.equals(other$seq)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label190: {
|
||||
Object this$remark = this.getRemark();
|
||||
Object other$remark = other.getRemark();
|
||||
if (this$remark == null) {
|
||||
if (other$remark == null) {
|
||||
break label190;
|
||||
}
|
||||
} else if (this$remark.equals(other$remark)) {
|
||||
break label190;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
label183: {
|
||||
Object this$scene_id = this.getScene_id();
|
||||
Object other$scene_id = other.getScene_id();
|
||||
if (this$scene_id == null) {
|
||||
if (other$scene_id == null) {
|
||||
break label183;
|
||||
}
|
||||
} else if (this$scene_id.equals(other$scene_id)) {
|
||||
break label183;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$aid = this.getAid();
|
||||
Object other$aid = other.getAid();
|
||||
if (this$aid == null) {
|
||||
if (other$aid != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$aid.equals(other$aid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label169: {
|
||||
Object this$atime = this.getAtime();
|
||||
Object other$atime = other.getAtime();
|
||||
if (this$atime == null) {
|
||||
if (other$atime == null) {
|
||||
break label169;
|
||||
}
|
||||
} else if (this$atime.equals(other$atime)) {
|
||||
break label169;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$mid = this.getMid();
|
||||
Object other$mid = other.getMid();
|
||||
if (this$mid == null) {
|
||||
if (other$mid != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$mid.equals(other$mid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label155: {
|
||||
Object this$mtime = this.getMtime();
|
||||
Object other$mtime = other.getMtime();
|
||||
if (this$mtime == null) {
|
||||
if (other$mtime == null) {
|
||||
break label155;
|
||||
}
|
||||
} else if (this$mtime.equals(other$mtime)) {
|
||||
break label155;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$dis_type = this.getDis_type();
|
||||
Object other$dis_type = other.getDis_type();
|
||||
if (this$dis_type == null) {
|
||||
if (other$dis_type != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$dis_type.equals(other$dis_type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$node_id = this.getNode_id();
|
||||
Object other$node_id = other.getNode_id();
|
||||
if (this$node_id == null) {
|
||||
if (other$node_id != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$node_id.equals(other$node_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label134: {
|
||||
Object this$parent_id = this.getParent_id();
|
||||
Object other$parent_id = other.getParent_id();
|
||||
if (this$parent_id == null) {
|
||||
if (other$parent_id == null) {
|
||||
break label134;
|
||||
}
|
||||
} else if (this$parent_id.equals(other$parent_id)) {
|
||||
break label134;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
label127: {
|
||||
Object this$openflag = this.getOpenflag();
|
||||
Object other$openflag = other.getOpenflag();
|
||||
if (this$openflag == null) {
|
||||
if (other$openflag == null) {
|
||||
break label127;
|
||||
}
|
||||
} else if (this$openflag.equals(other$openflag)) {
|
||||
break label127;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$password = this.getPassword();
|
||||
Object other$password = other.getPassword();
|
||||
if (this$password == null) {
|
||||
if (other$password != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$password.equals(other$password)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object this$visitorname = this.getVisitorname();
|
||||
Object other$visitorname = other.getVisitorname();
|
||||
if (this$visitorname == null) {
|
||||
if (other$visitorname != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this$visitorname.equals(other$visitorname)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof IotVisualDisplayInfo;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
boolean PRIME = true;
|
||||
int result = 1;
|
||||
Object $id = this.getId();
|
||||
result = result * 59 + ($id == null ? 43 : $id.hashCode());
|
||||
Object $name = this.getName();
|
||||
result = result * 59 + ($name == null ? 43 : $name.hashCode());
|
||||
Object $keycode = this.getKeycode();
|
||||
result = result * 59 + ($keycode == null ? 43 : $keycode.hashCode());
|
||||
Object $description = this.getDescription();
|
||||
result = result * 59 + ($description == null ? 43 : $description.hashCode());
|
||||
Object $content = this.getContent();
|
||||
result = result * 59 + ($content == null ? 43 : $content.hashCode());
|
||||
Object $config = this.getConfig();
|
||||
result = result * 59 + ($config == null ? 43 : $config.hashCode());
|
||||
Object $seq = this.getSeq();
|
||||
result = result * 59 + ($seq == null ? 43 : $seq.hashCode());
|
||||
Object $remark = this.getRemark();
|
||||
result = result * 59 + ($remark == null ? 43 : $remark.hashCode());
|
||||
Object $scene_id = this.getScene_id();
|
||||
result = result * 59 + ($scene_id == null ? 43 : $scene_id.hashCode());
|
||||
Object $aid = this.getAid();
|
||||
result = result * 59 + ($aid == null ? 43 : $aid.hashCode());
|
||||
Object $atime = this.getAtime();
|
||||
result = result * 59 + ($atime == null ? 43 : $atime.hashCode());
|
||||
Object $mid = this.getMid();
|
||||
result = result * 59 + ($mid == null ? 43 : $mid.hashCode());
|
||||
Object $mtime = this.getMtime();
|
||||
result = result * 59 + ($mtime == null ? 43 : $mtime.hashCode());
|
||||
Object $dis_type = this.getDis_type();
|
||||
result = result * 59 + ($dis_type == null ? 43 : $dis_type.hashCode());
|
||||
Object $node_id = this.getNode_id();
|
||||
result = result * 59 + ($node_id == null ? 43 : $node_id.hashCode());
|
||||
Object $parent_id = this.getParent_id();
|
||||
result = result * 59 + ($parent_id == null ? 43 : $parent_id.hashCode());
|
||||
Object $openflag = this.getOpenflag();
|
||||
result = result * 59 + ($openflag == null ? 43 : $openflag.hashCode());
|
||||
Object $password = this.getPassword();
|
||||
result = result * 59 + ($password == null ? 43 : $password.hashCode());
|
||||
Object $visitorname = this.getVisitorname();
|
||||
result = result * 59 + ($visitorname == null ? 43 : $visitorname.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author thomas.he
|
||||
* @Description:
|
||||
* @date 2021/7/27 21:19
|
||||
*/
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class IotVisualMoudleInfo extends BaseBean {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String dis_img;
|
||||
private String description;
|
||||
private Object content;
|
||||
private Integer moudle_type;
|
||||
private Integer user_id;
|
||||
private Integer sys_flag;
|
||||
private Integer seq;
|
||||
private Integer aid;
|
||||
private Date atime;
|
||||
private Integer mid;
|
||||
private Date mtime;
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDis_img() {
|
||||
return this.dis_img;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public Integer getMoudle_type() {
|
||||
return this.moudle_type;
|
||||
}
|
||||
|
||||
public Integer getUser_id() {
|
||||
return this.user_id;
|
||||
}
|
||||
|
||||
public Integer getSys_flag() {
|
||||
return this.sys_flag;
|
||||
}
|
||||
|
||||
public Integer getSeq() {
|
||||
return this.seq;
|
||||
}
|
||||
|
||||
public Integer getAid() {
|
||||
return this.aid;
|
||||
}
|
||||
|
||||
public Date getAtime() {
|
||||
return this.atime;
|
||||
}
|
||||
|
||||
public Integer getMid() {
|
||||
return this.mid;
|
||||
}
|
||||
|
||||
public Date getMtime() {
|
||||
return this.mtime;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDis_img(String dis_img) {
|
||||
this.dis_img = dis_img;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setContent(Object content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setMoudle_type(Integer moudle_type) {
|
||||
this.moudle_type = moudle_type;
|
||||
}
|
||||
|
||||
public void setUser_id(Integer user_id) {
|
||||
this.user_id = user_id;
|
||||
}
|
||||
|
||||
public void setSys_flag(Integer sys_flag) {
|
||||
this.sys_flag = sys_flag;
|
||||
}
|
||||
|
||||
public void setSeq(Integer seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setAid(Integer aid) {
|
||||
this.aid = aid;
|
||||
}
|
||||
|
||||
public void setAtime(Date atime) {
|
||||
this.atime = atime;
|
||||
}
|
||||
|
||||
public void setMid(Integer mid) {
|
||||
this.mid = mid;
|
||||
}
|
||||
|
||||
public void setMtime(Date mtime) {
|
||||
this.mtime = mtime;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "IotVisualMoudleInfo(id=" + getId() + ", name=" + getName() + ", dis_img=" + getDis_img() + ", description=" + getDescription() + ", content=" + getContent() + ", moudle_type=" + getMoudle_type() + ", user_id=" + getUser_id() + ", sys_flag=" + getSys_flag() + ", seq=" + getSeq() + ", aid=" + getAid() + ", atime=" + getAtime() + ", mid=" + getMid() + ", mtime=" + getMtime() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof IotVisualMoudleInfo)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
IotVisualMoudleInfo that = (IotVisualMoudleInfo) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(dis_img, that.dis_img) && Objects.equals(description, that.description) && Objects.equals(content, that.content) && Objects.equals(moudle_type, that.moudle_type) && Objects.equals(user_id, that.user_id) && Objects.equals(sys_flag, that.sys_flag) && Objects.equals(seq, that.seq) && Objects.equals(aid, that.aid) && Objects.equals(atime, that.atime) && Objects.equals(mid, that.mid) && Objects.equals(mtime, that.mtime);
|
||||
}
|
||||
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof IotVisualMoudleInfo;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int PRIME = 59;
|
||||
int result = 1;
|
||||
Object $id = getId();
|
||||
result = result * 59 + (($id == null) ? 43 : $id.hashCode());
|
||||
Object $name = getName();
|
||||
result = result * 59 + (($name == null) ? 43 : $name.hashCode());
|
||||
Object $dis_img = getDis_img();
|
||||
result = result * 59 + (($dis_img == null) ? 43 : $dis_img.hashCode());
|
||||
Object $description = getDescription();
|
||||
result = result * 59 + (($description == null) ? 43 : $description.hashCode());
|
||||
Object $content = getContent();
|
||||
result = result * 59 + (($content == null) ? 43 : $content.hashCode());
|
||||
Object $moudle_type = getMoudle_type();
|
||||
result = result * 59 + (($moudle_type == null) ? 43 : $moudle_type.hashCode());
|
||||
Object $user_id = getUser_id();
|
||||
result = result * 59 + (($user_id == null) ? 43 : $user_id.hashCode());
|
||||
Object $sys_flag = getSys_flag();
|
||||
result = result * 59 + (($sys_flag == null) ? 43 : $sys_flag.hashCode());
|
||||
Object $seq = getSeq();
|
||||
result = result * 59 + (($seq == null) ? 43 : $seq.hashCode());
|
||||
Object $aid = getAid();
|
||||
result = result * 59 + (($aid == null) ? 43 : $aid.hashCode());
|
||||
Object $atime = getAtime();
|
||||
result = result * 59 + (($atime == null) ? 43 : $atime.hashCode());
|
||||
Object $mid = getMid();
|
||||
result = result * 59 + (($mid == null) ? 43 : $mid.hashCode());
|
||||
Object $mtime = getMtime();
|
||||
return (result * 59 + (($mtime == null) ? 43 : $mtime.hashCode()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MqttServerReCall {
|
||||
|
||||
private String action ;
|
||||
|
||||
private String client_id ;
|
||||
|
||||
private String username ;
|
||||
|
||||
private String reason ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ProDictionaryInfo extends BaseBean {
|
||||
|
||||
private String p_dictionary_name ;
|
||||
|
||||
private String dictionary_name ;
|
||||
|
||||
private Integer p_code ;
|
||||
|
||||
private Integer code ;
|
||||
|
||||
private String name ;
|
||||
|
||||
private String value ;
|
||||
|
||||
private Integer seq ;
|
||||
|
||||
private Date mtime ;
|
||||
|
||||
private List<ProDictionaryInfo> sub = new ArrayList<>() ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* mqtt json 字符串 转化实体对象
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class SimpleProtocolMqtt {
|
||||
|
||||
private String sid ;
|
||||
|
||||
private Integer pid ;
|
||||
|
||||
private Float dat ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:SysConfigInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysConfigInfo extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**name*/
|
||||
private String name;
|
||||
|
||||
/**value*/
|
||||
private String value;
|
||||
|
||||
/**remark*/
|
||||
private String remark;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.lp.bean;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class TableSystem {
|
||||
|
||||
private String table_name ;
|
||||
|
||||
private Integer table_index ;
|
||||
|
||||
private String table_names ;
|
||||
|
||||
private Integer num ;
|
||||
|
||||
private String db_name ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class User extends BaseBean {
|
||||
|
||||
private String name ;
|
||||
|
||||
private String password ;
|
||||
|
||||
private String phone ;
|
||||
|
||||
private String email ;
|
||||
|
||||
private String user_key ;
|
||||
|
||||
private String nick_name ;
|
||||
|
||||
private String real_name ;
|
||||
|
||||
private String id_no ;
|
||||
|
||||
private String wx_img_url ;
|
||||
|
||||
@Code
|
||||
private Integer type ;
|
||||
|
||||
@Code
|
||||
private Integer status ;
|
||||
|
||||
@Code
|
||||
private Integer sex ;
|
||||
|
||||
private Integer img_id ;
|
||||
|
||||
private String remark ;
|
||||
|
||||
private Date register_time ;
|
||||
|
||||
private String wx_open_id ;
|
||||
|
||||
private String wp_id ;
|
||||
|
||||
private String validate_code ;
|
||||
|
||||
private Date validate_time ;
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:UserAccountInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UserAccountInfo extends BaseBean {
|
||||
|
||||
/**id*/
|
||||
private Integer id;
|
||||
|
||||
/**user_id*/
|
||||
private Integer user_id;
|
||||
|
||||
/**金额,分为单位*/
|
||||
private Integer amount;
|
||||
|
||||
/**短信数量*/
|
||||
private Integer sms_num;
|
||||
|
||||
/**语音报警数量*/
|
||||
private Integer voice_num;
|
||||
|
||||
/**delete_flag*/
|
||||
private Integer delete_flag;
|
||||
|
||||
/**aid*/
|
||||
private Integer aid;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
/**mid*/
|
||||
private Integer mid;
|
||||
|
||||
/**mtime*/
|
||||
private Date mtime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:VideoFileInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class VideoFileInfo extends BaseBean {
|
||||
|
||||
/**pk*/
|
||||
private Integer id;
|
||||
|
||||
/**视频id*/
|
||||
private Integer video_id;
|
||||
|
||||
/**名称*/
|
||||
private String name;
|
||||
|
||||
/**fix*/
|
||||
private String fix;
|
||||
|
||||
/**atime*/
|
||||
private Date atime;
|
||||
|
||||
private String url;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.lp.bean;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:VideoServerReCall
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class VideoServerReCall {
|
||||
|
||||
// 动作类型
|
||||
private String action ;
|
||||
|
||||
//
|
||||
private Integer client_id ;
|
||||
|
||||
private String ip ;
|
||||
|
||||
private String vhost ;
|
||||
|
||||
private String app ;
|
||||
|
||||
private String tcUrl ;
|
||||
|
||||
private String pageUrl ;
|
||||
|
||||
private String stream ;
|
||||
|
||||
private String file ;
|
||||
|
||||
private String cwd ;
|
||||
|
||||
private Long send_bytes ;
|
||||
|
||||
private Long recv_bytes ;
|
||||
|
||||
private String param ;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.AlarmTriggerRecord;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:AlarmTriggerRecord
|
||||
* @作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class AlarmTriggerRecordBO extends AlarmTriggerRecord {
|
||||
|
||||
public AlarmTriggerRecordBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private Integer sms_num ;
|
||||
|
||||
private Integer voice_num ;
|
||||
|
||||
private String name ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.AlarmTriggerStatistic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:AlarmTriggerStatistic
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class AlarmTriggerStatisticBO extends AlarmTriggerStatistic {
|
||||
|
||||
public AlarmTriggerStatisticBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AliyunParamBO {
|
||||
|
||||
public String phonenumber ;
|
||||
|
||||
private String SignaName ;
|
||||
|
||||
private String templateCode ;
|
||||
|
||||
private String templateParam ;
|
||||
|
||||
private String calledShowNumber ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BussinessTriggerBO {
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message ;
|
||||
|
||||
/**
|
||||
* 阿里云短信报警格式
|
||||
*/
|
||||
private Map<String,String> aliyunSms ;
|
||||
|
||||
/**
|
||||
* 阿里云语音格式
|
||||
*/
|
||||
private Map<String,String> aliyunSmsVoice ;
|
||||
|
||||
/**
|
||||
* 1 模板1 - 设备报警
|
||||
* 2 模板2 - 设备离线
|
||||
* 3 模板3 - 设备报警恢复
|
||||
* 4 模板4 - 设备离线恢复
|
||||
*/
|
||||
private Integer smsType ;
|
||||
|
||||
/**
|
||||
* 1 模板1 - 设备报警
|
||||
* 2 模板2 - 设备离线
|
||||
* 3 模板3 - 设备报警恢复
|
||||
* 4 模板4 - 设备离线恢复
|
||||
*/
|
||||
private Integer vocieType ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:ContactUserInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class CommonInfoBO {
|
||||
|
||||
private Integer num ;
|
||||
|
||||
private Integer param ;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.ContactUserInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:ContactUserInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ContactUserInfoBO extends ContactUserInfo {
|
||||
|
||||
public ContactUserInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class ContactorBO {
|
||||
|
||||
private String contactor ;
|
||||
|
||||
private String control_device_status ;
|
||||
|
||||
private String control_device ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.FileInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:FileInfo
|
||||
* @作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class FileInfoBO extends FileInfo {
|
||||
|
||||
public FileInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
|
||||
private String base64File ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.HkAccountInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:HkAccountInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class HkAccountInfoBO extends HkAccountInfo {
|
||||
|
||||
public HkAccountInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotAlarmInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:IotAlarmInfo
|
||||
* @作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotAlarmInfoBO extends IotAlarmInfo {
|
||||
|
||||
public IotAlarmInfoBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private String atimestr ;
|
||||
|
||||
private String node_name ;
|
||||
|
||||
private Integer node_id ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotHistoryNodeData;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotHistoryNodeData
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotHistoryNodeDataBO extends IotHistoryNodeData {
|
||||
|
||||
public IotHistoryNodeDataBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
import com.lp.bean.IotHistorySensorData;
|
||||
import com.lp.common.Constants;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:IotHistorySensorData
|
||||
* @作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotHistorySensorDataBO extends IotHistorySensorData {
|
||||
|
||||
/**传感器单位*/
|
||||
@Code(type=Constants.CodeType.DICTIONARY_VALUE)
|
||||
private Integer measure_unit_type;
|
||||
|
||||
public IotHistorySensorDataBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
@Code
|
||||
private Integer iot_sensor_type ;
|
||||
|
||||
private String atimestr;
|
||||
|
||||
// 查询间隔时间
|
||||
private Integer query_interval_type ;
|
||||
|
||||
private String interval_p1 ;
|
||||
private String interval_p2 ;
|
||||
private Integer interval_p3 ;
|
||||
|
||||
|
||||
private Integer scene_id ;
|
||||
|
||||
private Integer node_id ;
|
||||
|
||||
private String ids ;
|
||||
|
||||
private String sensor_device_id ;
|
||||
|
||||
private Integer port_id ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotHistoryTriggerInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:IotHistoryTriggerInfo
|
||||
* @作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotHistoryTriggerInfoBO extends IotHistoryTriggerInfo {
|
||||
|
||||
public IotHistoryTriggerInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private Integer node_id ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotNodeInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class IotImportNodeInfoBO {
|
||||
|
||||
private String name ;
|
||||
|
||||
private String device_code ;
|
||||
|
||||
private String copy_device_code ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotLpmInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotLpmInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotLpmInfoBO extends IotLpmInfo {
|
||||
|
||||
public IotLpmInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
import com.lp.bean.IotNodeInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotNodeInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotNodeInfoBO extends IotNodeInfo {
|
||||
|
||||
public IotNodeInfoBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private String scene_name;
|
||||
|
||||
private String lpmKey ;
|
||||
|
||||
// private Integer device_template_id ;
|
||||
//
|
||||
// private String template_name ;
|
||||
|
||||
@Code
|
||||
private List<IotSensorInfoBO> iotSensorList ;
|
||||
|
||||
// 设备下 数据传感点,或者配置传感点
|
||||
private Integer node_data_type ; // 0 ,1配置
|
||||
|
||||
private String copy_device_code ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotSceneInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSceneInfoBO extends IotSceneInfo {
|
||||
|
||||
private Integer is_parent ;
|
||||
|
||||
private Integer unread_alarm ;
|
||||
|
||||
private Integer device_num ;
|
||||
|
||||
public IotSceneInfoBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotSceneUserRelation;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotSceneUserRelation
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSceneUserRelationBO extends IotSceneUserRelation {
|
||||
|
||||
public IotSceneUserRelationBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private String name ;
|
||||
|
||||
private String ids;
|
||||
|
||||
private String userKey ;
|
||||
|
||||
private String user_name ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author thomas.he
|
||||
* @Description:
|
||||
* @date 2021/7/27 21:24
|
||||
*/
|
||||
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
|
||||
public class IotSceneVisualBO {
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
private List<IotVisualDisplayInfoBO> visualList;
|
||||
|
||||
public Integer getId()
|
||||
{
|
||||
return this.id; }
|
||||
public String getName() { return this.name; }
|
||||
public List<IotVisualDisplayInfoBO> getVisualList() { return this.visualList; }
|
||||
public void setId(Integer id) { this.id = id; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
public void setVisualList(List<IotVisualDisplayInfoBO> visualList) { this.visualList = visualList; }
|
||||
public String toString() { return "IotSceneVisualBO(id=" + getId() + ", name=" + getName() + ", visualList=" + getVisualList() + ")"; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof IotSceneVisualBO)) return false;
|
||||
IotSceneVisualBO that = (IotSceneVisualBO) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(visualList, that.visualList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, visualList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
import com.lp.bean.IotSensorDeviceInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:IotSensorDeviceInfo
|
||||
* @作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSensorDeviceInfoBO extends IotSensorDeviceInfo {
|
||||
|
||||
public IotSensorDeviceInfoBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private String node_name ;
|
||||
|
||||
@Code
|
||||
private List<IotSensorInfoBO> iotSensorList ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotSensorInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotSensorInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotSensorInfoBO extends IotSensorInfo {
|
||||
|
||||
public IotSensorInfoBO(Integer id){
|
||||
setId(id);
|
||||
}
|
||||
|
||||
private String device_code ;
|
||||
|
||||
private String node_name ;
|
||||
|
||||
private String scene_name ;
|
||||
|
||||
private Integer scene_id ;
|
||||
|
||||
private String iot_sensor_type_array ;
|
||||
|
||||
private List<IotTriggerInfoBO> triggerList = new ArrayList<>();
|
||||
|
||||
private List<historySimpleData> historyDara = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 储存时间
|
||||
*/
|
||||
private Date storeTime;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.annotation.Code;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotNodeInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
|
||||
public class IotStatisticBO {
|
||||
|
||||
private Integer num ;
|
||||
|
||||
private Integer statistic_type ;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotTriggerInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:IotTriggerInfo
|
||||
*@作者:chenrj
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotTriggerInfoBO extends IotTriggerInfo {
|
||||
|
||||
public IotTriggerInfoBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private String from_sensor_name ;
|
||||
|
||||
private String subActionParam ;
|
||||
|
||||
private Integer node_id ;
|
||||
|
||||
// 最近是否触发过
|
||||
private Boolean is_worked ;
|
||||
|
||||
private String sensor_device_id ;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotVideoInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:IotVideoInfo
|
||||
* @作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotVideoInfoBO extends IotVideoInfo {
|
||||
|
||||
public IotVideoInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private String scene_name ;
|
||||
//操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
|
||||
private Integer direction;
|
||||
//云台速度:0-慢,1-适中,2-快,海康设备参数不可为0
|
||||
private Integer speed;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.IotVideoRecord;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @类:IotVideoRecord
|
||||
* @作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IotVideoRecordBO extends IotVideoRecord {
|
||||
|
||||
public IotVideoRecordBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import com.lp.bean.IotVisualDisplayInfo;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
/**
|
||||
* @author thomas.he
|
||||
* @Description:
|
||||
* @date 2021/7/27 21:24
|
||||
*/
|
||||
|
||||
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
|
||||
public class IotVisualDisplayInfoBO extends IotVisualDisplayInfo {
|
||||
|
||||
public IotVisualDisplayInfoBO(Integer id)
|
||||
{
|
||||
setId(id);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "IotVisualDisplayInfoBO()"; }
|
||||
|
||||
public IotVisualDisplayInfoBO() { }
|
||||
public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof IotVisualDisplayInfoBO)) return false; IotVisualDisplayInfoBO other = (IotVisualDisplayInfoBO)o; return (!(other.canEqual(this))); }
|
||||
protected boolean canEqual(Object other) { return other instanceof IotVisualDisplayInfoBO; }
|
||||
public int hashCode() { return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import com.lp.bean.IotVisualMoudleInfo;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
/**
|
||||
* @author thomas.he
|
||||
* @Description:
|
||||
* @date 2021/7/27 21:27
|
||||
*/
|
||||
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
|
||||
public class IotVisualMoudleInfoBO extends IotVisualMoudleInfo
|
||||
{
|
||||
public IotVisualMoudleInfoBO(Integer id)
|
||||
{
|
||||
setId(id);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "IotVisualMoudleInfoBO()"; }
|
||||
|
||||
public IotVisualMoudleInfoBO() { }
|
||||
|
||||
public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof IotVisualMoudleInfoBO)) return false; IotVisualMoudleInfoBO other = (IotVisualMoudleInfoBO)o; return (!(other.canEqual(this))); }
|
||||
protected boolean canEqual(Object other) { return other instanceof IotVisualMoudleInfoBO; }
|
||||
public int hashCode() { return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class OtherBO {
|
||||
|
||||
private Integer online_device_num ;
|
||||
|
||||
private Integer all_device_num ;
|
||||
|
||||
private Integer all_alarm_num ;
|
||||
|
||||
private Integer unsolve_alarm_num ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.ProDictionaryInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ProDictionaryInfoBO extends ProDictionaryInfo {
|
||||
|
||||
public ProDictionaryInfoBO(Integer id) {
|
||||
// TODO Auto-generated constructor stub
|
||||
super.setId(id);
|
||||
}
|
||||
|
||||
private Integer isOnlyP ;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.SysConfigInfo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:SysConfigInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysConfigInfoBO extends SysConfigInfo {
|
||||
|
||||
public SysConfigInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.UserAccountInfo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:UserAccountInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UserAccountInfoBO extends UserAccountInfo {
|
||||
|
||||
public UserAccountInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.User;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UserInfoBO extends User {
|
||||
|
||||
public UserInfoBO(Integer id) {
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
private Integer scene_num ;
|
||||
|
||||
private Integer scene_num_flag ;
|
||||
|
||||
// 注册类型,1 短信注册
|
||||
private Integer register_type ;
|
||||
|
||||
private String newpassword ;
|
||||
|
||||
private Integer sms_num ;
|
||||
|
||||
private Integer voice_num ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import com.lp.bean.VideoFileInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*@类:VideoFileInfo
|
||||
*@作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class VideoFileInfoBO extends VideoFileInfo {
|
||||
|
||||
public VideoFileInfoBO(Integer id) {
|
||||
|
||||
super();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.lp.bo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @作者:M
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
|
||||
public class historySimpleData {
|
||||
|
||||
private String sdata ;
|
||||
|
||||
private Date atime ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.lp.cache;
|
||||
|
||||
/**
|
||||
*
|
||||
* cache的键名
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CacheName {
|
||||
|
||||
/**
|
||||
* 项目字典 code ->obj
|
||||
*/
|
||||
public final static String DICTIONARY = "Dictionary";
|
||||
/**
|
||||
* 项目字典,一级子列表 code -> obj.subList
|
||||
*/
|
||||
public final static String DICTIONARY_RELATION = "DictionaryRelationSub";
|
||||
/**
|
||||
* 用户缓存 userkey -> obj
|
||||
*/
|
||||
public final static String USERINFO = "UserInfo";
|
||||
/**
|
||||
* 中间件LPM缓存 lpmKey -> obj
|
||||
*/
|
||||
// public final static String LPMINFO = "LpmInfo" ;
|
||||
/**
|
||||
* 传感器缓存 id->obj
|
||||
*/
|
||||
public final static String SENSORINFO = "SensorInfo";
|
||||
/**
|
||||
* 传感器缓存 nodeid,sensor_device_id,portid -> obj
|
||||
*/
|
||||
public final static String SENSORINFO_NSP = "SensorInfoNsp";
|
||||
/**
|
||||
* 节点缓存 id -> obj
|
||||
*/
|
||||
public final static String NODEINFO = "NodeInfo";
|
||||
/**
|
||||
* 节点缓存 device_code -> obj
|
||||
*/
|
||||
public final static String NODEINFO_DEVICECODE = "NodeInfoDeviceCode";
|
||||
/**
|
||||
* 场景缓存 id -> obj
|
||||
*/
|
||||
public final static String SCENEINFO = "SceneInfo";
|
||||
|
||||
/**
|
||||
* 传感器触发器列表缓存 obj.getNode_id()+"-"+ obj.getSensor_device_id()+"-"+obj.getPort_id() -> obj . TriggerList
|
||||
*/
|
||||
public final static String SENSORTRIGGERINFO = "SensorTriggerInfo" ;
|
||||
|
||||
/**
|
||||
* 设备离线触发器缓存
|
||||
*/
|
||||
public final static String NODETRIGGERINFO = "NodeTriggerInfo" ;
|
||||
|
||||
|
||||
/**
|
||||
* 网关注册 LPM缓存 device_code -> lpmkey
|
||||
*/
|
||||
public final static String DEVICECODE_LPM ="DeviceCodeToLpmInfo";
|
||||
|
||||
/**
|
||||
* 视频设备信息缓存
|
||||
*/
|
||||
public final static String VIDEO_INFO = "VideoInfo";
|
||||
|
||||
/**
|
||||
* open_id , userinfo 缓存
|
||||
*/
|
||||
public final static String USERINFO_OPENID = "UserInfoOpenId";
|
||||
|
||||
public final static String USERACCOUNT_ID = "UserAccountId" ;
|
||||
|
||||
/**
|
||||
* 用户短信缓存
|
||||
*/
|
||||
public final static String USER_SMS = "UserSms" ;
|
||||
|
||||
/**
|
||||
* 传感器设置缓存
|
||||
*/
|
||||
public final static String SENSOR_PARAM_SETTING = "SensorSetting" ;
|
||||
|
||||
|
||||
public final static String SCENE_IPDATE_FLAG = "SceneUpdateFlag" ;
|
||||
|
||||
public final static String SensorPeroidValue = "SensorPeroidValue" ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.lp.cache;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import net.sf.ehcache.Element;
|
||||
@Service
|
||||
public class EhcacheUtil {
|
||||
|
||||
private static CacheManager manager;
|
||||
@Autowired
|
||||
public void setManager(CacheManager manager) {
|
||||
EhcacheUtil.manager = manager;
|
||||
}
|
||||
public static CacheManager getCacheManager(){
|
||||
return manager;
|
||||
}
|
||||
public static void put(String cacheName, String key, Object value) {
|
||||
Cache cache = manager.getCache(cacheName);
|
||||
Element element = new Element(key, value);
|
||||
cache.put(element);
|
||||
}
|
||||
|
||||
public static Object get(String cacheName, String key) {
|
||||
Cache cache = manager.getCache(cacheName);
|
||||
Element element = cache.get(key);
|
||||
return element == null ? null : element.getObjectValue();
|
||||
}
|
||||
|
||||
public static Cache getCache(String cacheName) {
|
||||
return manager.getCache(cacheName);
|
||||
}
|
||||
|
||||
public static void remove(String cacheName, String key) {
|
||||
Cache cache = manager.getCache(cacheName);
|
||||
cache.remove(key);
|
||||
}
|
||||
|
||||
public static void removeAll(String cacheName) {
|
||||
Cache cache = manager.getCache(cacheName);
|
||||
cache.removeAll();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,388 @@
|
|||
package com.lp.cache;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.lp.bean.IotLpmInfo;
|
||||
import com.lp.bo.IotNodeInfoBO;
|
||||
import com.lp.bo.IotSceneInfoBO;
|
||||
import com.lp.bo.IotSensorInfoBO;
|
||||
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
|
||||
@DependsOn(value = "ehcacheUtil")
|
||||
public class ProCache extends ResultMapUtils {
|
||||
|
||||
@Autowired
|
||||
private BaseDao baseDao;
|
||||
|
||||
@Autowired
|
||||
private TaskExecutor taskExecutor ;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
protected void initCache() throws Exception {
|
||||
// 数据字典
|
||||
taskExecutor.execute(new DictionaryThread(baseDao));
|
||||
// 用户缓存
|
||||
taskExecutor.execute(new UserInfoThread(baseDao));
|
||||
// 传感器缓存
|
||||
taskExecutor.execute(new IotSensorInfoThread(baseDao));
|
||||
// LPM 中间件缓存
|
||||
// taskExecutor.execute(new LpmInfoThread(baseDao));
|
||||
// 网关缓存
|
||||
taskExecutor.execute(new IotNodeInfoThread(baseDao));
|
||||
// 传感器触发列表缓存
|
||||
taskExecutor.execute(new IotSensorTriggerThread(baseDao));
|
||||
// 场景缓存
|
||||
taskExecutor.execute(new IotSceneInfoThread(baseDao));
|
||||
|
||||
// 视频信息缓存
|
||||
taskExecutor.execute(new IotVideoInfoThread(baseDao));
|
||||
|
||||
// 触发器缓存信息
|
||||
taskExecutor.execute(new IotNodeSensorTriggerThread(baseDao));
|
||||
|
||||
// 用户缓存信息
|
||||
taskExecutor.execute(new UserAccountThread(baseDao));
|
||||
|
||||
// 系统信息初始化
|
||||
taskExecutor.execute(new SysInfoInit(baseDao));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统信息初始化
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class SysInfoInit implements Runnable {
|
||||
private BaseDao baseDao;
|
||||
public SysInfoInit(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
List<SysConfigInfoBO> sysList = baseDao.selectList("SysConfigInfo.select", new SysConfigInfoBO());
|
||||
Map<String,String> map = new HashedMap();
|
||||
for(SysConfigInfoBO obj :sysList ){
|
||||
map.put(obj.getName(), obj.getValue());
|
||||
}
|
||||
// 更新配置信息
|
||||
ProConfig.LOCAL_DOMAIN = map.get("server.domain" );
|
||||
ProConfig.IMAGE_DOMAIN = map.get( "server.image.domain" );
|
||||
ProConfig.LOCAL_FILE_PATH = map.get("server.file.local.path" );
|
||||
|
||||
ProConfig.PROJECT_NAME = map.get("sys.borwser.name" );
|
||||
ProConfig.SYS_WEB_LOGIN_NAME = map.get("sys.web.login.name" );
|
||||
ProConfig.SYS_APP_LOGIN_NAME = map.get("sys.app.login.name" );
|
||||
ProConfig.SYS_INFO_NAME = map.get("sys.info.name" );
|
||||
|
||||
ProConfig.SYS_TECH_HELP = map.get("sys.tech.help") ;
|
||||
|
||||
ProConfig.SYS_BEIAN_NAME = map.get("sys.beian.name");
|
||||
|
||||
ProConfig.SYS_WEB_SCREEN_NAME = map.get("sys_web_screen_name" );
|
||||
|
||||
ProConfig.APP_NODE_DATA_SAVE = map.get("app.node.data.save" );
|
||||
|
||||
ProConfig.EZUIZ_APPKEY = map.get("ezuiz.app.key");
|
||||
|
||||
ProConfig.EZUIZ_APPSECRET = map.get("ezuiz.app.secret");
|
||||
|
||||
//配置加载完成后初始化token
|
||||
EzuizService.refreshToken();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动刷新整个缓存
|
||||
*/
|
||||
public void refleshCache(String name){
|
||||
if(CacheName.DICTIONARY.equals(name)){
|
||||
ProCacheUtil.removeAll(name);
|
||||
ProCacheUtil.removeAll(CacheName.DICTIONARY_RELATION);
|
||||
// 数据字典
|
||||
taskExecutor.execute(new DictionaryThread(baseDao));
|
||||
|
||||
}else if("sysInfo".equals(name)){
|
||||
// 系统信息初始化
|
||||
taskExecutor.execute(new SysInfoInit(baseDao));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目字典
|
||||
*/
|
||||
public class DictionaryThread implements Runnable {
|
||||
|
||||
private BaseDao baseDao;
|
||||
|
||||
public DictionaryThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<ProDictionaryInfoBO> list = baseDao.selectList("ProDictionaryInfo.selectList", new ProDictionaryInfoBO());
|
||||
if(!ObjectUtil.isEmpty(list)){
|
||||
// 线性缓存
|
||||
for(ProDictionaryInfoBO obj : list){
|
||||
EhcacheUtil.put(CacheName.DICTIONARY, obj.getCode().toString() ,obj);
|
||||
}
|
||||
// 父子关系缓存 - 目前只处理二级关系
|
||||
for(ProDictionaryInfoBO obj : list){
|
||||
if( ObjectUtil.isEmpty(obj.getP_code()) ){
|
||||
ProCacheUtil.addCache(CacheName.DICTIONARY_RELATION, obj.getCode().toString(), obj);
|
||||
}else{
|
||||
if(ObjectUtil.isNotEmpty(ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION,obj.getP_code().toString(),obj))){
|
||||
ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION,
|
||||
obj.getP_code().toString(), obj).getSub().add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户账户表缓存
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class UserAccountThread implements Runnable {
|
||||
private BaseDao baseDao;
|
||||
|
||||
public UserAccountThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<UserAccountInfoBO> list = baseDao.selectList("UserAccountInfo.select", new UserAccountInfoBO());
|
||||
if(!ObjectUtil.isEmpty(list)){
|
||||
for(UserAccountInfoBO obj : list){
|
||||
ProCacheUtil.addCache(CacheName.USERACCOUNT_ID, obj.getUser_id().toString() ,obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户缓存
|
||||
*/
|
||||
public class UserInfoThread implements Runnable {
|
||||
|
||||
private BaseDao baseDao;
|
||||
|
||||
public UserInfoThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<UserInfoBO> list = baseDao.selectList("UserInfo.selects", null);
|
||||
if(!ObjectUtil.isEmpty(list)){
|
||||
for(UserInfoBO obj : list){
|
||||
ProCacheUtil.addCache(CacheName.USERINFO, obj.getUser_key() ,obj);
|
||||
ProCacheUtil.addCache(CacheName.USERINFO_OPENID, obj.getWx_open_id(), obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* lpm 缓存
|
||||
*/
|
||||
// public class LpmInfoThread implements Runnable{
|
||||
//
|
||||
// private BaseDao baseDao;
|
||||
// public LpmInfoThread(BaseDao baseDao) {
|
||||
// super();
|
||||
// this.baseDao = baseDao;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// List<IotLpmInfo> iotLpmList = baseDao.selectList("IotLpmInfo.select", new IotLpmInfo());
|
||||
// if( ObjectUtil.isNotEmpty(iotLpmList) ){
|
||||
// for(IotLpmInfo obj: iotLpmList){
|
||||
// ProCacheUtil.addCache(CacheName.LPMINFO, obj.getLpm_key(), obj);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* sensor 缓存
|
||||
*/
|
||||
public class IotSensorInfoThread implements Runnable{
|
||||
|
||||
private BaseDao baseDao;
|
||||
public IotSensorInfoThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IotSensorInfoBO objt = new IotSensorInfoBO();
|
||||
// 所有传感器的包含配置和数据
|
||||
objt.setData_type(-1);
|
||||
List<IotSensorInfoBO> iotSensorInfoList = baseDao.selectList("IotSensorInfo.select", objt);
|
||||
if( ObjectUtil.isNotEmpty(iotSensorInfoList) ){
|
||||
for(IotSensorInfoBO obj: iotSensorInfoList){
|
||||
ProCacheUtil.addCache(CacheName.SENSORINFO, obj.getId()+"", obj);
|
||||
ProCacheUtil.addCache(CacheName.SENSORINFO_NSP,
|
||||
obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scene 缓存
|
||||
*/
|
||||
public class IotSceneInfoThread implements Runnable{
|
||||
|
||||
private BaseDao baseDao;
|
||||
public IotSceneInfoThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<IotSceneInfoBO> iotSceneInfo = baseDao.selectList("IotSceneInfo.select", new IotSceneInfoBO());
|
||||
if( ObjectUtil.isNotEmpty(iotSceneInfo) ){
|
||||
for(IotSceneInfoBO obj: iotSceneInfo){
|
||||
ProCacheUtil.addCache(CacheName.SCENEINFO, obj.getId().toString(), obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Node 缓存
|
||||
*/
|
||||
public class IotNodeInfoThread implements Runnable{
|
||||
|
||||
private BaseDao baseDao;
|
||||
public IotNodeInfoThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<IotNodeInfoBO> iotNodeInfoList = baseDao.selectList("IotNodeInfo.select", new IotNodeInfoBO());
|
||||
if( ObjectUtil.isNotEmpty(iotNodeInfoList) ){
|
||||
for(IotNodeInfoBO obj: iotNodeInfoList){
|
||||
ProCacheUtil.addCache(CacheName.NODEINFO, obj.getId().toString(), obj);
|
||||
ProCacheUtil.addCache(CacheName.NODEINFO_DEVICECODE, obj.getDevice_code(), obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sensor trigger List 缓存
|
||||
*/
|
||||
public class IotSensorTriggerThread implements Runnable{
|
||||
|
||||
private BaseDao baseDao;
|
||||
public IotSensorTriggerThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<IotSensorInfoBO> iotSensorInfoBOList = baseDao.selectList("IotSensorInfo.selectSensorTriggerList", new IotSensorInfoBO());
|
||||
if( ObjectUtil.isNotEmpty(iotSensorInfoBOList) ){
|
||||
for(IotSensorInfoBO obj: iotSensorInfoBOList){
|
||||
ProCacheUtil.addCache(CacheName.SENSORTRIGGERINFO, obj.getNode_id()+"-"+ obj.getSensor_device_id()+"-"+obj.getPort_id(), obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* node trigger List 缓存
|
||||
*/
|
||||
public class IotNodeSensorTriggerThread implements Runnable{
|
||||
private BaseDao baseDao;
|
||||
public IotNodeSensorTriggerThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IotTriggerInfoBO triggerInfo = new IotTriggerInfoBO();
|
||||
triggerInfo.setIot_trigger_condition_type(280);
|
||||
List<IotTriggerInfoBO> iotTriggerInfoBOList = baseDao.selectList("IotTriggerInfo.select", triggerInfo) ;
|
||||
if( ObjectUtil.isNotEmpty(iotTriggerInfoBOList) ){
|
||||
for(IotTriggerInfoBO obj: iotTriggerInfoBOList){
|
||||
obj.setIs_worked(true);
|
||||
List<IotTriggerInfoBO> objs = ProCacheUtil.getCache(CacheName.NODETRIGGERINFO, obj.getNode_id().toString()) ;
|
||||
if( ObjectUtil.isNotEmpty( objs ) ){
|
||||
objs.add(obj);
|
||||
}else{
|
||||
objs = new ArrayList<>();
|
||||
objs.add(obj);
|
||||
ProCacheUtil.addCache(CacheName.NODETRIGGERINFO, obj.getNode_id().toString() , objs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频缓存
|
||||
*/
|
||||
public class IotVideoInfoThread implements Runnable{
|
||||
|
||||
private BaseDao baseDao;
|
||||
public IotVideoInfoThread(BaseDao baseDao) {
|
||||
super();
|
||||
this.baseDao = baseDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<IotVideoInfoBO> iotVideoInfoBOList = baseDao.selectList("IotVideoInfo.select", new IotVideoInfoBO());
|
||||
if( ObjectUtil.isNotEmpty(iotVideoInfoBOList) ){
|
||||
for(IotVideoInfoBO obj: iotVideoInfoBOList){
|
||||
ProCacheUtil.addCache(CacheName.VIDEO_INFO, obj.getDevice_serial() , obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.lp.cache;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.lp.bo.IotTriggerInfoBO;
|
||||
|
||||
public class ProCacheUtil {
|
||||
|
||||
/**
|
||||
* 临时存储触发条件带时间的触发器(触发是判断是否需要触发)
|
||||
*/
|
||||
public static Map<Integer, IotTriggerInfoBO> timeTirggerListCache = new ConcurrentHashMap<Integer, IotTriggerInfoBO>();
|
||||
|
||||
|
||||
public static void addCache(String cacheName , String key ,Object o ){
|
||||
EhcacheUtil.put(cacheName, key, o);
|
||||
}
|
||||
|
||||
public static <T> T getCache(String cacheName , String key,T a){
|
||||
return (T) EhcacheUtil.get(cacheName, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这边作为一个优化补丁
|
||||
* @param cacheName
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static <T> T getCache(String cacheName , String key){
|
||||
return (T) EhcacheUtil.get(cacheName, key);
|
||||
}
|
||||
|
||||
public static void removeCache(String cacheName , String key){
|
||||
EhcacheUtil.remove(cacheName, key);
|
||||
}
|
||||
|
||||
public static void removeAll(String cacheName ){
|
||||
EhcacheUtil.removeAll(cacheName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
package com.lp.cfg;
|
||||
|
||||
import com.lp.util.PropertiesUtil;
|
||||
|
||||
/**
|
||||
* config 属性文件
|
||||
*
|
||||
*/
|
||||
public class ProConfig {
|
||||
|
||||
|
||||
|
||||
public final static long VERSION = System.currentTimeMillis();
|
||||
|
||||
public static String LOCAL_DOMAIN= "" ;
|
||||
|
||||
public static String IMAGE_DOMAIN = "" ;
|
||||
|
||||
public static String VIDEO_DOMAIN = "" ;
|
||||
|
||||
public static String LOCAL_FILE_PATH = "";
|
||||
|
||||
public static String PROJECT_NAME = "" ;
|
||||
|
||||
public static String SYS_WEB_LOGIN_NAME = "";
|
||||
|
||||
public static String SYS_APP_LOGIN_NAME = "";
|
||||
|
||||
public static String SYS_INFO_NAME = "";
|
||||
|
||||
public static String SYS_TECH_HELP = "";
|
||||
|
||||
public static String SYS_BEIAN_NAME = "";
|
||||
|
||||
public static String APP_TIME_TASK_PERIOD = "";
|
||||
|
||||
public static String SYS_WEB_SCREEN_NAME = "";
|
||||
|
||||
public static String APP_NODE_DATA_SAVE = "" ;
|
||||
|
||||
public static String EZUIZ_APPKEY = "";
|
||||
|
||||
public static String EZUIZ_APPSECRET = "";
|
||||
|
||||
public final static String PAGE_SIZE = PropertiesUtil.getProperty("page.size");
|
||||
|
||||
public final static String DEV_MODE = PropertiesUtil.getProperty("dev.mode");
|
||||
|
||||
public final static String BD_API_GEOCODER = PropertiesUtil.getProperty("bd.api.geocoder");
|
||||
|
||||
// public final static String SENSOR_ICON_SELF_FLAG = PropertiesUtil.getProperty("sensor.icon.self.flag") ;
|
||||
|
||||
public static class Mail{
|
||||
public final static String HOST = PropertiesUtil.getProperty("mail.config" ,"mail.host") ;
|
||||
public final static String PORT= PropertiesUtil.getProperty("mail.config" ,"mail.port");
|
||||
public final static String USERNAME = PropertiesUtil.getProperty("mail.config" ,"mail.username");
|
||||
public final static String PASSWORD = PropertiesUtil.getProperty("mail.config" ,"mail.password");
|
||||
public final static String SMTP_AUTH = PropertiesUtil.getProperty("mail.config" ,"mail.smtp.auth");
|
||||
public final static String SMTP_TIMEOUT = PropertiesUtil.getProperty("mail.config" ,"mail.smtp.timeout");
|
||||
public final static String DEFAULT_FROM = PropertiesUtil.getProperty("mail.config" ,"mail.default.from");
|
||||
}
|
||||
|
||||
public static class Map{
|
||||
public final static String BAIDU_MAP_KEY = PropertiesUtil.getProperty("map.config" ,"baidu.map.api.key") ;
|
||||
}
|
||||
|
||||
public static class ShortMessageYunpian{
|
||||
/**
|
||||
* api_key
|
||||
*/
|
||||
public final static String API_KEY = PropertiesUtil.getProperty("sms.config", "sms.yunpian.api_key");
|
||||
/**
|
||||
* 验证码模板ID
|
||||
*/
|
||||
public final static String TPL_ID_VALIDATE_CODE = PropertiesUtil.getProperty("sms.config",
|
||||
"sms.yunpian.tpl.id.validate.code");
|
||||
/**
|
||||
* /** 签名
|
||||
*/
|
||||
public final static String SIGNATURE = PropertiesUtil.getProperty("sms.config", "sms.yunpian.signature");
|
||||
}
|
||||
|
||||
|
||||
public static class AliyunShortMessage{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String ACCESSKEY = PropertiesUtil.getProperty("sms.config", "aliyun.accesskey");
|
||||
|
||||
public final static String ACCESSKEYSECRET = PropertiesUtil.getProperty("sms.config", "aliyun.accesskeysecret");
|
||||
|
||||
public final static String SIGNATURE = PropertiesUtil.getProperty("sms.config", "aliyun.signname");
|
||||
|
||||
public final static String CALLEDSHOWNUMBER = PropertiesUtil.getProperty("sms.config", "aliyun.calledshownumber");
|
||||
|
||||
public final static String SMS_TEMPCODE1 = PropertiesUtil.getProperty("sms.config", "aliyun.sms.templatecode1");
|
||||
public final static String SMS_TEMPCODE2 = PropertiesUtil.getProperty("sms.config", "aliyun.sms.templatecode2");
|
||||
public final static String SMS_TEMPCODE3 = PropertiesUtil.getProperty("sms.config", "aliyun.sms.templatecode3");
|
||||
public final static String SMS_TEMPCODE4 = PropertiesUtil.getProperty("sms.config", "aliyun.sms.templatecode4");
|
||||
|
||||
public final static String VOICE_TEMPLATE1 = PropertiesUtil.getProperty("sms.config", "aliyun.voice.templatecode1");
|
||||
public final static String VOICE_TEMPLATE2 = PropertiesUtil.getProperty("sms.config", "aliyun.voice.templatecode2");
|
||||
public final static String VOICE_TEMPLATE3 = PropertiesUtil.getProperty("sms.config", "aliyun.voice.templatecode3");
|
||||
public final static String VOICE_TEMPLATE4 = PropertiesUtil.getProperty("sms.config", "aliyun.voice.templatecode4");
|
||||
|
||||
public final static String SMS_TEMPLATE_CODE = PropertiesUtil.getProperty("sms.config", "aliyun.validate.code");
|
||||
|
||||
public final static String SMS_LOGIN_TEMPLATE_CODE = PropertiesUtil.getProperty("sms.config", "aliyun.validate.login.code");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class MQTT {
|
||||
|
||||
public static final String USERNAME = PropertiesUtil.getProperty("mqtt.config" ,"mqtt.username") ;
|
||||
|
||||
public static final String PASSWORD = PropertiesUtil.getProperty("mqtt.config" ,"mqtt.password") ;
|
||||
|
||||
public static final String MQTTSIMPLEURI = PropertiesUtil.getProperty("mqtt.config" ,"mqtt.simpleURI") ;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信公众号配置
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public static class WEIXIN{
|
||||
|
||||
public final static String MP_OAUTH2_REDIRECT_URI = PropertiesUtil.getProperty("weixin.config","weixin.mp.oauth2.redirect_uri");
|
||||
|
||||
public final static String MP_NOTIFY_URL = LOCAL_DOMAIN + PropertiesUtil.getProperty("weixin.config","weixin.pay.notify_url");
|
||||
|
||||
public final static String APP_ID = PropertiesUtil.getProperty("weixin.config" ,"weixin.mp.appid");
|
||||
|
||||
public final static String MCH_ID = PropertiesUtil.getProperty("weixin.config" ,"weixin.mp.mch.id");
|
||||
|
||||
public final static String MCH_SERECT = PropertiesUtil.getProperty("weixin.config" ,"weixin.mp.mch.key");
|
||||
|
||||
/**
|
||||
* 传感点报警消息
|
||||
*/
|
||||
public final static String NOTICE_1 = PropertiesUtil.getProperty("weixin.config" ,"weixin.msg.tpl.NOTICE_1");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String NOTICE_2 = PropertiesUtil.getProperty("weixin.config" ,"weixin.msg.tpl.NOTICE_2");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String NOTICE_3 = PropertiesUtil.getProperty("weixin.config" ,"weixin.msg.tpl.NOTICE_3");
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String NOTICE_4 = PropertiesUtil.getProperty("weixin.config" ,"weixin.msg.tpl.NOTICE_4");
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String NOTICE_5 = PropertiesUtil.getProperty("weixin.config" ,"weixin.msg.tpl.NOTICE_5");
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String NOTICE_6 = PropertiesUtil.getProperty("weixin.config" ,"weixin.msg.tpl.NOTICE_6");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.lp.common;
|
||||
|
||||
public class Code {
|
||||
|
||||
/**
|
||||
* 返回状态
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public static class ResponseCode{
|
||||
|
||||
public static class SystemCode{
|
||||
|
||||
public final static Integer OK = 2 ;
|
||||
|
||||
public final static Integer ERROR = 3 ;
|
||||
|
||||
public final static Integer NO_DATA = 4 ;
|
||||
|
||||
public final static Integer PARAM_ERROR = 5;
|
||||
|
||||
public final static Integer EXEC_FAIL = 9;
|
||||
|
||||
public final static Integer NO_AUTHORIZATION = 11;
|
||||
|
||||
public final static Integer ACTIVE_CODE_OVERDUE = 62;
|
||||
|
||||
public final static Integer ACTIVED= 63 ;
|
||||
|
||||
public final static Integer NO_ACTIVE_CODE = 65 ;
|
||||
|
||||
public final static Integer VALIDATER_ALLER = 93 ;
|
||||
|
||||
public final static Integer CODE_TIME_ERROR = 94 ;
|
||||
|
||||
public final static Integer CODE_ERROR = 95 ;
|
||||
|
||||
public final static Integer PASSWORD_ERROR = 14 ;
|
||||
|
||||
}
|
||||
|
||||
public static class UserInfo{
|
||||
|
||||
public final static Integer USER_EXIST = 12 ;
|
||||
|
||||
public static final Integer USER_NOT_EXISTS = 13;
|
||||
|
||||
public final static Integer USERNAME_OR_PASSWORD_ERROR = 14 ;
|
||||
|
||||
public final static Integer NAME_EXIST = 66 ;
|
||||
|
||||
public final static Integer EMAIL_EXIST = 67 ;
|
||||
|
||||
public final static Integer PHONE_EXIST = 68 ;
|
||||
|
||||
}
|
||||
|
||||
public static class IotInfo{
|
||||
public final static Integer DEVICE_CODE_EXIST = 70 ;
|
||||
|
||||
public final static Integer DEVICE_CODE_NOT_EXIST = 380 ;
|
||||
|
||||
public final static Integer DEVICE_CODE_USED = 381 ;
|
||||
|
||||
public final static Integer VIDEO_INFO_REPEAT = 86 ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public static class UserType{
|
||||
|
||||
public final static Integer Normal = 7 ;
|
||||
|
||||
public final static Integer MANAGER = 8 ;
|
||||
|
||||
public final static Integer SUPER = 10 ;
|
||||
|
||||
}
|
||||
|
||||
public static class UserStatus{
|
||||
public final static Integer UN_ACTIVED = 59 ;
|
||||
public final static Integer NORMAL = 60 ;
|
||||
public final static Integer FORBIDDEN = 61;
|
||||
}
|
||||
|
||||
public static class DEVICE_STATUS{
|
||||
//在线
|
||||
public final static Integer ONLINE = 16;
|
||||
//设备离线
|
||||
public final static Integer OFFLINE = 17;
|
||||
//未连接
|
||||
public final static Integer UNCONTECT = 18;
|
||||
//故障
|
||||
public final static Integer FAILURE = 19;
|
||||
}
|
||||
|
||||
public static class VIDEO_INPUT_TYPE{
|
||||
//远程推流
|
||||
public final static Integer AUTO_INPUT = 79;
|
||||
//萤石云转发
|
||||
public final static Integer HIK_INPUT = 80;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package com.lp.common;
|
||||
|
||||
public class CodeIot extends Code {
|
||||
|
||||
/**
|
||||
* 设备打开数值
|
||||
*/
|
||||
public static class DEVICE_STATUS_VALUE{
|
||||
public static final Integer DEVICE_OPEN = 65535 ;
|
||||
|
||||
public static final Integer DEVICE_CLOSE = 0 ;
|
||||
}
|
||||
|
||||
/*
|
||||
* 传感器类型
|
||||
*/
|
||||
public static class SENSOR_TYPE {
|
||||
public static final Integer POSITION = 90 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 传感器单位
|
||||
*/
|
||||
public static class SENSOR_MEASURE_UNIT_TYPE {
|
||||
|
||||
public static final Integer LOCALON = 92 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public static class DEVICE_STATUS{
|
||||
|
||||
public static final Integer ONLINE = 16 ;
|
||||
|
||||
public static final Integer OFFLINE = 17 ;
|
||||
|
||||
public static final Integer UNCONTECT = 18;
|
||||
|
||||
public static final Integer FAILURE = 19 ;
|
||||
}
|
||||
/**
|
||||
* 触发器状态
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public static class IOT_TRIGGER_STATUS{
|
||||
|
||||
public static final Integer NORMAL = 43 ;
|
||||
|
||||
public static final Integer STOP = 44 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发器类型
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public static class TRIGGER_CONDITION_TYPE{
|
||||
|
||||
public static final Integer OVERTOPX = 29;
|
||||
|
||||
public static final Integer UNDERY = 30 ;
|
||||
|
||||
public static final Integer XY_OVERMIDDLE = 31 ;
|
||||
|
||||
public static final Integer EQUAL =32 ;
|
||||
|
||||
public static final Integer OVERTOPX_OVERTIME = 33;
|
||||
|
||||
public static final Integer UNDERY_OVERTIME =34 ;
|
||||
|
||||
public static final Integer SENSOR_VALUE_MONITOR = 110 ;
|
||||
|
||||
public static final Integer PEROID_MAX_OVER_PERCENT = 111 ;
|
||||
|
||||
public static final Integer PEROID_MIN_OVER_PERCENT = 112 ;
|
||||
|
||||
public static final Integer EXCEPTION_DATA_SOLVE = 189 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警开关
|
||||
*/
|
||||
public static class ALARM_FLAG{
|
||||
public static final Integer OPEN = 36 ;
|
||||
|
||||
public static final Integer CLOSE = 37 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发类型
|
||||
*/
|
||||
public static class ACTION_TYPE {
|
||||
public static final Integer CONTROL_DEVICE = 50 ;
|
||||
public static final Integer MESSAGE_WECHAT = 51 ;
|
||||
public static final Integer MESSAGE_SMS = 52 ;
|
||||
public static final Integer MESSAGE_MAIL = 53 ;
|
||||
public static final Integer MESSAGE_VOICE = 360 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理标志
|
||||
*/
|
||||
public static class PROCESS_STATUS {
|
||||
public static final Integer NO = 46 ;
|
||||
public static final Integer YES = 47 ;
|
||||
public static final Integer TAGGING = 48 ;
|
||||
}
|
||||
|
||||
public static class IOT_NODE_STATUS{
|
||||
public static final Integer HTTP = 82;
|
||||
public static final Integer MQTT = 84;
|
||||
public static final Integer TCP = 83;
|
||||
|
||||
public static final Integer UDP = 105 ;
|
||||
}
|
||||
|
||||
public static class IOT_NODE_PROTOCOL{
|
||||
public static final Integer HTTP = 82;
|
||||
public static final Integer MQTT = 84;
|
||||
public static final Integer TCP = 83;
|
||||
|
||||
public static final Integer UDP = 105 ;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.lp.common;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static class DELETE{
|
||||
|
||||
public final static Integer YES = 1 ;
|
||||
|
||||
public final static Integer NO = 0;
|
||||
|
||||
}
|
||||
|
||||
public static class CodeType{
|
||||
|
||||
public final static int DICTIONARY_CODE = 0;
|
||||
|
||||
public final static int DICTIONARY_VALUE = 1 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片类型分类
|
||||
*/
|
||||
public static class FileRealPath {
|
||||
|
||||
public final static String NORMAL = "/normal" ;
|
||||
|
||||
public final static String QRCODE = "/qrcode" ;
|
||||
|
||||
public final static String DEVICEPATH = "/device" ;
|
||||
|
||||
}
|
||||
|
||||
public static class WeiXinTemplate{
|
||||
public final static String FIRST = "first" ;
|
||||
|
||||
public final static String KEYWORD1 = "keyword1";
|
||||
|
||||
public final static String KEYWORD2 = "keyword2";
|
||||
|
||||
public final static String KEYWORD3 = "keyword3";
|
||||
|
||||
public final static String KEYWORD4 = "keyword4";
|
||||
|
||||
public final static String KEYWORD5 = "keyword5";
|
||||
|
||||
public final static String REMARK = "remark";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.lp.common;
|
||||
|
||||
/**
|
||||
* @author thomas.he
|
||||
* @Description:
|
||||
* @date 2021/7/27 21:30
|
||||
*/
|
||||
public enum ErrorCodeEnum {
|
||||
|
||||
VISITOR_NAME_REPEAT;
|
||||
|
||||
private Integer code;
|
||||
private String desc;
|
||||
|
||||
public Integer getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ErrorCodeEnum{code='" + this.code + '\'' + ", desc='" + this.desc + '\'' + '}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
package com.lp.common;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class RequestURL {
|
||||
|
||||
public class Base {
|
||||
|
||||
}
|
||||
/**
|
||||
* 数据字典
|
||||
*
|
||||
*/
|
||||
public class ProDictionaryInfo {
|
||||
|
||||
public final static String PRO_DICTIONARY_INFO = "/dictionary";
|
||||
|
||||
public final static String GET_PRO_DICTIONARY_INFO = "/get-dictionary";
|
||||
|
||||
public final static String PRO_DICTIONARY_INFO_PAGE = "/page/dictionary";
|
||||
|
||||
public final static String PRO_DICTIONARY_INFO_SEL = "/dictionary/{p_code}" ;
|
||||
|
||||
public final static String GEN_DICTIONARY_INFO_SEL = "/gen/dictionary" ;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
*/
|
||||
public class User{
|
||||
|
||||
public final static String USER_REGISTER = "/user/register";
|
||||
|
||||
public final static String WP_USER_LOGIN = "/wp/user/login" ;
|
||||
|
||||
/**
|
||||
* WP 微信小程序
|
||||
*/
|
||||
public final static String WP_USER_BIND = "/wp/user/bind";
|
||||
|
||||
/**
|
||||
* wx公众号绑定
|
||||
*/
|
||||
public final static String WX_USER_BIND = "/wx/user/bind";
|
||||
|
||||
public final static String USER_LOGIN = "/user/login";
|
||||
|
||||
public final static String USER_SMS_LOGIN = "/user/sms/login";
|
||||
|
||||
public final static String USER_LOGOUT = "/user/logout";
|
||||
|
||||
public final static String USER_ID = "/user/{id}";
|
||||
|
||||
public final static String USERS = "/users";
|
||||
|
||||
public final static String USER = "/user";
|
||||
|
||||
public final static String USER_MODIFY_PASSWORD = "/user/modify/password" ;
|
||||
|
||||
public final static String USER_INFO = "/user/info";
|
||||
|
||||
public final static String USER_SCREEN = "/user/user-screen";
|
||||
|
||||
public final static String USER_INFO_MODIFY = "/user/self";
|
||||
|
||||
public final static String USER_PAGE = "/page/user";
|
||||
|
||||
public final static String RESET_PASSWORD = "/user/reset/password";
|
||||
|
||||
public final static String BIND_SUB_ACCOUNT = "/bind/sub/account" ;
|
||||
|
||||
/**
|
||||
* 账号验证码
|
||||
*/
|
||||
public final static String ACCOUNT_SECURITY_CODE = "/security_code/{phone}";
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
public final static String VALIDATE_BY_NAME = "/validate/{name}";
|
||||
/**
|
||||
* 图片验证码
|
||||
*/
|
||||
public final static String IMG_SECURITY_CODE = "/security_code/img";
|
||||
|
||||
public final static String MAIL_MESSAGE = "/mail/{validatecode}" ;
|
||||
|
||||
public final static String MAIL_RESET_PASSWORD_MESSAGE = "/mail/reset/password/{validatecode}" ;
|
||||
}
|
||||
|
||||
public static final class FileInfo {
|
||||
|
||||
public static final String FILE_INFO_PAGE = "/page/fileInfo";
|
||||
|
||||
public static final String FILE_INFO = "/fileInfo";
|
||||
|
||||
public static final String UPLOAD = "/upload";
|
||||
|
||||
public static final String FILE_SENSOR_ICO = "/sensor/ico/upload" ;
|
||||
|
||||
// base64 保存图片
|
||||
public static final String BASE64_FILE_INFO = "/base64/fileInfo" ;
|
||||
|
||||
}
|
||||
|
||||
public static final class SysConfigInfo {
|
||||
|
||||
public static final String SYS_CONFIG_INFO_PAGE ="/sys/confog/page/info" ;
|
||||
|
||||
public static final String SYS_CONFIG_INFO ="/sys/confog/info" ;
|
||||
|
||||
public static final String SYS_CONFIG_INFO_EKY ="/sys/confog/info/{key}" ;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,314 @@
|
|||
package com.lp.common;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class RequestURLIOT {
|
||||
|
||||
/**
|
||||
* 场景信息
|
||||
*
|
||||
*/
|
||||
public class SceneInfo {
|
||||
|
||||
public final static String SCENE_INFO = "/scene";
|
||||
|
||||
public final static String ADMIN_SCENE_INFO_PAGE = "/admin/page/scene";
|
||||
|
||||
public final static String SCENE_INFO_PAGE = "/page/scene";
|
||||
|
||||
public final static String SCENE_INFO_ALL = "/page/scene-all";
|
||||
|
||||
public final static String SCENE_TRIGGER_SENSOR = "/scene/trigger-sensor";
|
||||
|
||||
public final static String SELF_SCENE_INFO_PAGE = "/self/page/scene";
|
||||
|
||||
public final static String SCENE_DETAILL = "/scene/detail" ;
|
||||
}
|
||||
|
||||
public class NodeInfo {
|
||||
public final static String NODE_INFO = "/node";
|
||||
|
||||
public final static String NODE_DATA_SAVE = "/save/node/data" ;
|
||||
|
||||
public final static String NODE_BIND = "/node/bind" ;
|
||||
|
||||
public final static String ADMIN_NODE_INFO_PAGE = "/admin/page/node";
|
||||
|
||||
public final static String ADMIN_UNUSED_NODES = "/admin/unused/nodes";
|
||||
|
||||
public final static String NODE_INFO_PAGE = "/page/node";
|
||||
|
||||
public final static String NODE_INFO_ALL = "/page/node-all";
|
||||
|
||||
public final static String NODE_STATISTIC = "/node/statistic";
|
||||
|
||||
public final static String NODE_GUARANTEE = "/node/guarantee";
|
||||
|
||||
public final static String NODE_INFO_MAP = "/page/node-map";
|
||||
|
||||
public final static String NODE_STATUS_INFO = "/node/status";
|
||||
|
||||
public final static String NODE_DATA_INFO_SYNC = "/node/data/sync" ;
|
||||
|
||||
public final static String NODE_INFO_SENSOR_INFO_PAGE = "/page/node/sensor/list";
|
||||
|
||||
public final static String NODE_INFO_SENSOR_INFO_PAGES = "/page/node/sensor/lists";
|
||||
|
||||
}
|
||||
|
||||
public class SensorInfo {
|
||||
public final static String SENSOR_INFO = "/sensor";
|
||||
|
||||
public final static String SENSOR_INFO_PAGE = "/page/sensor";
|
||||
|
||||
public final static String SENSOR_CONTROL_VALUE = "/sensor/control/realtime/update";
|
||||
|
||||
/**
|
||||
* 参数下发
|
||||
*/
|
||||
public final static String SENSOR_PARAM_SETTING_DOWN = "/sensor/param/down" ;
|
||||
|
||||
/**
|
||||
* 参数读取
|
||||
*/
|
||||
public final static String SENSOR_PARAM_SETTING_READ = "/sensor/param/read" ;
|
||||
/**
|
||||
* 参数设置成功回复
|
||||
*/
|
||||
public final static String SENSOR_PARAM_SETTING_REPLAY = "/sensor/param/setting/success" ;
|
||||
|
||||
public final static String SENSOR_VALUE = "/sensor/realtime/update";
|
||||
|
||||
public final static String SENSORS_VALUE = "/sensors/realtime/update";
|
||||
|
||||
public final static String SENSOR_GPS_VALUE = "/sensor/gps" ;
|
||||
|
||||
public final static String SENSOR_REALTIME_VALUE = "/sensor/realtime/data" ;
|
||||
|
||||
public final static String NODE_REALTIME_VALUE = "/node/realtime/data" ;
|
||||
|
||||
public final static String SENSOR_REALTIME_CONTROL = "/sensor/realtime/control" ;
|
||||
}
|
||||
|
||||
public class SensorHistoryInfo {
|
||||
public final static String SENSOR_HISTORY_INFO = "/sensor/history";
|
||||
|
||||
public final static String SENSOR_HISTORY_INFO_PAGE = "/page/sensor/history";
|
||||
|
||||
public final static String SENSOR_HISTORY_INFO_LIST = "/list/sensor/history";
|
||||
|
||||
public final static String SENSOR_HISTORY_INFO_INFO = "/sensor/history/excel";
|
||||
|
||||
public final static String SENSORS_HISTORY_DATA = "/sensor/history/data" ;
|
||||
}
|
||||
|
||||
public class AlarmInfo {
|
||||
public final static String ALARM_INFO = "/alarm";
|
||||
|
||||
public final static String ALARM_INFO_PAGE = "/page/alarm";
|
||||
|
||||
public final static String ALARM_INFO_STATISTIC = "/alarm/info/statistic";
|
||||
|
||||
public final static String ALARM_INFO_ALL = "/page/alarm-all";
|
||||
|
||||
public final static String ALARM_INFO_EXCEL = "/alarm/excel";
|
||||
|
||||
public final static String ALARM_INFO_READ = "/alarm/read";
|
||||
|
||||
public final static String ALARM_INFO_UNREAD = "/alarm/unread";
|
||||
}
|
||||
|
||||
public class TriggerInfo {
|
||||
public final static String TRIGGER_INFO = "/trigger";
|
||||
|
||||
public final static String TRIGGER_INFO_PAGE = "/page/trigger";
|
||||
}
|
||||
|
||||
public class TriggerHistoryInfo {
|
||||
public final static String TRIGGER_HISTORY_INFO = "/trigger/history";
|
||||
|
||||
public final static String TRIGGER_HISTORY_INFO_PAGE = "/page/trigger/history";
|
||||
|
||||
public final static String TRIGGER_HISTORY_INFO_EXCEL = "/trigger/history/excel";
|
||||
}
|
||||
|
||||
public class SceneUserRelation {
|
||||
public final static String SCENE_USER_RELATION = "/relation/scene/user";
|
||||
|
||||
public final static String SCENE_USER_RELATION_CHANGE = "/relation/scene/user/change";
|
||||
|
||||
public final static String SCENE_USER_RELATION_PAGE = "/page/relation/scene/user";
|
||||
}
|
||||
|
||||
public class ContactUserInfo {
|
||||
public final static String CONTACT_USER_INFO = "/contact/user/info";
|
||||
|
||||
public final static String CONTACT_USER_INFO_PAGE = "/page/contact/user/info";
|
||||
}
|
||||
|
||||
public class IotLpmInfo {
|
||||
|
||||
public static final String IOT_LPM_INFO_PAGE = "/page/lpm";
|
||||
|
||||
public static final String IOT_LPM_INFO = "/lpm";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 海康账户信息
|
||||
*
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class HkAccountInfo {
|
||||
|
||||
public static final String HK_ACCOUNT_INFO_PAGE = "/page/hkaccount";
|
||||
|
||||
public static final String HK_ACCOUNT_INFO = "/hkaccount";
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频设备信息
|
||||
*
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class IotVideoInfo {
|
||||
public static final String IOT_VIDEO_INFO = "/video";
|
||||
|
||||
public static final String IOT_VIDEO_INFO_PAGE = "/page/video";
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频图片表
|
||||
*
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class VideoFileInfo {
|
||||
public static final String VIDEO_FILE_INFO = "/video/file";
|
||||
|
||||
public static final String VIDEO_FILE_INFO_PAGE = "/page/video/file";
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频记录表
|
||||
*
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class IotVideoRecord {
|
||||
public static final String IOT_VIDEO_RECORD = "/video/record";
|
||||
|
||||
public static final String IOT_VIDEO_RECORD_PAGE = "/page/video/record";
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频服务器回调信息
|
||||
*
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class IotVideoCall {
|
||||
|
||||
public static final String IOT_VIDEO_CLIENTS = "/live/clients";
|
||||
|
||||
public static final String IOT_VIDEO_STREAMS = "/live/streams";
|
||||
|
||||
public static final String IOT_VIDEO_SESSIONS = "/live/sessions";
|
||||
|
||||
public static final String IOT_VIDEO_DVRS = "/live/dvrs";
|
||||
}
|
||||
|
||||
/**
|
||||
* Mqtt server recall
|
||||
*
|
||||
* @author chenrj
|
||||
*
|
||||
*/
|
||||
public class IotMqttCall {
|
||||
|
||||
public static final String IOT_MQTT_AUTH_CLIENT = "/mqtt/auth";
|
||||
|
||||
public static final String IOT_MQTT_CLIENT_NOTICE = "/mqtt/notice";
|
||||
|
||||
}
|
||||
|
||||
public static final class AlarmTriggerStatistic{
|
||||
|
||||
public static final String ALARM_TRIGGER_STATISTIC_PAGE = "/page/alarm/statistic" ;
|
||||
|
||||
public static final String ALARM_TRIGGER_STATISTIC = "/alarm/statistic" ;
|
||||
|
||||
}
|
||||
|
||||
public static final class AlarmTriggerRecord{
|
||||
|
||||
public static final String ALARM_TRIGGER_RECORD_PAGE = "/page/alarm/record" ;
|
||||
|
||||
public static final String ALARM_TRIGGER_RECORD_STATISTIC_PAGE = "/page/alarm/record/statistic" ;
|
||||
|
||||
public static final String ALARM_TRIGGER_RECORD = "/alarm/record" ;
|
||||
|
||||
public static final String ALARM_TRIGGER_RECORD_UPDATE = "/alarm/record/update" ;
|
||||
|
||||
}
|
||||
|
||||
public static final class UserAccountInfo {
|
||||
|
||||
public static final String USER_ACCOUNT_INFO = "/user/account";
|
||||
|
||||
}
|
||||
|
||||
public static final class IotHistoryNodeData {
|
||||
|
||||
public static final String IOT_HISTORY_NODE_DATA_PAGE = "/page/history/node/data" ;
|
||||
|
||||
public static final String IOT_HISTORY_NODE_DATA = "/history/node/data" ;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 从机信息
|
||||
*
|
||||
*/
|
||||
public class SensorDeviceInfo {
|
||||
|
||||
public final static String SENSOR_DEVICE_INFO_COPY = "/sensor/device/copy";
|
||||
|
||||
public final static String SENSOR_DEVICE_INFO = "/sensor/device";
|
||||
|
||||
public final static String SENSOR_DEVICE_INFO_PAGE = "/page/sensor/device";
|
||||
|
||||
public final static String DEVICE_INFO_NODE_INFO_SENSOR_INFO_PAGES = "/page/device/node/sensor/list";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 云台控制
|
||||
* @author Kvc
|
||||
*
|
||||
*/
|
||||
public class Ptz {
|
||||
/**
|
||||
* 开始云台控制
|
||||
*/
|
||||
public final static String START = "/ptz/start";
|
||||
/**
|
||||
* 停止云台控制
|
||||
*/
|
||||
public final static String STOP = "/ptz/stop";
|
||||
}
|
||||
|
||||
public class Ezuiz{
|
||||
//设备同步
|
||||
public final static String SYNCHRONIZ = "/synchroniz/device";
|
||||
//视频加密关
|
||||
public final static String ENCRYPTOFF = "/encrypt/off";
|
||||
//视频加密开
|
||||
public final static String ENCRYPTON = "/encrypt/on";
|
||||
//抓取设备图片
|
||||
public final static String DEVICECAPTURE = "/device/capture";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.lp.common;
|
||||
|
||||
/**
|
||||
* @author thomas.he
|
||||
* @Description:
|
||||
* @date 2021/7/27 21:31
|
||||
*/
|
||||
public class UrlIotVisual {
|
||||
public class IotVisualDisplayInfo
|
||||
{
|
||||
public static final String IOT_VISUAL_DISPLAY_INFO = "/visual/display";
|
||||
public static final String IOT_VISUAL_DISPLAY_INFO_PAGE = "/page/visual/display";
|
||||
public static final String IOT_VISUAL_DISPLAY_SCENE = "/scene/visual";
|
||||
public static final String IOT_VISUAL_SUB_ALL = "/visual/display/sub/all";
|
||||
public static final String IOT_VISUAL_LOGIN = "/visual/login";
|
||||
}
|
||||
|
||||
public class IotVisualMoudleInfo
|
||||
{
|
||||
public static final String IOT_VISUAL_MOUDLE_INFO = "/moudle/visual";
|
||||
public static final String IOT_VISUAL_MOUDLE_INFO_PAGE = "/page/moudle/visual";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
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.cache.CacheName;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.service.BaseService;
|
||||
import com.lp.util.ExcelUtil;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
|
||||
|
||||
public class BaseController extends ResultMapUtils {
|
||||
|
||||
@Autowired
|
||||
@Qualifier(value = "baseService")
|
||||
protected BaseService service;
|
||||
|
||||
|
||||
/**
|
||||
* LOG
|
||||
*/
|
||||
protected final static Logger LOGGER = LoggerFactory.getLogger(BaseController.class);
|
||||
|
||||
/**
|
||||
* 根据userKey获取用户信息
|
||||
*/
|
||||
protected UserInfoBO getUserInfoByUserKey(String userKey){
|
||||
return ProCacheUtil.getCache(CacheName.USERINFO, userKey, new UserInfoBO());
|
||||
}
|
||||
/**
|
||||
* 根据session获取用户信息
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
protected UserInfoBO getUserInfoBySession(HttpServletRequest req) {
|
||||
return (UserInfoBO) req.getSession().getAttribute("user");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为用户角色
|
||||
*/
|
||||
protected Boolean verifyUserRole(String userKey,Integer userTypeCode){
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey) ;
|
||||
if(ObjectUtil.isEmpty(user)){
|
||||
return false ;
|
||||
}else{
|
||||
if(ObjectUtil.isEmpty(userTypeCode)){
|
||||
return true ;
|
||||
}
|
||||
if(userTypeCode+0 == user.getType()){
|
||||
return true ;
|
||||
}else{
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有页面或者数据的访问权限
|
||||
*/
|
||||
protected ModelAndView accessFilter(String userKey,String url,HttpServletResponse response){
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel 下载
|
||||
*/
|
||||
protected void downExcel(String mapper,String name,String template,Object param,HttpServletResponse response) {
|
||||
List<?> list = (List<?>) getData(service.selectList(mapper , param)) ;
|
||||
if(ObjectUtil.isEmpty(list) || list.size() > 5000 ){
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
ExcelUtil.exportExcel(name, template, list, response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
package com.lp.controller;
|
||||
|
||||
import com.lp.bo.FileInfoBO;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURL;
|
||||
import com.lp.util.*;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
|
||||
public class FileInfoController extends BaseController {
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.FileInfo.FILE_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody FileInfoBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("FileInfo.selectPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 插入
|
||||
// */
|
||||
// @RequestMapping(method = RequestMethod.POST, value = RequestURL.FileInfo.FILE_INFO)
|
||||
// public ModelAndView save(HttpServletResponse response,
|
||||
// @RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
// @RequestBody FileInfoBO obj) {
|
||||
// Map<String, Object> resultMap = getResultMap();
|
||||
// try {
|
||||
// resultMap = service.insert("FileInfo.insert", obj);
|
||||
// } catch (Exception e) {
|
||||
// exception(e, resultMap, obj);
|
||||
// }
|
||||
// return getModelAndView(response, resultMap);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.FileInfo.FILE_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("FileInfo.selectOne", new FileInfoBO(id));
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.FileInfo.FILE_INFO)
|
||||
public ModelAndView update(HttpServletResponse response, @RequestBody FileInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("FileInfo.update", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURL.FileInfo.FILE_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
FileInfoBO obj = new FileInfoBO();
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
} else {
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("FileInfo.update", obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.FileInfo.FILE_SENSOR_ICO )
|
||||
public ModelAndView upload(HttpServletResponse response,HttpServletRequest request,
|
||||
@RequestParam(required = false,value="code") String code,
|
||||
@RequestParam(required = false,value="suffix") String suffix,
|
||||
@RequestParam(required = false, value = "file") MultipartFile file) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// 将文件保存起来
|
||||
if( ObjectUtil.isNotEmpty(file) && !file.isEmpty() ){
|
||||
try {
|
||||
// 文件保存路径
|
||||
String path = this.getClass().getClassLoader().getResource("").getPath() ;
|
||||
|
||||
String rootPath = "" ;
|
||||
|
||||
String os = System.getProperty("os.name");
|
||||
if(os.toLowerCase().startsWith("win")){
|
||||
rootPath = path.substring(1, path.indexOf("/WEB-INF/"));
|
||||
}else{
|
||||
rootPath = path.substring(0, path.indexOf("/WEB-INF/"));
|
||||
}
|
||||
String suffix_name = ".png" ;
|
||||
if(ObjectUtil.isNotEmpty(suffix)){
|
||||
suffix_name = "." + suffix ;
|
||||
}
|
||||
// 转存文件
|
||||
String icoFileName = ProConfig.LOCAL_FILE_PATH + "/sensor_icos/" + code + suffix_name;
|
||||
LOGGER.debug("{} call upload from {} to {} "
|
||||
, RequestURL.FileInfo.FILE_SENSOR_ICO, file.getOriginalFilename(), icoFileName);
|
||||
// file.transferTo(new File(rootPath+"/image/oss/iot/"+ code + suffix_name ));
|
||||
file.transferTo(new File(icoFileName));
|
||||
} catch (Exception e) {
|
||||
LogUtil.errorLog(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap, file);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件数据
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.FileInfo.UPLOAD)
|
||||
public ModelAndView uploadCommonFile(HttpServletResponse response, HttpSession session,
|
||||
@RequestParam(required = false,value="category") String category,
|
||||
@RequestParam(required = false, value = "file") MultipartFile file) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try{
|
||||
// 将文件保存起来
|
||||
if( ObjectUtil.isNotEmpty(file) && !file.isEmpty() ){
|
||||
try {
|
||||
String fix = file.getOriginalFilename();
|
||||
if(fix.contains(".")){
|
||||
fix = fix.split("\\.")[1];
|
||||
}
|
||||
String relativeFilePath = "/" + category +"/"
|
||||
+ DateUtils.format(DateUtils.dtShort , new Date()) ;
|
||||
String fileRealPath = ProConfig.LOCAL_FILE_PATH + relativeFilePath + "/" ;
|
||||
|
||||
if(! new File(fileRealPath).exists()){
|
||||
new File(fileRealPath).mkdirs();
|
||||
}
|
||||
String newFileName = System.currentTimeMillis() + "." + fix;
|
||||
String filePath = fileRealPath + newFileName ;
|
||||
// 转存文件
|
||||
file.transferTo(new File(filePath));
|
||||
// 返回所有值
|
||||
putData(resultMap, relativeFilePath+"/"+newFileName) ;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
LogUtil.errorLog(e);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信公众号端上传图片
|
||||
* 插入base64数据
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.FileInfo.BASE64_FILE_INFO)
|
||||
public ModelAndView uploadPortait(HttpServletResponse response, HttpSession session,
|
||||
@RequestBody FileInfoBO param) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
if (param.getBase64File() != null) {
|
||||
BASE64Decoder decoder = new BASE64Decoder();
|
||||
byte[] b;
|
||||
try {
|
||||
if (param.getBase64File().indexOf(',') > 0) {
|
||||
b = decoder.decodeBuffer(param.getBase64File().split(",")[1]);
|
||||
for (int i = 0; i < b.length; ++i) {
|
||||
if (b[i] < 0) {
|
||||
b[i] += 256;
|
||||
}
|
||||
}
|
||||
String fix = ArithHelper.getTypeByStream(b);
|
||||
String relativeFilePath = Constants.FileRealPath.NORMAL +"/"
|
||||
+ DateUtils.format(DateUtils.dtShort , new Date()) ;
|
||||
String fileRealPath = ProConfig.LOCAL_FILE_PATH + relativeFilePath + "/" ;
|
||||
FileInfoBO fileInfo = new FileInfoBO();
|
||||
fileInfo.setName("用户头像");
|
||||
fileInfo.setFile_path(relativeFilePath);
|
||||
fileInfo.setFix(fix.trim().toLowerCase());
|
||||
fileInfo.setSize( b.length);
|
||||
fileInfo.setAdd_time(new Date());
|
||||
service.insert("FileInfo.insert", fileInfo);
|
||||
//
|
||||
if (fileInfo.getId() != null) {
|
||||
if(! new File(fileRealPath).exists()){
|
||||
new File(fileRealPath).mkdirs();
|
||||
}
|
||||
String filePath = fileRealPath + fileInfo.getId() + "." + fix;
|
||||
// 2.图片存储到文件系统
|
||||
File f = new File(filePath);
|
||||
OutputStream out = new FileOutputStream(f);
|
||||
out.write(b);
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
// 保存成功,返回图片信息
|
||||
putData(resultMap, fileInfo);
|
||||
} else {
|
||||
putStatusCode(resultMap,
|
||||
Code.ResponseCode.SystemCode.NO_DATA);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
package com.lp.controller;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
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.PathVariable;
|
||||
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.bean.ProDictionaryInfo;
|
||||
import com.lp.bo.ProDictionaryInfoBO;
|
||||
import com.lp.cache.CacheName;
|
||||
import com.lp.cache.EhcacheUtil;
|
||||
import com.lp.cache.ProCache;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.RequestURL;
|
||||
import com.lp.util.MysqlDbGenerateBean;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
import net.sf.ehcache.Cache;
|
||||
|
||||
|
||||
@Controller
|
||||
public class ProDictionaryInfoController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProCache procahce;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param response
|
||||
* @param proDictionaryInfo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.ProDictionaryInfo.PRO_DICTIONARY_INFO_PAGE)
|
||||
public ModelAndView selectDictionArys(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = false) String userKey ,
|
||||
@RequestBody ProDictionaryInfoBO proDictionaryInfo,
|
||||
@RequestParam(required=false) Integer pageSize ,
|
||||
@RequestParam Integer paged ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(verifyUserRole(userKey, Code.UserType.SUPER) ){
|
||||
resultMap = service.selectPageList("ProDictionaryInfo.selectPageList",getPageBean(paged,pageSize), proDictionaryInfo);
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, proDictionaryInfo);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.ProDictionaryInfo.PRO_DICTIONARY_INFO)
|
||||
public ModelAndView saveDictionAry(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = false) String userKey ,
|
||||
@RequestBody ProDictionaryInfoBO proDictionaryInfo ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(verifyUserRole(userKey, Code.UserType.SUPER) ){
|
||||
Integer code = (Integer) getData(service.selectOne("ProDictionaryInfo.generateCode", proDictionaryInfo));
|
||||
if(ObjectUtil.isNotEmpty(code)){
|
||||
proDictionaryInfo.setCode(code);
|
||||
}else{
|
||||
proDictionaryInfo.setCode(1);
|
||||
}
|
||||
resultMap = service.insert("ProDictionaryInfo.insert", proDictionaryInfo) ;
|
||||
procahce.refleshCache(CacheName.DICTIONARY);
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, proDictionaryInfo);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.ProDictionaryInfo.PRO_DICTIONARY_INFO)
|
||||
public ModelAndView updateDictionAry(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = false) String userKey ,
|
||||
@RequestParam(required=false) Integer id , @RequestParam(required=false) String ids ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(ObjectUtil.isNotEmpty(id)){
|
||||
putData(resultMap,ProCacheUtil.getCache(CacheName.DICTIONARY, id.toString(), new ProDictionaryInfo()) );
|
||||
}else if(ObjectUtil.isNotEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
List<ProDictionaryInfo> list = new ArrayList<>();
|
||||
for(int i=0;i<idArray.length;i++){
|
||||
list.add(ProCacheUtil.getCache(CacheName.DICTIONARY, idArray[i], new ProDictionaryInfo()) );
|
||||
}
|
||||
putData(resultMap, list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.ProDictionaryInfo.PRO_DICTIONARY_INFO)
|
||||
public ModelAndView updateDictionAry(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = false) String userKey ,
|
||||
@RequestBody ProDictionaryInfoBO proDictionaryInfo ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(verifyUserRole(userKey, Code.UserType.SUPER) ){
|
||||
resultMap = service.update("ProDictionaryInfo.update", proDictionaryInfo) ;
|
||||
if(isOk(resultMap)){
|
||||
resultMap = service.selectOne("ProDictionaryInfo.selectOne", proDictionaryInfo) ;
|
||||
if(isOk(resultMap)){
|
||||
ProDictionaryInfoBO tmp = (ProDictionaryInfoBO)getData(resultMap) ;
|
||||
if(ObjectUtil.isNotEmpty(tmp)){
|
||||
//更新子字典中,父字典的类型名称
|
||||
proDictionaryInfo.setP_code(tmp.getCode());
|
||||
proDictionaryInfo.setP_dictionary_name(tmp.getDictionary_name());
|
||||
resultMap = service.update("ProDictionaryInfo.updateByCondition",proDictionaryInfo ) ;
|
||||
procahce.refleshCache(CacheName.DICTIONARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, proDictionaryInfo);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURL.ProDictionaryInfo.PRO_DICTIONARY_INFO)
|
||||
public ModelAndView deleteDictionAry(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = false) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(verifyUserRole(userKey, Code.UserType.SUPER) ){
|
||||
ProDictionaryInfoBO proDictionaryInfo = new ProDictionaryInfoBO();
|
||||
if(ObjectUtil.isNotEmpty(id)){
|
||||
proDictionaryInfo.setId(id);
|
||||
}
|
||||
resultMap = service.selectOne("ProDictionaryInfo.selectOne", proDictionaryInfo) ;
|
||||
if(isOk(resultMap)){
|
||||
ProDictionaryInfoBO tmp = (ProDictionaryInfoBO)getData(resultMap) ;
|
||||
if(ObjectUtil.isNotEmpty(tmp)){
|
||||
// 删除父字典下的子字典值
|
||||
proDictionaryInfo.setP_code(tmp.getCode());
|
||||
resultMap = service.delete("ProDictionaryInfo.deleteByPcode",proDictionaryInfo ) ;
|
||||
}
|
||||
}
|
||||
resultMap = service.delete("ProDictionaryInfo.delete",proDictionaryInfo ) ;
|
||||
|
||||
procahce.refleshCache(CacheName.DICTIONARY);
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.ProDictionaryInfo.PRO_DICTIONARY_INFO_SEL)
|
||||
public ModelAndView getDictionarySub(HttpServletResponse response,
|
||||
@PathVariable Integer p_code ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
putData(resultMap, ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, p_code.toString(), new ProDictionaryInfoBO()).getSub() );
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, p_code);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.ProDictionaryInfo.GEN_DICTIONARY_INFO_SEL)
|
||||
public void genDictionaryFile(HttpServletResponse response ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// string buffer信息
|
||||
StringBuffer stbuffer = new StringBuffer();
|
||||
Cache cache = EhcacheUtil.getCache(CacheName.DICTIONARY_RELATION) ;
|
||||
List<String> code = cache.getKeys() ;
|
||||
for(int i=0;i<code.size();i++){
|
||||
// System.out.println(code.get(i)+","+ cache.get(code.get(i)).getObjectValue() );
|
||||
MysqlDbGenerateBean.generateDictionaryCode(stbuffer, (ProDictionaryInfoBO) cache.get(code.get(i)).getObjectValue());
|
||||
}
|
||||
stbuffer.append("}\n\n");
|
||||
|
||||
|
||||
// 取得文件名。
|
||||
String filename = "Codes.java";
|
||||
byte[] buffer = stbuffer.toString().getBytes();
|
||||
|
||||
// 清空response
|
||||
response.reset();
|
||||
//
|
||||
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
||||
// 设置response的Header
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment;filename=" + new String(filename.getBytes("gb2312"), "ISO-8859-1"));
|
||||
response.addHeader("Content-Length", "" + buffer.length);
|
||||
response.setContentType("java"); // 设置返回的文件类型
|
||||
|
||||
toClient.write(buffer);
|
||||
toClient.flush();
|
||||
toClient.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.ProDictionaryInfo.GET_PRO_DICTIONARY_INFO)
|
||||
public ModelAndView getDictionary(HttpServletResponse response, @RequestParam Integer p_code ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
putData(resultMap, ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, p_code.toString(), new ProDictionaryInfoBO()).getSub() );
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, p_code);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package com.lp.controller;
|
||||
|
||||
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.PathVariable;
|
||||
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.SysConfigInfoBO;
|
||||
import com.lp.cache.ProCache;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURL;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
@Controller
|
||||
|
||||
public class SysConfigInfoController extends BaseController {
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.SysConfigInfo.SYS_CONFIG_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody SysConfigInfoBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("SysConfigInfo.selectPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.SysConfigInfo.SYS_CONFIG_INFO)
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody SysConfigInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.insert("SysConfigInfo.insert", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.SysConfigInfo.SYS_CONFIG_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("SysConfigInfo.selectOne", new SysConfigInfoBO(id));
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.SysConfigInfo.SYS_CONFIG_INFO_EKY)
|
||||
public ModelAndView selectOneByKey(HttpServletResponse response, @PathVariable String key) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
SysConfigInfoBO info = new SysConfigInfoBO();
|
||||
info.setName(key);
|
||||
resultMap = service.selectOne("SysConfigInfo.selectOneByCondition", info);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, key);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProCache procache;
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.SysConfigInfo.SYS_CONFIG_INFO)
|
||||
public ModelAndView update(HttpServletResponse response, @RequestBody SysConfigInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("SysConfigInfo.update", obj);
|
||||
if(isOk(resultMap)){
|
||||
procache.refleshCache("sysInfo");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURL.SysConfigInfo.SYS_CONFIG_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
SysConfigInfoBO obj = new SysConfigInfoBO();
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
} else {
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("SysConfigInfo.update", obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,846 @@
|
|||
package com.lp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.lp.bo.AliyunParamBO;
|
||||
import com.lp.bo.IotSceneUserRelationBO;
|
||||
import com.lp.bo.UserAccountInfoBO;
|
||||
import com.lp.bo.UserInfoBO;
|
||||
import com.lp.cache.CacheName;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURL;
|
||||
import com.lp.service.UserService;
|
||||
import com.lp.util.*;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
@Controller
|
||||
public class UserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private UserService userSerivce ;
|
||||
|
||||
protected final static Logger LOGGER = LoggerFactory.getLogger(UserController.class);
|
||||
/**
|
||||
* 用户注册
|
||||
*
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.User.USER_REGISTER )
|
||||
public ModelAndView userRegister(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if( ObjectUtil.isNotEmpty(user.getRegister_type()) && user.getRegister_type() == 1 ){
|
||||
// 短信携带验证码过来注册
|
||||
String register_code = user.getValidate_code() ;
|
||||
String code = ProCacheUtil.getCache(CacheName.USER_SMS, user.getPhone()+"_code");
|
||||
if(code.equals(register_code)){
|
||||
// 成功
|
||||
// 如果是微信公众号内注册,则设置open_id
|
||||
user.setWx_open_id( (String) req.getSession().getAttribute("open_id") );
|
||||
resultMap = userSerivce.userRegisterByPhone(user);
|
||||
}else{
|
||||
// 激活码过去
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.CODE_ERROR);
|
||||
}
|
||||
}else{
|
||||
resultMap = userSerivce.userRegister(user);
|
||||
}
|
||||
if(isOk(resultMap)){
|
||||
user = (UserInfoBO) getData(resultMap);
|
||||
// 注册成功,添加缓存
|
||||
ProCacheUtil.addCache(CacheName.USERINFO, user.getUser_key() ,user);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户验证激活-页面
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param validatecode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.User.MAIL_MESSAGE )
|
||||
public ModelAndView mailMessage(HttpServletRequest req, HttpServletResponse resp,
|
||||
@PathVariable String validatecode) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = userSerivce.validateCode(validatecode);
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap,"/oss/iot/message","Info");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码-页面
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param validatecode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.User.MAIL_RESET_PASSWORD_MESSAGE )
|
||||
public ModelAndView mailResetPasswordMessage(HttpServletRequest req, HttpServletResponse resp,
|
||||
@PathVariable String validatecode) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = userSerivce.mailValidatePassword(validatecode);
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap,"/oss/iot/resetpassword","Info");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码,发送邮件
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.User.RESET_PASSWORD )
|
||||
public ModelAndView resetPassword(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = userSerivce.resetPassword(user);
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账号验证码
|
||||
*
|
||||
* @param contentType
|
||||
* @param body
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.User.VALIDATE_BY_NAME)
|
||||
public ModelAndView getSecurityCode(HttpServletResponse response, @PathVariable String name) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = userSerivce.sendSecurityCode(name);
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.User.USER )
|
||||
public ModelAndView resetPasswordOver(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = super.service.update("UserInfo.updatePassword", user);
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.User.USER_MODIFY_PASSWORD )
|
||||
public ModelAndView modifyPasswordOver(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// 根据id 获取用户信息
|
||||
UserInfoBO userCache = ProCacheUtil.getCache(CacheName.USERINFO, user.getUser_key());
|
||||
if( userCache.getPassword().equalsIgnoreCase(user.getPassword()) ){
|
||||
user.setPassword(user.getNewpassword());
|
||||
resultMap = super.service.update("UserInfo.updatePasswordByKey", user);
|
||||
userCache.setPassword(user.getNewpassword());
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PASSWORD_ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信公众号信息 绑定
|
||||
*
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.User.WX_USER_BIND )
|
||||
public ModelAndView wxBind(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(ObjectUtil.hasNull(user.getName(),user.getPassword(),user.getWx_open_id() )){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
// ...
|
||||
String wxOpenId = user.getWx_open_id();
|
||||
user.setWx_open_id(null);
|
||||
resultMap = super.service.selectOne("UserInfo.selectOne", user) ;
|
||||
if(isOk(resultMap)){
|
||||
// 绑定时获取一下session里面的信息
|
||||
String wxImg = (String) req.getSession().getAttribute("wximg") ;
|
||||
String nickName = (String) req.getSession().getAttribute("nickname") ;
|
||||
// 则更新用户信息
|
||||
user.setWx_open_id(wxOpenId);
|
||||
user.setId( ((UserInfoBO) getData(resultMap)).getId());
|
||||
user.setNick_name(URLEncoder.encode(nickName, "utf-8"));
|
||||
user.setWx_img_url(wxImg);
|
||||
super.service.update("UserInfo.update", user);
|
||||
|
||||
user = (UserInfoBO) getData(resultMap);
|
||||
user.setWx_open_id(wxOpenId);
|
||||
req.getSession().setAttribute("user", user);
|
||||
// -- 更新缓存
|
||||
ProCacheUtil.addCache(CacheName.USERINFO_OPENID, wxOpenId, user);
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.USERNAME_OR_PASSWORD_ERROR);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序 用户绑定
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.User.WP_USER_BIND )
|
||||
public ModelAndView userBind(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(ObjectUtil.hasNull(user.getName(),user.getPassword(),user.getWp_id() )){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
// ...
|
||||
String wp_id = user.getWp_id();
|
||||
user.setWp_id(null);
|
||||
resultMap = super.service.selectOne("UserInfo.selectOne", user) ;
|
||||
if(isOk(resultMap)){
|
||||
// 则更新用户信息
|
||||
user.setWp_id(wp_id);
|
||||
user.setId( ((UserInfoBO) getData(resultMap)).getId());
|
||||
super.service.update("UserInfo.update", user);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
/**
|
||||
* 小程序 携带wp_id来获取用户信息
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.User.WP_USER_LOGIN )
|
||||
public ModelAndView wPUserLogin(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestParam String code){
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try{
|
||||
if( ObjectUtil.isNotEmpty(code) ){
|
||||
UserInfoBO userBo = new UserInfoBO();
|
||||
userBo.setWp_id(code);
|
||||
resultMap = super.service.selectOne("UserInfo.selectOne", userBo) ;
|
||||
UserInfoBO data = (UserInfoBO) getData(resultMap);
|
||||
if(ObjectUtil.isNotEmpty(data) && ObjectUtil.isNotEmpty(data.getNick_name())){
|
||||
data.setNick_name(URLDecoder.decode(data.getNick_name(), "utf-8"));
|
||||
putData(resultMap, data);
|
||||
}
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信登录
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.User.USER_SMS_LOGIN )
|
||||
public ModelAndView userSmsLogin(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(CommonUtil.isBlank(user.getName()) || CommonUtil.isBlank(user.getValidate_code() )){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_ACTIVE_CODE);
|
||||
}else{
|
||||
String register_code = user.getValidate_code() ;
|
||||
String code = ProCacheUtil.getCache(CacheName.USER_SMS, user.getName()+"_code");
|
||||
if( code.equals(register_code)){
|
||||
UserInfoBO userbo = new UserInfoBO() ;
|
||||
userbo.setName(user.getName());
|
||||
UserInfoBO userInfo = (UserInfoBO)getData( super.service.selectOne("UserInfo.selectOne", userbo));
|
||||
if(ObjectUtil.isNotEmpty(userInfo)){
|
||||
if(userInfo.getStatus() == Code.UserStatus.UN_ACTIVED){
|
||||
putStatusCode(resultMap, Code.UserStatus.UN_ACTIVED); // 未激活
|
||||
}else if(userInfo.getStatus() == Code.UserStatus.FORBIDDEN){
|
||||
putStatusCode(resultMap, Code.UserStatus.FORBIDDEN); // 已禁用
|
||||
}else if(userInfo.getStatus() == Code.UserStatus.NORMAL){
|
||||
req.getSession().setAttribute("user", userInfo);
|
||||
userInfo.setPassword(null);
|
||||
putData(resultMap, userInfo);
|
||||
}else {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_ACTIVE_CODE);
|
||||
}
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.USER_NOT_EXISTS);
|
||||
}
|
||||
}else {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_ACTIVE_CODE);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.User.USER_LOGIN )
|
||||
public ModelAndView userLogin(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestBody UserInfoBO user) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
LOGGER.debug("aaaa{}", user);
|
||||
try {
|
||||
if(CommonUtil.isBlank(user.getName()) || CommonUtil.isBlank(user.getPassword())){
|
||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.USERNAME_OR_PASSWORD_ERROR);
|
||||
}else{
|
||||
UserInfoBO userInfo = (UserInfoBO)getData( super.service.selectOne("UserInfo.selectOneLogin", user));
|
||||
if(ObjectUtil.isNotEmpty(userInfo)){
|
||||
if(ObjectUtil.isNotEmpty(userInfo.getNick_name())){
|
||||
userInfo.setNick_name(URLDecoder.decode(userInfo.getNick_name(), "utf-8"));
|
||||
}
|
||||
if(userInfo.getStatus() == Code.UserStatus.UN_ACTIVED){
|
||||
putStatusCode(resultMap, Code.UserStatus.UN_ACTIVED); // 未激活
|
||||
}else if(userInfo.getStatus() == Code.UserStatus.FORBIDDEN){
|
||||
putStatusCode(resultMap, Code.UserStatus.FORBIDDEN); // 已禁用
|
||||
}else if(userInfo.getStatus() == Code.UserStatus.NORMAL){
|
||||
req.getSession().setAttribute("user", userInfo);
|
||||
userInfo.setPassword(null);
|
||||
putData(resultMap, userInfo);
|
||||
}else {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
}
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.USERNAME_OR_PASSWORD_ERROR);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
LOGGER.debug("bbbb{}", resultMap);
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户退出
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.User.USER_LOGOUT )
|
||||
public ModelAndView logout(HttpServletRequest req, HttpServletResponse resp,@RequestParam(required=false) Integer type ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
req.getSession().setAttribute("user", null);
|
||||
} catch (Exception e) {
|
||||
super.exception(e, resultMap);
|
||||
}
|
||||
if(type!= null && type == 1){
|
||||
return new ModelAndView("redirect:/service/wiot/login");
|
||||
}
|
||||
return new ModelAndView("redirect:/service/iot/login");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检索用户列表
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.User.USER_PAGE)
|
||||
public ModelAndView selectUsers(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody UserInfoBO userInfoBO,
|
||||
@RequestParam(required=false) Integer pageSize ,
|
||||
@RequestParam Integer paged ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey) ;
|
||||
if(ObjectUtil.isNotEmpty(user)){
|
||||
if(!verifyUserRole(userKey,Code.UserType.SUPER) && ObjectUtil.isEmpty(userInfoBO.getAid()) ){
|
||||
userInfoBO.setAid(user.getId());
|
||||
}
|
||||
resultMap = service.selectPageList("UserInfo.select",getPageBean(paged,pageSize), userInfoBO);
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, userInfoBO);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.User.USER_INFO)
|
||||
public ModelAndView update(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody UserInfoBO userInfoBO ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey) ;
|
||||
|
||||
userInfoBO.setMid(user.getId());
|
||||
if(ObjectUtil.isNotEmpty(userInfoBO.getNick_name())){
|
||||
userInfoBO.setNick_name(URLEncoder.encode(userInfoBO.getNick_name(), "utf-8"));
|
||||
}
|
||||
resultMap = super.service.update("UserInfo.update", userInfoBO);
|
||||
if(isOk(resultMap)){
|
||||
ProCacheUtil.addCache(CacheName.USERINFO, userInfoBO.getUser_key() ,userInfoBO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, userInfoBO);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改当前用户信息
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.User.USER_INFO_MODIFY)
|
||||
public ModelAndView updateSelf(HttpServletResponse response, HttpServletRequest req ,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody UserInfoBO userInfoBO ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey) ;
|
||||
userInfoBO.setId(user.getId());
|
||||
resultMap = super.service.update("UserInfo.update", userInfoBO);
|
||||
if(isOk(resultMap)){
|
||||
UserInfoBO userInfo = getUserInfoBySession(req);
|
||||
userInfo.setPhone(userInfoBO.getPhone());
|
||||
userInfo.setEmail(userInfoBO.getEmail());
|
||||
userInfo.setNick_name(userInfoBO.getNick_name());
|
||||
req.getSession().setAttribute("user", userInfo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, userInfoBO);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
/**
|
||||
* 增加用户
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURL.User.USER_INFO)
|
||||
public ModelAndView add(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody UserInfoBO userInfoBO ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// 这边需要处理,不允许用户名、邮箱和手机号重复
|
||||
UserInfoBO userInfo = new UserInfoBO();
|
||||
userInfo.setName(userInfoBO.getName());
|
||||
if( service.count("UserInfo.selectCount", userInfo) >0){
|
||||
// 用户名重复
|
||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.NAME_EXIST);
|
||||
}else{
|
||||
userInfo.setName(null);
|
||||
userInfo.setEmail(userInfoBO.getEmail());
|
||||
if( service.count("UserInfo.selectCount", userInfo) >0 ){
|
||||
// 邮箱重复
|
||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.EMAIL_EXIST);
|
||||
}else{
|
||||
userInfo.setPhone(userInfoBO.getPhone());
|
||||
userInfo.setEmail(null);
|
||||
if(service.count("UserInfo.selectCount", userInfo) >0){
|
||||
// 电话号码重复
|
||||
putStatusCode(resultMap, Code.ResponseCode.UserInfo.PHONE_EXIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isOk(resultMap)){
|
||||
userInfoBO.setAid(getUserInfoByUserKey(userKey).getId());
|
||||
userInfoBO.setUser_key(CommonUtil.UUIDString.getUUIDString());
|
||||
userInfoBO.setRegister_time(new Date());
|
||||
userInfoBO.setStatus(Code.UserStatus.NORMAL);
|
||||
resultMap = super.service.insert("UserInfo.insert", userInfoBO);
|
||||
if(isOk(resultMap)){
|
||||
ProCacheUtil.addCache(CacheName.USERINFO, userInfoBO.getUser_key() ,userInfoBO);
|
||||
/**
|
||||
* 添加用户的账户表
|
||||
*/
|
||||
UserAccountInfoBO userAccountBo = new UserAccountInfoBO();
|
||||
userAccountBo.setUser_id(userInfoBO.getId());
|
||||
resultMap = super.service.insert("UserAccountInfo.insertSimple", userAccountBo);
|
||||
if(isOk(resultMap)){
|
||||
ProCacheUtil.addCache(CacheName.USERACCOUNT_ID, userAccountBo.getUser_id().toString() ,userAccountBo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, userInfoBO);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURL.User.USER_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(ObjectUtil.isEmpty(id)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
UserInfoBO obj = new UserInfoBO();
|
||||
if(id != getUserInfoByUserKey(userKey).getId()+0){
|
||||
if( verifyUserRole(userKey,Code.UserType.SUPER) ){
|
||||
;
|
||||
}else{
|
||||
obj.setAid(getUserInfoByUserKey(userKey).getId());
|
||||
}
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("UserInfo.update", obj) ;
|
||||
if(isOk(resultMap)){
|
||||
// 清空缓存信息
|
||||
UserInfoBO tmp =new UserInfoBO();
|
||||
tmp.setId(id);
|
||||
tmp.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.selectOne("UserInfo.selectOne", tmp );
|
||||
tmp = getData(resultMap);
|
||||
ProCacheUtil.removeCache(CacheName.USERINFO, tmp.getUser_key());
|
||||
|
||||
// 删除跟用户关联的场景信息
|
||||
IotSceneUserRelationBO userRelation = new IotSceneUserRelationBO();
|
||||
userRelation.setUser_id(id);
|
||||
service.delete("IotSceneUserRelation.deleteUserRelation", userRelation) ;
|
||||
}
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.EXEC_FAIL);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.User.USER_INFO)
|
||||
public ModelAndView getOne(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(ObjectUtil.isEmpty(id)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
UserInfoBO obj = new UserInfoBO();
|
||||
if( verifyUserRole(userKey,Code.UserType.SUPER) ){
|
||||
;
|
||||
}else{
|
||||
// obj.setAid(getUserInfoByUserKey(userKey).getId());
|
||||
}
|
||||
obj.setDelete_flag(Constants.DELETE.NO);
|
||||
obj.setId(id);
|
||||
resultMap = service.selectOne("UserInfo.selectOne", obj) ;
|
||||
UserInfoBO data = (UserInfoBO) getData(resultMap);
|
||||
data.setNick_name(URLDecoder.decode(data.getNick_name(), "utf-8"));
|
||||
putData(resultMap, data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联自由账户为普通用户
|
||||
* @param response
|
||||
* @param userKey
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURL.User.BIND_SUB_ACCOUNT)
|
||||
public ModelAndView UserSettingSub(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey , @RequestParam String userName ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(ObjectUtil.isEmpty(userName)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
UserInfoBO userInfo = new UserInfoBO() ;
|
||||
userInfo.setDelete_flag(Constants.DELETE.NO);
|
||||
userInfo.setName(userName);
|
||||
resultMap = service.selectOne("UserInfo.selectOne", userInfo ) ;
|
||||
userInfo = getData(resultMap) ;
|
||||
if(isOk(resultMap) && (userInfo.getAid()== null ||userInfo.getAid() == -1 )) {
|
||||
UserInfoBO mainUserInfo = ProCacheUtil.getCache(CacheName.USERINFO, userKey) ;
|
||||
if(ObjectUtil.isNotEmpty(mainUserInfo)){
|
||||
// 更新
|
||||
UserInfoBO user= new UserInfoBO() ;
|
||||
user.setId(userInfo.getId());
|
||||
user.setAid( mainUserInfo.getId());
|
||||
service.update("UserInfo.updateAid", user ) ;
|
||||
}
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, userName);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送验证码信息
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURL.User.ACCOUNT_SECURITY_CODE)
|
||||
public ModelAndView getSecurityCode(HttpServletRequest req, HttpServletResponse resp,
|
||||
@PathVariable String phone ,@RequestParam String code , @RequestParam(required=false) Integer type ){
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// 这边判断验证码有没有填写成功
|
||||
String scode = (String) req.getSession().getAttribute("validate_code");
|
||||
Long ltime = (Long) req.getSession().getAttribute("validate_code_time");
|
||||
if(ObjectUtil.isEmpty(scode)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.CODE_TIME_ERROR);
|
||||
}else{
|
||||
if( ! scode.equalsIgnoreCase(code) ){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.CODE_ERROR);
|
||||
}
|
||||
if( ltime + 2*60*1000 <= new Date().getTime()){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.CODE_TIME_ERROR);
|
||||
}
|
||||
}
|
||||
if(isOk(resultMap)){
|
||||
req.getSession().removeAttribute("validate_code");
|
||||
req.getSession().removeAttribute("validate_code_time");
|
||||
|
||||
Integer num = ProCacheUtil.getCache(CacheName.USER_SMS, phone) ;
|
||||
if(ObjectUtil.isNotEmpty(num)){
|
||||
if( num > 5){
|
||||
// 验证码超过数量
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.VALIDATER_ALLER);
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
ProCacheUtil.addCache(CacheName.USER_SMS, phone, num+1);
|
||||
}else{
|
||||
ProCacheUtil.addCache(CacheName.USER_SMS, phone, 1 );
|
||||
}
|
||||
// ---
|
||||
String gcode = ObjectUtil.getSixRandomCode();
|
||||
|
||||
// 设置到缓存中,过期时间暂不设置
|
||||
ProCacheUtil.addCache(CacheName.USER_SMS, phone+"_code", gcode);
|
||||
|
||||
//
|
||||
AliyunParamBO aliyunParamBo = new AliyunParamBO();
|
||||
aliyunParamBo.setSignaName(ProConfig.AliyunShortMessage.SIGNATURE);
|
||||
aliyunParamBo.setPhonenumber(phone);
|
||||
if(ObjectUtil.isNotEmpty(type) && type ==1){
|
||||
aliyunParamBo.setTemplateCode(ProConfig.AliyunShortMessage.SMS_TEMPLATE_CODE);
|
||||
}else{
|
||||
aliyunParamBo.setTemplateCode(ProConfig.AliyunShortMessage.SMS_LOGIN_TEMPLATE_CODE);
|
||||
}
|
||||
Map<String,String> map = new HashedMap();
|
||||
map.put("code", gcode);
|
||||
aliyunParamBo.setTemplateParam( JSON.toJSONString(map));
|
||||
AliyunSmsAndVoiceUtil.sendSms(aliyunParamBo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, phone);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/get/validate/code")
|
||||
public ModelAndView getValidateCode(HttpServletRequest req, HttpServletResponse resp){
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// randomCode用于保存随机产生的验证码,以便用户登录后进行验证。
|
||||
Random random = new Random();
|
||||
StringBuffer randomCode = new StringBuffer();
|
||||
int red = random.nextInt(255) , green = random.nextInt(255), blue = random.nextInt(255);
|
||||
char[] codeSequence = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
|
||||
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
// 随机产生codeCount数字的验证码。
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// 得到随机产生的验证码数字。
|
||||
String code = String.valueOf(codeSequence[random.nextInt(codeSequence.length-1)]);
|
||||
// 将产生的四个随机数组合在一起。
|
||||
randomCode.append(code);
|
||||
}
|
||||
// 将四位数字的验证码保存到Session中。
|
||||
req.getSession().setAttribute("validate_code", randomCode.toString());
|
||||
req.getSession().setAttribute("validate_code_time", System.currentTimeMillis());
|
||||
|
||||
putData(resultMap,randomCode.toString() );
|
||||
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap);
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片验证码生成
|
||||
* @param req
|
||||
* @param resp
|
||||
* @throws IOException
|
||||
* <img alt="验证码" title="点击更新" id="validate-code" src="<%=basePath%>/service/validate/code" >
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/validate/code")
|
||||
public void getCode(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
int width = 90; // 定义图片的width
|
||||
int height = 38; // 定义图片的height
|
||||
int codeCount = 4; // 定义图片上显示验证码的个数
|
||||
int xx = 15;
|
||||
int fontHeight = 22;
|
||||
int codeY = 28;
|
||||
char[] codeSequence = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
|
||||
// 定义图像buffer
|
||||
BufferedImage buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics gd = buffImg.getGraphics();
|
||||
// 创建一个随机数生成器类
|
||||
Random random = new Random();
|
||||
// 将图像填充为白色
|
||||
gd.setColor(Color.WHITE);
|
||||
gd.fillRect(0, 0, width, height);
|
||||
// 创建字体,字体的大小应该根据图片的高度来定。
|
||||
Font font = new Font("Fixedsys", Font.BOLD, fontHeight);
|
||||
// 设置字体。
|
||||
gd.setFont(font);
|
||||
// 画边框。
|
||||
gd.setColor(Color.BLACK);
|
||||
gd.drawRect(0, 0, width - 1, height - 1);
|
||||
// 随机产生20条干扰线,使图象中的认证码不易被其它程序探测到。
|
||||
gd.setColor(Color.BLACK);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
int x = random.nextInt(width);
|
||||
int y = random.nextInt(height);
|
||||
int xl = random.nextInt(12);
|
||||
int yl = random.nextInt(12);
|
||||
gd.drawLine(x, y, x + xl, y + yl);
|
||||
}
|
||||
// randomCode用于保存随机产生的验证码,以便用户登录后进行验证。
|
||||
StringBuffer randomCode = new StringBuffer();
|
||||
int red = random.nextInt(255) , green = random.nextInt(255), blue = random.nextInt(255);
|
||||
// 随机产生codeCount数字的验证码。
|
||||
for (int i = 0; i < codeCount; i++) {
|
||||
// 得到随机产生的验证码数字。
|
||||
String code = String.valueOf(codeSequence[random.nextInt(codeSequence.length-1)]);
|
||||
// 产生随机的颜色分量来构造颜色值,这样输出的每位数字的颜色值都将不同。
|
||||
// 用随机产生的颜色将验证码绘制到图像中。
|
||||
gd.setColor(new Color(red, green, blue));
|
||||
gd.drawString(code, (i + 1) * xx, codeY);
|
||||
// 将产生的四个随机数组合在一起。
|
||||
randomCode.append(code);
|
||||
}
|
||||
// 将四位数字的验证码保存到Session中。
|
||||
req.getSession().setAttribute("validate_code", randomCode.toString());
|
||||
req.getSession().setAttribute("validate_code_time", System.currentTimeMillis());
|
||||
// 禁止图像缓存。
|
||||
resp.setHeader("Pragma", "no-cache");
|
||||
resp.setHeader("Cache-Control", "no-cache");
|
||||
resp.setDateHeader("Expires", 0);
|
||||
resp.setContentType("image/jpeg");
|
||||
// 将图像输出到Servlet输出流中。
|
||||
ServletOutputStream sos = resp.getOutputStream();
|
||||
ImageIO.write(buffImg, "jpeg", sos);
|
||||
sos.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.lp.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.lp.bo.UserInfoBO;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.util.HttpServiceSender;
|
||||
import com.lp.util.JsonUtils;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
|
||||
@Controller
|
||||
public class WebViewController extends BaseController {
|
||||
|
||||
private final static String VIEW_PATH = "/oss/base/" ;
|
||||
|
||||
/**
|
||||
* 非超级管理员用户登录不了后台
|
||||
* @param req
|
||||
* @param resp
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/oss")
|
||||
public String ossManager(HttpServletRequest req, HttpServletResponse resp) {
|
||||
UserInfoBO userInfo = getUserInfoBySession(req);
|
||||
if(userInfo.getType() == Code.UserType.SUPER){
|
||||
return VIEW_PATH + "index";
|
||||
}else{
|
||||
return "redirect:/";
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/base/{viewName}")
|
||||
public String viewPage(HttpServletRequest req, HttpServletResponse resp,
|
||||
@PathVariable String viewName) {
|
||||
setModel(req,viewName);
|
||||
return VIEW_PATH + viewName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取省市
|
||||
* @param req
|
||||
* @param resp
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/baidu/api/geocoder")
|
||||
@ResponseBody
|
||||
public String baiduApiGeocoder(String lat,String lon,HttpServletRequest req, HttpServletResponse resp) {
|
||||
String url = ProConfig.BD_API_GEOCODER+"?location="+lat+","+lon+"&key="+ProConfig.Map.BAIDU_MAP_KEY+"&output=json";
|
||||
String[] strings = HttpServiceSender.doGet(url);
|
||||
JSONObject jsonObject = JsonUtils.getJSONObject(strings[1]);
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
private void setModel(HttpServletRequest req , String viewName){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,326 @@
|
|||
package com.lp.controller;
|
||||
|
||||
import com.lp.bo.UserInfoBO;
|
||||
import com.lp.cache.CacheName;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.service.base.FileInfoService;
|
||||
import com.lp.util.LogUtil;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.WxMenu;
|
||||
import me.chanjar.weixin.common.bean.WxMenu.WxMenuButton;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.StringUtils;
|
||||
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl;
|
||||
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class WxMpController extends BaseController {
|
||||
|
||||
@Resource(name = "wxMpService")
|
||||
private WxMpServiceImpl wxMpService;
|
||||
|
||||
@Resource(name = "wxMpMessageRouter")
|
||||
private WxMpMessageRouter wxMpMessageRouter;
|
||||
|
||||
@Autowired
|
||||
private WxMpInMemoryConfigStorage wxMpConfigStorage;
|
||||
|
||||
protected final static Logger LOGGER = LoggerFactory.getLogger(WxMpController.class);
|
||||
/**
|
||||
* 微信消息 和事件推送
|
||||
*
|
||||
* @param signature
|
||||
* @param timestamp
|
||||
* @param nonce
|
||||
* @param echostr
|
||||
* @param req
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "weixin/mp/msg")
|
||||
public void verifyMsg(@RequestParam(value = "signature", required = false) String signature,
|
||||
@RequestParam(value = "timestamp", required = false) String timestamp,
|
||||
@RequestParam(value = "nonce", required = false) String nonce,
|
||||
@RequestParam(value = "echostr", required = false) String echostr, HttpServletRequest req,
|
||||
HttpServletResponse response) throws IOException {
|
||||
LOGGER.debug("get echostr with {}", echostr);
|
||||
PrintWriter out = response.getWriter();
|
||||
out.write(echostr);
|
||||
out.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信消息 和事件推送
|
||||
*
|
||||
* @param req
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = "weixin/mp/msg")
|
||||
public void rcvMsg(HttpServletRequest req, HttpServletResponse response) throws Exception {
|
||||
WxMpXmlMessage msg = WxMpXmlMessage.fromXml(req.getInputStream());
|
||||
// 事件
|
||||
if (WxConsts.XML_MSG_EVENT.equals(msg.getMsgType())) {
|
||||
// subscribe(订阅) 、 unsubscribe(取消订阅)
|
||||
if ("subscribe".equals(msg.getEvent())) {
|
||||
// 给用户发送含有绑定url的消息通知
|
||||
String user_open_id = msg.getFromUserName();
|
||||
|
||||
WxMpCustomMessage ms = new WxMpCustomMessage();
|
||||
ms.setToUser(user_open_id);
|
||||
ms.setMsgType("text");
|
||||
ms.setContent("欢迎关注"+ ProConfig.PROJECT_NAME +"公众号服务平台!");
|
||||
wxMpService.customMessageSend(ms);
|
||||
|
||||
// 发送图文消息
|
||||
|
||||
} else if ("unsubscribe".equals(msg.getEvent())) {
|
||||
// 取消订阅
|
||||
}
|
||||
}else if(WxConsts.XML_MSG_TEXT.equals(msg.getMsgType()) ){
|
||||
// 文字消息
|
||||
|
||||
}else if(WxConsts.XML_MSG_IMAGE.equals(msg.getMsgType()) ){
|
||||
// 图片消息
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建微信菜单
|
||||
*
|
||||
* @param req
|
||||
* @param response
|
||||
* @throws IOException
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "weixin/mp/menu/create")
|
||||
public void menuCreate(HttpServletRequest req, HttpServletResponse response) throws IOException, WxErrorException {
|
||||
PrintWriter out = response.getWriter();
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
createMenu(out);
|
||||
out.write("menu create OK!");
|
||||
out.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信网页授权回调接口
|
||||
*
|
||||
* @param req
|
||||
* @param response
|
||||
* @param state
|
||||
* @param code
|
||||
* @throws IOException
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "oauth2/authorize/weixin/mp")
|
||||
public String authCallback(HttpServletRequest req, HttpServletResponse response,
|
||||
@RequestParam(required = false) String state, @RequestParam(required = false) String code)
|
||||
throws IOException, WxErrorException {
|
||||
if (!StringUtils.isEmpty(code)) {
|
||||
// 通过code换取网页授权access_token
|
||||
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
|
||||
// ---
|
||||
String openid = wxMpOAuth2AccessToken.getOpenId();
|
||||
// 设置到session中
|
||||
req.getSession().setAttribute("open_id", openid);
|
||||
|
||||
if(state.contains("cbind")){
|
||||
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
|
||||
// 联系人信息绑定
|
||||
UserInfoBO userx = new UserInfoBO() ;
|
||||
userx.setWx_open_id(openid);
|
||||
if( wxMpUser.getHeadImgUrl().length() > 190 ){
|
||||
userx.setWx_img_url(wxMpUser.getHeadImgUrl());
|
||||
}else{
|
||||
// 设置默认图片
|
||||
userx.setWx_img_url(ProConfig.LOCAL_DOMAIN +"/image/oss/iot/default.jpg" );
|
||||
}
|
||||
req.getSession().setAttribute("user", userx);
|
||||
// 这个session 时间设置的短一点
|
||||
req.getSession().setMaxInactiveInterval(30);
|
||||
return "redirect:" + state.replace("*", "&");
|
||||
}
|
||||
|
||||
UserInfoBO user = ProCacheUtil.getCache(CacheName.USERINFO_OPENID, openid);
|
||||
|
||||
if( ObjectUtil.isEmpty(user) ){
|
||||
// 获取用户更多的信息,snap_userinfo 授权
|
||||
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
|
||||
|
||||
if( state.contains("bind") ){
|
||||
// 账户绑定,将微信或者url
|
||||
if(wxMpUser.getHeadImgUrl().length() < 180){
|
||||
req.getSession().setAttribute("wximg", wxMpUser.getHeadImgUrl());
|
||||
}
|
||||
req.getSession().setAttribute("nickname", wxMpUser.getNickname());
|
||||
// 跳转到绑定页面
|
||||
return "redirect:/service/wiot/bind" ;
|
||||
|
||||
}
|
||||
}
|
||||
// 账户已存在,则不做处理
|
||||
req.getSession().setAttribute("user", user);
|
||||
}
|
||||
return "redirect:" + state.replace("*", "&");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建菜单
|
||||
*
|
||||
* @throws WxErrorException
|
||||
* @throws UnsupportedEncodingException
|
||||
* test:
|
||||
* http://chen.sub.testlg.com/lpro/service/weixin/mp/menu/create
|
||||
*/
|
||||
|
||||
public String createMenu(PrintWriter out) throws WxErrorException, UnsupportedEncodingException {
|
||||
String ret_msg = null;
|
||||
// 初始化菜单
|
||||
WxMenu wxMenu = new WxMenu();
|
||||
// 微信一级菜单列表
|
||||
List<WxMenuButton> menuList = new ArrayList<WxMenuButton>();
|
||||
|
||||
String url = ProConfig.LOCAL_DOMAIN ;
|
||||
|
||||
generateWeixinMenu(menuList, Arrays.asList("实时监控", url+ "/service/wiot/scene"), null);
|
||||
|
||||
generateWeixinMenu(menuList, Arrays.asList("报警管理", url+ "/service/wiot/alarm"), null);
|
||||
|
||||
generateWeixinMenu(menuList, Arrays.asList("个人信息") ,
|
||||
Arrays.asList(
|
||||
Arrays.asList("项目信息",url+ "/service/wiot/mscene"),
|
||||
Arrays.asList("设备配网",url+ "/service/wiot/deviceConfigwifi")
|
||||
));
|
||||
|
||||
wxMenu.setButtons(menuList);
|
||||
wxMpService.menuCreate(wxMenu);
|
||||
return ret_msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具类
|
||||
* @param menuList
|
||||
* @param parent
|
||||
* @param sub
|
||||
*/
|
||||
private void generateWeixinMenu(List<WxMenuButton> menuList,List<String> parent,List<List<String>> sub ){
|
||||
WxMenuButton parentMenu = new WxMenuButton();
|
||||
if(parent.size() >1){
|
||||
parentMenu.setName(parent.get(0));
|
||||
parentMenu.setType("view");
|
||||
parentMenu.setUrl(parent.get(1));
|
||||
}else{
|
||||
parentMenu.setName(parent.get(0));
|
||||
parentMenu.setType("view");
|
||||
|
||||
List<WxMenuButton> secordBtns = new ArrayList<WxMenuButton>();
|
||||
|
||||
for(int i=0; i< sub.size();i++){
|
||||
WxMenuButton askBtn = new WxMenuButton();
|
||||
askBtn.setName(sub.get(i).get(0));
|
||||
askBtn.setType("view");
|
||||
askBtn.setUrl(sub.get(i).get(1));
|
||||
secordBtns.add(askBtn);
|
||||
}
|
||||
parentMenu.setSubButtons(secordBtns);
|
||||
}
|
||||
menuList.add(parentMenu);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private FileInfoService fileInfoService ;
|
||||
|
||||
/**
|
||||
* 将提交到微信文件下载并提交到服务器
|
||||
*
|
||||
* @param req
|
||||
* @param resp
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/wx/media/{media_id}")
|
||||
public ModelAndView getWxMediaInfo(HttpServletRequest req, HttpServletResponse resp,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey, @PathVariable String media_id) {
|
||||
// media_id为附件上传到微信平台的id
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey) ;
|
||||
if(ObjectUtil.isNotEmpty(user)){
|
||||
resultMap = fileInfoService.downFileImgFromWxServer(wxMpConfigStorage.getAccessToken(), media_id, user.getId());
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.NO_AUTHORIZATION);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.ERROR);
|
||||
LogUtil.errorLog(e.getMessage());
|
||||
}
|
||||
return getModelAndView(resp, resultMap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送临时图片消息
|
||||
*
|
||||
* @param open_id
|
||||
* @param content
|
||||
*/
|
||||
public void sendWxMpCustomTempImageMessage(String wx_open_id, String imagePath, String title) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
File imageFile = new File(imagePath);
|
||||
inputStream = new FileInputStream(imageFile);
|
||||
byte b[] = new byte[(int) imageFile.length()]; // 创建合适文件大小的数组
|
||||
inputStream.read(b); // 读取文件中的内容到b[]数组
|
||||
|
||||
// 上传临时图片
|
||||
WxMediaUploadResult wxMediaUploadResult = wxMpService.mediaUpload(WxConsts.CUSTOM_MSG_IMAGE, "jpg",
|
||||
inputStream);
|
||||
|
||||
// 发送图片消息
|
||||
WxMpCustomMessage wm = new WxMpCustomMessage();
|
||||
wm.setToUser(wx_open_id);
|
||||
wm.setMsgType(WxConsts.CUSTOM_MSG_IMAGE);
|
||||
// wm.setToUser("from " + wx_open_id);
|
||||
wm.setMediaId(wxMediaUploadResult.getMediaId());
|
||||
|
||||
wxMpService.customMessageSend(wm);
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtil.errorLog(e.getMessage());
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
package com.lp.controller.iot;
|
||||
|
||||
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.AlarmTriggerRecordBO;
|
||||
import com.lp.bo.UserAccountInfoBO;
|
||||
import com.lp.cache.CacheName;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.common.Constants;
|
||||
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
@Controller
|
||||
|
||||
public class AlarmTriggerRecordController extends BaseController {
|
||||
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmTriggerRecord.ALARM_TRIGGER_RECORD_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody AlarmTriggerRecordBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("AlarmTriggerRecord.selectPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检索 短信和语音的发送量
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmTriggerRecord.ALARM_TRIGGER_RECORD_STATISTIC_PAGE)
|
||||
public ModelAndView selectStatisticPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody AlarmTriggerRecordBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("AlarmTriggerRecord.selectStatisticPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmTriggerRecord.ALARM_TRIGGER_RECORD)
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody AlarmTriggerRecordBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.insert("AlarmTriggerRecord.insert", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.AlarmTriggerRecord.ALARM_TRIGGER_RECORD)
|
||||
public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("AlarmTriggerRecord.selectOne", new AlarmTriggerRecordBO(id));
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.AlarmTriggerRecord.ALARM_TRIGGER_RECORD)
|
||||
public ModelAndView update(HttpServletResponse response, @RequestBody AlarmTriggerRecordBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("AlarmTriggerRecord.update", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改短信和语音的数量
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.AlarmTriggerRecord.ALARM_TRIGGER_RECORD_UPDATE)
|
||||
public ModelAndView updateInfoNum(HttpServletResponse response, @RequestBody AlarmTriggerRecordBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("AlarmTriggerRecord.updateSmsVocieNum", obj);
|
||||
// 这边更新的该用户的缓存
|
||||
if(isOk(resultMap)){
|
||||
//
|
||||
UserAccountInfoBO userAccount = ProCacheUtil.getCache(CacheName.USERACCOUNT_ID , obj.getUser_id().toString()) ;
|
||||
if( ObjectUtil.isEmpty(userAccount.getSms_num()) ){
|
||||
userAccount.setSms_num(0);
|
||||
}
|
||||
if( ObjectUtil.isEmpty(userAccount.getVoice_num()) ){
|
||||
userAccount.setVoice_num(0);
|
||||
}
|
||||
userAccount.setSms_num( userAccount.getSms_num()+ 0 + obj.getSms_num() );
|
||||
userAccount.setVoice_num( userAccount.getVoice_num()+ 0 + obj.getVoice_num() );
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.AlarmTriggerRecord.ALARM_TRIGGER_RECORD)
|
||||
public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
AlarmTriggerRecordBO obj = new AlarmTriggerRecordBO();
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
} else {
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("AlarmTriggerRecord.update", obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
/**
|
||||
* 版权所有 @鸿名物联
|
||||
* 未经授权,禁止侵权和商业,违法必究
|
||||
* 联系QQ:2224313811
|
||||
*
|
||||
*/
|
||||
package com.lp.controller.iot;
|
||||
|
||||
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.AlarmTriggerStatisticBO;
|
||||
import com.lp.common.Constants;
|
||||
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
@Controller
|
||||
|
||||
public class AlarmTriggerStatisticController extends BaseController {
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody AlarmTriggerStatisticBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("AlarmTriggerStatistic.selectPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC)
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody AlarmTriggerStatisticBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.insert("AlarmTriggerStatistic.insert", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC)
|
||||
public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("AlarmTriggerStatistic.selectOne", new AlarmTriggerStatisticBO(id));
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC)
|
||||
public ModelAndView update(HttpServletResponse response, @RequestBody AlarmTriggerStatisticBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("AlarmTriggerStatistic.update", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.AlarmTriggerStatistic.ALARM_TRIGGER_STATISTIC)
|
||||
public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
AlarmTriggerStatisticBO obj = new AlarmTriggerStatisticBO();
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
} else {
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("AlarmTriggerStatistic.update", obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
import com.lp.bo.ContactUserInfoBO;
|
||||
import com.lp.bo.UserInfoBO;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.QRCodeUtil;
|
||||
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.Map;
|
||||
|
||||
|
||||
@Controller
|
||||
public class ContactUserInfoController extends BaseController {
|
||||
|
||||
/**
|
||||
* 检索
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody ContactUserInfoBO obj,
|
||||
@RequestParam(required=false) Integer pageSize ,
|
||||
@RequestParam Integer paged ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
resultMap = service.selectPageList("ContactUserInfo.selectPage",getPageBean(paged,pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO )
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody ContactUserInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
resultMap = service.insert("ContactUserInfo.insert", obj) ;
|
||||
if(isOk(resultMap)){
|
||||
LOGGER.debug("{} save is called with {}", RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO, obj);
|
||||
// 增加二维码,提供微信公众号绑定 [ 增加新的文件储存隔离系统 ]
|
||||
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
|
||||
, false,obj.getId()+"");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
ContactUserInfoBO obj = new ContactUserInfoBO(id);
|
||||
obj.setUser_id(user.getId());
|
||||
resultMap = service.selectOne("ContactUserInfo.selectOne", obj ) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO)
|
||||
public ModelAndView update(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody ContactUserInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
//UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
//obj.setUser_id(user.getId());
|
||||
resultMap = service.update("ContactUserInfo.update", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.ContactUserInfo.CONTACT_USER_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
ContactUserInfoBO obj = new ContactUserInfoBO();
|
||||
if(ObjectUtil.isEmpty(id)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("ContactUserInfo.update", obj) ;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
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.HkAccountInfoBO;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
@Controller
|
||||
|
||||
public class HkAccountInfoController extends BaseController {
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.HkAccountInfo.HK_ACCOUNT_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody HkAccountInfoBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("HkAccountInfo.selectPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.HkAccountInfo.HK_ACCOUNT_INFO)
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody HkAccountInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.insert("HkAccountInfo.insert", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.HkAccountInfo.HK_ACCOUNT_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("HkAccountInfo.selectOne", new HkAccountInfoBO(id));
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.HkAccountInfo.HK_ACCOUNT_INFO)
|
||||
public ModelAndView update(HttpServletResponse response, @RequestBody HkAccountInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("HkAccountInfo.update", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.HkAccountInfo.HK_ACCOUNT_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
HkAccountInfoBO obj = new HkAccountInfoBO();
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
} else {
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("HkAccountInfo.update", obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,255 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
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.IotAlarmInfoBO;
|
||||
import com.lp.bo.UserInfoBO;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.CodeIot;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.DateUtils;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
|
||||
@Controller
|
||||
public class IotAlarmInfoController extends BaseController {
|
||||
|
||||
/**
|
||||
* 检索
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmInfo.ALARM_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotAlarmInfoBO obj,
|
||||
@RequestParam(required=false) Integer pageSize ,
|
||||
@RequestParam Integer paged ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
resultMap = service.selectPageList("IotAlarmInfo.selectPage",getPageBean(paged,pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警统计
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmInfo.ALARM_INFO_STATISTIC)
|
||||
public ModelAndView selectAlarmStatisticInfo(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotAlarmInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
if(ObjectUtil.isEmpty(obj.getStart_time())){
|
||||
obj.setStart_time( DateUtils.format(DateUtils.simpleALL, DateUtils.getDate(5)) );
|
||||
}
|
||||
resultMap = service.selectList("IotAlarmInfo.selectStatisticInfo", obj );
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel 下载
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.AlarmInfo.ALARM_INFO_EXCEL )
|
||||
public void excel(HttpServletResponse response,
|
||||
IotAlarmInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
downExcel("IotAlarmInfo.select", "报警信息下载", "tpl/xls/alarm_info_template", obj, response);
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmInfo.ALARM_INFO )
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotAlarmInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.insert("IotAlarmInfo.insert", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.AlarmInfo.ALARM_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
IotAlarmInfoBO obj =new IotAlarmInfoBO(id);
|
||||
obj.setUser_id(user.getId());
|
||||
resultMap = service.selectOne("IotAlarmInfo.selectOne", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记所有为已读
|
||||
* @param response
|
||||
* @param userKey
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.AlarmInfo.ALARM_INFO_READ)
|
||||
public ModelAndView allRead(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey
|
||||
) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
IotAlarmInfoBO obj = new IotAlarmInfoBO();
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
obj.setIot_alarm_process_status(CodeIot.PROCESS_STATUS.YES);
|
||||
resultMap = service.selectOne("IotAlarmInfo.setMyAllread", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.AlarmInfo.ALARM_INFO)
|
||||
public ModelAndView update(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotAlarmInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
resultMap = service.update("IotAlarmInfo.update", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.AlarmInfo.ALARM_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
IotAlarmInfoBO obj = new IotAlarmInfoBO();
|
||||
if(ObjectUtil.isEmpty(id)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("IotAlarmInfo.update", obj) ;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询(未读报警)的数量
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmInfo.ALARM_INFO_UNREAD)
|
||||
public ModelAndView selectUnreadCount(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody IotAlarmInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
Integer count = service.count("IotAlarmInfo.selectPageCount", obj);
|
||||
resultMap.put("count", count);
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有报警(大屏统计)
|
||||
*
|
||||
* @param response
|
||||
* @param userKey
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.AlarmInfo.ALARM_INFO_ALL)
|
||||
public ModelAndView selectAll(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody IotAlarmInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
UserInfoBO user = getUserInfoByUserKey(userKey);
|
||||
obj.setUser_id(user.getId());
|
||||
resultMap = service.selectList("IotAlarmInfo.selectAll", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
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.IotHistoryNodeDataBO;
|
||||
import com.lp.common.Constants;
|
||||
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
@Controller
|
||||
|
||||
public class IotHistoryNodeDataController extends BaseController {
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.IotHistoryNodeData.IOT_HISTORY_NODE_DATA_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody IotHistoryNodeDataBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("IotHistoryNodeData.selectPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.IotHistoryNodeData.IOT_HISTORY_NODE_DATA)
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody IotHistoryNodeDataBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.insert("IotHistoryNodeData.insert", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.IotHistoryNodeData.IOT_HISTORY_NODE_DATA)
|
||||
public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("IotHistoryNodeData.selectOne", new IotHistoryNodeDataBO(id));
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.IotHistoryNodeData.IOT_HISTORY_NODE_DATA)
|
||||
public ModelAndView update(HttpServletResponse response, @RequestBody IotHistoryNodeDataBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("IotHistoryNodeData.update", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.IotHistoryNodeData.IOT_HISTORY_NODE_DATA)
|
||||
public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
IotHistoryNodeDataBO obj = new IotHistoryNodeDataBO();
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
} else {
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("IotHistoryNodeData.update", obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,337 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
import com.lp.bo.IotHistorySensorDataBO;
|
||||
import com.lp.bo.IotSensorInfoBO;
|
||||
import com.lp.cache.CacheName;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.service.IotHistorySensorDataService;
|
||||
import com.lp.util.DateUtils;
|
||||
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.CSVPrinter;
|
||||
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.io.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Controller
|
||||
public class IotHistorySensorInfoController extends BaseController {
|
||||
|
||||
/**
|
||||
* 检索
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotHistorySensorDataBO obj,
|
||||
@RequestParam(required=false) Integer pageSize ,
|
||||
@RequestParam Integer paged ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// 这边暂时不管,当前场景是否是该有用户的数据
|
||||
if( ObjectUtil.isNotEmpty(obj.getSensor_id()) || ObjectUtil.isNotEmpty(obj.getScene_id()) ){
|
||||
if( ObjectUtil.isNotEmpty( obj.getQuery_interval_type())){
|
||||
if(obj.getQuery_interval_type() == 1){
|
||||
obj.setInterval_p1("%Y%d%m%k%i");
|
||||
obj.setInterval_p2("%s");
|
||||
obj.setInterval_p3(30);
|
||||
}else if(obj.getQuery_interval_type() == 2){
|
||||
obj.setInterval_p1("%Y%d%m%k");
|
||||
obj.setInterval_p2("%i");
|
||||
obj.setInterval_p3(1);
|
||||
}else if(obj.getQuery_interval_type() == 3){
|
||||
obj.setInterval_p1("%Y%d%m%k");
|
||||
obj.setInterval_p2("%i");
|
||||
obj.setInterval_p3(30);
|
||||
}else if(obj.getQuery_interval_type() == 4){
|
||||
obj.setInterval_p1("%Y%d%m");
|
||||
obj.setInterval_p2("%k");
|
||||
obj.setInterval_p3(1);
|
||||
}
|
||||
resultMap = service.selectPageList("IotHistorySensorData.selectGroupByPage",getPageBean(paged,pageSize), obj);
|
||||
}else{
|
||||
resultMap = service.selectPageList("IotHistorySensorData.selectPage",getPageBean(paged,pageSize), obj);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
PageBean data = (PageBean) getData(resultMap);
|
||||
List<IotHistorySensorDataBO> data1 = (List<IotHistorySensorDataBO>) data.getData();
|
||||
LOGGER.debug("/page/sensor/history selectPage return: {}", resultMap);
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检索列表
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO_LIST)
|
||||
public ModelAndView selectList(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotHistorySensorDataBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(ObjectUtil.isNotEmpty(obj.getStart_time()) && ObjectUtil.isNotEmpty(obj.getEnd_time()) ){
|
||||
|
||||
// 这边做特殊情况,传 node_id, sensor_device_id 和 port_id的时候,转成传感器id去检索历史数据
|
||||
if(ObjectUtil.isEmpty(obj.getSensor_id()) && ObjectUtil.isNotEmpty(obj.getNode_id()) &&
|
||||
ObjectUtil.isNotEmpty(obj.getSensor_device_id()) && ObjectUtil.isNotEmpty(obj.getPort_id()) ){
|
||||
IotSensorInfoBO sensorInfo = ProCacheUtil.getCache(CacheName.SENSORINFO_NSP, obj.getNode_id()+"-"+obj.getSensor_device_id()+"-"+obj.getPort_id()) ;
|
||||
obj.setSensor_id(sensorInfo.getId());
|
||||
}
|
||||
// 这边判断时间不允许超过一个月,否则强行设置一个月;
|
||||
Date start_time = DateUtils.parse(DateUtils.simpleALL, obj.getStart_time());
|
||||
Date end_time = DateUtils.parse(DateUtils.simpleALL,obj.getEnd_time());
|
||||
if( start_time.getTime() + (long)32*24*3600*1000 < end_time.getTime()){
|
||||
// 时间出错
|
||||
obj.setStart_time( DateUtils.format(DateUtils.simpleALL, DateUtils.getBeforeOneDateTime(end_time)) );
|
||||
}
|
||||
// 这边暂时不管,当前场景是否是该有用户的数据
|
||||
if( ObjectUtil.isNotEmpty(obj.getSensor_id()) || ObjectUtil.isNotEmpty(obj.getScene_id()) ){
|
||||
if( ObjectUtil.isNotEmpty( obj.getQuery_interval_type())){
|
||||
if(obj.getQuery_interval_type() == 1){
|
||||
obj.setInterval_p1("%Y%d%m%k%i");
|
||||
obj.setInterval_p2("%s");
|
||||
obj.setInterval_p3(30);
|
||||
}else if(obj.getQuery_interval_type() == 2){
|
||||
obj.setInterval_p1("%Y%d%m%k");
|
||||
obj.setInterval_p2("%i");
|
||||
obj.setInterval_p3(1);
|
||||
}else if(obj.getQuery_interval_type() == 3){
|
||||
obj.setInterval_p1("%Y%d%m%k");
|
||||
obj.setInterval_p2("%i");
|
||||
obj.setInterval_p3(30);
|
||||
}else if(obj.getQuery_interval_type() == 4){
|
||||
obj.setInterval_p1("%Y%d%m");
|
||||
obj.setInterval_p2("%k");
|
||||
obj.setInterval_p3(1);
|
||||
}
|
||||
resultMap = service.selectList("IotHistorySensorData.selectGroupByPage", obj);
|
||||
}else{
|
||||
resultMap = service.selectList("IotHistorySensorData.selectPage", obj) ;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IotHistorySensorDataService hisSensorService ;
|
||||
|
||||
/**
|
||||
* 历史数据分析会调用此接口 page/myhtml/index.html getChartData
|
||||
* 批量获取多个传感器历史数据
|
||||
* @param response
|
||||
* @param userKey
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.SensorHistoryInfo.SENSORS_HISTORY_DATA)
|
||||
public ModelAndView selectDatas(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey , @RequestBody IotHistorySensorDataBO obj,
|
||||
@RequestParam(required=false) Integer pageSize ,
|
||||
@RequestParam Integer paged ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
if(pageSize == null)
|
||||
pageSize = 300 ;
|
||||
obj.setLimit(pageSize);
|
||||
obj.setOffset( (paged-1)*pageSize );
|
||||
resultMap = hisSensorService.getHistorySensorData(obj) ;
|
||||
resultMap.put("paged", paged) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel 下载
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO_INFO )
|
||||
public void excel(HttpServletResponse response,
|
||||
IotHistorySensorDataBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// 这边需要对查询的数据进行判断是否数据量过大,如果大于5000 条,则通过CSV下载,并且CSV通过分段下载
|
||||
int allCount = service.count("IotHistorySensorData.selectPageCount", obj) ;
|
||||
if(allCount < 1){
|
||||
downExcel("IotHistorySensorData.select","历史数据下载","tpl/xls/history_sensor_data_template",obj, response);
|
||||
}else{
|
||||
// 这边就需要分段下载
|
||||
int num = allCount / 5000 +1 ;
|
||||
|
||||
String fileRealPath = ProConfig.LOCAL_FILE_PATH + Constants.FileRealPath.NORMAL +"/"
|
||||
+ DateUtils.format(DateUtils.dtShort , new Date()) + "/"
|
||||
;
|
||||
|
||||
if(! new File(fileRealPath).exists()){
|
||||
new File(fileRealPath).mkdirs();
|
||||
}
|
||||
File f = new File(fileRealPath
|
||||
+ "historySensorData" + DateUtils.format(DateUtils.dtShort , new Date())+".csv");
|
||||
FileOutputStream fos = new FileOutputStream(f );
|
||||
|
||||
// excel兼容
|
||||
fos.write(new byte[] { (byte) 0xEF, (byte) 0xBB,(byte) 0xBF } );
|
||||
|
||||
OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
|
||||
|
||||
// csv 格式
|
||||
CSVFormat csvFormat = CSVFormat.DEFAULT.withHeader("序号", "传感器名称", "数值", "时间"); // "类型"
|
||||
CSVPrinter csvPrinter = new CSVPrinter(osw, csvFormat);
|
||||
for (int i = 0; i < num; i++) {
|
||||
obj.setLimit(5000);
|
||||
obj.setOffset(i*5000);
|
||||
List<IotHistorySensorDataBO> list = getData( service.selectList("IotHistorySensorData.selectPage", obj) );
|
||||
for(int j=0;j<list.size();j++){
|
||||
csvPrinter.printRecord(i*5000 + (j+1) ,list.get(j).getSensor_name(), list.get(j).getSdata()+list.get(j).getData().get("measure_unit_type"),
|
||||
list.get(j).getAtimestr() ); // list.get(j).getData().get("iot_sensor_type")
|
||||
}
|
||||
// 这边需要对list 清空缓存
|
||||
list = null ;
|
||||
System.gc();
|
||||
}
|
||||
csvPrinter.flush();
|
||||
csvPrinter.close();
|
||||
|
||||
// 返回文件流
|
||||
InputStream bis = new BufferedInputStream(new FileInputStream(f));
|
||||
byte[] buffer = new byte[bis.available()];
|
||||
bis.read(buffer);
|
||||
bis.close();
|
||||
// 清空response
|
||||
response.reset();
|
||||
// 设置response的Header
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment;filename=" + new String(f.getName().getBytes("gb2312"), "ISO8859-1"));
|
||||
response.addHeader("Content-Length", "" + f.length());
|
||||
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
||||
response.setContentType("application/vnd.ms-excel;charset=gb2312");
|
||||
|
||||
toClient.write(buffer);
|
||||
toClient.flush();
|
||||
toClient.close();
|
||||
// 删除生成的临时文件
|
||||
if (f.exists()) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO )
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotHistorySensorDataBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
|
||||
resultMap = service.insert("IotHistorySensorData.insert", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("IotHistorySensorData.selectOne", new IotHistorySensorDataBO(id)) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
LOGGER.debug("{} selectOne return {}", RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO, resultMap);
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO)
|
||||
public ModelAndView update(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotHistorySensorDataBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("IotHistorySensorData.update", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.SensorHistoryInfo.SENSOR_HISTORY_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
IotHistorySensorDataBO obj = new IotHistorySensorDataBO();
|
||||
if(ObjectUtil.isEmpty(id)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("IotHistorySensorData.update", obj) ;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
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.IotHistoryTriggerInfoBO;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
|
||||
@Controller
|
||||
public class IotHistoryTriggerInfoController extends BaseController {
|
||||
|
||||
/**
|
||||
* 检索
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.TriggerHistoryInfo.TRIGGER_HISTORY_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotHistoryTriggerInfoBO obj,
|
||||
@RequestParam(required=false) Integer pageSize ,
|
||||
@RequestParam Integer paged ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
// 这边查询,需要有场景id
|
||||
if( ObjectUtil.isNotEmpty(obj.getScene_id()) ){
|
||||
resultMap = service.selectPageList("IotHistoryTriggerInfo.selectPage",getPageBean(paged,pageSize), obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel 下载
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.TriggerHistoryInfo.TRIGGER_HISTORY_INFO_EXCEL )
|
||||
public void excel(HttpServletResponse response,
|
||||
IotHistoryTriggerInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
downExcel("IotHistoryTriggerInfo.select", "触发历史下载", "tpl/xls/history_action_template", obj, response);
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param response
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.TriggerHistoryInfo.TRIGGER_HISTORY_INFO)
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotHistoryTriggerInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
|
||||
resultMap = service.insert("IotHistoryTriggerInfo.insert", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.TriggerHistoryInfo.TRIGGER_HISTORY_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
|
||||
resultMap = service.selectOne("IotHistoryTriggerInfo.selectOne", new IotHistoryTriggerInfoBO(id)) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param response
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.TriggerHistoryInfo.TRIGGER_HISTORY_INFO)
|
||||
public ModelAndView update(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestBody IotHistoryTriggerInfoBO obj ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("IotHistoryTriggerInfo.update", obj) ;
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param response
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.TriggerHistoryInfo.TRIGGER_HISTORY_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey ,
|
||||
@RequestParam Integer id ) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
IotHistoryTriggerInfoBO obj = new IotHistoryTriggerInfoBO();
|
||||
if(ObjectUtil.isEmpty(id)){
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
}else{
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("IotHistoryTriggerInfo.update", obj) ;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e,resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
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.IotLpmInfoBO;
|
||||
import com.lp.common.Code;
|
||||
import com.lp.common.Constants;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.util.ObjectUtil;
|
||||
import com.lp.util.ResultMapUtils;
|
||||
|
||||
@Controller
|
||||
public class IotLpmInfoController extends BaseController {
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.IotLpmInfo.IOT_LPM_INFO_PAGE)
|
||||
public ModelAndView selectPage(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody IotLpmInfoBO obj, @RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam Integer paged) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectPageList("IotLpmInfo.selectPage", getPageBean(paged, pageSize), obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.IotLpmInfo.IOT_LPM_INFO)
|
||||
public ModelAndView save(HttpServletResponse response,
|
||||
@RequestHeader(value = ResultMapUtils.USER_KEY, required = true) String userKey,
|
||||
@RequestBody IotLpmInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.insert("IotLpmInfo.insert", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = RequestURLIOT.IotLpmInfo.IOT_LPM_INFO)
|
||||
public ModelAndView selectOne(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.selectOne("IotLpmInfo.selectOne", new IotLpmInfoBO(id));
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.PUT, value = RequestURLIOT.IotLpmInfo.IOT_LPM_INFO)
|
||||
public ModelAndView update(HttpServletResponse response, @RequestBody IotLpmInfoBO obj) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
resultMap = service.update("IotLpmInfo.update", obj);
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, obj);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = RequestURLIOT.IotLpmInfo.IOT_LPM_INFO)
|
||||
public ModelAndView delete(HttpServletResponse response, @RequestParam Integer id) {
|
||||
Map<String, Object> resultMap = getResultMap();
|
||||
try {
|
||||
IotLpmInfoBO obj = new IotLpmInfoBO();
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
putStatusCode(resultMap, Code.ResponseCode.SystemCode.PARAM_ERROR);
|
||||
} else {
|
||||
obj.setId(id);
|
||||
obj.setDelete_flag(Constants.DELETE.YES);
|
||||
resultMap = service.update("IotLpmInfo.update", obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, resultMap, id);
|
||||
}
|
||||
return getModelAndView(response, resultMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.lp.controller.iot;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.lp.bean.MqttServerReCall;
|
||||
import com.lp.bo.IotNodeInfoBO;
|
||||
import com.lp.cache.CacheName;
|
||||
import com.lp.cache.ProCacheUtil;
|
||||
import com.lp.cfg.ProConfig;
|
||||
import com.lp.common.CodeIot;
|
||||
import com.lp.common.RequestURLIOT;
|
||||
import com.lp.controller.BaseController;
|
||||
import com.lp.mqtt.protocol.ProtocalFactory;
|
||||
import com.lp.util.ObjectUtil;
|
||||
|
||||
@Controller
|
||||
public class IotMqttReCallController extends BaseController {
|
||||
|
||||
/**
|
||||
* HTTP 账户、密码鉴权
|
||||
* @param response
|
||||
* @param clientid
|
||||
* @param username
|
||||
* @param password
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.IotMqttCall.IOT_MQTT_AUTH_CLIENT)
|
||||
public void authClient(HttpServletResponse response,
|
||||
@RequestParam(required=true) String clientid ,@RequestParam(required=false) String username,
|
||||
@RequestParam(required=false) String password ) {
|
||||
try {
|
||||
if( ProConfig.MQTT.PASSWORD.equals(password) && ProConfig.MQTT.USERNAME.equals(username)){
|
||||
response.setStatus(200);
|
||||
return ;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
exception(e, clientid+","+username+","+password);
|
||||
}
|
||||
response.setStatus(401);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备上下线
|
||||
* @param response
|
||||
* @param obj
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, value = RequestURLIOT.IotMqttCall.IOT_MQTT_CLIENT_NOTICE)
|
||||
public void authClient(HttpServletResponse response,
|
||||
@RequestBody MqttServerReCall obj ) {
|
||||
try {
|
||||
IotNodeInfoBO node = new IotNodeInfoBO();
|
||||
node.setDevice_code(obj.getClient_id());
|
||||
|
||||
IotNodeInfoBO nodeInfo = ProCacheUtil.getCache(CacheName.NODEINFO_DEVICECODE, obj.getClient_id() );
|
||||
if(ObjectUtil.isEmpty(nodeInfo)){
|
||||
response.setStatus(200);
|
||||
return ;
|
||||
}
|
||||
if("session_created".equals(obj.getAction())){
|
||||
// 更新网关在线
|
||||
node.setIot_node_status(CodeIot.DEVICE_STATUS.ONLINE);
|
||||
}else if("session_terminated".equals(obj.getAction())){
|
||||
// 更新网关离线
|
||||
node.setIot_node_status(CodeIot.DEVICE_STATUS.OFFLINE);
|
||||
}
|
||||
ProtocalFactory.getInstance(nodeInfo.getIot_protocal_category()).loginProtocal(node);
|
||||
} catch (Exception e) {
|
||||
exception(e, obj);
|
||||
}
|
||||
response.setStatus(200);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue