parent
c969bb5ab0
commit
b12ba8d795
@ -1,9 +0,0 @@
|
|||||||
package com.example.module.admin.rsp;
|
|
||||||
|
|
||||||
import com.example.frame.base.BaseResponse;
|
|
||||||
|
|
||||||
|
|
||||||
public class LoginResponse extends BaseResponse {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example;
|
package xyz.wbsite;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
@ -1,26 +1,26 @@
|
|||||||
package com.example.action;
|
package xyz.wbsite.action;
|
||||||
|
|
||||||
import com.example.frame.base.BaseResponse;
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
import com.example.frame.base.Error;
|
import xyz.wbsite.frame.base.Error;
|
||||||
import com.example.frame.base.ErrorType;
|
import xyz.wbsite.frame.base.ErrorType;
|
||||||
import com.example.frame.base.Token;
|
import xyz.wbsite.frame.base.Token;
|
||||||
import com.example.frame.utils.LocalData;
|
import xyz.wbsite.frame.utils.LocalData;
|
||||||
import com.example.frame.utils.LogUtil;
|
import xyz.wbsite.frame.utils.LogUtil;
|
||||||
import com.example.frame.utils.MD5Util;
|
import xyz.wbsite.frame.utils.MD5Util;
|
||||||
import com.example.frame.utils.MapperUtil;
|
import xyz.wbsite.frame.utils.MapperUtil;
|
||||||
import com.example.frame.utils.Message;
|
import xyz.wbsite.frame.utils.Message;
|
||||||
import com.example.frame.utils.ProcessUtil;
|
import xyz.wbsite.frame.utils.ProcessUtil;
|
||||||
import com.example.frame.utils.ValidationUtil;
|
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||||
import com.example.module.admin.ent.Mapping;
|
import xyz.wbsite.module.admin.ent.Mapping;
|
||||||
import com.example.module.admin.ent.NginxCtrl;
|
import xyz.wbsite.module.admin.ent.NginxCtrl;
|
||||||
import com.example.module.admin.mgr.MappingManager;
|
import xyz.wbsite.module.admin.mgr.MappingManager;
|
||||||
import com.example.module.admin.req.LoginRequest;
|
import xyz.wbsite.module.admin.req.LoginRequest;
|
||||||
import com.example.module.admin.req.MappingCreateRequest;
|
import xyz.wbsite.module.admin.req.MappingCreateRequest;
|
||||||
import com.example.module.admin.req.MappingDeleteRequest;
|
import xyz.wbsite.module.admin.req.MappingDeleteRequest;
|
||||||
import com.example.module.admin.req.MappingFindRequest;
|
import xyz.wbsite.module.admin.req.MappingFindRequest;
|
||||||
import com.example.module.admin.req.MappingUpdateRequest;
|
import xyz.wbsite.module.admin.req.MappingUpdateRequest;
|
||||||
import com.example.module.admin.rsp.LoginResponse;
|
import xyz.wbsite.module.admin.rsp.LoginResponse;
|
||||||
import com.example.module.admin.rsp.MappingFindResponse;
|
import xyz.wbsite.module.admin.rsp.MappingFindResponse;
|
||||||
import freemarker.template.Template;
|
import freemarker.template.Template;
|
||||||
import freemarker.template.TemplateException;
|
import freemarker.template.TemplateException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
@ -0,0 +1,21 @@
|
|||||||
|
package xyz.wbsite.action.ajax;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
|
import xyz.wbsite.frame.base.ErrorType;
|
||||||
|
import xyz.wbsite.frame.utils.LogUtil;
|
||||||
|
import xyz.wbsite.frame.utils.MapperUtil;
|
||||||
|
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||||
|
import xyz.wbsite.module.admin.mgr.MappingManager;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MappingAjax {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MappingManager mappingManager;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.action.control;
|
package xyz.wbsite.action.control;
|
||||||
|
|
||||||
import com.example.frame.base.Control;
|
import xyz.wbsite.frame.base.Control;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.action.control;
|
package xyz.wbsite.action.control;
|
||||||
|
|
||||||
import com.example.frame.base.Control;
|
import xyz.wbsite.frame.base.Control;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.action.screen;
|
package xyz.wbsite.action.screen;
|
||||||
|
|
||||||
import com.example.frame.base.Screen;
|
import xyz.wbsite.frame.base.Screen;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
@ -1,7 +1,7 @@
|
|||||||
package com.example.action.screen;
|
package xyz.wbsite.action.screen;
|
||||||
|
|
||||||
import com.example.frame.base.Screen;
|
import xyz.wbsite.frame.base.Screen;
|
||||||
import com.example.module.admin.ent.NginxCtrl;
|
import xyz.wbsite.module.admin.ent.NginxCtrl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
@ -1,15 +1,12 @@
|
|||||||
package com.example.config;
|
package xyz.wbsite.config;
|
||||||
|
|
||||||
import com.example.action.GlobalController;
|
import xyz.wbsite.action.GlobalController;
|
||||||
import com.example.frame.base.Message;
|
import xyz.wbsite.frame.base.Message;
|
||||||
import com.example.frame.base.MessageType;
|
import xyz.wbsite.frame.base.MessageType;
|
||||||
import com.example.frame.utils.LogUtil;
|
import xyz.wbsite.module.admin.ent.NginxCtrl;
|
||||||
import com.example.frame.utils.ProcessUtil;
|
import xyz.wbsite.module.admin.ent.State;
|
||||||
import com.example.module.admin.ent.NginxCtrl;
|
|
||||||
import com.example.module.admin.ent.State;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Profile;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.config;
|
package xyz.wbsite.config;
|
||||||
|
|
||||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseFindRequest - 基类
|
* BaseFindRequest - 基类
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseFindRequest - 基类
|
* BaseFindRequest - 基类
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseRequest - 基类
|
* BaseRequest - 基类
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseSearchRequest - 基类
|
* BaseSearchRequest - 基类
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseUpdateRequest - 基类
|
* BaseUpdateRequest - 基类
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error - 错误基类
|
* Error - 错误基类
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ErrorType - 错误类型
|
* ErrorType - 错误类型
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
public class FileUploadResponse extends BaseResponse {
|
public class FileUploadResponse extends BaseResponse {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
public class Message {
|
public class Message {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
public enum MessageType {
|
public enum MessageType {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SortTypeEnum - 排序方式
|
* SortTypeEnum - 排序方式
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.base;
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.freemarker;
|
package xyz.wbsite.frame.freemarker;
|
||||||
|
|
||||||
import freemarker.template.TemplateModelException;
|
import freemarker.template.TemplateModelException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.frame.freemarker;
|
package xyz.wbsite.frame.freemarker;
|
||||||
|
|
||||||
import com.example.frame.utils.LocalData;
|
import xyz.wbsite.frame.utils.LocalData;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.DispatcherServlet;
|
import org.springframework.web.servlet.DispatcherServlet;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
import javax.crypto.BadPaddingException;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import com.example.frame.base.Token;
|
import xyz.wbsite.frame.base.Token;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.TreeNode;
|
import com.fasterxml.jackson.core.TreeNode;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
@ -0,0 +1,79 @@
|
|||||||
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RequestUtil
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2017-01-01
|
||||||
|
*/
|
||||||
|
public class RequestUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求放IP
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getIp(HttpServletRequest request) {
|
||||||
|
String ip = request.getHeader("X-Forwarded-For");
|
||||||
|
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("HTTP_CLIENT_IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ip.length() > 15) {
|
||||||
|
String[] ips = ip.split(",");
|
||||||
|
for (int index = 0; index < ips.length; index++) {
|
||||||
|
String strIp = (String) ips[index];
|
||||||
|
if (!("unknown".equalsIgnoreCase(strIp))) {
|
||||||
|
ip = strIp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取情况方客户端信息
|
||||||
|
*
|
||||||
|
* @param request 请求
|
||||||
|
* @return 客户端信息
|
||||||
|
*/
|
||||||
|
public static String getUserAgent(HttpServletRequest request) {
|
||||||
|
return request.getHeader("User-Agent");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取转发至错误页之前的请求URL
|
||||||
|
*
|
||||||
|
* @param request 请求
|
||||||
|
* @return 请求URL
|
||||||
|
*/
|
||||||
|
public static String getErrorUrl(HttpServletRequest request) {
|
||||||
|
if (request.getAttribute("javax.servlet.error.request_uri") != null) {
|
||||||
|
return (String) request.getAttribute("javax.servlet.error.request_uri");
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,13 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import com.example.frame.base.BaseRequest;
|
import xyz.wbsite.frame.base.BaseRequest;
|
||||||
import com.example.frame.base.BaseResponse;
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
import com.example.frame.base.ErrorType;
|
import xyz.wbsite.frame.base.ErrorType;
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import javax.validation.Validation;
|
import javax.validation.Validation;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
import javax.validation.ValidatorFactory;
|
import javax.validation.ValidatorFactory;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证工具类。提供一些通用简单的数据验证功能
|
* 验证工具类。提供一些通用简单的数据验证功能
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.utils;
|
package xyz.wbsite.frame.utils;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.validation;
|
package xyz.wbsite.frame.validation;
|
||||||
|
|
||||||
import javax.validation.Constraint;
|
import javax.validation.Constraint;
|
||||||
import javax.validation.Payload;
|
import javax.validation.Payload;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.frame.validation;
|
package xyz.wbsite.frame.validation;
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
import javax.validation.ConstraintValidator;
|
||||||
import javax.validation.ConstraintValidatorContext;
|
import javax.validation.ConstraintValidatorContext;
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.module.admin.ent;
|
package xyz.wbsite.module.admin.ent;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import xyz.wbsite.wsqlite.anonation.TableField;
|
import xyz.wbsite.wsqlite.anonation.TableField;
|
@ -1,7 +1,7 @@
|
|||||||
package com.example.module.admin.ent;
|
package xyz.wbsite.module.admin.ent;
|
||||||
|
|
||||||
|
|
||||||
import com.example.frame.utils.ProcessUtil;
|
import xyz.wbsite.frame.utils.ProcessUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.module.admin.ent;
|
package xyz.wbsite.module.admin.ent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运行状态
|
* 运行状态
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.module.admin.mgr;
|
package xyz.wbsite.module.admin.mgr;
|
||||||
|
|
||||||
import freemarker.cache.ClassTemplateLoader;
|
import freemarker.cache.ClassTemplateLoader;
|
||||||
import freemarker.cache.MultiTemplateLoader;
|
import freemarker.cache.MultiTemplateLoader;
|
@ -1,8 +1,16 @@
|
|||||||
package com.example.module.admin.mgr;
|
package xyz.wbsite.module.admin.mgr;
|
||||||
|
|
||||||
import com.example.module.admin.req.*;
|
import com.example.module.admin.req.*;
|
||||||
import com.example.module.admin.rsp.*;
|
import com.example.module.admin.rsp.*;
|
||||||
import com.example.frame.base.Token;
|
import xyz.wbsite.frame.base.Token;
|
||||||
|
import xyz.wbsite.module.admin.req.MappingCreateRequest;
|
||||||
|
import xyz.wbsite.module.admin.req.MappingDeleteRequest;
|
||||||
|
import xyz.wbsite.module.admin.req.MappingFindRequest;
|
||||||
|
import xyz.wbsite.module.admin.req.MappingUpdateRequest;
|
||||||
|
import xyz.wbsite.module.admin.rsp.MappingCreateResponse;
|
||||||
|
import xyz.wbsite.module.admin.rsp.MappingDeleteResponse;
|
||||||
|
import xyz.wbsite.module.admin.rsp.MappingFindResponse;
|
||||||
|
import xyz.wbsite.module.admin.rsp.MappingUpdateResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 映射
|
* 映射
|
@ -1,19 +1,19 @@
|
|||||||
package com.example.module.admin.mgr;
|
package xyz.wbsite.module.admin.mgr;
|
||||||
|
|
||||||
import com.example.frame.base.ErrorType;
|
import xyz.wbsite.frame.base.ErrorType;
|
||||||
import com.example.frame.base.Token;
|
import xyz.wbsite.frame.base.Token;
|
||||||
import com.example.frame.utils.IDgenerator;
|
import xyz.wbsite.frame.utils.IDgenerator;
|
||||||
import com.example.frame.utils.MapperUtil;
|
import xyz.wbsite.frame.utils.MapperUtil;
|
||||||
import com.example.frame.utils.ValidationUtil;
|
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||||
import com.example.module.admin.ent.Mapping;
|
import xyz.wbsite.module.admin.ent.Mapping;
|
||||||
import com.example.module.admin.req.MappingCreateRequest;
|
import xyz.wbsite.module.admin.req.MappingCreateRequest;
|
||||||
import com.example.module.admin.req.MappingDeleteRequest;
|
import xyz.wbsite.module.admin.req.MappingDeleteRequest;
|
||||||
import com.example.module.admin.req.MappingFindRequest;
|
import xyz.wbsite.module.admin.req.MappingFindRequest;
|
||||||
import com.example.module.admin.req.MappingUpdateRequest;
|
import xyz.wbsite.module.admin.req.MappingUpdateRequest;
|
||||||
import com.example.module.admin.rsp.MappingCreateResponse;
|
import xyz.wbsite.module.admin.rsp.MappingCreateResponse;
|
||||||
import com.example.module.admin.rsp.MappingDeleteResponse;
|
import xyz.wbsite.module.admin.rsp.MappingDeleteResponse;
|
||||||
import com.example.module.admin.rsp.MappingFindResponse;
|
import xyz.wbsite.module.admin.rsp.MappingFindResponse;
|
||||||
import com.example.module.admin.rsp.MappingUpdateResponse;
|
import xyz.wbsite.module.admin.rsp.MappingUpdateResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import xyz.wbsite.wsqlite.ObjectClient;
|
import xyz.wbsite.wsqlite.ObjectClient;
|
@ -1,9 +1,8 @@
|
|||||||
package com.example.module.admin.req;
|
package xyz.wbsite.module.admin.req;
|
||||||
|
|
||||||
import com.example.frame.base.BaseRequest;
|
import xyz.wbsite.frame.base.BaseRequest;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MappingCreateRequest - 映射新增
|
* MappingCreateRequest - 映射新增
|
@ -1,17 +1,10 @@
|
|||||||
package com.example.module.admin.req;
|
package xyz.wbsite.module.admin.req;
|
||||||
|
|
||||||
import com.example.frame.base.BaseRequest;
|
import xyz.wbsite.frame.base.BaseRequest;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
import xyz.wbsite.wsqlite.anonation.TableField;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MappingCreateRequest - 映射新增
|
* MappingCreateRequest - 映射新增
|
||||||
*
|
*
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.module.admin.req;
|
package xyz.wbsite.module.admin.req;
|
||||||
|
|
||||||
import com.example.frame.base.BaseUpdateRequest;
|
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.module.admin.req;
|
package xyz.wbsite.module.admin.req;
|
||||||
|
|
||||||
import com.example.frame.base.BaseFindRequest;
|
import xyz.wbsite.frame.base.BaseFindRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MappingRequest - 映射查询
|
* MappingRequest - 映射查询
|
@ -1,14 +1,10 @@
|
|||||||
package com.example.module.admin.req;
|
package xyz.wbsite.module.admin.req;
|
||||||
|
|
||||||
import com.example.frame.base.BaseUpdateRequest;
|
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
import xyz.wbsite.wsqlite.anonation.TableField;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
@ -0,0 +1,9 @@
|
|||||||
|
package xyz.wbsite.module.admin.rsp;
|
||||||
|
|
||||||
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
|
|
||||||
|
|
||||||
|
public class LoginResponse extends BaseResponse {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.module.admin.rsp;
|
package xyz.wbsite.module.admin.rsp;
|
||||||
|
|
||||||
import com.example.frame.base.BaseResponse;
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MappingCreateResponse - 映射
|
* MappingCreateResponse - 映射
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.module.admin.rsp;
|
package xyz.wbsite.module.admin.rsp;
|
||||||
|
|
||||||
import com.example.frame.base.BaseResponse;
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MappingDeleteResponse - 映射
|
* MappingDeleteResponse - 映射
|
@ -1,8 +1,8 @@
|
|||||||
package com.example.module.admin.rsp;
|
package xyz.wbsite.module.admin.rsp;
|
||||||
|
|
||||||
|
|
||||||
import com.example.frame.base.BaseFindResponse;
|
import xyz.wbsite.frame.base.BaseFindResponse;
|
||||||
import com.example.module.admin.ent.Mapping;
|
import xyz.wbsite.module.admin.ent.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MappingFindResponse - 映射
|
* MappingFindResponse - 映射
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.module.admin.rsp;
|
package xyz.wbsite.module.admin.rsp;
|
||||||
|
|
||||||
import com.example.frame.base.BaseResponse;
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MappingUpdateResponse - 映射
|
* MappingUpdateResponse - 映射
|
@ -1,10 +1,16 @@
|
|||||||
package com.example;
|
package xyz.wbsite;
|
||||||
|
|
||||||
import com.example.frame.utils.*;
|
import com.example.frame.utils.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import xyz.wbsite.frame.utils.AESUtil;
|
||||||
|
import xyz.wbsite.frame.utils.Base64Util;
|
||||||
|
import xyz.wbsite.frame.utils.IDgenerator;
|
||||||
|
import xyz.wbsite.frame.utils.MD5Util;
|
||||||
|
import xyz.wbsite.frame.utils.ProcessUtil;
|
||||||
|
import xyz.wbsite.frame.utils.RSAUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UtilTest - - 测试用例
|
* UtilTest - - 测试用例
|
@ -1,6 +1,6 @@
|
|||||||
package com.example.config;
|
package xyz.wbsite.config;
|
||||||
|
|
||||||
import com.example.frame.base.Token;
|
import xyz.wbsite.frame.base.Token;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@Configuration
|
@Configuration
|
@ -1,14 +1,11 @@
|
|||||||
package com.example.mapping;
|
package xyz.wbsite.mapping;
|
||||||
|
|
||||||
import com.example.frame.base.Token;
|
import xyz.wbsite.frame.base.Token;
|
||||||
import com.example.frame.utils.IDgenerator;
|
import xyz.wbsite.module.admin.mgr.MappingManager;
|
||||||
import com.example.frame.utils.LocalData;
|
import xyz.wbsite.module.admin.req.MappingCreateRequest;
|
||||||
import com.example.module.admin.ent.Mapping;
|
import xyz.wbsite.module.admin.req.MappingFindRequest;
|
||||||
import com.example.module.admin.mgr.MappingManager;
|
import xyz.wbsite.module.admin.rsp.MappingCreateResponse;
|
||||||
import com.example.module.admin.req.MappingCreateRequest;
|
import xyz.wbsite.module.admin.rsp.MappingFindResponse;
|
||||||
import com.example.module.admin.req.MappingFindRequest;
|
|
||||||
import com.example.module.admin.rsp.MappingCreateResponse;
|
|
||||||
import com.example.module.admin.rsp.MappingFindResponse;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
Binary file not shown.
@ -0,0 +1,22 @@
|
|||||||
|
package xyz.wbsite;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
import xyz.wbsite.frame.auth.LocalData;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableAutoConfiguration
|
||||||
|
public class Application extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(Application.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
LocalData.setApplicationContext(SpringApplication.run(Application.class, args));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package xyz.wbsite.action.ajax.conf;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.TreeNode;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import xyz.wbsite.frame.excel.WExcel;
|
||||||
|
import xyz.wbsite.frame.utils.LogUtil;
|
||||||
|
import xyz.wbsite.frame.auth.LocalData;
|
||||||
|
import xyz.wbsite.frame.base.ErrorType;
|
||||||
|
import xyz.wbsite.frame.utils.MapperUtil;
|
||||||
|
import xyz.wbsite.frame.base.BaseResponse;
|
||||||
|
import xyz.wbsite.frame.utils.ResponseUtil;
|
||||||
|
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||||
|
import xyz.wbsite.frame.excel.exception.ReadErrorException;
|
||||||
|
import xyz.wbsite.frame.excel.exception.TemplateNotMatchException;
|
||||||
|
import xyz.wbsite.module.conf.ent.Mapping;
|
||||||
|
import xyz.wbsite.module.conf.mgr.MappingManager;
|
||||||
|
import xyz.wbsite.module.conf.req.MappingCreateRequest;
|
||||||
|
import xyz.wbsite.module.conf.req.MappingDeleteRequest;
|
||||||
|
import xyz.wbsite.module.conf.req.MappingFindRequest;
|
||||||
|
import xyz.wbsite.module.conf.req.MappingGetRequest;
|
||||||
|
import xyz.wbsite.module.conf.req.MappingUpdateRequest;
|
||||||
|
import xyz.wbsite.module.conf.rsp.MappingCreateResponse;
|
||||||
|
import xyz.wbsite.module.conf.rsp.MappingDeleteResponse;
|
||||||
|
import xyz.wbsite.module.conf.rsp.MappingFindResponse;
|
||||||
|
import xyz.wbsite.module.conf.rsp.MappingGetResponse;
|
||||||
|
import xyz.wbsite.module.conf.rsp.MappingUpdateResponse;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MappingAjax{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MappingManager mappingManager;
|
||||||
|
|
||||||
|
public MappingCreateResponse create(MappingCreateRequest request) {
|
||||||
|
return mappingManager.create(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingDeleteResponse delete(MappingDeleteRequest request) {
|
||||||
|
return mappingManager.delete(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingUpdateResponse update(MappingUpdateRequest request) {
|
||||||
|
return mappingManager.update(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingFindResponse find(MappingFindRequest request) {
|
||||||
|
return mappingManager.find(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingGetResponse get(MappingGetRequest request) {
|
||||||
|
return mappingManager.get(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package xyz.wbsite.action.ajax.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import xyz.wbsite.frame.auth.LocalData;
|
||||||
|
import xyz.wbsite.frame.auth.Token;
|
||||||
|
import xyz.wbsite.frame.base.ErrorType;
|
||||||
|
import xyz.wbsite.frame.utils.CookieUtil;
|
||||||
|
import xyz.wbsite.frame.utils.IDgenerator;
|
||||||
|
import xyz.wbsite.frame.utils.MD5Util;
|
||||||
|
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||||
|
import xyz.wbsite.module.system.req.UserLoginRequest;
|
||||||
|
import xyz.wbsite.module.system.req.UserLogoutRequest;
|
||||||
|
import xyz.wbsite.module.system.rsp.UserLoginResponse;
|
||||||
|
import xyz.wbsite.module.system.rsp.UserLogoutResponse;
|
||||||
|
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class UserAjax {
|
||||||
|
|
||||||
|
@Value("${web.url.auth.admin}")
|
||||||
|
private String admin;
|
||||||
|
@Value("${web.url.auth.pwd}")
|
||||||
|
private String pwd;
|
||||||
|
|
||||||
|
public UserLoginResponse login(UserLoginRequest request, Token token, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
|
||||||
|
UserLoginResponse response = new UserLoginResponse();
|
||||||
|
|
||||||
|
ValidationUtil.validate(request, response);
|
||||||
|
if (response.hasError()) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.getUsername().equals(admin)) {//超级管理员登录
|
||||||
|
String generatePwd = MD5Util.generatePwd(request.getPassword());
|
||||||
|
if (!generatePwd.equals(pwd)) {
|
||||||
|
response.addError(ErrorType.BUSINESS_ERROR, "用户名或密码错误!");
|
||||||
|
} else {
|
||||||
|
Date current = new Date();
|
||||||
|
Calendar instance = Calendar.getInstance();
|
||||||
|
instance.setTime(current);
|
||||||
|
instance.add(Calendar.HOUR_OF_DAY, 1);//默认一个小时内有效
|
||||||
|
|
||||||
|
Token sysToken = LocalData.getSysToken();
|
||||||
|
sysToken.setToken(IDgenerator.nextUUID());
|
||||||
|
|
||||||
|
Cookie cookie = CookieUtil.newCookie("token", sysToken.getToken());
|
||||||
|
httpServletResponse.addCookie(cookie);
|
||||||
|
response.setToken(sysToken.getToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserLogoutResponse logout(UserLogoutRequest request, Token token) {
|
||||||
|
UserLogoutResponse response = new UserLogoutResponse();
|
||||||
|
CookieUtil.clearCookie("token");
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package xyz.wbsite.action.api.conf;
|
||||||
|
|
||||||
|
import xyz.wbsite.frame.auth.LocalData;
|
||||||
|
import xyz.wbsite.module.conf.mgr.MappingManager;
|
||||||
|
import xyz.wbsite.module.conf.req.*;
|
||||||
|
import xyz.wbsite.module.conf.rsp.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
public class MappingApi{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MappingManager mappingManager;
|
||||||
|
|
||||||
|
public MappingCreateResponse create(MappingCreateRequest request) {
|
||||||
|
return mappingManager.create(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingDeleteResponse delete(MappingDeleteRequest request) {
|
||||||
|
return mappingManager.delete(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingUpdateResponse update(MappingUpdateRequest request) {
|
||||||
|
return mappingManager.update(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingFindResponse find(MappingFindRequest request) {
|
||||||
|
return mappingManager.find(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingGetResponse get(MappingGetRequest request) {
|
||||||
|
return mappingManager.get(request, LocalData.getToken());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package xyz.wbsite.action.control;
|
||||||
|
|
||||||
|
import xyz.wbsite.frame.base.Control;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
public class Header extends Control {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec(Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package xyz.wbsite.action.screen;
|
||||||
|
|
||||||
|
import xyz.wbsite.frame.base.Screen;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
public class Index extends Screen {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec(Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
|
// 获取配置
|
||||||
|
HashMap<String, Object> prop = new HashMap<>();
|
||||||
|
prop.put("open", true);//是否保持一个子菜单展开
|
||||||
|
prop.put("coll", false);//左侧菜单是否收缩
|
||||||
|
prop.put("tran", false);//是否展示动画
|
||||||
|
prop.put("full", false);//是否全屏
|
||||||
|
model.addAttribute("prop", prop);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package xyz.wbsite.config;
|
||||||
|
|
||||||
|
import net.sf.ehcache.Cache;
|
||||||
|
import net.sf.ehcache.CacheManager;
|
||||||
|
import net.sf.ehcache.config.CacheConfiguration;
|
||||||
|
import net.sf.ehcache.config.DiskStoreConfiguration;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
|
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableCaching
|
||||||
|
public class CacheConfig {
|
||||||
|
|
||||||
|
public static final String TOKEN_CACHE = "tokenCache";
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public EhCacheCacheManager getCacheManager() {
|
||||||
|
net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration();
|
||||||
|
// todo 需根据服务器物理内存配置
|
||||||
|
configuration.setMaxBytesLocalHeap("128M");
|
||||||
|
configuration.updateCheck(false);
|
||||||
|
configuration.addDiskStore(new DiskStoreConfiguration().path("java.io.tmpdir"));
|
||||||
|
CacheManager cacheManager = CacheManager.create(configuration);
|
||||||
|
|
||||||
|
// 添加token缓存
|
||||||
|
cacheManager.addCache(buildTokenCache());
|
||||||
|
return new EhCacheCacheManager(cacheManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建TokenCache
|
||||||
|
*
|
||||||
|
* @return 缓存
|
||||||
|
*/
|
||||||
|
private Cache buildTokenCache() {
|
||||||
|
CacheConfiguration config = new CacheConfiguration();
|
||||||
|
config.setMemoryStoreEvictionPolicy("LFU");//最少使用
|
||||||
|
config.setTimeToLiveSeconds(60 * 60);//最长有效时间
|
||||||
|
config.setTimeToIdleSeconds(60 * 60);//无访问最长有效时间
|
||||||
|
config.setName(TOKEN_CACHE);
|
||||||
|
return new Cache(config);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,124 @@
|
|||||||
|
package xyz.wbsite.config;
|
||||||
|
|
||||||
|
import freemarker.template.SimpleScalar;
|
||||||
|
import freemarker.template.TemplateMethodModelEx;
|
||||||
|
import freemarker.template.TemplateModelException;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.validation.support.BindingAwareModelMap;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
import org.springframework.web.servlet.DispatcherServlet;
|
||||||
|
import org.springframework.web.servlet.LocaleResolver;
|
||||||
|
import org.springframework.web.servlet.View;
|
||||||
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
||||||
|
import xyz.wbsite.frame.auth.LocalData;
|
||||||
|
import xyz.wbsite.frame.base.Control;
|
||||||
|
import xyz.wbsite.frame.utils.UrlUtil;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static xyz.wbsite.config.ActionConfig.CONTROL_PREFIX;
|
||||||
|
import static xyz.wbsite.config.ActionConfig.SCREEN_PREFIX;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class FreeMarkerConfig {
|
||||||
|
@Autowired
|
||||||
|
private FreeMarkerViewResolver viewResolver;
|
||||||
|
@Autowired
|
||||||
|
private freemarker.template.Configuration configuration;
|
||||||
|
@Value("${server.servlet.context-path}")
|
||||||
|
private String context;
|
||||||
|
|
||||||
|
private String suffix = ".ftl";
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void setSharedVariable() throws TemplateModelException {
|
||||||
|
// 全局共享变量、函数
|
||||||
|
configuration.setSharedVariable("context", context);
|
||||||
|
configuration.setSharedVariable("screenHolder", new ScreenHolder());
|
||||||
|
configuration.setSharedVariable("controlHolder", new ControlHolder());
|
||||||
|
configuration.setSharedVariable("UrlUtil", new UrlUtil());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ScreenHolder implements TemplateMethodModelEx {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object exec(List list) throws TemplateModelException {
|
||||||
|
try {
|
||||||
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
|
LocaleResolver localeResolver = (LocaleResolver) request.getAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE);
|
||||||
|
String servletPath = LocalData.getAction();
|
||||||
|
servletPath = servletPath.replaceAll("^/", "");
|
||||||
|
|
||||||
|
String[] split = servletPath.split("/");
|
||||||
|
StringBuilder sb = new StringBuilder("");
|
||||||
|
|
||||||
|
// 分割组装路径
|
||||||
|
for (int i = 0; i < split.length; i++) {
|
||||||
|
sb.append(split[i]);
|
||||||
|
if (i != split.length - 1) {
|
||||||
|
sb.append(File.separator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Locale locale = localeResolver.resolveLocale(request);
|
||||||
|
String viewName = "screen" + File.separator + sb.toString();
|
||||||
|
View view = viewResolver.resolveViewName(viewName, locale);
|
||||||
|
//无法找到对应screen
|
||||||
|
if (view == null) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return SCREEN_PREFIX + servletPath + suffix;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ControlHolder implements TemplateMethodModelEx {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object exec(List list) throws TemplateModelException {
|
||||||
|
String control = "";
|
||||||
|
if (list.size() != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
Object o = list.get(0);
|
||||||
|
if (o instanceof SimpleScalar) {
|
||||||
|
control = ((SimpleScalar) o).getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找是否存在对应控制面板执行器
|
||||||
|
Control controlExec = null;
|
||||||
|
try {
|
||||||
|
String beanClassName = (CONTROL_PREFIX + control).toLowerCase();
|
||||||
|
controlExec = LocalData.getApplicationContext().getBean(beanClassName, Control.class);
|
||||||
|
|
||||||
|
HttpServletRequest request = LocalData.getRequest();
|
||||||
|
HttpServletResponse response = LocalData.getResponse();
|
||||||
|
|
||||||
|
BindingAwareModelMap modelMap = new BindingAwareModelMap();
|
||||||
|
controlExec.exec(modelMap, request, response);
|
||||||
|
|
||||||
|
for (String key : modelMap.keySet()) {
|
||||||
|
request.setAttribute(key, modelMap.get(key));
|
||||||
|
}
|
||||||
|
} catch (BeansException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
control = control.replaceAll("/", File.separator);
|
||||||
|
return CONTROL_PREFIX + control + suffix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package xyz.wbsite.config;
|
||||||
|
|
||||||
|
import xyz.wbsite.frame.utils.ResourceUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class SQLiteConfig {
|
||||||
|
|
||||||
|
@Value("${spring.datasource.url}")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void generateDB() {
|
||||||
|
Pattern compile = Pattern.compile("jdbc:sqlite:(.*.db).*");
|
||||||
|
Matcher matcher = compile.matcher(url);
|
||||||
|
if (matcher.find()) {
|
||||||
|
String group = matcher.group(1);
|
||||||
|
File file = new File(group);
|
||||||
|
if (!file.exists()) {
|
||||||
|
File path = file.getAbsoluteFile().getParentFile();
|
||||||
|
if (!path.exists()) path.mkdirs();
|
||||||
|
ResourceUtil.copyResource2File("nginx-admin.db", file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
package xyz.wbsite.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
|
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.builders.WebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
|
||||||
|
import xyz.wbsite.frame.auth.LocalData;
|
||||||
|
import xyz.wbsite.frame.auth.Token;
|
||||||
|
import xyz.wbsite.frame.utils.CookieUtil;
|
||||||
|
|
||||||
|
import javax.servlet.Filter;
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableGlobalMethodSecurity(securedEnabled = true)
|
||||||
|
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
|
@Value("${web.url.auth.included}")
|
||||||
|
private String[] included;
|
||||||
|
@Value("${web.url.auth.excluded}")
|
||||||
|
private String[] excluded;
|
||||||
|
@Value("${spring.mvc.static-path-pattern}")
|
||||||
|
private String[] staticPath;
|
||||||
|
@Value("${web.login.page}")
|
||||||
|
private String loginPage;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(WebSecurity web) throws Exception {
|
||||||
|
web.ignoring().mvcMatchers(staticPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
|
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||||
|
.and()
|
||||||
|
.addFilterBefore(new TokenFilter(), FilterSecurityInterceptor.class)// 过滤器用于处理Token
|
||||||
|
.authorizeRequests()
|
||||||
|
.antMatchers(excluded).permitAll()// 放行排除的URL
|
||||||
|
.antMatchers(included).access("@Authorization.hasPermission(request,authentication)")// 需要权限的URL
|
||||||
|
.and().cors()
|
||||||
|
.and().headers().frameOptions().disable()
|
||||||
|
.and().csrf().disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此方法不要删除 用于屏蔽默认用户密码生成
|
||||||
|
* <p>
|
||||||
|
* 例如 Using generated security password: f6b42a66-71b1-4c31-b6a8-942838c81408
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public AuthenticationManager authenticationManagerBean() throws Exception {
|
||||||
|
return super.authenticationManagerBean();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TokenFilter implements Filter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||||
|
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||||
|
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||||
|
String token = request.getParameter("token");
|
||||||
|
if (token == null || token.isEmpty()) {
|
||||||
|
token = CookieUtil.getCookieValue(request.getCookies(), "token");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组装Token ~ 这边根据实际的业务组装Token
|
||||||
|
if (token != null) {
|
||||||
|
LocalData.setToken( LocalData.getSysToken());
|
||||||
|
} else {
|
||||||
|
LocalData.setToken(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action
|
||||||
|
String servletPath = request.getServletPath().toLowerCase();
|
||||||
|
Pattern compile = Pattern.compile("^/(.+)\\.htm");
|
||||||
|
Matcher matcher = compile.matcher(servletPath);
|
||||||
|
if (matcher.find()) {
|
||||||
|
LocalData.setAction(matcher.group(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
filterChain.doFilter(servletRequest, servletResponse);
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
response.sendError(HttpServletResponse.SC_FORBIDDEN);
|
||||||
|
} catch (Exception e) {
|
||||||
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean("Authorization")
|
||||||
|
public Object getAuthorization() {
|
||||||
|
return new Object() {
|
||||||
|
public boolean hasPermission(HttpServletRequest request, Authentication authentication) {
|
||||||
|
|
||||||
|
Token token_ = LocalData.getToken();
|
||||||
|
if (token_ == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String path = request.getServletPath();
|
||||||
|
if (token_.hasRes(path)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package xyz.wbsite.frame.auth;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
import xyz.wbsite.frame.auth.Token;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LocalData - 本地数据存放类
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2017-01-01
|
||||||
|
*/
|
||||||
|
public class LocalData {
|
||||||
|
|
||||||
|
private static ApplicationContext applicationContext = null;
|
||||||
|
|
||||||
|
private static Token system = null;
|
||||||
|
|
||||||
|
static {
|
||||||
|
// 组装系统Token
|
||||||
|
system = new Token();
|
||||||
|
system.setId(0);
|
||||||
|
system.setUserId(0);
|
||||||
|
system.setUserName("system");
|
||||||
|
system.putRes(".*");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Token getSysToken() {
|
||||||
|
return system;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当请求目标 target = '/aa/bb'
|
||||||
|
*/
|
||||||
|
private static final ThreadLocal<String> actionHolder = new ThreadLocal();
|
||||||
|
|
||||||
|
public static String getAction() {
|
||||||
|
return actionHolder.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setAction(String action) {
|
||||||
|
actionHolder.set(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前用户的通行证
|
||||||
|
*/
|
||||||
|
private static final ThreadLocal<Token> tokenHolder = new ThreadLocal();
|
||||||
|
|
||||||
|
public static Token getToken() {
|
||||||
|
return tokenHolder.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setToken(Token token) {
|
||||||
|
tokenHolder.set(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpServletRequest getRequest() {
|
||||||
|
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpServletResponse getResponse() {
|
||||||
|
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationContext getApplicationContext() {
|
||||||
|
return LocalData.applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setApplicationContext(ApplicationContext applicationContext) {
|
||||||
|
LocalData.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T getBean(Class<T> t) {
|
||||||
|
if (getApplicationContext() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return getApplicationContext().getBean(t);
|
||||||
|
} catch (BeansException ignored) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Environment getEnvironment() {
|
||||||
|
return getBean(Environment.class);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package xyz.wbsite.frame.auth;
|
||||||
|
|
||||||
|
import xyz.wbsite.frame.utils.IDgenerator;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token - 通行证类
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2017-01-01
|
||||||
|
*/
|
||||||
|
public class Token implements Serializable {
|
||||||
|
private static final Long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private long id;
|
||||||
|
/**
|
||||||
|
* TOKEN
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private long userId;
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
private Set<String> resSet = new HashSet<>();
|
||||||
|
|
||||||
|
public boolean hasRes(String res) {
|
||||||
|
for (String s : resSet) {
|
||||||
|
if (res.matches(s)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void putRes(String resource) {
|
||||||
|
resSet.add(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void putRes(Set<String> resourceSet) {
|
||||||
|
this.resSet.addAll(resourceSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Set<String> getResSet() {
|
||||||
|
return resSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,110 @@
|
|||||||
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base - 基类
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2017-01-01
|
||||||
|
*/
|
||||||
|
public class BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行版本
|
||||||
|
*/
|
||||||
|
private long rowVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
private long createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后更新用户
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
private long lastUpdateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后更新时间
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
private Date lastUpdateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
private boolean isDeleted;
|
||||||
|
|
||||||
|
public long getRowVersion() {
|
||||||
|
return rowVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowVersion(long rowVersion) {
|
||||||
|
this.rowVersion = rowVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreateBy() {
|
||||||
|
return createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateBy(long createBy) {
|
||||||
|
this.createBy = createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastUpdateBy() {
|
||||||
|
return lastUpdateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastUpdateBy(long lastUpdateBy) {
|
||||||
|
this.lastUpdateBy = lastUpdateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastUpdateTime() {
|
||||||
|
return lastUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastUpdateTime(Date lastUpdateTime) {
|
||||||
|
this.lastUpdateTime = lastUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsDeleted() {
|
||||||
|
return isDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDeleted(boolean deleted) {
|
||||||
|
isDeleted = deleted;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaseFindRequest - 基类
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2017-01-01
|
||||||
|
*/
|
||||||
|
public class BaseFindRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private int pageNumber = 1;
|
||||||
|
|
||||||
|
private int pageSize = 10;
|
||||||
|
|
||||||
|
private String sortKey;
|
||||||
|
|
||||||
|
private SortType sortType;
|
||||||
|
|
||||||
|
public int getPageNumber() {
|
||||||
|
return pageNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPageNumber(int pageNumber) {
|
||||||
|
this.pageNumber = pageNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPageSize() {
|
||||||
|
return pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPageSize(int pageSize) {
|
||||||
|
this.pageSize = pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSortKey() {
|
||||||
|
return sortKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortKey(String sortKey) {
|
||||||
|
this.sortKey = sortKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortType getSortType() {
|
||||||
|
return sortType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortType(SortType sortType) {
|
||||||
|
this.sortType = sortType;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package xyz.wbsite.frame.base;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaseFindResponse - 基类
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2017-01-01
|
||||||
|
*/
|
||||||
|
public class BaseFindResponse<T> extends BaseResponse{
|
||||||
|
|
||||||
|
private List<T> result;
|
||||||
|
|
||||||
|
private Long totalCount;
|
||||||
|
|
||||||
|
public List<T> getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResult(List<T> result) {
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTotalCount() {
|
||||||
|
return totalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalCount(Long totalCount) {
|
||||||
|
this.totalCount = totalCount;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue