commit
					c57d9580ed
				
				 375 changed files with 30136 additions and 0 deletions
			
			
		@ -0,0 +1,55 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<project xmlns="http://maven.apache.org/POM/4.0.0" | 
				
			||||
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 
				
			||||
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | 
				
			||||
    <parent> | 
				
			||||
        <groupId>com.mh</groupId> | 
				
			||||
        <artifactId>mh_esi</artifactId> | 
				
			||||
        <version>1.0-SNAPSHOT</version> | 
				
			||||
    </parent> | 
				
			||||
    <modelVersion>4.0.0</modelVersion> | 
				
			||||
 | 
				
			||||
    <groupId>com.mh</groupId> | 
				
			||||
    <artifactId>common</artifactId> | 
				
			||||
    <version>0.0.1-SNAPSHOT</version> | 
				
			||||
    <packaging>jar</packaging> | 
				
			||||
 | 
				
			||||
    <properties> | 
				
			||||
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 
				
			||||
        <encoding>UTF-8</encoding> | 
				
			||||
        <java.version>1.8</java.version> | 
				
			||||
        <maven.compiler.source>1.8</maven.compiler.source> | 
				
			||||
        <maven.compiler.target>1.8</maven.compiler.target> | 
				
			||||
    </properties> | 
				
			||||
    <dependencies> | 
				
			||||
 | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.alibaba</groupId> | 
				
			||||
            <artifactId>fastjson</artifactId> | 
				
			||||
            <version>1.2.31</version> | 
				
			||||
        </dependency> | 
				
			||||
        <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter --> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.github.pagehelper</groupId> | 
				
			||||
            <artifactId>pagehelper-spring-boot-starter</artifactId> | 
				
			||||
            <version>1.2.13</version> | 
				
			||||
        </dependency> | 
				
			||||
        <!-- web --> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-web</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
        <!-- commons-beanutils --> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>commons-beanutils</groupId> | 
				
			||||
            <artifactId>commons-beanutils</artifactId> | 
				
			||||
            <version>1.9.3</version> | 
				
			||||
        </dependency> | 
				
			||||
        <!-- poi --> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.apache.poi</groupId> | 
				
			||||
            <artifactId>poi-ooxml</artifactId> | 
				
			||||
            <version>4.0.1</version> | 
				
			||||
        </dependency> | 
				
			||||
    </dependencies> | 
				
			||||
</project> | 
				
			||||
@ -0,0 +1,26 @@
					 | 
				
			||||
package com.mh.common.dto; | 
				
			||||
 | 
				
			||||
import java.io.Serializable; | 
				
			||||
 | 
				
			||||
public class RespDTO<T> implements Serializable{ | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    public int code = 0; | 
				
			||||
    public String error = ""; | 
				
			||||
    public T data; | 
				
			||||
 | 
				
			||||
    public static RespDTO onSuc(Object data) { | 
				
			||||
        RespDTO resp = new RespDTO(); | 
				
			||||
        resp.data = data; | 
				
			||||
        return resp; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return "RespDTO{" + | 
				
			||||
                "code=" + code + | 
				
			||||
                ", error='" + error + '\'' + | 
				
			||||
                ", data=" + data + | 
				
			||||
                '}'; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,9 @@
					 | 
				
			||||
package com.mh.common.exception; | 
				
			||||
 | 
				
			||||
public interface BaseErrorInfo { | 
				
			||||
    /** 错误码*/ | 
				
			||||
    int getResultCode(); | 
				
			||||
 | 
				
			||||
    /** 错误描述*/ | 
				
			||||
    String getResultMsg(); | 
				
			||||
} | 
				
			||||
@ -0,0 +1,50 @@
					 | 
				
			||||
package com.mh.common.exception; | 
				
			||||
 | 
				
			||||
public enum CommonNum implements BaseErrorInfo { | 
				
			||||
    /** | 
				
			||||
     * 自定义错误信息 | 
				
			||||
     */ | 
				
			||||
    SUCCESS(200, "成功!"), | 
				
			||||
    BODY_NOT_MATCH(400,"请求的数据格式不符!"), | 
				
			||||
    SIGNATURE_NOT_MATCH(401,"请求的数字签名不匹配!"), | 
				
			||||
    NOT_FOUND(404, "未找到该资源!"), | 
				
			||||
    INTERNAL_SERVER_ERROR(500, "服务器内部错误!"), | 
				
			||||
    SERVER_BUSY(503,"服务器正忙,请稍后再试!"), | 
				
			||||
 | 
				
			||||
    OK(0, ""), | 
				
			||||
    FAIL(-1, "操作失败"), | 
				
			||||
    RPC_ERROR(-2,"远程调度失败"), | 
				
			||||
    USER_NOT_FOUND(1000,"用户不存在"), | 
				
			||||
    USER_PASSWORD_ERROR(1001,"密码错误"), | 
				
			||||
    GET_TOKEN_FAIL(1002,"获取token失败"), | 
				
			||||
    TOKEN_IS_NOT_MATCH_USER(1003,"请使用自己的token进行接口请求"), | 
				
			||||
    BLOG_IS_NOT_EXIST(2001,"该博客不存在"); | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 错误码 | 
				
			||||
     */ | 
				
			||||
    private int resultCode; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 错误描述 | 
				
			||||
     */ | 
				
			||||
    private String resultMsg; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    CommonNum(int resultCode, String resultMsg) { | 
				
			||||
        this.resultCode = resultCode; | 
				
			||||
        this.resultMsg = resultMsg; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int getResultCode() { | 
				
			||||
        return resultCode; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String getResultMsg() { | 
				
			||||
        return resultMsg; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
 | 
				
			||||
 | 
				
			||||
@ -0,0 +1,52 @@
					 | 
				
			||||
package com.mh.common.exception; | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import org.slf4j.Logger; | 
				
			||||
import org.slf4j.LoggerFactory; | 
				
			||||
import org.springframework.web.bind.annotation.ControllerAdvice; | 
				
			||||
import org.springframework.web.bind.annotation.ExceptionHandler; | 
				
			||||
import org.springframework.web.bind.annotation.ResponseBody; | 
				
			||||
 | 
				
			||||
@ControllerAdvice | 
				
			||||
public class GlobalException { | 
				
			||||
    private static final Logger logger = LoggerFactory.getLogger(GlobalException.class); | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 处理自定义异常 | 
				
			||||
     * @param e | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @ResponseBody | 
				
			||||
    @ExceptionHandler(value = ServiceRuntimeException.class) | 
				
			||||
    public HttpResult serviceRuntimeException(ServiceRuntimeException e){ | 
				
			||||
        logger.error("发生业务异常!原因是:{}",e.getMessage()); | 
				
			||||
        return HttpResult.error(e.getCode(),e.getMessage()); | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 处理空指针异常 | 
				
			||||
     * @param e | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @ResponseBody | 
				
			||||
    @ExceptionHandler(value = NullPointerException.class) | 
				
			||||
    public HttpResult exceptionHandler(NullPointerException e){ | 
				
			||||
        logger.error("发生空指针异常!原因是:",e); | 
				
			||||
        return HttpResult.error(CommonNum.BODY_NOT_MATCH.toString()); | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 其它异常 | 
				
			||||
     * @param e | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @ResponseBody | 
				
			||||
    @ExceptionHandler(value = Exception.class) | 
				
			||||
    public HttpResult exceptionHandler(Exception e){ | 
				
			||||
        logger.error("发生空指针异常!原因是:",e); | 
				
			||||
        return HttpResult.error(CommonNum.INTERNAL_SERVER_ERROR.toString()); | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,64 @@
					 | 
				
			||||
package com.mh.common.exception; | 
				
			||||
 | 
				
			||||
public class ServiceRuntimeException extends RuntimeException{ | 
				
			||||
    /** | 
				
			||||
     * 错误码 | 
				
			||||
     */ | 
				
			||||
    private int code; | 
				
			||||
    /** | 
				
			||||
     * 错误信息 | 
				
			||||
     */ | 
				
			||||
    private String message; | 
				
			||||
 | 
				
			||||
    public ServiceRuntimeException(String message){ | 
				
			||||
        super(message); | 
				
			||||
        this.message = message; | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public ServiceRuntimeException(int code,String message){ | 
				
			||||
        super(message); | 
				
			||||
        this.code = code; | 
				
			||||
        this.message = message; | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //Throwable是Error和Exception的父类,用来定义所有可以作为异常被抛出来的类。
 | 
				
			||||
    public ServiceRuntimeException(int code,String message,Throwable cause){ | 
				
			||||
        super(message,cause); | 
				
			||||
        this.code = code; | 
				
			||||
        this.message = message; | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public ServiceRuntimeException(BaseErrorInfo baseErrorInfo){ | 
				
			||||
        super(baseErrorInfo.getResultMsg()); | 
				
			||||
        this.code = baseErrorInfo.getResultCode(); | 
				
			||||
        this.message = baseErrorInfo.getResultMsg(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public ServiceRuntimeException(BaseErrorInfo baseErrorInfo,Throwable cause){ | 
				
			||||
        super(baseErrorInfo.getResultMsg(),cause); | 
				
			||||
        this.code = baseErrorInfo.getResultCode(); | 
				
			||||
        this.message = baseErrorInfo.getResultMsg(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    public int getCode() { | 
				
			||||
        return code; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setCode(int code) { | 
				
			||||
        this.code = code; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String getMessage() { | 
				
			||||
        return message; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMessage(String message) { | 
				
			||||
        this.message = message; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
 | 
				
			||||
@ -0,0 +1,96 @@
					 | 
				
			||||
package com.mh.common.http; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * HTTP结果封装 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Jan 12, 2019 | 
				
			||||
 */ | 
				
			||||
public class HttpResult { | 
				
			||||
 | 
				
			||||
	private int code = 200; // 为成功
 | 
				
			||||
	private String msg;     // 消息
 | 
				
			||||
	private Object data;    // 数据对象
 | 
				
			||||
	private int count;      // 记录数
 | 
				
			||||
 | 
				
			||||
	public static HttpResult error() { | 
				
			||||
 | 
				
			||||
		return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员"); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public static HttpResult error(String msg) | 
				
			||||
	{ | 
				
			||||
		return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public static HttpResult error(int code, String msg) { | 
				
			||||
		HttpResult r = new HttpResult(); | 
				
			||||
		r.setCode(code); | 
				
			||||
		r.setMsg(msg); | 
				
			||||
		return r; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public static HttpResult ok(String msg) { | 
				
			||||
		HttpResult r = new HttpResult(); | 
				
			||||
		r.setMsg(msg); | 
				
			||||
		return r; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public static HttpResult ok(Object data) { | 
				
			||||
		HttpResult r = new HttpResult(); | 
				
			||||
		r.setData(data); | 
				
			||||
		return r; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public static HttpResult ok(String msg, Object data) { | 
				
			||||
		HttpResult r = new HttpResult(); | 
				
			||||
		r.setMsg(msg); | 
				
			||||
		r.setData(data); | 
				
			||||
		return r; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public static HttpResult ok(int count, Object data) { | 
				
			||||
		HttpResult r = new HttpResult(); | 
				
			||||
		r.setCount(count); | 
				
			||||
		r.setData(data); | 
				
			||||
		return r; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public static HttpResult ok() { | 
				
			||||
		HttpResult r = new HttpResult(); | 
				
			||||
		r.setMsg("success"); | 
				
			||||
		r.setCode(200); | 
				
			||||
		return r; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public int getCode() { | 
				
			||||
		return code; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public void setCode(int code) { | 
				
			||||
		this.code = code; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public String getMsg() { | 
				
			||||
		return msg; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public void setMsg(String msg) { | 
				
			||||
		this.msg = msg; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public Object getData() { | 
				
			||||
		return data; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public void setData(Object data) { | 
				
			||||
		this.data = data; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public int getCount() { | 
				
			||||
		return count; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	public void setCount(int count) { | 
				
			||||
		this.count = count; | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,149 @@
					 | 
				
			||||
package com.mh.common.http; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * Constants enumerating the HTTP status codes. | 
				
			||||
 * All status codes defined in RFC1945 (HTTP/1.0), RFC2616 (HTTP/1.1), and | 
				
			||||
 * RFC2518 (WebDAV) are listed. | 
				
			||||
 * | 
				
			||||
 * | 
				
			||||
 * | 
				
			||||
 * @since 4.0 | 
				
			||||
 */ | 
				
			||||
public interface HttpStatus { | 
				
			||||
 | 
				
			||||
    // --- 1xx Informational ---
 | 
				
			||||
 | 
				
			||||
    /** {@code 100 Continue} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_CONTINUE = 100; | 
				
			||||
    /** {@code 101 Switching Protocols} (HTTP/1.1 - RFC 2616)*/ | 
				
			||||
    public static final int SC_SWITCHING_PROTOCOLS = 101; | 
				
			||||
    /** {@code 102 Processing} (WebDAV - RFC 2518) */ | 
				
			||||
    public static final int SC_PROCESSING = 102; | 
				
			||||
 | 
				
			||||
    // --- 2xx Success ---
 | 
				
			||||
 | 
				
			||||
    /** {@code 200 OK} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_OK = 200; | 
				
			||||
    /** {@code 201 Created} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_CREATED = 201; | 
				
			||||
    /** {@code 202 Accepted} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_ACCEPTED = 202; | 
				
			||||
    /** {@code 203 Non Authoritative Information} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203; | 
				
			||||
    /** {@code 204 No Content} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_NO_CONTENT = 204; | 
				
			||||
    /** {@code 205 Reset Content} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_RESET_CONTENT = 205; | 
				
			||||
    /** {@code 206 Partial Content} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_PARTIAL_CONTENT = 206; | 
				
			||||
    /** | 
				
			||||
     * {@code 207 Multi-Status} (WebDAV - RFC 2518) | 
				
			||||
     * or | 
				
			||||
     * {@code 207 Partial Update OK} (HTTP/1.1 - draft-ietf-http-v11-spec-rev-01?) | 
				
			||||
     */ | 
				
			||||
    public static final int SC_MULTI_STATUS = 207; | 
				
			||||
 | 
				
			||||
    // --- 3xx Redirection ---
 | 
				
			||||
 | 
				
			||||
    /** {@code 300 Mutliple Choices} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_MULTIPLE_CHOICES = 300; | 
				
			||||
    /** {@code 301 Moved Permanently} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_MOVED_PERMANENTLY = 301; | 
				
			||||
    /** {@code 302 Moved Temporarily} (Sometimes {@code Found}) (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_MOVED_TEMPORARILY = 302; | 
				
			||||
    /** {@code 303 See Other} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_SEE_OTHER = 303; | 
				
			||||
    /** {@code 304 Not Modified} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_NOT_MODIFIED = 304; | 
				
			||||
    /** {@code 305 Use Proxy} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_USE_PROXY = 305; | 
				
			||||
    /** {@code 307 Temporary Redirect} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_TEMPORARY_REDIRECT = 307; | 
				
			||||
 | 
				
			||||
    // --- 4xx Client Error ---
 | 
				
			||||
 | 
				
			||||
    /** {@code 400 Bad Request} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_BAD_REQUEST = 400; | 
				
			||||
    /** {@code 401 Unauthorized} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_UNAUTHORIZED = 401; | 
				
			||||
    /** {@code 402 Payment Required} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_PAYMENT_REQUIRED = 402; | 
				
			||||
    /** {@code 403 Forbidden} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_FORBIDDEN = 403; | 
				
			||||
    /** {@code 404 Not Found} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_NOT_FOUND = 404; | 
				
			||||
    /** {@code 405 Method Not Allowed} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_METHOD_NOT_ALLOWED = 405; | 
				
			||||
    /** {@code 406 Not Acceptable} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_NOT_ACCEPTABLE = 406; | 
				
			||||
    /** {@code 407 Proxy Authentication Required} (HTTP/1.1 - RFC 2616)*/ | 
				
			||||
    public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407; | 
				
			||||
    /** {@code 408 Request Timeout} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_REQUEST_TIMEOUT = 408; | 
				
			||||
    /** {@code 409 Conflict} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_CONFLICT = 409; | 
				
			||||
    /** {@code 410 Gone} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_GONE = 410; | 
				
			||||
    /** {@code 411 Length Required} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_LENGTH_REQUIRED = 411; | 
				
			||||
    /** {@code 412 Precondition Failed} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_PRECONDITION_FAILED = 412; | 
				
			||||
    /** {@code 413 Request Entity Too Large} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_REQUEST_TOO_LONG = 413; | 
				
			||||
    /** {@code 414 Request-URI Too Long} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_REQUEST_URI_TOO_LONG = 414; | 
				
			||||
    /** {@code 415 Unsupported Media Type} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415; | 
				
			||||
    /** {@code 416 Requested Range Not Satisfiable} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416; | 
				
			||||
    /** {@code 417 Expectation Failed} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_EXPECTATION_FAILED = 417; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * Static constant for a 418 error. | 
				
			||||
     * {@code 418 Unprocessable Entity} (WebDAV drafts?) | 
				
			||||
     * or {@code 418 Reauthentication Required} (HTTP/1.1 drafts?) | 
				
			||||
     */ | 
				
			||||
    // not used
 | 
				
			||||
    // public static final int SC_UNPROCESSABLE_ENTITY = 418;
 | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * Static constant for a 419 error. | 
				
			||||
     * {@code 419 Insufficient Space on Resource} | 
				
			||||
     * (WebDAV - draft-ietf-webdav-protocol-05?) | 
				
			||||
     * or {@code 419 Proxy Reauthentication Required} | 
				
			||||
     * (HTTP/1.1 drafts?) | 
				
			||||
     */ | 
				
			||||
    public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419; | 
				
			||||
    /** | 
				
			||||
     * Static constant for a 420 error. | 
				
			||||
     * {@code 420 Method Failure} | 
				
			||||
     * (WebDAV - draft-ietf-webdav-protocol-05?) | 
				
			||||
     */ | 
				
			||||
    public static final int SC_METHOD_FAILURE = 420; | 
				
			||||
    /** {@code 422 Unprocessable Entity} (WebDAV - RFC 2518) */ | 
				
			||||
    public static final int SC_UNPROCESSABLE_ENTITY = 422; | 
				
			||||
    /** {@code 423 Locked} (WebDAV - RFC 2518) */ | 
				
			||||
    public static final int SC_LOCKED = 423; | 
				
			||||
    /** {@code 424 Failed Dependency} (WebDAV - RFC 2518) */ | 
				
			||||
    public static final int SC_FAILED_DEPENDENCY = 424; | 
				
			||||
 | 
				
			||||
    // --- 5xx Server Error ---
 | 
				
			||||
 | 
				
			||||
    /** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_INTERNAL_SERVER_ERROR = 500; | 
				
			||||
    /** {@code 501 Not Implemented} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_NOT_IMPLEMENTED = 501; | 
				
			||||
    /** {@code 502 Bad Gateway} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_BAD_GATEWAY = 502; | 
				
			||||
    /** {@code 503 Service Unavailable} (HTTP/1.0 - RFC 1945) */ | 
				
			||||
    public static final int SC_SERVICE_UNAVAILABLE = 503; | 
				
			||||
    /** {@code 504 Gateway Timeout} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_GATEWAY_TIMEOUT = 504; | 
				
			||||
    /** {@code 505 HTTP Version Not Supported} (HTTP/1.1 - RFC 2616) */ | 
				
			||||
    public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505; | 
				
			||||
 | 
				
			||||
    /** {@code 507 Insufficient Storage} (WebDAV - RFC 2518) */ | 
				
			||||
    public static final int SC_INSUFFICIENT_STORAGE = 507; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,32 @@
					 | 
				
			||||
package com.mh.common.page; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 分页查询列过滤器 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Aug 19, 2018 | 
				
			||||
 */ | 
				
			||||
public class ColumnFilter { | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * 过滤列名 | 
				
			||||
	 */ | 
				
			||||
	private String name; | 
				
			||||
	/** | 
				
			||||
	 * 查询的值 | 
				
			||||
	 */ | 
				
			||||
	private String value; | 
				
			||||
	 | 
				
			||||
	public String getName() { | 
				
			||||
		return name; | 
				
			||||
	} | 
				
			||||
	public void setName(String name) { | 
				
			||||
		this.name = name; | 
				
			||||
	} | 
				
			||||
	public String getValue() { | 
				
			||||
		return value; | 
				
			||||
	} | 
				
			||||
	public void setValue(String value) { | 
				
			||||
		this.value = value; | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,63 @@
					 | 
				
			||||
package com.mh.common.page; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
import com.github.pagehelper.PageHelper; | 
				
			||||
import com.github.pagehelper.PageInfo; | 
				
			||||
import com.mh.common.utils.ReflectionUtils; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * MyBatis 分页查询助手 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Jan 12, 2019 | 
				
			||||
 */ | 
				
			||||
public class MybatisPageHelper { | 
				
			||||
 | 
				
			||||
	public static final String findPage = "findPage"; | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 分页查询, 约定查询方法名为 “findPage”  | 
				
			||||
	 * @param pageRequest 分页请求 | 
				
			||||
	 * @param mapper Dao对象,MyBatis的 Mapper	 | 
				
			||||
	 * @param | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	public static PageResult findPage(PageRequest pageRequest, Object mapper) { | 
				
			||||
		return findPage(pageRequest, mapper, findPage); | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 调用分页插件进行分页查询 | 
				
			||||
	 * @param pageRequest 分页请求 | 
				
			||||
	 * @param mapper Dao对象,MyBatis的 Mapper	 | 
				
			||||
	 * @param queryMethodName 要分页的查询方法名 | 
				
			||||
	 * @param args 方法参数 | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	@SuppressWarnings({ "unchecked", "rawtypes" }) | 
				
			||||
	public static PageResult findPage(PageRequest pageRequest, Object mapper, String queryMethodName, Object... args) { | 
				
			||||
		// 设置分页参数
 | 
				
			||||
		int pageNum = pageRequest.getPageNum(); | 
				
			||||
		int pageSize = pageRequest.getPageSize(); | 
				
			||||
		PageHelper.startPage(pageNum, pageSize); | 
				
			||||
		// 利用反射调用查询方法
 | 
				
			||||
		Object result = ReflectionUtils.invoke(mapper, queryMethodName, args); | 
				
			||||
		return getPageResult(pageRequest, new PageInfo((List) result)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * 将分页信息封装到统一的接口 | 
				
			||||
	 * @param pageRequest  | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	private static PageResult getPageResult(PageRequest pageRequest, PageInfo<?> pageInfo) { | 
				
			||||
		PageResult pageResult = new PageResult(); | 
				
			||||
        pageResult.setPageNum(pageInfo.getPageNum()); | 
				
			||||
        pageResult.setPageSize(pageInfo.getPageSize()); | 
				
			||||
        pageResult.setTotalSize(pageInfo.getTotal()); | 
				
			||||
        pageResult.setTotalPages(pageInfo.getPages()); | 
				
			||||
        pageResult.setContent(pageInfo.getList()); | 
				
			||||
		return pageResult; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,46 @@
					 | 
				
			||||
package com.mh.common.page; | 
				
			||||
 | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 分页请求 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Aug 19, 2018 | 
				
			||||
 */ | 
				
			||||
public class PageRequest { | 
				
			||||
	/** | 
				
			||||
	 * 当前页码 | 
				
			||||
	 */ | 
				
			||||
	private int pageNum = 1; | 
				
			||||
	/** | 
				
			||||
	 * 每页数量 | 
				
			||||
	 */ | 
				
			||||
	private int pageSize = 10; | 
				
			||||
	/** | 
				
			||||
	 * 每页数量 | 
				
			||||
	 */ | 
				
			||||
	private Map<String, ColumnFilter> columnFilters = new HashMap<String, ColumnFilter>(); | 
				
			||||
	 | 
				
			||||
	public int getPageNum() { | 
				
			||||
		return pageNum; | 
				
			||||
	} | 
				
			||||
	public void setPageNum(int pageNum) { | 
				
			||||
		this.pageNum = pageNum; | 
				
			||||
	} | 
				
			||||
	public int getPageSize() { | 
				
			||||
		return pageSize; | 
				
			||||
	} | 
				
			||||
	public void setPageSize(int pageSize) { | 
				
			||||
		this.pageSize = pageSize; | 
				
			||||
	} | 
				
			||||
	public Map<String, ColumnFilter> getColumnFilters() { | 
				
			||||
		return columnFilters; | 
				
			||||
	} | 
				
			||||
	public void setColumnFilters(Map<String, ColumnFilter> columnFilters) { | 
				
			||||
		this.columnFilters = columnFilters; | 
				
			||||
	} | 
				
			||||
	public ColumnFilter getColumnFilter(String name) { | 
				
			||||
		return columnFilters.get(name); | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,61 @@
					 | 
				
			||||
package com.mh.common.page; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 分页返回结果 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Jan 12, 2019 | 
				
			||||
 */ | 
				
			||||
public class PageResult { | 
				
			||||
	/** | 
				
			||||
	 * 当前页码 | 
				
			||||
	 */ | 
				
			||||
	private int pageNum; | 
				
			||||
	/** | 
				
			||||
	 * 每页数量 | 
				
			||||
	 */ | 
				
			||||
	private int pageSize; | 
				
			||||
	/** | 
				
			||||
	 * 记录总数 | 
				
			||||
	 */ | 
				
			||||
	private long totalSize; | 
				
			||||
	/** | 
				
			||||
	 * 页码总数 | 
				
			||||
	 */ | 
				
			||||
	private int totalPages; | 
				
			||||
	/** | 
				
			||||
	 * 分页数据 | 
				
			||||
	 */ | 
				
			||||
	private List<?> content; | 
				
			||||
	public int getPageNum() { | 
				
			||||
		return pageNum; | 
				
			||||
	} | 
				
			||||
	public void setPageNum(int pageNum) { | 
				
			||||
		this.pageNum = pageNum; | 
				
			||||
	} | 
				
			||||
	public int getPageSize() { | 
				
			||||
		return pageSize; | 
				
			||||
	} | 
				
			||||
	public void setPageSize(int pageSize) { | 
				
			||||
		this.pageSize = pageSize; | 
				
			||||
	} | 
				
			||||
	public long getTotalSize() { | 
				
			||||
		return totalSize; | 
				
			||||
	} | 
				
			||||
	public void setTotalSize(long totalSize) { | 
				
			||||
		this.totalSize = totalSize; | 
				
			||||
	} | 
				
			||||
	public int getTotalPages() { | 
				
			||||
		return totalPages; | 
				
			||||
	} | 
				
			||||
	public void setTotalPages(int totalPages) { | 
				
			||||
		this.totalPages = totalPages; | 
				
			||||
	} | 
				
			||||
	public List<?> getContent() { | 
				
			||||
		return content; | 
				
			||||
	} | 
				
			||||
	public void setContent(List<?> content) { | 
				
			||||
		this.content = content; | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,50 @@
					 | 
				
			||||
package com.mh.common.service; | 
				
			||||
 | 
				
			||||
import com.mh.common.page.PageRequest; | 
				
			||||
import com.mh.common.page.PageResult; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 通用CURD接口 | 
				
			||||
 */ | 
				
			||||
public interface CurdService<T> { | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 保存操作 | 
				
			||||
	 * @param record | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	int save(T record); | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 删除操作 | 
				
			||||
	 * @param record | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	int delete(T record); | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 批量删除操作 | 
				
			||||
	 * @param records | 
				
			||||
	 */ | 
				
			||||
	int delete(List<T> records); | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 根据ID查询 | 
				
			||||
	 * @param id | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	T findById(Long id); | 
				
			||||
	 | 
				
			||||
    /** | 
				
			||||
     * 分页查询 | 
				
			||||
	 * 这里统一封装了分页请求和结果,避免直接引入具体框架的分页对象, 如MyBatis或JPA的分页对象 | 
				
			||||
	 * 从而避免因为替换ORM框架而导致服务层、控制层的分页接口也需要变动的情况,替换ORM框架也不会 | 
				
			||||
	 * 影响服务层以上的分页接口,起到了解耦的作用 | 
				
			||||
	 * @param pageRequest 自定义,统一分页查询请求 | 
				
			||||
	 * @return PageResult 自定义,统一分页查询结果 | 
				
			||||
     */ | 
				
			||||
	PageResult findPage(PageRequest pageRequest); | 
				
			||||
	 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,32 @@
					 | 
				
			||||
package com.mh.common.utils; | 
				
			||||
 | 
				
			||||
import java.text.SimpleDateFormat; | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 日期时间相关工具 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Jan 14, 2019 | 
				
			||||
 */ | 
				
			||||
public class DateTimeUtils { | 
				
			||||
 | 
				
			||||
	public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 获取当前标准格式化日期时间 | 
				
			||||
	 * @param date | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	public static String getDateTime() { | 
				
			||||
		return getDateTime(new Date()); | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 标准格式化日期时间 | 
				
			||||
	 * @param date | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	public static String getDateTime(Date date) { | 
				
			||||
		return (new SimpleDateFormat(DATE_FORMAT)).format(date); | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,42 @@
					 | 
				
			||||
package com.mh.common.utils; | 
				
			||||
 | 
				
			||||
import javax.servlet.http.HttpServletResponse; | 
				
			||||
import java.io.BufferedInputStream; | 
				
			||||
import java.io.BufferedOutputStream; | 
				
			||||
import java.io.File; | 
				
			||||
import java.io.FileInputStream; | 
				
			||||
import java.io.InputStream; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 文件相关操作 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Jan 14, 2019 | 
				
			||||
 */ | 
				
			||||
public class FileUtils { | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * 下载文件 | 
				
			||||
	 * @param response | 
				
			||||
	 * @param file | 
				
			||||
	 * @param newFileName | 
				
			||||
	 */ | 
				
			||||
	public static void downloadFile(HttpServletResponse response, File file, String newFileName) { | 
				
			||||
		try { | 
				
			||||
			response.setHeader("Content-Disposition", "attachment; filename=" + new String(newFileName.getBytes("ISO-8859-1"), "UTF-8")); | 
				
			||||
			BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); | 
				
			||||
			InputStream is = new FileInputStream(file.getAbsolutePath()); | 
				
			||||
			BufferedInputStream bis = new BufferedInputStream(is); | 
				
			||||
			int length = 0; | 
				
			||||
			byte[] temp = new byte[1 * 1024 * 10]; | 
				
			||||
			while ((length = bis.read(temp)) != -1) { | 
				
			||||
				bos.write(temp, 0, length); | 
				
			||||
			} | 
				
			||||
			bos.flush(); | 
				
			||||
			bis.close(); | 
				
			||||
			bos.close(); | 
				
			||||
			is.close(); | 
				
			||||
		} catch (Exception e) { | 
				
			||||
			e.printStackTrace(); | 
				
			||||
		} | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,26 @@
					 | 
				
			||||
package com.mh.common.utils; | 
				
			||||
 | 
				
			||||
import java.io.Closeable; | 
				
			||||
import java.io.IOException; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * IO相关工具类 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Oct 29, 2018 | 
				
			||||
 */ | 
				
			||||
public class IOUtils { | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * 关闭对象,连接 | 
				
			||||
	 * @param closeable | 
				
			||||
	 */ | 
				
			||||
    public static void closeQuietly(final Closeable closeable) { | 
				
			||||
        try { | 
				
			||||
            if (closeable != null) { | 
				
			||||
                closeable.close(); | 
				
			||||
            } | 
				
			||||
        } catch (final IOException ioe) { | 
				
			||||
            // ignore
 | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,41 @@
					 | 
				
			||||
//package com.mh.common.utils;
 | 
				
			||||
//
 | 
				
			||||
//import java.io.File;
 | 
				
			||||
//import java.io.FileNotFoundException;
 | 
				
			||||
//import java.io.FileOutputStream;
 | 
				
			||||
//import java.io.IOException;
 | 
				
			||||
//import java.io.OutputStream;
 | 
				
			||||
//
 | 
				
			||||
//import org.apache.poi.ss.usermodel.Workbook;
 | 
				
			||||
//
 | 
				
			||||
///**
 | 
				
			||||
// * POI相关操作
 | 
				
			||||
// * @author Louis
 | 
				
			||||
// * @date Jan 14, 2019
 | 
				
			||||
// */
 | 
				
			||||
//public class PoiUtils {
 | 
				
			||||
//
 | 
				
			||||
//	/**
 | 
				
			||||
//	 * 生成Excel文件
 | 
				
			||||
//	 * @param workbook
 | 
				
			||||
//	 * @param fileName
 | 
				
			||||
//	 * @return
 | 
				
			||||
//	 */
 | 
				
			||||
//	public static File createExcelFile(Workbook workbook, String fileName) {
 | 
				
			||||
//		OutputStream stream = null;
 | 
				
			||||
//		File file = null;
 | 
				
			||||
//		try {
 | 
				
			||||
//			file = File.createTempFile(fileName, ".xlsx");
 | 
				
			||||
//			stream = new FileOutputStream(file.getAbsoluteFile());
 | 
				
			||||
//			workbook.write(stream);
 | 
				
			||||
//		} catch (FileNotFoundException e) {
 | 
				
			||||
//			e.printStackTrace();
 | 
				
			||||
//		} catch (IOException e) {
 | 
				
			||||
//			e.printStackTrace();
 | 
				
			||||
//		} finally {
 | 
				
			||||
//			IOUtils.closeQuietly(workbook);
 | 
				
			||||
//			IOUtils.closeQuietly(stream);
 | 
				
			||||
//		}
 | 
				
			||||
//		return file;
 | 
				
			||||
//	}
 | 
				
			||||
//}
 | 
				
			||||
@ -0,0 +1,78 @@
					 | 
				
			||||
package com.mh.common.utils; | 
				
			||||
 | 
				
			||||
import java.lang.reflect.InvocationTargetException; | 
				
			||||
import java.lang.reflect.Method; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 反射相关辅助方法 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Aug 19, 2018 | 
				
			||||
 */ | 
				
			||||
public class ReflectionUtils { | 
				
			||||
 | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 根据方法名调用指定对象的方法 | 
				
			||||
	 * @param object 要调用方法的对象 | 
				
			||||
	 * @param method 要调用的方法名 | 
				
			||||
	 * @param args 参数对象数组 | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	public static Object invoke(Object object, String method, Object... args) { | 
				
			||||
		Object result = null; | 
				
			||||
		Class<? extends Object> clazz = object.getClass(); | 
				
			||||
		Method queryMethod = getMethod(clazz, method, args); | 
				
			||||
		if(queryMethod != null) { | 
				
			||||
			try { | 
				
			||||
				result = queryMethod.invoke(object, args); | 
				
			||||
			} catch (IllegalAccessException e) { | 
				
			||||
				e.printStackTrace(); | 
				
			||||
			} catch (IllegalArgumentException e) { | 
				
			||||
				e.printStackTrace(); | 
				
			||||
			} catch (InvocationTargetException e) { | 
				
			||||
				e.printStackTrace(); | 
				
			||||
			} | 
				
			||||
		} else { | 
				
			||||
			try { | 
				
			||||
				throw new NoSuchMethodException(clazz.getName() + " 类中没有找到 " + method + " 方法。"); | 
				
			||||
			} catch (NoSuchMethodException e) { | 
				
			||||
				e.printStackTrace(); | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		return result; | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	/** | 
				
			||||
	 * 根据方法名和参数对象查找方法 | 
				
			||||
	 * @param clazz | 
				
			||||
	 * @param name | 
				
			||||
	 * @param args 参数实例数据 | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	public static Method getMethod(Class<? extends Object> clazz, String name, Object[] args) { | 
				
			||||
		Method queryMethod = null; | 
				
			||||
		Method[] methods = clazz.getMethods(); | 
				
			||||
		for(Method method:methods) { | 
				
			||||
			if(method.getName().equals(name)) { | 
				
			||||
				Class<?>[] parameterTypes = method.getParameterTypes(); | 
				
			||||
				if(parameterTypes.length == args.length) { | 
				
			||||
					boolean isSameMethod = true; | 
				
			||||
					for(int i=0; i<parameterTypes.length; i++) { | 
				
			||||
						Object arg = args[i]; | 
				
			||||
						if(arg == null) { | 
				
			||||
							arg = ""; | 
				
			||||
						} | 
				
			||||
						if(!parameterTypes[i].equals(args[i].getClass())) { | 
				
			||||
							isSameMethod = false; | 
				
			||||
						} | 
				
			||||
					} | 
				
			||||
					if(isSameMethod) { | 
				
			||||
						queryMethod = method; | 
				
			||||
						break ; | 
				
			||||
					} | 
				
			||||
				} | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		return queryMethod; | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,19 @@
					 | 
				
			||||
package com.mh.common.utils; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 字符串工具类 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Sep 1, 2018 | 
				
			||||
 */ | 
				
			||||
public class StringUtils { | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * 判空操作 | 
				
			||||
	 * @param value | 
				
			||||
	 * @return | 
				
			||||
	 */ | 
				
			||||
	public static boolean isBlank(String value) { | 
				
			||||
		return value == null || "".equals(value) || "null".equals(value) || "undefined".equals(value); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,74 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<project xmlns="http://maven.apache.org/POM/4.0.0" | 
				
			||||
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 
				
			||||
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | 
				
			||||
    <modelVersion>4.0.0</modelVersion> | 
				
			||||
    <groupId>com.mh</groupId> | 
				
			||||
    <artifactId>mh_esi</artifactId> | 
				
			||||
    <version>1.0-SNAPSHOT</version> | 
				
			||||
    <packaging>pom</packaging> | 
				
			||||
    <modules> | 
				
			||||
        <module>common</module> | 
				
			||||
        <module>user-service</module> | 
				
			||||
    </modules> | 
				
			||||
    <parent> | 
				
			||||
        <groupId>org.springframework.boot</groupId> | 
				
			||||
        <artifactId>spring-boot-starter-parent</artifactId> | 
				
			||||
        <version>2.2.5.RELEASE</version> | 
				
			||||
        <relativePath/> <!-- lookup parent from repository --> | 
				
			||||
    </parent> | 
				
			||||
    <properties> | 
				
			||||
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 
				
			||||
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | 
				
			||||
        <java.version>1.8</java.version> | 
				
			||||
        <spring-cloud.version>Hoxton.SR3</spring-cloud.version> | 
				
			||||
        <swagger.version>2.9.2</swagger.version> | 
				
			||||
    </properties> | 
				
			||||
    <dependencies> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-test</artifactId> | 
				
			||||
            <scope>test</scope> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.jolokia</groupId> | 
				
			||||
            <artifactId>jolokia-core</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>io.springfox</groupId> | 
				
			||||
            <artifactId>springfox-swagger2</artifactId> | 
				
			||||
            <version>${swagger.version}</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>io.springfox</groupId> | 
				
			||||
            <artifactId>springfox-swagger-ui</artifactId> | 
				
			||||
            <version>${swagger.version}</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-aop</artifactId> | 
				
			||||
            <version>2.2.5.RELEASE</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.rxtx</groupId> | 
				
			||||
            <artifactId>rxtx</artifactId> | 
				
			||||
            <version>2.1.7</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.github.purejavacomm</groupId> | 
				
			||||
            <artifactId>purejavacomm</artifactId> | 
				
			||||
            <version>1.0.1.RELEASE</version> | 
				
			||||
        </dependency> | 
				
			||||
    </dependencies> | 
				
			||||
    <dependencyManagement> | 
				
			||||
        <dependencies> | 
				
			||||
            <dependency> | 
				
			||||
                <groupId>org.springframework.cloud</groupId> | 
				
			||||
                <artifactId>spring-cloud-dependencies</artifactId> | 
				
			||||
                <version>${spring-cloud.version}</version> | 
				
			||||
                <type>pom</type> | 
				
			||||
                <scope>import</scope> | 
				
			||||
            </dependency> | 
				
			||||
        </dependencies> | 
				
			||||
    </dependencyManagement> | 
				
			||||
</project> | 
				
			||||
@ -0,0 +1,33 @@
					 | 
				
			||||
# Getting Started | 
				
			||||
 | 
				
			||||
### Reference Documentation | 
				
			||||
For further reference, please consider the following sections: | 
				
			||||
 | 
				
			||||
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) | 
				
			||||
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.2.5.RELEASE/maven-plugin/) | 
				
			||||
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.2.5.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications) | 
				
			||||
 | 
				
			||||
### Guides | 
				
			||||
The following guides illustrate how to use some features concretely: | 
				
			||||
 | 
				
			||||
* [Service Registration and Discovery](https://spring.io/guides/gs/service-registration-and-discovery/) | 
				
			||||
* [Circuit Breaker](https://spring.io/guides/gs/circuit-breaker/) | 
				
			||||
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) | 
				
			||||
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) | 
				
			||||
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) | 
				
			||||
 | 
				
			||||
# Spring Cloud Netflix Maintenance Mode | 
				
			||||
 | 
				
			||||
The dependencies listed below are in maintenance mode. We do not recommend adding them to | 
				
			||||
new projects: | 
				
			||||
 | 
				
			||||
*  Hystrix | 
				
			||||
*  Hystrix Dashboard | 
				
			||||
 | 
				
			||||
The decision to move most of the Spring Cloud Netflix projects to maintenance mode was | 
				
			||||
a response to Netflix not continuing maintenance of many of the libraries that we provided | 
				
			||||
support for. | 
				
			||||
 | 
				
			||||
Please see [this blog entry](https://spring.io/blog/2018/12/12/spring-cloud-greenwich-rc1-available-now#spring-cloud-netflix-projects-entering-maintenance-mode) | 
				
			||||
for more information on maintenance mode and a list of suggested replacements for those | 
				
			||||
libraries. | 
				
			||||
@ -0,0 +1,9 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<module type="JAVA_MODULE" version="4"> | 
				
			||||
  <component name="NewModuleRootManager" inherit-compiler-output="true"> | 
				
			||||
    <exclude-output /> | 
				
			||||
    <content url="file://$MODULE_DIR$" /> | 
				
			||||
    <orderEntry type="inheritedJdk" /> | 
				
			||||
    <orderEntry type="sourceFolder" forTests="false" /> | 
				
			||||
  </component> | 
				
			||||
</module> | 
				
			||||
@ -0,0 +1,6 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<project version="4"> | 
				
			||||
  <component name="JavaScriptSettings"> | 
				
			||||
    <option name="languageLevel" value="ES6" /> | 
				
			||||
  </component> | 
				
			||||
</project> | 
				
			||||
@ -0,0 +1,8 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<project version="4"> | 
				
			||||
  <component name="ProjectModuleManager"> | 
				
			||||
    <modules> | 
				
			||||
      <module fileurl="file://$PROJECT_DIR$/.idea/lib.iml" filepath="$PROJECT_DIR$/.idea/lib.iml" /> | 
				
			||||
    </modules> | 
				
			||||
  </component> | 
				
			||||
</project> | 
				
			||||
@ -0,0 +1,6 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<project version="4"> | 
				
			||||
  <component name="VcsDirectoryMappings"> | 
				
			||||
    <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> | 
				
			||||
  </component> | 
				
			||||
</project> | 
				
			||||
@ -0,0 +1,99 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<project version="4"> | 
				
			||||
  <component name="ChangeListManager"> | 
				
			||||
    <list default="true" id="0fc2e36a-ac80-4cf4-ab67-252a7144a30d" name="Default Changelist" comment=""> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../../.idea/misc.xml" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../../.idea/workspace.xml" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../common/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../../common/pom.xml" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../common/src/main/java/com/mh/common/exception/CommonException.java" beforeDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../common/src/main/java/com/mh/common/exception/ErrorCode.java" beforeDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../common/src/main/java/com/mh/common/http/HttpResult.java" beforeDir="false" afterPath="$PROJECT_DIR$/../../common/src/main/java/com/mh/common/http/HttpResult.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../hs_err_pid11956.log" beforeDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../hs_err_pid5548.log" beforeDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../hs_err_pid7444.log" beforeDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../../pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../../pom.xml" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../pom.xml" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/config/QuartzConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/config/QuartzConfig.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/DeviceInstallController.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/DeviceInstallController.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/EnergyController.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/EnergyController.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/SerialPortController.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/SerialPortController.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/TestController.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/controller/TestController.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/entity/DeviceCodeParamEntity.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/entity/DeviceCodeParamEntity.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/entity/NowDataEntity.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/entity/NowDataEntity.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/job/CollectionLoopRunner.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/job/CollectionLoopRunner.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/job/JobCloudAndMeter.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/job/JobCloudAndMeter.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/AnalysisMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/AnalysisMapper.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/ControlSetMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/ControlSetMapper.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/DeviceCodeParamMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/DeviceCodeParamMapper.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/DeviceInstallMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/DeviceInstallMapper.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/EnergyMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/EnergyMapper.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/provider/EnergyProvider.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/mapper/provider/EnergyProvider.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/netty/NettyMeterAndCloudClientHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/netty/NettyMeterAndCloudClientHandler.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/netty/NettyMeterClientHandler1.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/netty/NettyMeterClientHandler1.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortListener.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortListener.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortSendReceive.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortSendReceive.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortSingle.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortSingle.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortThread.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortThread.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialPortUtil.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialTool.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/serialport/SerialTool.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/DeviceCodeParamService.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/DeviceCodeParamService.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/DeviceInstallService.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/DeviceInstallService.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/EnergyService.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/EnergyService.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/NowDataService.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/NowDataService.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/DataResultServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/DataResultServiceImpl.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/DeviceCodeParamServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/DeviceCodeParamServiceImpl.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/EnergyServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/EnergyServiceImpl.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/NowDataServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/NowDataServiceImpl.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/NowPublicDataServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/service/impl/NowPublicDataServiceImpl.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/utils/AnalysisReceiveOrder485.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/utils/AnalysisReceiveOrder485.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/utils/GetReadOrder485.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/utils/GetReadOrder485.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/java/com/mh/user/utils/SendOrderUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/com/mh/user/utils/SendOrderUtils.java" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/resources/bootstrap.yml" afterDir="false" /> | 
				
			||||
      <change beforePath="$PROJECT_DIR$/../src/main/resources/log4j.properties" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/resources/log4j.properties" afterDir="false" /> | 
				
			||||
    </list> | 
				
			||||
    <option name="SHOW_DIALOG" value="false" /> | 
				
			||||
    <option name="HIGHLIGHT_CONFLICTS" value="true" /> | 
				
			||||
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | 
				
			||||
    <option name="LAST_RESOLUTION" value="IGNORE" /> | 
				
			||||
  </component> | 
				
			||||
  <component name="Git.Settings"> | 
				
			||||
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." /> | 
				
			||||
  </component> | 
				
			||||
  <component name="ProjectId" id="2F0uiUYnVYT3PIhLtb2GPuZA4zm" /> | 
				
			||||
  <component name="ProjectLevelVcsManager" settingsEditedManually="true" /> | 
				
			||||
  <component name="ProjectViewState"> | 
				
			||||
    <option name="hideEmptyMiddlePackages" value="true" /> | 
				
			||||
    <option name="showExcludedFiles" value="true" /> | 
				
			||||
    <option name="showLibraryContents" value="true" /> | 
				
			||||
  </component> | 
				
			||||
  <component name="PropertiesComponent"> | 
				
			||||
    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> | 
				
			||||
    <property name="WebServerToolWindowFactoryState" value="false" /> | 
				
			||||
    <property name="aspect.path.notification.shown" value="true" /> | 
				
			||||
    <property name="last_opened_file_path" value="$PROJECT_DIR$/../../../JIENENGDAO" /> | 
				
			||||
  </component> | 
				
			||||
  <component name="SvnConfiguration"> | 
				
			||||
    <configuration /> | 
				
			||||
  </component> | 
				
			||||
  <component name="TaskManager"> | 
				
			||||
    <task active="true" id="Default" summary="Default task"> | 
				
			||||
      <changelist id="0fc2e36a-ac80-4cf4-ab67-252a7144a30d" name="Default Changelist" comment="" /> | 
				
			||||
      <created>1663641449492</created> | 
				
			||||
      <option name="number" value="Default" /> | 
				
			||||
      <option name="presentableId" value="Default" /> | 
				
			||||
      <updated>1663641449492</updated> | 
				
			||||
      <workItem from="1663641450981" duration="46000" /> | 
				
			||||
    </task> | 
				
			||||
    <servers /> | 
				
			||||
  </component> | 
				
			||||
  <component name="TypeScriptGeneratedFilesManager"> | 
				
			||||
    <option name="version" value="1" /> | 
				
			||||
  </component> | 
				
			||||
  <component name="WindowStateProjectService"> | 
				
			||||
    <state x="740" y="274" key="FileChooserDialogImpl" timestamp="1663641486702"> | 
				
			||||
      <screen x="0" y="0" width="1920" height="1040" /> | 
				
			||||
    </state> | 
				
			||||
    <state x="740" y="274" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1663641486702" /> | 
				
			||||
  </component> | 
				
			||||
</project> | 
				
			||||
									
										Binary file not shown.
									
								
							
						@ -0,0 +1,203 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 
				
			||||
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | 
				
			||||
    <modelVersion>4.0.0</modelVersion> | 
				
			||||
    <parent> | 
				
			||||
        <groupId>com.mh</groupId> | 
				
			||||
        <artifactId>mh_esi</artifactId> | 
				
			||||
        <version>1.0-SNAPSHOT</version> | 
				
			||||
    </parent> | 
				
			||||
    <groupId>com.mh</groupId> | 
				
			||||
    <artifactId>user-service</artifactId> | 
				
			||||
    <version>0.0.1-SNAPSHOT</version> | 
				
			||||
    <name>user-service</name> | 
				
			||||
    <packaging>jar</packaging> | 
				
			||||
    <description>Demo project for Spring Boot</description> | 
				
			||||
 | 
				
			||||
    <properties> | 
				
			||||
        <java.version>1.8</java.version> | 
				
			||||
        <spring-cloud.version>Hoxton.SR3</spring-cloud.version> | 
				
			||||
    </properties> | 
				
			||||
 | 
				
			||||
    <dependencies> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-web</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-tomcat</artifactId> | 
				
			||||
            <scope>import</scope> | 
				
			||||
<!--          当时本地启动需要注释掉--> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-quartz</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.cloud</groupId> | 
				
			||||
            <artifactId>spring-cloud-starter-config</artifactId> | 
				
			||||
            <version>2.2.2.RELEASE</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.github.ben-manes.caffeine</groupId> | 
				
			||||
            <artifactId>caffeine</artifactId> | 
				
			||||
            <version>2.8.8</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.alibaba</groupId> | 
				
			||||
            <artifactId>fastjson</artifactId> | 
				
			||||
            <version>1.2.41</version> | 
				
			||||
        </dependency> | 
				
			||||
<!--        <dependency>--> | 
				
			||||
<!--            <groupId>org.springframework.cloud</groupId>--> | 
				
			||||
<!--            <artifactId>spring-cloud-config-client</artifactId>--> | 
				
			||||
<!--        </dependency>--> | 
				
			||||
<!--        <dependency>--> | 
				
			||||
<!--            <groupId>org.springframework.cloud</groupId>--> | 
				
			||||
<!--            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>--> | 
				
			||||
<!--        </dependency>--> | 
				
			||||
<!--        <dependency>--> | 
				
			||||
<!--            <groupId>org.springframework.cloud</groupId>--> | 
				
			||||
<!--            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>--> | 
				
			||||
<!--        </dependency>--> | 
				
			||||
 | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-test</artifactId> | 
				
			||||
            <scope>test</scope> | 
				
			||||
            <exclusions> | 
				
			||||
                <exclusion> | 
				
			||||
                    <groupId>org.junit.vintage</groupId> | 
				
			||||
                    <artifactId>junit-vintage-engine</artifactId> | 
				
			||||
                </exclusion> | 
				
			||||
            </exclusions> | 
				
			||||
        </dependency> | 
				
			||||
        <!--        mybatis配置--> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.mybatis.spring.boot</groupId> | 
				
			||||
            <artifactId>mybatis-spring-boot-starter</artifactId> | 
				
			||||
            <version>2.1.2</version> | 
				
			||||
        </dependency> | 
				
			||||
        <!--        mysql数据库链接--> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>mysql</groupId> | 
				
			||||
            <artifactId>mysql-connector-java</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
        <!--        druid配置--> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.alibaba</groupId> | 
				
			||||
            <artifactId>druid-spring-boot-starter</artifactId> | 
				
			||||
            <version>1.1.18</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.microsoft.sqlserver</groupId> | 
				
			||||
            <artifactId>mssql-jdbc</artifactId> | 
				
			||||
            <scope>runtime</scope> | 
				
			||||
        </dependency> | 
				
			||||
        <!-- 引入log4j依赖 --> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>log4j</groupId> | 
				
			||||
            <artifactId>log4j</artifactId> | 
				
			||||
            <version>1.2.17</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>io.netty</groupId> | 
				
			||||
            <artifactId>netty-all</artifactId> | 
				
			||||
            <version>5.0.0.Alpha2</version> | 
				
			||||
        </dependency> | 
				
			||||
        <!--登录验证码--> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.github.penggle</groupId> | 
				
			||||
            <artifactId>kaptcha</artifactId> | 
				
			||||
            <version>2.3.2</version> | 
				
			||||
        </dependency> | 
				
			||||
        <!--spring security安全验证--> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-security</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
        <!--jwt(json web token)验证--> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>io.jsonwebtoken</groupId> | 
				
			||||
            <artifactId>jjwt</artifactId> | 
				
			||||
            <version>0.9.1</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>com.mh</groupId> | 
				
			||||
            <artifactId>common</artifactId> | 
				
			||||
            <version>0.0.1-SNAPSHOT</version> | 
				
			||||
        </dependency> | 
				
			||||
        <!--spring-boot-admin --> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>de.codecentric</groupId> | 
				
			||||
            <artifactId>spring-boot-admin-starter-client</artifactId> | 
				
			||||
            <version>2.2.2</version> | 
				
			||||
        </dependency> | 
				
			||||
<!--        Lombok--> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.projectlombok</groupId> | 
				
			||||
            <artifactId>lombok</artifactId> | 
				
			||||
            <optional>true</optional> | 
				
			||||
        </dependency> | 
				
			||||
 | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>tk.mybatis</groupId> | 
				
			||||
            <artifactId>mapper</artifactId> | 
				
			||||
            <version>3.3.9</version> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.apache.commons</groupId> | 
				
			||||
            <artifactId>commons-pool2</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>net.sf.json-lib</groupId> | 
				
			||||
            <artifactId>json-lib</artifactId> | 
				
			||||
            <version>2.4</version> | 
				
			||||
            <classifier>jdk15</classifier> | 
				
			||||
        </dependency> | 
				
			||||
        <dependency> | 
				
			||||
            <groupId>org.springframework.boot</groupId> | 
				
			||||
            <artifactId>spring-boot-starter-amqp</artifactId> | 
				
			||||
        </dependency> | 
				
			||||
    </dependencies> | 
				
			||||
    <dependencyManagement> | 
				
			||||
        <dependencies> | 
				
			||||
            <dependency> | 
				
			||||
                <groupId>org.springframework.cloud</groupId> | 
				
			||||
                <artifactId>spring-cloud-dependencies</artifactId> | 
				
			||||
                <version>${spring-cloud.version}</version> | 
				
			||||
                <type>pom</type> | 
				
			||||
                <scope>import</scope> | 
				
			||||
            </dependency> | 
				
			||||
        </dependencies> | 
				
			||||
    </dependencyManagement> | 
				
			||||
 | 
				
			||||
    <build> | 
				
			||||
        <!-- 打包时拷贝MyBatis的映射文件 --> | 
				
			||||
        <resources> | 
				
			||||
            <resource> | 
				
			||||
                <directory>src/main/java</directory> | 
				
			||||
                <includes> | 
				
			||||
                    <include>**/sqlmapper/*.xml</include> | 
				
			||||
                </includes> | 
				
			||||
                <filtering>false</filtering> | 
				
			||||
            </resource> | 
				
			||||
            <resource> | 
				
			||||
                <directory>src/main/resources</directory> | 
				
			||||
                <includes> | 
				
			||||
                    <include>**/*.*</include> | 
				
			||||
                </includes> | 
				
			||||
                <filtering>true</filtering> | 
				
			||||
            </resource> | 
				
			||||
        </resources> | 
				
			||||
        <plugins> | 
				
			||||
            <plugin> | 
				
			||||
                <groupId>org.springframework.boot</groupId> | 
				
			||||
                <artifactId>spring-boot-maven-plugin</artifactId> | 
				
			||||
                <version>2.7.2</version> | 
				
			||||
            </plugin> | 
				
			||||
        </plugins> | 
				
			||||
    </build> | 
				
			||||
 | 
				
			||||
</project> | 
				
			||||
@ -0,0 +1,57 @@
					 | 
				
			||||
package com.mh.user; | 
				
			||||
 | 
				
			||||
import com.mh.user.constants.Constant; | 
				
			||||
import com.mh.user.job.CollectionLoopRunner; | 
				
			||||
import com.mh.user.netty.EchoServer; | 
				
			||||
import com.mh.user.service.DeviceCodeParamService; | 
				
			||||
import com.mh.user.utils.GetReadOrder485; | 
				
			||||
import lombok.extern.slf4j.Slf4j; | 
				
			||||
import org.apache.log4j.Logger; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.boot.SpringApplication; | 
				
			||||
import org.springframework.boot.autoconfigure.SpringBootApplication; | 
				
			||||
import org.springframework.boot.builder.SpringApplicationBuilder; | 
				
			||||
import org.springframework.boot.web.servlet.ServletComponentScan; | 
				
			||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 
				
			||||
import org.springframework.scheduling.annotation.EnableScheduling; | 
				
			||||
import javax.annotation.PreDestroy; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
@SpringBootApplication(scanBasePackages = "com.mh.user") | 
				
			||||
@EnableScheduling | 
				
			||||
//@ServletComponentScan
 | 
				
			||||
public class UserServiceApplication extends SpringBootServletInitializer { | 
				
			||||
 | 
				
			||||
    private static final Logger log = Logger.getLogger(UserServiceApplication.class); | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    DeviceCodeParamService deviceCodeParamService; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | 
				
			||||
        return builder.sources(UserServiceApplication.class); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public static void main(String[] args) { //一共四个地方要修改,UserServiceApplication,RabbitmqConfig,log4j,bootstrap,DealDataJob
 | 
				
			||||
 | 
				
			||||
        SpringApplication.run(UserServiceApplication.class, args); | 
				
			||||
        //System.out.println(Constant.projectId);
 | 
				
			||||
        //Constant.projectId=7;
 | 
				
			||||
        //System.out.println(Constant.projectId);
 | 
				
			||||
        GetReadOrder485 getReadOrder485=new GetReadOrder485(); | 
				
			||||
        getReadOrder485.createOrderParam("2");    //生成采集参数,1新珠江,2广合科技,3广大科技,6珠江国际,7保利山庄,8东莞迎宾馆
 | 
				
			||||
        try{ | 
				
			||||
            new EchoServer(6001).start();                // 调用服务器的start方法,网关作为客户端,6006新珠江,6001广合科技,6077广大科技
 | 
				
			||||
//            new EchoServer2(6013).start();               // 6028(6006)珠江国际,5000保利山庄,6004东莞迎宾馆
 | 
				
			||||
//       log.info("测试日志路径========!");
 | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            System.out.println("端口已占用!"); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @PreDestroy | 
				
			||||
    public void destory() { | 
				
			||||
        //关闭应用前 关闭端口
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,15 @@
					 | 
				
			||||
package com.mh.user.annotation; | 
				
			||||
 | 
				
			||||
import java.lang.annotation.*; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * Created by fangzhipeng on 2017/7/12. | 
				
			||||
 */ | 
				
			||||
@Target(ElementType.METHOD) | 
				
			||||
@Retention(RetentionPolicy.RUNTIME) | 
				
			||||
@Documented | 
				
			||||
public @interface SysLogger { | 
				
			||||
 | 
				
			||||
    String value() default "";   // 模块
 | 
				
			||||
    String optDesc() default ""; // 业务操作描述
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,23 @@
					 | 
				
			||||
package com.mh.user.annotation; | 
				
			||||
import javax.servlet.ServletContextAttributeEvent; | 
				
			||||
import javax.servlet.ServletContextAttributeListener; | 
				
			||||
import javax.servlet.ServletContextEvent; | 
				
			||||
import javax.servlet.ServletContextListener; | 
				
			||||
import javax.servlet.annotation.WebListener; | 
				
			||||
 | 
				
			||||
@WebListener | 
				
			||||
public class applicationListener implements ServletContextListener,ServletContextAttributeListener{ | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void contextDestroyed(ServletContextEvent arg0) { | 
				
			||||
        System.getProperties().remove("log4jDirKey"); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void contextInitialized(ServletContextEvent arg0) { | 
				
			||||
        String log4jDir=arg0.getServletContext().getRealPath("/"); | 
				
			||||
        System.setProperty("log4jDirKey", log4jDir); | 
				
			||||
//        System.out.println(log4jDir);
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,91 @@
					 | 
				
			||||
package com.mh.user.aspect; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
import javax.servlet.http.HttpServletRequest; | 
				
			||||
 | 
				
			||||
import com.mh.common.utils.StringUtils; | 
				
			||||
import com.mh.user.utils.SecurityUtils; | 
				
			||||
import org.apache.commons.beanutils.BeanUtils; | 
				
			||||
import org.aspectj.lang.ProceedingJoinPoint; | 
				
			||||
import org.aspectj.lang.annotation.Around; | 
				
			||||
import org.aspectj.lang.annotation.Aspect; | 
				
			||||
import org.aspectj.lang.annotation.Pointcut; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import org.springframework.stereotype.Component; | 
				
			||||
import org.springframework.web.context.request.RequestContextHolder; | 
				
			||||
import org.springframework.web.context.request.ServletRequestAttributes; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * DAO切面,插入创建人,创建时间,修改人,修改时间 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Oct 29, 2018 | 
				
			||||
 */ | 
				
			||||
@Aspect | 
				
			||||
@Component | 
				
			||||
@Configuration | 
				
			||||
public class DaoAspect { | 
				
			||||
	private static final String createBy = "createBy"; | 
				
			||||
	private static final String createTime = "createTime"; | 
				
			||||
	private static final String lastUpdateBy = "lastUpdateBy"; | 
				
			||||
	private static final String lastUpdateTime = "lastUpdateTime"; | 
				
			||||
 | 
				
			||||
	@Pointcut("execution(* com.mh.*.mapper.*.update*(..))") | 
				
			||||
	public void daoUpdate() { | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@Pointcut("execution(* com.mh.*.mapper.*.insert*(..))") | 
				
			||||
	public void daoCreate() { | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@Around("daoUpdate()") | 
				
			||||
	public Object doAroundUpdate(ProceedingJoinPoint pjp) throws Throwable { | 
				
			||||
		ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); | 
				
			||||
		if (attributes == null) { | 
				
			||||
			return pjp.proceed(); | 
				
			||||
		} | 
				
			||||
		HttpServletRequest request = attributes.getRequest(); | 
				
			||||
		String token = request.getHeader("token"); | 
				
			||||
		String username = getUserName(); | 
				
			||||
		if (token != null && username != null) { | 
				
			||||
			Object[] objects = pjp.getArgs(); | 
				
			||||
			if (objects != null && objects.length > 0) { | 
				
			||||
				for (Object arg : objects) { | 
				
			||||
					BeanUtils.setProperty(arg, lastUpdateBy, username); | 
				
			||||
					BeanUtils.setProperty(arg, lastUpdateTime, new Date()); | 
				
			||||
				} | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		Object object = pjp.proceed(); | 
				
			||||
		return object; | 
				
			||||
 | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@Around("daoCreate()") | 
				
			||||
	public Object doAroundCreate(ProceedingJoinPoint pjp) throws Throwable { | 
				
			||||
		ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); | 
				
			||||
		if (attributes == null) { | 
				
			||||
			return pjp.proceed(); | 
				
			||||
		} | 
				
			||||
		Object[] objects = pjp.getArgs(); | 
				
			||||
		if (objects != null && objects.length > 0) { | 
				
			||||
			for (Object arg : objects) { | 
				
			||||
				String username = getUserName(); | 
				
			||||
				if (username != null) { | 
				
			||||
					if (StringUtils.isBlank(BeanUtils.getProperty(arg, createBy))) { | 
				
			||||
						BeanUtils.setProperty(arg, createBy, username); | 
				
			||||
					} | 
				
			||||
					if (StringUtils.isBlank(BeanUtils.getProperty(arg, createTime))) { | 
				
			||||
						BeanUtils.setProperty(arg, createTime, new Date()); | 
				
			||||
					} | 
				
			||||
				} | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		Object object = pjp.proceed(); | 
				
			||||
		return object; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	private String getUserName() { | 
				
			||||
		return SecurityUtils.getUsername(); | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,127 @@
					 | 
				
			||||
package com.mh.user.aspect; | 
				
			||||
 | 
				
			||||
import javax.servlet.http.HttpServletRequest; | 
				
			||||
 | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.model.SysLog; | 
				
			||||
import com.mh.user.service.SysLogService; | 
				
			||||
import com.mh.user.utils.HttpUtils; | 
				
			||||
import com.mh.user.utils.IPUtils; | 
				
			||||
import com.mh.user.utils.SecurityUtils; | 
				
			||||
import org.aspectj.lang.JoinPoint; | 
				
			||||
import org.aspectj.lang.ProceedingJoinPoint; | 
				
			||||
import org.aspectj.lang.annotation.Around; | 
				
			||||
import org.aspectj.lang.annotation.Aspect; | 
				
			||||
import org.aspectj.lang.annotation.Pointcut; | 
				
			||||
import org.aspectj.lang.reflect.MethodSignature; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.stereotype.Component; | 
				
			||||
 | 
				
			||||
import com.alibaba.fastjson.JSONObject; | 
				
			||||
 | 
				
			||||
import java.lang.reflect.Method; | 
				
			||||
import java.text.SimpleDateFormat; | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 系统日志,切面处理类,记录日志 | 
				
			||||
 */ | 
				
			||||
@Aspect | 
				
			||||
@Component | 
				
			||||
public class SysLogAspect { | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysLogService sysLogService; | 
				
			||||
 | 
				
			||||
	//@Pointcut("execution(* com.mh.*.service.*.*(..))")
 | 
				
			||||
	@Pointcut("@annotation(com.mh.user.annotation.SysLogger)") | 
				
			||||
	public void logPointCut() { | 
				
			||||
 | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@Around("logPointCut()") | 
				
			||||
	public Object around(ProceedingJoinPoint point) throws Throwable { | 
				
			||||
		long beginTime = System.currentTimeMillis(); | 
				
			||||
		// 执行方法
 | 
				
			||||
		Object result = point.proceed(); | 
				
			||||
		// 执行时长(毫秒)
 | 
				
			||||
		long time = System.currentTimeMillis() - beginTime; | 
				
			||||
		// 保存日志
 | 
				
			||||
		saveSysLog(point, time); | 
				
			||||
		return result; | 
				
			||||
 | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	private void saveSysLog(ProceedingJoinPoint joinPoint, long time) { | 
				
			||||
		SysLog sysLog = new SysLog(); | 
				
			||||
		String methodName = joinPoint.getSignature().getName(); | 
				
			||||
		Method method = currentMethod(joinPoint,methodName); | 
				
			||||
		SysLogger sysLogger = method.getAnnotation(SysLogger.class); | 
				
			||||
		String module = sysLogger.value();   //操作模块
 | 
				
			||||
		String optDesc=sysLogger.optDesc();  //操作描述
 | 
				
			||||
		sysLog.setOperation(module); | 
				
			||||
		sysLog.setOptDesc(optDesc); | 
				
			||||
		String userName = SecurityUtils.getUsername(); //用户名称
 | 
				
			||||
		if(joinPoint.getTarget() instanceof SysLogService) { | 
				
			||||
			return ; | 
				
			||||
		} | 
				
			||||
		MethodSignature signature = (MethodSignature) joinPoint.getSignature(); | 
				
			||||
 | 
				
			||||
		// 请求的方法名
 | 
				
			||||
		String className = joinPoint.getTarget().getClass().getName(); | 
				
			||||
		String methodName1 = signature.getName(); | 
				
			||||
		sysLog.setMethod(className + "." + methodName1 + "()"); | 
				
			||||
 | 
				
			||||
		// 请求的参数
 | 
				
			||||
		Object[] args = joinPoint.getArgs(); | 
				
			||||
		try{ | 
				
			||||
			String params = JSONObject.toJSONString(args[0]); | 
				
			||||
			if(params.length() > 200) { | 
				
			||||
				params = params.substring(0, 200) + "..."; | 
				
			||||
			} | 
				
			||||
			sysLog.setParams(params); | 
				
			||||
		} catch (Exception e){ | 
				
			||||
		} | 
				
			||||
		// 获取request
 | 
				
			||||
		HttpServletRequest request = HttpUtils.getHttpServletRequest(); | 
				
			||||
		// 设置IP地址
 | 
				
			||||
		sysLog.setIp(IPUtils.getIpAddr(request)); | 
				
			||||
		String ip=IPUtils.getRemoteIp(); | 
				
			||||
		// 用户名
 | 
				
			||||
		sysLog.setUserName(userName); | 
				
			||||
		Date date1 = SecurityUtils.getLoginTime(); | 
				
			||||
		// 登录时间
 | 
				
			||||
		sysLog.setCreateTime(date1); | 
				
			||||
		Date date=new Date(); | 
				
			||||
		// 最后操作时间
 | 
				
			||||
		sysLog.setLastUpdateTime(date); | 
				
			||||
		// 执行时长(毫秒)
 | 
				
			||||
		sysLog.setTime(time); | 
				
			||||
		// 保存系统日志
 | 
				
			||||
		sysLogService.save(sysLog); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * 获取当前执行的方法 | 
				
			||||
	 * | 
				
			||||
	 * @param joinPoint  连接点 | 
				
			||||
	 * @param methodName 方法名称 | 
				
			||||
	 * @return 方法 | 
				
			||||
	 */ | 
				
			||||
	private Method currentMethod(JoinPoint joinPoint, String methodName) { | 
				
			||||
		/** | 
				
			||||
		 * 获取目标类的所有方法,找到当前要执行的方法 | 
				
			||||
		 */ | 
				
			||||
		Method[] methods = joinPoint.getTarget().getClass().getMethods(); | 
				
			||||
		Method resultMethod = null; | 
				
			||||
		for (Method method : methods) { | 
				
			||||
			if (method.getName().equals(methodName)) { | 
				
			||||
				resultMethod = method; | 
				
			||||
				break; | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		return resultMethod; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,71 @@
					 | 
				
			||||
package com.mh.user.component; | 
				
			||||
 | 
				
			||||
import com.alibaba.druid.sql.visitor.functions.Isnull; | 
				
			||||
import com.alibaba.fastjson.JSONObject; | 
				
			||||
import com.mh.user.config.RabbitmqConfig; | 
				
			||||
import com.mh.user.model.QueueParam; | 
				
			||||
import com.mh.user.utils.AnalysisReceiveOrder485; | 
				
			||||
import com.rabbitmq.client.AMQP; | 
				
			||||
import com.rabbitmq.client.Channel; | 
				
			||||
import com.rabbitmq.client.impl.AMQImpl; | 
				
			||||
import lombok.extern.slf4j.Slf4j; | 
				
			||||
import org.apache.log4j.Logger; | 
				
			||||
import org.springframework.amqp.core.ExchangeTypes; | 
				
			||||
import org.springframework.amqp.core.Message; | 
				
			||||
import org.springframework.amqp.rabbit.annotation.Exchange; | 
				
			||||
import org.springframework.amqp.rabbit.annotation.Queue; | 
				
			||||
import org.springframework.amqp.rabbit.annotation.QueueBinding; | 
				
			||||
import org.springframework.amqp.rabbit.annotation.RabbitListener; | 
				
			||||
import org.springframework.stereotype.Component; | 
				
			||||
 | 
				
			||||
import java.io.IOException; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 队列消费接收消息 | 
				
			||||
 */ | 
				
			||||
@Component | 
				
			||||
public class ReceiveHandler { | 
				
			||||
 | 
				
			||||
    private static final Logger log = Logger.getLogger(ReceiveHandler.class); | 
				
			||||
    //监听队列
 | 
				
			||||
//    @RabbitListener(bindings = @QueueBinding(
 | 
				
			||||
//            value = @Queue(value = "queue_zjjd", durable = "true"),
 | 
				
			||||
//            exchange = @Exchange(
 | 
				
			||||
//                    value = "topic.exchange",
 | 
				
			||||
//                    ignoreDeclarationExceptions = "true",
 | 
				
			||||
//                    type = ExchangeTypes.TOPIC
 | 
				
			||||
//            ),
 | 
				
			||||
//            key = {"topic.#.zjjd.#"}),ackMode = "MANUAL")
 | 
				
			||||
    @RabbitListener(queues = RabbitmqConfig.QUEUE_NAME,containerFactory = "simpleRabbitListenerContainerFactory") | 
				
			||||
    public void rece_msg(String msg,Channel channel, Message message) throws IOException { | 
				
			||||
        log.info("当前线程:{},收到的简单消息:{}"+Thread.currentThread().getName()+msg); | 
				
			||||
        try { | 
				
			||||
            String show=""; | 
				
			||||
            if(msg!=null && msg.length()>0){ | 
				
			||||
                JSONObject JSONObj=JSONObject.parseObject(msg); | 
				
			||||
                AnalysisReceiveOrder485 analysisReceive=new AnalysisReceiveOrder485(); | 
				
			||||
                QueueParam queueParam=new QueueParam(); | 
				
			||||
                queueParam.setRecData(JSONObj.getString("recData")); | 
				
			||||
                queueParam.setDeviceType(JSONObj.getString("deviceType")); | 
				
			||||
                queueParam.setRegisterAddr(JSONObj.getString("registerAddr")); | 
				
			||||
                queueParam.setProjectID(JSONObj.getString("projectID")); | 
				
			||||
                queueParam.setCopyTime(JSONObj.getString("copyTime")); | 
				
			||||
                String deviceType=JSONObj.getString("deviceType"); | 
				
			||||
                show=deviceType+",数据:"+JSONObj.getString("recData"); | 
				
			||||
                log.info("从队列接受到的信息-->"+show); | 
				
			||||
                if(deviceType!=null && deviceType.equals("电表")){ | 
				
			||||
                    analysisReceive.analysisMeterQueue(queueParam); | 
				
			||||
                }else if(deviceType.equals("冷量计")){ | 
				
			||||
                    analysisReceive.analysisCloudQueue(queueParam); | 
				
			||||
                } | 
				
			||||
            } | 
				
			||||
            //告诉服务器收到这条消息 已经被我消费了 可以在队列删掉 这样以后就不会再发了 否则消息服务器以为这条消息没处理掉 重启应用后还会在发
 | 
				
			||||
            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); | 
				
			||||
        } catch (Exception e) { | 
				
			||||
//            e.printStackTrace();
 | 
				
			||||
             //丢弃这条消息
 | 
				
			||||
            channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false); | 
				
			||||
            log.info("消费队列信息异常"); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,41 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | 
				
			||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | 
				
			||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 跨域配置 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Oct 29, 2018 | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
public class CorsConfig implements WebMvcConfigurer { | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    @Autowired(required = false) | 
				
			||||
    private PrimessionInterceptor primessionInterceptor; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 注册拦截器 | 
				
			||||
     */ | 
				
			||||
    @Override | 
				
			||||
    public void addInterceptors(InterceptorRegistry registry) { | 
				
			||||
 | 
				
			||||
        registry.addInterceptor(primessionInterceptor); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void addCorsMappings(CorsRegistry registry) { | 
				
			||||
        registry.addMapping("/**")	// 允许跨域访问的路径
 | 
				
			||||
        .allowedOrigins("*")	// 允许跨域访问的源
 | 
				
			||||
        .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")	// 允许请求方法
 | 
				
			||||
        .maxAge(168000)	// 预检间隔时间
 | 
				
			||||
        .allowedHeaders("*")  // 允许头部设置
 | 
				
			||||
        .allowCredentials(true);	// 是否发送cookie
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,117 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import java.sql.SQLException; | 
				
			||||
import java.util.ArrayList; | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
import javax.servlet.Filter; | 
				
			||||
import javax.servlet.Servlet; | 
				
			||||
import javax.sql.DataSource; | 
				
			||||
 | 
				
			||||
import com.alibaba.druid.wall.WallConfig; | 
				
			||||
import com.alibaba.druid.wall.WallFilter; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | 
				
			||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | 
				
			||||
import org.springframework.boot.web.servlet.FilterRegistrationBean; | 
				
			||||
import org.springframework.boot.web.servlet.ServletRegistrationBean; | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
 | 
				
			||||
import com.alibaba.druid.pool.DruidDataSource; | 
				
			||||
import com.alibaba.druid.support.http.StatViewServlet; | 
				
			||||
import com.alibaba.druid.support.http.WebStatFilter; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2020-03-13 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
@EnableConfigurationProperties({DruidDataSourceProperties.class}) | 
				
			||||
public class DruidConfig { | 
				
			||||
    @Autowired | 
				
			||||
    private DruidDataSourceProperties properties; | 
				
			||||
 | 
				
			||||
    @Bean | 
				
			||||
    @ConditionalOnMissingBean | 
				
			||||
    public DataSource druidDataSource() { | 
				
			||||
        DruidDataSource druidDataSource = new DruidDataSource(); | 
				
			||||
        druidDataSource.setDriverClassName(properties.getDriverClassName()); | 
				
			||||
        druidDataSource.setUrl(properties.getUrl()); | 
				
			||||
        druidDataSource.setUsername(properties.getUsername()); | 
				
			||||
        druidDataSource.setPassword(properties.getPassword()); | 
				
			||||
        druidDataSource.setInitialSize(properties.getInitialSize()); | 
				
			||||
        druidDataSource.setMinIdle(properties.getMinIdle()); | 
				
			||||
        druidDataSource.setMaxActive(properties.getMaxActive()); | 
				
			||||
        druidDataSource.setMaxWait(properties.getMaxWait()); | 
				
			||||
        druidDataSource.setTimeBetweenEvictionRunsMillis(properties.getTimeBetweenEvictionRunsMillis()); | 
				
			||||
        druidDataSource.setMinEvictableIdleTimeMillis(properties.getMinEvictableIdleTimeMillis()); | 
				
			||||
        druidDataSource.setValidationQuery(properties.getValidationQuery()); | 
				
			||||
        druidDataSource.setTestWhileIdle(properties.isTestWhileIdle()); | 
				
			||||
        druidDataSource.setTestOnBorrow(properties.isTestOnBorrow()); | 
				
			||||
        druidDataSource.setTestOnReturn(properties.isTestOnReturn()); | 
				
			||||
        druidDataSource.setPoolPreparedStatements(properties.isPoolPreparedStatements()); | 
				
			||||
        druidDataSource.setMaxPoolPreparedStatementPerConnectionSize(properties.getMaxPoolPreparedStatementPerConnectionSize()); | 
				
			||||
 | 
				
			||||
        List list=new ArrayList<>(); | 
				
			||||
        WallFilter wallFilter=new WallFilter(); | 
				
			||||
        WallConfig config = new WallConfig(); | 
				
			||||
        //允许一次执行多条语句
 | 
				
			||||
        config.setMultiStatementAllow(true); | 
				
			||||
        //允许非基本语句的其他语句
 | 
				
			||||
        //config.setNoneBaseStatementAllow(true);
 | 
				
			||||
        wallFilter.setConfig(config); | 
				
			||||
        list.add(wallFilter); | 
				
			||||
        druidDataSource.setProxyFilters(list); | 
				
			||||
 | 
				
			||||
        try { | 
				
			||||
            druidDataSource.setFilters(properties.getFilters()); | 
				
			||||
            druidDataSource.init(); | 
				
			||||
        } catch (SQLException e) { | 
				
			||||
            e.printStackTrace(); | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
        return druidDataSource; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 注册Servlet信息, 配置监控视图 | 
				
			||||
     * | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @Bean | 
				
			||||
    @ConditionalOnMissingBean | 
				
			||||
    public ServletRegistrationBean<Servlet> druidServlet() { | 
				
			||||
        ServletRegistrationBean<Servlet> servletRegistrationBean = new ServletRegistrationBean<Servlet>(new StatViewServlet(), "/druid/*"); | 
				
			||||
 | 
				
			||||
        //白名单:
 | 
				
			||||
//        servletRegistrationBean.addInitParameter("allow","127.0.0.1,139.196.87.48");
 | 
				
			||||
        //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
 | 
				
			||||
        servletRegistrationBean.addInitParameter("deny","192.168.1.222"); | 
				
			||||
        //登录查看信息的账号密码, 用于登录Druid监控后台
 | 
				
			||||
        servletRegistrationBean.addInitParameter("loginUsername", "admin"); | 
				
			||||
        servletRegistrationBean.addInitParameter("loginPassword", "admin"); | 
				
			||||
        //是否能够重置数据.
 | 
				
			||||
        servletRegistrationBean.addInitParameter("resetEnable", "true"); | 
				
			||||
        return servletRegistrationBean; | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 注册Filter信息, 监控拦截器 | 
				
			||||
     * | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @Bean | 
				
			||||
    @ConditionalOnMissingBean | 
				
			||||
    public FilterRegistrationBean<Filter> filterRegistrationBean() { | 
				
			||||
        FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<Filter>(); | 
				
			||||
        filterRegistrationBean.setFilter(new WebStatFilter()); | 
				
			||||
        filterRegistrationBean.addUrlPatterns("/*"); | 
				
			||||
        filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"); | 
				
			||||
        return filterRegistrationBean; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,172 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import org.springframework.boot.context.properties.ConfigurationProperties; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2020-03-13 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@ConfigurationProperties(prefix = "spring.datasource.druid") | 
				
			||||
public class DruidDataSourceProperties { | 
				
			||||
 | 
				
			||||
    // jdbc
 | 
				
			||||
    private String driverClassName; | 
				
			||||
    private String url; | 
				
			||||
    private String username; | 
				
			||||
    private String password; | 
				
			||||
    // jdbc connection pool
 | 
				
			||||
    private int initialSize; | 
				
			||||
    private int minIdle; | 
				
			||||
    private int maxActive = 100; | 
				
			||||
    private long maxWait; | 
				
			||||
    private long timeBetweenEvictionRunsMillis; | 
				
			||||
    private long minEvictableIdleTimeMillis; | 
				
			||||
    private String validationQuery; | 
				
			||||
    private boolean testWhileIdle; | 
				
			||||
    private boolean testOnBorrow; | 
				
			||||
    private boolean testOnReturn; | 
				
			||||
    private boolean poolPreparedStatements; | 
				
			||||
    private int maxPoolPreparedStatementPerConnectionSize; | 
				
			||||
    // filter
 | 
				
			||||
    private String filters; | 
				
			||||
 | 
				
			||||
    public int getInitialSize() { | 
				
			||||
        return initialSize; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setInitialSize(int initialSize) { | 
				
			||||
        this.initialSize = initialSize; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getMinIdle() { | 
				
			||||
        return minIdle; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMinIdle(int minIdle) { | 
				
			||||
        this.minIdle = minIdle; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getMaxActive() { | 
				
			||||
        return maxActive; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMaxActive(int maxActive) { | 
				
			||||
        this.maxActive = maxActive; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public long getMaxWait() { | 
				
			||||
        return maxWait; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMaxWait(long maxWait) { | 
				
			||||
        this.maxWait = maxWait; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public long getTimeBetweenEvictionRunsMillis() { | 
				
			||||
        return timeBetweenEvictionRunsMillis; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) { | 
				
			||||
        this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public long getMinEvictableIdleTimeMillis() { | 
				
			||||
        return minEvictableIdleTimeMillis; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { | 
				
			||||
        this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getValidationQuery() { | 
				
			||||
        return validationQuery; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setValidationQuery(String validationQuery) { | 
				
			||||
        this.validationQuery = validationQuery; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public boolean isTestWhileIdle() { | 
				
			||||
        return testWhileIdle; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setTestWhileIdle(boolean testWhileIdle) { | 
				
			||||
        this.testWhileIdle = testWhileIdle; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public boolean isTestOnBorrow() { | 
				
			||||
        return testOnBorrow; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setTestOnBorrow(boolean testOnBorrow) { | 
				
			||||
        this.testOnBorrow = testOnBorrow; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public boolean isTestOnReturn() { | 
				
			||||
        return testOnReturn; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setTestOnReturn(boolean testOnReturn) { | 
				
			||||
        this.testOnReturn = testOnReturn; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public boolean isPoolPreparedStatements() { | 
				
			||||
        return poolPreparedStatements; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setPoolPreparedStatements(boolean poolPreparedStatements) { | 
				
			||||
        this.poolPreparedStatements = poolPreparedStatements; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getMaxPoolPreparedStatementPerConnectionSize() { | 
				
			||||
        return maxPoolPreparedStatementPerConnectionSize; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) { | 
				
			||||
        this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getFilters() { | 
				
			||||
        return filters; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setFilters(String filters) { | 
				
			||||
        this.filters = filters; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDriverClassName() { | 
				
			||||
        return driverClassName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDriverClassName(String driverClassName) { | 
				
			||||
        this.driverClassName = driverClassName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getUrl() { | 
				
			||||
        return url; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setUrl(String url) { | 
				
			||||
        this.url = url; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getUsername() { | 
				
			||||
        return username; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setUsername(String username) { | 
				
			||||
        this.username = username; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getPassword() { | 
				
			||||
        return password; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setPassword(String password) { | 
				
			||||
        this.password = password; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,17 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import com.alibaba.druid.support.http.StatViewServlet; | 
				
			||||
 | 
				
			||||
/**    | 
				
			||||
 * druid监控视图配置    | 
				
			||||
 */     | 
				
			||||
//@WebServlet(urlPatterns = "/druid/*", initParams={    
 | 
				
			||||
//    @WebInitParam(name="allow",value="192.168.6.195"),	// IP白名单 (没有配置或者为空,则允许所有访问)    
 | 
				
			||||
//    @WebInitParam(name="deny",value="192.168.6.73"),	// IP黑名单 (存在共同时,deny优先于allow)    
 | 
				
			||||
//    @WebInitParam(name="loginUsername",value="admin"),	// 用户名    
 | 
				
			||||
//    @WebInitParam(name="loginPassword",value="admin"),	// 密码    
 | 
				
			||||
//    @WebInitParam(name="resetEnable",value="true")	// 禁用HTML页面上的“Reset All”功能    
 | 
				
			||||
//})   
 | 
				
			||||
public class DruidStatViewServlet extends StatViewServlet {   | 
				
			||||
    private static final long serialVersionUID = 7359758657306626394L;   | 
				
			||||
}   | 
				
			||||
@ -0,0 +1,56 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import com.google.code.kaptcha.impl.DefaultKaptcha; | 
				
			||||
import com.google.code.kaptcha.util.Config; | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
 | 
				
			||||
import java.util.Properties; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * author:ljf | 
				
			||||
 * update:2020-03-13 | 
				
			||||
 * description:登陆验证码 | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
public class KaptchaConfig { | 
				
			||||
 | 
				
			||||
    @Bean | 
				
			||||
    public DefaultKaptcha getDefaultKaptcha(){ | 
				
			||||
        DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); | 
				
			||||
        Properties properties = new Properties(); | 
				
			||||
        // 图片边框,合法值:yes[默认] , no
 | 
				
			||||
        properties.setProperty("kaptcha.border", "no"); | 
				
			||||
        // 边框颜色,合法值: r,g,b (and optional alpha) 或者 white,black,blue.默认black
 | 
				
			||||
        properties.setProperty("kaptcha.border.color", "105,179,90"); | 
				
			||||
        // 边框厚度,合法值:>0,默认1
 | 
				
			||||
//        properties.setProperty("kaptcha.border.thickness", "1");
 | 
				
			||||
        // 图片宽,默认200
 | 
				
			||||
        properties.setProperty("kaptcha.image.width", "110"); | 
				
			||||
        // 图片高,默认50
 | 
				
			||||
        properties.setProperty("kaptcha.image.height", "40"); | 
				
			||||
        // 字体大小,默认40px
 | 
				
			||||
        properties.setProperty("kaptcha.textproducer.font.size", "35"); | 
				
			||||
        // 字体,默认Arial, Courier
 | 
				
			||||
        properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑"); | 
				
			||||
        // 字体颜色,合法值: r,g,b  或者 white,black,blue.默认black
 | 
				
			||||
        properties.setProperty("kaptcha.textproducer.font.color", "blue"); | 
				
			||||
        // session key,默认KAPTCHA_SESSION_KEY
 | 
				
			||||
        properties.setProperty("kaptcha.session.key", "code"); | 
				
			||||
        // session date,默认KAPTCHA_SESSION_DATE
 | 
				
			||||
//        properties.setProperty("kaptcha.session.date", "KAPTCHA_SESSION_DATE");
 | 
				
			||||
        // 验证码长度,默认5
 | 
				
			||||
        properties.setProperty("kaptcha.textproducer.char.length", "4"); | 
				
			||||
        // 文字间隔,默认2
 | 
				
			||||
        properties.setProperty("kaptcha.textproducer.char.space", "5"); | 
				
			||||
        // 干扰 颜色,合法值: r,g,b 或者 white,black,blue.默认black
 | 
				
			||||
//        properties.setProperty("kaptcha.noise.color", "black");
 | 
				
			||||
        // 更多可参考:https://blog.csdn.net/elephantboy/article/details/52795309
 | 
				
			||||
 | 
				
			||||
        Config config = new Config(properties); | 
				
			||||
        defaultKaptcha.setConfig(config); | 
				
			||||
 | 
				
			||||
        return defaultKaptcha; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,68 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import com.alibaba.fastjson.JSON; | 
				
			||||
import com.alibaba.fastjson.JSONObject; | 
				
			||||
import com.mh.user.dynamic.datasource.DataSourceContextHolder; | 
				
			||||
import com.mh.user.dynamic.datasource.DataSourceObject; | 
				
			||||
import com.mh.user.entity.DBEntity; | 
				
			||||
import com.mh.user.service.SysUserService; | 
				
			||||
import com.mh.user.utils.JwtTokenUtils; | 
				
			||||
import com.mh.user.utils.AESUtil; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.stereotype.Component; | 
				
			||||
import org.springframework.web.servlet.HandlerInterceptor; | 
				
			||||
 | 
				
			||||
import javax.servlet.http.HttpServletRequest; | 
				
			||||
import javax.servlet.http.HttpServletResponse; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author chison | 
				
			||||
 * @date 2020-09-03 08:44 | 
				
			||||
 * @Description 请求拦截器 | 
				
			||||
 */ | 
				
			||||
@Component | 
				
			||||
public class PrimessionInterceptor implements HandlerInterceptor  { | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private SysUserService sysUserService; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 根据token获取用户项目信息,对数据源进行切换 | 
				
			||||
     * @param request | 
				
			||||
     * @param response | 
				
			||||
     * @param handler | 
				
			||||
     * @return | 
				
			||||
     * @throws Exception | 
				
			||||
     */ | 
				
			||||
    @Override | 
				
			||||
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | 
				
			||||
        String token = request.getHeader("token"); | 
				
			||||
        if (token != null && token.contains("token")) { | 
				
			||||
            JSONObject jsonObject = (JSONObject) JSON.parse(token); | 
				
			||||
            System.out.println("header---->" + jsonObject.get("token")); | 
				
			||||
            if (jsonObject.get("token") !=null ) { | 
				
			||||
                token = jsonObject.get("token").toString(); | 
				
			||||
            } | 
				
			||||
            System.out.println(" token==> " + token); | 
				
			||||
        } | 
				
			||||
        String uri = request.getRequestURI(); | 
				
			||||
        System.out.println(uri); | 
				
			||||
        DataSourceContextHolder.setDBType("default"); | 
				
			||||
        // 除了中间库业务的请求都使用多数据源切换
 | 
				
			||||
//        if(!(uri.contains("/sysUser") || uri.contains("/sysRole") || uri.contains("/sysMenu") )){
 | 
				
			||||
//            if(token != null){
 | 
				
			||||
//                String userName = JwtTokenUtils.getUsernameFromToken(token);
 | 
				
			||||
//                System.out.println(userName);
 | 
				
			||||
//                DBEntity dbEntity = sysUserService.queryDBInfo(userName);
 | 
				
			||||
//                dbEntity.setDB_Pwd(AESUtil.AESdecrypt(dbEntity.getDB_Pwd()));
 | 
				
			||||
//                // 切换数据源
 | 
				
			||||
//                DataSourceObject dataSourceObject = new DataSourceObject();
 | 
				
			||||
//                String SourceName = "sqlServer-"+dbEntity.getDB_Names();
 | 
				
			||||
//                dataSourceObject.SwitchSQLServerDataSource(dbEntity,SourceName);
 | 
				
			||||
//                DataSourceContextHolder.setDBType(SourceName);
 | 
				
			||||
//            }
 | 
				
			||||
//        }
 | 
				
			||||
        return true; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,54 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import com.mh.user.job.JobFactory; | 
				
			||||
import lombok.extern.slf4j.Slf4j; | 
				
			||||
import org.quartz.Scheduler; | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : Quartz配置 | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2020-04-03 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Slf4j | 
				
			||||
@Configuration | 
				
			||||
public class QuartzConfig { | 
				
			||||
 | 
				
			||||
    private JobFactory jobFactory; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * @author jinhaoxun | 
				
			||||
     * @description 构造器 | 
				
			||||
     * @param jobFactory | 
				
			||||
     */ | 
				
			||||
    public QuartzConfig(JobFactory jobFactory){ | 
				
			||||
        this.jobFactory = jobFactory; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * @author  jinhaoxun | 
				
			||||
     * @description 配置SchedulerFactoryBean,将一个方法产生为Bean并交给Spring容器管理 | 
				
			||||
     * @return SchedulerFactoryBean | 
				
			||||
     */ | 
				
			||||
    @Bean | 
				
			||||
    public SchedulerFactoryBean schedulerFactoryBean() { | 
				
			||||
//        log.info("开始注入定时任务调度器工厂...");
 | 
				
			||||
        System.out.println("开始注入定时任务调度器工厂..."); | 
				
			||||
        SchedulerFactoryBean factory = new SchedulerFactoryBean();// Spring提供SchedulerFactoryBean为Scheduler提供配置信息,并被Spring容器管理其生命周期
 | 
				
			||||
        factory.setJobFactory(jobFactory);// 设置自定义Job Factory,用于Spring管理Job bean
 | 
				
			||||
        factory.setOverwriteExistingJobs(true);// 覆盖存在的定时任务
 | 
				
			||||
        factory.setStartupDelay(30); //延时30秒启动定时任务,避免系统未完全启动却开始执行定时任务的情况
 | 
				
			||||
//        log.info("注入定时任务调度器工厂成功!");
 | 
				
			||||
        System.out.println("注入定时任务调度器工厂成功!"); | 
				
			||||
        return factory; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Bean(name = "scheduler") | 
				
			||||
    public Scheduler scheduler() { | 
				
			||||
        return schedulerFactoryBean().getScheduler(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,87 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import com.mh.user.component.ReceiveHandler; | 
				
			||||
import com.mh.user.constants.Constant; | 
				
			||||
import lombok.extern.slf4j.Slf4j; | 
				
			||||
import org.apache.log4j.Logger; | 
				
			||||
import org.springframework.amqp.core.*; | 
				
			||||
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; | 
				
			||||
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; | 
				
			||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory; | 
				
			||||
import org.springframework.amqp.support.converter.MessageConverter; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.beans.factory.annotation.Qualifier; | 
				
			||||
import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer; | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import org.springframework.core.task.SimpleAsyncTaskExecutor; | 
				
			||||
import org.springframework.transaction.PlatformTransactionManager; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 *队列绑定队列、绑定交换机、绑定路由KEY | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
public class RabbitmqConfig { | 
				
			||||
 | 
				
			||||
    private static final Logger log = Logger.getLogger(RabbitmqConfig.class); | 
				
			||||
 | 
				
			||||
//    public static final String QUEUE_NAME = "queue_zjjd";                //采集队列,珠江酒店
 | 
				
			||||
 | 
				
			||||
//    public static final String QUEUE_NAME = "queue_gdkj";                //采集队列,广大科技
 | 
				
			||||
    public static final String QUEUE_NAME = "queue_ghkj";                //采集队列,广和科技
 | 
				
			||||
//    public static final String QUEUE_NAME = "queue_zjgj";                //采集队列,珠江国际
 | 
				
			||||
//    public static final String QUEUE_NAME = "queue_blsz";                //采集队列,保利山庄
 | 
				
			||||
//    public static final String QUEUE_NAME = "queue_dgybg";                //采集队列,东莞迎宾馆
 | 
				
			||||
    public static final String EXCHANGE_NAME="topic.exchange";           //topics类型交换机==============
 | 
				
			||||
//    public static final String ROUTINGKEY_NAME="topic.#.zjjd.#";         //路由KEY,珠江酒店
 | 
				
			||||
//    public static final String ROUTINGKEY_NAME="topic.#.gdkj.#";         //路由KEY,广大科技
 | 
				
			||||
    public static final String ROUTINGKEY_NAME="topic.#.ghkj.#";         //路由KEY,广和科技
 | 
				
			||||
//    public static final String ROUTINGKEY_NAME="topic.#.zjgj.#";         //路由KEY,珠江国际
 | 
				
			||||
//    public static final String ROUTINGKEY_NAME="topic.#.blsz.#";         //路由KEY,保利山庄
 | 
				
			||||
//    public static final String ROUTINGKEY_NAME="topic.#.dgybg.#";         //路由KEY,东莞迎宾馆
 | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private CachingConnectionFactory connectionFactory; | 
				
			||||
 | 
				
			||||
    //声明交换机
 | 
				
			||||
    @Bean(EXCHANGE_NAME) | 
				
			||||
    public Exchange exchange(){ | 
				
			||||
        //durable(true) 持久化,mq重启之后交换机还在
 | 
				
			||||
        return ExchangeBuilder.topicExchange(EXCHANGE_NAME).durable(true).build(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //声明队列
 | 
				
			||||
    /* | 
				
			||||
     *   new Queue(QUEUE_EMAIL,true,false,false) | 
				
			||||
     *   durable="true" 持久化 rabbitmq重启的时候不需要创建新的队列 | 
				
			||||
     *   auto-delete 表示消息队列没有在使用时将被自动删除 默认是false | 
				
			||||
     *   exclusive  表示该消息队列是否只在当前connection生效,默认是false | 
				
			||||
     */ | 
				
			||||
    //声明队列
 | 
				
			||||
    @Bean(QUEUE_NAME) | 
				
			||||
    public Queue queue(){ | 
				
			||||
        log.info("声明队列"+QUEUE_NAME); | 
				
			||||
        return new Queue(QUEUE_NAME); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //ROUTINGKEY_WX队列绑定交换机,指定routingKey
 | 
				
			||||
    @Bean | 
				
			||||
    public Binding bindingQueue(@Qualifier(QUEUE_NAME) Queue queue, | 
				
			||||
                                @Qualifier(EXCHANGE_NAME) Exchange exchange){ | 
				
			||||
        log.info(QUEUE_NAME+"队列绑定到交换机topic.exchange"); | 
				
			||||
        return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_NAME).noargs(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //应该是处理多线程消费的
 | 
				
			||||
    @Bean | 
				
			||||
    public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory(){ | 
				
			||||
        SimpleRabbitListenerContainerFactory listenerContainerFactory = new SimpleRabbitListenerContainerFactory(); | 
				
			||||
        listenerContainerFactory.setConnectionFactory(connectionFactory); | 
				
			||||
        listenerContainerFactory.setConcurrentConsumers(3); | 
				
			||||
        listenerContainerFactory.setMaxConcurrentConsumers(5); | 
				
			||||
        listenerContainerFactory.setPrefetchCount(1);//预处理消息个数
 | 
				
			||||
        listenerContainerFactory.setAcknowledgeMode(AcknowledgeMode.MANUAL);//开启消息确认机制
 | 
				
			||||
        return listenerContainerFactory; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,14 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : redis配置 | 
				
			||||
 * @updateTime 2020-08-20 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
public class RestTemplateConfig { | 
				
			||||
} | 
				
			||||
@ -0,0 +1,49 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import springfox.documentation.builders.ApiInfoBuilder; | 
				
			||||
import springfox.documentation.builders.ParameterBuilder; | 
				
			||||
import springfox.documentation.builders.PathSelectors; | 
				
			||||
import springfox.documentation.builders.RequestHandlerSelectors; | 
				
			||||
import springfox.documentation.schema.ModelRef; | 
				
			||||
import springfox.documentation.service.ApiInfo; | 
				
			||||
import springfox.documentation.service.Parameter; | 
				
			||||
import springfox.documentation.spi.DocumentationType; | 
				
			||||
import springfox.documentation.spring.web.plugins.Docket; | 
				
			||||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | 
				
			||||
 | 
				
			||||
import java.util.ArrayList; | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2020-03-13 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
@EnableSwagger2 | 
				
			||||
public class SwaggerConfig { | 
				
			||||
 | 
				
			||||
    @Bean | 
				
			||||
    public Docket createRestApi(){ | 
				
			||||
        // 添加请求参数,我们这里把token作为请求头部参数传入后端
 | 
				
			||||
        ParameterBuilder parameterBuilder = new ParameterBuilder(); | 
				
			||||
        List<Parameter> parameters = new ArrayList<Parameter>(); | 
				
			||||
        parameterBuilder.name("token").description("令牌") | 
				
			||||
                .modelRef(new ModelRef("string")).parameterType("header").required(false).build(); | 
				
			||||
        parameters.add(parameterBuilder.build()); | 
				
			||||
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() | 
				
			||||
                .apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()) | 
				
			||||
                .build().globalOperationParameters(parameters); | 
				
			||||
//        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
 | 
				
			||||
//        		.apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build();
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    private ApiInfo apiInfo(){ | 
				
			||||
        return new ApiInfoBuilder().build(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,83 @@
					 | 
				
			||||
package com.mh.user.config; | 
				
			||||
 | 
				
			||||
import com.mh.user.security.JwtAuthenticationFilter; | 
				
			||||
import com.mh.user.security.JwtAuthenticationProvider; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.beans.factory.annotation.Qualifier; | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import org.springframework.http.HttpMethod; | 
				
			||||
import org.springframework.security.authentication.AuthenticationManager; | 
				
			||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | 
				
			||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; | 
				
			||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | 
				
			||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | 
				
			||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | 
				
			||||
import org.springframework.security.core.userdetails.UserDetailsService; | 
				
			||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; | 
				
			||||
import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; | 
				
			||||
import org.springframework.web.cors.CorsUtils; | 
				
			||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * Spring Security配置 | 
				
			||||
 * @author Louis | 
				
			||||
 * @date Jan 14, 2019 | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
@EnableWebSecurity	// 开启Spring Security
 | 
				
			||||
//@EnableGlobalMethodSecurity(prePostEnabled = true)	// 开启权限注解,如:@PreAuthorize注解
 | 
				
			||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | 
				
			||||
 | 
				
			||||
    @Qualifier("userDetailsServiceImpl") | 
				
			||||
    @Autowired | 
				
			||||
    private UserDetailsService userDetailsService; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void configure(AuthenticationManagerBuilder auth) throws Exception { | 
				
			||||
        // 使用自定义身份验证组件
 | 
				
			||||
        auth.authenticationProvider(new JwtAuthenticationProvider(userDetailsService)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    protected void configure(HttpSecurity http) throws Exception { | 
				
			||||
        // 禁用 csrf, 由于使用的是JWT,我们这里不需要csrf
 | 
				
			||||
//        System.out.println("test0");
 | 
				
			||||
//        http.cors().and().csrf().disable()
 | 
				
			||||
//    		.authorizeRequests()
 | 
				
			||||
//    		// 跨域预检请求
 | 
				
			||||
//            .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
 | 
				
			||||
//            // web jars
 | 
				
			||||
//            .antMatchers("/webjars/**").permitAll()
 | 
				
			||||
//            // 查看SQL监控(druid)
 | 
				
			||||
//            .antMatchers("/druid/**").permitAll()
 | 
				
			||||
//            // 首页和登录页面
 | 
				
			||||
//            .antMatchers("/").permitAll()
 | 
				
			||||
//            .antMatchers("/login").permitAll()
 | 
				
			||||
//            // swagger
 | 
				
			||||
//            .antMatchers("/swagger-ui.html").permitAll()
 | 
				
			||||
//            .antMatchers("/swagger-resources/**").permitAll()
 | 
				
			||||
//            .antMatchers("/v2/api-docs").permitAll()
 | 
				
			||||
//            .antMatchers("/webjars/springfox-swagger-ui/**").permitAll()
 | 
				
			||||
//            // 验证码
 | 
				
			||||
//            .antMatchers("/captcha.jpg**").permitAll()
 | 
				
			||||
//            // 服务监控
 | 
				
			||||
//            .antMatchers("/actuator/**").permitAll()
 | 
				
			||||
//            // 其他所有请求需要身份认证
 | 
				
			||||
//            .anyRequest().authenticated();
 | 
				
			||||
//        // 退出登录处理器
 | 
				
			||||
//        http.logout().logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
 | 
				
			||||
//        // token验证过滤器
 | 
				
			||||
//        http.addFilterBefore(new JwtAuthenticationFilter(authenticationManager()), UsernamePasswordAuthenticationFilter.class);
 | 
				
			||||
//        System.out.println("test0_1");
 | 
				
			||||
        // 禁用token验证
 | 
				
			||||
        http.csrf().disable().authorizeRequests().anyRequest().permitAll().and().logout().permitAll(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Bean | 
				
			||||
    @Override | 
				
			||||
    public AuthenticationManager authenticationManager() throws Exception { | 
				
			||||
    	return super.authenticationManager(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,18 @@
					 | 
				
			||||
package com.mh.user.constants; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 存放一些公共全局参数 | 
				
			||||
 * @updateTime 2020-05-29 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
public class Constant { | 
				
			||||
 | 
				
			||||
	public static boolean CONTROL_WEB_FLAG = false; | 
				
			||||
	public static boolean SEND_STATUS = false;           // 指令发送状态
 | 
				
			||||
    public static boolean FLAG = false; | 
				
			||||
    public static boolean WEB_FLAG = false;              // 判断是否有前端指令下发
 | 
				
			||||
    public static int projectId=1;                       // 项目编号
 | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,33 @@
					 | 
				
			||||
package com.mh.user.constants; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
import org.springframework.beans.factory.annotation.Value; | 
				
			||||
import org.springframework.boot.context.properties.ConfigurationProperties; | 
				
			||||
import org.springframework.context.annotation.PropertySource; | 
				
			||||
import org.springframework.stereotype.Component; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2020-06-09 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@PropertySource("classpath:socket.yml") | 
				
			||||
@ConfigurationProperties(prefix = "socket") | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
@Component | 
				
			||||
public class SocketMessage { | 
				
			||||
 | 
				
			||||
    @Value("${IP}") | 
				
			||||
    private String IP; | 
				
			||||
 | 
				
			||||
    @Value("${port}") | 
				
			||||
    private int port; | 
				
			||||
 | 
				
			||||
    @Value("${overtime}") | 
				
			||||
    private int overTime; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,11 @@
					 | 
				
			||||
package com.mh.user.constants; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * author: ljf | 
				
			||||
 * desc: 系统常量值 | 
				
			||||
 */ | 
				
			||||
public interface SysConstants { | 
				
			||||
 | 
				
			||||
    // 系统管理员用户名
 | 
				
			||||
    String ADMIN = "admin"; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,38 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.entity.AreaEntity; | 
				
			||||
import com.mh.user.entity.ExceptionTableData; | 
				
			||||
import com.mh.user.service.AreaService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author nxr | 
				
			||||
 * @title : 校区接口 | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2022-06-09 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("area") | 
				
			||||
public class AreaController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private AreaService areaService; | 
				
			||||
 | 
				
			||||
    @PreAuthorize("hasAuthority('sys:area:view')") | 
				
			||||
    @PostMapping(value = "/findArea") | 
				
			||||
    public HttpResult findArea() { | 
				
			||||
        List<AreaEntity> list=areaService.findAll(); | 
				
			||||
//        System.out.println("test");
 | 
				
			||||
        return HttpResult.ok("500",list); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,90 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.BuildingEntity; | 
				
			||||
import com.mh.user.model.BuildingModel; | 
				
			||||
import com.mh.user.service.BuildingService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.List; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("building") | 
				
			||||
public class BuildingController { | 
				
			||||
 | 
				
			||||
   @Autowired | 
				
			||||
    private BuildingService buildingService; | 
				
			||||
 | 
				
			||||
   //保存
 | 
				
			||||
   @SysLogger(value="楼栋管理",optDesc = "添加楼栋信息") | 
				
			||||
   @PostMapping(value="/save") | 
				
			||||
    public HttpResult saveBuilding(@RequestBody BuildingEntity buildingEntity) { | 
				
			||||
       try{ | 
				
			||||
           return HttpResult.ok(buildingService.saveBuilding(buildingEntity)); | 
				
			||||
       }catch (Exception e){ | 
				
			||||
           e.printStackTrace(); | 
				
			||||
           return HttpResult.error(); | 
				
			||||
       } | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //修改
 | 
				
			||||
    @SysLogger(value="楼栋管理",optDesc = "编辑楼栋信息") | 
				
			||||
    @PostMapping(value="/update") | 
				
			||||
    public HttpResult updateBuilding(@RequestBody BuildingEntity buildingEntity) { | 
				
			||||
        return HttpResult.ok(buildingService.updateBuilding(buildingEntity)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //查询所有
 | 
				
			||||
    @SysLogger(value="楼栋管理",optDesc = "查询楼栋信息") | 
				
			||||
    @PostMapping(value = "/query") | 
				
			||||
    public HttpResult queryBuilding(@RequestParam(value = "buildingId", required = false)String buildingId, | 
				
			||||
                                    @RequestParam(value= "page", required=true)Integer page, | 
				
			||||
                                    @RequestParam(value= "limit", required=true)Integer limit) { | 
				
			||||
        try{ | 
				
			||||
            int count=buildingService.getCount(buildingId, page,limit); | 
				
			||||
            List<BuildingEntity> records=buildingService.queryBuilding(buildingId, page,limit); | 
				
			||||
            return HttpResult.ok(count,records); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //查询楼栋名称
 | 
				
			||||
    @PostMapping(value="/name") | 
				
			||||
    public HttpResult selectBuildingName() { | 
				
			||||
       try{ | 
				
			||||
           List<BuildingModel> list=buildingService.selectBuildingName(); | 
				
			||||
           return HttpResult.ok(list); | 
				
			||||
       }catch (Exception e){ | 
				
			||||
           e.printStackTrace(); | 
				
			||||
           return HttpResult.error(); | 
				
			||||
       } | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 删除多
 | 
				
			||||
    @PostMapping(value="/deletes") | 
				
			||||
    public HttpResult delete(@RequestBody List<BuildingEntity> records) { | 
				
			||||
        return HttpResult.ok(buildingService.deleteBuilding(records)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 删除单个
 | 
				
			||||
    @SysLogger(value="楼栋管理",optDesc = "删除楼栋信息") | 
				
			||||
    @PostMapping(value="/delete") | 
				
			||||
    public HttpResult delete(@RequestParam String id ) { | 
				
			||||
        return HttpResult.ok(buildingService.deleteBuilding(id)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 查询编号
 | 
				
			||||
    @PostMapping(value="/selectBuildingId") | 
				
			||||
    public HttpResult selectBuildingId(@RequestParam String buildingName ) { | 
				
			||||
        String id=buildingService.selectBuildingId(buildingName); | 
				
			||||
        return HttpResult.ok(id); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,56 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.alibaba.fastjson.JSONArray; | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.entity.chart.ChartEntity; | 
				
			||||
import com.mh.user.entity.chart.GetChartParams; | 
				
			||||
import com.mh.user.service.chart.ChartService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.List; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : 图表查询接口 | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2020-07-17 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("/report") | 
				
			||||
public class ChartController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private ChartService chartService; | 
				
			||||
 | 
				
			||||
    @PostMapping("/getFirstColChartsData") | 
				
			||||
    public HttpResult getFirstColChartsData(@RequestBody GetChartParams getChartParams) { | 
				
			||||
        System.out.println(getChartParams.toString()); | 
				
			||||
        // 遍历数组参数
 | 
				
			||||
        StringBuilder chooseIndexIds = new StringBuilder(); | 
				
			||||
        int b = 0; | 
				
			||||
        for (int a : | 
				
			||||
                getChartParams.getChooseIndexId()) { | 
				
			||||
            b = b + 1; | 
				
			||||
            if (b == 1) { | 
				
			||||
                chooseIndexIds = new StringBuilder(String.valueOf(a)); | 
				
			||||
            } else { | 
				
			||||
                chooseIndexIds.append(",").append(a); | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
        System.out.println(chooseIndexIds); | 
				
			||||
        Map<String,Object> map = new HashMap<>(); | 
				
			||||
        map.put("choose_index_ids", chooseIndexIds.toString()); | 
				
			||||
        map.put("begin_time",getChartParams.getBeginTime()); | 
				
			||||
        map.put("end_time",getChartParams.getEndTime()); | 
				
			||||
        map.put("type",getChartParams.getType()); | 
				
			||||
        map.put("chart_id",getChartParams.getChartId()); | 
				
			||||
        List<ChartEntity> chartEntityList = chartService.queryChartData(map); | 
				
			||||
        System.out.println(JSONArray.toJSONString(chartEntityList)); | 
				
			||||
        return HttpResult.ok("success",chartEntityList); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,140 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.alibaba.fastjson.JSONObject; | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.dto.DisplayBoxDataDTO; | 
				
			||||
import com.mh.user.dto.TableInfoDTO; | 
				
			||||
import com.mh.user.entity.GaugeEntity; | 
				
			||||
import com.mh.user.entity.HostValue; | 
				
			||||
import com.mh.user.entity.TableDataEntity; | 
				
			||||
import com.mh.user.entity.TableInfoEntity; | 
				
			||||
import com.mh.user.service.chillers.ChillersService; | 
				
			||||
import com.mh.user.service.chillers.DeviceDisplayService; | 
				
			||||
import com.mh.user.service.chillers.GaugeService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 设备监控操作控制接口 | 
				
			||||
 * @updateTime 2020-05-20 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
public class ChillersController { | 
				
			||||
 | 
				
			||||
    private final ChillersService chillersService; | 
				
			||||
    private final DeviceDisplayService deviceDisplayService; | 
				
			||||
 | 
				
			||||
    public ChillersController(ChillersService chillersService, DeviceDisplayService deviceDisplayService) { | 
				
			||||
        this.chillersService = chillersService; | 
				
			||||
        this.deviceDisplayService = deviceDisplayService; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 查询冷水机组各个部位的状态值
 | 
				
			||||
//    @GetMapping("/chillers")
 | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 查询冷水机组进出水温度值等设备数据详情 | 
				
			||||
     * @param deviceType | 
				
			||||
     * @param type | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @GetMapping("/charts/getDisplayBoxData") | 
				
			||||
    public HttpResult getDisplayBoxData(@RequestParam(value = "deviceType") String deviceType, | 
				
			||||
                                        @RequestParam(value = "type") Integer type) { | 
				
			||||
        List<DisplayBoxDataDTO> displayBoxDataDTOS = deviceDisplayService.deviceDisplayBoxData(deviceType, String.valueOf(type)); | 
				
			||||
        return HttpResult.ok("success", displayBoxDataDTOS); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 主机监测详情左侧表格数据 | 
				
			||||
     * @param deviceName | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @GetMapping("/charts/getHostTableOneData") | 
				
			||||
    public HttpResult queryChillersOneTable(@RequestParam(value = "deviceName") String deviceName) { | 
				
			||||
        TableInfoDTO<TableInfoEntity> tableInfoDTO = new TableInfoDTO<>(); | 
				
			||||
        tableInfoDTO.setTableInfo(chillersService.queryLeftAndRightData(deviceName, 1)); | 
				
			||||
        return HttpResult.ok("success", tableInfoDTO); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 主机监测详情顶部表格数据 | 
				
			||||
     * @param deviceName | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @GetMapping("/charts/getHostTopData") | 
				
			||||
    public HttpResult queryChillersTopTable(@RequestParam(value = "deviceName", required = true) String deviceName) { | 
				
			||||
        TableInfoDTO<TableDataEntity> tableInfoDTO = new TableInfoDTO<>(); | 
				
			||||
        tableInfoDTO.setTableInfo(chillersService.queryTopData(deviceName, 1)); | 
				
			||||
        return HttpResult.ok("success", tableInfoDTO); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 主机监测详情右侧一表格数据 | 
				
			||||
     * @param deviceName | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @GetMapping("/charts/getHostTableTwoData") | 
				
			||||
    public HttpResult queryChillersRightTable(@RequestParam(value = "deviceName", required = true) String deviceName) { | 
				
			||||
        TableInfoDTO<TableInfoEntity> tableInfoDTO = new TableInfoDTO<>(); | 
				
			||||
        tableInfoDTO.setTableInfo(chillersService.queryLeftAndRightData(deviceName, 2)); | 
				
			||||
        return HttpResult.ok("success", tableInfoDTO); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 主机监测详情右侧二表格数据 | 
				
			||||
     * @param deviceName | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @GetMapping("/charts/getHostTableThreeData") | 
				
			||||
    public HttpResult queryChillersRightTable1(@RequestParam(value = "deviceName", required = true) String deviceName) { | 
				
			||||
        TableInfoDTO<TableInfoEntity> tableInfoDTO = new TableInfoDTO<>(); | 
				
			||||
        tableInfoDTO.setTableInfo(chillersService.queryLeftAndRightData(deviceName, 3)); | 
				
			||||
        return HttpResult.ok("success", tableInfoDTO); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 冷却泵、冷冻泵、冷却塔详情页顶部表格数据
 | 
				
			||||
    @GetMapping("/charts/getPumpOrTowerTopTableData") | 
				
			||||
    public HttpResult getPumpOrTowerTopData(@RequestParam(value = "deviceName", required = true) String deviceName) { | 
				
			||||
        TableInfoDTO<TableInfoEntity> tableInfoDTO = new TableInfoDTO<>(); | 
				
			||||
        tableInfoDTO.setTableInfo(chillersService.queryLeftAndRightData(deviceName, 1)); | 
				
			||||
        return HttpResult.ok("success", tableInfoDTO); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 冷却泵、冷冻泵、冷却塔详情页顶部数据
 | 
				
			||||
//    @GetMapping("/charts/getPumpOrTowerTopTableData")
 | 
				
			||||
    @GetMapping("/charts/getPumpOrTowerTopData") | 
				
			||||
    public HttpResult getPumpOrTowerTopTableData(@RequestParam(value = "deviceName", required = true) String deviceName) { | 
				
			||||
        TableInfoDTO<TableDataEntity> tableInfoDTO = new TableInfoDTO<>(); | 
				
			||||
        tableInfoDTO.setTableInfo(chillersService.queryTopData(deviceName, 1)); | 
				
			||||
        return HttpResult.ok("success", tableInfoDTO); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    // 获取冷却/冷冻水进出水温度、主机/冷却塔温度
 | 
				
			||||
    @GetMapping("/operation/getTempValue") | 
				
			||||
    public HttpResult getTempValue(@RequestParam(value = "deviceType", required = true) String deviceType) { | 
				
			||||
        List<HostValue> hostValueList = chillersService.queryTempValue(deviceType); | 
				
			||||
        JSONObject jsonObject = new JSONObject(); | 
				
			||||
        jsonObject.put("values", hostValueList); | 
				
			||||
        return HttpResult.ok("success",jsonObject); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private GaugeService gaugeService; | 
				
			||||
 | 
				
			||||
    // 设备监控页表盘分析图
 | 
				
			||||
    @GetMapping("/charts/getGaugeData") | 
				
			||||
    public HttpResult getGaugeData(@RequestParam(value = "type") String type, @RequestParam(value = "deviceName") String deviceName) { | 
				
			||||
        GaugeEntity gaugeEntity = gaugeService.getGaugeData(type,deviceName); | 
				
			||||
        return HttpResult.ok("success",gaugeEntity); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,328 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.DataResultChEntity; | 
				
			||||
import com.mh.user.entity.DataResultEntity; | 
				
			||||
import com.mh.user.service.BuildingService; | 
				
			||||
import com.mh.user.service.DataResultService; | 
				
			||||
import com.mh.user.utils.ExchangeStringUtil; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
import java.text.SimpleDateFormat; | 
				
			||||
import java.util.*; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("dataResult") | 
				
			||||
public class DataResultController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    DataResultService dataResultService; | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    BuildingService buildingService; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    @SysLogger(value="中央空调",optDesc = "数据分析查询") | 
				
			||||
    @PostMapping(value="/query") | 
				
			||||
    public HttpResult queryDataResult(@RequestParam(value = "projectID", required = false) String projectID, | 
				
			||||
                                      @RequestParam(value= "startDate", required=false)String startDate, | 
				
			||||
                                      @RequestParam(value= "endDate", required=false)String endDate, | 
				
			||||
                                      @RequestParam(value= "deviceType", required=false)String deviceType, | 
				
			||||
                                      @RequestParam(value= "page", required=true)Integer page, | 
				
			||||
                                      @RequestParam(value= "limit", required=true)Integer limit) { | 
				
			||||
 | 
				
			||||
        try{ | 
				
			||||
 | 
				
			||||
           int count=dataResultService.getDataResultCount(projectID,startDate,endDate,deviceType,page,limit); | 
				
			||||
           List<DataResultEntity> records=dataResultService.queryDataResult(projectID,startDate,endDate,deviceType,page,limit); | 
				
			||||
           return HttpResult.ok(count,records); | 
				
			||||
 | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="中央空调",optDesc = "能耗分析按小时查询") | 
				
			||||
    @PostMapping(value="/hour") | 
				
			||||
    public HttpResult queryDataResultMi(@RequestParam(value= "projectID", required=false)String projectID, | 
				
			||||
                                        @RequestParam(value= "dateType", required=false)String dateType, | 
				
			||||
                                        @RequestParam(value= "curDate", required=false)String curDate, | 
				
			||||
                                        @RequestParam(value="page", required=false) int page, | 
				
			||||
                                        @RequestParam(value="limit", required=false) int limit) { | 
				
			||||
        try{ | 
				
			||||
            if(projectID!=null && projectID.length()>0){ | 
				
			||||
                String startDate=""; | 
				
			||||
                curDate=curDate.substring(0,16)+":00"; | 
				
			||||
                if (dateType.equals("1小时")){ | 
				
			||||
                    startDate= ExchangeStringUtil.dateRoll(1,curDate); | 
				
			||||
                    List<DataResultChEntity> records=dataResultService.queryDataResultMi(projectID,startDate,curDate,page,limit,0); | 
				
			||||
                    int count=dataResultService.dataResultOneMiCount(projectID,startDate,curDate); | 
				
			||||
                    return HttpResult.ok(count,records); | 
				
			||||
                }else if (dateType.equals("2小时")){ | 
				
			||||
                    startDate=ExchangeStringUtil.dateRoll(2,curDate); | 
				
			||||
                    List<DataResultChEntity> records=dataResultService.queryDataResultMi(projectID,startDate,curDate,page,limit,0); | 
				
			||||
                    int count=dataResultService.dataResultOneMiCount(projectID,startDate,curDate); | 
				
			||||
                    return HttpResult.ok(count,records); | 
				
			||||
                }else if (dateType.equals("8小时")){ | 
				
			||||
                    startDate=ExchangeStringUtil.dateRoll(8,curDate); | 
				
			||||
                    List<DataResultChEntity> records=dataResultService.queryDataResultMi(projectID,startDate,curDate,page,limit,1); | 
				
			||||
                    int count=dataResultService.dataResultFiveMiCount(projectID,startDate,curDate); | 
				
			||||
                    return HttpResult.ok(count,records); | 
				
			||||
                }else if (dateType.equals("12小时")){ | 
				
			||||
                    startDate=ExchangeStringUtil.dateRoll(12,curDate); | 
				
			||||
                    List<DataResultChEntity> records=dataResultService.queryDataResultMi(projectID,startDate,curDate,page,limit,1); | 
				
			||||
                    int count=dataResultService.dataResultFiveMiCount(projectID,startDate,curDate); | 
				
			||||
                    return HttpResult.ok(count,records); | 
				
			||||
                }else if (dateType.equals("24小时")){ | 
				
			||||
                    startDate=ExchangeStringUtil.dateRoll(24,curDate); | 
				
			||||
                    List<DataResultChEntity> records=dataResultService.queryDataResultMi(projectID,startDate,curDate,page,limit,2); | 
				
			||||
                    int count=dataResultService.dataResultFifteenMiCount(projectID,startDate,curDate); | 
				
			||||
                    return HttpResult.ok(count,records); | 
				
			||||
                }else{ //1小时
 | 
				
			||||
                    startDate=ExchangeStringUtil.dateRoll(1,curDate); | 
				
			||||
                    List<DataResultChEntity> records=dataResultService.queryDataResultMi(projectID,startDate,curDate,page,limit,0); | 
				
			||||
                    int count=dataResultService.dataResultOneMiCount(projectID,startDate,curDate); | 
				
			||||
                    return HttpResult.ok(count,records); | 
				
			||||
                } | 
				
			||||
            }else{ | 
				
			||||
                return HttpResult.error(); | 
				
			||||
            } | 
				
			||||
        }catch (Exception e){ | 
				
			||||
//            e.printStackTrace();
 | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="中央空调",optDesc = "能耗分析按分钟查询") | 
				
			||||
    @PostMapping(value="/minute") | 
				
			||||
    public HttpResult queryDataResultSec(@RequestParam(value= "projectID", required=false)String projectID, | 
				
			||||
                                         @RequestParam(value= "dateType", required=false)String dateType, | 
				
			||||
                                         @RequestParam(value= "curDate", required=false)String curDate, | 
				
			||||
                                         @RequestParam(value="page",required=false) int page, | 
				
			||||
                                         @RequestParam(value="limit",required=false) int limit) { | 
				
			||||
 | 
				
			||||
        try{ | 
				
			||||
            SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
				
			||||
            String startDate=""; //起始时间
 | 
				
			||||
            String strDate="";   //遍历时间
 | 
				
			||||
            String strDate2=""; | 
				
			||||
            curDate=curDate.substring(0,16)+":00"; | 
				
			||||
            if (dateType.equals("1分钟")){ | 
				
			||||
                startDate= ExchangeStringUtil.dateTime(1,curDate); | 
				
			||||
                List<DataResultChEntity> records=dataResultService.queryDataResultSec(projectID,startDate,curDate); | 
				
			||||
                String deviceAddr=records.get(0).getDeviceAddr(); | 
				
			||||
                String projectName=records.get(0).getProjectName(); | 
				
			||||
 | 
				
			||||
//                Date date=df.parse(startDate); //顺序
 | 
				
			||||
                Date date=df.parse(curDate); //倒序
 | 
				
			||||
                List<Map<String,Object>> listMap=new ArrayList<Map<String,Object>>(); | 
				
			||||
                for (int i=0;i<60;i++){ | 
				
			||||
                    Map<String,Object>map=new HashMap<String,Object>(); | 
				
			||||
                    //date.setTime(date.getTime()+1000);//顺序
 | 
				
			||||
                    date.setTime(date.getTime()-1000);//倒序
 | 
				
			||||
                    strDate=df.format(date); | 
				
			||||
                    map.put("deviceAddr",deviceAddr); | 
				
			||||
                    map.put("projectName",projectName); | 
				
			||||
                    map.put("curDate",strDate); | 
				
			||||
                    map.put("curValue","0"); | 
				
			||||
                    for (DataResultChEntity dataResult: records) { | 
				
			||||
                        strDate2=df.format(dataResult.getCurDate()); | 
				
			||||
                        if (strDate2.equals(strDate)){ | 
				
			||||
                            map.put("curValue",dataResult.getCurValue()); | 
				
			||||
                        } | 
				
			||||
                    } | 
				
			||||
                    listMap.add(map); | 
				
			||||
                } | 
				
			||||
                return HttpResult.ok(60,listMap); | 
				
			||||
 | 
				
			||||
            }else if (dateType.equals("2分钟")){ | 
				
			||||
                startDate=ExchangeStringUtil.dateTime(2,curDate); | 
				
			||||
                List<DataResultChEntity> records=dataResultService.queryDataResultSec(projectID,startDate,curDate); | 
				
			||||
                String deviceAddr=records.get(0).getDeviceAddr(); | 
				
			||||
                String projectName=records.get(0).getProjectName(); | 
				
			||||
                //Date date=df.parse(startDate);//顺序
 | 
				
			||||
                Date date=df.parse(curDate); //倒序
 | 
				
			||||
                List<Map<String,Object>> listMap=new ArrayList<Map<String,Object>>(); | 
				
			||||
                for (int i=0;i<120;i++){ | 
				
			||||
                    Map<String,Object>map=new HashMap<String,Object>(); | 
				
			||||
                    //date.setTime(date.getTime()+1000);
 | 
				
			||||
                    date.setTime(date.getTime()-1000);//倒序
 | 
				
			||||
                    strDate=df.format(date); | 
				
			||||
                    map.put("deviceAddr",deviceAddr); | 
				
			||||
                    map.put("projectName",projectName); | 
				
			||||
                    map.put("curDate",strDate); | 
				
			||||
                    map.put("curValue","0"); | 
				
			||||
                    for (DataResultChEntity dataResult: records) { | 
				
			||||
                        strDate2=df.format(dataResult.getCurDate()); | 
				
			||||
                        if (strDate2.equals(strDate)){ | 
				
			||||
                          map.put("curValue",dataResult.getCurValue()); | 
				
			||||
                        } | 
				
			||||
                    } | 
				
			||||
                    listMap.add(map); | 
				
			||||
                } | 
				
			||||
                return HttpResult.ok(120,listMap); | 
				
			||||
            }else if (dateType.equals("5分钟")){ | 
				
			||||
                startDate=ExchangeStringUtil.dateTime(5,curDate); | 
				
			||||
                List<DataResultChEntity> records=dataResultService.queryDataResultSec(projectID,startDate,curDate); | 
				
			||||
                String deviceAddr=records.get(0).getDeviceAddr(); | 
				
			||||
                String projectName=records.get(0).getProjectName(); | 
				
			||||
                String s=startDate.substring(18,19); | 
				
			||||
                if (Integer.parseInt(s)>=0 && Integer.parseInt(s)<5){ | 
				
			||||
                    startDate=startDate.substring(0,18)+"0"; | 
				
			||||
                }else{ | 
				
			||||
                    startDate=startDate.substring(0,18)+"5"; | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                //Date date=df.parse(startDate);//顺序
 | 
				
			||||
                Date date=df.parse(curDate); //倒序
 | 
				
			||||
                List<Map<String,Object>> listMap=new ArrayList<Map<String,Object>>(); | 
				
			||||
                for (int i=0;i<60;i++){ | 
				
			||||
                    Map<String,Object>map=new HashMap<String,Object>(); | 
				
			||||
                    //date.setTime(date.getTime()+5000);
 | 
				
			||||
                    date.setTime(date.getTime()-5000); | 
				
			||||
                    strDate=df.format(date); | 
				
			||||
                    map.put("deviceAddr",deviceAddr); | 
				
			||||
                    map.put("projectName",projectName); | 
				
			||||
                    map.put("curDate",strDate); | 
				
			||||
                    map.put("curValue","0"); | 
				
			||||
                    for (DataResultChEntity dataResult: records) { | 
				
			||||
                        strDate2=df.format(dataResult.getCurDate()); | 
				
			||||
                        if (strDate2.equals(strDate)){ | 
				
			||||
//                            map.put("curDate",curDate);
 | 
				
			||||
                            map.put("curValue",dataResult.getCurValue()); | 
				
			||||
                        } | 
				
			||||
                    } | 
				
			||||
                    listMap.add(map); | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                return HttpResult.ok(60,listMap); | 
				
			||||
            }else if (dateType.equals("15分钟")){ | 
				
			||||
                startDate=ExchangeStringUtil.dateTime(15,curDate); | 
				
			||||
                List<DataResultChEntity> records=dataResultService.queryDataResultSec(projectID,startDate,curDate); | 
				
			||||
                String deviceAddr=records.get(0).getDeviceAddr(); | 
				
			||||
                String projectName=records.get(0).getProjectName(); | 
				
			||||
                String s=startDate.substring(18,19); | 
				
			||||
                if (Integer.parseInt(s)>=0 && Integer.parseInt(s)<5){ | 
				
			||||
                    startDate=startDate.substring(0,18)+"0"; | 
				
			||||
                }else{ | 
				
			||||
                    startDate=startDate.substring(0,18)+"5"; | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                //Date date=df.parse(startDate);
 | 
				
			||||
                Date date=df.parse(curDate); | 
				
			||||
                List<Map<String,Object>> listMap=new ArrayList<Map<String,Object>>(); | 
				
			||||
                for (int i=0;i<180;i++){ | 
				
			||||
                    Map<String,Object>map=new HashMap<String,Object>(); | 
				
			||||
                    //date.setTime(date.getTime()+5000);
 | 
				
			||||
                    date.setTime(date.getTime()-5000); | 
				
			||||
                    strDate=df.format(date); | 
				
			||||
                    map.put("deviceAddr",deviceAddr); | 
				
			||||
                    map.put("projectName",projectName); | 
				
			||||
                    map.put("curDate",strDate); | 
				
			||||
                    map.put("curValue","0"); | 
				
			||||
                    for (DataResultChEntity dataResult: records) { | 
				
			||||
                        strDate2=df.format(dataResult.getCurDate()); | 
				
			||||
                        if (strDate2.equals(strDate)){ | 
				
			||||
//                            map.put("curDate",curDate);
 | 
				
			||||
                            map.put("curValue",dataResult.getCurValue()); | 
				
			||||
                        } | 
				
			||||
                    } | 
				
			||||
                    listMap.add(map); | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                return HttpResult.ok(180,listMap); | 
				
			||||
            }else if (dateType.equals("30分钟")){ | 
				
			||||
                startDate=ExchangeStringUtil.dateTime(30,curDate); | 
				
			||||
                List<DataResultChEntity> records=dataResultService.queryDataResultSec(projectID,startDate,curDate); | 
				
			||||
                String deviceAddr=records.get(0).getDeviceAddr(); | 
				
			||||
                String projectName=records.get(0).getProjectName(); | 
				
			||||
                String s=startDate.substring(18,19); | 
				
			||||
                if (Integer.parseInt(s)>=0 && Integer.parseInt(s)<5){ | 
				
			||||
                    startDate=startDate.substring(0,18)+"0"; | 
				
			||||
                }else{ | 
				
			||||
                    startDate=startDate.substring(0,18)+"5"; | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                //Date date=df.parse(startDate);
 | 
				
			||||
                Date date=df.parse(curDate); | 
				
			||||
                List<Map<String,Object>> listMap=new ArrayList<Map<String,Object>>(); | 
				
			||||
                for (int i=0;i<180;i++){ | 
				
			||||
                    Map<String,Object>map=new HashMap<String,Object>(); | 
				
			||||
                    //date.setTime(date.getTime()+10000);
 | 
				
			||||
                    date.setTime(date.getTime()-10000); | 
				
			||||
                    strDate=df.format(date); | 
				
			||||
                    map.put("deviceAddr",deviceAddr); | 
				
			||||
                    map.put("projectName",projectName); | 
				
			||||
                    map.put("curDate",strDate); | 
				
			||||
                    map.put("curValue","0"); | 
				
			||||
                    for (DataResultChEntity dataResult: records) { | 
				
			||||
                        strDate2=df.format(dataResult.getCurDate()); | 
				
			||||
                        if (strDate2.equals(strDate)){ | 
				
			||||
//                            map.put("curDate",curDate);
 | 
				
			||||
                            map.put("curValue",dataResult.getCurValue()); | 
				
			||||
                        } | 
				
			||||
                    } | 
				
			||||
                    listMap.add(map); | 
				
			||||
                } | 
				
			||||
                return HttpResult.ok(180,listMap); | 
				
			||||
            }else{ //1分钟
 | 
				
			||||
                startDate= ExchangeStringUtil.dateTime(1,curDate); | 
				
			||||
                List<DataResultChEntity> records=dataResultService.queryDataResultSec(projectID,startDate,curDate); | 
				
			||||
                String deviceAddr=records.get(0).getDeviceAddr(); | 
				
			||||
                String projectName=records.get(0).getProjectName(); | 
				
			||||
                //Date date=df.parse(startDate);
 | 
				
			||||
                Date date=df.parse(curDate); | 
				
			||||
                List<Map<String,Object>> listMap=new ArrayList<Map<String,Object>>(); | 
				
			||||
                for (int i=0;i<60;i++){ | 
				
			||||
                    Map<String,Object>map=new HashMap<String,Object>(); | 
				
			||||
                    //date.setTime(date.getTime()+1000);
 | 
				
			||||
                    date.setTime(date.getTime()-1000); | 
				
			||||
                    strDate=df.format(date); | 
				
			||||
                    map.put("deviceAddr",deviceAddr); | 
				
			||||
                    map.put("projectName",projectName); | 
				
			||||
                    map.put("curDate",strDate); | 
				
			||||
                    map.put("curValue","0"); | 
				
			||||
                    for (DataResultChEntity dataResult: records) { | 
				
			||||
                        strDate2=df.format(dataResult.getCurDate()); | 
				
			||||
                        if (strDate2.equals(strDate)){ | 
				
			||||
//                            map.put("curDate",strDate);
 | 
				
			||||
                            map.put("curValue",dataResult.getCurValue()); | 
				
			||||
                        } | 
				
			||||
                    } | 
				
			||||
                    listMap.add(map); | 
				
			||||
                } | 
				
			||||
                return HttpResult.ok(listMap); | 
				
			||||
            } | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="中央空调",optDesc = "查询冷水机参数实时值") | 
				
			||||
    @PostMapping(value="/dataNow") | 
				
			||||
    public HttpResult selectDataResultNow(@RequestParam(value= "deviceAddr", required=false)String deviceAddr, | 
				
			||||
                                          @RequestParam(value= "deviceType", required=false)String deviceType, | 
				
			||||
                                          @RequestParam(value= "projectID", required=false)String projectID) { | 
				
			||||
 | 
				
			||||
        List<DataResultChEntity> dataNow=dataResultService.selectDataResultNow(deviceAddr, deviceType, projectID); | 
				
			||||
        return HttpResult.ok("success",dataNow); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="中央空调",optDesc = "查询冷水机参数值") | 
				
			||||
    @PostMapping(value="/dataChiller") | 
				
			||||
    public HttpResult queryDataResultChiller(@RequestParam("projectID")String projectID, | 
				
			||||
                                             @RequestParam("deviceAddr")String deviceAddr, | 
				
			||||
                                             @RequestParam("registerName")String registerName, | 
				
			||||
                                             @RequestParam(value= "startDate", required=false)String startDate, | 
				
			||||
                                             @RequestParam(value="curDate", required=false)String curDate, | 
				
			||||
                                             @RequestParam("page")int page, | 
				
			||||
                                             @RequestParam("limit")int limit) { | 
				
			||||
 | 
				
			||||
        int count=dataResultService.dataResultChillerCount(projectID,deviceAddr, registerName, startDate, curDate); | 
				
			||||
        List<DataResultChEntity> dataChiller=dataResultService.queryDataResultChiller(projectID,deviceAddr,registerName,startDate,curDate,page,limit); | 
				
			||||
        return HttpResult.ok(count,dataChiller); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,57 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.DeviceInfoEntity; | 
				
			||||
import com.mh.user.model.ChillerModel; | 
				
			||||
import com.mh.user.model.DeviceModel; | 
				
			||||
import com.mh.user.service.DeviceInfoService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("deviceInfo") | 
				
			||||
public class DeviceInfoController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    DeviceInfoService deviceInfoService; | 
				
			||||
 | 
				
			||||
    @SysLogger(value="设备信息",optDesc = "查询设备信息") | 
				
			||||
    @PostMapping("/query") | 
				
			||||
    public HttpResult queryMeterInfo(@RequestParam(value = "systemID") String systemID, | 
				
			||||
                                     @RequestParam(value = "projectID") String projectID, | 
				
			||||
                                     @RequestParam(value = "deviceType") String deviceType){ | 
				
			||||
 | 
				
			||||
        List<DeviceInfoEntity> list=deviceInfoService.queryDeviceInfo(systemID,projectID,deviceType); | 
				
			||||
        return HttpResult.ok(list); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="设备信息",optDesc = "查询冷水机列表") | 
				
			||||
    @PostMapping("/list") | 
				
			||||
    public HttpResult selectDevices(@RequestParam(value = "systemID") String systemID, | 
				
			||||
                                     @RequestParam(value = "projectID") String projectID){ | 
				
			||||
        List<DeviceModel> list=deviceInfoService.selectDevices(projectID); | 
				
			||||
        return HttpResult.ok(list); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="设备信息",optDesc = "查询多个冷水机相关信息") | 
				
			||||
    @PostMapping("/chillers") | 
				
			||||
    public HttpResult queryChiller(@RequestParam(value = "projectID") String projectID, | 
				
			||||
                                   @RequestParam(value = "deviceAddr") String deviceAddr){ | 
				
			||||
        List<ChillerModel> list=deviceInfoService.queryChiller(projectID,deviceAddr); | 
				
			||||
        return HttpResult.ok(list); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="设备信息",optDesc = "查询单个冷水机相关信息") | 
				
			||||
    @PostMapping("/chiller") | 
				
			||||
    public HttpResult selectChiller(@RequestParam(value = "projectID") String projectID, | 
				
			||||
                                    @RequestParam(value = "deviceAddr") String deviceAddr){ | 
				
			||||
        ChillerModel chillerModel=deviceInfoService.selectChiller(projectID,deviceAddr); | 
				
			||||
        return HttpResult.ok(chillerModel); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,299 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.alibaba.fastjson.JSONObject; | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.dto.DeviceMessageDTO; | 
				
			||||
import com.mh.user.entity.*; | 
				
			||||
import com.mh.user.manage.QuartzManager; | 
				
			||||
import com.mh.user.netty.NettyChillerControlClient; | 
				
			||||
import com.mh.user.service.chillers.DeviceDisplayService; | 
				
			||||
import com.mh.user.constants.Constant; | 
				
			||||
import com.mh.user.service.chillers.DeviceManageService; | 
				
			||||
import com.mh.user.service.chillers.DeviceParamService; | 
				
			||||
import com.mh.user.service.chillers.GatewayManageService; | 
				
			||||
import com.mh.user.utils.GetReadOrder485; | 
				
			||||
import com.mh.user.utils.QuerySendThread; | 
				
			||||
import com.mh.user.constants.SocketMessage; | 
				
			||||
import com.mh.user.utils.TimeDifferenceUtil; | 
				
			||||
import org.quartz.SchedulerException; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import javax.annotation.Resource; | 
				
			||||
import java.text.ParseException; | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.List; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 设备管理接口 | 
				
			||||
 * @updateTime 2020-05-29 | 
				
			||||
 * @updateTime 2020-07-17 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
public class DeviceManageController { | 
				
			||||
 | 
				
			||||
    private final DeviceDisplayService deviceDisplayService; | 
				
			||||
    private final GatewayManageService gatewayManageService; | 
				
			||||
    private final DeviceManageService deviceManageService; | 
				
			||||
    private final DeviceParamService deviceParamService; | 
				
			||||
 | 
				
			||||
    public DeviceManageController(DeviceDisplayService deviceDisplayService, GatewayManageService gatewayManageService, DeviceManageService deviceManageService, DeviceParamService deviceParamService) { | 
				
			||||
        this.deviceDisplayService = deviceDisplayService; | 
				
			||||
        this.gatewayManageService = gatewayManageService; | 
				
			||||
        this.deviceManageService = deviceManageService; | 
				
			||||
        this.deviceParamService = deviceParamService; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Resource | 
				
			||||
    QuartzManager quartzManager; | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private SocketMessage socketMessage; | 
				
			||||
 | 
				
			||||
    // 查询设备信息状态
 | 
				
			||||
    @GetMapping("/operation/getColdStation") | 
				
			||||
    public HttpResult getColdStation(@RequestParam(value = "deviceType", required = true) String deviceType) { | 
				
			||||
        List<DeviceMessageDTO> deviceMessageList = deviceDisplayService.queryDeviceStatus(deviceType); | 
				
			||||
        Map<String, Object> formValues = new HashMap<>(); | 
				
			||||
        formValues.put("formValues",deviceMessageList); | 
				
			||||
        return HttpResult.ok("success", formValues); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 对设备进行操作处理
 | 
				
			||||
    @PostMapping("/operation/operationDevice") | 
				
			||||
    public HttpResult operationDevice(@RequestBody List<OrderEntity> changeValues) { | 
				
			||||
      String result; | 
				
			||||
      try { | 
				
			||||
        List<OrderMessageEntity> orderMessageEntityList; | 
				
			||||
        // type值 0:修改频率, 1:修改开关状态, 2: 关闭冷却泵之前,查询最近关闭的冷却塔时间,3: 群控手自动切换类型,4: 修改温度, 5: 修改压力
 | 
				
			||||
//        // 添加网页发送指令状态 update by ljf on 2020-08-07
 | 
				
			||||
        Constant.CONTROL_WEB_FLAG = true; | 
				
			||||
        // 暂停采集
 | 
				
			||||
//        quartzManager.pauseJob("DDC","JobDDCGroup");
 | 
				
			||||
//        Thread.sleep(2000);
 | 
				
			||||
          // 修改成不用暂停采集处理
 | 
				
			||||
        GetReadOrder485 getReadOrder485 = new GetReadOrder485(); | 
				
			||||
        // 判断是否是去关闭冷却泵,如果是,需要检查最近冷却塔有没有关闭并且关闭时间大于8分钟
 | 
				
			||||
        // 判断changeValues大小
 | 
				
			||||
        int size = changeValues.size(); | 
				
			||||
        int type = changeValues.get(0).getType(); | 
				
			||||
        if (type == 3 && size == 1) { | 
				
			||||
            // 生成指令
 | 
				
			||||
            orderMessageEntityList = getReadOrder485.createOrder(changeValues); | 
				
			||||
            if (orderMessageEntityList.size() != 0) { | 
				
			||||
                // 开启发送指令
 | 
				
			||||
                NettyChillerControlClient nettyChillerControlClient = new NettyChillerControlClient(); | 
				
			||||
//            nettyChillerControlClient.connect(8081, "192.168.1.131", orderMessageEntityList);
 | 
				
			||||
                nettyChillerControlClient.connect(socketMessage.getPort(), socketMessage.getIP(), orderMessageEntityList); | 
				
			||||
                // 开启线程监测标志
 | 
				
			||||
                QuerySendThread querySendThread = new QuerySendThread(); | 
				
			||||
                querySendThread.start(); | 
				
			||||
                if (Constant.SEND_STATUS) { | 
				
			||||
                    result = "success"; | 
				
			||||
                } else { | 
				
			||||
                    result = "fail"; | 
				
			||||
                } | 
				
			||||
            } else { | 
				
			||||
                result = "fail"; | 
				
			||||
            } | 
				
			||||
        } else if (type == 2 && size == 1) { | 
				
			||||
            TimeDifferenceUtil timeDifferenceUtil = new TimeDifferenceUtil(); | 
				
			||||
            Boolean a = timeDifferenceUtil.timeDifference(socketMessage.getOverTime()); | 
				
			||||
            if (a) { | 
				
			||||
                // 生成指令
 | 
				
			||||
                orderMessageEntityList = getReadOrder485.createOrder(changeValues); | 
				
			||||
                if (orderMessageEntityList.size() != 0) { | 
				
			||||
                    // 开启发送指令
 | 
				
			||||
                    NettyChillerControlClient nettyChillerControlClient = new NettyChillerControlClient(); | 
				
			||||
//            nettyChillerControlClient.connect(8081, "192.168.1.131", orderMessageEntityList);
 | 
				
			||||
                    nettyChillerControlClient.connect(socketMessage.getPort(), socketMessage.getIP(), orderMessageEntityList); | 
				
			||||
                    // 开启线程监测标志
 | 
				
			||||
                    QuerySendThread querySendThread = new QuerySendThread(); | 
				
			||||
                    querySendThread.start(); | 
				
			||||
                    if (Constant.SEND_STATUS) { | 
				
			||||
                        result = "success"; | 
				
			||||
                    } else { | 
				
			||||
                        result = "fail"; | 
				
			||||
                    } | 
				
			||||
                } else { | 
				
			||||
                    result = "fail"; | 
				
			||||
                } | 
				
			||||
            } else { | 
				
			||||
                result = "冷却塔关机还没有超过8分钟"; | 
				
			||||
            } | 
				
			||||
        } else { | 
				
			||||
            // 生成指令
 | 
				
			||||
            orderMessageEntityList = getReadOrder485.createOrder(changeValues); | 
				
			||||
            if (orderMessageEntityList.size() != 0) { | 
				
			||||
                // 开启发送指令
 | 
				
			||||
                NettyChillerControlClient nettyChillerControlClient = new NettyChillerControlClient(); | 
				
			||||
//            nettyChillerControlClient.connect(8081, "192.168.1.131", orderMessageEntityList);
 | 
				
			||||
                nettyChillerControlClient.connect(socketMessage.getPort(), socketMessage.getIP(), orderMessageEntityList); | 
				
			||||
                // 开启线程监测标志
 | 
				
			||||
                QuerySendThread querySendThread = new QuerySendThread(); | 
				
			||||
                querySendThread.start(); | 
				
			||||
                if (Constant.SEND_STATUS) { | 
				
			||||
                    result = "success"; | 
				
			||||
                } else { | 
				
			||||
                    result = "fail"; | 
				
			||||
                } | 
				
			||||
            } else { | 
				
			||||
                result = "fail"; | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
        Constant.CONTROL_WEB_FLAG = false; | 
				
			||||
        // 不需要停止采集
 | 
				
			||||
//        Constant.WEB_FLAG = false;
 | 
				
			||||
//        // 延迟5秒处理,等待线程处理数据
 | 
				
			||||
        Thread.sleep(500); | 
				
			||||
//        // 重新开启定时采集
 | 
				
			||||
//        quartzManager.resumeAllJob();
 | 
				
			||||
//          quartzManager.resumeJob("DDC","JobDDCGroup");
 | 
				
			||||
      } catch (InterruptedException | ParseException e) { | 
				
			||||
        e.printStackTrace(); | 
				
			||||
        result = "fail"; | 
				
			||||
      } | 
				
			||||
      // 异常情况处理
 | 
				
			||||
        return HttpResult.ok(result); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 查询网关信息 | 
				
			||||
     * @param requestJson | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @PostMapping("/gateWay/getGateWayList") | 
				
			||||
    public HttpResult gateWayList(@RequestBody String requestJson){ | 
				
			||||
        JSONObject jsonObject =JSONObject.parseObject(requestJson); | 
				
			||||
        Integer operator = null; | 
				
			||||
        Integer grade = null; | 
				
			||||
        if(jsonObject.get("operator") != null){ | 
				
			||||
            if(jsonObject.get("operator").equals("中国移动")){ | 
				
			||||
                operator = 0; | 
				
			||||
            }else if(jsonObject.get("operator").equals("中国联通")){ | 
				
			||||
                operator = 1; | 
				
			||||
            }else if(jsonObject.get("operator").equals("中国电信")){ | 
				
			||||
                operator = 2; | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
        if(jsonObject.get("grade") != null){ | 
				
			||||
          if(jsonObject.get("grade").equals("正常")){ | 
				
			||||
              grade = 0; | 
				
			||||
          }else if(jsonObject.get("grade").equals("不在线")){ | 
				
			||||
              grade = 1; | 
				
			||||
          }else if(jsonObject.get("grade").equals("异常")){ | 
				
			||||
              grade = 2; | 
				
			||||
          } | 
				
			||||
        } | 
				
			||||
        List<GatewayManageEntity> gateWayList = gatewayManageService.queryByOther(grade,operator); | 
				
			||||
        JSONObject tableData = new JSONObject(); | 
				
			||||
        tableData.put("tableData",gateWayList); | 
				
			||||
        return HttpResult.ok(tableData); | 
				
			||||
//        System.out.println(requestJson);
 | 
				
			||||
//        return null;
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 新增或更新网关信息 | 
				
			||||
     * @param reqestJson | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @PostMapping("/gateWay/addOrUpdateGateWayInfo") | 
				
			||||
    public HttpResult addOrUpdateGateWayInfo(@RequestBody GatewayManageEntity reqestJson){ | 
				
			||||
        try { | 
				
			||||
            System.out.println(reqestJson.toString()); | 
				
			||||
            gatewayManageService.addOrUpdateGateWayInfo(reqestJson); | 
				
			||||
            return HttpResult.ok(); | 
				
			||||
        } catch (Exception e) { | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(e.getMessage()); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 删除网关/基表/基表参数信息 | 
				
			||||
     * @param requestJson | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @PostMapping("/device/deleteDeviceInfo") | 
				
			||||
    public HttpResult deleteDeviceInfo(@RequestBody String requestJson){ | 
				
			||||
        JSONObject jsonObject =JSONObject.parseObject(requestJson); | 
				
			||||
        System.out.println(jsonObject.get("deviceId")); | 
				
			||||
        try { | 
				
			||||
            deviceManageService.deleteDeviceInfo((Integer)jsonObject.get("deviceId"),jsonObject.get("deviceType").toString()); | 
				
			||||
            return HttpResult.ok(); | 
				
			||||
        } catch (Exception e) { | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(e.getMessage()); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 查询基表管理中的基表数据 | 
				
			||||
     * @param requestJson | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @PostMapping("/baseMeter/getBaseMeterList") | 
				
			||||
    public HttpResult getBaseMeterList(@RequestBody String requestJson){ | 
				
			||||
        JSONObject jsonObject =JSONObject.parseObject(requestJson); | 
				
			||||
        List<DeviceManageEntity> list = deviceManageService.getDeviceByOther(jsonObject.get("deviceNum").toString()); | 
				
			||||
        JSONObject tableData = new JSONObject(); | 
				
			||||
        tableData.put("tableData",list); | 
				
			||||
        return HttpResult.ok(tableData); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 增加或更新基表信息数据 | 
				
			||||
     * @param requestJson | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @PostMapping("/baseMeter/addOrUpdateBaseMeter") | 
				
			||||
    public HttpResult addOrUpdateBaseMeter(@RequestBody DeviceManageEntity requestJson){ | 
				
			||||
        try { | 
				
			||||
            deviceManageService.addOrUpdateBaseMeter(requestJson); | 
				
			||||
            return HttpResult.ok(); | 
				
			||||
        } catch (Exception e) { | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error("检查输入的设备码是否有误!"); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 查询基表参数管理中的基表参数数据 | 
				
			||||
     * @param requestJson | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @PostMapping("/baseMeterParam/getBaseMeterParamList") | 
				
			||||
    public HttpResult getBaseMeterParamList(@RequestBody String requestJson){ | 
				
			||||
        JSONObject jsonObject =JSONObject.parseObject(requestJson); | 
				
			||||
        System.out.println(jsonObject.get("baseMeterType")); | 
				
			||||
        String baseMeterType = (String) jsonObject.get("baseMeterType"); | 
				
			||||
        List<DeviceParameterEntity> list = deviceParamService.getBaseMeterParamList(baseMeterType); | 
				
			||||
        JSONObject tableData = new JSONObject(); | 
				
			||||
        tableData.put("tableData",list); | 
				
			||||
        return HttpResult.ok(tableData); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 添加或更新基表参数信息 | 
				
			||||
     * @param requestJson | 
				
			||||
     * @return | 
				
			||||
     */ | 
				
			||||
    @PostMapping("/baseMeterParam/addOrUpdateBaseMeterParam") | 
				
			||||
    public HttpResult addOrUpdateBaseMeterParam(@RequestBody DeviceParameterEntity requestJson){ | 
				
			||||
        try { | 
				
			||||
            deviceParamService.addOrUpdateBaseMeterParam(requestJson); | 
				
			||||
            return HttpResult.ok(); | 
				
			||||
        } catch (Exception e) { | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(e.getMessage()); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,109 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.EnergyEntity; | 
				
			||||
import com.mh.user.model.EnergyModel; | 
				
			||||
import com.mh.user.model.EnergyParam; | 
				
			||||
import com.mh.user.service.BuildingService; | 
				
			||||
import com.mh.user.service.EnergyService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import java.util.ArrayList; | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("energy") | 
				
			||||
public class EnergyController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    EnergyService energyService; | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    BuildingService buildingService; | 
				
			||||
 | 
				
			||||
    @PostMapping("/save") | 
				
			||||
    public HttpResult saveEnergy(@RequestBody EnergyEntity energyEntity, @RequestParam(value = "type") int type){ | 
				
			||||
       try{ | 
				
			||||
           energyService.saveEnergy(energyEntity,type); | 
				
			||||
           return  HttpResult.ok(); | 
				
			||||
       }catch (Exception e){ | 
				
			||||
           return  HttpResult.error("保存出错!"); | 
				
			||||
       } | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @PostMapping("/update") | 
				
			||||
    public HttpResult updateEnergy(@RequestBody EnergyEntity energyEntity, @RequestParam(value = "type") int type){ | 
				
			||||
        try{ | 
				
			||||
            energyService.updateEnergy(energyEntity,type); | 
				
			||||
            return  HttpResult.ok(); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            return  HttpResult.error("修改出错!"); | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @PostMapping("/delete") | 
				
			||||
    public HttpResult deleteEnergy(@RequestParam(value = "curDate") String curDate, | 
				
			||||
                                   @RequestParam(value = "buildingId") String buildingId, | 
				
			||||
                                   @RequestParam(value = "type") int type){ | 
				
			||||
        try{ | 
				
			||||
            energyService.deleteEnergy(curDate,buildingId,type); | 
				
			||||
            return  HttpResult.ok(); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            return  HttpResult.error("删除出错!"); | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SysLogger(value="中央热水",optDesc = "数据分析查询") | 
				
			||||
    @PostMapping("/query") | 
				
			||||
    public HttpResult queryEnergy(@RequestBody EnergyParam energyParam){ | 
				
			||||
        try{ | 
				
			||||
            List<EnergyEntity> list; | 
				
			||||
            list=energyService.queryEnergy(energyParam); | 
				
			||||
            int count=energyService.getEnergyCount(energyParam); | 
				
			||||
            return  HttpResult.ok(count,list); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return  HttpResult.error("查询出错!"); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //主界面水、电、单耗查询
 | 
				
			||||
    @SysLogger(value="中央热水",optDesc = "主界面水、电、单耗查询") | 
				
			||||
    @PostMapping("/queryGroup") | 
				
			||||
    public HttpResult queryEnergyGroup(@RequestParam(value = "curDate",required = true) String curDate, | 
				
			||||
                                       @RequestParam(value = "type",required = true,defaultValue = "1") int type){ | 
				
			||||
        try{ | 
				
			||||
            List<EnergyEntity> list; | 
				
			||||
            list=energyService.queryEnergyGroup(curDate,type); | 
				
			||||
            return  HttpResult.ok(list); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return  HttpResult.error("查询出错!"); | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //查询每天的用量
 | 
				
			||||
    @SysLogger(value="中央热水",optDesc = "查询每天的用量") | 
				
			||||
    @PostMapping("/queryDay") | 
				
			||||
    public HttpResult queryDayEnergy(@RequestParam(value = "buildingId",required = false) String buildingId, | 
				
			||||
                                     @RequestParam(value = "startDate",required = false) String startDate, | 
				
			||||
                                     @RequestParam(value = "endDate",required = false) String endDate, | 
				
			||||
                                     @RequestParam(value = "page") int page, | 
				
			||||
                                     @RequestParam(value = "limit") int limit){ | 
				
			||||
        try{ | 
				
			||||
            List<EnergyEntity> list; | 
				
			||||
            list=energyService.queryDayEnergy(buildingId,startDate,endDate,page,limit); | 
				
			||||
            int count=energyService.getDayEnergyCount(buildingId,startDate,endDate,page,limit); | 
				
			||||
            return  HttpResult.ok(count,list); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return  HttpResult.error("查询出错!"); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,41 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.DeviceInstallEntity; | 
				
			||||
import com.mh.user.entity.EnergyDataEntity; | 
				
			||||
import com.mh.user.entity.EnergyEntity; | 
				
			||||
import com.mh.user.model.EnergyModel; | 
				
			||||
import com.mh.user.service.EnergyDataService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
import java.util.ArrayList; | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("energyData") | 
				
			||||
public class EnergyDataController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    EnergyDataService energyDataService; | 
				
			||||
 | 
				
			||||
    @SysLogger(value="中央空调",optDesc = "按小时、天、月、年查询用量") | 
				
			||||
    @PostMapping("/query") | 
				
			||||
    public HttpResult queryEnergyData(@RequestBody EnergyModel energyModel){ | 
				
			||||
        try{ | 
				
			||||
            String projectID=energyModel.getProjectID(); | 
				
			||||
            if(projectID!=null && projectID.length()>0){ | 
				
			||||
                List<EnergyDataEntity> list=energyDataService.queryEnergyData(energyModel); | 
				
			||||
                int count=energyDataService.getEnergyDataCount(energyModel); | 
				
			||||
                return  HttpResult.ok(count,list); | 
				
			||||
            }else{ | 
				
			||||
                return  HttpResult.error(); | 
				
			||||
            } | 
				
			||||
        }catch (Exception e){ | 
				
			||||
//            e.printStackTrace();
 | 
				
			||||
            return  HttpResult.error("查询出错!"); | 
				
			||||
        } | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,30 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.MeterInfoEntity; | 
				
			||||
import com.mh.user.service.MeterInfoService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("meterInfo") | 
				
			||||
public class MeterInfoController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    MeterInfoService meterInfoService; | 
				
			||||
 | 
				
			||||
    @SysLogger(value="基表信息",optDesc = "查询基表信息") | 
				
			||||
    @PostMapping("/query") | 
				
			||||
    public HttpResult queryMeterInfo(@RequestParam(value = "systemID",required = false) String systemID, | 
				
			||||
                                     @RequestParam(value = "projectID",required = false) String projectID){ | 
				
			||||
 | 
				
			||||
        List<MeterInfoEntity> list=meterInfoService.queryMeterInfo(systemID,projectID); | 
				
			||||
        return HttpResult.ok(list); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,29 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.ProjectInfoEntity; | 
				
			||||
import com.mh.user.service.ProjectInfoService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("pro") | 
				
			||||
public class ProjectInfoController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    ProjectInfoService projectInfoService; | 
				
			||||
 | 
				
			||||
    @SysLogger(value="项目信息",optDesc = "查询项目信息") | 
				
			||||
    @PostMapping("/queryPro") | 
				
			||||
    public HttpResult queryProject(@RequestParam(value = "systemID")String systemID) { | 
				
			||||
        List<ProjectInfoEntity> list=projectInfoService.queryProjectInfo(systemID); | 
				
			||||
 | 
				
			||||
        return HttpResult.ok(list); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,51 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.config.RabbitmqConfig; | 
				
			||||
import lombok.extern.slf4j.Slf4j; | 
				
			||||
import org.springframework.amqp.rabbit.core.RabbitTemplate; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("send") | 
				
			||||
@Slf4j | 
				
			||||
public class SendTest { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    RabbitTemplate rabbitTemplate; | 
				
			||||
 | 
				
			||||
    @PostMapping(value="/test") | 
				
			||||
    public HttpResult sendMsgByTopics(){ | 
				
			||||
        /** | 
				
			||||
         * 参数: | 
				
			||||
         * 1、交换机名称 | 
				
			||||
         * 2、routingKey | 
				
			||||
         * 3、消息内容 | 
				
			||||
         */ | 
				
			||||
        for (int i=0;i<5;i++){ | 
				
			||||
            String message = "恭喜您,注册成功!userId="+i; | 
				
			||||
            rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_NAME,"topic.#.zjjd.#",message); | 
				
			||||
            log.info("SendMsg:" + message); | 
				
			||||
        } | 
				
			||||
        return HttpResult.ok(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @PostMapping(value="/op") | 
				
			||||
    public HttpResult operate(@RequestParam("opMsg") String opMsg){ | 
				
			||||
        rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_NAME,"topic.zjjd",opMsg); | 
				
			||||
        log.info("SendMsg:" + opMsg +" 到交换机"+RabbitmqConfig.EXCHANGE_NAME); | 
				
			||||
        return HttpResult.ok(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    @PostMapping(value="/opt") | 
				
			||||
    public HttpResult test(@RequestParam("opMsg") String opMsg){ | 
				
			||||
        rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_NAME,"topic.zjjd",opMsg); | 
				
			||||
        log.info("SendMsg:" + opMsg +" 到交换机"+RabbitmqConfig.EXCHANGE_NAME); | 
				
			||||
        return HttpResult.ok(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,195 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.constants.Constant; | 
				
			||||
import com.mh.user.entity.ControlSetEntity; | 
				
			||||
import com.mh.user.entity.DeviceCodeParamEntity; | 
				
			||||
import com.mh.user.entity.DeviceInstallEntity; | 
				
			||||
import com.mh.user.model.SerialPortModel; | 
				
			||||
import com.mh.user.serialport.SerialPortSingle; | 
				
			||||
import com.mh.user.service.ControlSetService; | 
				
			||||
import com.mh.user.service.DeviceInstallService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("serial") | 
				
			||||
public class SerialPortController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    DeviceInstallService deviceInstallService; | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    ControlSetService controlSetService; | 
				
			||||
 | 
				
			||||
    //操作设备
 | 
				
			||||
    @PostMapping(value="/operate") | 
				
			||||
    public HttpResult operateDevice(@RequestBody List<SerialPortModel> params){ | 
				
			||||
        try{ | 
				
			||||
            SerialPortSingle serialPortSingle = new SerialPortSingle(); //发送接收类
 | 
				
			||||
            DeviceCodeParamEntity deviceCodeParam=new DeviceCodeParamEntity();//参数实体类
 | 
				
			||||
 | 
				
			||||
            Constant.WEB_FLAG=true; //单抄,暂时停止采集
 | 
				
			||||
            for (SerialPortModel serialPortModel : | 
				
			||||
                    params) { | 
				
			||||
                String deviceAddr=serialPortModel.getDeviceAddr();//设备通讯地址
 | 
				
			||||
                String deviceType=serialPortModel.getDeviceType();//设备类型
 | 
				
			||||
                String buildingId=serialPortModel.getBuildingId();//楼栋
 | 
				
			||||
                String param=serialPortModel.getParam();//操作参数
 | 
				
			||||
                DeviceInstallEntity deviceInstallEntity=deviceInstallService.selectDevice(deviceAddr,deviceType,buildingId); | 
				
			||||
                //发送指令实体类
 | 
				
			||||
                deviceCodeParam.setDeviceAddr(deviceAddr); | 
				
			||||
                deviceCodeParam.setDeviceType(deviceType); | 
				
			||||
                deviceCodeParam.setDataPort(deviceInstallEntity.getDataPort()); | 
				
			||||
                deviceCodeParam.setBaudRate(deviceInstallEntity.getBaudRate()); | 
				
			||||
                deviceCodeParam.setParity(deviceInstallEntity.getParity()); | 
				
			||||
                deviceCodeParam.setDataValue(serialPortModel.getDataValue());//传入相关参数值
 | 
				
			||||
                deviceCodeParam.setProjectID(buildingId); | 
				
			||||
                String brand=deviceInstallEntity.getBrand();//品牌
 | 
				
			||||
                deviceCodeParam.setBrand(brand); | 
				
			||||
                ControlSetEntity controlData=new ControlSetEntity(); | 
				
			||||
 | 
				
			||||
                //设置设备实体对象
 | 
				
			||||
                controlData.setBuildingId(deviceInstallEntity.getProjectID()); | 
				
			||||
 | 
				
			||||
                if (deviceType==null || deviceType.equals("") || deviceType.equals("热泵")){ | 
				
			||||
                    if (param==null || param.equals("") || param.equals("温度设定")){ | 
				
			||||
                        //发送指令
 | 
				
			||||
                        deviceCodeParam.setRegisterAddr("0642"); //寄存器地址
 | 
				
			||||
                        deviceCodeParam.setFunCode("10");        //功能码写数据
 | 
				
			||||
 | 
				
			||||
                    }else if(param.equals("时段1")){ | 
				
			||||
                        //发送指令
 | 
				
			||||
                        deviceCodeParam.setRegisterAddr("0656");    //寄存器地址
 | 
				
			||||
                        deviceCodeParam.setFunCode("10");           //功能码写数据
 | 
				
			||||
                        //保存数据
 | 
				
			||||
                        String time=serialPortModel.getDataValue(); | 
				
			||||
                        if (time.length()==8){ | 
				
			||||
                            String statTime=time.substring(0,2)+":"+time.substring(2,4); | 
				
			||||
                            String closeTime=time.substring(4,6)+":"+time.substring(6,8); | 
				
			||||
                        } | 
				
			||||
 | 
				
			||||
                    }else if(param.equals("时段2")){ | 
				
			||||
                        //发送指令
 | 
				
			||||
                        deviceCodeParam.setRegisterAddr("065A");    //寄存器地址
 | 
				
			||||
                        deviceCodeParam.setFunCode("10");           //功能码写数据
 | 
				
			||||
                        //保存数据
 | 
				
			||||
                        String time=serialPortModel.getDataValue(); | 
				
			||||
                        if (time.length()==8){ | 
				
			||||
                            String statTime=time.substring(0,2)+":"+time.substring(2,4); | 
				
			||||
                            String closeTime=time.substring(4,6)+":"+time.substring(6,8); | 
				
			||||
                        } | 
				
			||||
 | 
				
			||||
                    } | 
				
			||||
                }else if (deviceType.equals("时控")){ | 
				
			||||
                    deviceCodeParam.setRegisterAddr("0011"); //寄存器地址,L3路,L1(0009),L2(000D)
 | 
				
			||||
                    deviceCodeParam.setFunCode("10");        //功能码写数据
 | 
				
			||||
                    String time=serialPortModel.getDataValue(); | 
				
			||||
                    if (time.length()==16){ | 
				
			||||
                        //时段1
 | 
				
			||||
                        String statTime1=time.substring(0,2)+":"+time.substring(2,4); | 
				
			||||
                        String closeTime1=time.substring(4,6)+":"+time.substring(6,8); | 
				
			||||
                        //时段2
 | 
				
			||||
                        String statTime2=time.substring(8,10)+":"+time.substring(10,12); | 
				
			||||
                        String closeTime2=time.substring(12,14)+":"+time.substring(14,16); | 
				
			||||
                        controlData.setUseStartTime1(statTime1); | 
				
			||||
                        controlData.setUseCloseTime1(closeTime1); | 
				
			||||
                        controlData.setUseStartTime2(statTime2); | 
				
			||||
                        controlData.setUseCloseTime2(closeTime2); | 
				
			||||
                    } | 
				
			||||
 | 
				
			||||
                    controlSetService.saveControlSet(controlData); //保存设置内容
 | 
				
			||||
                }else if (deviceType.equals("水位开关")){ | 
				
			||||
                    if (brand==null || brand.equals("") || brand.equals("中凯")){//品牌
 | 
				
			||||
                        deviceCodeParam.setFunCode("12");        //功能码写数据
 | 
				
			||||
 | 
				
			||||
                    }else if(brand.equals("远向")){ | 
				
			||||
                        deviceCodeParam.setFunCode("06");        //功能码写数据
 | 
				
			||||
                    }else if(brand.equals("顶威")){ | 
				
			||||
                        deviceCodeParam.setFunCode("0407");      //功能码写数据
 | 
				
			||||
                    } | 
				
			||||
 | 
				
			||||
                    deviceCodeParam.setDataValue(serialPortModel.getDataValue()); | 
				
			||||
 | 
				
			||||
                    controlData.setLevelSet(serialPortModel.getDataValue()); | 
				
			||||
                    controlSetService.saveControlSet(controlData); | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                serialPortSingle.serialPortSend(deviceCodeParam);//生成并发送指令
 | 
				
			||||
            } | 
				
			||||
            return HttpResult.ok(); | 
				
			||||
        }catch(Exception e){ | 
				
			||||
          e.printStackTrace(); | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    //读数据
 | 
				
			||||
    @PostMapping(value="/read") | 
				
			||||
    public HttpResult readData(@RequestBody List<SerialPortModel> params){ | 
				
			||||
        try{ | 
				
			||||
            SerialPortSingle serialPortSingle = new SerialPortSingle(); | 
				
			||||
            DeviceCodeParamEntity deviceCodeParam=new DeviceCodeParamEntity(); | 
				
			||||
 | 
				
			||||
            for (SerialPortModel serialPortModel : | 
				
			||||
                    params) { | 
				
			||||
                String deviceAddr=serialPortModel.getDeviceAddr(); | 
				
			||||
                String deviceType=serialPortModel.getDeviceType(); | 
				
			||||
                String buildingId=serialPortModel.getBuildingId(); | 
				
			||||
                String param=serialPortModel.getParam(); | 
				
			||||
                DeviceInstallEntity deviceInstallEntity=deviceInstallService.selectDevice(deviceAddr,deviceType,buildingId); | 
				
			||||
 | 
				
			||||
                deviceCodeParam.setDeviceAddr(deviceAddr); | 
				
			||||
                deviceCodeParam.setDeviceType(deviceType); | 
				
			||||
                deviceCodeParam.setDataPort(deviceInstallEntity.getDataPort()); | 
				
			||||
                deviceCodeParam.setBaudRate(deviceInstallEntity.getBaudRate()); | 
				
			||||
                deviceCodeParam.setBrand(deviceInstallEntity.getBrand()); | 
				
			||||
 | 
				
			||||
                if (deviceType.equals("热泵")){ | 
				
			||||
                    if (param.equals("温度设定")){ | 
				
			||||
                        deviceCodeParam.setRegisterAddr("0641"); | 
				
			||||
                        deviceCodeParam.setFunCode("03"); | 
				
			||||
                    } | 
				
			||||
 | 
				
			||||
                }else if (deviceType.equals("时控")){ | 
				
			||||
 | 
				
			||||
                }else if (deviceType.equals("水位开关")){ | 
				
			||||
 | 
				
			||||
                }else if (deviceType.equals("状态检测")){ | 
				
			||||
 | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                Constant.WEB_FLAG=true; //单抄,暂时停止采集
 | 
				
			||||
                serialPortSingle.serialPortSend(deviceCodeParam); | 
				
			||||
            } | 
				
			||||
            return HttpResult.ok(); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @PostMapping(value="/pump") | 
				
			||||
    public HttpResult queryPumpSet(@RequestParam(value = "pumpId") String pumpId, | 
				
			||||
                                  @RequestParam(value = "buildingId") String buildingId){ | 
				
			||||
        try{ | 
				
			||||
 | 
				
			||||
            return HttpResult.ok(); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @PostMapping(value="/control") | 
				
			||||
    public HttpResult queryControlSet(@RequestParam(value = "buildingId") String buildingId){ | 
				
			||||
        try{ | 
				
			||||
            ControlSetEntity list=controlSetService.queryControlSet(buildingId); | 
				
			||||
            return HttpResult.ok(list); | 
				
			||||
        }catch (Exception e){ | 
				
			||||
            e.printStackTrace(); | 
				
			||||
            return HttpResult.error(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,28 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.StrategyInfoEntity; | 
				
			||||
import com.mh.user.service.StrategyInfoService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("strategy") | 
				
			||||
public class StrategyInfoController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    StrategyInfoService strategyInfoService; | 
				
			||||
 | 
				
			||||
    @SysLogger(value="节能策略查询") | 
				
			||||
    @RequestMapping("query") | 
				
			||||
    public HttpResult queryStrategyInfo(@RequestParam(value = "systemID",required = false) String systemID, | 
				
			||||
                                        @RequestParam(value = "projectID",required = false) String projectID){ | 
				
			||||
         List<StrategyInfoEntity> list=strategyInfoService.queryStrategyInfo(systemID,projectID); | 
				
			||||
         return HttpResult.ok(list); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,46 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.model.SysDept; | 
				
			||||
import com.mh.user.service.SysDeptService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 机构控制器 | 
				
			||||
 * @author ljf | 
				
			||||
 * @date 2020-04-25 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("dept") | 
				
			||||
public class SysDeptController { | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysDeptService sysDeptService; | 
				
			||||
	 | 
				
			||||
	@PreAuthorize("hasAuthority('sys:dept:add') AND hasAuthority('sys:dept:edit')") | 
				
			||||
	@PostMapping(value="/save") | 
				
			||||
	public HttpResult save(@RequestBody SysDept record) { | 
				
			||||
		return HttpResult.ok(sysDeptService.save(record)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PreAuthorize("hasAuthority('sys:dept:delete')") | 
				
			||||
	@PostMapping(value="/delete") | 
				
			||||
	public HttpResult delete(@RequestBody List<SysDept> records) { | 
				
			||||
		return HttpResult.ok(sysDeptService.delete(records)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PreAuthorize("hasAuthority('sys:dept:view')") | 
				
			||||
	@GetMapping(value="/findTree") | 
				
			||||
	public HttpResult findTree() { | 
				
			||||
		return HttpResult.ok(sysDeptService.findTree()); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,60 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.common.page.PageRequest; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.model.SysLog; | 
				
			||||
import com.mh.user.service.SysLogService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import java.util.ArrayList; | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 日志控制器 | 
				
			||||
 * @author ljf | 
				
			||||
 * @date 2020-04-25 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("log") | 
				
			||||
public class SysLogController { | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysLogService sysLogService; | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/findPage") | 
				
			||||
	public HttpResult findPage(@RequestBody PageRequest pageRequest) { | 
				
			||||
		return HttpResult.ok(sysLogService.findPage(pageRequest)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@SysLogger(value="日志",optDesc = "查询每个操作员的日志记录") | 
				
			||||
    @PostMapping(value="/findLogs") | 
				
			||||
    public HttpResult findLogs(@RequestParam(value = "userName", required = false)String userName, | 
				
			||||
							   @RequestParam int page, | 
				
			||||
							   @RequestParam int limit) { | 
				
			||||
        try{ | 
				
			||||
			List<SysLog> list=sysLogService.findLogs(userName,page,limit); | 
				
			||||
			int count=sysLogService.findCount(userName,page,limit); | 
				
			||||
 | 
				
			||||
			return HttpResult.ok(count,list); | 
				
			||||
		}catch (Exception e){ | 
				
			||||
        	e.printStackTrace(); | 
				
			||||
            return HttpResult.error(); | 
				
			||||
		} | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    // 查询日志详情
 | 
				
			||||
	@SysLogger(value="日志",optDesc = "查询日志详情") | 
				
			||||
	@PostMapping(value="/logInfo") | 
				
			||||
    public HttpResult logInfo(@RequestParam int id){ | 
				
			||||
		try{ | 
				
			||||
			SysLog sysLog=sysLogService.logInfo(id); | 
				
			||||
			return HttpResult.ok(sysLog); | 
				
			||||
		}catch (Exception e){ | 
				
			||||
			e.printStackTrace(); | 
				
			||||
			return HttpResult.error(); | 
				
			||||
		} | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,98 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import java.awt.image.BufferedImage; | 
				
			||||
import java.io.IOException; | 
				
			||||
 | 
				
			||||
import javax.imageio.ImageIO; | 
				
			||||
import javax.servlet.ServletException; | 
				
			||||
import javax.servlet.ServletOutputStream; | 
				
			||||
import javax.servlet.http.HttpServletRequest; | 
				
			||||
import javax.servlet.http.HttpServletResponse; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.common.utils.IOUtils; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.dynamic.datasource.DataSourceContextHolder; | 
				
			||||
import com.mh.user.dynamic.datasource.DataSourceObject; | 
				
			||||
import com.mh.user.entity.DBEntity; | 
				
			||||
import com.mh.user.model.SysRole; | 
				
			||||
import com.mh.user.model.SysUser; | 
				
			||||
import com.mh.user.security.JwtAuthenticatioToken; | 
				
			||||
import com.mh.user.service.SysRoleService; | 
				
			||||
import com.mh.user.service.SysUserService; | 
				
			||||
import com.mh.user.utils.AESUtil; | 
				
			||||
import com.mh.user.utils.PasswordUtils; | 
				
			||||
import com.mh.user.utils.SecurityUtils; | 
				
			||||
import com.mh.user.vo.LoginBean; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.authentication.AuthenticationManager; | 
				
			||||
import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import com.google.code.kaptcha.Constants; | 
				
			||||
import com.google.code.kaptcha.Producer; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 登录控制器 | 
				
			||||
 * @author ljf | 
				
			||||
 * @date 2023-04-25 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
public class SysLoginController { | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private Producer producer; | 
				
			||||
	@Autowired | 
				
			||||
	private SysUserService sysUserService; | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysRoleService sysRoleService; | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private AuthenticationManager authenticationManager; | 
				
			||||
 | 
				
			||||
	@GetMapping("captcha.jpg") | 
				
			||||
	public void captcha(HttpServletResponse response, HttpServletRequest request) throws ServletException, IOException { | 
				
			||||
		response.setHeader("Cache-Control", "no-store, no-cache"); | 
				
			||||
		response.setContentType("image/jpeg"); | 
				
			||||
		// 生成文字验证码
 | 
				
			||||
		String text = producer.createText(); | 
				
			||||
		// 生成图片验证码
 | 
				
			||||
		BufferedImage image = producer.createImage(text); | 
				
			||||
		// 保存到验证码到 session
 | 
				
			||||
		request.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY, text); | 
				
			||||
		ServletOutputStream out = response.getOutputStream(); | 
				
			||||
		ImageIO.write(image, "jpg", out); | 
				
			||||
		IOUtils.closeQuietly(out); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * 登录接口 | 
				
			||||
	 */ | 
				
			||||
	@SysLogger(value="用户登录") | 
				
			||||
	@PostMapping(value = "/login") | 
				
			||||
	public HttpResult login(@RequestBody LoginBean loginBean, HttpServletRequest request) throws Exception { | 
				
			||||
		String username = loginBean.getAccount(); | 
				
			||||
		String password = loginBean.getPassword(); | 
				
			||||
		String captcha = loginBean.getCaptcha(); | 
				
			||||
 | 
				
			||||
		// 用户信息
 | 
				
			||||
		SysUser user = sysUserService.findByName(username); | 
				
			||||
		// 账号不存在、密码错误
 | 
				
			||||
		if (user == null) { | 
				
			||||
			return HttpResult.error("账号不存在"); | 
				
			||||
		} | 
				
			||||
		if (!PasswordUtils.matches(user.getSalt(), password, user.getPassword())) { | 
				
			||||
			return HttpResult.error("密码不正确"); | 
				
			||||
		} | 
				
			||||
		// 账号锁定
 | 
				
			||||
		if (user.getStatus() == 0) { | 
				
			||||
			return HttpResult.error("账号已被锁定,请联系管理员"); | 
				
			||||
		} | 
				
			||||
		// 系统登录认证
 | 
				
			||||
		JwtAuthenticatioToken token = SecurityUtils.login(request, username, password, authenticationManager); | 
				
			||||
		return HttpResult.ok(token); | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,50 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.model.SysMenu; | 
				
			||||
import com.mh.user.service.SysMenuService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 菜单控制器 | 
				
			||||
 * @author ljf | 
				
			||||
 * @date 2020-04-25 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("menu") | 
				
			||||
public class SysMenuController { | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysMenuService sysMenuService; | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/save") | 
				
			||||
	public HttpResult save(@RequestBody SysMenu record) { | 
				
			||||
 | 
				
			||||
		return HttpResult.ok(sysMenuService.save(record)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/delete") | 
				
			||||
	public HttpResult delete(@RequestBody List<SysMenu> records) { | 
				
			||||
		return HttpResult.ok(sysMenuService.delete(records)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	//查询菜单树,用户ID和用户名为空则查询全部,获取菜单类型,0:获取所有菜单,包含按钮,1:获取所有菜单,不包含按钮
 | 
				
			||||
	@GetMapping(value="/findNavTree") | 
				
			||||
	public HttpResult findNavTree(@RequestParam String systemID,@RequestParam String userName) { | 
				
			||||
		return HttpResult.ok(sysMenuService.findTree(systemID,userName, 0)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@GetMapping(value="/findMenuTree") | 
				
			||||
	public HttpResult findMenuTree(@RequestParam String systemID) { | 
				
			||||
		return HttpResult.ok(sysMenuService.findTree(systemID,"", 0)); | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
@ -0,0 +1,132 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.common.page.PageRequest; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.constants.SysConstants; | 
				
			||||
import com.mh.user.mapper.SysRoleMapper; | 
				
			||||
import com.mh.user.model.SysRole; | 
				
			||||
import com.mh.user.model.SysRoleMenu; | 
				
			||||
import com.mh.user.service.SysRoleService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 角色控制器 | 
				
			||||
 * @author ljf | 
				
			||||
 * @date 2020-04-25 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("role") | 
				
			||||
public class SysRoleController { | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysRoleService sysRoleService; | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysRoleMapper sysRoleMapper; | 
				
			||||
 | 
				
			||||
	@SysLogger(value="角色管理",optDesc = "添加或者编辑角色") | 
				
			||||
	@PostMapping(value="/save") | 
				
			||||
	public HttpResult save(@RequestBody SysRole record) { | 
				
			||||
		SysRole role = sysRoleService.findById(record.getId()); | 
				
			||||
		if(role != null) { | 
				
			||||
			if(SysConstants.ADMIN.equalsIgnoreCase(role.getName())) { | 
				
			||||
				return HttpResult.error("超级管理员不允许修改!"); | 
				
			||||
			} | 
				
			||||
			List<SysRole> role1=sysRoleService.findByName(record.getName()); | 
				
			||||
			if (role1.size()>0){ | 
				
			||||
				if(role.getId()!=role1.get(0).getId()){ | 
				
			||||
					return HttpResult.error("角色名不能重复!"); | 
				
			||||
				} | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		// 新增角色
 | 
				
			||||
		if((record.getId() == null || record.getId() ==0) && !sysRoleService.findByName(record.getName()).isEmpty()) { | 
				
			||||
			return HttpResult.error("角色名已存在!"); | 
				
			||||
		} | 
				
			||||
		record.setCreateBy("admin"); | 
				
			||||
		Date date=new Date(); | 
				
			||||
		record.setCreateTime(date); | 
				
			||||
		record.setLastUpdateTime(date); | 
				
			||||
		return HttpResult.ok(sysRoleService.save(record)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	// 删除多个
 | 
				
			||||
	@PostMapping(value="/delete") | 
				
			||||
	public HttpResult delete(@RequestBody List<SysRole> records) { | 
				
			||||
 | 
				
			||||
		return HttpResult.ok(sysRoleService.delete(records)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	// 删除单个
 | 
				
			||||
	@SysLogger(value="角色管理",optDesc = "删除角色") | 
				
			||||
	@PostMapping(value="/deleteById") | 
				
			||||
	public HttpResult deleteById(@RequestBody SysRole record) { | 
				
			||||
 | 
				
			||||
		return HttpResult.ok(sysRoleService.delete(record)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/findPage") | 
				
			||||
	public HttpResult findPage(@RequestBody PageRequest pageRequest) { | 
				
			||||
		return HttpResult.ok(sysRoleService.findPage(pageRequest)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@GetMapping(value="/findAll") | 
				
			||||
	public HttpResult findAll() { | 
				
			||||
		return HttpResult.ok(sysRoleService.findAll()); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@GetMapping(value="/findRoleMenus") | 
				
			||||
	public HttpResult findRoleMenus(@RequestParam Long roleId) { | 
				
			||||
		return HttpResult.ok(sysRoleService.findRoleMenus(roleId)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@SysLogger(value="角色管理",optDesc = "编辑权限") | 
				
			||||
	@PostMapping(value="/saveRoleMenus") | 
				
			||||
	public HttpResult saveRoleMenus(@RequestBody List<SysRoleMenu> records) { | 
				
			||||
		for(SysRoleMenu record:records) { | 
				
			||||
			SysRole sysRole = sysRoleMapper.selectByPrimaryKey(record.getRoleId()); | 
				
			||||
			if(SysConstants.ADMIN.equalsIgnoreCase(sysRole.getName())) { | 
				
			||||
				// 如果是超级管理员,不允许修改
 | 
				
			||||
				return HttpResult.error("超级管理员拥有所有菜单权限,不允许修改!"); | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		return HttpResult.ok(sysRoleService.saveRoleMenus(records)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/findId") | 
				
			||||
	public HttpResult findByName(@RequestParam String name) { | 
				
			||||
		return HttpResult.ok(sysRoleService.findByName(name)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/queryRoles") | 
				
			||||
	public HttpResult queryRoles(@RequestParam(value = "roleName", required = false) String roleName, | 
				
			||||
			                     @RequestParam int page, | 
				
			||||
								 @RequestParam int limit) { | 
				
			||||
		try{ | 
				
			||||
			List<SysRole> list=sysRoleService.queryRoles(roleName,page,limit); | 
				
			||||
			int count=sysRoleService.getCount(roleName,page,limit); | 
				
			||||
			return HttpResult.ok(count,list); | 
				
			||||
		}catch (Exception e){ | 
				
			||||
			return HttpResult.error(); | 
				
			||||
		} | 
				
			||||
 | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/roleID") | 
				
			||||
	public HttpResult findRoleID(@RequestParam String name) { | 
				
			||||
		String roleID=sysRoleService.findRoleID(name); | 
				
			||||
		return HttpResult.ok(roleID); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,140 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.common.page.PageRequest; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.constants.SysConstants; | 
				
			||||
import com.mh.user.mapper.SysUserRoleMapper; | 
				
			||||
import com.mh.user.model.SysRole; | 
				
			||||
import com.mh.user.model.SysUser; | 
				
			||||
import com.mh.user.model.SysUserRole; | 
				
			||||
import com.mh.user.service.SysRoleService; | 
				
			||||
import com.mh.user.service.SysUserService; | 
				
			||||
import com.mh.user.utils.PasswordUtils; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * 用户控制器 | 
				
			||||
 * @author ljf | 
				
			||||
 * @date 2020-04-25 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("user") | 
				
			||||
public class SysUserController { | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysUserService sysUserService; | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysRoleService sysRoleService; | 
				
			||||
 | 
				
			||||
	@Autowired | 
				
			||||
	private SysUserRoleMapper sysUserRoleMapper; | 
				
			||||
 | 
				
			||||
	@SysLogger(value="用户管理",optDesc = "添加或者编辑用户") | 
				
			||||
	@PostMapping(value="/save") | 
				
			||||
	public HttpResult save(@RequestBody SysUser record) { | 
				
			||||
		SysUser user = sysUserService.findById(record.getId()); | 
				
			||||
		if(user != null) { | 
				
			||||
			if(SysConstants.ADMIN.equalsIgnoreCase(user.getUserName())) { | 
				
			||||
				return HttpResult.error("超级管理员不允许修改!"); | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		if(record.getPassword() != null) { | 
				
			||||
 | 
				
			||||
			String salt = PasswordUtils.getSalt(); | 
				
			||||
			if(user == null) { | 
				
			||||
				// 新增用户
 | 
				
			||||
				if(sysUserService.findByName(record.getUserName()) != null) { | 
				
			||||
					return HttpResult.error("用户名已存在!"); | 
				
			||||
				} | 
				
			||||
				String password = PasswordUtils.encode(record.getPassword(), salt); | 
				
			||||
				record.setSalt(salt); | 
				
			||||
				record.setPassword(password); | 
				
			||||
				record.setStatus(Byte.parseByte("1")); | 
				
			||||
			} else { | 
				
			||||
				SysUser user1=sysUserService.findByName(record.getUserName()); | 
				
			||||
				if(user1!=null && user1.getId()!=record.getId()){ | 
				
			||||
					return HttpResult.error("修改的用户名不能与存在的用户名相同!"); | 
				
			||||
				} | 
				
			||||
				// 修改用户, 且修改了密码
 | 
				
			||||
				if(!record.getPassword().equals(user.getPassword())) { | 
				
			||||
					String password = PasswordUtils.encode(record.getPassword(), salt); | 
				
			||||
					record.setSalt(salt); | 
				
			||||
					record.setPassword(password); | 
				
			||||
				} | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
 | 
				
			||||
		return HttpResult.ok(sysUserService.save(record)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/delete") | 
				
			||||
	public HttpResult delete(@RequestBody List<SysUser> records) { | 
				
			||||
		for(SysUser record:records) { | 
				
			||||
			SysUser sysUser = sysUserService.findById(record.getId()); | 
				
			||||
			if(sysUser != null && SysConstants.ADMIN.equalsIgnoreCase(sysUser.getUserName())) { | 
				
			||||
				return HttpResult.error("超级管理员不允许删除!"); | 
				
			||||
			} | 
				
			||||
		} | 
				
			||||
		return HttpResult.ok(sysUserService.delete(records)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
 | 
				
			||||
	@SysLogger(value="用户管理",optDesc = "删除用户") | 
				
			||||
	@PostMapping(value="/deleteById") | 
				
			||||
	public HttpResult deleteById(@RequestBody SysUser record) { | 
				
			||||
		SysUser sysUser = sysUserService.findById(record.getId()); | 
				
			||||
		if(sysUser != null && SysConstants.ADMIN.equalsIgnoreCase(sysUser.getUserName())) { | 
				
			||||
			return HttpResult.error("超级管理员不允许删除!"); | 
				
			||||
		}else{ | 
				
			||||
			return HttpResult.ok(sysUserService.delete(record)); | 
				
			||||
		} | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@GetMapping(value="/findByName") | 
				
			||||
	public HttpResult findByUserName(@RequestParam String name) { | 
				
			||||
 | 
				
			||||
		return HttpResult.ok(sysUserService.findByName(name)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
 | 
				
			||||
	@GetMapping(value="/findPermissions") | 
				
			||||
	public HttpResult findPermissions(@RequestParam String systemID,@RequestParam String name) { | 
				
			||||
		return HttpResult.ok(sysUserService.findPermissions(systemID,name)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@GetMapping(value="/findUserRoles") | 
				
			||||
	public HttpResult findUserRoles(@RequestParam Long userId) { | 
				
			||||
		return HttpResult.ok(sysUserService.findUserRoles(userId)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/findPage") | 
				
			||||
	public HttpResult findPage(@RequestBody PageRequest pageRequest) { | 
				
			||||
		return HttpResult.ok(sysUserService.findPage(pageRequest)); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	@PostMapping(value="/queryUsers") | 
				
			||||
	public HttpResult queryUsers(@RequestParam(value = "userName", required = false) String userName, | 
				
			||||
								 @RequestParam int page, | 
				
			||||
								 @RequestParam int limit) { | 
				
			||||
		try{ | 
				
			||||
			List<SysUser> list=sysUserService.queryUsers(userName,page,limit); | 
				
			||||
			int count=sysUserService.getCount(userName,page,limit); | 
				
			||||
			return HttpResult.ok(count,list); | 
				
			||||
		}catch (Exception e){ | 
				
			||||
			return HttpResult.error(); | 
				
			||||
		} | 
				
			||||
 | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,29 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.common.http.HttpResult; | 
				
			||||
import com.mh.user.annotation.SysLogger; | 
				
			||||
import com.mh.user.entity.SystemInfoEntity; | 
				
			||||
import com.mh.user.service.SystemInfoService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("sys") | 
				
			||||
public class SystemInfoController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    SystemInfoService systemInfoService; | 
				
			||||
 | 
				
			||||
    @SysLogger(value="系统查询") | 
				
			||||
    @PostMapping("/querySys") | 
				
			||||
    public HttpResult querySystem(@RequestParam(value = "roleID")String roleID) { | 
				
			||||
        List<SystemInfoEntity> list=systemInfoService.querySystem(roleID); | 
				
			||||
 | 
				
			||||
       return HttpResult.ok(list); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,102 @@
					 | 
				
			||||
package com.mh.user.controller; | 
				
			||||
 | 
				
			||||
import com.mh.user.constants.Constant; | 
				
			||||
import com.mh.user.dynamic.datasource.DataSourceContextHolder; | 
				
			||||
import com.mh.user.dynamic.datasource.DataSourceObject; | 
				
			||||
import com.mh.user.entity.DBEntity; | 
				
			||||
import com.mh.user.entity.DeviceCodeParamEntity; | 
				
			||||
import com.mh.user.manage.QuartzManager; | 
				
			||||
import com.mh.user.service.SysUserService; | 
				
			||||
import com.mh.user.utils.AESUtil; | 
				
			||||
import com.mh.user.utils.AnalysisReceiveOrder485; | 
				
			||||
import com.mh.user.utils.ExchangeStringUtil; | 
				
			||||
import com.mh.user.utils.GetReadOrder485; | 
				
			||||
import org.quartz.SchedulerException; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.authentication.AuthenticationManager; | 
				
			||||
import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RestController; | 
				
			||||
 | 
				
			||||
import javax.annotation.Resource; | 
				
			||||
import java.text.SimpleDateFormat; | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@RestController | 
				
			||||
public class TestController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private SysUserService sysUserService; | 
				
			||||
 | 
				
			||||
    @Resource | 
				
			||||
    QuartzManager quartzManager; | 
				
			||||
 | 
				
			||||
    @RequestMapping("/hello") | 
				
			||||
    public String HelloWord() throws SchedulerException, InterruptedException { | 
				
			||||
        // 停止JobTest
 | 
				
			||||
        quartzManager.pauseAllJob(); | 
				
			||||
        Constant.FLAG = true; | 
				
			||||
        Thread.sleep(2000); | 
				
			||||
        // 开始JobTest
 | 
				
			||||
//        quartzManager.resumeAllJob();
 | 
				
			||||
        Constant.FLAG = false; | 
				
			||||
        return "user hello word."; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @RequestMapping("/startHello") | 
				
			||||
    public String startHelloWord() throws SchedulerException, InterruptedException { | 
				
			||||
        // 停止JobTest
 | 
				
			||||
//        quartzManager.pauseAllJob();
 | 
				
			||||
//        Constant.FLAG = true;
 | 
				
			||||
//        Thread.sleep(2000);
 | 
				
			||||
        // 开始JobTest
 | 
				
			||||
        quartzManager.resumeAllJob(); | 
				
			||||
        Thread.sleep(2000); | 
				
			||||
        Constant.FLAG = false; | 
				
			||||
        return "user hello word."; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @GetMapping("/test") | 
				
			||||
    public void testQuery(){ | 
				
			||||
//        try{
 | 
				
			||||
//            DBEntity dbEntity = sysUserService.queryDBInfo("admin");
 | 
				
			||||
//            dbEntity.setDB_Pwd(AESUtil.AESdecrypt(dbEntity.getDB_Pwd()));
 | 
				
			||||
//            DataSourceObject dataSourceObject = new DataSourceObject();
 | 
				
			||||
//            String SourceName = "sqlServer-"+dbEntity.getDB_Names();
 | 
				
			||||
//            dataSourceObject.SwitchSQLServerDataSource(dbEntity,SourceName);
 | 
				
			||||
//            DataSourceContextHolder.setDBType(SourceName);
 | 
				
			||||
//        }catch (Exception e){
 | 
				
			||||
//           e.printStackTrace();
 | 
				
			||||
//        }
 | 
				
			||||
 | 
				
			||||
        AnalysisReceiveOrder485 analysis=new AnalysisReceiveOrder485(); | 
				
			||||
        GetReadOrder485 getReadOrder485=new GetReadOrder485(); | 
				
			||||
        DeviceCodeParamEntity deviceCodeParamEntity=new DeviceCodeParamEntity(); | 
				
			||||
        deviceCodeParamEntity.setDeviceAddr("90"); | 
				
			||||
        deviceCodeParamEntity.setDeviceType("冷量计"); | 
				
			||||
        deviceCodeParamEntity.setRegisterAddr("34"); | 
				
			||||
        deviceCodeParamEntity.setRegisterName("累积量"); | 
				
			||||
        deviceCodeParamEntity.setGrade(1); | 
				
			||||
        deviceCodeParamEntity.setProjectID("3"); | 
				
			||||
        analysis.analysisCloudOrder485("5A0304AEF600D911B6",deviceCodeParamEntity); | 
				
			||||
 | 
				
			||||
//        analysis.analysisWtMeterOrder485("FEFEFE6810398710810000008116901F00006502002C006502002C0000000000000000FF3416","","");
 | 
				
			||||
//        analysis.analysisPumpOrder485("0303020000C184","000B","","21");
 | 
				
			||||
//        analysis.analysisMeterOrder485("6810470010000068810643C3BA595C346716",deviceCodeParamEntity);
 | 
				
			||||
//        analysis.analysisRelayOrder485("220611000000013A220611000000023B220611000000033C220611000000043D220611000000053E220611000000063F22061100000007402206110000000841","0017","中凯");
 | 
				
			||||
//        analysis.analysisPressureOrder485("01030205157ADB","","澳升");
 | 
				
			||||
 | 
				
			||||
//        Date date2=new Date();
 | 
				
			||||
//        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
				
			||||
//        System.out.println("------时间--------"+sdf1.format(date2));
 | 
				
			||||
//        if (ExchangeStringUtil.isInDate(date2,"00:00:00","00:00:05")==true ||
 | 
				
			||||
//                ExchangeStringUtil.isInDate(date2,"00:00:20","00:00:25")==true ||
 | 
				
			||||
//                ExchangeStringUtil.isInDate(date2,"00:00:40","00:00:45")==true) {
 | 
				
			||||
//            System.out.println("------时间跳出--------"+sdf1.format(date2));
 | 
				
			||||
//
 | 
				
			||||
//        }
 | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,33 @@
					 | 
				
			||||
package com.mh.user.dto; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 设备信息状态 | 
				
			||||
 * @updateTime 2020-05-29 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class DeviceMessageDTO { | 
				
			||||
 | 
				
			||||
    private String label; | 
				
			||||
    private int spanLength; | 
				
			||||
    private boolean openState; | 
				
			||||
    private String deviceId; | 
				
			||||
    private int grade;          // 0:A区  1:B区
 | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return "DeviceMessageDTO{" + | 
				
			||||
                "label='" + label + '\'' + | 
				
			||||
                ", spanLength=" + spanLength + | 
				
			||||
                ", openState=" + openState + | 
				
			||||
                ", deviceId='" + deviceId + '\'' + | 
				
			||||
                ", grade=" + grade + | 
				
			||||
                '}'; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,35 @@
					 | 
				
			||||
package com.mh.user.dto; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 设备数据显示框 | 
				
			||||
 * @updateTime 2020-05-29 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class DisplayBoxDataDTO { | 
				
			||||
 | 
				
			||||
    private String title; | 
				
			||||
    private String secContent1; | 
				
			||||
    private String secContent2; | 
				
			||||
    private String firstDivClass; | 
				
			||||
    private String  deviceId; | 
				
			||||
    private int grade; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return "DisplayBoxDataDTO{" + | 
				
			||||
                "title='" + title + '\'' + | 
				
			||||
                ", secContent1='" + secContent1 + '\'' + | 
				
			||||
                ", secContent2='" + secContent2 + '\'' + | 
				
			||||
                ", firstDivClass='" + firstDivClass + '\'' + | 
				
			||||
                ", deviceId='" + deviceId + '\'' + | 
				
			||||
                ", grade=" + grade + | 
				
			||||
                '}'; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,21 @@
					 | 
				
			||||
package com.mh.user.dto; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : | 
				
			||||
 * @updateTime 2020-05-25 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class TableInfoDTO<T> { | 
				
			||||
 | 
				
			||||
    private List<T> tableInfo; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,77 @@
					 | 
				
			||||
package com.mh.user.dynamic.config; | 
				
			||||
 | 
				
			||||
import com.alibaba.druid.pool.DruidDataSource; | 
				
			||||
import com.mh.user.dynamic.datasource.DynamicDataSource; | 
				
			||||
import org.apache.ibatis.session.SqlSessionFactory; | 
				
			||||
import org.mybatis.spring.SqlSessionFactoryBean; | 
				
			||||
import org.mybatis.spring.SqlSessionTemplate; | 
				
			||||
import org.mybatis.spring.annotation.MapperScan; | 
				
			||||
import org.springframework.beans.factory.annotation.Qualifier; | 
				
			||||
import org.springframework.beans.factory.annotation.Value; | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | 
				
			||||
 | 
				
			||||
import javax.sql.DataSource; | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author chison | 
				
			||||
 * @date 2020-04-02 09:39 | 
				
			||||
 * @Description | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
@MapperScan("com.mh.*.mapper")	// 扫描DAO
 | 
				
			||||
public class DataSourceConfig { | 
				
			||||
 | 
				
			||||
    @Value("${spring.datasource.druid.url}") | 
				
			||||
    private String defaultDBUrl; | 
				
			||||
    @Value("${spring.datasource.druid.username}") | 
				
			||||
    private String defaultDBUser; | 
				
			||||
    @Value("${spring.datasource.druid.password}") | 
				
			||||
    private String defaultDBPassword; | 
				
			||||
    @Value("${spring.datasource.druid.driver-class-name}") | 
				
			||||
    private String defaultDBDreiverName; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
    @Bean | 
				
			||||
    public DynamicDataSource dynamicDataSource() { | 
				
			||||
        DynamicDataSource dynamicDataSource = DynamicDataSource.getInstance(); | 
				
			||||
 | 
				
			||||
        DruidDataSource defaultDataSource = new DruidDataSource(); | 
				
			||||
        defaultDataSource.setUrl(defaultDBUrl); | 
				
			||||
        defaultDataSource.setUsername(defaultDBUser); | 
				
			||||
        defaultDataSource.setPassword(defaultDBPassword); | 
				
			||||
        defaultDataSource.setDriverClassName(defaultDBDreiverName); | 
				
			||||
 | 
				
			||||
        Map<Object,Object> map = new HashMap<>(); | 
				
			||||
        map.put("default", defaultDataSource); | 
				
			||||
        dynamicDataSource.setTargetDataSources(map); | 
				
			||||
        dynamicDataSource.setDefaultTargetDataSource(defaultDataSource); | 
				
			||||
 | 
				
			||||
        return dynamicDataSource; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Bean | 
				
			||||
    public SqlSessionFactory sqlSessionFactory( | 
				
			||||
            @Qualifier("dynamicDataSource") DataSource dynamicDataSource) | 
				
			||||
            throws Exception { | 
				
			||||
        SqlSessionFactoryBean bean = new SqlSessionFactoryBean(); | 
				
			||||
        bean.setDataSource(dynamicDataSource); | 
				
			||||
        bean.setTypeAliasesPackage("com.mh.*.model");	// 扫描Model
 | 
				
			||||
 | 
				
			||||
        bean.setMapperLocations(new PathMatchingResourcePatternResolver() | 
				
			||||
                .getResources("classpath*:**/sqlmapper/*.xml")); | 
				
			||||
        return bean.getObject(); | 
				
			||||
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Bean(name = "sqlSessionTemplate") | 
				
			||||
    public SqlSessionTemplate sqlSessionTemplate( | 
				
			||||
            @Qualifier("sqlSessionFactory") SqlSessionFactory sqlSessionFactory) | 
				
			||||
            throws Exception { | 
				
			||||
        return new SqlSessionTemplate(sqlSessionFactory); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,28 @@
					 | 
				
			||||
package com.mh.user.dynamic.config; | 
				
			||||
 | 
				
			||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import tk.mybatis.spring.mapper.MapperScannerConfigurer; | 
				
			||||
 | 
				
			||||
import java.util.Properties; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author chison | 
				
			||||
 * @date 2020-04-02 09:40 | 
				
			||||
 * @Description | 
				
			||||
 */ | 
				
			||||
@EnableAutoConfiguration | 
				
			||||
public class MyBatisMapperScannerConfig { | 
				
			||||
    @Bean | 
				
			||||
    public MapperScannerConfigurer mapperScannerConfigurer() { | 
				
			||||
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer(); | 
				
			||||
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory"); | 
				
			||||
        mapperScannerConfigurer.setBasePackage("com.mh.user.mapper"); | 
				
			||||
        Properties properties = new Properties(); | 
				
			||||
        properties.setProperty("notEmpty", "false"); | 
				
			||||
        properties.setProperty("IDENTITY", "MYSQL"); | 
				
			||||
        mapperScannerConfigurer.setProperties(properties); | 
				
			||||
        return mapperScannerConfigurer; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,23 @@
					 | 
				
			||||
package com.mh.user.dynamic.datasource; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author chison | 
				
			||||
 * @date 2020-04-02 09:40 | 
				
			||||
 * @Description 通过ThreadLocal维护一个全局唯一的map来实现数据源的动态切换 | 
				
			||||
 */ | 
				
			||||
public class DataSourceContextHolder { | 
				
			||||
 | 
				
			||||
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>(); | 
				
			||||
 | 
				
			||||
    public static synchronized void setDBType(String dbType){ | 
				
			||||
        contextHolder.set(dbType); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public static String getDBType(){ | 
				
			||||
        return contextHolder.get(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public static void clearDBType(){ | 
				
			||||
        contextHolder.remove(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,71 @@
					 | 
				
			||||
package com.mh.user.dynamic.datasource; | 
				
			||||
 | 
				
			||||
import com.alibaba.druid.pool.DruidDataSource; | 
				
			||||
import com.mh.user.entity.DBEntity; | 
				
			||||
 | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author chison | 
				
			||||
 * @date 2020-04-02 09:40 | 
				
			||||
 * @Description | 
				
			||||
 */ | 
				
			||||
public class DataSourceObject { | 
				
			||||
 | 
				
			||||
    private Long MaxWait=6000L; | 
				
			||||
    private Integer maxActive=10; | 
				
			||||
    private Long timeBetweenEvictionRunsMillis=6000L; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 切换sqlserver数据库,并动态赋值 | 
				
			||||
     * @param dbInfo | 
				
			||||
     * @param SourceName | 
				
			||||
     */ | 
				
			||||
    public void SwitchMySQLDataSource(DBEntity dbInfo, String SourceName) { | 
				
			||||
        System.out.println("mysql进入数据源切换"); | 
				
			||||
        System.out.println("MaxWait:"+MaxWait); | 
				
			||||
        DruidDataSource dynamicDataSource = new DruidDataSource(); | 
				
			||||
        dynamicDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); | 
				
			||||
        dynamicDataSource.setUrl("jdbc:mysql://"+dbInfo.getDB_IP()+":"+dbInfo.getDB_Port()+"/"+dbInfo.getDB_Names()+"?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&autoReconnect=true"); | 
				
			||||
        dynamicDataSource.setUsername(dbInfo.getDB_UserName()); | 
				
			||||
        dynamicDataSource.setPassword(dbInfo.getDB_Pwd()); | 
				
			||||
        dynamicDataSource.setMaxWait(MaxWait); | 
				
			||||
        dynamicDataSource.setMaxActive(maxActive); | 
				
			||||
        dynamicDataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); | 
				
			||||
 | 
				
			||||
        DynamicDataSource dataSource = DynamicDataSource.getInstance(); | 
				
			||||
        Map<Object, Object> map=new HashMap<Object, Object>(); | 
				
			||||
        map.put(SourceName, dynamicDataSource); | 
				
			||||
        dataSource.setTargetDataSources(map); | 
				
			||||
        System.out.println(dynamicDataSource.getUrl()); | 
				
			||||
        System.out.println(SourceName); | 
				
			||||
    } | 
				
			||||
    /** | 
				
			||||
     * 第二个sqlserver数据库 | 
				
			||||
     * @param dbInfo | 
				
			||||
     * @param SourceName | 
				
			||||
     */ | 
				
			||||
    public void SwitchSQLServerDataSource(DBEntity dbInfo,String SourceName) { | 
				
			||||
        System.out.println("进入数据源切换"); | 
				
			||||
        System.out.println("MaxWait:"+MaxWait); | 
				
			||||
        DruidDataSource dynamicDataSource = new DruidDataSource(); | 
				
			||||
        dynamicDataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); | 
				
			||||
        dynamicDataSource.setUrl("jdbc:sqlserver://"+dbInfo.getDB_IP()+":"+dbInfo.getDB_Port()+";Databasename="+dbInfo.getDB_Names()); | 
				
			||||
        dynamicDataSource.setUsername(dbInfo.getDB_UserName()); | 
				
			||||
        dynamicDataSource.setPassword(dbInfo.getDB_Pwd()); | 
				
			||||
        System.out.println(dbInfo.getDB_UserName()); | 
				
			||||
        System.out.println(dbInfo.getDB_Pwd()); | 
				
			||||
        dynamicDataSource.setMaxWait(MaxWait); | 
				
			||||
        dynamicDataSource.setMaxActive(maxActive); | 
				
			||||
        dynamicDataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); | 
				
			||||
 | 
				
			||||
        DynamicDataSource dataSource = DynamicDataSource.getInstance(); | 
				
			||||
        Map<Object, Object> map=new HashMap<Object, Object>(); | 
				
			||||
        map.put(SourceName, dynamicDataSource); | 
				
			||||
        dataSource.setTargetDataSources(map); | 
				
			||||
 | 
				
			||||
        System.out.println(dynamicDataSource.getUrl()); | 
				
			||||
        System.out.println(SourceName); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,44 @@
					 | 
				
			||||
package com.mh.user.dynamic.datasource; | 
				
			||||
 | 
				
			||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; | 
				
			||||
 | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author chison | 
				
			||||
 * @date 2020-04-02 09:41 | 
				
			||||
 * @Description | 
				
			||||
 */ | 
				
			||||
public class DynamicDataSource extends AbstractRoutingDataSource { | 
				
			||||
 | 
				
			||||
    private static DynamicDataSource instance; | 
				
			||||
    private static byte[] lock=new byte[0]; | 
				
			||||
    private static Map<Object,Object> dataSourceMap=new HashMap<Object, Object>(); | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void setTargetDataSources(Map<Object, Object> targetDataSources) { | 
				
			||||
        super.setTargetDataSources(targetDataSources); | 
				
			||||
        dataSourceMap.putAll(targetDataSources); | 
				
			||||
        super.afterPropertiesSet();// 必须添加该句,否则新添加数据源无法识别到
 | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Map<Object, Object> getDataSourceMap() { | 
				
			||||
        return dataSourceMap; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public static synchronized DynamicDataSource getInstance(){ | 
				
			||||
        if(instance==null){ | 
				
			||||
            synchronized (lock){ | 
				
			||||
                if(instance==null){ | 
				
			||||
                    instance=new DynamicDataSource(); | 
				
			||||
                } | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
        return instance; | 
				
			||||
    } | 
				
			||||
    //必须实现其方法
 | 
				
			||||
    protected Object determineCurrentLookupKey() { | 
				
			||||
        return DataSourceContextHolder.getDBType(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,34 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
 | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 定时任务请求类 | 
				
			||||
 * @updateTime 2020-04-03 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class AddCronJobReq { | 
				
			||||
 | 
				
			||||
    private String jobName; | 
				
			||||
 | 
				
			||||
    private String jobGroupName; | 
				
			||||
 | 
				
			||||
    private String triggerName; | 
				
			||||
 | 
				
			||||
    private String triggerGroupName; | 
				
			||||
 | 
				
			||||
    private String jobClass; | 
				
			||||
 | 
				
			||||
    private String date; | 
				
			||||
 | 
				
			||||
    private Map<String, String> params = new HashMap<>(); | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,27 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
import java.util.HashMap; | 
				
			||||
import java.util.Map; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 新增Simple定时任务请求实体类 | 
				
			||||
 * @updateTime 2020-04-03 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class AddSimpleJobReq { | 
				
			||||
 | 
				
			||||
    private String jobClass; | 
				
			||||
 | 
				
			||||
    private Date date; | 
				
			||||
 | 
				
			||||
    private Map<String, String> params = new HashMap<>(); | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,21 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class AlarmInfoEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String alarmId; | 
				
			||||
    private String buildingId; | 
				
			||||
    private String buildingName; | 
				
			||||
    private Date alarmTime; | 
				
			||||
    private String deviceAddr; | 
				
			||||
    private String deviceType; | 
				
			||||
    private String alarmType; | 
				
			||||
    private String dealState; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,20 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class AlarmInfoSumEntity { | 
				
			||||
 | 
				
			||||
    private long id; | 
				
			||||
    private String curDate; | 
				
			||||
    private String buildingId; | 
				
			||||
    private int deviceNum; | 
				
			||||
    private int faultNum; | 
				
			||||
    private String waterLevel; | 
				
			||||
    private int waterLevelNum; | 
				
			||||
    private String waterTemp; | 
				
			||||
    private int waterTempNum; | 
				
			||||
    private String energy; | 
				
			||||
    private int energyNum; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,13 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class AlarmValueSetEntity { | 
				
			||||
 | 
				
			||||
    private String waterLevel; | 
				
			||||
    private String waterTemp; | 
				
			||||
    private String electWater; | 
				
			||||
    private String buildingId; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,46 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class AnalysisMonthEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String curDate; | 
				
			||||
    private String itemType; | 
				
			||||
    private String day01; | 
				
			||||
    private String day02; | 
				
			||||
    private String day03; | 
				
			||||
    private String day04; | 
				
			||||
    private String day05; | 
				
			||||
    private String day06; | 
				
			||||
    private String day07; | 
				
			||||
    private String day08; | 
				
			||||
    private String day09; | 
				
			||||
    private String day10; | 
				
			||||
    private String day11; | 
				
			||||
    private String day12; | 
				
			||||
    private String day13; | 
				
			||||
    private String day14; | 
				
			||||
    private String day15; | 
				
			||||
    private String day16; | 
				
			||||
    private String day17; | 
				
			||||
    private String day18; | 
				
			||||
    private String day19; | 
				
			||||
    private String day20; | 
				
			||||
    private String day21; | 
				
			||||
    private String day22; | 
				
			||||
    private String day23; | 
				
			||||
    private String day24; | 
				
			||||
    private String day25; | 
				
			||||
    private String day26; | 
				
			||||
    private String day27; | 
				
			||||
    private String day28; | 
				
			||||
    private String day29; | 
				
			||||
    private String day30; | 
				
			||||
    private String day31; | 
				
			||||
    private String day32; | 
				
			||||
    private String totalValue; | 
				
			||||
    private String buildingId; | 
				
			||||
    private String buildingName; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,27 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class AnalysisYearEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String curDate; | 
				
			||||
    private String itemType; | 
				
			||||
    private String month01; | 
				
			||||
    private String month02; | 
				
			||||
    private String month03; | 
				
			||||
    private String month04; | 
				
			||||
    private String month05; | 
				
			||||
    private String month06; | 
				
			||||
    private String month07; | 
				
			||||
    private String month08; | 
				
			||||
    private String month09; | 
				
			||||
    private String month10; | 
				
			||||
    private String month11; | 
				
			||||
    private String month12; | 
				
			||||
    private String totalValue; | 
				
			||||
    private String buildingId; | 
				
			||||
    private String buildingName; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,32 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
public class AreaEntity { | 
				
			||||
 | 
				
			||||
    private String areaId; | 
				
			||||
 | 
				
			||||
    private String areaName; | 
				
			||||
 | 
				
			||||
    public String getAreaId() { | 
				
			||||
        return areaId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setAreaId(String areaId) { | 
				
			||||
        this.areaId = areaId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getAreaName() { | 
				
			||||
        return areaName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setAreaName(String areaName) { | 
				
			||||
        this.areaName = areaName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return "AreaEntity{" + | 
				
			||||
                "areaId='" + areaId + '\'' + | 
				
			||||
                ", areaName='" + areaName + '\'' + | 
				
			||||
                '}'; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,41 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
import org.springframework.format.annotation.DateTimeFormat; | 
				
			||||
 | 
				
			||||
import java.io.Serializable; | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 基础实体类 | 
				
			||||
 * @updateTime 2020-05-14 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class BaseEntity implements Serializable { | 
				
			||||
 | 
				
			||||
    static final long serialVersionUID = 42L; | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
 | 
				
			||||
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 
				
			||||
    private Date createTime; | 
				
			||||
 | 
				
			||||
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 
				
			||||
    private Date updateTime; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return "BaseEntity{" + | 
				
			||||
                "id=" + id + | 
				
			||||
                ", createTime=" + createTime + | 
				
			||||
                ", updateTime=" + updateTime + | 
				
			||||
                '}'; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,19 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class BuildingEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String buildingId; | 
				
			||||
    private String buildingName; | 
				
			||||
    private int levelsCount; | 
				
			||||
    private int beginLevel; | 
				
			||||
    private int houseCount; | 
				
			||||
    private int bedCount; | 
				
			||||
    private int checkInCount; | 
				
			||||
    private String areaId; | 
				
			||||
    private String remarks; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,58 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
import org.springframework.format.annotation.DateTimeFormat; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description :冷水机组设备实体类 | 
				
			||||
 * @updateTime 2020-05-20 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class ChillersEntity extends BaseEntity { | 
				
			||||
 | 
				
			||||
    private String deviceCode;              // 设备代码
 | 
				
			||||
    private String deviceNum;               // 设备码
 | 
				
			||||
    private String collectionNum;           // 冷水机组采集地址
 | 
				
			||||
    private String registerAddress;         // 寄存器地址
 | 
				
			||||
    private String registerName;            // 寄存器名称
 | 
				
			||||
    private String funCode;                 // 功能码
 | 
				
			||||
    private int digit;                      // 保留位数
 | 
				
			||||
    private String otherName;               // 别名
 | 
				
			||||
    private int grade;                      // 标志 1:冷水机组设备 2:ddc设备采集参数 3:控制指令类型 4:故障类型
 | 
				
			||||
    private String lastValue;               // 最新采集数据
 | 
				
			||||
    private String lastTime;                  // 最新采集时间
 | 
				
			||||
    private String dataCom;                 // 采集端口号
 | 
				
			||||
    private String ddcAddr;                 // DDC地址
 | 
				
			||||
 | 
				
			||||
    // update by ljf on 2020-05-26 添加网络管理器的IP和采集的端口号
 | 
				
			||||
    private String IP;                      // IP地址
 | 
				
			||||
    private int port;                       // 端口号
 | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return "ChillersEntity{" + | 
				
			||||
                "deviceCode='" + deviceCode + '\'' + | 
				
			||||
                ", deviceNum='" + deviceNum + '\'' + | 
				
			||||
                ", collectionNum='" + collectionNum + '\'' + | 
				
			||||
                ", registerAddress='" + registerAddress + '\'' + | 
				
			||||
                ", registerName='" + registerName + '\'' + | 
				
			||||
                ", funCode='" + funCode + '\'' + | 
				
			||||
                ", digit=" + digit + | 
				
			||||
                ", otherName='" + otherName + '\'' + | 
				
			||||
                ", grade=" + grade + | 
				
			||||
                ", lastValue='" + lastValue + '\'' + | 
				
			||||
                ", lastTime=" + lastTime + | 
				
			||||
                ", dataCom='" + dataCom + '\'' + | 
				
			||||
                ", ddcAddr='" + ddcAddr + '\'' + | 
				
			||||
                ", IP='" + IP + '\'' + | 
				
			||||
                ", port=" + port + | 
				
			||||
                '}'; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,17 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class ControlSetEntity { | 
				
			||||
 | 
				
			||||
    private String buildingId; | 
				
			||||
    private String levelSet; | 
				
			||||
    private String useStartTime1; | 
				
			||||
    private String useCloseTime1; | 
				
			||||
    private String useStartTime2; | 
				
			||||
    private String useCloseTime2; | 
				
			||||
    private String backWaterTemp; | 
				
			||||
    private String upWaterTemp; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,91 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author chison | 
				
			||||
 * @date 2020-09-02 13:37 | 
				
			||||
 * @Description | 
				
			||||
 */ | 
				
			||||
public class DBEntity { | 
				
			||||
 | 
				
			||||
    private String DB_Names; | 
				
			||||
    private String DB_UserName; | 
				
			||||
    private String DB_Pwd; | 
				
			||||
    private String DB_Port; | 
				
			||||
    private Integer DB_Type;    //0:sqlserver,1:oracle,2:mysql
 | 
				
			||||
    private String DB_IP; | 
				
			||||
    private String Project_Name; | 
				
			||||
    private String Project_No; | 
				
			||||
    private Integer DB_IsStatus; | 
				
			||||
 | 
				
			||||
    public String getDB_Names() { | 
				
			||||
        return DB_Names; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDB_Names(String DB_Names) { | 
				
			||||
        this.DB_Names = DB_Names; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDB_UserName() { | 
				
			||||
        return DB_UserName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDB_UserName(String DB_UserName) { | 
				
			||||
        this.DB_UserName = DB_UserName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDB_Pwd() { | 
				
			||||
        return DB_Pwd; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDB_Pwd(String DB_Pwd) { | 
				
			||||
        this.DB_Pwd = DB_Pwd; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDB_Port() { | 
				
			||||
        return DB_Port; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDB_Port(String DB_Port) { | 
				
			||||
        this.DB_Port = DB_Port; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Integer getDB_Type() { | 
				
			||||
        return DB_Type; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDB_Type(Integer DB_Type) { | 
				
			||||
        this.DB_Type = DB_Type; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDB_IP() { | 
				
			||||
        return DB_IP; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDB_IP(String DB_IP) { | 
				
			||||
        this.DB_IP = DB_IP; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getProject_Name() { | 
				
			||||
        return Project_Name; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setProject_Name(String project_Name) { | 
				
			||||
        Project_Name = project_Name; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getProject_No() { | 
				
			||||
        return Project_No; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setProject_No(String project_No) { | 
				
			||||
        Project_No = project_No; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Integer getDB_IsStatus() { | 
				
			||||
        return DB_IsStatus; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDB_IsStatus(Integer DB_IsStatus) { | 
				
			||||
        this.DB_IsStatus = DB_IsStatus; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,24 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import com.fasterxml.jackson.annotation.JsonFormat; | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class DataResultChEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String deviceAddr; | 
				
			||||
    private String deviceType; | 
				
			||||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") | 
				
			||||
    private Date curDate; | 
				
			||||
//    private String curDate;
 | 
				
			||||
    private String curValue; | 
				
			||||
    private String funCode; | 
				
			||||
    private String registerAddr; | 
				
			||||
    private String registerName; | 
				
			||||
    private int grade; | 
				
			||||
    private String projectID; | 
				
			||||
    private String projectName; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,23 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class DataResultClEntity { | 
				
			||||
    private Long id; | 
				
			||||
    private String deviceAddr; | 
				
			||||
    private String deviceType; | 
				
			||||
    private double lastValue; | 
				
			||||
    private Date lastDate; | 
				
			||||
    private double curValue; | 
				
			||||
    private Date curDate; | 
				
			||||
    private double ratio; | 
				
			||||
    private double calcValue; | 
				
			||||
    private int grade; | 
				
			||||
    private String registerAddr; | 
				
			||||
    private String registerName; | 
				
			||||
    private String projectName; | 
				
			||||
    private String projectID; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,22 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class DataResultEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String deviceAddr; | 
				
			||||
    private String deviceType; | 
				
			||||
    private double lastValue; | 
				
			||||
    private Date lastDate; | 
				
			||||
    private double curValue; | 
				
			||||
    private Date curDate; | 
				
			||||
    private double ratio; | 
				
			||||
    private double calcValue; | 
				
			||||
    private int grade; | 
				
			||||
    private String projectName; | 
				
			||||
    private String projectID; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,25 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Getter; | 
				
			||||
import lombok.Setter; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description : 定时任务删除类 | 
				
			||||
 * @updateTime 2020-04-03 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@Setter | 
				
			||||
@Getter | 
				
			||||
public class DeleteJobReq { | 
				
			||||
 | 
				
			||||
    private String jobName; | 
				
			||||
 | 
				
			||||
    private String jobGroupName; | 
				
			||||
 | 
				
			||||
    private String triggerName; | 
				
			||||
 | 
				
			||||
    private String triggerGroupName; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,27 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class DeviceCodeParamEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String deviceAddr; | 
				
			||||
    private String deviceName; | 
				
			||||
    private String deviceType; | 
				
			||||
    private String strData; | 
				
			||||
    private String dataPort; | 
				
			||||
    private int baudRate; | 
				
			||||
    private String parity; | 
				
			||||
    private String brand; | 
				
			||||
    private String funCode; | 
				
			||||
    private String registerAddr; | 
				
			||||
    private String registerName; | 
				
			||||
    private int digit;            //保留小数位
 | 
				
			||||
    private int grade;            //级别
 | 
				
			||||
    private String dataValue;     //传入值
 | 
				
			||||
    private Date createTime; | 
				
			||||
    private String projectID; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,18 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class DeviceFloorTempEntity { | 
				
			||||
 | 
				
			||||
    private String deviceName; | 
				
			||||
    private String deviceType; | 
				
			||||
    private String buildingId; | 
				
			||||
    private Date installDate; | 
				
			||||
    private String model; | 
				
			||||
    private String specs; | 
				
			||||
    private String remarks; | 
				
			||||
    private String rowId;         //行号
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,20 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class DeviceInfoEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String deviceName;  //设备名称
 | 
				
			||||
    private String deviceType;  //设备类型
 | 
				
			||||
    private String brand;       //品牌
 | 
				
			||||
    private String power;       //功率
 | 
				
			||||
    private String madeTime;    //制造时间
 | 
				
			||||
    private String flow;        //流量
 | 
				
			||||
    private String isFC;        //是否变频
 | 
				
			||||
    private String motorBrand;  //机电品牌
 | 
				
			||||
    private String projectID;   //项目ID
 | 
				
			||||
    private String systemID;    //系统ID
 | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,31 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import lombok.Data; | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@Data | 
				
			||||
public class DeviceInstallEntity { | 
				
			||||
 | 
				
			||||
    private Long id; | 
				
			||||
    private String deviceAddr; | 
				
			||||
    private String deviceName; | 
				
			||||
    private String deviceType; | 
				
			||||
    private String dataCom; | 
				
			||||
    private String dataPort; | 
				
			||||
    private int baudRate; | 
				
			||||
    private String parity; | 
				
			||||
    private double ratio; | 
				
			||||
    private double initValue; | 
				
			||||
    private double lastValue; | 
				
			||||
    private Date lastDate; | 
				
			||||
    private String standard; | 
				
			||||
    private String isTotal; | 
				
			||||
    private String isForbid; | 
				
			||||
    private int grade; | 
				
			||||
    private String brand; | 
				
			||||
    private String installPosition; | 
				
			||||
    private Date installDate; | 
				
			||||
    private String projectID; | 
				
			||||
    private String remarks; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,113 @@
					 | 
				
			||||
package com.mh.user.entity; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
public class DeviceInstallTempEntity { | 
				
			||||
 | 
				
			||||
    private String deviceAddr; | 
				
			||||
    private String deviceName; | 
				
			||||
    private String deviceType; | 
				
			||||
    private int baudRate; | 
				
			||||
    private String dataCom; | 
				
			||||
    private double ratio; | 
				
			||||
    private String buildingId; | 
				
			||||
    private Date installDate; | 
				
			||||
    private String remarks; | 
				
			||||
    private String rowId;         //行号
 | 
				
			||||
 | 
				
			||||
    public String getDeviceAddr() { | 
				
			||||
        return deviceAddr; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDeviceAddr(String deviceAddr) { | 
				
			||||
        this.deviceAddr = deviceAddr; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDeviceName() { | 
				
			||||
        return deviceName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDeviceName(String deviceName) { | 
				
			||||
        this.deviceName = deviceName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDeviceType() { | 
				
			||||
        return deviceType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDeviceType(String deviceType) { | 
				
			||||
        this.deviceType = deviceType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getBaudRate() { | 
				
			||||
        return baudRate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setBaudRate(int baudRate) { | 
				
			||||
        this.baudRate = baudRate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDataCom() { | 
				
			||||
        return dataCom; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDataCom(String dataCom) { | 
				
			||||
        this.dataCom = dataCom; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public double getRatio() { | 
				
			||||
        return ratio; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setRatio(double ratio) { | 
				
			||||
        this.ratio = ratio; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getBuildingId() { | 
				
			||||
        return buildingId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setBuildingId(String buildingId) { | 
				
			||||
        this.buildingId = buildingId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Date getInstallDate() { | 
				
			||||
        return installDate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setInstallDate(Date installDate) { | 
				
			||||
        this.installDate = installDate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getRemarks() { | 
				
			||||
        return remarks; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setRemarks(String remarks) { | 
				
			||||
        this.remarks = remarks; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getRowId() { | 
				
			||||
        return rowId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setRowId(String rowId) { | 
				
			||||
        this.rowId = rowId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return "DeviceInstallTempEntity{" + | 
				
			||||
                "deviceAddr='" + deviceAddr + '\'' + | 
				
			||||
                ", deviceName='" + deviceName + '\'' + | 
				
			||||
                ", deviceType='" + deviceType + '\'' + | 
				
			||||
                ", baudRate=" + baudRate + | 
				
			||||
                ", dataCom='" + dataCom + '\'' + | 
				
			||||
                ", ratio=" + ratio + | 
				
			||||
                ", buildingId='" + buildingId + '\'' + | 
				
			||||
                ", installDate=" + installDate + | 
				
			||||
                ", remarks='" + remarks + '\'' + | 
				
			||||
                ", rowId='" + rowId + '\'' + | 
				
			||||
                '}'; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
Some files were not shown because too many files have changed in this diff Show More
					Loading…
					
					
				
		Reference in new issue