parent
d21803c4fd
commit
11efd0fe35
@ -0,0 +1,19 @@
|
||||
package cn.jeefast;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MrWangApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MrWangApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(MrWangApplication.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.jeefast.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 系统日志注解
|
||||
*
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Log {
|
||||
|
||||
String value() default "";
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.jeefast.common.aspect;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import cn.jeefast.common.exception.RRException;
|
||||
|
||||
/**
|
||||
* Redis切面处理类
|
||||
*
|
||||
*/
|
||||
@Aspect
|
||||
@Configuration
|
||||
public class RedisAspect {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
//是否开启redis缓存 true开启 false关闭
|
||||
@Value("${renren.redis.open: false}")
|
||||
private boolean open;
|
||||
|
||||
@Around("execution(* cn.jeefast.common.utils.RedisUtils.*(..))")
|
||||
public Object around(ProceedingJoinPoint point) throws Throwable {
|
||||
Object result = null;
|
||||
if(open){
|
||||
try{
|
||||
result = point.proceed();
|
||||
}catch (Exception e){
|
||||
logger.error("redis error", e);
|
||||
throw new RRException("Redis服务异常");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.jeefast.common.base;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import cn.jeefast.system.entity.SysUser;
|
||||
|
||||
/**
|
||||
* Controller公共组件
|
||||
*
|
||||
*/
|
||||
public abstract class BaseController {
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
protected SysUser getUser() {
|
||||
return (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
}
|
||||
|
||||
protected Long getUserId() {
|
||||
return getUser().getUserId();
|
||||
}
|
||||
|
||||
protected Long getDeptId() {
|
||||
return getUser().getDeptId();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.jeefast.common.exception;
|
||||
|
||||
/**
|
||||
* 自定义异常
|
||||
*
|
||||
*/
|
||||
public class RRException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String msg;
|
||||
private int code = 500;
|
||||
|
||||
public RRException(String msg) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public RRException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public RRException(String msg, int code) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public RRException(String msg, int code, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.jeefast.common.exception;
|
||||
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import cn.jeefast.common.utils.R;
|
||||
|
||||
/**
|
||||
* 异常处理器
|
||||
*
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class RRExceptionHandler {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
/**
|
||||
* 自定义异常
|
||||
*/
|
||||
@ExceptionHandler(RRException.class)
|
||||
public R handleRRException(RRException e){
|
||||
R r = new R();
|
||||
r.put("code", e.getCode());
|
||||
r.put("msg", e.getMessage());
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@ExceptionHandler(DuplicateKeyException.class)
|
||||
public R handleDuplicateKeyException(DuplicateKeyException e){
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error("数据库中已存在该记录");
|
||||
}
|
||||
|
||||
@ExceptionHandler(AuthorizationException.class)
|
||||
public R handleAuthorizationException(AuthorizationException e){
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error("没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public R handleException(Exception e){
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error();
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package cn.jeefast.common.utils;
|
||||
|
||||
/**
|
||||
* 常量
|
||||
*
|
||||
*/
|
||||
public class Constant {
|
||||
/** 超级管理员ID */
|
||||
public static final int SUPER_ADMIN = 1;
|
||||
|
||||
/**
|
||||
* 菜单类型
|
||||
*
|
||||
*/
|
||||
public enum MenuType {
|
||||
/**
|
||||
* 目录
|
||||
*/
|
||||
CATALOG(0),
|
||||
/**
|
||||
* 菜单
|
||||
*/
|
||||
MENU(1),
|
||||
/**
|
||||
* 按钮
|
||||
*/
|
||||
BUTTON(2);
|
||||
|
||||
private int value;
|
||||
|
||||
private MenuType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务状态
|
||||
*
|
||||
*/
|
||||
public enum ScheduleStatus {
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
NORMAL(0),
|
||||
/**
|
||||
* 暂停
|
||||
*/
|
||||
PAUSE(1);
|
||||
|
||||
private int value;
|
||||
|
||||
private ScheduleStatus(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 云服务商
|
||||
*/
|
||||
public enum CloudService {
|
||||
/**
|
||||
* 七牛云
|
||||
*/
|
||||
QINIU(1),
|
||||
/**
|
||||
* 阿里云
|
||||
*/
|
||||
ALIYUN(2),
|
||||
/**
|
||||
* 腾讯云
|
||||
*/
|
||||
QCLOUD(3);
|
||||
|
||||
private int value;
|
||||
|
||||
private CloudService(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.jeefast.common.utils;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class HttpContextUtils {
|
||||
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.jeefast.common.utils;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
*
|
||||
*/
|
||||
public class R extends HashMap<String, Object> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public R() {
|
||||
put("code", 0);
|
||||
}
|
||||
|
||||
public static R error() {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员");
|
||||
}
|
||||
|
||||
public static R error(String msg) {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg);
|
||||
}
|
||||
|
||||
public static R error(int code, String msg) {
|
||||
R r = new R();
|
||||
r.put("code", code);
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(String msg) {
|
||||
R r = new R();
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(Map<String, Object> map) {
|
||||
R r = new R();
|
||||
r.putAll(map);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok() {
|
||||
return new R();
|
||||
}
|
||||
|
||||
public R put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.jeefast.common.utils;
|
||||
|
||||
/**
|
||||
* Redis所有Keys
|
||||
*
|
||||
*/
|
||||
public class RedisKeys {
|
||||
|
||||
public static String getSysConfigKey(String key){
|
||||
return "sys:config:" + key;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.jeefast.common.utils;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
||||
import cn.jeefast.common.exception.RRException;
|
||||
import cn.jeefast.system.entity.SysUser;
|
||||
|
||||
/**
|
||||
* Shiro工具类
|
||||
*
|
||||
*/
|
||||
public class ShiroUtils {
|
||||
|
||||
public static Session getSession() {
|
||||
return SecurityUtils.getSubject().getSession();
|
||||
}
|
||||
|
||||
public static Subject getSubject() {
|
||||
return SecurityUtils.getSubject();
|
||||
}
|
||||
|
||||
public static SysUser getUser() {
|
||||
return (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
}
|
||||
|
||||
public static Long getUserId() {
|
||||
return getUser().getUserId();
|
||||
}
|
||||
|
||||
public static void setSessionAttribute(Object key, Object value) {
|
||||
getSession().setAttribute(key, value);
|
||||
}
|
||||
|
||||
public static Object getSessionAttribute(Object key) {
|
||||
return getSession().getAttribute(key);
|
||||
}
|
||||
|
||||
public static boolean isLogin() {
|
||||
return SecurityUtils.getSubject().getPrincipal() != null;
|
||||
}
|
||||
|
||||
public static void logout() {
|
||||
SecurityUtils.getSubject().logout();
|
||||
}
|
||||
|
||||
public static String getKaptcha(String key) {
|
||||
Object kaptcha = getSessionAttribute(key);
|
||||
if(kaptcha == null){
|
||||
throw new RRException("验证码已失效");
|
||||
}
|
||||
getSession().removeAttribute(key);
|
||||
return kaptcha.toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.jeefast.common.utils;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Spring Context 工具类
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class SpringContextUtils implements ApplicationContextAware {
|
||||
public static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext)
|
||||
throws BeansException {
|
||||
SpringContextUtils.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public static Object getBean(String name) {
|
||||
return applicationContext.getBean(name);
|
||||
}
|
||||
|
||||
public static <T> T getBean(String name, Class<T> requiredType) {
|
||||
return applicationContext.getBean(name, requiredType);
|
||||
}
|
||||
|
||||
public static boolean containsBean(String name) {
|
||||
return applicationContext.containsBean(name);
|
||||
}
|
||||
|
||||
public static boolean isSingleton(String name) {
|
||||
return applicationContext.isSingleton(name);
|
||||
}
|
||||
|
||||
public static Class<? extends Object> getType(String name) {
|
||||
return applicationContext.getType(name);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.jeefast.common.validator;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import cn.jeefast.common.exception.RRException;
|
||||
|
||||
/**
|
||||
* 数据校验
|
||||
*/
|
||||
public abstract class Assert {
|
||||
|
||||
public static void isBlank(String str, String message) {
|
||||
if (StringUtils.isBlank(str)) {
|
||||
throw new RRException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNull(Object object, String message) {
|
||||
if (object == null) {
|
||||
throw new RRException(message);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package cn.jeefast.common.validator.group;
|
||||
|
||||
/**
|
||||
* 新增数据 Group
|
||||
*/
|
||||
public interface AddGroup {
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package cn.jeefast.common.validator.group;
|
||||
|
||||
/**
|
||||
* 更新数据 Group
|
||||
*/
|
||||
|
||||
public interface UpdateGroup {
|
||||
|
||||
}
|
@ -0,0 +1,527 @@
|
||||
package cn.jeefast.common.xss;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
* HTML filtering utility for protecting against XSS (Cross Site Scripting).
|
||||
*
|
||||
* This code is licensed LGPLv3
|
||||
*
|
||||
* This code is a Java port of the original work in PHP by Cal Hendersen.
|
||||
* http://code.iamcal.com/php/lib_filter/
|
||||
*
|
||||
* The trickiest part of the translation was handling the differences in regex handling
|
||||
* between PHP and Java. These resources were helpful in the process:
|
||||
*
|
||||
* http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
|
||||
* http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php
|
||||
* http://www.regular-expressions.info/modifiers.html
|
||||
*
|
||||
* A note on naming conventions: instance variables are prefixed with a "v"; global
|
||||
* constants are in all caps.
|
||||
*
|
||||
* Sample use:
|
||||
* String input = ...
|
||||
* String clean = new HTMLFilter().filter( input );
|
||||
*
|
||||
* The class is not thread safe. Create a new instance if in doubt.
|
||||
*
|
||||
* If you find bugs or have suggestions on improvement (especially regarding
|
||||
* performance), please contact us. The latest version of this
|
||||
* source, and our contact details, can be found at http://xss-html-filter.sf.net
|
||||
*
|
||||
*/
|
||||
public final class HTMLFilter {
|
||||
|
||||
/** regex flag union representing /si modifiers in php **/
|
||||
private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL;
|
||||
private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL);
|
||||
private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI);
|
||||
private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL);
|
||||
private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI);
|
||||
private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI);
|
||||
private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI);
|
||||
private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI);
|
||||
private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI);
|
||||
private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?");
|
||||
private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?");
|
||||
private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?");
|
||||
private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))");
|
||||
private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL);
|
||||
private static final Pattern P_END_ARROW = Pattern.compile("^>");
|
||||
private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)");
|
||||
private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)");
|
||||
private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)");
|
||||
private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)");
|
||||
private static final Pattern P_AMP = Pattern.compile("&");
|
||||
private static final Pattern P_QUOTE = Pattern.compile("<");
|
||||
private static final Pattern P_LEFT_ARROW = Pattern.compile("<");
|
||||
private static final Pattern P_RIGHT_ARROW = Pattern.compile(">");
|
||||
private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>");
|
||||
|
||||
// @xxx could grow large... maybe use sesat's ReferenceMap
|
||||
private static final ConcurrentMap<String,Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<String, Pattern>();
|
||||
private static final ConcurrentMap<String,Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<String, Pattern>();
|
||||
|
||||
/** set of allowed html elements, along with allowed attributes for each element **/
|
||||
private final Map<String, List<String>> vAllowed;
|
||||
/** counts of open tags for each (allowable) html element **/
|
||||
private final Map<String, Integer> vTagCounts = new HashMap<String, Integer>();
|
||||
|
||||
/** html elements which must always be self-closing (e.g. "<img />") **/
|
||||
private final String[] vSelfClosingTags;
|
||||
/** html elements which must always have separate opening and closing tags (e.g. "<b></b>") **/
|
||||
private final String[] vNeedClosingTags;
|
||||
/** set of disallowed html elements **/
|
||||
private final String[] vDisallowed;
|
||||
/** attributes which should be checked for valid protocols **/
|
||||
private final String[] vProtocolAtts;
|
||||
/** allowed protocols **/
|
||||
private final String[] vAllowedProtocols;
|
||||
/** tags which should be removed if they contain no content (e.g. "<b></b>" or "<b />") **/
|
||||
private final String[] vRemoveBlanks;
|
||||
/** entities allowed within html markup **/
|
||||
private final String[] vAllowedEntities;
|
||||
/** flag determining whether comments are allowed in input String. */
|
||||
private final boolean stripComment;
|
||||
private final boolean encodeQuotes;
|
||||
private boolean vDebug = false;
|
||||
/**
|
||||
* flag determining whether to try to make tags when presented with "unbalanced"
|
||||
* angle brackets (e.g. "<b text </b>" becomes "<b> text </b>"). If set to false,
|
||||
* unbalanced angle brackets will be html escaped.
|
||||
*/
|
||||
private final boolean alwaysMakeTags;
|
||||
|
||||
/** Default constructor.
|
||||
*
|
||||
*/
|
||||
public HTMLFilter() {
|
||||
vAllowed = new HashMap<>();
|
||||
|
||||
final ArrayList<String> a_atts = new ArrayList<String>();
|
||||
a_atts.add("href");
|
||||
a_atts.add("target");
|
||||
vAllowed.put("a", a_atts);
|
||||
|
||||
final ArrayList<String> img_atts = new ArrayList<String>();
|
||||
img_atts.add("src");
|
||||
img_atts.add("width");
|
||||
img_atts.add("height");
|
||||
img_atts.add("alt");
|
||||
vAllowed.put("img", img_atts);
|
||||
|
||||
final ArrayList<String> no_atts = new ArrayList<String>();
|
||||
vAllowed.put("b", no_atts);
|
||||
vAllowed.put("strong", no_atts);
|
||||
vAllowed.put("i", no_atts);
|
||||
vAllowed.put("em", no_atts);
|
||||
|
||||
vSelfClosingTags = new String[]{"img"};
|
||||
vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"};
|
||||
vDisallowed = new String[]{};
|
||||
vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp.
|
||||
vProtocolAtts = new String[]{"src", "href"};
|
||||
vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"};
|
||||
vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"};
|
||||
stripComment = true;
|
||||
encodeQuotes = true;
|
||||
alwaysMakeTags = true;
|
||||
}
|
||||
|
||||
/** Set debug flag to true. Otherwise use default settings. See the default constructor.
|
||||
*
|
||||
* @param debug turn debug on with a true argument
|
||||
*/
|
||||
public HTMLFilter(final boolean debug) {
|
||||
this();
|
||||
vDebug = debug;
|
||||
|
||||
}
|
||||
|
||||
/** Map-parameter configurable constructor.
|
||||
*
|
||||
* @param conf map containing configuration. keys match field names.
|
||||
*/
|
||||
public HTMLFilter(final Map<String,Object> conf) {
|
||||
|
||||
assert conf.containsKey("vAllowed") : "configuration requires vAllowed";
|
||||
assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags";
|
||||
assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags";
|
||||
assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed";
|
||||
assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols";
|
||||
assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts";
|
||||
assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks";
|
||||
assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities";
|
||||
|
||||
vAllowed = Collections.unmodifiableMap((HashMap<String, List<String>>) conf.get("vAllowed"));
|
||||
vSelfClosingTags = (String[]) conf.get("vSelfClosingTags");
|
||||
vNeedClosingTags = (String[]) conf.get("vNeedClosingTags");
|
||||
vDisallowed = (String[]) conf.get("vDisallowed");
|
||||
vAllowedProtocols = (String[]) conf.get("vAllowedProtocols");
|
||||
vProtocolAtts = (String[]) conf.get("vProtocolAtts");
|
||||
vRemoveBlanks = (String[]) conf.get("vRemoveBlanks");
|
||||
vAllowedEntities = (String[]) conf.get("vAllowedEntities");
|
||||
stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true;
|
||||
encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true;
|
||||
alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true;
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
vTagCounts.clear();
|
||||
}
|
||||
|
||||
private void debug(final String msg) {
|
||||
if (vDebug) {
|
||||
Logger.getAnonymousLogger().info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// my versions of some PHP library functions
|
||||
public static String chr(final int decimal) {
|
||||
return String.valueOf((char) decimal);
|
||||
}
|
||||
|
||||
public static String htmlSpecialChars(final String s) {
|
||||
String result = s;
|
||||
result = regexReplace(P_AMP, "&", result);
|
||||
result = regexReplace(P_QUOTE, """, result);
|
||||
result = regexReplace(P_LEFT_ARROW, "<", result);
|
||||
result = regexReplace(P_RIGHT_ARROW, ">", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
/**
|
||||
* given a user submitted input String, filter out any invalid or restricted
|
||||
* html.
|
||||
*
|
||||
* @param input text (i.e. submitted by a user) than may contain html
|
||||
* @return "clean" version of input, with only valid, whitelisted html elements allowed
|
||||
*/
|
||||
public String filter(final String input) {
|
||||
reset();
|
||||
String s = input;
|
||||
|
||||
debug("************************************************");
|
||||
debug(" INPUT: " + input);
|
||||
|
||||
s = escapeComments(s);
|
||||
debug(" escapeComments: " + s);
|
||||
|
||||
s = balanceHTML(s);
|
||||
debug(" balanceHTML: " + s);
|
||||
|
||||
s = checkTags(s);
|
||||
debug(" checkTags: " + s);
|
||||
|
||||
s = processRemoveBlanks(s);
|
||||
debug("processRemoveBlanks: " + s);
|
||||
|
||||
s = validateEntities(s);
|
||||
debug(" validateEntites: " + s);
|
||||
|
||||
debug("************************************************\n\n");
|
||||
return s;
|
||||
}
|
||||
|
||||
public boolean isAlwaysMakeTags(){
|
||||
return alwaysMakeTags;
|
||||
}
|
||||
|
||||
public boolean isStripComments(){
|
||||
return stripComment;
|
||||
}
|
||||
|
||||
private String escapeComments(final String s) {
|
||||
final Matcher m = P_COMMENTS.matcher(s);
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
if (m.find()) {
|
||||
final String match = m.group(1); //(.*?)
|
||||
m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
|
||||
}
|
||||
m.appendTail(buf);
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private String balanceHTML(String s) {
|
||||
if (alwaysMakeTags) {
|
||||
//
|
||||
// try and form html
|
||||
//
|
||||
s = regexReplace(P_END_ARROW, "", s);
|
||||
s = regexReplace(P_BODY_TO_END, "<$1>", s);
|
||||
s = regexReplace(P_XML_CONTENT, "$1<$2", s);
|
||||
|
||||
} else {
|
||||
//
|
||||
// escape stray brackets
|
||||
//
|
||||
s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s);
|
||||
s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s);
|
||||
|
||||
//
|
||||
// the last regexp causes '<>' entities to appear
|
||||
// (we need to do a lookahead assertion so that the last bracket can
|
||||
// be used in the next pass of the regexp)
|
||||
//
|
||||
s = regexReplace(P_BOTH_ARROWS, "", s);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
private String checkTags(String s) {
|
||||
Matcher m = P_TAGS.matcher(s);
|
||||
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
while (m.find()) {
|
||||
String replaceStr = m.group(1);
|
||||
replaceStr = processTag(replaceStr);
|
||||
m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr));
|
||||
}
|
||||
m.appendTail(buf);
|
||||
|
||||
s = buf.toString();
|
||||
|
||||
// these get tallied in processTag
|
||||
// (remember to reset before subsequent calls to filter method)
|
||||
for (String key : vTagCounts.keySet()) {
|
||||
for (int ii = 0; ii < vTagCounts.get(key); ii++) {
|
||||
s += "</" + key + ">";
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
private String processRemoveBlanks(final String s) {
|
||||
String result = s;
|
||||
for (String tag : vRemoveBlanks) {
|
||||
if(!P_REMOVE_PAIR_BLANKS.containsKey(tag)){
|
||||
P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?></" + tag + ">"));
|
||||
}
|
||||
result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result);
|
||||
if(!P_REMOVE_SELF_BLANKS.containsKey(tag)){
|
||||
P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>"));
|
||||
}
|
||||
result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) {
|
||||
Matcher m = regex_pattern.matcher(s);
|
||||
return m.replaceAll(replacement);
|
||||
}
|
||||
|
||||
private String processTag(final String s) {
|
||||
// ending tags
|
||||
Matcher m = P_END_TAG.matcher(s);
|
||||
if (m.find()) {
|
||||
final String name = m.group(1).toLowerCase();
|
||||
if (allowed(name)) {
|
||||
if (!inArray(name, vSelfClosingTags)) {
|
||||
if (vTagCounts.containsKey(name)) {
|
||||
vTagCounts.put(name, vTagCounts.get(name) - 1);
|
||||
return "</" + name + ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// starting tags
|
||||
m = P_START_TAG.matcher(s);
|
||||
if (m.find()) {
|
||||
final String name = m.group(1).toLowerCase();
|
||||
final String body = m.group(2);
|
||||
String ending = m.group(3);
|
||||
|
||||
//debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" );
|
||||
if (allowed(name)) {
|
||||
String params = "";
|
||||
|
||||
final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body);
|
||||
final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body);
|
||||
final List<String> paramNames = new ArrayList<String>();
|
||||
final List<String> paramValues = new ArrayList<String>();
|
||||
while (m2.find()) {
|
||||
paramNames.add(m2.group(1)); //([a-z0-9]+)
|
||||
paramValues.add(m2.group(3)); //(.*?)
|
||||
}
|
||||
while (m3.find()) {
|
||||
paramNames.add(m3.group(1)); //([a-z0-9]+)
|
||||
paramValues.add(m3.group(3)); //([^\"\\s']+)
|
||||
}
|
||||
|
||||
String paramName, paramValue;
|
||||
for (int ii = 0; ii < paramNames.size(); ii++) {
|
||||
paramName = paramNames.get(ii).toLowerCase();
|
||||
paramValue = paramValues.get(ii);
|
||||
|
||||
// debug( "paramName='" + paramName + "'" );
|
||||
// debug( "paramValue='" + paramValue + "'" );
|
||||
// debug( "allowed? " + vAllowed.get( name ).contains( paramName ) );
|
||||
|
||||
if (allowedAttribute(name, paramName)) {
|
||||
if (inArray(paramName, vProtocolAtts)) {
|
||||
paramValue = processParamProtocol(paramValue);
|
||||
}
|
||||
params += " " + paramName + "=\"" + paramValue + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (inArray(name, vSelfClosingTags)) {
|
||||
ending = " /";
|
||||
}
|
||||
|
||||
if (inArray(name, vNeedClosingTags)) {
|
||||
ending = "";
|
||||
}
|
||||
|
||||
if (ending == null || ending.length() < 1) {
|
||||
if (vTagCounts.containsKey(name)) {
|
||||
vTagCounts.put(name, vTagCounts.get(name) + 1);
|
||||
} else {
|
||||
vTagCounts.put(name, 1);
|
||||
}
|
||||
} else {
|
||||
ending = " /";
|
||||
}
|
||||
return "<" + name + params + ending + ">";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// comments
|
||||
m = P_COMMENT.matcher(s);
|
||||
if (!stripComment && m.find()) {
|
||||
return "<" + m.group() + ">";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private String processParamProtocol(String s) {
|
||||
s = decodeEntities(s);
|
||||
final Matcher m = P_PROTOCOL.matcher(s);
|
||||
if (m.find()) {
|
||||
final String protocol = m.group(1);
|
||||
if (!inArray(protocol, vAllowedProtocols)) {
|
||||
// bad protocol, turn into local anchor link instead
|
||||
s = "#" + s.substring(protocol.length() + 1, s.length());
|
||||
if (s.startsWith("#//")) {
|
||||
s = "#" + s.substring(3, s.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
private String decodeEntities(String s) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
Matcher m = P_ENTITY.matcher(s);
|
||||
while (m.find()) {
|
||||
final String match = m.group(1);
|
||||
final int decimal = Integer.decode(match).intValue();
|
||||
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
|
||||
}
|
||||
m.appendTail(buf);
|
||||
s = buf.toString();
|
||||
|
||||
buf = new StringBuffer();
|
||||
m = P_ENTITY_UNICODE.matcher(s);
|
||||
while (m.find()) {
|
||||
final String match = m.group(1);
|
||||
final int decimal = Integer.valueOf(match, 16).intValue();
|
||||
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
|
||||
}
|
||||
m.appendTail(buf);
|
||||
s = buf.toString();
|
||||
|
||||
buf = new StringBuffer();
|
||||
m = P_ENCODE.matcher(s);
|
||||
while (m.find()) {
|
||||
final String match = m.group(1);
|
||||
final int decimal = Integer.valueOf(match, 16).intValue();
|
||||
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
|
||||
}
|
||||
m.appendTail(buf);
|
||||
s = buf.toString();
|
||||
|
||||
s = validateEntities(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
private String validateEntities(final String s) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
// validate entities throughout the string
|
||||
Matcher m = P_VALID_ENTITIES.matcher(s);
|
||||
while (m.find()) {
|
||||
final String one = m.group(1); //([^&;]*)
|
||||
final String two = m.group(2); //(?=(;|&|$))
|
||||
m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two)));
|
||||
}
|
||||
m.appendTail(buf);
|
||||
|
||||
return encodeQuotes(buf.toString());
|
||||
}
|
||||
|
||||
private String encodeQuotes(final String s){
|
||||
if(encodeQuotes){
|
||||
StringBuffer buf = new StringBuffer();
|
||||
Matcher m = P_VALID_QUOTES.matcher(s);
|
||||
while (m.find()) {
|
||||
final String one = m.group(1); //(>|^)
|
||||
final String two = m.group(2); //([^<]+?)
|
||||
final String three = m.group(3); //(<|$)
|
||||
m.appendReplacement(buf, Matcher.quoteReplacement(one + regexReplace(P_QUOTE, """, two) + three));
|
||||
}
|
||||
m.appendTail(buf);
|
||||
return buf.toString();
|
||||
}else{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
private String checkEntity(final String preamble, final String term) {
|
||||
|
||||
return ";".equals(term) && isValidEntity(preamble)
|
||||
? '&' + preamble
|
||||
: "&" + preamble;
|
||||
}
|
||||
|
||||
private boolean isValidEntity(final String entity) {
|
||||
return inArray(entity, vAllowedEntities);
|
||||
}
|
||||
|
||||
private static boolean inArray(final String s, final String[] array) {
|
||||
for (String item : array) {
|
||||
if (item != null && item.equals(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean allowed(final String name) {
|
||||
return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed);
|
||||
}
|
||||
|
||||
private boolean allowedAttribute(final String name, final String paramName) {
|
||||
return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName));
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.jeefast.common.xss;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import cn.jeefast.common.exception.RRException;
|
||||
|
||||
/**
|
||||
* SQL过滤
|
||||
*/
|
||||
public class SQLFilter {
|
||||
|
||||
/**
|
||||
* SQL注入过滤
|
||||
* @param str 待验证的字符串
|
||||
*/
|
||||
public static String sqlInject(String str){
|
||||
if(StringUtils.isBlank(str)){
|
||||
return null;
|
||||
}
|
||||
//去掉'|"|;|\字符
|
||||
str = StringUtils.replace(str, "'", "");
|
||||
str = StringUtils.replace(str, "\"", "");
|
||||
str = StringUtils.replace(str, ";", "");
|
||||
str = StringUtils.replace(str, "\\", "");
|
||||
|
||||
//转换成小写
|
||||
str = str.toLowerCase();
|
||||
|
||||
//非法字符
|
||||
String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alert", "drop"};
|
||||
|
||||
//判断是否包含非法字符
|
||||
for(String keyword : keywords){
|
||||
if(str.indexOf(keyword) != -1){
|
||||
throw new RRException("包含非法字符");
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.jeefast.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;
|
||||
|
||||
|
||||
/**
|
||||
* 生成验证码配置
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class KaptchaConfig {
|
||||
|
||||
@Bean
|
||||
public DefaultKaptcha producer() {
|
||||
Properties properties = new Properties();
|
||||
properties.put("kaptcha.border", "no");
|
||||
properties.put("kaptcha.textproducer.font.color", "black");
|
||||
properties.put("kaptcha.textproducer.char.space", "5");
|
||||
Config config = new Config(properties);
|
||||
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
||||
defaultKaptcha.setConfig(config);
|
||||
return defaultKaptcha;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.jeefast.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.*;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
/**
|
||||
* Redis配置
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
@Autowired
|
||||
private RedisConnectionFactory factory;
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate() {
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(new StringRedisSerializer());
|
||||
redisTemplate.setValueSerializer(new StringRedisSerializer());
|
||||
redisTemplate.setConnectionFactory(factory);
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForHash();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ValueOperations<String, String> valueOperations(RedisTemplate<String, String> redisTemplate) {
|
||||
return redisTemplate.opsForValue();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForList();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForSet();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
|
||||
return redisTemplate.opsForZSet();
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package cn.jeefast.config;
|
||||
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.apache.shiro.session.mgt.SessionManager;
|
||||
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
||||
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import cn.jeefast.system.oauth2.OAuth2Filter;
|
||||
import cn.jeefast.system.oauth2.OAuth2Realm;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Shiro配置
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ShiroConfig {
|
||||
|
||||
@Bean("sessionManager")
|
||||
public SessionManager sessionManager(){
|
||||
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
|
||||
sessionManager.setSessionValidationSchedulerEnabled(true);
|
||||
sessionManager.setSessionIdUrlRewritingEnabled(false);
|
||||
//sessionManager.setSessionIdCookieEnabled(false);
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
@Bean("securityManager")
|
||||
public SecurityManager securityManager(OAuth2Realm oAuth2Realm, SessionManager sessionManager) {
|
||||
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
|
||||
securityManager.setRealm(oAuth2Realm);
|
||||
securityManager.setSessionManager(sessionManager);
|
||||
|
||||
return securityManager;
|
||||
}
|
||||
|
||||
@Bean("shiroFilter")
|
||||
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
|
||||
ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
|
||||
shiroFilter.setSecurityManager(securityManager);
|
||||
|
||||
//oauth过滤
|
||||
Map<String, Filter> filters = new HashMap<>();
|
||||
filters.put("oauth2", new OAuth2Filter());
|
||||
shiroFilter.setFilters(filters);
|
||||
|
||||
Map<String, String> filterMap = new LinkedHashMap<>();
|
||||
filterMap.put("/webjars/**", "anon");
|
||||
filterMap.put("/druid/**", "anon");
|
||||
filterMap.put("/api/**", "anon");
|
||||
filterMap.put("/sys/login", "anon");
|
||||
filterMap.put("/**/*.css", "anon");
|
||||
filterMap.put("/**/*.js", "anon");
|
||||
filterMap.put("/**/*.html", "anon");
|
||||
filterMap.put("/img/**", "anon");
|
||||
filterMap.put("/ueditor/**", "anon");
|
||||
filterMap.put("/fonts/**", "anon");
|
||||
filterMap.put("/plugins/**", "anon");
|
||||
filterMap.put("/swagger/**", "anon");
|
||||
filterMap.put("/favicon.ico", "anon");
|
||||
filterMap.put("/captcha.jpg", "anon");
|
||||
filterMap.put("/sys/regsave", "anon");
|
||||
|
||||
|
||||
// 文本编辑器
|
||||
filterMap.put("/**/*.eot", "anon");
|
||||
filterMap.put("/**/*.ttf", "anon");
|
||||
filterMap.put("/**/*.woff", "anon");
|
||||
|
||||
filterMap.put("/**/wx.jpg", "anon");
|
||||
filterMap.put("/**/zfb.jpg", "anon");
|
||||
|
||||
filterMap.put("/", "anon");
|
||||
filterMap.put("/**", "oauth2");
|
||||
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
||||
|
||||
return shiroFilter;
|
||||
}
|
||||
|
||||
@Bean("lifecycleBeanPostProcessor")
|
||||
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
|
||||
return new LifecycleBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
|
||||
DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator();
|
||||
proxyCreator.setProxyTargetClass(true);
|
||||
return proxyCreator;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
|
||||
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
|
||||
advisor.setSecurityManager(securityManager);
|
||||
return advisor;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.jeefast.datasources;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 测试
|
||||
*/
|
||||
@Service
|
||||
public class DataSourceTestService {
|
||||
// @Autowired
|
||||
// private TbUserService userService;
|
||||
//
|
||||
// public TbUser queryObject(Long userId){
|
||||
// return userService.selectById(userId);
|
||||
// }
|
||||
//
|
||||
// @DataSource(name = DataSourceNames.SECOND)
|
||||
// public TbUser queryObject2(Long userId){
|
||||
// return userService.selectById(userId);
|
||||
// }
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.jeefast.datasources;
|
||||
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 动态数据源
|
||||
*/
|
||||
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||
private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();
|
||||
|
||||
public DynamicDataSource(DataSource defaultTargetDataSource, Map<String, DataSource> targetDataSources) {
|
||||
super.setDefaultTargetDataSource(defaultTargetDataSource);
|
||||
super.setTargetDataSources(new HashMap<>(targetDataSources));
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey() {
|
||||
return getDataSource();
|
||||
}
|
||||
|
||||
public static void setDataSource(String dataSource) {
|
||||
contextHolder.set(dataSource);
|
||||
}
|
||||
|
||||
public static String getDataSource() {
|
||||
return contextHolder.get();
|
||||
}
|
||||
|
||||
public static void clearDataSource() {
|
||||
contextHolder.remove();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.jeefast.datasources;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 配置多数据源
|
||||
*/
|
||||
@Configuration
|
||||
public class DynamicDataSourceConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.first")
|
||||
public DataSource firstDataSource(){
|
||||
return DruidDataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public DynamicDataSource dataSource(DataSource firstDataSource, DataSource secondDataSource) {
|
||||
Map<String, DataSource> targetDataSources = new HashMap<>();
|
||||
targetDataSources.put(DataSourceNames.FIRST, firstDataSource);
|
||||
targetDataSources.put(DataSourceNames.SECOND, secondDataSource);
|
||||
return new DynamicDataSource(firstDataSource, targetDataSources);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.jeefast.datasources.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 多数据源注解
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataSource {
|
||||
String name() default "";
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
import cn.jeefast.system.entity.SysUser;
|
||||
import cn.jeefast.system.service.SysUserService;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
import cn.jeefast.common.utils.Constant;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.system.entity.SysDept;
|
||||
import cn.jeefast.system.service.SysDeptService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 部门管理
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/dept")
|
||||
public class SysDeptController extends BaseController {
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
//@RequiresPermissions("sys:dept:list")
|
||||
public List<SysDept> list(){
|
||||
List<SysDept> deptList = sysDeptService.queryList(new HashMap<>());
|
||||
|
||||
System.out.println("deptListdeptListdeptList"+deptList);
|
||||
return deptList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择部门(添加、修改菜单)
|
||||
*/
|
||||
@RequestMapping("/select")
|
||||
//@RequiresPermissions("sys:dept:select")
|
||||
public R select(){
|
||||
List<SysDept> deptList = sysDeptService.queryList(new HashMap<>());
|
||||
|
||||
//添加一级部门
|
||||
if(getUserId() == Constant.SUPER_ADMIN){
|
||||
SysDept root = new SysDept();
|
||||
root.setDeptId(0L);
|
||||
root.setName("一级部门");
|
||||
root.setParentId(-1L);
|
||||
root.setOpen(true);
|
||||
deptList.add(root);
|
||||
}
|
||||
return R.ok().put("deptList", deptList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上级部门Id(管理员则为0)
|
||||
*/
|
||||
@RequestMapping("/info")
|
||||
//@RequiresPermissions("sys:dept:list")
|
||||
public R info(){
|
||||
long deptId = 0;
|
||||
if(getUserId() != Constant.SUPER_ADMIN){
|
||||
SysDept dept = sysDeptService.selectById(getDeptId());
|
||||
deptId = dept.getParentId();
|
||||
}
|
||||
|
||||
return R.ok().put("deptId", deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{deptId}")
|
||||
//@RequiresPermissions("sys:dept:info")
|
||||
public R info(@PathVariable("deptId") Long deptId){
|
||||
SysDept dept = sysDeptService.selectById(deptId);
|
||||
|
||||
return R.ok().put("dept", dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
//@RequiresPermissions("sys:dept:save")
|
||||
public R save(@RequestBody SysDept dept){
|
||||
System.out.println("deptdeptdept"+dept);
|
||||
if(dept.getParentId() == 0){
|
||||
dept.setUpstr(",0,");
|
||||
}else{
|
||||
SysDept sysDeptFj = sysDeptService.selectById(dept.getParentId());
|
||||
dept.setUpstr(sysDeptFj.getUpstr()+sysDeptFj.getDeptId()+",");
|
||||
}
|
||||
sysDeptService.insert(dept);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
//@RequiresPermissions("sys:dept:update")
|
||||
public R update(@RequestBody SysDept dept){
|
||||
if(dept.getParentId() == 0){
|
||||
dept.setUpstr(",0,");
|
||||
}else{
|
||||
SysDept sysDeptFj = sysDeptService.selectById(dept.getParentId());
|
||||
dept.setUpstr(sysDeptFj.getUpstr()+sysDeptFj.getDeptId()+",");
|
||||
}
|
||||
sysDeptService.updateById(dept);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
//@RequiresPermissions("sys:dept:delete")
|
||||
public R delete(long deptId){
|
||||
//判断是否有子部门
|
||||
List<Long> deptList = sysDeptService.queryDetpIdList(deptId);
|
||||
if(deptList.size() > 0){
|
||||
return R.error("请先删除子部门");
|
||||
}
|
||||
//逻辑删除
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(deptId);
|
||||
dept.setDelFlag(-1);
|
||||
sysDeptService.updateById(dept);
|
||||
//物理删除
|
||||
//sysDeptService.delete(deptId);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,313 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.common.validator.Assert;
|
||||
import cn.jeefast.system.entity.*;
|
||||
import cn.jeefast.system.service.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysIndexQd")
|
||||
public class SysIndexQdController extends BaseController {
|
||||
|
||||
@Value("${server.port}")
|
||||
private String serverport;
|
||||
|
||||
@Value("${server.context-path}")
|
||||
private String servercontextpath;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysUserTokenService sysUserTokenService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TMaterialFileService tMaterialFileService;
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
@RequestMapping("/getUser")
|
||||
public R getUser(@RequestBody Map<String,Object> tjarray) throws UnknownHostException {
|
||||
System.out.println("tjarraytjarray"+tjarray);
|
||||
|
||||
SysUserToken sysUserToken = sysUserTokenService.selectOne(new EntityWrapper<SysUserToken>().eq("token",tjarray.get("token")+""));
|
||||
SysUser user = sysUserService.selectById(sysUserToken.getUserId());
|
||||
|
||||
/**
|
||||
* 设置头像信息
|
||||
*/
|
||||
List<TMaterialFile> tMaterialFileList = tMaterialFileService.selectList(new EntityWrapper<TMaterialFile>().eq("parentid",user.getUserId()));
|
||||
// SysUserToken sysUserToken = sysUserTokenService.selectOne(new EntityWrapper<SysUserToken>().eq("user_id", getUserId()));
|
||||
System.out.println("tMaterialFileListtMaterialFileList"+tMaterialFileList);
|
||||
InetAddress address = InetAddress.getLocalHost();
|
||||
user.setPhotopath(tMaterialFileList != null && tMaterialFileList.size()>0?"http://"+address.getHostAddress() +":"+serverport+"/"+servercontextpath+"/upload/"+tMaterialFileList.get(0).getSfilename()+"?token="+sysUserToken.getToken():"img/usermm.jpg");
|
||||
System.out.println("useruseruseruser"+user);
|
||||
|
||||
|
||||
//获取用户所属的角色列表
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
user.setRoleIdList(roleIdList);
|
||||
|
||||
//获取附件列表
|
||||
List<TMaterialFile> tMaterialFiles = tMaterialFileService.selectList(new EntityWrapper<TMaterialFile>().eq("parentid",user.getUserId()));
|
||||
List<Map<String,Object>> mapList = new ArrayList<>();
|
||||
if(!tMaterialFiles.isEmpty()){
|
||||
for(TMaterialFile tMaterialFile:tMaterialFiles){
|
||||
Map<String,Object> map =new HashMap<>();
|
||||
map.put("id",tMaterialFile.getId());
|
||||
map.put("filePath",tMaterialFile.getSfilename());
|
||||
map.put("fileName",tMaterialFile.getSaccessoryname());
|
||||
mapList.add(map);
|
||||
}
|
||||
}
|
||||
JSONArray json = (JSONArray) JSONArray.toJSON(mapList);
|
||||
user.setFiles(json);
|
||||
|
||||
return R.ok().put("sysuser",user);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像更新
|
||||
*/
|
||||
@RequestMapping("/userSaveFile")
|
||||
public R userSaveFile(@RequestBody JSONObject param){
|
||||
System.out.println("paramparamparam"+JSON.toJSONString(param));
|
||||
String userid = param.getString("userid");
|
||||
JSONArray allFiles = param.getJSONArray("allFiles");
|
||||
System.out.println("useriduseriduserid"+userid);
|
||||
System.out.println("allFilesallFilesallFiles"+JSON.toJSONString(allFiles));
|
||||
List<TMaterialFile> tMaterialFiles = tMaterialFileService.selectList(new EntityWrapper<TMaterialFile>().eq("parentid",userid));
|
||||
if (tMaterialFiles.size()>0){
|
||||
for (int i = 0; i < tMaterialFiles.size(); i++) {
|
||||
tMaterialFileService.deleteById(tMaterialFiles.get(i).getId());
|
||||
}
|
||||
}
|
||||
if(allFiles.size()>0){
|
||||
for (int i = 0; i < allFiles.size(); i++) {
|
||||
Map map = (Map) allFiles.get(i);
|
||||
TMaterialFile tMaterialFile = tMaterialFileService.selectById(map.get("id").toString());
|
||||
tMaterialFile.setParentid(userid);
|
||||
tMaterialFileService.updateById(tMaterialFile);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人信息更新
|
||||
*/
|
||||
@RequestMapping("/updateuser")
|
||||
public R updateuser(@RequestBody SysUser sysUser){
|
||||
System.out.println("sysUsersysUser"+sysUser);
|
||||
sysUserService.updateById(sysUser);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人更改密码
|
||||
*/
|
||||
@RequestMapping("/updatepassword")
|
||||
public R updatepassword(@RequestBody JSONObject tjarray){
|
||||
String token = tjarray.getString("token");
|
||||
SysUserToken sysUserToken = sysUserTokenService.selectOne(new EntityWrapper<SysUserToken>().eq("token",token));
|
||||
SysUser user = sysUserService.selectById(sysUserToken.getUserId());
|
||||
|
||||
|
||||
String oldpassword = tjarray.getString("oldpassword");
|
||||
String newPassword = tjarray.getString("password");
|
||||
|
||||
|
||||
Assert.isBlank(newPassword, "新密码不为能空");
|
||||
|
||||
//sha256加密
|
||||
oldpassword = new Sha256Hash(oldpassword, user.getSalt()).toHex();
|
||||
//sha256加密
|
||||
newPassword = new Sha256Hash(newPassword, user.getSalt()).toHex();
|
||||
if(!oldpassword.equals(user.getPassword())){
|
||||
return R.error("原密码不正确无法修改密码");
|
||||
}
|
||||
|
||||
// SysUser user = new SysUser();
|
||||
user.setUserId(user.getUserId());
|
||||
user.setPassword(newPassword);
|
||||
//更新密码
|
||||
sysUserService.updateById(user);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysXinwenService sysXinwenService;
|
||||
|
||||
/**
|
||||
* 获取健康资讯列表
|
||||
*/
|
||||
@RequestMapping("/getXinwenListAll")
|
||||
public R getXinwenListAll(@RequestBody JSONObject tjarray){
|
||||
String type = tjarray.getString("type");
|
||||
String qname = tjarray.getString("qname");
|
||||
Wrapper w =new EntityWrapper<SysXinwen>();
|
||||
if(type != null){
|
||||
w.eq("type",type);
|
||||
}
|
||||
if(qname != null){
|
||||
w.like("title",qname);
|
||||
}
|
||||
List<SysXinwen> xinwenList = sysXinwenService.selectList(w.orderBy(true,"updatetime",false));
|
||||
return R.ok().put("xinwenList",xinwenList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取健康资讯
|
||||
*/
|
||||
@RequestMapping("/getXinwen")
|
||||
public R getXinwen(@RequestBody Map<String,Object> tjarray) throws Exception {
|
||||
System.out.println("tjarraytjarraytjarray"+tjarray);
|
||||
if(tjarray.get("id") == null){
|
||||
return R.error("请选择要查看的健康资讯");
|
||||
}
|
||||
String id = tjarray.get("id")+"";
|
||||
SysXinwen xinwen =sysXinwenService.selectById(id);
|
||||
System.out.println("xinwenxinwenxinwen"+xinwen);
|
||||
|
||||
//获取附件列表
|
||||
List<TMaterialFile> tMaterialFiles = tMaterialFileService.selectList(new EntityWrapper<TMaterialFile>().eq("parentid",xinwen.getId()));
|
||||
List<Map<String,Object>> mapList = new ArrayList<>();
|
||||
if(!tMaterialFiles.isEmpty()){
|
||||
for(TMaterialFile tMaterialFile:tMaterialFiles){
|
||||
Map<String,Object> map =new HashMap<>();
|
||||
map.put("id",tMaterialFile.getId());
|
||||
map.put("filePath",tMaterialFile.getSfilename());
|
||||
map.put("fileName",tMaterialFile.getSaccessoryname());
|
||||
mapList.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
JSONArray json = (JSONArray) JSONArray.toJSON(mapList);
|
||||
|
||||
xinwen.setFiles(json);
|
||||
|
||||
return R.ok().put("xinwen",xinwen);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysSlxxbService sysSlxxbService;
|
||||
|
||||
|
||||
/**
|
||||
* 视力数据信息管理列表
|
||||
*/
|
||||
@RequestMapping("/getSlxxbListAll")
|
||||
public R getSlxxbListAll(@RequestBody JSONObject param){
|
||||
String token = param.getString("token");
|
||||
SysUserToken sysUserToken = sysUserTokenService.selectOne(new EntityWrapper<SysUserToken>().eq("token",token));
|
||||
SysUser user = sysUserService.selectById(sysUserToken.getUserId());
|
||||
Wrapper wrapper = new EntityWrapper<SysSlxxb>();
|
||||
wrapper.orderBy(true,"updatetime",false);
|
||||
List<SysSlxxb> slxxbList = sysSlxxbService.selectList(wrapper);
|
||||
if(slxxbList.size()>0){
|
||||
for (int i = 0; i < slxxbList.size(); i++) {
|
||||
SysSlxxb sysSlxxb = slxxbList.get(i);
|
||||
if(sysSlxxb.getType() != null){
|
||||
if(sysSlxxb.getType().equals("1")){
|
||||
sysSlxxb.setTypename("左眼");
|
||||
}else {
|
||||
sysSlxxb.setTypename("右眼");
|
||||
}
|
||||
}else{
|
||||
sysSlxxb.setTypename("未知");
|
||||
}
|
||||
if(sysSlxxb.getSfzc() != null){
|
||||
if(sysSlxxb.getSfzc().equals("1")){
|
||||
sysSlxxb.setSfzcname("正常");
|
||||
}else {
|
||||
sysSlxxb.setSfzcname("异常");
|
||||
}
|
||||
}else{
|
||||
sysSlxxb.setSfzcname("未知");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return R.ok().put("slxxbList",slxxbList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 视力数据信息管理信息保存
|
||||
*/
|
||||
@RequestMapping("/saveSlxxb")
|
||||
public R saveSlxxb(@RequestBody JSONObject param) throws ParseException {
|
||||
String token = param.getString("token");
|
||||
SysUserToken sysUserToken = sysUserTokenService.selectOne(new EntityWrapper<SysUserToken>().eq("token",token));
|
||||
SysUser user = sysUserService.selectById(sysUserToken.getUserId());
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String type = param.getString("type");
|
||||
Double slj = param.getDouble("slj");
|
||||
String username = param.getString("username");
|
||||
String jcsj = param.getString("jcsj");
|
||||
String sfzc = param.getString("sfzc");
|
||||
|
||||
SysSlxxb sysSlxxb = new SysSlxxb();
|
||||
|
||||
sysSlxxb.setType(type);
|
||||
sysSlxxb.setSlj(slj);
|
||||
sysSlxxb.setUsername(username);
|
||||
sysSlxxb.setJcsj(format.parse(jcsj));
|
||||
sysSlxxb.setSfzc(sfzc);
|
||||
|
||||
sysSlxxb.setUpdatetime(new Date());
|
||||
sysSlxxb.setUpdateuser(user.getUsername());
|
||||
sysSlxxb.setCreatetime(new Date());
|
||||
sysSlxxb.setCreateuser(user.getUsername());
|
||||
|
||||
sysSlxxbService.insert(sysSlxxb);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 视力数据信息管理信息删除
|
||||
*/
|
||||
@RequestMapping("/slxxbshanchu")
|
||||
public R slxxbshanchu(@RequestBody JSONObject param) throws ParseException {
|
||||
String id = param.getString("id");
|
||||
sysSlxxbService.delete(new EntityWrapper<SysSlxxb>().eq("id",id));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
import cn.jeefast.common.utils.Query;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.system.entity.SysLog;
|
||||
import cn.jeefast.system.service.SysLogService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 系统日志
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/log")
|
||||
public class SysLogController extends BaseController {
|
||||
@Autowired
|
||||
private SysLogService sysLogService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("sys:log:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
Page<SysLog> pageUtil = new Page<SysLog>(query.getPage(), query.getLimit());
|
||||
|
||||
Page<SysLog> page = sysLogService.selectPageList(pageUtil,query);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.jeefast.common.annotation.Log;
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
import cn.jeefast.common.exception.RRException;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.common.utils.Constant.MenuType;
|
||||
import cn.jeefast.system.entity.SysMenu;
|
||||
import cn.jeefast.system.service.ShiroService;
|
||||
import cn.jeefast.system.service.SysMenuService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 系统菜单
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/menu")
|
||||
public class SysMenuController extends BaseController {
|
||||
@Autowired
|
||||
private SysMenuService sysMenuService;
|
||||
@Autowired
|
||||
private ShiroService shiroService;
|
||||
|
||||
/**
|
||||
* 导航菜单
|
||||
*/
|
||||
@RequestMapping("/nav")
|
||||
public R nav(){
|
||||
List<SysMenu> menuList = sysMenuService.getUserMenuList(getUserId());
|
||||
Set<String> permissions = shiroService.getUserPermissions(getUserId());
|
||||
return R.ok().put("menuList", menuList).put("permissions", permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有菜单列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("sys:menu:list")
|
||||
public List<SysMenu> list(){
|
||||
List<SysMenu> menuList = sysMenuService.queryList(new HashMap<>());
|
||||
|
||||
return menuList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择菜单(添加、修改菜单)
|
||||
*/
|
||||
@RequestMapping("/select")
|
||||
@RequiresPermissions("sys:menu:select")
|
||||
public R select(){
|
||||
//查询列表数据
|
||||
List<SysMenu> menuList = sysMenuService.queryNotButtonList();
|
||||
|
||||
//添加顶级菜单
|
||||
SysMenu root = new SysMenu();
|
||||
root.setMenuId(0L);
|
||||
root.setName("一级菜单");
|
||||
root.setParentId(-1L);
|
||||
root.setOpen(true);
|
||||
menuList.add(root);
|
||||
|
||||
return R.ok().put("menuList", menuList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*/
|
||||
@RequestMapping("/info/{menuId}")
|
||||
@RequiresPermissions("sys:menu:info")
|
||||
public R info(@PathVariable("menuId") Long menuId){
|
||||
SysMenu menu = sysMenuService.selectById(menuId);
|
||||
return R.ok().put("menu", menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Log("保存菜单")
|
||||
@RequestMapping("/save")
|
||||
@RequiresPermissions("sys:menu:save")
|
||||
public R save(@RequestBody SysMenu menu){
|
||||
//数据校验
|
||||
verifyForm(menu);
|
||||
|
||||
sysMenuService.insert(menu);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Log("修改菜单")
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("sys:menu:update")
|
||||
public R update(@RequestBody SysMenu menu){
|
||||
//数据校验
|
||||
verifyForm(menu);
|
||||
|
||||
sysMenuService.updateById(menu);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log("删除菜单")
|
||||
@RequestMapping("/delete")
|
||||
@RequiresPermissions("sys:menu:delete")
|
||||
public R delete(long menuId){
|
||||
if(menuId <= 31){
|
||||
return R.error("系统菜单,不能删除");
|
||||
}
|
||||
|
||||
//判断是否有子菜单或按钮
|
||||
List<SysMenu> menuList = sysMenuService.queryListParentId(menuId);
|
||||
if(menuList.size() > 0){
|
||||
return R.error("请先删除子菜单或按钮");
|
||||
}
|
||||
|
||||
sysMenuService.deleteBatch(new Long[]{menuId});
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证参数是否正确
|
||||
*/
|
||||
private void verifyForm(SysMenu menu){
|
||||
if(StringUtils.isBlank(menu.getName())){
|
||||
throw new RRException("菜单名称不能为空");
|
||||
}
|
||||
|
||||
if(menu.getParentId() == null){
|
||||
throw new RRException("上级菜单不能为空");
|
||||
}
|
||||
|
||||
//菜单
|
||||
if(menu.getType() == MenuType.MENU.getValue()){
|
||||
if(StringUtils.isBlank(menu.getUrl())){
|
||||
throw new RRException("菜单URL不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
//上级菜单类型
|
||||
int parentType = MenuType.CATALOG.getValue();
|
||||
if(menu.getParentId() != 0){
|
||||
SysMenu parentMenu = sysMenuService.selectById(menu.getParentId());
|
||||
parentType = parentMenu.getType();
|
||||
}
|
||||
|
||||
//目录、菜单
|
||||
if(menu.getType() == MenuType.CATALOG.getValue() ||
|
||||
menu.getType() == MenuType.MENU.getValue()){
|
||||
if(parentType != MenuType.CATALOG.getValue()){
|
||||
throw new RRException("上级菜单只能为目录类型");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
//按钮
|
||||
if(menu.getType() == MenuType.BUTTON.getValue()){
|
||||
if(parentType != MenuType.MENU.getValue()){
|
||||
throw new RRException("上级菜单只能为菜单类型");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
|
||||
import cn.jeefast.common.annotation.Log;
|
||||
import cn.jeefast.common.utils.Query;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.common.validator.ValidatorUtils;
|
||||
import cn.jeefast.system.entity.SysPjinfo;
|
||||
import cn.jeefast.system.service.SysDeptService;
|
||||
import cn.jeefast.system.service.SysPjinfoService;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统评价前端控制器
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysPjinfo")
|
||||
public class SysPjinfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SysPjinfoService sysPjinfoService;
|
||||
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
/**
|
||||
* 系统评价列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("sys:pjinfo:list")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
Page<SysPjinfo> pageUtil = new Page<SysPjinfo>(query.getPage(), query.getLimit());
|
||||
Page<SysPjinfo> page = sysPjinfoService.queryPageList(pageUtil, query);
|
||||
if (page.getRecords().size() > 0) {
|
||||
for (int i = 0; i < page.getRecords().size(); i++) {
|
||||
SysPjinfo newSysPjinfo = page.getRecords().get(i);
|
||||
newSysPjinfo.setDeptName(newSysPjinfo.getDeptid() != null && newSysPjinfo.getDeptid() != "" ? sysDeptService.selectById(newSysPjinfo.getDeptid()).getName() : null);
|
||||
}
|
||||
}
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统评价信息
|
||||
*/
|
||||
@RequestMapping("/info/{pjinfoId}")
|
||||
@RequiresPermissions("sys:pjinfo:info")
|
||||
public R info(@PathVariable("pjinfoId") String pjinfoId) {
|
||||
System.out.println("pjinfoIdpjinfoIdpjinfoId"+pjinfoId);
|
||||
SysPjinfo pjinfo = sysPjinfoService.selectById(pjinfoId);
|
||||
return R.ok().put("pjinfo", pjinfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统评价信息
|
||||
*/
|
||||
@RequestMapping("/infoprent/{pjinfoId}")
|
||||
@RequiresPermissions("sys:pjinfo:infoprent")
|
||||
public R infoprent(@PathVariable("pjinfoId") String pjinfoId) {
|
||||
System.out.println("pjinfoIdpjinfoIdpjinfoId"+pjinfoId);
|
||||
SysPjinfo pjinfo = sysPjinfoService.selectById(pjinfoId);
|
||||
List<SysPjinfo> sysPjinfoList = new ArrayList<>();
|
||||
if(pjinfo.getPrentid() != null){
|
||||
sysPjinfoList = sysPjinfoService.selectList(new EntityWrapper<SysPjinfo>().eq("prentid",pjinfo.getId()));
|
||||
}
|
||||
System.out.println("sysPjinfoListsysPjinfoListsysPjinfoList"+sysPjinfoList);
|
||||
System.out.println("sizesizesizesizesizesizesize"+sysPjinfoList.size());
|
||||
pjinfo.setSysPjinfoList(sysPjinfoList);
|
||||
|
||||
System.out.println("pjinfopjinfopjinfopjinfopjinfopjinfopjinfopjinfopjinfopjin"+pjinfo);
|
||||
return R.ok().put("pjinfo", pjinfo).put("allFiles",sysPjinfoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存系统评价
|
||||
*/
|
||||
@Log("保存系统评价")
|
||||
@RequestMapping("/save")
|
||||
@RequiresPermissions("sys:pjinfo:save")
|
||||
public R save(@RequestBody SysPjinfo pjinfo) {
|
||||
ValidatorUtils.validateEntity(pjinfo);
|
||||
pjinfo.setUsername(getUser().getUsername());
|
||||
sysPjinfoService.insert(pjinfo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统评价
|
||||
*/
|
||||
@Log("修改系统评价")
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("sys:pjinfo:update")
|
||||
public R update(@RequestBody SysPjinfo pjinfo) {
|
||||
ValidatorUtils.validateEntity(pjinfo);
|
||||
pjinfo.setUsername(getUser().getUsername());
|
||||
pjinfo.setPrentid("0");
|
||||
sysPjinfoService.updateById(pjinfo);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存评论
|
||||
*/
|
||||
@Log("保存评论")
|
||||
@RequestMapping("/savePlxx")
|
||||
@RequiresPermissions("sys:pjinfo:savePlxx")
|
||||
public R savePlxx(@RequestBody SysPjinfo pjinfo) {
|
||||
System.out.println("pjinfopjinfopjinfopjinfo"+pjinfo);
|
||||
ValidatorUtils.validateEntity(pjinfo);
|
||||
pjinfo.setUsername(getUser().getUsername());
|
||||
pjinfo.setPrentid(pjinfo.getId()+"");
|
||||
pjinfo.setId(null);
|
||||
sysPjinfoService.insert(pjinfo);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除系统评价
|
||||
*/
|
||||
@Log("删除系统评价")
|
||||
@RequestMapping("/delete")
|
||||
@RequiresPermissions("sys:pjinfo:delete")
|
||||
public R delete(@RequestBody String[] pjinfoIds) {
|
||||
sysPjinfoService.deleteBatch(pjinfoIds);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import cn.jeefast.common.annotation.Log;
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
import cn.jeefast.common.utils.Constant;
|
||||
import cn.jeefast.common.utils.Query;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.common.validator.ValidatorUtils;
|
||||
import cn.jeefast.system.entity.SysRole;
|
||||
import cn.jeefast.system.service.SysRoleDeptService;
|
||||
import cn.jeefast.system.service.SysRoleMenuService;
|
||||
import cn.jeefast.system.service.SysRoleService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 角色管理
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/role")
|
||||
public class SysRoleController extends BaseController {
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private SysRoleMenuService sysRoleMenuService;
|
||||
@Autowired
|
||||
private SysRoleDeptService sysRoleDeptService;
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("sys:role:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
//如果不是超级管理员,则只查询自己创建的角色列表
|
||||
if(getUserId() != Constant.SUPER_ADMIN){
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
Page<SysRole> pageUtil = new Page<SysRole>(query.getPage(), query.getLimit());
|
||||
|
||||
Page<SysRole> page = sysRoleService.queryPageList(pageUtil,query);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
*/
|
||||
@RequestMapping("/select")
|
||||
@RequiresPermissions("sys:role:select")
|
||||
public R select(){
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
//如果不是超级管理员,则只查询自己所拥有的角色列表
|
||||
if(getUserId() != Constant.SUPER_ADMIN){
|
||||
map.put("createUserId", getUserId());
|
||||
}
|
||||
List<SysRole> list = sysRoleService.queryList(map);
|
||||
|
||||
return R.ok().put("list", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*/
|
||||
@RequestMapping("/info/{roleId}")
|
||||
@RequiresPermissions("sys:role:info")
|
||||
public R info(@PathVariable("roleId") Long roleId){
|
||||
SysRole role = sysRoleService.selectById(roleId);
|
||||
|
||||
//查询角色对应的菜单
|
||||
List<Long> menuIdList = sysRoleMenuService.queryMenuIdList(roleId);
|
||||
role.setMenuIdList(menuIdList);
|
||||
|
||||
//查询角色对应的部门
|
||||
List<Long> deptIdList = sysRoleDeptService.queryDeptIdList(roleId);
|
||||
role.setDeptIdList(deptIdList);
|
||||
|
||||
return R.ok().put("role", role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色
|
||||
*/
|
||||
@Log("保存角色")
|
||||
@RequestMapping("/save")
|
||||
@RequiresPermissions("sys:role:save")
|
||||
public R save(@RequestBody SysRole role){
|
||||
ValidatorUtils.validateEntity(role);
|
||||
|
||||
sysRoleService.save(role);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角色
|
||||
*/
|
||||
@Log("修改角色")
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("sys:role:update")
|
||||
public R update(@RequestBody SysRole role){
|
||||
ValidatorUtils.validateEntity(role);
|
||||
|
||||
sysRoleService.update(role);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
@Log("删除角色")
|
||||
@RequestMapping("/delete")
|
||||
@RequiresPermissions("sys:role:delete")
|
||||
public R delete(@RequestBody Long[] roleIds){
|
||||
sysRoleService.deleteBatch(roleIds);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.jeefast.common.annotation.Log;
|
||||
import cn.jeefast.common.utils.Query;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.common.validator.ValidatorUtils;
|
||||
import cn.jeefast.system.entity.SysSlxxb;
|
||||
import cn.jeefast.system.entity.TMaterialFile;
|
||||
import cn.jeefast.system.service.TMaterialFileService;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
|
||||
import cn.jeefast.system.service.SysSlxxbService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视力数据信息管理 前端控制器
|
||||
* </p>
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysSlxxb")
|
||||
public class SysSlxxbController extends BaseController {
|
||||
@Autowired
|
||||
private SysSlxxbService sysSlxxbService;
|
||||
|
||||
@Autowired
|
||||
private TMaterialFileService tMaterialFileService;
|
||||
|
||||
|
||||
/**
|
||||
* 视力数据信息管理列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("sys:slxxb:list")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
Page<SysSlxxb> pageUtil = new Page<SysSlxxb>(query.getPage(), query.getLimit());
|
||||
Page<SysSlxxb> page = sysSlxxbService.queryPageList(pageUtil, query);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 视力数据信息管理
|
||||
*/
|
||||
@RequestMapping("/info/{slxxbId}")
|
||||
@RequiresPermissions("sys:slxxb:info")
|
||||
public R info(@PathVariable("slxxbId") String slxxbId) {
|
||||
SysSlxxb slxxb = sysSlxxbService.selectById(slxxbId);
|
||||
//获取附件列表
|
||||
List<TMaterialFile> tMaterialFiles = tMaterialFileService.selectList(new EntityWrapper<TMaterialFile>().eq("parentid", slxxb.getId()));
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
if (!tMaterialFiles.isEmpty()) {
|
||||
for (TMaterialFile tMaterialFile : tMaterialFiles) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", tMaterialFile.getId());
|
||||
map.put("filePath", tMaterialFile.getSfilename());
|
||||
map.put("fileName", tMaterialFile.getSaccessoryname());
|
||||
mapList.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
JSONArray json = (JSONArray) JSONArray.toJSON(mapList);
|
||||
|
||||
slxxb.setFiles(json);
|
||||
return R.ok().put("slxxb", slxxb);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有视力数据信息管理
|
||||
*/
|
||||
@RequestMapping("/getSlxxbs")
|
||||
public R getSlxxbs() {
|
||||
List<SysSlxxb> slxxbs = sysSlxxbService.selectList(new EntityWrapper<SysSlxxb>().orderBy(true, "updatetime", false));
|
||||
return R.ok().put("slxxbs", slxxbs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存视力数据信息管理
|
||||
*/
|
||||
@Log("保存视力数据信息管理")
|
||||
@RequestMapping("/save")
|
||||
@RequiresPermissions("sys:slxxb:save")
|
||||
public R save(@RequestBody SysSlxxb slxxb) {
|
||||
ValidatorUtils.validateEntity(slxxb);
|
||||
slxxb.setCreatetime(new Date());
|
||||
slxxb.setCreateuser(getUser().getUsername());
|
||||
slxxb.setUpdatetime(new Date());
|
||||
slxxb.setUpdateuser(getUser().getUsername());
|
||||
sysSlxxbService.insert(slxxb);
|
||||
|
||||
if (slxxb.getFiles() != null) {
|
||||
tMaterialFileService.setTMaterialFilePrintId(slxxb.getFiles(), slxxb.getId());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视力数据信息管理
|
||||
*/
|
||||
@Log("修改视力数据信息管理")
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("sys:slxxb:update")
|
||||
public R update(@RequestBody SysSlxxb slxxb) {
|
||||
ValidatorUtils.validateEntity(slxxb);
|
||||
slxxb.setUpdatetime(new Date());
|
||||
slxxb.setUpdateuser(getUser().getUsername());
|
||||
sysSlxxbService.updateById(slxxb);
|
||||
if (slxxb.getFiles() != null) {
|
||||
tMaterialFileService.setTMaterialFilePrintId(slxxb.getFiles(), slxxb.getId());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视力数据信息管理
|
||||
*/
|
||||
@Log("删除视力数据信息管理")
|
||||
@RequestMapping("/delete")
|
||||
@RequiresPermissions("sys:slxxb:delete")
|
||||
public R delete(@RequestBody String[] slxxbIds) {
|
||||
sysSlxxbService.deleteBatch(slxxbIds);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 视力数据信息管理列表
|
||||
*/
|
||||
@RequestMapping("/tjlist")
|
||||
@RequiresPermissions("sys:slxxb:tjlist")
|
||||
public R tjlist(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
Page<SysSlxxb> pageUtil = new Page<SysSlxxb>(query.getPage(), query.getLimit());
|
||||
Page<SysSlxxb> page = sysSlxxbService.queryPageList(pageUtil, query);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
@Log("统计图表")
|
||||
@RequestMapping("/getData")
|
||||
public R getData(@RequestBody JSONObject param) {
|
||||
System.out.println("paramparamparam"+param);
|
||||
String id = param.getString("id");
|
||||
SysSlxxb sysSlxxb = sysSlxxbService.selectById(id);
|
||||
String username = sysSlxxb.getUsername();
|
||||
List<SysSlxxb> sysSlxxbs = sysSlxxbService.selectList(new EntityWrapper<SysSlxxb>().eq("username",username).eq("type","1").orderBy(true,"jcsj",true));
|
||||
List<SysSlxxb> sysyySlxxbs = sysSlxxbService.selectList(new EntityWrapper<SysSlxxb>().eq("username",username).eq("type","2").orderBy(true,"jcsj",true));
|
||||
return R.ok().put("zy",sysSlxxbs).put("yy",sysyySlxxbs);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package cn.jeefast.system.controller;
|
||||
|
||||
|
||||
import cn.jeefast.common.annotation.Log;
|
||||
import cn.jeefast.common.utils.Query;
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.common.validator.ValidatorUtils;
|
||||
import cn.jeefast.system.entity.SysXinwen;
|
||||
import cn.jeefast.system.entity.TMaterialFile;
|
||||
import cn.jeefast.system.service.SysXinwenService;
|
||||
import cn.jeefast.system.service.TMaterialFileService;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.jeefast.common.base.BaseController;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 健康资讯 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author theodo
|
||||
* @since 2022-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysXinwen")
|
||||
public class SysXinwenController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysXinwenService sysXinwenService;
|
||||
|
||||
@Autowired
|
||||
private TMaterialFileService tMaterialFileService;
|
||||
|
||||
/**
|
||||
* 健康资讯列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("sys:xinwen:list")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
params.put("type","1");
|
||||
Query query = new Query(params);
|
||||
Page<SysXinwen> pageUtil = new Page<SysXinwen>(query.getPage(), query.getLimit());
|
||||
Page<SysXinwen> page = sysXinwenService.queryPageList(pageUtil, query);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公司简介列表
|
||||
*/
|
||||
@RequestMapping("/gsjj")
|
||||
@RequiresPermissions("sys:xinwen:gsjj")
|
||||
public R gsjj(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
params.put("type","2");
|
||||
Query query = new Query(params);
|
||||
Page<SysXinwen> pageUtil = new Page<SysXinwen>(query.getPage(), query.getLimit());
|
||||
Page<SysXinwen> page = sysXinwenService.queryPageList(pageUtil, query);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公司简介列表
|
||||
*/
|
||||
@RequestMapping("/zysxlist")
|
||||
@RequiresPermissions("sys:xinwen:zysxlist")
|
||||
public R zysxlist(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
params.put("type","3");
|
||||
Query query = new Query(params);
|
||||
Page<SysXinwen> pageUtil = new Page<SysXinwen>(query.getPage(), query.getLimit());
|
||||
Page<SysXinwen> page = sysXinwenService.queryPageList(pageUtil, query);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公司简介列表
|
||||
*/
|
||||
@RequestMapping("/xlgllist")
|
||||
@RequiresPermissions("sys:xinwen:xlgllist")
|
||||
public R xlgllist(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
params.put("type","4");
|
||||
Query query = new Query(params);
|
||||
Page<SysXinwen> pageUtil = new Page<SysXinwen>(query.getPage(), query.getLimit());
|
||||
Page<SysXinwen> page = sysXinwenService.queryPageList(pageUtil, query);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 健康资讯信息
|
||||
*/
|
||||
@RequestMapping("/info/{xinwenId}")
|
||||
@RequiresPermissions("sys:xinwen:info")
|
||||
public R info(@PathVariable("xinwenId") String xinwenId) {
|
||||
SysXinwen xinwen = sysXinwenService.selectById(xinwenId);
|
||||
|
||||
|
||||
//获取附件列表
|
||||
List<TMaterialFile> tMaterialFiles = tMaterialFileService.selectList(new EntityWrapper<TMaterialFile>().eq("parentid",xinwen.getId()));
|
||||
List<Map<String,Object>> mapList = new ArrayList<>();
|
||||
if(!tMaterialFiles.isEmpty()){
|
||||
for(TMaterialFile tMaterialFile:tMaterialFiles){
|
||||
Map<String,Object> map =new HashMap<>();
|
||||
map.put("id",tMaterialFile.getId());
|
||||
map.put("filePath",tMaterialFile.getSfilename());
|
||||
map.put("fileName",tMaterialFile.getSaccessoryname());
|
||||
mapList.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
JSONArray json = (JSONArray) JSONArray.toJSON(mapList);
|
||||
|
||||
xinwen.setFiles(json);
|
||||
return R.ok().put("xinwen", xinwen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存健康资讯
|
||||
*/
|
||||
//@Log("保存健康资讯")
|
||||
@RequestMapping("/save")
|
||||
@RequiresPermissions("sys:xinwen:save")
|
||||
public R save(@RequestBody SysXinwen xinwen) {
|
||||
ValidatorUtils.validateEntity(xinwen);
|
||||
xinwen.setCreateuser(getUser().getUsername());
|
||||
xinwen.setCreatetime(new Date());
|
||||
xinwen.setUpdateuser(getUser().getUsername());
|
||||
xinwen.setUpdatetime(new Date());
|
||||
sysXinwenService.insert(xinwen);
|
||||
if(xinwen.getFiles() != null){
|
||||
tMaterialFileService.setTMaterialFilePrintId(xinwen.getFiles(),xinwen.getId());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改健康资讯
|
||||
*/
|
||||
//@Log("修改健康资讯")
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("sys:xinwen:update")
|
||||
public R update(@RequestBody SysXinwen xinwen) {
|
||||
ValidatorUtils.validateEntity(xinwen);
|
||||
xinwen.setUpdateuser(getUser().getUsername());
|
||||
xinwen.setUpdatetime(new Date());
|
||||
sysXinwenService.updateById(xinwen);
|
||||
if(xinwen.getFiles() != null){
|
||||
tMaterialFileService.setTMaterialFilePrintId(xinwen.getFiles(),xinwen.getId());
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除健康资讯
|
||||
*/
|
||||
//@Log("删除健康资讯")
|
||||
@RequestMapping("/delete")
|
||||
@RequiresPermissions("sys:xinwen:delete")
|
||||
public R delete(@RequestBody String[] xinwenIds) {
|
||||
sysXinwenService.deleteBatch(xinwenIds);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.jeefast.system.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
|
||||
import cn.jeefast.system.entity.SysDept;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门管理 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysDeptDao extends BaseMapper<SysDept> {
|
||||
|
||||
List<SysDept> queryList(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 查询子部门ID列表
|
||||
* @param parentId 上级部门ID
|
||||
*/
|
||||
List<Long> queryDetpIdList(Long parentId);
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.jeefast.system.dao;
|
||||
|
||||
import cn.jeefast.system.entity.SysPjinfo;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysPjinfoDao extends BaseMapper<SysPjinfo> {
|
||||
List<SysPjinfo> queryPageList(Page<SysPjinfo> page, Map<String, Object> map);
|
||||
|
||||
int deleteBatch(Object[] id);
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.jeefast.system.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import cn.jeefast.system.entity.SysRole;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysRoleDao extends BaseMapper<SysRole> {
|
||||
|
||||
List<SysRole> queryPageList(Page<SysRole> page, Map<String, Object> map);
|
||||
|
||||
List<SysRole> queryList(Map<String, Object> map);
|
||||
|
||||
int deleteBatch(Object[] id);
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.jeefast.system.dao;
|
||||
|
||||
import cn.jeefast.system.entity.SysSlxxb;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视力数据信息管理 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysSlxxbDao extends BaseMapper<SysSlxxb> {
|
||||
List<SysSlxxb> queryPageList(Page<SysSlxxb> page, Map<String, Object> map);
|
||||
|
||||
int deleteBatch(Object[] id);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.jeefast.system.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
|
||||
import cn.jeefast.system.entity.SysUserToken;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户Token Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysUserTokenDao extends BaseMapper<SysUserToken> {
|
||||
|
||||
SysUserToken queryByToken(String token);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.jeefast.system.dao;
|
||||
|
||||
import cn.jeefast.system.entity.SysXinwen;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 健康资讯 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author theodo
|
||||
* @since 2022-03-30
|
||||
*/
|
||||
public interface SysXinwenDao extends BaseMapper<SysXinwen> {
|
||||
List<SysXinwen> queryPageList(Page<SysXinwen> page, Map<String, Object> map);
|
||||
|
||||
int deleteBatch(Object[] id);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.jeefast.system.dao;
|
||||
|
||||
import cn.jeefast.system.entity.TMaterialFile;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface TMaterialFileDao extends BaseMapper<TMaterialFile> {
|
||||
|
||||
List<TMaterialFile> queryPageList(Page<TMaterialFile> page, Map<String, Object> map);
|
||||
|
||||
void deleteBatch(String[] ids);
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统日志
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_log")
|
||||
public class SysLog extends Model<SysLog> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 用户操作
|
||||
*/
|
||||
private String operation;
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
private String method;
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String params;
|
||||
/**
|
||||
* 执行时长(毫秒)
|
||||
*/
|
||||
private Long time;
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
private String ip;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_date")
|
||||
private Date createDate;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(String params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public Long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysLog{" +
|
||||
", id=" + id +
|
||||
", username=" + username +
|
||||
", operation=" + operation +
|
||||
", method=" + method +
|
||||
", params=" + params +
|
||||
", time=" + time +
|
||||
", ip=" + ip +
|
||||
", createDate=" + createDate +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_pjinfo")
|
||||
public class SysPjinfo extends Model<SysPjinfo> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 评价标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 评价内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 评价人
|
||||
*/
|
||||
private String author;
|
||||
|
||||
private String pjtype;
|
||||
private String deptid;
|
||||
private String username;
|
||||
private String prentid;
|
||||
|
||||
@TableField(exist=false)
|
||||
private List<SysPjinfo> sysPjinfoList;
|
||||
|
||||
public List<SysPjinfo> getSysPjinfoList() {
|
||||
return sysPjinfoList;
|
||||
}
|
||||
|
||||
public void setSysPjinfoList(List<SysPjinfo> sysPjinfoList) {
|
||||
sysPjinfoList = sysPjinfoList;
|
||||
}
|
||||
|
||||
public String getPrentid() {
|
||||
return prentid;
|
||||
}
|
||||
|
||||
public void setPrentid(String prentid) {
|
||||
this.prentid = prentid;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private String deptName;
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getPjtype() {
|
||||
return pjtype;
|
||||
}
|
||||
|
||||
public void setPjtype(String pjtype) {
|
||||
this.pjtype = pjtype;
|
||||
}
|
||||
|
||||
public String getDeptid() {
|
||||
return deptid;
|
||||
}
|
||||
|
||||
public void setDeptid(String deptid) {
|
||||
this.deptid = deptid;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysPjinfo{" +
|
||||
"id=" + id +
|
||||
", title='" + title + '\'' +
|
||||
", content='" + content + '\'' +
|
||||
", author='" + author + '\'' +
|
||||
", pjtype='" + pjtype + '\'' +
|
||||
", deptid='" + deptid + '\'' +
|
||||
", username='" + username + '\'' +
|
||||
", prentid='" + prentid + '\'' +
|
||||
", SysPjinfoList=" + sysPjinfoList +
|
||||
", deptName='" + deptName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_role")
|
||||
public class SysRole extends Model<SysRole> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="role_id", type= IdType.AUTO)
|
||||
private Long roleId;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@TableField("role_name")
|
||||
@NotBlank(message="角色名称不能为空")
|
||||
private String roleName;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@TableField("dept_id")
|
||||
// @NotNull(message="部门不能为空")
|
||||
private Long deptId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private String deptName;
|
||||
@TableField(exist=false)
|
||||
private List<Long> menuIdList;
|
||||
@TableField(exist=false)
|
||||
private List<Long> deptIdList;
|
||||
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public List<Long> getDeptIdList() {
|
||||
return deptIdList;
|
||||
}
|
||||
|
||||
public void setDeptIdList(List<Long> deptIdList) {
|
||||
this.deptIdList = deptIdList;
|
||||
}
|
||||
|
||||
public List<Long> getMenuIdList() {
|
||||
return menuIdList;
|
||||
}
|
||||
|
||||
public void setMenuIdList(List<Long> menuIdList) {
|
||||
this.menuIdList = menuIdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysRole{" +
|
||||
", roleId=" + roleId +
|
||||
", roleName=" + roleName +
|
||||
", remark=" + remark +
|
||||
", deptId=" + deptId +
|
||||
", createTime=" + createTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色与部门对应关系
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_role_dept")
|
||||
public class SysRoleDept extends Model<SysRoleDept> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@TableField("role_id")
|
||||
private Long roleId;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@TableField("dept_id")
|
||||
private Long deptId;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysRoleDept{" +
|
||||
", id=" + id +
|
||||
", roleId=" + roleId +
|
||||
", deptId=" + deptId +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色与菜单对应关系
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_role_menu")
|
||||
public class SysRoleMenu extends Model<SysRoleMenu> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@TableField("role_id")
|
||||
private Long roleId;
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
@TableField("menu_id")
|
||||
private Long menuId;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getMenuId() {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(Long menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysRoleMenu{" +
|
||||
", id=" + id +
|
||||
", roleId=" + roleId +
|
||||
", menuId=" + menuId +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,219 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视力数据信息管理
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_slxxb")
|
||||
public class SysSlxxb extends Model<SysSlxxb> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 分类,1:左眼,2:右眼
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 视力数
|
||||
*/
|
||||
private Double slj;
|
||||
|
||||
/**
|
||||
* 检查人员
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
private Date jcsj;
|
||||
|
||||
/**
|
||||
* 视力是否正常,1:正常,2:不正常
|
||||
*/
|
||||
private String sfzc;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updatetime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateuser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createtime;
|
||||
|
||||
/**
|
||||
* 创建人员
|
||||
*/
|
||||
private String createuser;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String typename;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String sfzcname;
|
||||
|
||||
|
||||
public String getTypename() {
|
||||
return typename;
|
||||
}
|
||||
|
||||
public void setTypename(String typename) {
|
||||
this.typename = typename;
|
||||
}
|
||||
|
||||
public String getSfzcname() {
|
||||
return sfzcname;
|
||||
}
|
||||
|
||||
public void setSfzcname(String sfzcname) {
|
||||
this.sfzcname = sfzcname;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Double getSlj() {
|
||||
return slj;
|
||||
}
|
||||
|
||||
public void setSlj(Double slj) {
|
||||
this.slj = slj;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public Date getJcsj() {
|
||||
return jcsj;
|
||||
}
|
||||
|
||||
public void setJcsj(Date jcsj) {
|
||||
this.jcsj = jcsj;
|
||||
}
|
||||
|
||||
public String getSfzc() {
|
||||
return sfzc;
|
||||
}
|
||||
|
||||
public void setSfzc(String sfzc) {
|
||||
this.sfzc = sfzc;
|
||||
}
|
||||
|
||||
public Date getUpdatetime() {
|
||||
return updatetime;
|
||||
}
|
||||
|
||||
public void setUpdatetime(Date updatetime) {
|
||||
this.updatetime = updatetime;
|
||||
}
|
||||
|
||||
public String getUpdateuser() {
|
||||
return updateuser;
|
||||
}
|
||||
|
||||
public void setUpdateuser(String updateuser) {
|
||||
this.updateuser = updateuser;
|
||||
}
|
||||
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
public String getCreateuser() {
|
||||
return createuser;
|
||||
}
|
||||
|
||||
public void setCreateuser(String createuser) {
|
||||
this.createuser = createuser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private JSONArray files;
|
||||
|
||||
public JSONArray getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
||||
public void setFiles(JSONArray files) {
|
||||
this.files = files;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysSlxxb{" +
|
||||
"id='" + id + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", slj=" + slj +
|
||||
", username='" + username + '\'' +
|
||||
", jcsj=" + jcsj +
|
||||
", sfzc='" + sfzc + '\'' +
|
||||
", updatetime=" + updatetime +
|
||||
", updateuser='" + updateuser + '\'' +
|
||||
", createtime=" + createtime +
|
||||
", createuser='" + createuser + '\'' +
|
||||
", typename='" + typename + '\'' +
|
||||
", sfzcname='" + sfzcname + '\'' +
|
||||
", files=" + files +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户与角色对应关系
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_user_role")
|
||||
public class SysUserRole extends Model<SysUserRole> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@TableField("role_id")
|
||||
private Long roleId;
|
||||
|
||||
|
||||
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 Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUserRole{" +
|
||||
", id=" + id +
|
||||
", userId=" + userId +
|
||||
", roleId=" + roleId +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户Token
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("sys_user_token")
|
||||
public class SysUserToken extends Model<SysUserToken> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private Long userId;
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
private String token;
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
@TableField("expire_time")
|
||||
private Date expireTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Date getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(Date expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUserToken{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", token='" + token + '\'' +
|
||||
", expireTime=" + expireTime +
|
||||
", updateTime=" + updateTime +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package cn.jeefast.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@TableName("tb_scms_file")
|
||||
public class TMaterialFile extends Model<TMaterialFile> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
//存储状态
|
||||
private Integer smodelidstate;
|
||||
//附件名
|
||||
private String sfilename;
|
||||
//附件路径
|
||||
private String sfilelength;
|
||||
//存储源文件名
|
||||
private String saccessoryname;
|
||||
//新表父id
|
||||
private String parentid;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getSmodelidstate() {
|
||||
return smodelidstate;
|
||||
}
|
||||
|
||||
public void setSmodelidstate(Integer smodelidstate) {
|
||||
this.smodelidstate = smodelidstate;
|
||||
}
|
||||
|
||||
public String getSfilename() {
|
||||
return sfilename;
|
||||
}
|
||||
|
||||
public void setSfilename(String sfilename) {
|
||||
this.sfilename = sfilename;
|
||||
}
|
||||
|
||||
public String getSfilelength() {
|
||||
return sfilelength;
|
||||
}
|
||||
|
||||
public void setSfilelength(String sfilelength) {
|
||||
this.sfilelength = sfilelength;
|
||||
}
|
||||
|
||||
public String getSaccessoryname() {
|
||||
return saccessoryname;
|
||||
}
|
||||
|
||||
public void setSaccessoryname(String saccessoryname) {
|
||||
this.saccessoryname = saccessoryname;
|
||||
}
|
||||
|
||||
public String getParentid() {
|
||||
return parentid;
|
||||
}
|
||||
|
||||
public void setParentid(String parentid) {
|
||||
this.parentid = parentid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TMaterialFile{" +
|
||||
"id='" + id + '\'' +
|
||||
", smodelidstate=" + smodelidstate +
|
||||
", sfilename='" + sfilename + '\'' +
|
||||
", sfilelength='" + sfilelength + '\'' +
|
||||
", saccessoryname='" + saccessoryname + '\'' +
|
||||
", parentid='" + parentid + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.jeefast.system.oauth2;
|
||||
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
|
||||
/**
|
||||
* token
|
||||
*
|
||||
*/
|
||||
public class OAuth2Token implements AuthenticationToken {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String token;
|
||||
|
||||
public OAuth2Token(String token){
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrincipal() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return token;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.jeefast.system.oauth2;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.UUID;
|
||||
|
||||
import cn.jeefast.common.exception.RRException;
|
||||
|
||||
/**
|
||||
* 生成token
|
||||
*
|
||||
*/
|
||||
public class TokenGenerator {
|
||||
|
||||
public static String generateValue() {
|
||||
return generateValue(UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
private static final char[] hexCode = "0123456789abcdef".toCharArray();
|
||||
|
||||
public static String toHexString(byte[] data) {
|
||||
if(data == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder r = new StringBuilder(data.length*2);
|
||||
for ( byte b : data) {
|
||||
r.append(hexCode[(b >> 4) & 0xF]);
|
||||
r.append(hexCode[(b & 0xF)]);
|
||||
}
|
||||
return r.toString();
|
||||
}
|
||||
|
||||
public static String generateValue(String param) {
|
||||
try {
|
||||
MessageDigest algorithm = MessageDigest.getInstance("MD5");
|
||||
algorithm.reset();
|
||||
algorithm.update(param.getBytes());
|
||||
byte[] messageDigest = algorithm.digest();
|
||||
return toHexString(messageDigest);
|
||||
} catch (Exception e) {
|
||||
throw new RRException("生成Token失败", e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.jeefast.system.redis;
|
||||
|
||||
|
||||
import cn.jeefast.common.utils.RedisKeys;
|
||||
import cn.jeefast.common.utils.RedisUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 系统配置Redis
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class SysConfigRedis {
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
public void delete(String configKey) {
|
||||
String key = RedisKeys.getSysConfigKey(configKey);
|
||||
redisUtils.delete(key);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.jeefast.system.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
|
||||
import cn.jeefast.system.entity.SysLog;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统日志 服务类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysLogService extends IService<SysLog> {
|
||||
public Page<SysLog> selectPageList(Page<SysLog> page, Map<String, Object> map);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.jeefast.system.service;
|
||||
|
||||
import cn.jeefast.system.entity.SysPjinfo;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysPjinfoService extends IService<SysPjinfo> {
|
||||
Page<SysPjinfo> queryPageList(Page<SysPjinfo> page, Map<String, Object> map);
|
||||
void deleteBatch(String[] borrowIds);
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.jeefast.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
|
||||
import cn.jeefast.system.entity.SysRole;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色 服务类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysRoleService extends IService<SysRole> {
|
||||
|
||||
Page<SysRole> queryPageList(Page<SysRole> pageUtil, Map<String, Object> map);
|
||||
List<SysRole> queryList(Map<String, Object> map);
|
||||
void deleteBatch(Long[] roleIds);
|
||||
void save(SysRole role);
|
||||
void update(SysRole role);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.jeefast.system.service;
|
||||
|
||||
import cn.jeefast.system.entity.SysSlxxb;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视力数据信息管理 服务类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysSlxxbService extends IService<SysSlxxb> {
|
||||
Page<SysSlxxb> queryPageList(Page<SysSlxxb> page, Map<String, Object> map);
|
||||
void deleteBatch(String[] slxxbIds);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.jeefast.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
|
||||
import cn.jeefast.common.utils.R;
|
||||
import cn.jeefast.system.entity.SysUserToken;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统用户Token 服务类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface SysUserTokenService extends IService<SysUserToken> {
|
||||
SysUserToken queryByToken(String token);
|
||||
|
||||
/**
|
||||
* 生成token
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
R createToken(long userId);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.jeefast.system.service;
|
||||
|
||||
import cn.jeefast.system.entity.SysXinwen;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 健康资讯 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author theodo
|
||||
* @since 2022-03-30
|
||||
*/
|
||||
public interface SysXinwenService extends IService<SysXinwen> {
|
||||
Page<SysXinwen> queryPageList(Page<SysXinwen> page, Map<String, Object> map);
|
||||
void deleteBatch(String[] xinwenIds);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.jeefast.system.service;
|
||||
|
||||
import cn.jeefast.system.entity.SysUser;
|
||||
import cn.jeefast.system.entity.TMaterialFile;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface TMaterialFileService extends IService<TMaterialFile> {
|
||||
|
||||
void setTMaterialFilePrintId(JSONArray filesOld, String parentid);
|
||||
|
||||
Page<TMaterialFile> queryPageList(Page<TMaterialFile> pageUtil, Map<String, Object> map);
|
||||
|
||||
void deleteBatch(String[] ids);
|
||||
|
||||
String uploadFile(MultipartFile file);
|
||||
|
||||
void deletePreachFile(String filePath);
|
||||
|
||||
void downFile(String id, HttpServletResponse response);
|
||||
|
||||
Map<String, String> importPsot(HttpServletRequest request);
|
||||
Map<String, String> importPsotfiles(HttpServletRequest request);
|
||||
|
||||
void deleteFile(String filePath);
|
||||
void deleteFileByid(String id);
|
||||
|
||||
|
||||
String getIsoldFilesname(String id, String smodeltype);
|
||||
|
||||
String getIsoldFilespath(String id, String smodeltype);
|
||||
//密标转换成名字
|
||||
String mbfkljToName(String mbfklj);
|
||||
//验证机密等级是否能够上传文件
|
||||
Boolean verification(String mbbjk, SysUser sysUser);
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package cn.jeefast.system.service.impl;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import cn.jeefast.common.utils.Constant;
|
||||
import cn.jeefast.system.dao.SysMenuDao;
|
||||
import cn.jeefast.system.dao.SysUserDao;
|
||||
import cn.jeefast.system.dao.SysUserTokenDao;
|
||||
import cn.jeefast.system.entity.SysMenu;
|
||||
import cn.jeefast.system.entity.SysUser;
|
||||
import cn.jeefast.system.entity.SysUserToken;
|
||||
import cn.jeefast.system.service.ShiroService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class ShiroServiceImpl implements ShiroService {
|
||||
@Autowired
|
||||
private SysMenuDao sysMenuDao;
|
||||
@Autowired
|
||||
private SysUserDao sysUserDao;
|
||||
@Autowired
|
||||
private SysUserTokenDao sysUserTokenDao;
|
||||
|
||||
@Override
|
||||
public Set<String> getUserPermissions(long userId) {
|
||||
List<String> permsList;
|
||||
|
||||
//系统管理员,拥有最高权限
|
||||
if(userId == Constant.SUPER_ADMIN){
|
||||
List<SysMenu> menuList = sysMenuDao.queryList(new HashMap<>());
|
||||
permsList = new ArrayList<>(menuList.size());
|
||||
for(SysMenu menu : menuList){
|
||||
permsList.add(menu.getPerms());
|
||||
}
|
||||
}else{
|
||||
permsList = sysUserDao.queryAllPerms(userId);
|
||||
}
|
||||
//用户权限列表
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for(String perms : permsList){
|
||||
if(StringUtils.isBlank(perms)){
|
||||
continue;
|
||||
}
|
||||
permsSet.addAll(Arrays.asList(perms.trim().split(",")));
|
||||
}
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserToken queryByToken(String token) {
|
||||
return sysUserTokenDao.queryByToken(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser queryUser(Long userId) {
|
||||
return sysUserDao.selectById(userId);
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package cn.jeefast.system.service.impl;
|
||||
|
||||
import com.qiniu.util.StringUtils;
|
||||
|
||||
import cn.jeefast.common.annotation.DataFilter;
|
||||
import cn.jeefast.system.dao.SysDeptDao;
|
||||
import cn.jeefast.system.entity.SysDept;
|
||||
import cn.jeefast.system.service.SysDeptService;
|
||||
|
||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门管理 服务实现类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class SysDeptServiceImpl extends ServiceImpl<SysDeptDao, SysDept> implements SysDeptService {
|
||||
|
||||
@Autowired
|
||||
private SysDeptDao sysDeptDao;
|
||||
|
||||
@Override
|
||||
@DataFilter(tableAlias = "d", user = false)
|
||||
public List<SysDept> queryList(Map<String, Object> map) {
|
||||
return sysDeptDao.queryList(map);
|
||||
}
|
||||
@Override
|
||||
public List<Long> queryDetpIdList(Long parentId) {
|
||||
return sysDeptDao.queryDetpIdList(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubDeptIdList(Long deptId){
|
||||
//部门及子部门ID列表
|
||||
List<Long> deptIdList = new ArrayList<>();
|
||||
|
||||
//获取子部门ID
|
||||
List<Long> subIdList = queryDetpIdList(deptId);
|
||||
getDeptTreeList(subIdList, deptIdList);
|
||||
|
||||
//添加本部门
|
||||
deptIdList.add(deptId);
|
||||
|
||||
String deptFilter = StringUtils.join(deptIdList, ",");
|
||||
return deptFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归
|
||||
*/
|
||||
private void getDeptTreeList(List<Long> subIdList, List<Long> deptIdList){
|
||||
for(Long deptId : subIdList){
|
||||
List<Long> list = queryDetpIdList(deptId);
|
||||
if(list.size() > 0){
|
||||
getDeptTreeList(list, deptIdList);
|
||||
}
|
||||
|
||||
deptIdList.add(deptId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.jeefast.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||
|
||||
import cn.jeefast.system.dao.SysLogDao;
|
||||
import cn.jeefast.system.entity.SysLog;
|
||||
import cn.jeefast.system.service.SysLogService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统日志 服务实现类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class SysLogServiceImpl extends ServiceImpl<SysLogDao, SysLog> implements SysLogService {
|
||||
|
||||
@Autowired
|
||||
private SysLogDao sysLogDao;
|
||||
|
||||
@Override
|
||||
public Page<SysLog> selectPageList(Page<SysLog> page, Map<String, Object> map) {
|
||||
page.setRecords(sysLogDao.selectPageList(page, map));
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package cn.jeefast.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||
|
||||
import cn.jeefast.common.utils.Constant;
|
||||
import cn.jeefast.common.utils.Constant.MenuType;
|
||||
import cn.jeefast.system.dao.SysMenuDao;
|
||||
import cn.jeefast.system.entity.SysMenu;
|
||||
import cn.jeefast.system.service.SysMenuService;
|
||||
import cn.jeefast.system.service.SysUserService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单管理 服务实现类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuDao, SysMenu> implements SysMenuService {
|
||||
@Autowired
|
||||
private SysMenuDao sysMenuDao;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
public List<SysMenu> queryListParentId(Long parentId, List<Long> menuIdList) {
|
||||
List<SysMenu> menuList = queryListParentId(parentId);
|
||||
if(menuIdList == null){
|
||||
return menuList;
|
||||
}
|
||||
|
||||
List<SysMenu> userMenuList = new ArrayList<>();
|
||||
for(SysMenu menu : menuList){
|
||||
if(menuIdList.contains(menu.getMenuId())){
|
||||
userMenuList.add(menu);
|
||||
}
|
||||
}
|
||||
return userMenuList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> queryListParentId(Long parentId) {
|
||||
return sysMenuDao.queryListParentId(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> queryNotButtonList() {
|
||||
return sysMenuDao.queryNotButtonList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> getUserMenuList(Long userId) {
|
||||
//系统管理员,拥有最高权限
|
||||
if(userId == Constant.SUPER_ADMIN){
|
||||
return getAllMenuList(null);
|
||||
}
|
||||
|
||||
//用户菜单列表
|
||||
List<Long> menuIdList = sysUserService.queryAllMenuId(userId);
|
||||
return getAllMenuList(menuIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> queryList(Map<String, Object> map) {
|
||||
return sysMenuDao.queryList(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteBatch(Long[] menuIds) {
|
||||
sysMenuDao.deleteBatch(menuIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> queryUserList(Long userId) {
|
||||
return sysMenuDao.queryUserList(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有菜单列表
|
||||
*/
|
||||
private List<SysMenu> getAllMenuList(List<Long> menuIdList){
|
||||
//查询根菜单列表
|
||||
List<SysMenu> menuList = queryListParentId(0L, menuIdList);
|
||||
//递归获取子菜单
|
||||
getMenuTreeList(menuList, menuIdList);
|
||||
|
||||
return menuList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归
|
||||
*/
|
||||
private List<SysMenu> getMenuTreeList(List<SysMenu> menuList, List<Long> menuIdList){
|
||||
List<SysMenu> subMenuList = new ArrayList<SysMenu>();
|
||||
|
||||
for(SysMenu entity : menuList){
|
||||
if(entity.getType() == MenuType.CATALOG.getValue()){//目录
|
||||
entity.setList(getMenuTreeList(queryListParentId(entity.getMenuId(), menuIdList), menuIdList));
|
||||
}
|
||||
subMenuList.add(entity);
|
||||
}
|
||||
|
||||
return subMenuList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.jeefast.system.service.impl;
|
||||
|
||||
import cn.jeefast.system.entity.SysPjinfo;
|
||||
import cn.jeefast.system.dao.SysPjinfoDao;
|
||||
import cn.jeefast.system.service.SysPjinfoService;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class SysPjinfoServiceImpl extends ServiceImpl<SysPjinfoDao, SysPjinfo> implements SysPjinfoService {
|
||||
|
||||
@Autowired
|
||||
private SysPjinfoDao sysPjinfoDao;
|
||||
|
||||
@Override
|
||||
public Page<SysPjinfo> queryPageList(Page<SysPjinfo> page, Map<String, Object> map) {
|
||||
page.setRecords(sysPjinfoDao.queryPageList(page, map));
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBatch(String[] pjinfoIds) {
|
||||
sysPjinfoDao.deleteBatch(pjinfoIds);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue