parent
5b7c96cbce
commit
1d238bc494
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
@ -1 +0,0 @@
|
|||||||
/target/
|
|
@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>tamguo-admin</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,8 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
encoding//src/main/java=UTF-8
|
|
||||||
encoding//src/main/resources=UTF-8
|
|
||||||
encoding//src/main/resources/templates/email/joinus.html=UTF-8
|
|
||||||
encoding//src/main/resources/templates/layout/page.html=UTF-8
|
|
||||||
encoding//src/test/java=UTF-8
|
|
||||||
encoding//src/test/resources=UTF-8
|
|
||||||
encoding/<project>=UTF-8
|
|
@ -1,5 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -1,4 +0,0 @@
|
|||||||
activeProfiles=
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
resolveWorkspaceProjects=true
|
|
||||||
version=1
|
|
@ -1,168 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>com.tamguo</groupId>
|
|
||||||
<artifactId>tamguo-admin</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<name>探果题库后台运营</name>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>1.5.3.RELEASE</version>
|
|
||||||
<relativePath /> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
<mybatis-plus-boot-starter.version>2.1.9</mybatis-plus-boot-starter.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- mybatis-plus begin -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
<version>${mybatis-plus-boot-starter.version}</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>tomcat-jdbc</artifactId>
|
|
||||||
<groupId>org.apache.tomcat</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<!-- mybatis-plus end -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.sourceforge.nekohtml</groupId>
|
|
||||||
<artifactId>nekohtml</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-redis</artifactId>
|
|
||||||
<version>1.3.8.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.session</groupId>
|
|
||||||
<artifactId>spring-session-data-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>fastjson</artifactId>
|
|
||||||
<version>1.2.32</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shiro</groupId>
|
|
||||||
<artifactId>shiro-spring</artifactId>
|
|
||||||
<version>1.2.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shiro</groupId>
|
|
||||||
<artifactId>shiro-ehcache</artifactId>
|
|
||||||
<version>1.2.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.theborakompanioni</groupId>
|
|
||||||
<artifactId>thymeleaf-extras-shiro</artifactId>
|
|
||||||
<version>1.2.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.songxinqiang</groupId>
|
|
||||||
<artifactId>com.baidu.ueditor</artifactId>
|
|
||||||
<version>1.1.2-edit-1.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-fileupload</groupId>
|
|
||||||
<artifactId>commons-fileupload</artifactId>
|
|
||||||
<version>1.3.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.penggle</groupId>
|
|
||||||
<artifactId>kaptcha</artifactId>
|
|
||||||
<version>2.3.2</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid</artifactId>
|
|
||||||
<version>1.0.18</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
|
||||||
<version>3.2.8</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-email</artifactId>
|
|
||||||
<version>1.5</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-dependencies</artifactId>
|
|
||||||
<version>Camden.SR6</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>tamguo-admin</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -1,37 +0,0 @@
|
|||||||
package com.tamguo.admin;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
||||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
|
||||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@ComponentScan("com.tamguo.admin")
|
|
||||||
public class TamguoAdminApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(TamguoAdminApplication.class).web(true).run(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FastJson替代Jackson
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public HttpMessageConverters fastJsonHttpMessageConverters() {
|
|
||||||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
|
||||||
FastJsonConfig fastJsonConfig = new FastJsonConfig();
|
|
||||||
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
|
|
||||||
fastConverter.setFastJsonConfig(fastJsonConfig);
|
|
||||||
HttpMessageConverter<?> converter = fastConverter;
|
|
||||||
return new HttpMessageConverters(converter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
package com.tamguo.admin.config;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
|
|
||||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
|
|
||||||
import org.springframework.boot.web.servlet.ErrorPage;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
||||||
|
|
||||||
import com.google.code.kaptcha.impl.DefaultKaptcha;
|
|
||||||
import com.google.code.kaptcha.util.Config;
|
|
||||||
import com.tamguo.admin.interceptor.MenuInterceptor;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class WebConfig extends WebMvcConfigurerAdapter {
|
|
||||||
|
|
||||||
@Value("${file.storage.path}")
|
|
||||||
private String fileStoragePath;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MenuInterceptor menuInterceptor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拦截器
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
|
||||||
registry.addInterceptor(menuInterceptor).addPathPatterns("/**");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
registry.addResourceHandler("/files/**").addResourceLocations("file:"+fileStoragePath);
|
|
||||||
super.addResourceHandlers(registry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(name="producer")
|
|
||||||
public DefaultKaptcha getKaptchaBean(){
|
|
||||||
DefaultKaptcha defaultKaptcha=new DefaultKaptcha();
|
|
||||||
Properties properties=new Properties();
|
|
||||||
// properties.setProperty("kaptcha.border.color", "105,179,90");
|
|
||||||
properties.setProperty("kaptcha.border", "no");
|
|
||||||
properties.setProperty("kaptcha.image.width", "125");
|
|
||||||
properties.setProperty("kaptcha.image.height", "45");
|
|
||||||
properties.setProperty("kaptcha.session.key", "code");
|
|
||||||
properties.setProperty("kaptcha.textproducer.char.length", "4");
|
|
||||||
properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
|
|
||||||
Config config=new Config(properties);
|
|
||||||
defaultKaptcha.setConfig(config);
|
|
||||||
return defaultKaptcha;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public EmbeddedServletContainerCustomizer containerCustomizer() {
|
|
||||||
return new EmbeddedServletContainerCustomizer(){
|
|
||||||
@Override
|
|
||||||
public void customize(ConfigurableEmbeddedServletContainer container) {
|
|
||||||
container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"));
|
|
||||||
container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.tamguo.admin.config.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
|
|
||||||
import com.tamguo.admin.TamguoAdminApplication;
|
|
||||||
|
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注入公共字段自动填充,任选注入方式即可
|
|
||||||
*/
|
|
||||||
//@Component
|
|
||||||
public class MyMetaObjectHandler extends MetaObjectHandler {
|
|
||||||
|
|
||||||
protected final static Logger logger = LoggerFactory.getLogger(TamguoAdminApplication.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void insertFill(MetaObject metaObject) {
|
|
||||||
logger.info("新增的时候干点不可描述的事情");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateFill(MetaObject metaObject) {
|
|
||||||
logger.info("更新的时候干点不可描述的事情");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package com.tamguo.admin.config.dao;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.baomidou.mybatisplus.activerecord.Model;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实体父类
|
|
||||||
*/
|
|
||||||
public class SuperEntity<T extends Model<?>> extends Model<T> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableId("uid")
|
|
||||||
private String uid;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Serializable pkVal() {
|
|
||||||
return this.getUid();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUid() {
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUid(String uid) {
|
|
||||||
this.uid = uid;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.tamguo.admin.config.redis;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
|
||||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
|
||||||
|
|
||||||
//这个类用配置redis服务器的连接
|
|
||||||
@EnableRedisHttpSession(maxInactiveIntervalInSeconds= 1800)
|
|
||||||
public class SessionConfig {
|
|
||||||
|
|
||||||
@Value("${redis.hostname}")
|
|
||||||
String HostName;
|
|
||||||
@Value("${redis.port}")
|
|
||||||
int Port;
|
|
||||||
@Value("${redis.password}")
|
|
||||||
String password;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public JedisConnectionFactory connectionFactory() {
|
|
||||||
JedisConnectionFactory connection = new JedisConnectionFactory();
|
|
||||||
connection.setPort(Port);
|
|
||||||
connection.setHostName(HostName);
|
|
||||||
connection.setPassword(password);
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package com.tamguo.admin.config.redis;
|
|
||||||
|
|
||||||
import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer;
|
|
||||||
|
|
||||||
//初始化Session配置
|
|
||||||
public class SessionInitializer extends AbstractHttpSessionApplicationInitializer{
|
|
||||||
public SessionInitializer() {
|
|
||||||
super(SessionConfig.class);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
package com.tamguo.admin.config.shiro;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
|
||||||
import org.apache.shiro.authc.AuthenticationInfo;
|
|
||||||
import org.apache.shiro.authc.AuthenticationToken;
|
|
||||||
import org.apache.shiro.authc.IncorrectCredentialsException;
|
|
||||||
import org.apache.shiro.authc.LockedAccountException;
|
|
||||||
import org.apache.shiro.authc.SimpleAuthenticationInfo;
|
|
||||||
import org.apache.shiro.authc.UnknownAccountException;
|
|
||||||
import org.apache.shiro.authz.AuthorizationInfo;
|
|
||||||
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
|
||||||
import org.apache.shiro.realm.AuthorizingRealm;
|
|
||||||
import org.apache.shiro.subject.PrincipalCollection;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import com.tamguo.admin.model.SysMenuEntity;
|
|
||||||
import com.tamguo.admin.model.SysUserEntity;
|
|
||||||
import com.tamguo.admin.model.enums.SysUserStatusEnum;
|
|
||||||
import com.tamguo.admin.service.ISysMenuService;
|
|
||||||
import com.tamguo.admin.service.ISysUserService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 认证
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class UserRealm extends AuthorizingRealm {
|
|
||||||
@Autowired
|
|
||||||
private ISysMenuService sysMenuService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService sysUserService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 授权(验证权限时调用)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
|
||||||
SysUserEntity user = (SysUserEntity)principals.getPrimaryPrincipal();
|
|
||||||
String userId = user.getUid();
|
|
||||||
|
|
||||||
List<String> permsList = null;
|
|
||||||
|
|
||||||
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(userId);
|
|
||||||
permsList = new ArrayList<>();
|
|
||||||
for(SysMenuEntity menu : menuList){
|
|
||||||
permsList.add(menu.getPerms());
|
|
||||||
}
|
|
||||||
//用户权限列表
|
|
||||||
Set<String> permsSet = new HashSet<String>();
|
|
||||||
for(String perms : permsList){
|
|
||||||
if(StringUtils.isEmpty(perms)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
permsSet.addAll(Arrays.asList(perms.trim().split(",")));
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
|
||||||
info.setStringPermissions(permsSet);
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 认证(登录时调用)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected AuthenticationInfo doGetAuthenticationInfo(
|
|
||||||
AuthenticationToken token) throws AuthenticationException {
|
|
||||||
String username = (String) token.getPrincipal();
|
|
||||||
String password = new String((char[]) token.getCredentials());
|
|
||||||
|
|
||||||
//查询用户信息
|
|
||||||
SysUserEntity user = sysUserService.queryByUserName(username);
|
|
||||||
|
|
||||||
//账号不存在
|
|
||||||
if(user == null) {
|
|
||||||
throw new UnknownAccountException("账号或密码不正确");
|
|
||||||
}
|
|
||||||
|
|
||||||
//密码错误
|
|
||||||
if(!password.equals(user.getPassword())) {
|
|
||||||
throw new IncorrectCredentialsException("账号或密码不正确");
|
|
||||||
}
|
|
||||||
|
|
||||||
//账号锁定
|
|
||||||
if(user.getStatus() == SysUserStatusEnum.LOCKED){
|
|
||||||
throw new LockedAccountException("账号已被锁定,请联系管理员");
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName());
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
package com.tamguo.admin.config.ueditor;
|
|
||||||
|
|
||||||
public class UEditorConfig {
|
|
||||||
|
|
||||||
public final static String UEDITOR_CONFIG = "{" +
|
|
||||||
" \"imageActionName\": \"uploadimage\"," +
|
|
||||||
" \"imageFieldName\": \"upfile\"," +
|
|
||||||
" \"imageMaxSize\": 2048000," +
|
|
||||||
" \"imageAllowFiles\": [\".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"]," +
|
|
||||||
" \"imageCompressEnable\": true," +
|
|
||||||
" \"imageCompressBorder\": 1600," +
|
|
||||||
" \"imageInsertAlign\": \"none\"," +
|
|
||||||
" \"imageUrlPrefix\": \"\"," +
|
|
||||||
" \"imagePathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\"," +
|
|
||||||
" \"scrawlActionName\": \"uploadscrawl\"," +
|
|
||||||
" \"scrawlFieldName\": \"upfile\"," +
|
|
||||||
" \"scrawlPathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\"," +
|
|
||||||
" \"scrawlMaxSize\": 2048000," +
|
|
||||||
" \"scrawlUrlPrefix\": \"\"," +
|
|
||||||
" \"scrawlInsertAlign\": \"none\"," +
|
|
||||||
" \"snapscreenActionName\": \"uploadimage\"," +
|
|
||||||
" \"snapscreenPathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\"," +
|
|
||||||
" \"snapscreenUrlPrefix\": \"\"," +
|
|
||||||
" \"snapscreenInsertAlign\": \"none\"," +
|
|
||||||
" \"catcherLocalDomain\": [\"127.0.0.1\", \"localhost\", \"img.baidu.com\"]," +
|
|
||||||
" \"catcherActionName\": \"catchimage\"," +
|
|
||||||
" \"catcherFieldName\": \"source\"," +
|
|
||||||
" \"catcherPathFormat\": \"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}\"," +
|
|
||||||
" \"catcherUrlPrefix\": \"\"," +
|
|
||||||
" \"catcherMaxSize\": 2048000," +
|
|
||||||
" \"catcherAllowFiles\": [\".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"]," +
|
|
||||||
" \"videoActionName\": \"uploadvideo\"," +
|
|
||||||
" \"videoFieldName\": \"upfile\"," +
|
|
||||||
" \"videoPathFormat\": \"/ueditor/jsp/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}\"," +
|
|
||||||
" \"videoUrlPrefix\": \"\"," +
|
|
||||||
" \"videoMaxSize\": 102400000," +
|
|
||||||
" \"videoAllowFiles\": [" +
|
|
||||||
" \".flv\", \".swf\", \".mkv\", \".avi\", \".rm\", \".rmvb\", \".mpeg\", \".mpg\"," +
|
|
||||||
" \".ogg\", \".ogv\", \".mov\", \".wmv\", \".mp4\", \".webm\", \".mp3\", \".wav\", \".mid\"" +
|
|
||||||
" ]," +
|
|
||||||
" \"fileActionName\": \"uploadfile\"," +
|
|
||||||
" \"fileFieldName\": \"upfile\"," +
|
|
||||||
" \"filePathFormat\": \"/ueditor/jsp/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}\"," +
|
|
||||||
" \"fileUrlPrefix\": \"\"," +
|
|
||||||
" \"fileMaxSize\": 51200000," +
|
|
||||||
" \"fileAllowFiles\": [" +
|
|
||||||
" \".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"," +
|
|
||||||
" \".flv\", \".swf\", \".mkv\", \".avi\", \".rm\", \".rmvb\", \".mpeg\", \".mpg\"," +
|
|
||||||
" \".ogg\", \".ogv\", \".mov\", \".wmv\", \".mp4\", \".webm\", \".mp3\", \".wav\", \".mid\"," +
|
|
||||||
" \".rar\", \".zip\", \".tar\", \".gz\", \".7z\", \".bz2\", \".cab\", \".iso\"," +
|
|
||||||
" \".doc\", \".docx\", \".xls\", \".xlsx\", \".ppt\", \".pptx\", \".pdf\", \".txt\", \".md\", \".xml\"" +
|
|
||||||
" ]," +
|
|
||||||
" \"imageManagerActionName\": \"listimage\"," +
|
|
||||||
" \"imageManagerListPath\": \"/ueditor/jsp/upload/image/\"," +
|
|
||||||
" \"imageManagerListSize\": 20," +
|
|
||||||
" \"imageManagerUrlPrefix\": \"\"," +
|
|
||||||
" \"imageManagerInsertAlign\": \"none\"," +
|
|
||||||
" \"imageManagerAllowFiles\": [\".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"]," +
|
|
||||||
" \"fileManagerActionName\": \"listfile\"," +
|
|
||||||
" \"fileManagerListPath\": \"/ueditor/jsp/upload/file/\"," +
|
|
||||||
" \"fileManagerUrlPrefix\": \"\"," +
|
|
||||||
" \"fileManagerListSize\": 20," +
|
|
||||||
" \"fileManagerAllowFiles\": [" +
|
|
||||||
" \".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"," +
|
|
||||||
" \".flv\", \".swf\", \".mkv\", \".avi\", \".rm\", \".rmvb\", \".mpeg\", \".mpg\"," +
|
|
||||||
" \".ogg\", \".ogv\", \".mov\", \".wmv\", \".mp4\", \".webm\", \".mp3\", \".wav\", \".mid\"," +
|
|
||||||
" \".rar\", \".zip\", \".tar\", \".gz\", \".7z\", \".bz2\", \".cab\", \".iso\"," +
|
|
||||||
" \".doc\", \".docx\", \".xls\", \".xlsx\", \".ppt\", \".pptx\", \".pdf\", \".txt\", \".md\", \".xml\"" +
|
|
||||||
" ]" +
|
|
||||||
"}";
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.tamguo.admin.config.ueditor;
|
|
||||||
|
|
||||||
public class Ueditor {
|
|
||||||
|
|
||||||
private String state;
|
|
||||||
private String url;
|
|
||||||
private String title;
|
|
||||||
private String original;
|
|
||||||
|
|
||||||
public String getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(String state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOriginal() {
|
|
||||||
return original;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginal(String original) {
|
|
||||||
this.original = original;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.AdEntity;
|
|
||||||
|
|
||||||
public interface AdMapper extends SuperMapper<AdEntity>{
|
|
||||||
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.AreaEntity;
|
|
||||||
|
|
||||||
public interface AreaMapper extends SuperMapper<AreaEntity>{
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.model.BookEntity;
|
|
||||||
|
|
||||||
public interface BookMapper extends BaseMapper<BookEntity>{
|
|
||||||
|
|
||||||
List<BookEntity> queryPage(@Param(value="name")String name , Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.ChapterEntity;
|
|
||||||
|
|
||||||
public interface ChapterMapper extends SuperMapper<ChapterEntity>{
|
|
||||||
|
|
||||||
List<ChapterEntity> findByBookId(@Param(value="bookId") String bookId);
|
|
||||||
|
|
||||||
List<ChapterEntity> findByParentId(@Param(value="parentId") String parentId);
|
|
||||||
|
|
||||||
ChapterEntity findNextPoint(@Param(value="uid")String uid , @Param(value="orders")Integer orders);
|
|
||||||
|
|
||||||
void deleteByCourseId(@Param(value="courseId")String courseId);
|
|
||||||
|
|
||||||
List<ChapterEntity> queryPage(@Param(value="name")String name, Pagination page);
|
|
||||||
|
|
||||||
ChapterEntity select(@Param(value="chapterId")String chapterId);
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.CourseEntity;
|
|
||||||
|
|
||||||
public interface CourseMapper extends SuperMapper<CourseEntity>{
|
|
||||||
|
|
||||||
List<CourseEntity> findBySubjectId(String subjectId);
|
|
||||||
|
|
||||||
List<CourseEntity> queryPageByName(@Param(value="name")String name , Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.MemberEntity;
|
|
||||||
|
|
||||||
public interface MemberMapper extends SuperMapper<MemberEntity>{
|
|
||||||
|
|
||||||
MemberEntity findByUsername(String username);
|
|
||||||
|
|
||||||
MemberEntity findByMobile(String mobile);
|
|
||||||
|
|
||||||
MemberEntity findByUsernameOrEmailOrMobile(@Param(value="account")String account);
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.MenuEntity;
|
|
||||||
|
|
||||||
public interface MenuMapper extends SuperMapper<MenuEntity>{
|
|
||||||
|
|
||||||
public List<MenuEntity> findFatherMenus();
|
|
||||||
|
|
||||||
public List<MenuEntity> findMenuByParentId(String parentId);
|
|
||||||
|
|
||||||
public List<MenuEntity> findAllFatherMenus();
|
|
||||||
|
|
||||||
public List<MenuEntity> findLeftFatherMenus();
|
|
||||||
|
|
||||||
public List<MenuEntity> findFooterFatherMenus();
|
|
||||||
|
|
||||||
public List<MenuEntity> findByName(String name , Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.PaperEntity;
|
|
||||||
|
|
||||||
public interface PaperMapper extends SuperMapper<PaperEntity>{
|
|
||||||
|
|
||||||
List<PaperEntity> findByTypeAndAreaId(@Param(value="type")String type, @Param(value="areaId")String areaId ,Pagination page);
|
|
||||||
|
|
||||||
List<PaperEntity> findByAreaId(@Param(value="areaId") String areaId , Pagination page);
|
|
||||||
|
|
||||||
List<PaperEntity> findBySchoolId(@Param(value="schoolId")String schoolId , Pagination page);
|
|
||||||
|
|
||||||
List<PaperEntity> findList(@Param(value="courseId")String courseId, @Param(value="paperType")String paperType,
|
|
||||||
@Param(value="year")String year, @Param(value="area")String area , Pagination page);
|
|
||||||
|
|
||||||
List<PaperEntity> findPaperByAreaId(@Param(value="areaId")String areaId , @Param(value="type")String type , Pagination page);
|
|
||||||
|
|
||||||
Long getPaperTotal();
|
|
||||||
|
|
||||||
List<PaperEntity> queryPageByName(@Param(value="name")String name , Pagination page);
|
|
||||||
|
|
||||||
List<PaperEntity> findByCreaterId(@Param(value="createrId")String createrId);
|
|
||||||
|
|
||||||
List<PaperEntity> queryPageByNameAndCreatorId(@Param(value="name")String name, @Param(value="memberId")String memberId , Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.QuestionEntity;
|
|
||||||
|
|
||||||
public interface QuestionMapper extends SuperMapper<QuestionEntity>{
|
|
||||||
|
|
||||||
List<QuestionEntity> findByChapterId(@Param(value="chapterId")String chapterId , Pagination page);
|
|
||||||
|
|
||||||
List<QuestionEntity> findByPaperId(@Param(value="paperId")String paperId);
|
|
||||||
|
|
||||||
List<QuestionEntity> queryPageByName(@Param(value="name")String name , Pagination page);
|
|
||||||
|
|
||||||
List<QuestionEntity> queryQuestionList(@Param(value="questionType")String questionType , @Param(value="uid")String uid , @Param(value="reviewPoint")String reviewPoint , Pagination page);
|
|
||||||
|
|
||||||
QuestionEntity selectByUid(@Param(value="uid")String uid);
|
|
||||||
|
|
||||||
QuestionEntity findNormalQuestion(@Param(value="uid")String uid);
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.SchoolEntity;
|
|
||||||
|
|
||||||
public interface SchoolMapper extends SuperMapper<SchoolEntity>{
|
|
||||||
|
|
||||||
List<SchoolEntity> findByAreaId(String beijingAreaId , Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.SubjectEntity;
|
|
||||||
|
|
||||||
public interface SubjectMapper extends SuperMapper<SubjectEntity>{
|
|
||||||
|
|
||||||
List<SubjectEntity> queryPage(@Param(value="name")String name , Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.SysMenuEntity;
|
|
||||||
|
|
||||||
public interface SysMenuMapper extends SuperMapper<SysMenuEntity>{
|
|
||||||
|
|
||||||
List<SysMenuEntity> queryList(Map<String, Object> hashMap , Pagination page);
|
|
||||||
|
|
||||||
List<SysMenuEntity> queryNotButtonList();
|
|
||||||
|
|
||||||
SysMenuEntity queryByParentId(String parentId);
|
|
||||||
|
|
||||||
SysMenuEntity queryByUid(String uid);
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.SysRoleEntity;
|
|
||||||
|
|
||||||
public interface SysRoleMapper extends SuperMapper<SysRoleEntity>{
|
|
||||||
|
|
||||||
List<SysRoleEntity> selectPageByName(SysRoleEntity sysRoleEntity, Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.SysUserEntity;
|
|
||||||
|
|
||||||
public interface SysUserMapper extends SuperMapper<SysUserEntity>{
|
|
||||||
|
|
||||||
SysUserEntity queryByUserName(String username);
|
|
||||||
|
|
||||||
List<SysUserEntity> queryPage(@Param(value="userName")String userName , Page<SysUserEntity> page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.tamguo.admin.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
|
||||||
import com.tamguo.admin.config.dao.SuperMapper;
|
|
||||||
import com.tamguo.admin.model.TeacherEntity;
|
|
||||||
|
|
||||||
public interface TeacherMapper extends SuperMapper<TeacherEntity>{
|
|
||||||
|
|
||||||
List<TeacherEntity> queryPage(@Param(value="mobile") String mobile , Pagination page);
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.tamguo.admin.dao.redis;
|
|
||||||
|
|
||||||
public class PoolConfigBean {
|
|
||||||
private int max_active;
|
|
||||||
private int max_idle;
|
|
||||||
private long max_wait;
|
|
||||||
|
|
||||||
public PoolConfigBean() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public PoolConfigBean(int max_active, int max_idle, long max_wait) {
|
|
||||||
super();
|
|
||||||
this.max_active = max_active;
|
|
||||||
this.max_idle = max_idle;
|
|
||||||
this.max_wait = max_wait;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMax_active() {
|
|
||||||
return max_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMax_active(int max_active) {
|
|
||||||
this.max_active = max_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMax_idle() {
|
|
||||||
return max_idle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMax_idle(int max_idle) {
|
|
||||||
this.max_idle = max_idle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getMax_wait() {
|
|
||||||
return max_wait;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMax_wait(long max_wait) {
|
|
||||||
this.max_wait = max_wait;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "PoolConfig [max_active=" + max_active + ", max_idle=" + max_idle + ", max_wait=" + max_wait + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package com.tamguo.admin.dao.redis;
|
|
||||||
|
|
||||||
public class RedisServerNodeBean {
|
|
||||||
private String ip;
|
|
||||||
private int port;
|
|
||||||
private boolean needAuth;
|
|
||||||
private String auth;
|
|
||||||
|
|
||||||
public RedisServerNodeBean(String ip, int port, boolean needAuth, String auth) {
|
|
||||||
this.ip = ip;
|
|
||||||
this.port = port;
|
|
||||||
this.needAuth = needAuth;
|
|
||||||
this.auth = auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIp() {
|
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIp(String ip) {
|
|
||||||
this.ip = ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPort() {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPort(int port) {
|
|
||||||
this.port = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNeedAuth() {
|
|
||||||
return needAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNeedAuth(boolean needAuth) {
|
|
||||||
this.needAuth = needAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuth() {
|
|
||||||
return auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuth(String auth) {
|
|
||||||
this.auth = auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "RedisServer [ip=" + ip + ", port=" + port + ", needAuth=" + needAuth + ", auth=" + auth + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,175 +0,0 @@
|
|||||||
package com.tamguo.admin.dao.redis;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
import com.tamguo.admin.util.XMLConfiguration;
|
|
||||||
|
|
||||||
import redis.clients.jedis.JedisPoolConfig;
|
|
||||||
import redis.clients.jedis.JedisShardInfo;
|
|
||||||
import redis.clients.jedis.ShardedJedis;
|
|
||||||
import redis.clients.jedis.ShardedJedisPool;
|
|
||||||
|
|
||||||
@Component("redisConfigure")
|
|
||||||
public class RedisXMLConfigure implements InitializingBean {
|
|
||||||
private static final Logger logger = Logger.getLogger(RedisXMLConfigure.class);
|
|
||||||
private static String preKey;
|
|
||||||
private static Document document = null;
|
|
||||||
private ShardedJedisPool shardedJedisPool;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterPropertiesSet() throws Exception {
|
|
||||||
XMLConfiguration xmlConfiguration = new XMLConfiguration();
|
|
||||||
String REDIS_PATH = "redis.xml";
|
|
||||||
InputStream stream = null;
|
|
||||||
try {
|
|
||||||
stream = this.getClass().getClassLoader().getResourceAsStream(REDIS_PATH);
|
|
||||||
if (stream == null) {
|
|
||||||
logger.error("load redis.xml failed!!!" + REDIS_PATH);
|
|
||||||
throw new RuntimeException("load redis.xml failed");
|
|
||||||
}
|
|
||||||
logger.info("Redis XML config path:" + REDIS_PATH);
|
|
||||||
if (xmlConfiguration.readConfigFile(stream)) {
|
|
||||||
document = xmlConfiguration.getDocument();
|
|
||||||
} else {
|
|
||||||
logger.error("load redis.xml failed!!!");
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (null != stream)
|
|
||||||
stream.close();
|
|
||||||
}
|
|
||||||
//初始化参数
|
|
||||||
initPreKey();
|
|
||||||
PoolConfigBean pcb = initPoolConfigBean();
|
|
||||||
List<RedisServerNodeBean> rsnbs = initRedisServerNodeBeans();
|
|
||||||
//实现shardedJedisPool
|
|
||||||
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
|
|
||||||
//no maxActive config
|
|
||||||
jedisPoolConfig.setMaxIdle(pcb.getMax_idle());
|
|
||||||
jedisPoolConfig.setMaxWaitMillis(pcb.getMax_wait());
|
|
||||||
shardedJedisPool = new ShardedJedisPool(jedisPoolConfig,getJedisShardInfo(rsnbs));
|
|
||||||
if(shardedJedisPool == null){
|
|
||||||
throw new RuntimeException("config redis.xml error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化jedis参数
|
|
||||||
*/
|
|
||||||
private PoolConfigBean initPoolConfigBean() {
|
|
||||||
PoolConfigBean poolConfigBean = new PoolConfigBean();
|
|
||||||
Element poolElement = (Element) document.getElementsByTagName("pool").item(0);
|
|
||||||
int max_active = poolElement.hasAttribute("maxActive") ? Integer.parseInt(poolElement.getAttribute("maxActive")) : -1;
|
|
||||||
int max_idle = poolElement.hasAttribute("maxIdle") ? Integer.parseInt(poolElement.getAttribute("maxIdle")) : -1;
|
|
||||||
long max_wait = poolElement.hasAttribute("maxWait") ? Long.parseLong(poolElement.getAttribute("maxWait")) : -1;
|
|
||||||
poolConfigBean.setMax_active(max_active);
|
|
||||||
poolConfigBean.setMax_idle(max_idle);
|
|
||||||
poolConfigBean.setMax_wait(max_wait);
|
|
||||||
return poolConfigBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解析配置redis的server列表
|
|
||||||
*/
|
|
||||||
private List<RedisServerNodeBean> initRedisServerNodeBeans() {
|
|
||||||
List<RedisServerNodeBean> redisServers = new ArrayList<RedisServerNodeBean>();
|
|
||||||
NodeList serverElements = document.getElementsByTagName("server");
|
|
||||||
int serverLen = serverElements.getLength();
|
|
||||||
if (serverLen < 1) {
|
|
||||||
logger.error("redis.servers.server must have one !");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < serverLen; i++) {
|
|
||||||
Element serverElement = (Element) serverElements.item(i);
|
|
||||||
String temp_ip = serverElement.hasAttribute("ip") ? serverElement.getAttribute("ip") : null;
|
|
||||||
if (temp_ip == null) {
|
|
||||||
logger.error("redis.servers.server.ip must be supplied!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
String temp_port = serverElement.hasAttribute("port") ? serverElement.getAttribute("port") : "6379";
|
|
||||||
String temp_needAuth = serverElement.hasAttribute("needAuth") ? serverElement.getAttribute("needAuth") : "false";
|
|
||||||
String temp_auth = null;
|
|
||||||
// need auth
|
|
||||||
if ("true".equals(temp_needAuth)) {
|
|
||||||
temp_auth = serverElement.hasAttribute("auth") ? serverElement.getAttribute("auth") : null;
|
|
||||||
if (null == temp_auth) {
|
|
||||||
logger.error("since needAuth is true,auth must be supplied!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RedisServerNodeBean rs = null;
|
|
||||||
try {
|
|
||||||
rs = new RedisServerNodeBean(temp_ip, Integer.parseInt(temp_port), Boolean.parseBoolean(temp_needAuth), temp_auth);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
logger.error("port must be a number!\n" + e.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
redisServers.add(rs);
|
|
||||||
}
|
|
||||||
return redisServers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换自定义配置为JedisShardInfo对象
|
|
||||||
* @param redisServers
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private List<JedisShardInfo> getJedisShardInfo(List<RedisServerNodeBean> redisServers) {
|
|
||||||
if(redisServers == null){
|
|
||||||
logger.error("redisServers must not be empty null");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int serverLen = redisServers.size();
|
|
||||||
if (serverLen < 1) {
|
|
||||||
logger.error("redisServers must not be empty ");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<JedisShardInfo> servers = new ArrayList<JedisShardInfo>(serverLen);
|
|
||||||
for (int i = 0; i < serverLen; i++) {
|
|
||||||
RedisServerNodeBean redisServer = redisServers.get(i);
|
|
||||||
JedisShardInfo jedisShardInfo = new JedisShardInfo(redisServer.getIp(), redisServer.getPort());
|
|
||||||
if (redisServer.isNeedAuth()) {
|
|
||||||
jedisShardInfo.setPassword(redisServer.getAuth());
|
|
||||||
}
|
|
||||||
servers.add(jedisShardInfo);
|
|
||||||
}
|
|
||||||
return servers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 初始化redis的key前缀
|
|
||||||
*/
|
|
||||||
private void initPreKey() {
|
|
||||||
Element preKeyElement = (Element) document.getElementsByTagName("preKey").item(0);
|
|
||||||
preKey = preKeyElement.hasAttribute("value") ? preKeyElement.getAttribute("value") : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPreKey() {
|
|
||||||
return preKey;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 从jedis连接池获得一个连接
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public ShardedJedis getConnection() {
|
|
||||||
return shardedJedisPool.getResource();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 把连接放回jedis连接池
|
|
||||||
* @param resource
|
|
||||||
*/
|
|
||||||
public void closeConnection(ShardedJedis resource) {
|
|
||||||
resource.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_ad database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_ad")
|
|
||||||
public class AdEntity extends SuperEntity<AdEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String businessKey;
|
|
||||||
private String name;
|
|
||||||
private String adInfo;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAdInfo() {
|
|
||||||
return adInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdInfo(String adInfo) {
|
|
||||||
this.adInfo = adInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONArray getAds(){
|
|
||||||
if(StringUtils.isEmpty(getAdInfo())){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return JSONArray.parseArray(getAdInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBusinessKey() {
|
|
||||||
return businessKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBusinessKey(String businessKey) {
|
|
||||||
this.businessKey = businessKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_chapter database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_area")
|
|
||||||
public class AreaEntity extends SuperEntity<AreaEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private Integer orders;
|
|
||||||
private String fullName;
|
|
||||||
private Integer grade;
|
|
||||||
private String treePath;
|
|
||||||
private String parent;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrders() {
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrders(Integer orders) {
|
|
||||||
this.orders = orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFullName() {
|
|
||||||
return fullName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFullName(String fullName) {
|
|
||||||
this.fullName = fullName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getGrade() {
|
|
||||||
return grade;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGrade(Integer grade) {
|
|
||||||
this.grade = grade;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTreePath() {
|
|
||||||
return treePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTreePath(String treePath) {
|
|
||||||
this.treePath = treePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParent(String parent) {
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
@TableName(value="tiku_book")
|
|
||||||
public class BookEntity extends SuperEntity<BookEntity>{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String subjectId;
|
|
||||||
private String courseId;
|
|
||||||
private String name;
|
|
||||||
private String publishingHouse;
|
|
||||||
private Integer questionNum;
|
|
||||||
private Integer pointNum;
|
|
||||||
private Integer orders;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String courseName;
|
|
||||||
|
|
||||||
public String getCourseId() {
|
|
||||||
return courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseId(String courseId) {
|
|
||||||
this.courseId = courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPublishingHouse() {
|
|
||||||
return publishingHouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublishingHouse(String publishingHouse) {
|
|
||||||
this.publishingHouse = publishingHouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getQuestionNum() {
|
|
||||||
return questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuestionNum(Integer questionNum) {
|
|
||||||
this.questionNum = questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPointNum() {
|
|
||||||
return pointNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointNum(Integer pointNum) {
|
|
||||||
this.pointNum = pointNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrders() {
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrders(Integer orders) {
|
|
||||||
this.orders = orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseName() {
|
|
||||||
return courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseName(String courseName) {
|
|
||||||
this.courseName = courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectId() {
|
|
||||||
return subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectId(String subjectId) {
|
|
||||||
this.subjectId = subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_chapter database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_chapter")
|
|
||||||
public class ChapterEntity extends SuperEntity<ChapterEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String courseId;
|
|
||||||
private String bookId;
|
|
||||||
private String name;
|
|
||||||
private String parentId;
|
|
||||||
private Integer questionNum;
|
|
||||||
private Integer pointNum;
|
|
||||||
private Integer orders;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String parentName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<ChapterEntity> childChapterList;
|
|
||||||
|
|
||||||
public ChapterEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseId() {
|
|
||||||
return this.courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseId(String courseId) {
|
|
||||||
this.courseId = courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentId() {
|
|
||||||
return this.parentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentId(String parentId) {
|
|
||||||
this.parentId = parentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ChapterEntity> getChildChapterList() {
|
|
||||||
return childChapterList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChildChapterList(List<ChapterEntity> childChapterList) {
|
|
||||||
this.childChapterList = childChapterList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getQuestionNum() {
|
|
||||||
return questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuestionNum(Integer questionNum) {
|
|
||||||
this.questionNum = questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPointNum() {
|
|
||||||
return pointNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointNum(Integer pointNum) {
|
|
||||||
this.pointNum = pointNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrders() {
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrders(Integer orders) {
|
|
||||||
this.orders = orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentName() {
|
|
||||||
return parentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentName(String parentName) {
|
|
||||||
this.parentName = parentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBookId() {
|
|
||||||
return bookId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBookId(String bookId) {
|
|
||||||
this.bookId = bookId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_course database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_course")
|
|
||||||
public class CourseEntity extends SuperEntity<CourseEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String subjectId;
|
|
||||||
private Integer pointNum;
|
|
||||||
private Integer questionNum;
|
|
||||||
private Integer orders;
|
|
||||||
private String seoTitle;
|
|
||||||
private String seoKeywords;
|
|
||||||
private String seoDescription;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String subjectName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<ChapterEntity> chapterList;
|
|
||||||
|
|
||||||
public CourseEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectId() {
|
|
||||||
return this.subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectId(String subjectId) {
|
|
||||||
this.subjectId = subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getQuestionNum() {
|
|
||||||
return questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuestionNum(Integer questionNum) {
|
|
||||||
this.questionNum = questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPointNum() {
|
|
||||||
return pointNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointNum(Integer pointNum) {
|
|
||||||
this.pointNum = pointNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrders() {
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrders(Integer orders) {
|
|
||||||
this.orders = orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ChapterEntity> getChapterList() {
|
|
||||||
return chapterList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChapterList(List<ChapterEntity> chapterList) {
|
|
||||||
this.chapterList = chapterList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeoTitle() {
|
|
||||||
return seoTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeoTitle(String seoTitle) {
|
|
||||||
this.seoTitle = seoTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeoKeywords() {
|
|
||||||
return seoKeywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeoKeywords(String seoKeywords) {
|
|
||||||
this.seoKeywords = seoKeywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeoDescription() {
|
|
||||||
return seoDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeoDescription(String seoDescription) {
|
|
||||||
this.seoDescription = seoDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectName() {
|
|
||||||
return subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectName(String subjectName) {
|
|
||||||
this.subjectName = subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,164 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_ad database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_member")
|
|
||||||
public class MemberEntity extends SuperEntity<MemberEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String subjectId;
|
|
||||||
private String courseId;
|
|
||||||
private String username;
|
|
||||||
private String nickName;
|
|
||||||
private String password;
|
|
||||||
private String avatar;
|
|
||||||
private String mobile;
|
|
||||||
private String email;
|
|
||||||
private Integer point;
|
|
||||||
private BigDecimal amount;
|
|
||||||
private Long lastLoginTime;
|
|
||||||
private Integer paperNum;
|
|
||||||
private Integer questionNum;
|
|
||||||
private Integer downNum;
|
|
||||||
private Integer hitsNum;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String verifyCode;
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAvatar() {
|
|
||||||
return avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAvatar(String avatar) {
|
|
||||||
this.avatar = avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPoint() {
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoint(Integer point) {
|
|
||||||
this.point = point;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAmount() {
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAmount(BigDecimal amount) {
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getLastLoginTime() {
|
|
||||||
return lastLoginTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastLoginTime(Long lastLoginTime) {
|
|
||||||
this.lastLoginTime = lastLoginTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPaperNum() {
|
|
||||||
return paperNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPaperNum(Integer paperNum) {
|
|
||||||
this.paperNum = paperNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getQuestionNum() {
|
|
||||||
return questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuestionNum(Integer questionNum) {
|
|
||||||
this.questionNum = questionNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHitsNum() {
|
|
||||||
return hitsNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHitsNum(Integer hitsNum) {
|
|
||||||
this.hitsNum = hitsNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDownNum() {
|
|
||||||
return downNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownNum(Integer downNum) {
|
|
||||||
this.downNum = downNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNickName() {
|
|
||||||
return nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNickName(String nickName) {
|
|
||||||
this.nickName = nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVerifyCode() {
|
|
||||||
return verifyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVerifyCode(String verifyCode) {
|
|
||||||
this.verifyCode = verifyCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectId() {
|
|
||||||
return subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectId(String subjectId) {
|
|
||||||
this.subjectId = subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseId() {
|
|
||||||
return courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseId(String courseId) {
|
|
||||||
this.courseId = courseId;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_subject database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_menu")
|
|
||||||
public class MenuEntity extends SuperEntity<MenuEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String pinyin;
|
|
||||||
private String parentId;
|
|
||||||
private String isShow;
|
|
||||||
private Integer orders;
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
@TableField(value="reserve_1")
|
|
||||||
private String reserve1;
|
|
||||||
|
|
||||||
// 子类型
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<MenuEntity> childSubjects;
|
|
||||||
|
|
||||||
public MenuEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentId() {
|
|
||||||
return this.parentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentId(String parentId) {
|
|
||||||
this.parentId = parentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MenuEntity> getChildSubjects() {
|
|
||||||
return childSubjects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChildSubjects(List<MenuEntity> childSubjects) {
|
|
||||||
this.childSubjects = childSubjects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPinyin() {
|
|
||||||
return pinyin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPinyin(String pinyin) {
|
|
||||||
this.pinyin = pinyin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsShow() {
|
|
||||||
return isShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsShow(String isShow) {
|
|
||||||
this.isShow = isShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrders() {
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrders(Integer orders) {
|
|
||||||
this.orders = orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReserve1() {
|
|
||||||
return reserve1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReserve1(String reserve1) {
|
|
||||||
this.reserve1 = reserve1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,200 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_chapter database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_paper")
|
|
||||||
public class PaperEntity extends SuperEntity<PaperEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String subjectId;
|
|
||||||
private String courseId;
|
|
||||||
private String schoolId;
|
|
||||||
private String areaId;
|
|
||||||
private String createrId;
|
|
||||||
private String name;
|
|
||||||
private String questionInfo;
|
|
||||||
private String type;
|
|
||||||
private String year;
|
|
||||||
private Integer downHits;
|
|
||||||
private Integer openHits;
|
|
||||||
private String seoTitle;
|
|
||||||
private String seoKeywords;
|
|
||||||
private String seoDescription;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String subjectName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String courseName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String areaName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String schoolName;
|
|
||||||
|
|
||||||
public JSONArray getQueInfo(){
|
|
||||||
if(StringUtils.isEmpty(getQuestionInfo())){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return JSONArray.parseArray(getQuestionInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseId() {
|
|
||||||
return courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseId(String courseId) {
|
|
||||||
this.courseId = courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAreaId() {
|
|
||||||
return areaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAreaId(String areaId) {
|
|
||||||
this.areaId = areaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getYear() {
|
|
||||||
return year;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setYear(String year) {
|
|
||||||
this.year = year;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSchoolId() {
|
|
||||||
return schoolId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSchoolId(String schoolId) {
|
|
||||||
this.schoolId = schoolId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDownHits() {
|
|
||||||
return downHits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownHits(Integer downHits) {
|
|
||||||
this.downHits = downHits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOpenHits() {
|
|
||||||
return openHits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpenHits(Integer openHits) {
|
|
||||||
this.openHits = openHits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQuestionInfo() {
|
|
||||||
return questionInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuestionInfo(String questionInfo) {
|
|
||||||
this.questionInfo = questionInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreaterId() {
|
|
||||||
return createrId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreaterId(String createrId) {
|
|
||||||
this.createrId = createrId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeoTitle() {
|
|
||||||
return seoTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeoTitle(String seoTitle) {
|
|
||||||
this.seoTitle = seoTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeoKeywords() {
|
|
||||||
return seoKeywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeoKeywords(String seoKeywords) {
|
|
||||||
this.seoKeywords = seoKeywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeoDescription() {
|
|
||||||
return seoDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeoDescription(String seoDescription) {
|
|
||||||
this.seoDescription = seoDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseName() {
|
|
||||||
return courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseName(String courseName) {
|
|
||||||
this.courseName = courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAreaName() {
|
|
||||||
return areaName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAreaName(String areaName) {
|
|
||||||
this.areaName = areaName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSchoolName() {
|
|
||||||
return schoolName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSchoolName(String schoolName) {
|
|
||||||
this.schoolName = schoolName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectId() {
|
|
||||||
return subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectId(String subjectId) {
|
|
||||||
this.subjectId = subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectName() {
|
|
||||||
return subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectName(String subjectName) {
|
|
||||||
this.subjectName = subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,159 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_question database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_question")
|
|
||||||
public class QuestionEntity extends SuperEntity<QuestionEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String analysis;
|
|
||||||
private String paperId;
|
|
||||||
private String answer;
|
|
||||||
private String chapterId;
|
|
||||||
private String questionType;
|
|
||||||
private String content;
|
|
||||||
private String subjectId;
|
|
||||||
private String courseId;
|
|
||||||
private String reviewPoint;
|
|
||||||
private String year;
|
|
||||||
private String score;
|
|
||||||
private String auditStatus;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String courseName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String chapterName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String subjectName;
|
|
||||||
|
|
||||||
public QuestionEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAnalysis() {
|
|
||||||
return this.analysis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnalysis(String analysis) {
|
|
||||||
this.analysis = analysis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAnswer() {
|
|
||||||
return this.answer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnswer(String answer) {
|
|
||||||
this.answer = answer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChapterId() {
|
|
||||||
return this.chapterId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChapterId(String chapterId) {
|
|
||||||
this.chapterId = chapterId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQuestionType() {
|
|
||||||
return this.questionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuestionType(String questionType) {
|
|
||||||
this.questionType = questionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReviewPoint() {
|
|
||||||
return reviewPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReviewPoint(String reviewPoint) {
|
|
||||||
this.reviewPoint = reviewPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getYear() {
|
|
||||||
return year;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setYear(String year) {
|
|
||||||
this.year = year;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScore() {
|
|
||||||
return score;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScore(String score) {
|
|
||||||
this.score = score;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPaperId() {
|
|
||||||
return paperId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPaperId(String paperId) {
|
|
||||||
this.paperId = paperId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseId() {
|
|
||||||
return courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseId(String courseId) {
|
|
||||||
this.courseId = courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseName() {
|
|
||||||
return courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseName(String courseName) {
|
|
||||||
this.courseName = courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChapterName() {
|
|
||||||
return chapterName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChapterName(String chapterName) {
|
|
||||||
this.chapterName = chapterName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectId() {
|
|
||||||
return subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectId(String subjectId) {
|
|
||||||
this.subjectId = subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectName() {
|
|
||||||
return subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectName(String subjectName) {
|
|
||||||
this.subjectName = subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuditStatus() {
|
|
||||||
return auditStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuditStatus(String auditStatus) {
|
|
||||||
this.auditStatus = auditStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_chapter database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_school")
|
|
||||||
public class SchoolEntity extends SuperEntity<SchoolEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String areaId;
|
|
||||||
private String name;
|
|
||||||
private String image;
|
|
||||||
|
|
||||||
// 试卷
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<PaperEntity> paperList;
|
|
||||||
|
|
||||||
public SchoolEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImage() {
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImage(String image) {
|
|
||||||
this.image = image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAreaId() {
|
|
||||||
return areaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAreaId(String areaId) {
|
|
||||||
this.areaId = areaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PaperEntity> getPaperList() {
|
|
||||||
return paperList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPaperList(List<PaperEntity> paperList) {
|
|
||||||
this.paperList = paperList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
@TableName(value="tiku_subject")
|
|
||||||
public class SubjectEntity extends SuperEntity<SubjectEntity> implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<CourseEntity> courseList;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CourseEntity> getCourseList() {
|
|
||||||
return courseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseList(List<CourseEntity> courseList) {
|
|
||||||
this.courseList = courseList;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,110 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the reaps_sys_menu database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="sys_menu")
|
|
||||||
public class SysMenuEntity extends SuperEntity<SysMenuEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private Integer orderNum;
|
|
||||||
private String parentId;
|
|
||||||
private Integer type;
|
|
||||||
private String url;
|
|
||||||
private String perms;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<SysMenuEntity> menuList;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String parentName;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private Boolean open;
|
|
||||||
|
|
||||||
public SysMenuEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrderNum() {
|
|
||||||
return this.orderNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderNum(Integer orderNum) {
|
|
||||||
this.orderNum = orderNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentId() {
|
|
||||||
return this.parentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentId(String parentId) {
|
|
||||||
this.parentId = parentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(Integer type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return this.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SysMenuEntity> getMenuList() {
|
|
||||||
return menuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMenuList(List<SysMenuEntity> menuList) {
|
|
||||||
this.menuList = menuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentName() {
|
|
||||||
return parentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentName(String parentName) {
|
|
||||||
this.parentName = parentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getOpen() {
|
|
||||||
return open;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpen(Boolean open) {
|
|
||||||
this.open = open;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPerms() {
|
|
||||||
return perms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPerms(String perms) {
|
|
||||||
this.perms = perms;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the reaps_sys_role database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="sys_role")
|
|
||||||
public class SysRoleEntity extends SuperEntity<SysRoleEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String perms;
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<String> menuIdList;
|
|
||||||
|
|
||||||
public SysRoleEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getMenuIdList() {
|
|
||||||
return menuIdList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMenuIdList(List<String> menuIdList) {
|
|
||||||
this.menuIdList = menuIdList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPerms() {
|
|
||||||
return perms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPerms(String perms) {
|
|
||||||
this.perms = perms;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,151 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
import com.tamguo.admin.model.enums.SysUserStatusEnum;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the reaps_sys_user database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="sys_user")
|
|
||||||
public class SysUserEntity extends SuperEntity<SysUserEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String userName;
|
|
||||||
private String nickName;
|
|
||||||
private String mobile;
|
|
||||||
private String email;
|
|
||||||
private String password;
|
|
||||||
private String roleIds;
|
|
||||||
|
|
||||||
@JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
|
|
||||||
private SysUserStatusEnum status;
|
|
||||||
|
|
||||||
private String safeKeyValue;
|
|
||||||
private Long createTime;
|
|
||||||
private String courseId;
|
|
||||||
private String subjectId;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private List<String> roleIdList;
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String roleName;
|
|
||||||
|
|
||||||
public SysUserEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return this.password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoleIds() {
|
|
||||||
return this.roleIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleIds(String roleIds) {
|
|
||||||
this.roleIds = roleIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
|
||||||
this.userName = userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNickName() {
|
|
||||||
return nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNickName(String nickName) {
|
|
||||||
this.nickName = nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Long createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getRoleIdList() {
|
|
||||||
return roleIdList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleIdList(List<String> roleIdList) {
|
|
||||||
this.roleIdList = roleIdList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSafeKeyValue() {
|
|
||||||
return safeKeyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSafeKeyValue(String safeKeyValue) {
|
|
||||||
this.safeKeyValue = safeKeyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SysUserStatusEnum getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(SysUserStatusEnum status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseId() {
|
|
||||||
return courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseId(String courseId) {
|
|
||||||
this.courseId = courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRoleName() {
|
|
||||||
return roleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleName(String roleName) {
|
|
||||||
this.roleName = roleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectId() {
|
|
||||||
return subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectId(String subjectId) {
|
|
||||||
this.subjectId = subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,195 +0,0 @@
|
|||||||
package com.tamguo.admin.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotations.TableName;
|
|
||||||
import com.tamguo.admin.config.dao.SuperEntity;
|
|
||||||
import com.tamguo.admin.model.enums.TeacherStatus;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The persistent class for the tiku_teacher database table.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableName(value="tiku_teacher")
|
|
||||||
public class TeacherEntity extends SuperEntity<TeacherEntity> implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String mobile;
|
|
||||||
private String email;
|
|
||||||
private String name;
|
|
||||||
private String motto;
|
|
||||||
private String provinceId;
|
|
||||||
private String cityId;
|
|
||||||
private String subjectId;
|
|
||||||
private String courseId;
|
|
||||||
private String cardId;
|
|
||||||
private String cardPhoto;
|
|
||||||
private String occupationPapers;
|
|
||||||
private Long createTime;
|
|
||||||
|
|
||||||
@JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
|
|
||||||
private TeacherStatus status;
|
|
||||||
private String qq;
|
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String provinceName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String courseName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String cityName;
|
|
||||||
@TableField(exist=false)
|
|
||||||
private String subjectName;
|
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMotto() {
|
|
||||||
return motto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMotto(String motto) {
|
|
||||||
this.motto = motto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseId() {
|
|
||||||
return courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseId(String courseId) {
|
|
||||||
this.courseId = courseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCardId() {
|
|
||||||
return cardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCardId(String cardId) {
|
|
||||||
this.cardId = cardId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCardPhoto() {
|
|
||||||
return cardPhoto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCardPhoto(String cardPhoto) {
|
|
||||||
this.cardPhoto = cardPhoto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOccupationPapers() {
|
|
||||||
return occupationPapers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOccupationPapers(String occupationPapers) {
|
|
||||||
this.occupationPapers = occupationPapers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQq() {
|
|
||||||
return qq;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQq(String qq) {
|
|
||||||
this.qq = qq;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getSerialversionuid() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectId() {
|
|
||||||
return subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectId(String subjectId) {
|
|
||||||
this.subjectId = subjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvinceId() {
|
|
||||||
return provinceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProvinceId(String provinceId) {
|
|
||||||
this.provinceId = provinceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityId() {
|
|
||||||
return cityId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityId(String cityId) {
|
|
||||||
this.cityId = cityId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Long createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TeacherStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(TeacherStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvinceName() {
|
|
||||||
return provinceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProvinceName(String provinceName) {
|
|
||||||
this.provinceName = provinceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCourseName() {
|
|
||||||
return courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCourseName(String courseName) {
|
|
||||||
this.courseName = courseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCityName() {
|
|
||||||
return cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCityName(String cityName) {
|
|
||||||
this.cityName = cityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubjectName() {
|
|
||||||
return subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubjectName(String subjectName) {
|
|
||||||
this.subjectName = subjectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.tamguo.admin.model.enums;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.baomidou.mybatisplus.enums.IEnum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户状态
|
|
||||||
*/
|
|
||||||
public enum SysUserStatusEnum implements IEnum {
|
|
||||||
NORMAL("normal", "正常"),
|
|
||||||
LOCKED("locked", "锁定");
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
private String desc;
|
|
||||||
|
|
||||||
SysUserStatusEnum(final String value, final String desc) {
|
|
||||||
this.value = value;
|
|
||||||
this.desc = desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Serializable getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDesc(){
|
|
||||||
return this.desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package com.tamguo.admin.model.enums;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
public enum TeacherStatus {
|
|
||||||
|
|
||||||
APPLY("apply", "申请"),
|
|
||||||
PASS("pass", "通过"),
|
|
||||||
UNPASS("unpass", "不通过");
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
private String desc;
|
|
||||||
|
|
||||||
TeacherStatus(final String value, final String desc) {
|
|
||||||
this.value = value;
|
|
||||||
this.desc = desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Serializable getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDesc(){
|
|
||||||
return this.desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.tamguo.admin.model.AdEntity;
|
|
||||||
|
|
||||||
public interface IAdService {
|
|
||||||
|
|
||||||
List<AdEntity> findAll();
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.tamguo.admin.model.AreaEntity;
|
|
||||||
|
|
||||||
public interface IAreaService {
|
|
||||||
|
|
||||||
public List<AreaEntity> findAll();
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
/**
|
|
||||||
* Service - 书籍
|
|
||||||
*
|
|
||||||
* @author tamguo
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.IService;
|
|
||||||
import com.tamguo.admin.model.BookEntity;
|
|
||||||
|
|
||||||
public interface IBookService extends IService<BookEntity>{
|
|
||||||
|
|
||||||
Page<BookEntity> queryPage(String name , Page<BookEntity> page);
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.ChapterEntity;
|
|
||||||
|
|
||||||
public interface IChapterService {
|
|
||||||
|
|
||||||
// 获取当前章节
|
|
||||||
public ChapterEntity findById(String uid);
|
|
||||||
|
|
||||||
// 获取下一个知识点
|
|
||||||
public ChapterEntity findNextPoint(String uid , Integer orders);
|
|
||||||
|
|
||||||
// 获取树形
|
|
||||||
public List<ChapterEntity> getChapterTree(String bookId);
|
|
||||||
|
|
||||||
// 获取树形
|
|
||||||
public List<ChapterEntity> getChapterTree();
|
|
||||||
|
|
||||||
// 查询列表
|
|
||||||
public Page<ChapterEntity> queryPage(String name, Page<ChapterEntity> page);
|
|
||||||
|
|
||||||
// 根据ID查询当前章节
|
|
||||||
public ChapterEntity select(String teacherId);
|
|
||||||
|
|
||||||
// 删除章节
|
|
||||||
public void deleteByIds(String[] chapterIds);
|
|
||||||
|
|
||||||
// 保存章节
|
|
||||||
public void save(ChapterEntity chapter);
|
|
||||||
|
|
||||||
// 更新章节
|
|
||||||
public void update(ChapterEntity chapter);
|
|
||||||
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.CourseEntity;
|
|
||||||
|
|
||||||
public interface ICourseService {
|
|
||||||
|
|
||||||
/** 高考专区*/
|
|
||||||
List<CourseEntity> findGaokaoArea(String gaokaoSubjectId);
|
|
||||||
|
|
||||||
/** 根据考试获取科目 */
|
|
||||||
List<CourseEntity> findBySubjectId(String subjectId);
|
|
||||||
|
|
||||||
/** 获取科目 */
|
|
||||||
CourseEntity find(String uid);
|
|
||||||
|
|
||||||
/** 获取科目*/
|
|
||||||
Page<CourseEntity> list(String name, Page<CourseEntity> page);
|
|
||||||
|
|
||||||
/** 获取科目*/
|
|
||||||
CourseEntity select(String courseId);
|
|
||||||
|
|
||||||
/** 删除*/
|
|
||||||
void deleteByIds(String[] courseIds);
|
|
||||||
|
|
||||||
/** 保存*/
|
|
||||||
void save(CourseEntity course);
|
|
||||||
|
|
||||||
/** 修改*/
|
|
||||||
void update(CourseEntity course);
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.commons.mail.EmailException;
|
|
||||||
|
|
||||||
import com.tamguo.admin.model.TeacherEntity;
|
|
||||||
|
|
||||||
public interface IEmailService {
|
|
||||||
|
|
||||||
/** 发送找回密码邮件*/
|
|
||||||
public Integer sendFindPasswordEmail(String email , String subject) throws EmailException;
|
|
||||||
|
|
||||||
/** 发送通过教师招募邮件*/
|
|
||||||
public Integer sendPassJoinusEmail(HttpServletRequest req , TeacherEntity teacher , String password) throws EmailException;
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import com.tamguo.admin.model.MemberEntity;
|
|
||||||
import com.tamguo.admin.util.Result;
|
|
||||||
|
|
||||||
public interface IMemberService {
|
|
||||||
|
|
||||||
public Result login(String username , String password , String captcha);
|
|
||||||
|
|
||||||
public Result checkUsername(String username);
|
|
||||||
|
|
||||||
public Result checkMobile(String mobile);
|
|
||||||
|
|
||||||
public Result register(String username , String mobile , String password , String verifyCode);
|
|
||||||
|
|
||||||
public Result checkAccount(String account);
|
|
||||||
|
|
||||||
public Result confirmAccount(String account , String veritycode);
|
|
||||||
|
|
||||||
public Result securityCheck(String username , String isEmail , String vcode);
|
|
||||||
|
|
||||||
public Result resetPassword(String resetPasswordKey , String username , String password, String verifypwd);
|
|
||||||
|
|
||||||
public Integer getLoginFailureCount(MemberEntity member);
|
|
||||||
|
|
||||||
public void updateMember(MemberEntity member);
|
|
||||||
|
|
||||||
public MemberEntity findByUid(String uid);
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.MenuEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Service - 类型
|
|
||||||
*
|
|
||||||
* @author candy.tam
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IMenuService {
|
|
||||||
|
|
||||||
/** 获取类型数结构 */
|
|
||||||
public List<MenuEntity> findMenus();
|
|
||||||
|
|
||||||
/** 获取所有头部菜单 */
|
|
||||||
public List<MenuEntity> findAllMenus();
|
|
||||||
|
|
||||||
/** 获取左侧菜单*/
|
|
||||||
public List<MenuEntity> findLeftMenus();
|
|
||||||
|
|
||||||
/** 资格考试专区*/
|
|
||||||
public List<MenuEntity> findFooterMenus();
|
|
||||||
|
|
||||||
/** 根据名称查询*/
|
|
||||||
public Page<MenuEntity> list(String name, Page<MenuEntity> page);
|
|
||||||
|
|
||||||
/** 获取菜单树*/
|
|
||||||
public List<MenuEntity> getMenuTree();
|
|
||||||
|
|
||||||
/** 获取菜单*/
|
|
||||||
public MenuEntity findById(String uid);
|
|
||||||
|
|
||||||
/** 保存*/
|
|
||||||
public void save(MenuEntity menu);
|
|
||||||
|
|
||||||
/** 修改*/
|
|
||||||
public void update(MenuEntity menu);
|
|
||||||
|
|
||||||
/** 删除*/
|
|
||||||
public void deleteBatch(String[] menuIds);
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.PaperEntity;
|
|
||||||
|
|
||||||
public interface IPaperService {
|
|
||||||
|
|
||||||
List<PaperEntity> findHistoryPaper();
|
|
||||||
|
|
||||||
List<PaperEntity> findSimulationPaper();
|
|
||||||
|
|
||||||
List<PaperEntity> findHotPaper(String areaId);
|
|
||||||
|
|
||||||
Page<PaperEntity> findList(String courseId, String paperType,
|
|
||||||
String year, String area , Integer pageNum);
|
|
||||||
|
|
||||||
PaperEntity find(String paperId);
|
|
||||||
|
|
||||||
List<PaperEntity> findPaperByAreaId(String areaId , String type);
|
|
||||||
|
|
||||||
Long getPaperTotal();
|
|
||||||
|
|
||||||
Page<PaperEntity> list(String name, Page<PaperEntity> page);
|
|
||||||
|
|
||||||
PaperEntity select(String paperId);
|
|
||||||
|
|
||||||
void deleteByIds(String[] paperIds);
|
|
||||||
|
|
||||||
void save(PaperEntity paper);
|
|
||||||
|
|
||||||
void update(PaperEntity paper);
|
|
||||||
|
|
||||||
// 会员部分
|
|
||||||
|
|
||||||
List<PaperEntity> findByCreaterId(String createrId);
|
|
||||||
|
|
||||||
void updatePaperName(String paperId, String name);
|
|
||||||
|
|
||||||
void deletePaper(String paperId);
|
|
||||||
|
|
||||||
void addPaperQuestionInfo(String paperId, String title, String name,
|
|
||||||
String type);
|
|
||||||
|
|
||||||
void updatePaperQuestionInfo(String paperId, String title, String name,
|
|
||||||
String type, String cuid);
|
|
||||||
|
|
||||||
void deletePaperQuestionInfoBtn(String paperId, String cuid);
|
|
||||||
|
|
||||||
Page<PaperEntity> memberPaperList(String name, String memberId , Integer page, Integer limit);
|
|
||||||
|
|
||||||
void addPaper(PaperEntity paper);
|
|
||||||
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.QuestionEntity;
|
|
||||||
|
|
||||||
public interface IQuestionService {
|
|
||||||
|
|
||||||
/** 根据章节获取问题 */
|
|
||||||
public Page<QuestionEntity> findByChapterId(String chapterId , Integer offset , Integer limit);
|
|
||||||
|
|
||||||
/** 获取审核通过的题目 */
|
|
||||||
public QuestionEntity findNormalQuestion(String uid);
|
|
||||||
|
|
||||||
public List<QuestionEntity> findPaperQuestion(String paperId);
|
|
||||||
|
|
||||||
public Page<QuestionEntity> list(String name, Integer page, Integer limit);
|
|
||||||
|
|
||||||
public QuestionEntity select(String questionId);
|
|
||||||
|
|
||||||
public void deleteBatch(String[] questionIds);
|
|
||||||
|
|
||||||
public void addQuestion(QuestionEntity question);
|
|
||||||
|
|
||||||
public Page<QuestionEntity> queryQuestionList(QuestionEntity question , Integer page , Integer limit);
|
|
||||||
|
|
||||||
public void save(QuestionEntity question);
|
|
||||||
|
|
||||||
public void update(QuestionEntity question);
|
|
||||||
|
|
||||||
public void audit(String[] questionIds);
|
|
||||||
|
|
||||||
public void notAudit(String[] questionIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.tamguo.admin.model.SchoolEntity;
|
|
||||||
|
|
||||||
public interface ISchoolService {
|
|
||||||
|
|
||||||
public List<SchoolEntity> findEliteSchoolPaper(String shcoolId);
|
|
||||||
|
|
||||||
public List<SchoolEntity> findEliteSchool();
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import com.aliyuncs.exceptions.ClientException;
|
|
||||||
import com.tamguo.admin.util.Result;
|
|
||||||
|
|
||||||
public interface ISmsService {
|
|
||||||
|
|
||||||
public Result sendFindPasswordSms(String mobile) throws ClientException;
|
|
||||||
|
|
||||||
public Result sendPassJoinusSms(String mobile) throws ClientException;
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.SubjectEntity;
|
|
||||||
|
|
||||||
public interface ISubjectService {
|
|
||||||
|
|
||||||
public SubjectEntity find(String uid);
|
|
||||||
|
|
||||||
public Page<SubjectEntity> list(String name , Integer pageNum , Integer pageSize);
|
|
||||||
|
|
||||||
public void update(SubjectEntity subject);
|
|
||||||
|
|
||||||
public void save(SubjectEntity subject);
|
|
||||||
|
|
||||||
public void deleteBatch(String[] subjectIds);
|
|
||||||
|
|
||||||
public List<SubjectEntity> getSubjectTree();
|
|
||||||
|
|
||||||
public JSONArray getCourseTree();
|
|
||||||
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.SysMenuEntity;
|
|
||||||
|
|
||||||
public interface ISysMenuService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户菜单权限
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<SysMenuEntity> getUserMenuList(String userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取菜单树
|
|
||||||
* @param menus
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<SysMenuEntity> getUserMenuTree(List<SysMenuEntity> menus);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单列表
|
|
||||||
* @param hashMap
|
|
||||||
* @param page
|
|
||||||
* @param limit
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Page<SysMenuEntity> queryList(Map<String, Object> hashMap, Page<SysMenuEntity> page);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询不是按钮的菜单
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<SysMenuEntity> queryNotButtonList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据父菜单查询菜单
|
|
||||||
* @param parentId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
SysMenuEntity select(String parentId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存数据
|
|
||||||
* @param menu
|
|
||||||
*/
|
|
||||||
void save(SysMenuEntity menu);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
* @param menu
|
|
||||||
*/
|
|
||||||
void update(SysMenuEntity menu);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
* @param menuIds
|
|
||||||
*/
|
|
||||||
void deleteBatch(String[] menuIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.SysRoleEntity;
|
|
||||||
|
|
||||||
public interface ISysRoleService {
|
|
||||||
|
|
||||||
public List<SysRoleEntity> findAll();
|
|
||||||
|
|
||||||
public Page<SysRoleEntity> queryList(SysRoleEntity role, Page<SysRoleEntity> page);
|
|
||||||
|
|
||||||
public SysRoleEntity select(String uid);
|
|
||||||
|
|
||||||
public void save(SysRoleEntity role);
|
|
||||||
|
|
||||||
public void update(SysRoleEntity role);
|
|
||||||
|
|
||||||
public void deleteBatch(String[] roleIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.SysUserEntity;
|
|
||||||
import com.tamguo.admin.util.Result;
|
|
||||||
|
|
||||||
public interface ISysUserService {
|
|
||||||
|
|
||||||
SysUserEntity queryByUserName(String username);
|
|
||||||
|
|
||||||
SysUserEntity queryByUid(String uid);
|
|
||||||
|
|
||||||
void updateUserInfo(SysUserEntity user);
|
|
||||||
|
|
||||||
Result updatePassword(String oldPassword, String password, String repassword);
|
|
||||||
|
|
||||||
Page<SysUserEntity> queryPage(String userName ,Page<SysUserEntity> page);
|
|
||||||
|
|
||||||
SysUserEntity selectById(String userId);
|
|
||||||
|
|
||||||
void save(SysUserEntity user);
|
|
||||||
|
|
||||||
void update(SysUserEntity user);
|
|
||||||
|
|
||||||
void deleteBatch(String[] userIds);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.tamguo.admin.service;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.commons.mail.EmailException;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.model.TeacherEntity;
|
|
||||||
import com.tamguo.admin.util.Result;
|
|
||||||
|
|
||||||
public interface ITeacherService {
|
|
||||||
|
|
||||||
Page<TeacherEntity> queryPage(String mobile, Page<TeacherEntity> page);
|
|
||||||
|
|
||||||
TeacherEntity find(String teacherId);
|
|
||||||
|
|
||||||
Result update(TeacherEntity teacher);
|
|
||||||
|
|
||||||
Result pass(HttpServletRequest req , String teacherId) throws EmailException;
|
|
||||||
|
|
||||||
Result deleteByIds(String[] teacherIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.mapper.Condition;
|
|
||||||
import com.tamguo.admin.dao.AdMapper;
|
|
||||||
import com.tamguo.admin.dao.redis.CacheService;
|
|
||||||
import com.tamguo.admin.model.AdEntity;
|
|
||||||
import com.tamguo.admin.service.IAdService;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AdService implements IAdService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
AdMapper adMapper;
|
|
||||||
@Autowired
|
|
||||||
CacheService cacheService;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<AdEntity> findAll() {
|
|
||||||
List<AdEntity> adList = (List<AdEntity>) cacheService.getObject(TamguoConstant.ALL_AD);
|
|
||||||
adList = null;
|
|
||||||
if(adList == null || adList.isEmpty()){
|
|
||||||
adList = adMapper.selectList(Condition.EMPTY);
|
|
||||||
cacheService.setObject(TamguoConstant.ALL_AD, adList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return adList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.mapper.Condition;
|
|
||||||
import com.tamguo.admin.dao.AreaMapper;
|
|
||||||
import com.tamguo.admin.model.AreaEntity;
|
|
||||||
import com.tamguo.admin.service.IAreaService;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class AreaService implements IAreaService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AreaMapper areaMapper;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<AreaEntity> findAll() {
|
|
||||||
return areaMapper.selectList(Condition.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
||||||
import com.tamguo.admin.dao.BookMapper;
|
|
||||||
import com.tamguo.admin.model.BookEntity;
|
|
||||||
import com.tamguo.admin.service.IBookService;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class BookServiceImpl extends ServiceImpl<BookMapper, BookEntity> implements IBookService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
BookMapper bookMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<BookEntity> queryPage(String name, Page<BookEntity> page) {
|
|
||||||
return page.setRecords(bookMapper.queryPage(name , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,103 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
||||||
import com.tamguo.admin.dao.ChapterMapper;
|
|
||||||
import com.tamguo.admin.model.ChapterEntity;
|
|
||||||
import com.tamguo.admin.service.IChapterService;
|
|
||||||
import com.tamguo.admin.util.ShiroUtils;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ChapterService extends ServiceImpl<ChapterMapper, ChapterEntity> implements IChapterService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ChapterMapper chapterMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChapterEntity findById(String uid) {
|
|
||||||
return chapterMapper.selectById(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChapterEntity findNextPoint(String uid , Integer orders) {
|
|
||||||
return chapterMapper.findNextPoint(uid , orders);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public List<ChapterEntity> getChapterTree(String bookId) {
|
|
||||||
if(StringUtils.isEmpty(bookId) || "null".equals(bookId)){
|
|
||||||
return rootChapterNode();
|
|
||||||
}
|
|
||||||
List<ChapterEntity> list = chapterMapper.findByBookId(bookId);
|
|
||||||
if(CollectionUtils.isEmpty(list)) {
|
|
||||||
return rootChapterNode();
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public List<ChapterEntity> getChapterTree() {
|
|
||||||
List<ChapterEntity> list = chapterMapper.findByBookId(ShiroUtils.getUser().getCourseId());
|
|
||||||
if(CollectionUtils.isEmpty(list)) {
|
|
||||||
return rootChapterNode();
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<ChapterEntity> rootChapterNode(){
|
|
||||||
ChapterEntity chapter = new ChapterEntity();
|
|
||||||
chapter.setCourseId(TamguoConstant.CHAPTER_DEFAULT_ROOT_UID);
|
|
||||||
chapter.setOrders(0);
|
|
||||||
chapter.setPointNum(0);
|
|
||||||
chapter.setQuestionNum(0);
|
|
||||||
chapter.setUid("0");
|
|
||||||
chapter.setName("一级章节");
|
|
||||||
chapter.setParentId(TamguoConstant.CHAPTER_DEFAULT_ROOT_UID);
|
|
||||||
return Arrays.asList(chapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
@Override
|
|
||||||
public Page<ChapterEntity> queryPage(String name, Page<ChapterEntity> page) {
|
|
||||||
return page.setRecords(chapterMapper.queryPage(name , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
@Override
|
|
||||||
public ChapterEntity select(String chapterId) {
|
|
||||||
return chapterMapper.select(chapterId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void deleteByIds(String[] chapterIds) {
|
|
||||||
chapterMapper.deleteBatchIds(Arrays.asList(chapterIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void save(ChapterEntity chapter) {
|
|
||||||
chapter.setCourseId(ShiroUtils.getUser().getCourseId());
|
|
||||||
chapterMapper.insert(chapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void update(ChapterEntity chapter) {
|
|
||||||
chapterMapper.updateById(chapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,147 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.dao.ChapterMapper;
|
|
||||||
import com.tamguo.admin.dao.CourseMapper;
|
|
||||||
import com.tamguo.admin.dao.redis.CacheService;
|
|
||||||
import com.tamguo.admin.model.ChapterEntity;
|
|
||||||
import com.tamguo.admin.model.CourseEntity;
|
|
||||||
import com.tamguo.admin.service.ICourseService;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class CourseService implements ICourseService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CourseMapper courseMapper;
|
|
||||||
@Autowired
|
|
||||||
private CacheService cacheService;
|
|
||||||
@Autowired
|
|
||||||
private ChapterMapper chapterMapper;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<CourseEntity> findGaokaoArea(String subjectId) {
|
|
||||||
List<CourseEntity> courseList = (List<CourseEntity>) cacheService.getObject(TamguoConstant.GAOKAO_COURSE_AREA);
|
|
||||||
courseList = null;
|
|
||||||
if(courseList == null || courseList.isEmpty()){
|
|
||||||
courseList = courseMapper.findBySubjectId(subjectId);
|
|
||||||
cacheService.setObject(TamguoConstant.GAOKAO_COURSE_AREA, courseList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return courseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CourseEntity> findBySubjectId(String subjectId) {
|
|
||||||
return courseMapper.findBySubjectId(subjectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CourseEntity find(String uid) {
|
|
||||||
return courseMapper.selectById(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CourseEntity> list(String name, Page<CourseEntity> page) {
|
|
||||||
if(!StringUtils.isEmpty(name)) {
|
|
||||||
name = "%" + name + "%";
|
|
||||||
}
|
|
||||||
return page.setRecords(courseMapper.queryPageByName(name , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CourseEntity select(String courseId) {
|
|
||||||
return courseMapper.selectById(courseId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void deleteByIds(String[] courseIds) {
|
|
||||||
courseMapper.deleteBatchIds(Arrays.asList(courseIds));
|
|
||||||
|
|
||||||
for(int i=0 ; i<courseIds.length ; i++){
|
|
||||||
// 删除之前的章节
|
|
||||||
chapterMapper.deleteByCourseId(courseIds[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void save(CourseEntity course) {
|
|
||||||
course.setUid(null);
|
|
||||||
|
|
||||||
course.setSeoTitle(course.getName());
|
|
||||||
course.setSeoKeywords(course.getName());
|
|
||||||
course.setSeoDescription(course.getName());
|
|
||||||
|
|
||||||
courseMapper.insert(course);
|
|
||||||
|
|
||||||
// 更新章节
|
|
||||||
List<ChapterEntity> chapterList = course.getChapterList();
|
|
||||||
for(int i=0 ; i<chapterList.size() ; i++){
|
|
||||||
ChapterEntity chapter = chapterList.get(i);
|
|
||||||
if(TamguoConstant.CHAPTER_DEFAULT_ROOT_UID.equals(chapter.getParentId())){
|
|
||||||
chapter.setName(course.getName());
|
|
||||||
}
|
|
||||||
String uid = chapter.getUid();
|
|
||||||
|
|
||||||
chapter.setUid(null);
|
|
||||||
chapter.setParentId(chapter.getParentId());
|
|
||||||
chapter.setCourseId(course.getUid());
|
|
||||||
chapterMapper.insert(chapter);
|
|
||||||
|
|
||||||
for(int k=0 ; k<chapterList.size() ; k++){
|
|
||||||
ChapterEntity c = chapterList.get(k);
|
|
||||||
if(c.getParentId().equals(uid)){
|
|
||||||
c.setParentId(chapter.getUid());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void update(CourseEntity course) {
|
|
||||||
courseMapper.updateById(course);
|
|
||||||
|
|
||||||
// 更新章节
|
|
||||||
List<ChapterEntity> chapterList = course.getChapterList();
|
|
||||||
for(int i=0 ; i<chapterList.size() ; i++){
|
|
||||||
|
|
||||||
ChapterEntity chapter = chapterList.get(i);
|
|
||||||
if(TamguoConstant.CHAPTER_DEFAULT_ROOT_UID.equals(chapter.getParentId())){
|
|
||||||
chapter.setName(course.getName());
|
|
||||||
}
|
|
||||||
// 只支持更新和新增操作
|
|
||||||
if(StringUtils.isEmpty(chapter.getCourseId())
|
|
||||||
|| TamguoConstant.CHAPTER_DEFAULT_ROOT_UID.equals(chapter.getCourseId())) {
|
|
||||||
String uid = chapter.getUid();
|
|
||||||
|
|
||||||
chapter.setUid(null);
|
|
||||||
chapter.setParentId(chapter.getParentId());
|
|
||||||
chapter.setCourseId(course.getUid());
|
|
||||||
chapterMapper.insert(chapter);
|
|
||||||
|
|
||||||
for(int k=0 ; k<chapterList.size() ; k++){
|
|
||||||
ChapterEntity c = chapterList.get(k);
|
|
||||||
if(c.getParentId().equals(uid)){
|
|
||||||
c.setParentId(chapter.getUid());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ChapterEntity entity = chapterMapper.selectById(chapter.getUid());
|
|
||||||
entity.setName(chapter.getName());
|
|
||||||
chapterMapper.updateById(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.commons.mail.EmailException;
|
|
||||||
import org.apache.commons.mail.HtmlEmail;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.thymeleaf.TemplateEngine;
|
|
||||||
import org.thymeleaf.context.Context;
|
|
||||||
import org.thymeleaf.context.IContext;
|
|
||||||
|
|
||||||
import com.tamguo.admin.dao.redis.CacheService;
|
|
||||||
import com.tamguo.admin.model.TeacherEntity;
|
|
||||||
import com.tamguo.admin.service.IEmailService;
|
|
||||||
import com.tamguo.admin.util.Setting;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class EmailService implements IEmailService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CacheService cacheService;
|
|
||||||
@Autowired
|
|
||||||
private TemplateEngine templateEngine;
|
|
||||||
@Autowired
|
|
||||||
private Setting setting;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer sendFindPasswordEmail(String email , String subject) throws EmailException {
|
|
||||||
HtmlEmail mail = new HtmlEmail();
|
|
||||||
mail.setHostName(TamguoConstant.ALIYUN_SMTP_HOST_NAME);
|
|
||||||
mail.setSmtpPort(TamguoConstant.ALIYUN_SMTP_HOST_PORT);
|
|
||||||
mail.setAuthentication(TamguoConstant.ALIYUN_MAIL_ACCOUNT, TamguoConstant.ALIYUN_MAIL_PASSWORD);
|
|
||||||
mail.setSSLOnConnect(true);
|
|
||||||
mail.setFrom(TamguoConstant.ALIYUN_MAIL_ACCOUNT, "探果题库");
|
|
||||||
mail.addTo(email);
|
|
||||||
mail.setSubject(subject);
|
|
||||||
mail.setCharset("UTF-8");
|
|
||||||
Integer vcode = (int) ((Math.random()*9+1)*100000);
|
|
||||||
mail.setHtmlMsg("探果网找回密码验证码:"+vcode);
|
|
||||||
mail.send();
|
|
||||||
|
|
||||||
cacheService.setObject(TamguoConstant.ALIYUN_MAIL_FIND_PASSWORD_PREFIX + email , vcode.toString() , 3 * 60);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer sendPassJoinusEmail(HttpServletRequest req , TeacherEntity teacher , String password) throws EmailException {
|
|
||||||
HtmlEmail mail = new HtmlEmail();
|
|
||||||
mail.setHostName(TamguoConstant.ALIYUN_SMTP_HOST_NAME);
|
|
||||||
mail.setSmtpPort(TamguoConstant.ALIYUN_SMTP_HOST_PORT);
|
|
||||||
mail.setAuthentication(TamguoConstant.ALIYUN_MAIL_ACCOUNT, TamguoConstant.ALIYUN_MAIL_PASSWORD);
|
|
||||||
mail.setSSLOnConnect(true);
|
|
||||||
mail.setFrom(TamguoConstant.ALIYUN_MAIL_ACCOUNT, "探果题库");
|
|
||||||
mail.addTo(teacher.getEmail());
|
|
||||||
mail.setSubject("恭喜您成为探果题库的成员");
|
|
||||||
mail.setCharset("UTF-8");
|
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
map.put("teacher", teacher);
|
|
||||||
map.put("setting", setting);
|
|
||||||
map.put("password", password);
|
|
||||||
IContext context = new Context(req.getLocale() , map);
|
|
||||||
String html = templateEngine.process("email/joinus", context);
|
|
||||||
mail.setHtmlMsg(html);
|
|
||||||
mail.send();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,200 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.google.code.kaptcha.Constants;
|
|
||||||
import com.tamguo.admin.dao.MemberMapper;
|
|
||||||
import com.tamguo.admin.dao.redis.CacheService;
|
|
||||||
import com.tamguo.admin.model.MemberEntity;
|
|
||||||
import com.tamguo.admin.service.IMemberService;
|
|
||||||
import com.tamguo.admin.util.Result;
|
|
||||||
import com.tamguo.admin.util.ShiroUtils;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class MemberService implements IMemberService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MemberMapper memberMapper;
|
|
||||||
@Autowired
|
|
||||||
private CacheService cacheService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result login(String username, String password , String captcha) {
|
|
||||||
MemberEntity member = memberMapper.findByUsername(username);
|
|
||||||
if(member == null){
|
|
||||||
return Result.result(201, member, "用户名或密码有误,请重新输入或找回密码");
|
|
||||||
}
|
|
||||||
Integer loginFailureCount = this.getLoginFailureCount(member);
|
|
||||||
if(loginFailureCount == 3 && !new Sha256Hash(password).toHex().equals(member.getPassword())){
|
|
||||||
loginFailureCount++;
|
|
||||||
this.updateLoginFailureCount(member , loginFailureCount);
|
|
||||||
return Result.result(203, member, "用户名或密码有误,错误次数超过三次,启用验证码!");
|
|
||||||
}
|
|
||||||
if(loginFailureCount > 3 && StringUtils.isEmpty(captcha)){
|
|
||||||
loginFailureCount++;
|
|
||||||
this.updateLoginFailureCount(member , loginFailureCount);
|
|
||||||
return Result.result(204, member, "请输入验证码!");
|
|
||||||
}
|
|
||||||
if(loginFailureCount > 3){
|
|
||||||
String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
|
|
||||||
if (!captcha.equalsIgnoreCase(kaptcha)) {
|
|
||||||
return Result.result(205, member, "验证码错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!new Sha256Hash(password).toHex().equals(member.getPassword())){
|
|
||||||
loginFailureCount++;
|
|
||||||
this.updateLoginFailureCount(member , loginFailureCount);
|
|
||||||
return Result.result(202, member, "用户名或密码有误,请重新输入或找回密码");
|
|
||||||
}
|
|
||||||
this.updateLoginFailureCount(member , 0);
|
|
||||||
return Result.result(200, member, "登录成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateLoginFailureCount(MemberEntity member , Integer loginFailureCount){
|
|
||||||
cacheService.setObject(TamguoConstant.LOGIN_FAILURE_COUNT + member.getUid(), loginFailureCount , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getLoginFailureCount(MemberEntity member){
|
|
||||||
if(member == null){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if(!cacheService.isExist(TamguoConstant.LOGIN_FAILURE_COUNT + member.getUid())){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return (Integer)cacheService.getObject(TamguoConstant.LOGIN_FAILURE_COUNT + member.getUid());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result checkUsername(String username) {
|
|
||||||
MemberEntity member = memberMapper.findByUsername(username);
|
|
||||||
if(member != null){
|
|
||||||
return Result.result(201, null, "该用户名已经存在");
|
|
||||||
}
|
|
||||||
return Result.result(200, null, "该用户名可用");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result checkMobile(String mobile) {
|
|
||||||
MemberEntity member = memberMapper.findByMobile(mobile);
|
|
||||||
if(member != null){
|
|
||||||
return Result.result(201, null, "该手机号已经存在");
|
|
||||||
}
|
|
||||||
return Result.result(200, null, "该手机号可用");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result register(String username, String mobile, String password,
|
|
||||||
String verifyCode) {
|
|
||||||
MemberEntity m = memberMapper.findByUsername(username);
|
|
||||||
if(m != null){
|
|
||||||
return Result.result(201, null, "该用户已经存在");
|
|
||||||
}
|
|
||||||
m = memberMapper.findByMobile(mobile);
|
|
||||||
if(m != null){
|
|
||||||
return Result.result(202, null, "该手机号已经存在");
|
|
||||||
}
|
|
||||||
if(!cacheService.isExist(TamguoConstant.ALIYUN_MOBILE_SMS_PREFIX + mobile)){
|
|
||||||
return Result.result(203, null, "验证码错误");
|
|
||||||
}
|
|
||||||
String code = (String) cacheService.getObject(TamguoConstant.ALIYUN_MOBILE_SMS_PREFIX + mobile);
|
|
||||||
if(!code.equals(verifyCode)){
|
|
||||||
return Result.result(204, null, "验证码错误");
|
|
||||||
}
|
|
||||||
MemberEntity member = new MemberEntity();
|
|
||||||
member.setAvatar(TamguoConstant.DEFAULT_MEMBER_AVATAR);
|
|
||||||
member.setMobile(mobile);
|
|
||||||
member.setPassword(new Sha256Hash(password).toHex());
|
|
||||||
member.setUsername(username);
|
|
||||||
memberMapper.insert(member);
|
|
||||||
return Result.result(200, member, "注册成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result checkAccount(String account) {
|
|
||||||
if(StringUtils.isEmpty(account)){
|
|
||||||
return Result.result(201, null, "帐号不存在!");
|
|
||||||
}
|
|
||||||
MemberEntity member = memberMapper.findByUsernameOrEmailOrMobile(account);
|
|
||||||
if(member == null){
|
|
||||||
return Result.result(201, null, "帐号不存在!");
|
|
||||||
}
|
|
||||||
return Result.result(200, null, "该帐号存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result confirmAccount(String account, String veritycode) {
|
|
||||||
if(StringUtils.isEmpty(account)){
|
|
||||||
return Result.result(201, null, "帐号不存在!");
|
|
||||||
}
|
|
||||||
MemberEntity member = memberMapper.findByUsernameOrEmailOrMobile(account);
|
|
||||||
if(member == null){
|
|
||||||
return Result.result(201, null, "帐号不存在!");
|
|
||||||
}
|
|
||||||
String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
|
|
||||||
if (!veritycode.equalsIgnoreCase(kaptcha)) {
|
|
||||||
return Result.result(202, null, "验证码错误");
|
|
||||||
}
|
|
||||||
return Result.result(200, member, "该帐号存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result securityCheck(String username , String isEmail , String vcode) {
|
|
||||||
MemberEntity member = memberMapper.findByUsername(username);
|
|
||||||
if("1".equals(isEmail)){
|
|
||||||
if(!cacheService.isExist(TamguoConstant.ALIYUN_MAIL_FIND_PASSWORD_PREFIX + member.getEmail())){
|
|
||||||
return Result.result(201, member, "验证码错误");
|
|
||||||
}
|
|
||||||
String code = (String) cacheService.getObject(TamguoConstant.ALIYUN_MAIL_FIND_PASSWORD_PREFIX + member.getEmail());
|
|
||||||
if(!code.equals(vcode)){
|
|
||||||
return Result.result(202, member, "验证码错误");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(!cacheService.isExist(TamguoConstant.ALIYUN_MOBILE_SMS_PREFIX + member.getMobile())){
|
|
||||||
return Result.result(203, member, "验证码错误");
|
|
||||||
}
|
|
||||||
String code = (String) cacheService.getObject(TamguoConstant.ALIYUN_MOBILE_SMS_PREFIX + member.getMobile());
|
|
||||||
if(!code.equals(vcode)){
|
|
||||||
return Result.result(204, member, "验证码错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String key = UUID.randomUUID().toString();
|
|
||||||
cacheService.setObject(TamguoConstant.SECURITY_CHECK_PREFIX + key, username , 2 * 60 * 60);
|
|
||||||
return Result.result(200, key, "安全验证通过");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result resetPassword(String resetPasswordKey , String username , String password, String verifypwd) {
|
|
||||||
if(cacheService.isExist(TamguoConstant.SECURITY_CHECK_PREFIX + resetPasswordKey)){
|
|
||||||
MemberEntity member = memberMapper.findByUsername(username);
|
|
||||||
if(password.equals(verifypwd)){
|
|
||||||
member.setPassword(new Sha256Hash(password).toHex());
|
|
||||||
memberMapper.updateById(member);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Result.result(200, null, "更新成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void updateMember(MemberEntity member) {
|
|
||||||
MemberEntity entity = memberMapper.selectById(member.getUid());
|
|
||||||
entity.setAvatar(member.getAvatar());
|
|
||||||
entity.setEmail(member.getEmail());
|
|
||||||
entity.setMobile(member.getMobile());
|
|
||||||
|
|
||||||
memberMapper.updateById(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
@Override
|
|
||||||
public MemberEntity findByUid(String uid) {
|
|
||||||
return memberMapper.selectById(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.mapper.Condition;
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.dao.MenuMapper;
|
|
||||||
import com.tamguo.admin.dao.redis.CacheService;
|
|
||||||
import com.tamguo.admin.model.MenuEntity;
|
|
||||||
import com.tamguo.admin.service.IMenuService;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class MenuService implements IMenuService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MenuMapper menuMapper;
|
|
||||||
@Autowired
|
|
||||||
private CacheService cacheService;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<MenuEntity> findMenus() {
|
|
||||||
List<MenuEntity> menuList = ((List<MenuEntity>) cacheService.getObject(TamguoConstant.INDEX_MENU));
|
|
||||||
menuList = null;
|
|
||||||
if (menuList == null || menuList.isEmpty()) {
|
|
||||||
menuList = menuMapper.findFatherMenus();
|
|
||||||
for(MenuEntity menu : menuList){
|
|
||||||
List<MenuEntity> childSubjects = menuMapper.findMenuByParentId(menu.getUid());
|
|
||||||
menu.setChildSubjects(childSubjects);
|
|
||||||
}
|
|
||||||
cacheService.setObject(TamguoConstant.INDEX_MENU, menuList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return menuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<MenuEntity> findAllMenus() {
|
|
||||||
List<MenuEntity> allMenuList = ((List<MenuEntity>) cacheService.getObject(TamguoConstant.ALL_INDEX_MENU));
|
|
||||||
allMenuList = null;
|
|
||||||
if(allMenuList == null || allMenuList.isEmpty()){
|
|
||||||
allMenuList = menuMapper.findAllFatherMenus();
|
|
||||||
for(MenuEntity menu : allMenuList){
|
|
||||||
List<MenuEntity> childSubjects = menuMapper.findMenuByParentId(menu.getUid());
|
|
||||||
menu.setChildSubjects(childSubjects);
|
|
||||||
}
|
|
||||||
cacheService.setObject(TamguoConstant.ALL_INDEX_MENU, allMenuList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return allMenuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<MenuEntity> findLeftMenus() {
|
|
||||||
List<MenuEntity> leftMenuList = ((List<MenuEntity>) cacheService.getObject(TamguoConstant.LEFT_INDEX_MENU));
|
|
||||||
leftMenuList = null;
|
|
||||||
if(leftMenuList == null || leftMenuList.isEmpty()){
|
|
||||||
leftMenuList = menuMapper.findLeftFatherMenus();
|
|
||||||
for(MenuEntity menu : leftMenuList){
|
|
||||||
List<MenuEntity> childSubjects = menuMapper.findMenuByParentId(menu.getUid());
|
|
||||||
menu.setChildSubjects(childSubjects);
|
|
||||||
}
|
|
||||||
cacheService.setObject(TamguoConstant.LEFT_INDEX_MENU, leftMenuList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return leftMenuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<MenuEntity> findFooterMenus() {
|
|
||||||
List<MenuEntity> footerMenuList = ((List<MenuEntity>) cacheService.getObject(TamguoConstant.FOOTER_INDEX_MENU));
|
|
||||||
footerMenuList = null;
|
|
||||||
if(footerMenuList == null || footerMenuList.isEmpty()){
|
|
||||||
footerMenuList = menuMapper.findFooterFatherMenus();
|
|
||||||
for(MenuEntity menu : footerMenuList){
|
|
||||||
List<MenuEntity> childSubjects = menuMapper.findMenuByParentId(menu.getUid());
|
|
||||||
menu.setChildSubjects(childSubjects);
|
|
||||||
}
|
|
||||||
cacheService.setObject(TamguoConstant.FOOTER_INDEX_MENU, footerMenuList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return footerMenuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<MenuEntity> list(String name, Page<MenuEntity> page) {
|
|
||||||
return page.setRecords(menuMapper.findByName(name , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<MenuEntity> getMenuTree() {
|
|
||||||
return (List<MenuEntity>) menuMapper.selectList(Condition.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MenuEntity findById(String uid) {
|
|
||||||
return menuMapper.selectById(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save(MenuEntity menu) {
|
|
||||||
menuMapper.insert(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(MenuEntity menu) {
|
|
||||||
menuMapper.updateById(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteBatch(String[] menuIds) {
|
|
||||||
menuMapper.deleteBatchIds(Arrays.asList(menuIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,230 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.dao.PaperMapper;
|
|
||||||
import com.tamguo.admin.dao.redis.CacheService;
|
|
||||||
import com.tamguo.admin.model.PaperEntity;
|
|
||||||
import com.tamguo.admin.service.IPaperService;
|
|
||||||
import com.tamguo.admin.util.ShiroUtils;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class PaperService implements IPaperService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PaperMapper paperMapper;
|
|
||||||
@Autowired
|
|
||||||
private CacheService cacheService;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<PaperEntity> findHistoryPaper() {
|
|
||||||
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(TamguoConstant.HISTORY_PAPER);
|
|
||||||
if(paperList == null || paperList.isEmpty()){
|
|
||||||
Page<PaperEntity> page = new Page<>(1 , 6);
|
|
||||||
paperList = paperMapper.findByTypeAndAreaId(TamguoConstant.ZHENGTI_PAPER_ID , TamguoConstant.BEIJING_AREA_ID , page);
|
|
||||||
cacheService.setObject(TamguoConstant.ZHENGTI_PAPER_ID, paperList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return paperList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<PaperEntity> findSimulationPaper() {
|
|
||||||
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(TamguoConstant.SIMULATION_PAPER);
|
|
||||||
if(paperList == null || paperList.isEmpty()){
|
|
||||||
Page<PaperEntity> page = new Page<>(1 , 6);
|
|
||||||
paperList = paperMapper.findByTypeAndAreaId(TamguoConstant.SIMULATION_PAPER_ID , TamguoConstant.BEIJING_AREA_ID , page);
|
|
||||||
cacheService.setObject(TamguoConstant.SIMULATION_PAPER, paperList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return paperList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<PaperEntity> findHotPaper(String areaId) {
|
|
||||||
List<PaperEntity> paperList = (List<PaperEntity>) cacheService.getObject(TamguoConstant.HOT_PAPER);
|
|
||||||
paperList = null;
|
|
||||||
if(paperList == null || paperList.isEmpty()){
|
|
||||||
Page<PaperEntity> page = new Page<>(1 , 10);
|
|
||||||
paperList = paperMapper.findByAreaId(areaId , page);
|
|
||||||
cacheService.setObject(TamguoConstant.HOT_PAPER, paperList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return paperList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<PaperEntity> findList(String courseId,
|
|
||||||
String paperType, String year, String area , Integer pageNum) {
|
|
||||||
Page<PaperEntity> page = new Page<>(pageNum , TamguoConstant.DEFAULT_PAGE_SIZE);
|
|
||||||
return page.setRecords(paperMapper.findList(courseId , paperType , year , area , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PaperEntity find(String paperId) {
|
|
||||||
return paperMapper.selectById(paperId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PaperEntity> findPaperByAreaId(String areaId , String type) {
|
|
||||||
if("n".equals(type)){
|
|
||||||
return this.findHotPaper(areaId);
|
|
||||||
}
|
|
||||||
Page<PaperEntity> page = new Page<>(1 , 8);
|
|
||||||
return paperMapper.findPaperByAreaId(areaId , type , page);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getPaperTotal() {
|
|
||||||
return paperMapper.getPaperTotal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<PaperEntity> list(String name, Page<PaperEntity> page) {
|
|
||||||
if(!StringUtils.isEmpty(name)){
|
|
||||||
name = "%" + name + "%";
|
|
||||||
}
|
|
||||||
return page.setRecords(paperMapper.queryPageByName(name , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PaperEntity select(String paperId) {
|
|
||||||
return paperMapper.selectById(paperId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteByIds(String[] paperIds) {
|
|
||||||
paperMapper.deleteBatchIds(Arrays.asList(paperIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save(PaperEntity paper) {
|
|
||||||
paper.setCreaterId(ShiroUtils.getUid());
|
|
||||||
paperMapper.insert(paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(PaperEntity paper) {
|
|
||||||
paperMapper.updateById(paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PaperEntity> findByCreaterId(String createrId) {
|
|
||||||
return paperMapper.findByCreaterId(createrId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void updatePaperName(String paperId, String name) {
|
|
||||||
PaperEntity paper = paperMapper.selectById(paperId);
|
|
||||||
paper.setName(name);
|
|
||||||
paperMapper.updateById(paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deletePaper(String paperId) {
|
|
||||||
paperMapper.deleteById(paperId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void addPaperQuestionInfo(String paperId, String title,
|
|
||||||
String name, String type) {
|
|
||||||
PaperEntity paper = paperMapper.selectById(paperId);
|
|
||||||
String questionInfo = paper.getQuestionInfo();
|
|
||||||
|
|
||||||
JSONArray qList = JSONArray.parseArray(questionInfo);
|
|
||||||
JSONObject entity = new JSONObject();
|
|
||||||
entity.put("name", name);
|
|
||||||
entity.put("title", title);
|
|
||||||
entity.put("type", type);
|
|
||||||
qList.add(entity);
|
|
||||||
|
|
||||||
// 处理uid 问题
|
|
||||||
for(int i=0 ; i<qList.size(); i++){
|
|
||||||
JSONObject q = qList.getJSONObject(i);
|
|
||||||
q.put("uid", i+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
paper.setQuestionInfo(qList.toString());
|
|
||||||
paperMapper.updateById(paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void updatePaperQuestionInfo(String paperId, String title,
|
|
||||||
String name, String type, String cuid) {
|
|
||||||
PaperEntity paper = paperMapper.selectById(paperId);
|
|
||||||
String questionInfo = paper.getQuestionInfo();
|
|
||||||
JSONArray qList = JSONArray.parseArray(questionInfo);
|
|
||||||
for(int i =0 ; i<qList.size() ; i++){
|
|
||||||
JSONObject q = qList.getJSONObject(i);
|
|
||||||
if(q.getString("uid").equals(cuid)){
|
|
||||||
q.put("name", name);
|
|
||||||
q.put("title", title);
|
|
||||||
q.put("type", type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
paper.setQuestionInfo(qList.toString());
|
|
||||||
paperMapper.updateById(paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deletePaperQuestionInfoBtn(String paperId, String cuid) {
|
|
||||||
PaperEntity paper = paperMapper.selectById(paperId);
|
|
||||||
String questionInfo = paper.getQuestionInfo();
|
|
||||||
JSONArray qList = JSONArray.parseArray(questionInfo);
|
|
||||||
for(int i =0 ; i<qList.size() ; i++){
|
|
||||||
JSONObject q = qList.getJSONObject(i);
|
|
||||||
if(q.getString("uid").equals(cuid)){
|
|
||||||
qList.remove(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理uid 问题
|
|
||||||
for(int i=0 ; i<qList.size(); i++){
|
|
||||||
JSONObject q = qList.getJSONObject(i);
|
|
||||||
q.put("uid", i+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
paper.setQuestionInfo(qList.toString());
|
|
||||||
paperMapper.updateById(paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<PaperEntity> memberPaperList(String name , String memberId , Integer page,
|
|
||||||
Integer limit) {
|
|
||||||
if(!StringUtils.isEmpty(name)){
|
|
||||||
name = "%" + name + "%";
|
|
||||||
}
|
|
||||||
Page<PaperEntity> p = new Page<>(page , limit);
|
|
||||||
return p.setRecords(paperMapper.queryPageByNameAndCreatorId(name , memberId , p));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void addPaper(PaperEntity paper) {
|
|
||||||
paper.setDownHits(0);
|
|
||||||
paper.setOpenHits(0);
|
|
||||||
paper.setQuestionInfo("[]");
|
|
||||||
|
|
||||||
// 写入seo信息
|
|
||||||
paper.setSeoTitle(paper.getName());
|
|
||||||
paper.setSeoKeywords(paper.getName());
|
|
||||||
paper.setSeoDescription(paper.getName());
|
|
||||||
paperMapper.insert(paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,137 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.dao.ChapterMapper;
|
|
||||||
import com.tamguo.admin.dao.PaperMapper;
|
|
||||||
import com.tamguo.admin.dao.QuestionMapper;
|
|
||||||
import com.tamguo.admin.model.ChapterEntity;
|
|
||||||
import com.tamguo.admin.model.PaperEntity;
|
|
||||||
import com.tamguo.admin.model.QuestionEntity;
|
|
||||||
import com.tamguo.admin.service.IQuestionService;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class QuestionService implements IQuestionService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private QuestionMapper questionMapper;
|
|
||||||
@Autowired
|
|
||||||
private PaperMapper paperMapper;
|
|
||||||
@Autowired
|
|
||||||
private ChapterMapper chapterMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<QuestionEntity> findByChapterId(String chapterId , Integer offset , Integer limit) {
|
|
||||||
Page<QuestionEntity> p = new Page<>(offset , limit);
|
|
||||||
return p.setRecords(questionMapper.findByChapterId(chapterId , p));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
@Override
|
|
||||||
public QuestionEntity findNormalQuestion(String uid) {
|
|
||||||
return questionMapper.findNormalQuestion(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<QuestionEntity> findPaperQuestion(String paperId) {
|
|
||||||
return questionMapper.findByPaperId(paperId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<QuestionEntity> list(String name, Integer page, Integer limit) {
|
|
||||||
Page<QuestionEntity> p = new Page<>(page , limit);
|
|
||||||
return p.setRecords(questionMapper.queryPageByName(name , p));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QuestionEntity select(String questionId) {
|
|
||||||
return questionMapper.selectByUid(questionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteBatch(String[] questionIds) {
|
|
||||||
questionMapper.deleteBatchIds(Arrays.asList(questionIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void addQuestion(QuestionEntity question) {
|
|
||||||
PaperEntity paper = paperMapper.selectById(question.getPaperId().toString());
|
|
||||||
question.setCourseId(paper.getCourseId());
|
|
||||||
questionMapper.insert(question);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<QuestionEntity> queryQuestionList(QuestionEntity question , Integer page , Integer limit) {
|
|
||||||
Page<QuestionEntity> p = new Page<>(page , limit);
|
|
||||||
if(!StringUtils.isEmpty(question.getReviewPoint())){
|
|
||||||
question.setReviewPoint("%" + question.getReviewPoint() + "%");
|
|
||||||
}
|
|
||||||
return p.setRecords(questionMapper.queryQuestionList(question.getQuestionType(),question.getUid() ,question.getReviewPoint() , p));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void save(QuestionEntity question) {
|
|
||||||
question.setAuditStatus(TamguoConstant.QUESTION_NOTHING_AUDIT_STATUS);
|
|
||||||
questionMapper.insert(question);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void update(QuestionEntity question) {
|
|
||||||
question.setAuditStatus(TamguoConstant.QUESTION_NOTHING_AUDIT_STATUS);
|
|
||||||
questionMapper.updateById(question);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void audit(String[] questionIds) {
|
|
||||||
List<QuestionEntity> questions = questionMapper.selectBatchIds(Arrays.asList(questionIds));
|
|
||||||
for(int i=0 ; i<questions.size() ; i++) {
|
|
||||||
QuestionEntity question = questions.get(i);
|
|
||||||
if(TamguoConstant.QUESTION_SUCCESS_AUDIT_STATUS.equals(question.getAuditStatus())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
question.setAuditStatus(TamguoConstant.QUESTION_SUCCESS_AUDIT_STATUS);
|
|
||||||
questionMapper.updateById(question);
|
|
||||||
|
|
||||||
// 章节题目数添加
|
|
||||||
ChapterEntity chapter = chapterMapper.selectById(question.getChapterId().toString());
|
|
||||||
if(chapter != null) {
|
|
||||||
chapter.setQuestionNum(chapter == null ? 0 : chapter.getQuestionNum().intValue() + 1);
|
|
||||||
chapterMapper.updateById(chapter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void notAudit(String[] questionIds) {
|
|
||||||
List<QuestionEntity> questions = questionMapper.selectBatchIds(Arrays.asList(questionIds));
|
|
||||||
for(int i=0 ; i<questions.size() ; i++) {
|
|
||||||
QuestionEntity question = questions.get(i);
|
|
||||||
if(TamguoConstant.QUESTION_FAILED_AUDIT_STATUS.equals(question.getAuditStatus())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
question.setAuditStatus(TamguoConstant.QUESTION_FAILED_AUDIT_STATUS);
|
|
||||||
questionMapper.updateById(question);
|
|
||||||
|
|
||||||
// 章节题目数添加
|
|
||||||
ChapterEntity chapter = chapterMapper.selectById(question.getChapterId().toString());
|
|
||||||
if(chapter != null) {
|
|
||||||
chapter.setQuestionNum(chapter == null ? 0 : chapter.getQuestionNum().intValue() - 1);
|
|
||||||
chapterMapper.updateById(chapter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.mapper.Condition;
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.dao.PaperMapper;
|
|
||||||
import com.tamguo.admin.dao.SchoolMapper;
|
|
||||||
import com.tamguo.admin.dao.redis.CacheService;
|
|
||||||
import com.tamguo.admin.model.PaperEntity;
|
|
||||||
import com.tamguo.admin.model.SchoolEntity;
|
|
||||||
import com.tamguo.admin.service.ISchoolService;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SchoolService implements ISchoolService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SchoolMapper schoolMapper;
|
|
||||||
@Autowired
|
|
||||||
private PaperMapper paperMapper;
|
|
||||||
@Autowired
|
|
||||||
private CacheService cacheService;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<SchoolEntity> findEliteSchoolPaper(String shcoolId) {
|
|
||||||
List<SchoolEntity> schoolList = (List<SchoolEntity>) cacheService.getObject(TamguoConstant.ELITE_SCHOOL_PAPER);
|
|
||||||
schoolList = null;
|
|
||||||
// 获取名校试卷
|
|
||||||
if(schoolList == null || schoolList.isEmpty()){
|
|
||||||
Page<SchoolEntity> page = new Page<>(1 , 3);
|
|
||||||
schoolList = schoolMapper.findByAreaId(shcoolId , page);
|
|
||||||
for(SchoolEntity school : schoolList){
|
|
||||||
Page<PaperEntity> p = new Page<>(1 , 3);
|
|
||||||
List<PaperEntity> paperList = paperMapper.findBySchoolId(school.getUid() , p);
|
|
||||||
school.setPaperList(paperList);
|
|
||||||
}
|
|
||||||
cacheService.setObject(TamguoConstant.ELITE_SCHOOL_PAPER, schoolList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return schoolList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<SchoolEntity> findEliteSchool() {
|
|
||||||
List<SchoolEntity> schoolList = (List<SchoolEntity>) cacheService.getObject(TamguoConstant.ELITE_PAPER);
|
|
||||||
if(schoolList == null || schoolList.isEmpty()){
|
|
||||||
schoolList = schoolMapper.selectList(Condition.EMPTY);
|
|
||||||
cacheService.setObject(TamguoConstant.ELITE_PAPER, schoolList , 2 * 60 * 60);
|
|
||||||
}
|
|
||||||
return schoolList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.mapper.Condition;
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.dao.CourseMapper;
|
|
||||||
import com.tamguo.admin.dao.SubjectMapper;
|
|
||||||
import com.tamguo.admin.model.CourseEntity;
|
|
||||||
import com.tamguo.admin.model.SubjectEntity;
|
|
||||||
import com.tamguo.admin.service.ISubjectService;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SubjectService implements ISubjectService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SubjectMapper subjectMapper;
|
|
||||||
@Autowired
|
|
||||||
private CourseMapper courseMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SubjectEntity find(String uid) {
|
|
||||||
SubjectEntity subject = subjectMapper.selectById(uid);
|
|
||||||
List<CourseEntity> courseList = courseMapper.findBySubjectId(uid);
|
|
||||||
subject.setCourseList(courseList);
|
|
||||||
return subject;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<SubjectEntity> list(String name , Integer pageNum , Integer pageSize) {
|
|
||||||
Page<SubjectEntity> page = new Page<>(pageNum , pageSize);
|
|
||||||
if(!StringUtils.isEmpty(name)){
|
|
||||||
name = "%"+name+"%";
|
|
||||||
}
|
|
||||||
return page.setRecords(subjectMapper.queryPage(name , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(SubjectEntity subject) {
|
|
||||||
SubjectEntity entity = subjectMapper.selectById(subject.getUid());
|
|
||||||
entity.setName(subject.getName());
|
|
||||||
subjectMapper.updateById(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save(SubjectEntity subject) {
|
|
||||||
subjectMapper.insert(subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteBatch(String[] subjectIds) {
|
|
||||||
subjectMapper.deleteBatchIds(Arrays.asList(subjectIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public List<SubjectEntity> getSubjectTree() {
|
|
||||||
return subjectMapper.selectList(Condition.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSONArray getCourseTree() {
|
|
||||||
JSONArray courseTree = new JSONArray();
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.EMPTY);
|
|
||||||
for(int i=0 ; i<subjectList.size() ; i++){
|
|
||||||
SubjectEntity subject = subjectList.get(i);
|
|
||||||
JSONObject node = new JSONObject();
|
|
||||||
node.put("uid", "s" + subject.getUid());
|
|
||||||
node.put("name", subject.getName());
|
|
||||||
node.put("parentId", "-1");
|
|
||||||
courseTree.add(node);
|
|
||||||
List<CourseEntity> courseList = courseMapper.findBySubjectId(subject.getUid());
|
|
||||||
for(int k=0 ; k<courseList.size() ; k++){
|
|
||||||
CourseEntity course = courseList.get(k);
|
|
||||||
|
|
||||||
node = new JSONObject();
|
|
||||||
node.put("uid", course.getUid());
|
|
||||||
node.put("name", course.getName());
|
|
||||||
node.put("parentId", "s" + subject.getUid());
|
|
||||||
courseTree.add(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return courseTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
||||||
import com.tamguo.admin.dao.SysMenuMapper;
|
|
||||||
import com.tamguo.admin.dao.SysRoleMapper;
|
|
||||||
import com.tamguo.admin.dao.SysUserMapper;
|
|
||||||
import com.tamguo.admin.model.SysMenuEntity;
|
|
||||||
import com.tamguo.admin.model.SysRoleEntity;
|
|
||||||
import com.tamguo.admin.model.SysUserEntity;
|
|
||||||
import com.tamguo.admin.service.ISysMenuService;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenuEntity> implements ISysMenuService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysMenuMapper sysMenuMapper;
|
|
||||||
@Autowired
|
|
||||||
private SysUserMapper sysUserMapper;
|
|
||||||
@Autowired
|
|
||||||
private SysRoleMapper sysRoleMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SysMenuEntity> getUserMenuList(String userId) {
|
|
||||||
SysUserEntity user = sysUserMapper.selectById(userId);
|
|
||||||
List<String> roleIds = Arrays.asList(user.getRoleIds().split(","));
|
|
||||||
// 获取用户角色
|
|
||||||
List<SysRoleEntity> roles = sysRoleMapper.selectBatchIds(roleIds);
|
|
||||||
// 有权限的菜单
|
|
||||||
List<String> menuIds = new ArrayList<>();
|
|
||||||
if(!CollectionUtils.isEmpty(roles)) {
|
|
||||||
for(int i=0 ; i<roles.size() ; i++) {
|
|
||||||
SysRoleEntity role = roles.get(i);
|
|
||||||
if(!StringUtils.isEmpty(role.getPerms())) {
|
|
||||||
List<String> mIds = Arrays.asList(role.getPerms().split(","));
|
|
||||||
menuIds.addAll(mIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<SysMenuEntity> menuList = sysMenuMapper.selectBatchIds(menuIds);
|
|
||||||
|
|
||||||
return menuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SysMenuEntity> getUserMenuTree(List<SysMenuEntity> menus){
|
|
||||||
List<SysMenuEntity> pMenuList = new ArrayList<>();
|
|
||||||
for(int i=0 ; i<menus.size() ; i++) {
|
|
||||||
SysMenuEntity menu = menus.get(i);
|
|
||||||
if(menu.getParentId().equals("0")) {
|
|
||||||
pMenuList.add(menu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 支持二级菜单
|
|
||||||
for(int i=0 ; i<pMenuList.size() ; i++) {
|
|
||||||
SysMenuEntity pMenu = pMenuList.get(i);
|
|
||||||
|
|
||||||
List<SysMenuEntity> childMenus = new ArrayList<>();
|
|
||||||
for(int k=0 ; k<menus.size() ; k++) {
|
|
||||||
SysMenuEntity cMenu = menus.get(k);
|
|
||||||
if(cMenu.getParentId().toString().equals(pMenu.getUid())) {
|
|
||||||
childMenus.add(cMenu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pMenu.setMenuList(childMenus);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pMenuList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
@Override
|
|
||||||
public Page<SysMenuEntity> queryList(Map<String, Object> hashMap, Page<SysMenuEntity> page) {
|
|
||||||
List<SysMenuEntity> pageList = (List<SysMenuEntity>) sysMenuMapper.queryList(hashMap , page);
|
|
||||||
page.setRecords(pageList);
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SysMenuEntity> queryNotButtonList() {
|
|
||||||
return sysMenuMapper.queryNotButtonList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysMenuEntity select(String parentId) {
|
|
||||||
return sysMenuMapper.queryByUid(parentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void save(SysMenuEntity menu) {
|
|
||||||
sysMenuMapper.insert(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void update(SysMenuEntity menu) {
|
|
||||||
sysMenuMapper.updateById(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void deleteBatch(String[] menuIds) {
|
|
||||||
sysMenuMapper.deleteBatchIds(Arrays.asList(menuIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
||||||
import com.tamguo.admin.dao.SysRoleMapper;
|
|
||||||
import com.tamguo.admin.model.SysRoleEntity;
|
|
||||||
import com.tamguo.admin.service.ISysRoleService;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRoleEntity> implements ISysRoleService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysRoleMapper sysRoleMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SysRoleEntity> findAll() {
|
|
||||||
return sysRoleMapper.selectList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
@Override
|
|
||||||
public Page<SysRoleEntity> queryList(SysRoleEntity sysRoleEntity, Page<SysRoleEntity> page) {
|
|
||||||
List<SysRoleEntity> list = sysRoleMapper.selectPageByName(sysRoleEntity , page);
|
|
||||||
page.setRecords(list);
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysRoleEntity select(String uid) {
|
|
||||||
return sysRoleMapper.selectById(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void save(SysRoleEntity role) {
|
|
||||||
role.setPerms(StringUtils.join(role.getMenuIdList(), ","));
|
|
||||||
sysRoleMapper.insert(role);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void update(SysRoleEntity role) {
|
|
||||||
role.setPerms(StringUtils.join(role.getMenuIdList(), ","));
|
|
||||||
sysRoleMapper.updateById(role);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void deleteBatch(String[] roleIds) {
|
|
||||||
sysRoleMapper.deleteBatchIds(Arrays.asList(roleIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,107 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.tamguo.admin.dao.SysUserMapper;
|
|
||||||
import com.tamguo.admin.model.SysUserEntity;
|
|
||||||
import com.tamguo.admin.service.ISysUserService;
|
|
||||||
import com.tamguo.admin.util.DateUtil;
|
|
||||||
import com.tamguo.admin.util.Result;
|
|
||||||
import com.tamguo.admin.util.ShaEncrypt;
|
|
||||||
import com.tamguo.admin.util.ShiroUtils;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SysUserServiceImpl implements ISysUserService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public SysUserMapper sysUserMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysUserEntity queryByUserName(String username) {
|
|
||||||
return sysUserMapper.queryByUserName(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysUserEntity queryByUid(String uid) {
|
|
||||||
return sysUserMapper.selectById(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateUserInfo(SysUserEntity user) {
|
|
||||||
SysUserEntity entity = sysUserMapper.selectById(user.getUid());
|
|
||||||
entity.setRoleIds(user.getRoleIds());
|
|
||||||
entity.setNickName(user.getNickName());
|
|
||||||
entity.setMobile(user.getMobile());
|
|
||||||
entity.setEmail(user.getEmail());
|
|
||||||
entity.setStatus(user.getStatus());
|
|
||||||
sysUserMapper.updateById(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public Result updatePassword(String oldPassword, String password, String repassword) {
|
|
||||||
String userId = ShiroUtils.getUid();
|
|
||||||
SysUserEntity user = sysUserMapper.selectById(userId);
|
|
||||||
if(!new Sha256Hash(oldPassword).toHex().equals(user.getPassword())) {
|
|
||||||
return Result.result(1, null, "旧密码错误");
|
|
||||||
}
|
|
||||||
if(!password.equals(repassword)) {
|
|
||||||
return Result.result(2, null, "两次密码输入不一致");
|
|
||||||
}
|
|
||||||
user.setPassword(new Sha256Hash(password).toHex());
|
|
||||||
sysUserMapper.updateById(user);
|
|
||||||
return Result.successResult(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=true)
|
|
||||||
@Override
|
|
||||||
public Page<SysUserEntity> queryPage(String userName ,Page<SysUserEntity> page) {
|
|
||||||
if(!StringUtils.isEmpty(userName)) {
|
|
||||||
userName = "%" + userName + "%";
|
|
||||||
}
|
|
||||||
page.setRecords(sysUserMapper.queryPage(userName , page));
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysUserEntity selectById(String userId) {
|
|
||||||
return sysUserMapper.selectById(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void save(SysUserEntity user) {
|
|
||||||
user.setCreateTime(DateUtil.getTime());
|
|
||||||
// sha256加密
|
|
||||||
user.setPassword(ShaEncrypt.SHA256(user.getPassword()));
|
|
||||||
// 处理角色
|
|
||||||
if(!CollectionUtils.isEmpty(user.getRoleIdList())) {
|
|
||||||
user.setRoleIds(StringUtils.join(user.getRoleIdList(), ","));
|
|
||||||
}
|
|
||||||
sysUserMapper.insert(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
public void update(SysUserEntity user) {
|
|
||||||
if (StringUtils.isEmpty(user.getPassword())) {
|
|
||||||
user.setPassword(null);
|
|
||||||
} else {
|
|
||||||
user.setPassword(ShaEncrypt.SHA256(user.getPassword()));
|
|
||||||
}
|
|
||||||
sysUserMapper.updateById(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void deleteBatch(String[] userIds) {
|
|
||||||
sysUserMapper.deleteBatchIds(Arrays.asList(userIds));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
package com.tamguo.admin.service.impl;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
||||||
import com.tamguo.admin.dao.SysUserMapper;
|
|
||||||
import com.tamguo.admin.dao.TeacherMapper;
|
|
||||||
import com.tamguo.admin.model.SysUserEntity;
|
|
||||||
import com.tamguo.admin.model.TeacherEntity;
|
|
||||||
import com.tamguo.admin.model.enums.SysUserStatusEnum;
|
|
||||||
import com.tamguo.admin.model.enums.TeacherStatus;
|
|
||||||
import com.tamguo.admin.service.IEmailService;
|
|
||||||
import com.tamguo.admin.service.ISmsService;
|
|
||||||
import com.tamguo.admin.service.ITeacherService;
|
|
||||||
import com.tamguo.admin.util.DateUtil;
|
|
||||||
import com.tamguo.admin.util.Result;
|
|
||||||
import com.tamguo.admin.util.TamguoConstant;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class TeacherService extends ServiceImpl<TeacherMapper, TeacherEntity> implements ITeacherService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TeacherMapper teacherMapper;
|
|
||||||
@Autowired
|
|
||||||
private IEmailService iEmailService;
|
|
||||||
@Autowired
|
|
||||||
private ISmsService iSmsService;
|
|
||||||
@Autowired
|
|
||||||
private SysUserMapper sysUserMapper;
|
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger(getClass());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<TeacherEntity> queryPage(String mobile, Page<TeacherEntity> page) {
|
|
||||||
return page.setRecords(teacherMapper.queryPage(mobile , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TeacherEntity find(String teacherId) {
|
|
||||||
return teacherMapper.selectById(teacherId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public Result update(TeacherEntity teacher) {
|
|
||||||
TeacherEntity entity = teacherMapper.selectById(teacher.getUid());
|
|
||||||
entity.setMobile(teacher.getMobile());
|
|
||||||
entity.setName(teacher.getName());
|
|
||||||
entity.setMobile(teacher.getMobile());
|
|
||||||
entity.setCardId(teacher.getCardId());
|
|
||||||
entity.setQq(teacher.getQq());
|
|
||||||
entity.setEmail(teacher.getEmail());
|
|
||||||
teacherMapper.updateById(entity);
|
|
||||||
return Result.successResult("修改成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public Result pass(HttpServletRequest req , String teacherId) {
|
|
||||||
TeacherEntity teacher = teacherMapper.selectById(teacherId);
|
|
||||||
if(TeacherStatus.PASS == teacher.getStatus()) {
|
|
||||||
return Result.result(Result.SUCCESS_CODE, null, "已经审核,不能再次审核!");
|
|
||||||
}
|
|
||||||
teacher.setStatus(TeacherStatus.PASS);
|
|
||||||
teacherMapper.updateById(teacher);
|
|
||||||
|
|
||||||
// 创建管理员账号
|
|
||||||
SysUserEntity user = new SysUserEntity();
|
|
||||||
user.setCreateTime(DateUtil.getTime());
|
|
||||||
user.setEmail(teacher.getEmail());
|
|
||||||
user.setMobile(teacher.getMobile());
|
|
||||||
user.setNickName(teacher.getName());
|
|
||||||
String password = this.generatePassword();
|
|
||||||
user.setPassword(new Sha256Hash(password).toHex());
|
|
||||||
user.setRoleIds(TamguoConstant.TEACHER_ROLE_ID);
|
|
||||||
user.setStatus(SysUserStatusEnum.NORMAL);
|
|
||||||
user.setUserName(teacher.getMobile());
|
|
||||||
sysUserMapper.insert(user);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 发送邮件
|
|
||||||
iEmailService.sendPassJoinusEmail(req , teacher , password);
|
|
||||||
// 发送短信
|
|
||||||
iSmsService.sendPassJoinusSms(teacher.getMobile());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage() , e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Result.result(Result.SUCCESS_CODE, null, "审核通过成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public Result deleteByIds(String[] teacherIds) {
|
|
||||||
if(teacherIds != null) {
|
|
||||||
if(!CollectionUtils.isEmpty(Arrays.asList(teacherIds))) {
|
|
||||||
List<TeacherEntity> teacherList = teacherMapper.selectBatchIds(Arrays.asList(teacherIds));
|
|
||||||
for(int i=0 ; i<teacherList.size() ; i++) {
|
|
||||||
TeacherEntity teacher = teacherList.get(i);
|
|
||||||
if(teacher.getStatus() == TeacherStatus.PASS) {
|
|
||||||
return Result.result(Result.FAIL_CODE, null, "已经通过不能删除");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 发送短信
|
|
||||||
|
|
||||||
// 发送邮件
|
|
||||||
|
|
||||||
teacherMapper.deleteBatchIds(Arrays.asList(teacherIds));
|
|
||||||
return Result.result(Result.SUCCESS_CODE, null, "删除成功");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Result.failResult("请选择要删除的记录!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String generatePassword() {
|
|
||||||
//字符源,可以根据需要删减
|
|
||||||
String generateSource = "0123456789abcdefghigklmnopqrstuvwxyz";
|
|
||||||
String rtnStr = "";
|
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
//循环随机获得当次字符,并移走选出的字符
|
|
||||||
String nowStr = String.valueOf(generateSource.charAt((int) Math.floor(Math.random() * generateSource.length())));
|
|
||||||
rtnStr += nowStr;
|
|
||||||
generateSource = generateSource.replaceAll(nowStr, "");
|
|
||||||
}
|
|
||||||
return rtnStr;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
import java.io.InterruptedIOException;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
public abstract class AbstractRunningLogHandler implements LogHandler {
|
|
||||||
|
|
||||||
private static Method getStackTraceMethod;
|
|
||||||
private static Method getClassNameMethod;
|
|
||||||
private static Method getMethodNameMethod;
|
|
||||||
private static Method getFileNameMethod;
|
|
||||||
private static Method getLineNumberMethod;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
Class<?>[] noArgs = null;
|
|
||||||
getStackTraceMethod = Throwable.class.getMethod("getStackTrace", noArgs);
|
|
||||||
Class<?> stackTraceElementClass = Class.forName("java.lang.StackTraceElement");
|
|
||||||
getClassNameMethod = stackTraceElementClass.getMethod("getClassName", noArgs);
|
|
||||||
getMethodNameMethod = stackTraceElementClass.getMethod("getMethodName", noArgs);
|
|
||||||
getFileNameMethod = stackTraceElementClass.getMethod("getFileName", noArgs);
|
|
||||||
getLineNumberMethod = stackTraceElementClass.getMethod("getLineNumber", noArgs);
|
|
||||||
} catch (ClassNotFoundException ex) {
|
|
||||||
LogDebug.debug("will use pre-JDK 1.4 methods to determine location.");
|
|
||||||
} catch (NoSuchMethodException ex) {
|
|
||||||
LogDebug.debug("will use pre-JDK 1.4 methods to determine location.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得指定class的StackTraceElement
|
|
||||||
*
|
|
||||||
* @param t
|
|
||||||
* @param fqnOfCallingClass
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected StackTraceElement getRunningStackTrace(Throwable t, String fqnOfCallingClass) {
|
|
||||||
if (getLineNumberMethod != null) {
|
|
||||||
try {
|
|
||||||
Object[] noArgs = null;
|
|
||||||
Object[] elements = (Object[]) getStackTraceMethod.invoke(t, noArgs);
|
|
||||||
for (int i = elements.length - 1; i >= 0; i--) {
|
|
||||||
String thisClass = (String) getClassNameMethod.invoke(elements[i], noArgs);
|
|
||||||
if (fqnOfCallingClass.equals(thisClass)) {
|
|
||||||
// 执行class名称
|
|
||||||
String className = fqnOfCallingClass;
|
|
||||||
// 执行方法名称
|
|
||||||
String methodName = (String) getMethodNameMethod.invoke(elements[i], noArgs);
|
|
||||||
// 执行class文件名称
|
|
||||||
String fileName = (String) getFileNameMethod.invoke(elements[i], noArgs);
|
|
||||||
// 执行到行号
|
|
||||||
int lineNumber = ((Integer) getLineNumberMethod.invoke(elements[i], noArgs)).intValue();
|
|
||||||
return new StackTraceElement(className, methodName, fileName, lineNumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
LogDebug.debug("failed using JDK 1.4 methods", ex);
|
|
||||||
} catch (InvocationTargetException ex) {
|
|
||||||
if (ex.getTargetException() instanceof InterruptedException
|
|
||||||
|| ex.getTargetException() instanceof InterruptedIOException) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
LogDebug.debug("failed using JDK 1.4 methods", ex);
|
|
||||||
} catch (RuntimeException ex) {
|
|
||||||
LogDebug.debug("failed using JDK 1.4 methods", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.createDefaultStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建默认StackTraceElement
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private StackTraceElement createDefaultStackTrace() {
|
|
||||||
return new StackTraceElement(this.getClass().getName(), "log", this.getClass().getName(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void info(String msg, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void info(String msg, Throwable t, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(String msg, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(String msg, Throwable t, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void debug(String msg, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void debug(String msg, Throwable t, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void warning(String msg, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void warning(String msg, Throwable t, String fqnOfCallingClass) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
public class CException extends RuntimeException {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 6401592364022805815L;
|
|
||||||
|
|
||||||
public CException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 统一异常处理 日志处理
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ExceptionSupport {
|
|
||||||
|
|
||||||
private final static Result failResult = Result.failResult("500");
|
|
||||||
private static LogHandler handler = new Log4jHandler();
|
|
||||||
|
|
||||||
private final static String LOG_INFO_PREFIX = "--info>> ";
|
|
||||||
private final static String LOG_ERROR_PREFIX = "--error>> ";
|
|
||||||
|
|
||||||
public static Result resolverResult(String methodInfo, Class<?> clazz, Exception e) {
|
|
||||||
if(e instanceof CException) {
|
|
||||||
handler.info(formatInfoLevelMsg(methodInfo, e.getMessage()), clazz.getName());
|
|
||||||
return Result.failResult(e.getMessage());
|
|
||||||
}
|
|
||||||
handler.error(formatErrorLevelMsg(methodInfo), e, clazz.getName());
|
|
||||||
return failResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String formatInfoLevelMsg(String methodInfo, String infoMsg) {
|
|
||||||
return LOG_INFO_PREFIX + methodInfo + ": " + infoMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String formatErrorLevelMsg(String methodInfo) {
|
|
||||||
return LOG_ERROR_PREFIX + methodInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
public class IdGen
|
|
||||||
{
|
|
||||||
private long workerId;
|
|
||||||
private long datacenterId;
|
|
||||||
private long sequence = 0L;
|
|
||||||
private long twepoch = 1288834974657L;
|
|
||||||
private long workerIdBits = 5L;
|
|
||||||
private long datacenterIdBits = 5L;
|
|
||||||
private long maxWorkerId = -1L ^ (-1L << workerIdBits);
|
|
||||||
private long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
|
|
||||||
private long sequenceBits = 12L;
|
|
||||||
private long workerIdShift = sequenceBits;
|
|
||||||
private long datacenterIdShift = sequenceBits + workerIdBits;
|
|
||||||
private long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
|
|
||||||
private long sequenceMask = -1L ^ (-1L << sequenceBits);
|
|
||||||
private long lastTimestamp = -1L;
|
|
||||||
private String suffix;
|
|
||||||
private boolean flag;
|
|
||||||
|
|
||||||
private static class IdGenHolder {
|
|
||||||
private static final IdGen instance = new IdGen();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IdGen get(){
|
|
||||||
return IdGenHolder.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取字符串拼接id
|
|
||||||
* @param suffix 字符串
|
|
||||||
* @param flag true:前缀 false:后缀
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static IdGen get(String suffix,boolean flag){
|
|
||||||
if(suffix == null || suffix.trim().length() == 0)
|
|
||||||
return IdGenHolder.instance;
|
|
||||||
else{
|
|
||||||
return new IdGen(suffix,flag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public IdGen() {
|
|
||||||
this(0L, 0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IdGen(String suffix,boolean flag){
|
|
||||||
this.suffix = suffix;
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IdGen(long workerId, long datacenterId) {
|
|
||||||
if (workerId > maxWorkerId || workerId < 0) {
|
|
||||||
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
|
|
||||||
}
|
|
||||||
if (datacenterId > maxDatacenterId || datacenterId < 0) {
|
|
||||||
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
|
|
||||||
}
|
|
||||||
this.workerId = workerId;
|
|
||||||
this.datacenterId = datacenterId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized String nextId() {
|
|
||||||
long timestamp = timeGen();
|
|
||||||
if (timestamp < lastTimestamp) {
|
|
||||||
throw new RuntimeException(String.format(
|
|
||||||
"Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
|
|
||||||
}
|
|
||||||
if (lastTimestamp == timestamp) {
|
|
||||||
sequence = (sequence + 1) & sequenceMask;
|
|
||||||
if (sequence == 0) {
|
|
||||||
timestamp = tilNextMillis(lastTimestamp);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sequence = 0L;
|
|
||||||
}
|
|
||||||
lastTimestamp = timestamp;
|
|
||||||
|
|
||||||
long serialNumber = ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift)
|
|
||||||
| (workerId << workerIdShift) | sequence;
|
|
||||||
|
|
||||||
return (suffix == null || suffix.trim().length() == 0) ? serialNumber+"" : (flag ? (new StringBuffer()).append(suffix).append(serialNumber).toString() : (new StringBuffer()).append(serialNumber).append(suffix).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected long tilNextMillis(long lastTimestamp) {
|
|
||||||
long timestamp = timeGen();
|
|
||||||
while (timestamp <= lastTimestamp) {
|
|
||||||
timestamp = timeGen();
|
|
||||||
}
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected long timeGen() {
|
|
||||||
return System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
import org.apache.log4j.Level;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
public class Log4jHandler extends AbstractRunningLogHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Log4jHandler.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void info(String msg, String fqnOfCallingClass) {
|
|
||||||
logger.log(fqnOfCallingClass, Level.INFO, msg, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void info(String msg, Throwable t, String fqnOfCallingClass) {
|
|
||||||
logger.log(fqnOfCallingClass, Level.INFO, msg, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(String msg, String fqnOfCallingClass) {
|
|
||||||
logger.log(fqnOfCallingClass, Level.ERROR, msg, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(String msg, Throwable t, String fqnOfCallingClass) {
|
|
||||||
logger.log(fqnOfCallingClass, Level.ERROR, msg, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
public class LogDebug {
|
|
||||||
|
|
||||||
private final static String DEBUG_LOG_KEY = "-- LogHandler: ";
|
|
||||||
|
|
||||||
public static void debug(String msg) {
|
|
||||||
System.err.println(DEBUG_LOG_KEY + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(String msg, Throwable t) {
|
|
||||||
System.err.println(DEBUG_LOG_KEY + msg);
|
|
||||||
if (t != null)
|
|
||||||
t.printStackTrace(System.err);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
public interface LogHandler {
|
|
||||||
|
|
||||||
public void info(String msg, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
public void info(String msg, Throwable t, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
public void error(String msg, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
public void error(String msg, Throwable t, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
public void debug(String msg, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
public void debug(String msg, Throwable t, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
public void warning(String msg, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
public void warning(String msg, Throwable t, String fqnOfCallingClass);
|
|
||||||
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
package com.tamguo.admin.util;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
|
|
||||||
public class ObjectUtil extends SerializeTranscoder {
|
|
||||||
@Override
|
|
||||||
public byte[] serialize(Object value) {
|
|
||||||
if (value == null) {
|
|
||||||
throw new NullPointerException("Can't serialize null");
|
|
||||||
}
|
|
||||||
byte[] result = null;
|
|
||||||
ByteArrayOutputStream bos = null;
|
|
||||||
ObjectOutputStream os = null;
|
|
||||||
try {
|
|
||||||
bos = new ByteArrayOutputStream();
|
|
||||||
os = new ObjectOutputStream(bos);
|
|
||||||
os.writeObject(value);
|
|
||||||
os.close();
|
|
||||||
bos.close();
|
|
||||||
result = bos.toByteArray();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new IllegalArgumentException("Non-serializable object", e);
|
|
||||||
} finally {
|
|
||||||
close(os);
|
|
||||||
close(bos);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object deserialize(byte[] in) {
|
|
||||||
Object result = null;
|
|
||||||
ByteArrayInputStream bis = null;
|
|
||||||
ObjectInputStream is = null;
|
|
||||||
try {
|
|
||||||
if (in != null) {
|
|
||||||
bis = new ByteArrayInputStream(in);
|
|
||||||
is = new ObjectInputStream(bis);
|
|
||||||
result = is.readObject();
|
|
||||||
is.close();
|
|
||||||
bis.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
close(is);
|
|
||||||
close(bis);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean equals(Object o1, Object o2) {
|
|
||||||
|
|
||||||
if (o1 == o2) {
|
|
||||||
return true;
|
|
||||||
} else if (o1 == null || o2 == null) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return o1.equals(o2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue