diff --git a/README.md b/README.md index e0463700c4de82c70b617e545fd98e97334e9f3b..78d7cdba450949b8fac01741b66ed0514f2fd1a9 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ oauthserver是一个基于Spring Boot Oauth2的完整的独立的Oauth2 Server 测试账号:用户名jeesun,密码1234567890c ### 管理端页面样式1 访问地址:[http://localhost:8182/index/index_v1](http://localhost:8182/index/index_v1) -![index_v1](screenshots/indev_v1.jpg) +![index_v1](tutorial/screenshots/indev_v1.jpg) ### 管理端页面样式2 访问地址:[http://localhost:8182/index/index_iframe](http://localhost:8182/index/index_iframe) -![index_iframe](screenshots/index_iframe.jpg) \ No newline at end of file +![index_iframe](tutorial/screenshots/index_iframe.jpg) \ No newline at end of file diff --git a/api/pom.xml b/api/pom.xml index 7a5588b3517ea13aefa464f1fb7095ffa4ddc90a..bb48da0e0e59b342647113ff240e5e0ea5374334 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -56,7 +56,6 @@ com.github.ulisesbocchio jasypt-spring-boot-starter - 1.18 @@ -92,12 +91,10 @@ org.thymeleaf.extras thymeleaf-extras-springsecurity4 - 3.0.2.RELEASE org.thymeleaf.extras thymeleaf-extras-java8time - 3.0.2.RELEASE @@ -108,7 +105,6 @@ net.sourceforge.nekohtml nekohtml - 1.9.22 @@ -123,12 +119,10 @@ io.springfox springfox-swagger2 - ${swagger2.version} io.springfox springfox-swagger-ui - ${swagger2.version} @@ -160,7 +154,6 @@ com.alibaba druid-spring-boot-starter - 1.1.10 mysql @@ -175,23 +168,19 @@ ojdbc14 ojdbc14 - 10.2.0.3.0 org.apache.httpcomponents httpclient - 4.5.3 com.google.code.gson gson - 2.8.5 com.alibaba fastjson - 1.2.47 @@ -203,24 +192,20 @@ org.mybatis.spring.boot mybatis-spring-boot-starter - 1.3.2 org.mybatis.generator mybatis-generator-maven-plugin - 1.3.7 org.mybatis.generator mybatis-generator-core - 1.3.7 com.github.pagehelper pagehelper-spring-boot-starter - 1.2.10 @@ -235,7 +220,6 @@ org.freemarker freemarker - 2.3.27-incubating @@ -244,40 +228,33 @@ com.alibaba dayu - 1.0 com.alibaba dayu-source - 1.0 commons-io commons-io - 2.4 org.apache.commons commons-lang3 - 3.7 commons-codec commons-codec - 1.10 commons-dbcp commons-dbcp - 1.4 commons-pool commons-pool - 1.6 @@ -285,33 +262,30 @@ com.qiniu qiniu-java-sdk - [7.2.0, 7.2.99] - + + + org.yaml snakeyaml - 1.23 com.alipay.sdk alipay-sdk-java - 3.3.4.ALL com.github.binarywang weixin-java-pay - ${weixin-java-pay.version} @@ -344,6 +317,12 @@ 0.0.1 + + + com.simon + common + 1.3.0 + diff --git a/api/src/main/java/com/simon/common/code/CodeGenerator.java b/api/src/main/java/com/simon/common/code/CodeGenerator.java deleted file mode 100644 index 69c0c1acd117ae203e100beda014e648742f5fb1..0000000000000000000000000000000000000000 --- a/api/src/main/java/com/simon/common/code/CodeGenerator.java +++ /dev/null @@ -1,468 +0,0 @@ -package com.simon.common.code; - -import com.google.common.base.CaseFormat; -import freemarker.template.TemplateExceptionHandler; -import org.apache.commons.lang3.StringUtils; -import org.mybatis.generator.api.MyBatisGenerator; -import org.mybatis.generator.config.*; -import org.mybatis.generator.internal.DefaultShellCallback; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.*; - -/** - * 代码生成器,根据数据表名称生成对应的Model、Mapper、Service、Controller简化开发。 - * @author simon - * @date 2018/09/22 - */ -public class CodeGenerator { - - /** - * 项目基础包名称,根据自己的项目修改 - */ - public static String BASE_PACKAGE; - - /*生成文件地址配置*/ - /** - * 生成的Model类所在包 - */ - private static String MODEL_PACKAGE; - - /** - * 生成的Mapper所在包 - */ - private static String MAPPER_PACKAGE; - - /** - * 生成Repository所在包 - */ - private static String REPOSITORY_PACKAGE; - - /** - * 生成的Service所在包 - */ - private static String SERVICE_PACKAGE; - - /** - * 生成的ServiceImpl所在包 - */ - private static String SERVICE_IMPL_PACKAGE; - - /** - * 生成的Controller所在包 - */ - private static String CONTROLLER_PACKAGE; - - /** - * Mapper插件基础接口的完全限定名(第二步提到的核心继承接口Mapper) - */ - private static String MAPPER_INTERFACE_REFERENCE; - - /*数据库配置*/ - /** - * 数据库url - */ - public static String JDBC_URL; - public static String JDBC_USERNAME; - public static String JDBC_PASSWORD; - public static String JDBC_DIVER_CLASS_NAME; - - /** - * 项目在硬盘上的基础路径 - */ - static final String PROJECT_PATH = System.getProperty("user.dir") + "/api"; - - /** - * 模板位置 - */ - static final String TEMPLATE_FILE_PATH = PROJECT_PATH + "/src/main/resources/templates/code"; - - /** - * java文件路径 - */ - static String JAVA_PATH; - - /** - * 资源文件路径 - */ - static String RESOURCES_PATH; - - private static String PACKAGE_PATH_REPOSITORY; - - /** - * 生成的Service存放路径 - */ - private static String PACKAGE_PATH_SERVICE; - - /** - * 生成的Service实现存放路径 - */ - private static String PACKAGE_PATH_SERVICE_IMPL; - - /** - * 生成的Controller存放路径 - */ - private static String PACKAGE_PATH_CONTROLLER; - - /** - * 要生成的模块 - */ - private static String GEN_MODULES; - - /** - * @author - */ - static String AUTHOR; - - /** - * @date - */ - static final String CREATE = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); - - /** - * 可选的要生成的代码部分 - */ - private static String MODULE_MODEL_AND_MAPPER = "modelandmapper"; - private static String MODULE_REPOSITORY = "repository"; - private static String MODULE_SERVICE = "service"; - private static String MODULE_CONTROLLER = "controller"; - private static String MODULE_CONTROLLER_AND_PAGE = "controllerandpage"; - - private static Properties prop; - static { - prop = new Properties(); - try { - prop.load(CodeGenerator.class.getResourceAsStream("/code-gen.properties")); - JDBC_URL = prop.getProperty("jdbc_url"); - JDBC_USERNAME = prop.getProperty("jdbc_username"); - JDBC_PASSWORD = prop.getProperty("jdbc_password"); - JDBC_DIVER_CLASS_NAME = prop.getProperty("jdbc_driver_class_name"); - AUTHOR = prop.getProperty("author"); - JAVA_PATH = prop.getProperty("java_path"); - RESOURCES_PATH = prop.getProperty("resources_path"); - BASE_PACKAGE = prop.getProperty("base_package"); - - MODEL_PACKAGE = BASE_PACKAGE + ".model"; - MAPPER_PACKAGE = BASE_PACKAGE + ".mapper"; - REPOSITORY_PACKAGE = BASE_PACKAGE + ".repository"; - SERVICE_PACKAGE = BASE_PACKAGE + ".service"; - SERVICE_IMPL_PACKAGE = BASE_PACKAGE + ".service.impl"; - CONTROLLER_PACKAGE = BASE_PACKAGE + ".controller"; - MAPPER_INTERFACE_REFERENCE = prop.getProperty("mapper_interface_reference"); - - PACKAGE_PATH_REPOSITORY = packageConvertPath(REPOSITORY_PACKAGE); - PACKAGE_PATH_SERVICE = packageConvertPath(SERVICE_PACKAGE); - PACKAGE_PATH_SERVICE_IMPL = packageConvertPath(SERVICE_IMPL_PACKAGE); - PACKAGE_PATH_CONTROLLER = packageConvertPath(CONTROLLER_PACKAGE); - - GEN_MODULES = prop.getProperty("gen_modules"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public CodeGenerator(){ - - } - - /** - * main函数入口,放入表名运行即可生成代码 - * @param args - */ - public static void main(String[] args) { - //genCode("users", "news_info"); - - //genCodeByCustomModelName("输入表名","输入自定义Model名称"); - //genCodeByCustomModelName("t_authorities", "Authority"); - //genCodeByCustomModelName("t_side_menu", "SideMenu"); - //genCodeByCustomModelName("t_side_menu", "SideMenu"); - //genCodeByCustomModelName("t_dict_type_group", "DictTypeGroup"); -// genCodeByCustomModelName("t_news_info","NewsInfo"); -// genCodeByCustomModelName("t_users", "OauthUser"); -// genCodeByCustomModelName("t_veri_code", "VeriCode"); -// genCodeByCustomModelName("t_reset_pwd_info", "ResetPwdInfo"); -// genCodeByCustomModelName("t_qr_code", "QrCode"); -// genCodeByCustomModelName("t_log_login", "LogLogin"); -// genCodeByCustomModelName("t_news_tag", "NewsTag"); - } - - /** - * 通过数据表名称生成代码,Model 名称通过解析数据表名称获得,下划线转大驼峰的形式。 - * 如输入表名称 "t_user_detail" 将生成 TUserDetail、TUserDetailMapper、TUserDetailService ... - * @param tableNames 数据表名称... - */ - public static void genCode(String... tableNames) { - for (String tableName : tableNames) { - genCodeByCustomModelName(tableName, null); - } - } - - public static void genCodeByCustomModelName(String tableName, String modelName, String idType, String genModules, String author) { - if(StringUtils.isNotEmpty(author)){ - AUTHOR = author; - } - - if (StringUtils.isEmpty(genModules)){ - genModules = GEN_MODULES; - } - - if(StringUtils.isEmpty(genModules)){ - genModelAndMapper(tableName, modelName, idType); - genRepository(tableName, modelName, idType); - genService(tableName, modelName, idType); - //genController(tableName, modelName); - }else{ - String[] modules = genModules.toLowerCase().split(","); - - if(Arrays.asList(modules).contains(MODULE_MODEL_AND_MAPPER)){ - genModelAndMapper(tableName, modelName, idType); - } - if(Arrays.asList(modules).contains(MODULE_REPOSITORY)){ - genRepository(tableName, modelName, idType); - } - if(Arrays.asList(modules).contains(MODULE_SERVICE)){ - genService(tableName, modelName, idType); - } - if(Arrays.asList(modules).contains(MODULE_CONTROLLER)){ - genController(tableName, modelName, idType); - } - if(Arrays.asList(modules).contains(MODULE_CONTROLLER_AND_PAGE)){ - genControllerAndPage(tableName, modelName, idType); - } - } - } - - public static void genCodeByCustomModelName(String tableName, String modelName, String idType, String genModules) { - genCodeByCustomModelName(tableName, modelName, idType, genModules, null); - } - - /** - * 通过数据表名称,和自定义的 Model 名称生成代码 - * 如输入表名称 "t_user_detail" 和自定义的 Model 名称 "User" 将生成 User、UserMapper、UserService ... - * @param tableName 数据表名称 - * @param modelName 自定义的 Model 名称 - */ - public static void genCodeByCustomModelName(String tableName, String modelName) { - genCodeByCustomModelName(tableName, modelName, "Long", null); - } - - - private static void genModelAndMapper(String tableName, String modelName, String idType) { - Context context = new Context(ModelType.FLAT); - context.setId("Potato"); - context.setTargetRuntime("MyBatis3Simple"); - context.addProperty(PropertyRegistry.CONTEXT_BEGINNING_DELIMITER, "`"); - context.addProperty(PropertyRegistry.CONTEXT_ENDING_DELIMITER, "`"); - - JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration(); - jdbcConnectionConfiguration.setConnectionURL(JDBC_URL); - jdbcConnectionConfiguration.setUserId(JDBC_USERNAME); - jdbcConnectionConfiguration.setPassword(JDBC_PASSWORD); - jdbcConnectionConfiguration.setDriverClass(JDBC_DIVER_CLASS_NAME); - context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration); - - PluginConfiguration pluginConfiguration = new PluginConfiguration(); - pluginConfiguration.setConfigurationType("tk.mybatis.mapper.generator.MapperPlugin"); - pluginConfiguration.addProperty("mappers", MAPPER_INTERFACE_REFERENCE); - context.addPluginConfiguration(pluginConfiguration); - - //该代码不能满足要求 - JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = new JavaModelGeneratorConfiguration(); - javaModelGeneratorConfiguration.setTargetProject(PROJECT_PATH + JAVA_PATH); - javaModelGeneratorConfiguration.setTargetPackage(MODEL_PACKAGE); - context.setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration); - - SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration = new SqlMapGeneratorConfiguration(); - sqlMapGeneratorConfiguration.setTargetProject(PROJECT_PATH + RESOURCES_PATH); - sqlMapGeneratorConfiguration.setTargetPackage("mapping"); - context.setSqlMapGeneratorConfiguration(sqlMapGeneratorConfiguration); - - JavaClientGeneratorConfiguration javaClientGeneratorConfiguration = new JavaClientGeneratorConfiguration(); - javaClientGeneratorConfiguration.setTargetProject(PROJECT_PATH + JAVA_PATH); - javaClientGeneratorConfiguration.setTargetPackage(MAPPER_PACKAGE); - javaClientGeneratorConfiguration.setConfigurationType("XMLMAPPER"); - context.setJavaClientGeneratorConfiguration(javaClientGeneratorConfiguration); - - TableConfiguration tableConfiguration = new TableConfiguration(context); - tableConfiguration.setTableName(tableName); - if (StringUtils.isNotEmpty(modelName)){ - tableConfiguration.setDomainObjectName(modelName); - } - tableConfiguration.setGeneratedKey(new GeneratedKey("id", "Mysql", true, null)); - - context.addTableConfiguration(tableConfiguration); - - List warnings; - MyBatisGenerator generator; - try { - Configuration config = new Configuration(); - config.addContext(context); - config.validate(); - - boolean overwrite = true; - DefaultShellCallback callback = new DefaultShellCallback(overwrite); - warnings = new ArrayList<>(); - generator = new MyBatisGenerator(config, callback, warnings); - generator.generate(null); - } catch (Exception e) { - throw new RuntimeException("生成Model和Mapper失败", e); - } - - if (generator.getGeneratedJavaFiles().isEmpty() || generator.getGeneratedXmlFiles().isEmpty()) { - throw new RuntimeException("生成Model和Mapper失败:" + warnings); - } - if (StringUtils.isEmpty(modelName)){ - modelName = tableNameConvertUpperCamel(tableName); - } - System.out.println(modelName + ".java 生成成功"); - System.out.println(modelName + "Mapper.java 生成成功"); - System.out.println(modelName + "Mapper.xml 生成成功"); - - FreeMarkerGeneratorUtil.generatorMvcCode( - JDBC_DIVER_CLASS_NAME, - JDBC_URL, - JDBC_USERNAME, - JDBC_PASSWORD, - tableName, - modelName, - MODEL_PACKAGE); - } - - private static void genRepository(String tableName, String modelName, String idType) { - try { - freemarker.template.Configuration cfg = getConfiguration(); - - Map data = new HashMap<>(); - data.put("AUTHOR", AUTHOR); - data.put("CREATE", CREATE); - String modelNameUpperCamel = StringUtils.isEmpty(modelName) ? tableNameConvertUpperCamel(tableName) : modelName; - data.put("modelNameUpperCamel", modelNameUpperCamel); - data.put("modelNameLowerCamel", modelNameConvertLowerCamel(modelNameUpperCamel)); - data.put("basePackage", BASE_PACKAGE); - data.put("idType", idType); - - File file = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_REPOSITORY + modelNameUpperCamel + "Repository.java"); - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - cfg.getTemplate("repository.ftl").process(data, - new FileWriter(file)); - System.out.println(modelNameUpperCamel + "Repository.java 生成成功"); - - } catch (Exception e) { - throw new RuntimeException("生成repository失败", e); - } - } - - private static void genService(String tableName, String modelName, String idType) { - try { - freemarker.template.Configuration cfg = getConfiguration(); - - Map data = new HashMap<>(); - data.put("AUTHOR", AUTHOR); - data.put("CREATE", CREATE); - String modelNameUpperCamel = StringUtils.isEmpty(modelName) ? tableNameConvertUpperCamel(tableName) : modelName; - data.put("modelNameUpperCamel", modelNameUpperCamel); - data.put("modelNameLowerCamel", modelNameConvertLowerCamel(modelNameUpperCamel)); - data.put("basePackage", BASE_PACKAGE); - data.put("idType", idType); - - File file = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_SERVICE + modelNameUpperCamel + "Service.java"); - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - cfg.getTemplate("service.ftl").process(data, - new FileWriter(file)); - System.out.println(modelNameUpperCamel + "Service.java 生成成功"); - - File file1 = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_SERVICE_IMPL + modelNameUpperCamel + "ServiceImpl.java"); - if (!file1.getParentFile().exists()) { - file1.getParentFile().mkdirs(); - } - cfg.getTemplate("service-impl.ftl").process(data, - new FileWriter(file1)); - System.out.println(modelNameUpperCamel + "ServiceImpl.java 生成成功"); - } catch (Exception e) { - throw new RuntimeException("生成Service失败", e); - } - } - - private static void genController(String tableName, String modelName, String idType) { - try { - freemarker.template.Configuration cfg = getConfiguration(); - - Map data = new HashMap<>(); - data.put("AUTHOR", AUTHOR); - data.put("CREATE", CREATE); - String modelNameUpperCamel = StringUtils.isEmpty(modelName) ? tableNameConvertUpperCamel(tableName) : modelName; - data.put("baseRequestMapping", modelNameConvertMappingPath(modelNameUpperCamel)); - data.put("modelNameUpperCamel", modelNameUpperCamel); - data.put("modelNameLowerCamel", modelNameConvertLowerCamel(modelNameUpperCamel)); - data.put("basePackage", BASE_PACKAGE); - data.put("idType", idType); - - File file = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_CONTROLLER + modelNameUpperCamel + "Controller.java"); - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - //cfg.getTemplate("controller-restful.ftl").process(data, new FileWriter(file)); - cfg.getTemplate("controller.ftl").process(data, new FileWriter(file)); - - System.out.println(modelNameUpperCamel + "Controller.java 生成成功"); - } catch (Exception e) { - throw new RuntimeException("生成Controller失败", e); - } - - } - - private static void genControllerAndPage(String tableName, String modelName, String idType){ - PageGeneratorUtil.generatorPage( - JDBC_DIVER_CLASS_NAME, - JDBC_URL, - JDBC_USERNAME, - JDBC_PASSWORD, - tableName, - modelName, - CONTROLLER_PACKAGE); - } - - private static freemarker.template.Configuration getConfiguration() throws IOException { - freemarker.template.Configuration cfg = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_23); - cfg.setDirectoryForTemplateLoading(new File(TEMPLATE_FILE_PATH)); - cfg.setDefaultEncoding("UTF-8"); - cfg.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER); - return cfg; - } - - public static String tableNameConvertLowerCamel(String tableName) { - return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, tableName.toLowerCase()); - } - - private static String tableNameConvertUpperCamel(String tableName) { - return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, tableName.toLowerCase()); - - } - - private static String tableNameConvertMappingPath(String tableName) { - //兼容使用大写的表名 - tableName = tableName.toLowerCase(); - return "/" + (tableName.contains("_") ? tableName.replaceAll("_", "/") : tableName); - } - - private static String modelNameConvertMappingPath(String modelName) { - String tableName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, modelName); - return tableNameConvertMappingPath(tableName); - } - - private static String packageConvertPath(String packageName) { - return String.format("/%s/", packageName.contains(".") ? packageName.replaceAll("\\.", "/") : packageName); - } - - private static String modelNameConvertLowerCamel(String modelName){ - return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, modelName); - } - -} \ No newline at end of file diff --git a/api/src/main/java/com/simon/common/code/Column.java b/api/src/main/java/com/simon/common/code/Column.java deleted file mode 100644 index 978a7c265bd92dbbe87c34a1e80c44af9cdbf332..0000000000000000000000000000000000000000 --- a/api/src/main/java/com/simon/common/code/Column.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.simon.common.code; - -/** - * @author simon - * @create 2018-08-07 - **/ - -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - * 代码生成列实体 - * @author simon - * @date 2018-08-07 - */ -@Data -@EqualsAndHashCode(callSuper = false) -public class Column implements Serializable{ - private static final long serialVersionUID = 8051725962502921942L; - /** - * 属性注解 - */ - private String annotation; - - /** - * 属性名 - */ - private String name; - - /** - * 属性类型 - */ - private String type; - - /** - * 属性注释 - */ - private String comment; -} \ No newline at end of file diff --git a/api/src/main/java/com/simon/common/code/PageGeneratorUtil.java b/api/src/main/java/com/simon/common/code/PageGeneratorUtil.java deleted file mode 100644 index 2e4876495f6ba67543628410d3defe105436cd67..0000000000000000000000000000000000000000 --- a/api/src/main/java/com/simon/common/code/PageGeneratorUtil.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.simon.common.code; - -import com.google.common.base.CaseFormat; -import com.simon.common.utils.DbUtil; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.sql.Connection; -import java.sql.DriverManager; - -/** - * 代码生成器工具类 - * @author simon - * @date 2018-08-07 - **/ -@Slf4j -public class PageGeneratorUtil { - /** - * - * @param driver - * @param url - * @param user - * @param pwd - * @param tableName - * @param modelName - * @param basePackage - */ - public static void generatorPage(String driver, String url, String user, String pwd, String tableName, - String modelName, String basePackage) { - - Connection con = null; - //注册驱动 - try { - Class.forName(driver); - con = DriverManager.getConnection(url, user, pwd); - } catch (Exception e) { - log.error("获取数据连接失败,{}", e.getMessage()); - return; - } - - //获取模板路径 - String templatePath = CodeGenerator.TEMPLATE_FILE_PATH; - //log.info("当前模板路径为:{}", templatePath); - - try { - - String entityDir = null; - //根据实体包名创建目录 - File projectPathFile = new File(CodeGenerator.PROJECT_PATH); - if (!projectPathFile.isDirectory()) { - throw new IOException("Path " + CodeGenerator.PROJECT_PATH + " is not directory!"); - } - File[] ls = projectPathFile.listFiles(); - for (File f: ls) { - String currModule = f.toString(); - boolean matches = currModule.matches("(.*?pojo.*?)|(.*?domain.*?)|(.*?entity.*?)"); - if (f.isDirectory()&&matches){ - entityDir = CodeGenerator.PROJECT_PATH + CodeGenerator.RESOURCES_PATH + "/"; - break; - } - } - if (StringUtils.isBlank(entityDir)){ - entityDir = CodeGenerator.PROJECT_PATH + CodeGenerator.RESOURCES_PATH + "/"; - } - - File entityDirFile = new File(entityDir); - if (!entityDirFile.exists()) { - entityDirFile.mkdirs(); - log.info("创建目录:{} 成功! ",entityDir); - } - EntityDataModel entityModel = DbUtil.getEntityModel(con, tableName, CodeGenerator.BASE_PACKAGE, modelName); - //生成每个表实体 - entityModel.setFileSuffix(".html"); - generateCode(entityModel, templatePath, "list.ftl", entityDir); - entityModel.setFileSuffix(".java"); - generateCode(entityModel, templatePath, "controllerWithPage.ftl", CodeGenerator.PROJECT_PATH + CodeGenerator.JAVA_PATH + "/" + basePackage.replace(".", "/")); - } catch (Exception e) { - log.error("代码生成出错 {}", e.getMessage()); - } - - } - - private static void generateCode(EntityDataModel dataModel, String templatePath, String templateName, String outDir) - throws IOException, TemplateException { - dataModel.setBasePackage(CodeGenerator.BASE_PACKAGE); - dataModel.setModelNameLowerCamel(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dataModel.getEntityName())); - dataModel.setModelNameUpperCamel(dataModel.getEntityName()); - - File outDirFile = new File(outDir); - if(!outDirFile.exists()){ - outDirFile.mkdirs(); - } - - String file; - if(".java".equalsIgnoreCase(dataModel.getFileSuffix())){ - file = outDir + "/" + dataModel.getEntityName() + "Controller" + dataModel.getFileSuffix(); - }else{ - file = outDir + "templates/" + CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dataModel.getEntityName()) + dataModel.getFileSuffix(); - File outDirTemplateFile = new File(outDir + "templates"); - if(!outDirTemplateFile.exists()){ - outDirTemplateFile.mkdirs(); - } - } - - File targetFile = new File(file); - if (targetFile.exists()){ - Files.delete(targetFile.toPath()); - } - //获取模板对象 - Configuration conf = new Configuration(freemarker.template.Configuration.VERSION_2_3_23); - File temp = new File(templatePath); - conf.setDirectoryForTemplateLoading(temp); - Template template = conf.getTemplate(templateName); - Writer writer = new FileWriter(file); - //填充数据模型 - template.process(dataModel, writer); - writer.close(); - log.info("代码生成成功,文件位置:{}",file); - } -} \ No newline at end of file diff --git a/api/src/main/java/com/simon/common/config/AppConfig.java b/api/src/main/java/com/simon/common/config/AppConfig.java deleted file mode 100644 index 5cdca19a50a902285ba67cc35cc65c46cdc9b5e0..0000000000000000000000000000000000000000 --- a/api/src/main/java/com/simon/common/config/AppConfig.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.simon.common.config; - -import org.springframework.context.i18n.LocaleContextHolder; - -import java.io.IOException; -import java.util.Locale; -import java.util.Properties; - -/** - * 字典 - * - * @author simon - * @date 2018-06-01 - **/ -public class AppConfig { - public static final String CODE = "code"; - public static final String MESSAGE = "message"; - public static final String DATA = "data"; - - //private static Locale locale = LocaleContextHolder.getLocale(); - //messages国际化语言指定 - private static Locale locale = LocaleContextHolder.getLocale(); - - public static Locale getLocale(){ - return locale; - } - - public final static int DEFAULT_PAGE_SIZE = 10; - public final static int DEFAULT_PAGE_NO = 1; - - //一级菜单 - public static final Integer MENU_LEVEL_1 = 1; - //二级菜单 - public static final Integer MENU_LEVEL_2 = 2; - - public static final String DATE_PATTERN_DATETIME = "yyyy-MM-dd HH:mm:ss"; - public static final String DATE_PATTERN_DAY = "yyyy-MM-dd"; - public static final String DATE_PATTERN_TIME = "HH:mm:ss"; - public static final String DATE_TIMEZONE = "GMT+8"; - - /** - * 文件上传保存路径 - */ - public static String FILE_UPLOAD_DIR; - - /** - * 文件上传方式,支持local和qiniu - */ - public static String FILE_UPLOAD_TYPE; - public static String FILE_UPLOAD_TYPE_LOCAL = "local"; - public static String FILE_UPLOAD_TYPE_QINIU = "qiniu"; - - public static String SERVER_PORT; - static { - Properties prop = new Properties(); - try { - prop.load(AppConfig.class.getResourceAsStream("/application.properties")); - FILE_UPLOAD_DIR = prop.getProperty("file.upload.dir"); - FILE_UPLOAD_TYPE = prop.getProperty("file.upload.type"); - SERVER_PORT = prop.getProperty("server.port"); - } catch (IOException e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/api/src/main/java/com/simon/common/filter/OrderByFilter.java b/api/src/main/java/com/simon/common/filter/OrderByFilter.java deleted file mode 100644 index ebdd159db6c4881adf73404f49bd05becb9a5c65..0000000000000000000000000000000000000000 --- a/api/src/main/java/com/simon/common/filter/OrderByFilter.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.simon.common.filter; - -import com.simon.common.wrapper.OrderByRequestWrapper; -import org.springframework.stereotype.Component; - -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; - -/** - * OrderBy拦截器(拦截并修改请求中的orderBy参数值) - * - * @author simon - * @date 2018-11-23 - **/ -@Component -public class OrderByFilter implements Filter { - @Override - public void init(FilterConfig filterConfig) throws ServletException { - - } - - @Override - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { - filterChain.doFilter(new OrderByRequestWrapper((HttpServletRequest)servletRequest), servletResponse); - } - - @Override - public void destroy() { - - } -} diff --git a/api/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java b/api/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java index c265f0a8dd9d82c043f558cd5365bda640a591a2..774c7dc25ee23630e07c130423ac4e2e643c5dab 100644 --- a/api/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java +++ b/api/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java @@ -2,6 +2,8 @@ package com.simon.common.plugins.oauth; import com.simon.common.config.AppConfig; import com.simon.common.domain.UserEntity; +import com.simon.common.exception.BusinessException; +import com.simon.common.utils.ValidUtil; import com.simon.model.Authority; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -34,7 +36,9 @@ public class UsernamePasswordAuthenticator extends AbstractPreparableIntegration private Locale locale = AppConfig.getLocale(); - private final String sqlLoadUser; + private final String sqlLoadUserByPhone; + private final String sqlLoadUserByEmail; + private final String sqlLoadUserByName; private final String sqlLoadAuthorities; private final RowMapper myUserDetailsRowMapper; private final RowMapper authorityRowMapper; @@ -42,7 +46,9 @@ public class UsernamePasswordAuthenticator extends AbstractPreparableIntegration private final static String PASSWORD_AUTH_TYPE = "password"; public UsernamePasswordAuthenticator(){ - sqlLoadUser = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where username=? OR phone=? OR email=?"; + sqlLoadUserByPhone = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where phone=?"; + sqlLoadUserByEmail = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where email=?"; + sqlLoadUserByName = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where username=?"; sqlLoadAuthorities = "select user_id,authority from t_authorities where user_id = ?"; myUserDetailsRowMapper = (rs, i) -> new UserEntity(rs.getLong(1), rs.getString(2), rs.getString(3), rs.getBoolean(4), rs.getString("phone"), rs.getString("email"),rs.getString("address"), rs.getDate("birth"), rs.getInt("age"), rs.getString("head_photo"), rs.getString("person_brief"), rs.getBoolean("sex")); @@ -59,7 +65,16 @@ public class UsernamePasswordAuthenticator extends AbstractPreparableIntegration public UserEntity authenticate(IntegrationAuthentication integrationAuthentication) { log.info("password authenticate"); try{ - UserEntity userFromQuery = jdbcTemplate.queryForObject(sqlLoadUser, myUserDetailsRowMapper, integrationAuthentication.getUsername(), integrationAuthentication.getUsername(), integrationAuthentication.getUsername()); + UserEntity userFromQuery = null; + if(ValidUtil.isEmail(integrationAuthentication.getUsername())){ + userFromQuery = jdbcTemplate.queryForObject(sqlLoadUserByEmail, myUserDetailsRowMapper, integrationAuthentication.getUsername()); + }else if(ValidUtil.isMobile(integrationAuthentication.getUsername())){ + userFromQuery = jdbcTemplate.queryForObject(sqlLoadUserByPhone, myUserDetailsRowMapper, integrationAuthentication.getUsername()); + }else{ + //userFromQuery = jdbcTemplate.queryForObject(sqlLoadUserByName, myUserDetailsRowMapper, integrationAuthentication.getUsername()); + throw new BusinessException("不支持的登录方式"); + } + log.info("查询得到用户:{}", userFromQuery); List authorities = jdbcTemplate.query(sqlLoadAuthorities, authorityRowMapper, userFromQuery.getId()); log.info("得到其权限:{}", authorities); diff --git a/api/src/main/java/com/simon/common/utils/DbUtil.java b/api/src/main/java/com/simon/common/utils/DbUtil.java deleted file mode 100644 index e43658125b2f60061398430de98824d0f43c63ba..0000000000000000000000000000000000000000 --- a/api/src/main/java/com/simon/common/utils/DbUtil.java +++ /dev/null @@ -1,369 +0,0 @@ -package com.simon.common.utils; - -import com.alibaba.fastjson.JSON; -import com.google.common.base.CaseFormat; -import com.simon.common.code.*; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; - -import java.sql.*; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -/** - * 数据库工具类 - * - * @author simon - * @date 2018-10-06 - **/ - -@Slf4j -public class DbUtil { - /** - * 获取数据表个数 - * @param driver - * @param url - * @param user - * @param pwd - * @return - * @throws Exception - */ - public static int getTableCount(String driver, String url, String user, String pwd) throws Exception{ - int tableCount = 0; - Connection con = null; - //注册驱动 - try { - Class.forName(driver); - con = DriverManager.getConnection(url, user, pwd); - } catch (ClassNotFoundException | SQLException e) { - log.error("获取数据连接失败,{}", e.getMessage()); - } - int dbType = 0; - try { - dbType = getDataBaseType(con); - } catch (SQLException e) { - e.printStackTrace(); - } - - String sql = ""; - PreparedStatement ps; - ResultSet rs; - - //查询表标注 - if(dbType == DbType.MYSQL){ - sql = "SELECT COUNT(*) FROM information_schema.TABLES WHERE table_schema='" + con.getCatalog() + "'"; - }else if(dbType == DbType.POSTGRESQL){ - sql = "SELECT COUNT(*) FROM pg_class C"; - }else if(dbType == DbType.ORACLE){ - sql = "select COUNT(*) from all_tab_comments"; - }else{ - throw new Exception("暂不支持其他数据库"); - } - ps = con.prepareStatement(sql); - rs = ps.executeQuery(); - - while (rs.next()){ - tableCount = rs.getInt(1); - } - return tableCount; - } - - /** - * 获取表信息 - * @param driver - * @param url - * @param user - * @param pwd - * @return - * @throws Exception - */ - public static List getTables(String driver, String url, String user, String pwd) throws Exception{ - return getTables(driver, url, user, pwd, null, null); - } - - /** - * 根据条件查询表信息 - * @param driver - * @param url - * @param user - * @param pwd - * @param tableNameKey - * @param tableCommentKey - * @return - * @throws Exception - */ - public static List getTables(String driver, String url, String user, String pwd, String tableNameKey, String tableCommentKey) throws Exception{ - List tableInfoList = new ArrayList<>(); - Connection con = null; - //注册驱动 - try { - Class.forName(driver); - con = DriverManager.getConnection(url, user, pwd); - } catch (ClassNotFoundException | SQLException e) { - log.error("获取数据连接失败,{}", e.getMessage()); - } - int dbType = 0; - try { - dbType = getDataBaseType(con); - } catch (SQLException e) { - e.printStackTrace(); - } - - String sql = ""; - PreparedStatement ps; - ResultSet rs; - - //查询表标注 - if(dbType == DbType.MYSQL){ - sql = "SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema.TABLES WHERE table_schema='" + con.getCatalog() + "'"; - }else if(dbType == DbType.POSTGRESQL){ - sql = "SELECT relname AS TABLE_NAME, CAST(obj_description(relfilenode, 'pg_class') AS VARCHAR) AS TABLE_COMMENT FROM pg_class C"; - }else if(dbType == DbType.ORACLE){ - sql = "select TABLE_NAME,COMMENTS from all_tab_comments"; - }else{ - throw new Exception("暂不支持其他数据库"); - } - if(StringUtils.isNotEmpty(tableNameKey)){ - if(sql.contains("WHERE")){ - sql += " AND TABLE_NAME LIKE '%" + tableNameKey + "%'"; - }else{ - sql += " WHERE TABLE_NAME LIKE '%" + tableNameKey + "%'"; - } - } - if(StringUtils.isNotEmpty(tableCommentKey)){ - if(sql.contains("WHERE")){ - sql += " AND TABLE_COMMENT LIKE '%" + tableCommentKey + "%'"; - }else{ - sql += " WHERE TABLE_COMMENT LIKE '%" + tableCommentKey + "%'"; - } - } - ps = con.prepareStatement(sql); - rs = ps.executeQuery(); - while (rs.next()){ - String tableComment = rs.getString("TABLE_COMMENT"); - String tableName = rs.getString("TABLE_NAME"); - String entityName = tableName; - if (entityName.startsWith("t_")){ - entityName = entityName.substring(2); - } - entityName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, entityName.toLowerCase()); - /*if(StringUtils.isEmpty(tableComment)){ - tableComment = tableName; - }else{ - if(tableComment.contains("表")&&tableComment.lastIndexOf("表") == (tableComment.length() - 1)){ - tableComment = tableComment.substring(0, tableComment.length() - 1); - } - }*/ - TableInfo tableInfo = new TableInfo(); - tableInfo.setTableName(tableName); - tableInfo.setTableComment(tableComment); - tableInfo.setEntityName(entityName); - tableInfoList.add(tableInfo); - } - return tableInfoList; - } - - /** - * 获取数据库类型 - * @param connection - * @return - * @throws SQLException - */ - public static int getDataBaseType(Connection connection) throws SQLException { - String driverName = connection.getMetaData().getDriverName().toLowerCase(); - log.info(driverName); - //通过driverName是否包含关键字判断 - if (driverName.contains("mysql")) { - return 1; - } else if (driverName.contains("postgresql")) { - return 2; - }else if(driverName.contains("oracle")){ - return 3; - } - return -1; - } - - /** - * 获取表对应的实体属性,用于代码生成 - * @param con - * @param tableName - * @param basePackage - * @param modelName - * @return - * @throws Exception - */ - public static EntityDataModel getEntityModel(Connection con, String tableName, String basePackage, String modelName) - throws Exception { - int dbType = getDataBaseType(con); - EntityDataModel dataModel = new EntityDataModel(); - - String sql = ""; - PreparedStatement ps; - ResultSet rs; - - //查询表标注 - if(dbType == DbType.MYSQL){ - sql = "SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema.TABLES WHERE table_schema='" + con.getCatalog() + "' AND TABLE_NAME='" + tableName + "'"; - }else if(dbType == DbType.POSTGRESQL){ - sql = "SELECT relname AS TABLE_NAME, CAST(obj_description(relfilenode, 'pg_class') AS VARCHAR) AS TABLE_COMMENT FROM pg_class C WHERE relname = '" + tableName + "'"; - }else if(dbType == DbType.ORACLE){ - sql = "select TABLE_NAME,COMMENTS from all_tab_comments WHERE table_name='" + tableName.toUpperCase() + "'"; - }else{ - throw new Exception("暂不支持其他数据库"); - } - ps = con.prepareStatement(sql); - rs = ps.executeQuery(); - while (rs.next()){ - String tableComment = rs.getString("TABLE_COMMENT"); - if(StringUtils.isEmpty(tableComment)){ - tableComment = tableName; - }else{ - if(tableComment.contains("表")&&tableComment.lastIndexOf("表") == (tableComment.length() - 1)){ - tableComment = tableComment.substring(0, tableComment.length() - 1); - } - } - dataModel.setTableComment(tableComment); - } - - - //查询表属性,格式化生成实体所需属性 - if(dbType == DbType.MYSQL){ - //log.info(con.getCatalog()); - sql = "SELECT table_name, column_name, column_comment, column_type, data_type, column_default, is_nullable " - + "FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE table_name = '" + tableName + "' AND table_schema = '" + con.getCatalog() + "'"; - }else if(dbType == DbType.POSTGRESQL){ - log.info(con.getCatalog()); - sql = "SELECT delta.table_name, delta.column_name, alb.column_comment, alb.column_type, delta.data_type, delta.column_default, delta.is_nullable FROM information_schema.COLUMNS AS delta, ( SELECT C .relname AS table_name, A.attname AS column_name, col_description ( A.attrelid, A.attnum ) AS column_comment, format_type ( A.atttypid, A.atttypmod ) AS column_type, A.attnotnull AS NOTNULL FROM pg_class AS C, pg_attribute AS A WHERE C.relname = '" + tableName + "' AND A.attrelid = C.oid AND A.attnum > 0 ) AS alb WHERE table_schema = 'public' AND delta.TABLE_NAME = '" + tableName + "' AND delta.COLUMN_NAME = alb.column_name"; - }else if(dbType == DbType.ORACLE){ - log.info(con.getCatalog()); - sql = "SELECT\n" + - "atc.table_name,\n" + - "atc.column_name,\n" + - "acc.COMMENTS AS column_comment,\n" + - "atc.data_length AS column_type,\n" + - "atc.data_type AS data_type,\n" + - "atc.data_default AS column_default,\n" + - "atc.NULLABLE AS is_nullable \n" + - "FROM\n" + - "all_tab_columns atc\n" + - "FULL JOIN ( SELECT column_name, COMMENTS FROM all_col_comments WHERE Table_Name = 'USERS' ) acc ON atc.column_name = acc.column_name \n" + - "WHERE\n" + - "atc.table_name = '" + tableName.toUpperCase() + "'"; - }else{ - throw new Exception("暂不支持其他数据库"); - } - - - ps = con.prepareStatement(sql); - rs = ps.executeQuery(); - - List columns = new ArrayList<>(); - while (rs.next()) { - Column col = new Column(); - String name = rs.getString("column_name"); - String columnType = rs.getString("column_type"); - String dataType = rs.getString("data_type"); - String comment = rs.getString("column_comment"); - String isNullable = rs.getString("is_nullable"); - - if(StringUtils.isEmpty(comment)){ - comment = name; - } - - String propertyType = null; - if(dbType == DbType.MYSQL){ - propertyType = TypeTranslator.translateMySQL(columnType, dataType); - }else if(dbType == DbType.POSTGRESQL){ - propertyType = TypeTranslator.translatePostgreSQL(columnType, dataType); - }else if(dbType == DbType.ORACLE){ - propertyType = TypeTranslator.translateOracle(columnType, dataType); - }else{ - throw new Exception("暂不支持其他数据库"); - } - - String annotation = ""; - if ("id".equalsIgnoreCase(name)) { - if ("Long".equalsIgnoreCase(propertyType)) { - annotation = "@Id\n" + - " @Column(name = \"id\")\n" + - " @KeySql(genId = SnowflakeGenId.class)\n" + - " @GeneratedValue(generator = \"sequenceId\")\n" + - " @GenericGenerator(name = \"sequenceId\", strategy = \"" + CodeGenerator.BASE_PACKAGE + ".common.utils.snowflake.SequenceId\")"; - }else if("String".equalsIgnoreCase(propertyType)){ - annotation = "@Id\n" + - " @Column(name = \"id\")\n" + - " @KeySql(genId = UUIdGenId.class)\n" + - " @GeneratedValue(generator = \"uuid\")\n" + - " @GenericGenerator(name = \"uuid\", strategy = \"" + CodeGenerator.BASE_PACKAGE + ".common.utils.UuidGenerator\")"; - }else if("Integer".equalsIgnoreCase(propertyType)){ - annotation = "@Id\n" + - " @Column(name = \"id\")\n" + - " @GeneratedValue(strategy = GenerationType.IDENTITY)"; - }else{ - annotation = "@Id\n" + - " @Column(name = \"id\")\n" + - " @GeneratedValue(strategy = GenerationType.IDENTITY)"; - } - }else{ - if("Date".equalsIgnoreCase(propertyType)){ - annotation = "@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE)\n"; - } - - annotation += " @ApiModelProperty(value = \"" + comment + "\")\n"; - - String charPattern = "char\\(\\d+\\)"; - if(Pattern.matches(charPattern, columnType)){ - //MySQL char(4) - if("NO".equalsIgnoreCase(isNullable)){ - annotation += " @Column(name = \"" + name + "\", nullable = false, columnDefinition =\"" + columnType + "\")"; - }else{ - annotation += " @Column(name = \"" + name + "\", columnDefinition =\"" + columnType + "\")"; - } - }else if("text".equalsIgnoreCase(columnType)){ - //MySQL text - if("No".equalsIgnoreCase(isNullable)){ - annotation += " @Column(name = \"" + name + "\", nullable = false, columnDefinition = \"TEXT\")"; - }else{ - annotation += " @Column(name = \"" + name + "\", columnDefinition = \"TEXT\")"; - } - }else if("longtext".equalsIgnoreCase(columnType)){ - //MySQL text - if("No".equalsIgnoreCase(isNullable)){ - annotation += " @Column(name = \"" + name + "\", nullable = false, columnDefinition = \"LONGTEXT\")"; - }else{ - annotation += " @Column(name = \"" + name + "\", columnDefinition = \"LONGTEXT\")"; - } - }else{ - if("NO".equalsIgnoreCase(isNullable)){ - annotation += " @Column(name = \"" + name + "\", nullable = false)"; - }else{ - annotation += " @Column(name = \"" + name + "\")"; - } - } - } - - col.setName(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name.toLowerCase())); - col.setType(propertyType); - col.setAnnotation(annotation); - col.setComment(comment); - columns.add(col); - } - - dataModel.setBasePackage(basePackage); - //dataModel.setEntityPackage(basePackage); - if (StringUtils.isNotEmpty(modelName)) { - dataModel.setEntityName(modelName); - } else { - dataModel.setEntityName(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, tableName.toLowerCase())); - } - dataModel.setTableName(tableName); - dataModel.setColumns(columns); - return dataModel; - } - - public static void main(String[] args) throws Exception { - log.info(JSON.toJSONString(getTables("com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false", "root", "19941017", null, null))); - log.info("" + getTableCount("com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false", "root", "19941017")); - } -} diff --git a/api/src/main/java/com/simon/controller/AliPayController.java b/api/src/main/java/com/simon/controller/AliPayController.java index e48833d078f8862f1b69a09e04c59c2a4f28d19d..922e747f2ab75c79276f6ab952458f6b34df66c0 100644 --- a/api/src/main/java/com/simon/controller/AliPayController.java +++ b/api/src/main/java/com/simon/controller/AliPayController.java @@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import springfox.documentation.annotations.ApiIgnore; import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletRequest; @@ -182,6 +183,7 @@ public class AliPayController extends BaseController { } } + @ApiIgnore @PermitAll @RequestMapping(value = "notifyUrl", method = RequestMethod.POST) @ResponseBody @@ -275,6 +277,7 @@ public class AliPayController extends BaseController { } } + @ApiIgnore @PermitAll @RequestMapping(value = "returnUrl", method = RequestMethod.GET) @ResponseBody diff --git a/api/src/main/java/com/simon/model/OauthUser.java b/api/src/main/java/com/simon/model/OauthUser.java index a37114097268d6a91ee563d9c0dce39df99eeb7d..b64f62d4f89ce3e76f4dcf0295010fd2cf2d644a 100644 --- a/api/src/main/java/com/simon/model/OauthUser.java +++ b/api/src/main/java/com/simon/model/OauthUser.java @@ -114,4 +114,8 @@ public class OauthUser implements Serializable{ @ApiModelProperty(value = "登录时间") @Column(name = "login_date") private Date loginDate; + + @ApiModelProperty(value = "角色") + @Transient + private String authorities; } \ No newline at end of file diff --git a/api/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java b/api/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java index 020d72b8a2889d4ba5d39a1896a69eae6ef81231..dcb52f8f45ee7dc39b3659ec47d59220341d20ea 100644 --- a/api/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java @@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -110,4 +111,9 @@ public class AccountBindServiceImpl implements AccountBindService { public int updateByPrimaryKeySelective(AccountBind accountBind){ return accountBindMapper.updateByPrimaryKeySelective(accountBind); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } } \ No newline at end of file diff --git a/api/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java b/api/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java index 1a57abec4154cb058db675f4db23266b72a07d90..713678ebc724a6914b84b9605c389809329aae6a 100644 --- a/api/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java @@ -115,6 +115,11 @@ public class AuthorityServiceImpl implements AuthorityService { return authorityMapper.updateByPrimaryKeySelective(authority); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } + @Override public PageInfo getDtoList(Map params, Integer pageNo, Integer pageSize, String orderBy) { if (null == pageSize){ diff --git a/api/src/main/java/com/simon/service/impl/BillServiceImpl.java b/api/src/main/java/com/simon/service/impl/BillServiceImpl.java index b8ba2460739af895c0233093a42c3e5733526913..fe75c2e6c7c2b102badcd0d7b5f88097cc2ddc75 100644 --- a/api/src/main/java/com/simon/service/impl/BillServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/BillServiceImpl.java @@ -117,6 +117,11 @@ public class BillServiceImpl implements BillService { return billMapper.updateByPrimaryKeySelective(bill); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } + @Override public Bill createBill(BillRequest billRequest) { Bill bill = new Bill(); diff --git a/api/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java b/api/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java index 4b24b382e91806796f91f3708e7c54f736afccf0..efe0b70e00f9265e3c7b81be6114ddfa9b3eaeda 100644 --- a/api/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java @@ -118,6 +118,11 @@ public class DictTypeGroupServiceImpl implements DictTypeGroupService { return dictTypeGroupMapper.updateByPrimaryKeySelective(dictTypeGroup); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } + @Override public List getDtos(Integer limit, Integer offset) { List dtoList = new ArrayList<>(); diff --git a/api/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java b/api/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java index 5dd0809076db0f86ecd39f9f6fe53503bc931221..6b3e7dca2625c5046e48327998fd6adfdf907ba7 100644 --- a/api/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -117,6 +118,11 @@ public class DictTypeServiceImpl implements DictTypeService { return dictTypeMapper.updateByPrimaryKeySelective(dictType); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } + @Override public List getTypeByGroupCode(String groupCode) { return dictTypeMapper.getByGroupCode(groupCode); diff --git a/api/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java b/api/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java index 24d732d47e233433903cfb3ae86543136e6c2558..d17fb683b8a761c32975320a9e7eb023980d43f1 100644 --- a/api/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java @@ -16,6 +16,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -109,4 +110,9 @@ public class NewsTagServiceImpl implements NewsTagService { public int updateByPrimaryKeySelective(NewsTag newsTag) { return newsTagMapper.updateByPrimaryKeySelective(newsTag); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } } \ No newline at end of file diff --git a/api/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java b/api/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java index 3a920de869c09fe7042939762bfee1d6c9d3f359..a37fa73045062d921d6f500769f3340cfae4def4 100644 --- a/api/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java @@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -110,4 +111,9 @@ public class NoticeMsgServiceImpl implements NoticeMsgService { public int updateByPrimaryKeySelective(NoticeMsg noticeMsg){ return noticeMsgMapper.updateByPrimaryKeySelective(noticeMsg); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } } \ No newline at end of file diff --git a/api/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java b/api/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java index 9f401b0c65d5e41858952bf83d4859ad1c220a0c..85ee5807a604a0288aaf7a4430bdf3184345f936 100644 --- a/api/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java @@ -8,11 +8,11 @@ import com.simon.common.exception.CodeInvalidException; import com.simon.common.exception.PhoneRegisteredException; import com.simon.common.exception.UserExistsException; import com.simon.common.exception.UserNotValidException; -import com.simon.common.utils.AccountValidatorUtil; import com.simon.common.utils.BeanUtils; -import com.simon.common.utils.RandomUtil; import com.simon.common.utils.UsernameUtil; +import com.simon.common.utils.ValidUtil; import com.simon.dto.StatisticDto; +import com.simon.mapper.AuthorityMapper; import com.simon.mapper.OauthUserMapper; import com.simon.model.Authority; import com.simon.model.OauthUser; @@ -22,7 +22,6 @@ import com.simon.repository.VeriCodeRepository; import com.simon.service.OauthUserService; import lombok.extern.slf4j.Slf4j; import lombok.var; -import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.Cache; @@ -34,6 +33,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -59,6 +59,9 @@ public class OauthUserServiceImpl implements OauthUserService { @Autowired private AuthorityRepository authorityRepository; + @Autowired + private AuthorityMapper authorityMapper; + @Autowired private CacheManager cacheManager; @@ -137,7 +140,27 @@ public class OauthUserServiceImpl implements OauthUserService { @Override public OauthUser save(OauthUser oauthUser) { - return oauthUserRepository.save(oauthUser); + oauthUser.setPassword(passwordEncoder.encode(oauthUser.getPassword())); + oauthUserMapper.insertSelective(oauthUser); + + if(StringUtils.isEmpty(oauthUser.getAuthorities())){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(AppConfig.ROLE_USER); + authorityMapper.insertSelective(authority); + }else{ + String[] authorities = oauthUser.getAuthorities().split(","); + List authorityList = new ArrayList<>(); + for(int i = 0; i < authorities.length; i++){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(authorities[i]); + authorityList.add(authority); + } + authorityMapper.insertList(authorityList); + } + + return oauthUser; } @Override @@ -201,13 +224,32 @@ public class OauthUserServiceImpl implements OauthUserService { } @Override - public int insert(OauthUser model) { - return oauthUserMapper.insert(model); + public int insert(OauthUser oauthUser) { + return insertSelective(oauthUser); } @Override - public int insertSelective(OauthUser model) { - return oauthUserMapper.insertSelective(model); + public int insertSelective(OauthUser oauthUser) { + oauthUser.setPassword(passwordEncoder.encode(oauthUser.getPassword())); + int result = oauthUserMapper.insertSelective(oauthUser); + + if(StringUtils.isEmpty(oauthUser.getAuthorities())){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(AppConfig.ROLE_USER); + authorityMapper.insertSelective(authority); + }else{ + String[] authorities = oauthUser.getAuthorities().split(","); + List authorityList = new ArrayList<>(); + for(int i = 0; i < authorities.length; i++){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(authorities[i]); + authorityList.add(authority); + } + authorityMapper.insertList(authorityList); + } + return result; } //@CachePut(key="#model.username", cacheNames = {"oauthUserCache"}) @@ -314,10 +356,10 @@ public class OauthUserServiceImpl implements OauthUserService { @Override public OauthUser registerByAccountAndPwd(String account, String password) { - if(AccountValidatorUtil.isMobile(account)){ + if(ValidUtil.isMobile(account)){ //account是手机号 - }else if(AccountValidatorUtil.isEmail(account)){ + }else if(ValidUtil.isEmail(account)){ //account是邮箱 }else{ diff --git a/api/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java b/api/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java index 8f65023838b0f381ac4c5b66d845c9c579032608..c79a16737b57a78cbfc60283361e330fe7034390 100644 --- a/api/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java @@ -16,6 +16,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -109,4 +110,9 @@ public class ResetPwdInfoServiceImpl implements ResetPwdInfoService { public int updateByPrimaryKeySelective(ResetPwdInfo resetPwdInfo) { return resetPwdInfoMapper.updateByPrimaryKeySelective(resetPwdInfo); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } } \ No newline at end of file diff --git a/api/src/main/java/com/simon/service/impl/SmsServiceImpl.java b/api/src/main/java/com/simon/service/impl/SmsServiceImpl.java index 51b33be577a6dfa8107671665aceebbb78d98e1e..9aaea2f48dc8b3b31822e71e479ee20fc91cb3fb 100644 --- a/api/src/main/java/com/simon/service/impl/SmsServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/SmsServiceImpl.java @@ -2,6 +2,7 @@ package com.simon.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.simon.common.config.AppConfig; import com.simon.common.utils.SmsUtil; import com.simon.service.SmsService; import lombok.extern.slf4j.Slf4j; @@ -33,8 +34,8 @@ public class SmsServiceImpl implements SmsService { @Value("${sms.password}") private String password; - @Value("${sms.identity-code-msg-template}") - private String identityCodeMsgTemplate; + //@Value("${sms.identity-code-msg-template}") + private String identityCodeMsgTemplate = AppConfig.SMS_TEMPLATE; @Autowired private org.springframework.cache.CacheManager cacheManager; @@ -70,10 +71,11 @@ public class SmsServiceImpl implements SmsService { @Override public boolean checkCode(String mobile, String code) { + log.info("checkCode"); var cache = cacheManager.getCache("smsCache"); var ele = cache.get(mobile); String output = (ele == null ? null : ele.get().toString()); - log.info(mobile + "," + output); + log.info("从缓存中读到" + mobile + "," + output); var result = false; @@ -84,6 +86,9 @@ public class SmsServiceImpl implements SmsService { } } + //删除缓存 + cache.evict(mobile); + return result; } } diff --git a/api/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java b/api/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java index 41e71c727bd977d00c7700e150ab820e54184e7d..fa40bb04b360fa775886a912ff891fe03aaf465c 100644 --- a/api/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java +++ b/api/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; /** * 验证码 @@ -112,6 +113,11 @@ public class VeriCodeServiceImpl implements VeriCodeService { return veriCodeMapper.updateByPrimaryKeySelective(veriCode); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + return null; + } + @Override public VeriCode findByPhone(String phone) { return veriCodeRepository.findByPhone(phone); diff --git a/api/src/main/resources/ehcache.xml b/api/src/main/resources/ehcache.xml index cad5d1a1abf76d8b52ffa1b2030844a2e30d659a..7b97cd4d955e36c09dbd6b1147240766e19cdf58 100644 --- a/api/src/main/resources/ehcache.xml +++ b/api/src/main/resources/ehcache.xml @@ -2,6 +2,24 @@ + + + + @@ -23,10 +41,12 @@ overflowToDisk="true" memoryStoreEvictionPolicy="LRU" /> - + diff --git a/api/src/main/resources/templates/code/controllerWithPage.ftl b/api/src/main/resources/templates/code/controllerWithPage.ftl index 199ee82c23b029b5fba06326f8b8df7c063a2261..07153f4c939b0365d5d389c22a339d9717c8cb58 100644 --- a/api/src/main/resources/templates/code/controllerWithPage.ftl +++ b/api/src/main/resources/templates/code/controllerWithPage.ftl @@ -6,8 +6,10 @@ import ${basePackage}.service.${modelNameUpperCamel}Service; import ${basePackage}.repository.${modelNameUpperCamel}Repository; import ${basePackage}.common.domain.ResultMsg; +import ${basePackage}.common.domain.EasyUIDataGridResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; @@ -15,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -31,53 +34,41 @@ import java.util.HashMap; import java.util.LinkedHashMap; /** +* ${tableComment} +* * @author ${AUTHOR} * @date ${CREATE} **/ - @Slf4j -@Api(value = "${tableComment}", description = "${tableComment}", tags = "${entityName?uncap_first}Api") +@Api(description = "${tableComment}") @Controller -@RequestMapping("${entityName?uncap_first}s") +@RequestMapping("/api/${entityName?uncap_first}s") public class ${entityName}Controller extends BaseController{ @Autowired private ${entityName}Service ${entityName?uncap_first}Service; - @GetMapping("data") - @ResponseBody - public Map list( - @RequestParam(required = false, defaultValue = "10") Integer limit, - @RequestParam(required = false, defaultValue = "0") Integer offset){ - Map resultMap = new LinkedHashMap<>(2); - resultMap.put("total", ${entityName?uncap_first}Service.count()); - resultMap.put("rows", ${entityName?uncap_first}Service.findAll(new PageRequest(offset/limit, limit, Sort.Direction.DESC, "id")).getContent()); - return resultMap; - } - - @GetMapping("list") - public String getList(){ - return "${modelNameLowerCamel}"; - } - - @DeleteMapping("/id/{id}") + @ApiOperation(value = "新增") + @PostMapping @ResponseBody - public ResultMsg deleteById(@PathVariable Long id){ - ${entityName?uncap_first}Service.delete(id); + public ResultMsg add(@RequestBody ${entityName} body){ + ${entityName?uncap_first}Service.save(body); return ResultMsg.success(); } + @ApiOperation(value = "修改") @PatchMapping @ResponseBody - public ResultMsg updateById(@RequestBody ${entityName} body){ + public ResultMsg update(@RequestBody ${entityName} body){ ${entityName?uncap_first}Service.updateByPrimaryKeySelective(body); return ResultMsg.success(); } - @PostMapping + @ApiOperation(value = "删除") + @DeleteMapping("/id/{ids}") @ResponseBody - public ResultMsg add(@RequestBody ${entityName} body){ - ${entityName?uncap_first}Service.save(body); + public ResultMsg delete(@PathVariable String ids){ + ${entityName?uncap_first}Service.deleteByIds(ids); return ResultMsg.success(); } } \ No newline at end of file diff --git a/api/src/main/resources/templates/code/list.ftl b/api/src/main/resources/templates/code/list.ftl index 06a6e724d6d7e5d9156301926f54319b65bfd3fb..d5053d9d217a70a2ca62edd726660935e7f0f5d6 100644 --- a/api/src/main/resources/templates/code/list.ftl +++ b/api/src/main/resources/templates/code/list.ftl @@ -1,56 +1,85 @@ - - - - - - - ${tableComment} - - - - - - - - - +
- - - + <#list columns as column> + <#if column.allowSearch> + <#switch column.easyuiType> + <#case "easyui-textbox"> + ${column.comment}: + <#break> + <#case "t:dict"> + ${column.comment}: + <#break> + <#default> + ${column.comment}: + + + + +
- - - + + +
- +
- <#list columns as column> - - + <#list columns as column> + +
${(column.annotation)}${(column.comment)}
-
+
+
- + <#list columns as column> + <#switch column.easyuiType> + <#case "easyui-textbox"> +
+ +
+ <#break> + <#case "image"> +
+ +
+
+
+ <#break> + <#case "rich_text"> + +
+
+ <#break> + <#case "t:select"> +
+ +
+ <#break> + <#case "t:dict"> +
+ +
+ <#break> + <#default> +
+ +
+ +
- - + +
@@ -59,29 +88,68 @@
- - + +
- - - - - - \ No newline at end of file diff --git a/api/src/main/resources/templates/code/mapper.ftl b/api/src/main/resources/templates/code/mapper.ftl index 3c345d3555c625fa506e46e00c653350f1cc1dad..39b615d9cfd799bb61b5e07b31e619af4a9a8262 100644 --- a/api/src/main/resources/templates/code/mapper.ftl +++ b/api/src/main/resources/templates/code/mapper.ftl @@ -1,15 +1,22 @@ package ${basePackage}.mapper; import ${basePackage}.common.mapper.MyMapper; -import ${basePackage}.model.DictTypeGroup; +import ${basePackage}.model.${modelNameUpperCamel}; +import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * ${modelNameUpperCamel} * @author ${AUTHOR} * @date ${CREATE} **/ -public interface DictTypeGroupMapper extends MyMapper<${modelNameUpperCamel}> { - +public interface ${modelNameUpperCamel}Mapper extends MyMapper<${modelNameUpperCamel}> { + /** + * 使用Map查询 + * @param map map查询条件 + * @return 查询结果 + */ + List<${modelNameUpperCamel}> getList(@Param("map") Map map); } \ No newline at end of file diff --git a/api/src/main/resources/templates/code/service-impl.ftl b/api/src/main/resources/templates/code/service-impl.ftl index 3659930066fd49cae7ae46f45ef1fef8b0610ada..8452993b64fb098d7835b1b18d3262ecfbd01f06 100644 --- a/api/src/main/resources/templates/code/service-impl.ftl +++ b/api/src/main/resources/templates/code/service-impl.ftl @@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * @author ${AUTHOR} @@ -113,4 +114,19 @@ public class ${modelNameUpperCamel}ServiceImpl implements ${modelNameUpperCamel} public int updateByPrimaryKeySelective(${modelNameUpperCamel} ${modelNameLowerCamel}){ return ${modelNameLowerCamel}Mapper.updateByPrimaryKeySelective(${modelNameLowerCamel}); } + + @Override + public PageInfo<${modelNameUpperCamel}> getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + List<${modelNameUpperCamel}> list = ${modelNameLowerCamel}Mapper.getList(params); + return new PageInfo<>(list); + } } \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1dee5a885380f488521d06dc47a2fbc1e4bb75f9 --- /dev/null +++ b/common/pom.xml @@ -0,0 +1,139 @@ + + + 4.0.0 + + com.simon + oauthserver + 1.3.0 + ../pom.xml + + + com.simon + common + 1.3.0 + jar + + common + Common Module + + + + org.springframework.boot + spring-boot-starter-aop + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.cloud + spring-cloud-starter-oauth2 + + + org.springframework.cloud + spring-cloud-starter-security + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.projectlombok + lombok + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + org.mybatis.generator + mybatis-generator-maven-plugin + + + org.mybatis.generator + mybatis-generator-core + + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + tk.mybatis + mapper-spring-boot-starter + + + + tk.mybatis + mapper-generator + + + + org.freemarker + freemarker + + + + + com.google.code.gson + gson + + + com.alibaba + fastjson + + + + commons-io + commons-io + + + org.apache.commons + commons-lang3 + + + commons-codec + commons-codec + + + + com.google.guava + guava + + + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-swagger-ui + + + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/api/src/main/java/com/simon/common/annotation/CurrentUser.java b/common/src/main/java/com/simon/common/annotation/CurrentUser.java similarity index 100% rename from api/src/main/java/com/simon/common/annotation/CurrentUser.java rename to common/src/main/java/com/simon/common/annotation/CurrentUser.java diff --git a/api/src/main/java/com/simon/common/annotation/IgnoreSecurity.java b/common/src/main/java/com/simon/common/annotation/IgnoreSecurity.java similarity index 100% rename from api/src/main/java/com/simon/common/annotation/IgnoreSecurity.java rename to common/src/main/java/com/simon/common/annotation/IgnoreSecurity.java diff --git a/web/src/main/java/com/simon/common/code/CodeGenerator.java b/common/src/main/java/com/simon/common/code/CodeGenerator.java similarity index 92% rename from web/src/main/java/com/simon/common/code/CodeGenerator.java rename to common/src/main/java/com/simon/common/code/CodeGenerator.java index e31d540d516a48af55571a2a8bd9b2742f35e045..c114af15e0f1e16031ae8549af508b730286c3d1 100644 --- a/web/src/main/java/com/simon/common/code/CodeGenerator.java +++ b/common/src/main/java/com/simon/common/code/CodeGenerator.java @@ -90,6 +90,14 @@ public class CodeGenerator { */ static String RESOURCES_PATH; + /** + * 生成的mapper存放路径 + */ + private static String PACKAGE_PATH_MAPPER; + + /** + * 生成的JPA Repository存放路径 + */ private static String PACKAGE_PATH_REPOSITORY; /** @@ -153,6 +161,7 @@ public class CodeGenerator { CONTROLLER_PACKAGE = BASE_PACKAGE + ".controller"; MAPPER_INTERFACE_REFERENCE = prop.getProperty("mapper_interface_reference"); + PACKAGE_PATH_MAPPER = packageConvertPath(MAPPER_PACKAGE); PACKAGE_PATH_REPOSITORY = packageConvertPath(REPOSITORY_PACKAGE); PACKAGE_PATH_SERVICE = packageConvertPath(SERVICE_PACKAGE); PACKAGE_PATH_SERVICE_IMPL = packageConvertPath(SERVICE_IMPL_PACKAGE); @@ -337,6 +346,40 @@ public class CodeGenerator { tableName, modelName, MODEL_PACKAGE); + + reGenMapper(tableName, modelName, idType); + } + + /** + * 使用模板重新生成mapper.java + * @param tableName + * @param modelName + * @param idType + */ + private static void reGenMapper(String tableName, String modelName, String idType) { + try { + freemarker.template.Configuration cfg = getConfiguration(); + + Map data = new HashMap<>(); + data.put("AUTHOR", AUTHOR); + data.put("CREATE", CREATE); + String modelNameUpperCamel = StringUtils.isEmpty(modelName) ? tableNameConvertUpperCamel(tableName) : modelName; + data.put("modelNameUpperCamel", modelNameUpperCamel); + data.put("modelNameLowerCamel", modelNameConvertLowerCamel(modelNameUpperCamel)); + data.put("basePackage", BASE_PACKAGE); + data.put("idType", idType); + + File file = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_MAPPER + modelNameUpperCamel + "Mapper.java"); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + cfg.getTemplate("mapper.ftl").process(data, + new FileWriter(file)); + System.out.println(modelNameUpperCamel + "Mapper.java 重新生成成功"); + + } catch (Exception e) { + throw new RuntimeException("生成Mapper失败", e); + } } private static void genRepository(String tableName, String modelName, String idType) { diff --git a/web/src/main/java/com/simon/common/code/Column.java b/common/src/main/java/com/simon/common/code/Column.java similarity index 100% rename from web/src/main/java/com/simon/common/code/Column.java rename to common/src/main/java/com/simon/common/code/Column.java diff --git a/api/src/main/java/com/simon/common/code/DbType.java b/common/src/main/java/com/simon/common/code/DbType.java similarity index 100% rename from api/src/main/java/com/simon/common/code/DbType.java rename to common/src/main/java/com/simon/common/code/DbType.java diff --git a/api/src/main/java/com/simon/common/code/EntityDataModel.java b/common/src/main/java/com/simon/common/code/EntityDataModel.java similarity index 100% rename from api/src/main/java/com/simon/common/code/EntityDataModel.java rename to common/src/main/java/com/simon/common/code/EntityDataModel.java diff --git a/api/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java b/common/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java rename to common/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java diff --git a/web/src/main/java/com/simon/common/code/PageGeneratorUtil.java b/common/src/main/java/com/simon/common/code/PageGeneratorUtil.java similarity index 100% rename from web/src/main/java/com/simon/common/code/PageGeneratorUtil.java rename to common/src/main/java/com/simon/common/code/PageGeneratorUtil.java diff --git a/api/src/main/java/com/simon/common/code/TableInfo.java b/common/src/main/java/com/simon/common/code/TableInfo.java similarity index 100% rename from api/src/main/java/com/simon/common/code/TableInfo.java rename to common/src/main/java/com/simon/common/code/TableInfo.java diff --git a/api/src/main/java/com/simon/common/code/TypeTranslator.java b/common/src/main/java/com/simon/common/code/TypeTranslator.java similarity index 100% rename from api/src/main/java/com/simon/common/code/TypeTranslator.java rename to common/src/main/java/com/simon/common/code/TypeTranslator.java diff --git a/web/src/main/java/com/simon/common/config/AppConfig.java b/common/src/main/java/com/simon/common/config/AppConfig.java similarity index 86% rename from web/src/main/java/com/simon/common/config/AppConfig.java rename to common/src/main/java/com/simon/common/config/AppConfig.java index 5cdca19a50a902285ba67cc35cc65c46cdc9b5e0..a6be396202160a48043ea7a7c902352e198b87a3 100644 --- a/web/src/main/java/com/simon/common/config/AppConfig.java +++ b/common/src/main/java/com/simon/common/config/AppConfig.java @@ -50,6 +50,12 @@ public class AppConfig { public static String FILE_UPLOAD_TYPE_LOCAL = "local"; public static String FILE_UPLOAD_TYPE_QINIU = "qiniu"; + public static String SMS_TEMPLATE = "【thymelte】您的验证码是:%s,在5分钟内有效。如非本人操作请忽略本短信。"; + + public static final String ROLE_USER = "ROLE_USER"; + public static final String ROLE_ADMIN = "ROLE_ADMIN"; + public static final String ROLE_SU = "ROLE_SU"; + public static String SERVER_PORT; static { Properties prop = new Properties(); diff --git a/api/src/main/java/com/simon/common/controller/BaseController.java b/common/src/main/java/com/simon/common/controller/BaseController.java similarity index 100% rename from api/src/main/java/com/simon/common/controller/BaseController.java rename to common/src/main/java/com/simon/common/controller/BaseController.java diff --git a/api/src/main/java/com/simon/common/domain/BillStatus.java b/common/src/main/java/com/simon/common/domain/BillStatus.java similarity index 100% rename from api/src/main/java/com/simon/common/domain/BillStatus.java rename to common/src/main/java/com/simon/common/domain/BillStatus.java diff --git a/api/src/main/java/com/simon/common/domain/EasyUIDataGridResult.java b/common/src/main/java/com/simon/common/domain/EasyUIDataGridResult.java similarity index 100% rename from api/src/main/java/com/simon/common/domain/EasyUIDataGridResult.java rename to common/src/main/java/com/simon/common/domain/EasyUIDataGridResult.java diff --git a/api/src/main/java/com/simon/common/domain/PaymentType.java b/common/src/main/java/com/simon/common/domain/PaymentType.java similarity index 100% rename from api/src/main/java/com/simon/common/domain/PaymentType.java rename to common/src/main/java/com/simon/common/domain/PaymentType.java diff --git a/api/src/main/java/com/simon/common/domain/ResultCode.java b/common/src/main/java/com/simon/common/domain/ResultCode.java similarity index 100% rename from api/src/main/java/com/simon/common/domain/ResultCode.java rename to common/src/main/java/com/simon/common/domain/ResultCode.java diff --git a/api/src/main/java/com/simon/common/domain/ResultMsg.java b/common/src/main/java/com/simon/common/domain/ResultMsg.java similarity index 100% rename from api/src/main/java/com/simon/common/domain/ResultMsg.java rename to common/src/main/java/com/simon/common/domain/ResultMsg.java diff --git a/web/src/main/java/com/simon/common/exception/PhoneRegisteredException.java b/common/src/main/java/com/simon/common/exception/BusinessException.java similarity index 30% rename from web/src/main/java/com/simon/common/exception/PhoneRegisteredException.java rename to common/src/main/java/com/simon/common/exception/BusinessException.java index bfb4d5bfa3a5090ab1db92ba9293df916799c266..e814ee5bbd6cdc887fc0b5d3b4f0de3d5d7fc150 100644 --- a/web/src/main/java/com/simon/common/exception/PhoneRegisteredException.java +++ b/common/src/main/java/com/simon/common/exception/BusinessException.java @@ -1,17 +1,19 @@ package com.simon.common.exception; /** - * 手机号已注册 + * 业务异常 * * @author simon - * @create 2018-07-31 15:31 + * @date 2018-12-20 **/ -public class PhoneRegisteredException extends RuntimeException { - public PhoneRegisteredException() { +public class BusinessException extends RuntimeException { + private static final long serialVersionUID = -1004796665465965612L; + + public BusinessException() { } - public PhoneRegisteredException(String message) { + public BusinessException(String message) { super(message); } } diff --git a/api/src/main/java/com/simon/common/exception/CodeInvalidException.java b/common/src/main/java/com/simon/common/exception/CodeInvalidException.java similarity index 100% rename from api/src/main/java/com/simon/common/exception/CodeInvalidException.java rename to common/src/main/java/com/simon/common/exception/CodeInvalidException.java diff --git a/api/src/main/java/com/simon/common/exception/CustomOauthException.java b/common/src/main/java/com/simon/common/exception/CustomOauthException.java similarity index 100% rename from api/src/main/java/com/simon/common/exception/CustomOauthException.java rename to common/src/main/java/com/simon/common/exception/CustomOauthException.java diff --git a/api/src/main/java/com/simon/common/exception/CustomOauthExceptionSerializer.java b/common/src/main/java/com/simon/common/exception/CustomOauthExceptionSerializer.java similarity index 100% rename from api/src/main/java/com/simon/common/exception/CustomOauthExceptionSerializer.java rename to common/src/main/java/com/simon/common/exception/CustomOauthExceptionSerializer.java diff --git a/api/src/main/java/com/simon/common/exception/PhoneRegisteredException.java b/common/src/main/java/com/simon/common/exception/PhoneRegisteredException.java similarity index 100% rename from api/src/main/java/com/simon/common/exception/PhoneRegisteredException.java rename to common/src/main/java/com/simon/common/exception/PhoneRegisteredException.java diff --git a/api/src/main/java/com/simon/common/exception/RegisterException.java b/common/src/main/java/com/simon/common/exception/RegisterException.java similarity index 100% rename from api/src/main/java/com/simon/common/exception/RegisterException.java rename to common/src/main/java/com/simon/common/exception/RegisterException.java diff --git a/api/src/main/java/com/simon/common/exception/UserExistsException.java b/common/src/main/java/com/simon/common/exception/UserExistsException.java similarity index 100% rename from api/src/main/java/com/simon/common/exception/UserExistsException.java rename to common/src/main/java/com/simon/common/exception/UserExistsException.java diff --git a/api/src/main/java/com/simon/common/exception/UserNotValidException.java b/common/src/main/java/com/simon/common/exception/UserNotValidException.java similarity index 100% rename from api/src/main/java/com/simon/common/exception/UserNotValidException.java rename to common/src/main/java/com/simon/common/exception/UserNotValidException.java diff --git a/api/src/main/java/com/simon/common/mapper/MyMapper.java b/common/src/main/java/com/simon/common/mapper/MyMapper.java similarity index 100% rename from api/src/main/java/com/simon/common/mapper/MyMapper.java rename to common/src/main/java/com/simon/common/mapper/MyMapper.java diff --git a/api/src/main/java/com/simon/common/service/BasicService.java b/common/src/main/java/com/simon/common/service/BasicService.java similarity index 88% rename from api/src/main/java/com/simon/common/service/BasicService.java rename to common/src/main/java/com/simon/common/service/BasicService.java index 005446e0e9d89eb88b7e74308a49d0fd6cc3419e..fd115e1c72d21cdc97a2179c1bc7d78fe85dcc65 100644 --- a/api/src/main/java/com/simon/common/service/BasicService.java +++ b/common/src/main/java/com/simon/common/service/BasicService.java @@ -5,6 +5,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import java.util.List; +import java.util.Map; /** * Basic Service @@ -110,4 +111,14 @@ public interface BasicService { * @return 影响的记录条数 */ int updateByPrimaryKeySelective(T model); + + /** + * 通用查询 + * @param params 参数 + * @param pageNo 页码 + * @param pageSize 每页条数 + * @param orderBy 排序 + * @return 分页数据 + */ + PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy); } \ No newline at end of file diff --git a/api/src/main/java/com/simon/common/utils/BeanUtils.java b/common/src/main/java/com/simon/common/utils/BeanUtils.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/BeanUtils.java rename to common/src/main/java/com/simon/common/utils/BeanUtils.java diff --git a/api/src/main/java/com/simon/common/utils/CodeUtil.java b/common/src/main/java/com/simon/common/utils/CodeUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/CodeUtil.java rename to common/src/main/java/com/simon/common/utils/CodeUtil.java diff --git a/api/src/main/java/com/simon/common/utils/DateUtil.java b/common/src/main/java/com/simon/common/utils/DateUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/DateUtil.java rename to common/src/main/java/com/simon/common/utils/DateUtil.java diff --git a/web/src/main/java/com/simon/common/utils/DbUtil.java b/common/src/main/java/com/simon/common/utils/DbUtil.java similarity index 98% rename from web/src/main/java/com/simon/common/utils/DbUtil.java rename to common/src/main/java/com/simon/common/utils/DbUtil.java index 252774dfe4802a1254c5f762f0c68e4ae2aaa7ca..9bb6f5851cfb354a0d5d79803f3f0c01a28fba09 100644 --- a/web/src/main/java/com/simon/common/utils/DbUtil.java +++ b/common/src/main/java/com/simon/common/utils/DbUtil.java @@ -330,7 +330,11 @@ public class DbUtil { annotation = "@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE)\n"; } - annotation += " @ApiModelProperty(value = \"" + comment + "\")\n"; + if(!"".equals(annotation)){ + annotation += " "; + } + + annotation += "@ApiModelProperty(value = \"" + comment + "\")\n"; String charPattern = "char\\(\\d+\\)"; if(Pattern.matches(charPattern, columnType)){ diff --git a/api/src/main/java/com/simon/common/utils/FileUploadUtil.java b/common/src/main/java/com/simon/common/utils/FileUploadUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/FileUploadUtil.java rename to common/src/main/java/com/simon/common/utils/FileUploadUtil.java diff --git a/api/src/main/java/com/simon/common/utils/IpUtil.java b/common/src/main/java/com/simon/common/utils/IpUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/IpUtil.java rename to common/src/main/java/com/simon/common/utils/IpUtil.java diff --git a/api/src/main/java/com/simon/common/utils/MD5Util.java b/common/src/main/java/com/simon/common/utils/MD5Util.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/MD5Util.java rename to common/src/main/java/com/simon/common/utils/MD5Util.java diff --git a/api/src/main/java/com/simon/common/utils/RandomUtil.java b/common/src/main/java/com/simon/common/utils/RandomUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/RandomUtil.java rename to common/src/main/java/com/simon/common/utils/RandomUtil.java diff --git a/api/src/main/java/com/simon/common/utils/SmsUtil.java b/common/src/main/java/com/simon/common/utils/SmsUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/SmsUtil.java rename to common/src/main/java/com/simon/common/utils/SmsUtil.java diff --git a/api/src/main/java/com/simon/common/utils/SnowflakeGenId.java b/common/src/main/java/com/simon/common/utils/SnowflakeGenId.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/SnowflakeGenId.java rename to common/src/main/java/com/simon/common/utils/SnowflakeGenId.java diff --git a/api/src/main/java/com/simon/common/utils/SpringUtils.java b/common/src/main/java/com/simon/common/utils/SpringUtils.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/SpringUtils.java rename to common/src/main/java/com/simon/common/utils/SpringUtils.java diff --git a/api/src/main/java/com/simon/common/utils/UUIdGenId.java b/common/src/main/java/com/simon/common/utils/UUIdGenId.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/UUIdGenId.java rename to common/src/main/java/com/simon/common/utils/UUIdGenId.java diff --git a/api/src/main/java/com/simon/common/utils/UsernameUtil.java b/common/src/main/java/com/simon/common/utils/UsernameUtil.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/UsernameUtil.java rename to common/src/main/java/com/simon/common/utils/UsernameUtil.java diff --git a/api/src/main/java/com/simon/common/utils/UuidGenerator.java b/common/src/main/java/com/simon/common/utils/UuidGenerator.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/UuidGenerator.java rename to common/src/main/java/com/simon/common/utils/UuidGenerator.java diff --git a/api/src/main/java/com/simon/common/utils/UuidUtils.java b/common/src/main/java/com/simon/common/utils/UuidUtils.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/UuidUtils.java rename to common/src/main/java/com/simon/common/utils/UuidUtils.java diff --git a/api/src/main/java/com/simon/common/utils/AccountValidatorUtil.java b/common/src/main/java/com/simon/common/utils/ValidUtil.java similarity index 98% rename from api/src/main/java/com/simon/common/utils/AccountValidatorUtil.java rename to common/src/main/java/com/simon/common/utils/ValidUtil.java index 17b7fadda1b911a351eeb71250a13a4e7761315d..e50aa72433485ae3e787b976c0362d4b1f452b1e 100644 --- a/api/src/main/java/com/simon/common/utils/AccountValidatorUtil.java +++ b/common/src/main/java/com/simon/common/utils/ValidUtil.java @@ -9,7 +9,7 @@ import java.util.regex.Pattern; * @date 2018-12-07 **/ -public class AccountValidatorUtil { +public class ValidUtil { /** * 正则表达式:验证用户名 */ diff --git a/api/src/main/java/com/simon/common/utils/snowflake/Sequence.java b/common/src/main/java/com/simon/common/utils/snowflake/Sequence.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/snowflake/Sequence.java rename to common/src/main/java/com/simon/common/utils/snowflake/Sequence.java diff --git a/api/src/main/java/com/simon/common/utils/snowflake/SequenceId.java b/common/src/main/java/com/simon/common/utils/snowflake/SequenceId.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/snowflake/SequenceId.java rename to common/src/main/java/com/simon/common/utils/snowflake/SequenceId.java diff --git a/api/src/main/java/com/simon/common/utils/snowflake/SnowFlake.java b/common/src/main/java/com/simon/common/utils/snowflake/SnowFlake.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/snowflake/SnowFlake.java rename to common/src/main/java/com/simon/common/utils/snowflake/SnowFlake.java diff --git a/api/src/main/java/com/simon/common/utils/snowflake/SnowFlakeId.java b/common/src/main/java/com/simon/common/utils/snowflake/SnowFlakeId.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/snowflake/SnowFlakeId.java rename to common/src/main/java/com/simon/common/utils/snowflake/SnowFlakeId.java diff --git a/api/src/main/java/com/simon/common/utils/snowflake/SystemClock.java b/common/src/main/java/com/simon/common/utils/snowflake/SystemClock.java similarity index 100% rename from api/src/main/java/com/simon/common/utils/snowflake/SystemClock.java rename to common/src/main/java/com/simon/common/utils/snowflake/SystemClock.java diff --git a/api/src/main/java/com/simon/common/wrapper/OrderByRequestWrapper.java b/common/src/main/java/com/simon/common/wrapper/OrderByRequestWrapper.java similarity index 100% rename from api/src/main/java/com/simon/common/wrapper/OrderByRequestWrapper.java rename to common/src/main/java/com/simon/common/wrapper/OrderByRequestWrapper.java diff --git a/common/src/main/resources/application.properties b/common/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/common/src/test/java/com/simon/common/CommonApplicationTests.java b/common/src/test/java/com/simon/common/CommonApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..8f7f4946f7871df6933db71a8cae4ce1ce0fb389 --- /dev/null +++ b/common/src/test/java/com/simon/common/CommonApplicationTests.java @@ -0,0 +1,17 @@ +package com.simon.common; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class CommonApplicationTests { + + @Test + public void contextLoads() { + } + +} + diff --git a/pom.xml b/pom.xml index 98bfbe7dc9809350adbc2a3f237c79e4eb06e3aa..aee6a243afbafd52086fa75fcf0892a071357eeb 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,7 @@ web api + common @@ -284,7 +285,7 @@ tk.mybatis mapper-generator - 1.1.1 + 1.1.2 @@ -344,11 +345,12 @@ - - commons-beanutils - commons-beanutils - 1.9.3 - + + + org.yaml @@ -382,11 +384,26 @@ guava 20.0 + + org.quartz-scheduler + quartz + 2.3.0 + + + org.quartz-scheduler + quartz-jobs + 2.3.0 + + + com.squareup.okhttp3 + okhttp + 3.12.1 + diff --git a/src/main/resources/jars/taobao-sdk-java-auto_1455552377940-20160607-source.jar b/src/main/resources/jars/taobao-sdk-java-auto_1455552377940-20160607-source.jar deleted file mode 100644 index c755f8d2622231905594bc0c5215223f52c7999f..0000000000000000000000000000000000000000 Binary files a/src/main/resources/jars/taobao-sdk-java-auto_1455552377940-20160607-source.jar and /dev/null differ diff --git a/src/main/resources/jars/taobao-sdk-java-auto_1455552377940-20160607.jar b/src/main/resources/jars/taobao-sdk-java-auto_1455552377940-20160607.jar deleted file mode 100644 index 1b5f22fe7a52d0ae2f5389ad8a80483705664567..0000000000000000000000000000000000000000 Binary files a/src/main/resources/jars/taobao-sdk-java-auto_1455552377940-20160607.jar and /dev/null differ diff --git a/src/main/resources/static/plug-in/colResizable.jquery.plugin/colResizable-1.5.source.js b/src/main/resources/static/plug-in/colResizable.jquery.plugin/colResizable-1.5.source.js deleted file mode 100644 index 22d335671fb97edcd5a544951a7cad2cfdefae21..0000000000000000000000000000000000000000 --- a/src/main/resources/static/plug-in/colResizable.jquery.plugin/colResizable-1.5.source.js +++ /dev/null @@ -1,367 +0,0 @@ -/** - _ _____ _ _ _ - | | __ \ (_) | | | | - ___ ___ | | |__) |___ ___ _ ______ _| |__ | | ___ - / __/ _ \| | _ // _ \/ __| |_ / _` | '_ \| |/ _ \ - | (_| (_) | | | \ \ __/\__ \ |/ / (_| | |_) | | __/ - \___\___/|_|_| \_\___||___/_/___\__,_|_.__/|_|\___| - - v 1.5 - a jQuery plug-in by Alvaro Prieto Lauroba - - Licences: MIT & GPL - Feel free to use or modify this plugin as far as my full name is kept - - If you are going to use this plug-in in production environments it is - strongly recommended to use its minified version: colResizable.min.js - -*/ - -(function($){ - - var d = $(document); //window object - var h = $("head"); //head object - var drag = null; //reference to the current grip that is being dragged - var tables = []; //array of the already processed tables (table.id as key) - var count = 0; //internal count to create unique IDs when needed. - - //common strings for packing - var ID = "id"; - var PX = "px"; - var SIGNATURE ="JColResizer"; - var FLEX = "JCLRFlex"; - - //short-cuts - var I = parseInt; - var M = Math; - var ie = navigator.userAgent.indexOf('Trident/4.0')>0; - var S; - try{S = sessionStorage;}catch(e){} //Firefox crashes when executed as local file system - - //append required CSS rules - h.append(""); - - - /** - * Function to allow column resizing for table objects. It is the starting point to apply the plugin. - * @param {DOM node} tb - reference to the DOM table object to be enhanced - * @param {Object} options - some customization values - */ - var init = function( tb, options){ - var t = $(tb); //the table object is wrapped - t.opt = options; - if(t.opt.disable) return destroy(t); //the user is asking to destroy a previously colResized table - var id = t.id = t.attr(ID) || SIGNATURE+count++; //its id is obtained, if null new one is generated - t.p = t.opt.postbackSafe; //short-cut to detect postback safe - if(!t.is("table") || tables[id] && !t.opt.partialRefresh) return; //if the object is not a table or if it was already processed then it is ignored. - t.addClass(SIGNATURE).attr(ID, id).before('
'); //the grips container object is added. Signature class forces table rendering in fixed-layout mode to prevent column's min-width - t.g = []; t.c = []; t.w = t.width(); t.gc = t.prev(); t.f=t.opt.fixed; //t.c and t.g are arrays of columns and grips respectively - if(options.marginLeft) t.gc.css("marginLeft", options.marginLeft); //if the table contains margins, it must be specified - if(options.marginRight) t.gc.css("marginRight", options.marginRight); //since there is no (direct) way to obtain margin values in its original units (%, em, ...) - t.cs = I(ie? tb.cellSpacing || tb.currentStyle.borderSpacing :t.css('border-spacing'))||2; //table cellspacing (not even jQuery is fully cross-browser) - t.b = I(ie? tb.border || tb.currentStyle.borderLeftWidth :t.css('border-left-width'))||1; //outer border width (again cross-browser issues) - // if(!(tb.style.width || tb.width)) t.width(t.width()); //I am not an IE fan at all, but it is a pity that only IE has the currentStyle attribute working as expected. For this reason I can not check easily if the table has an explicit width or if it is rendered as "auto" - tables[id] = t; //the table object is stored using its id as key - createGrips(t); //grips are created - - }; - - - /** - * This function allows to remove any enhancements performed by this plugin on a previously processed table. - * @param {jQuery ref} t - table object - */ - var destroy = function(t){ - var id=t.attr(ID), t=tables[id]; //its table object is found - if(!t||!t.is("table")) return; //if none, then it wasn't processed - t.removeClass(SIGNATURE+" "+FLEX).gc.remove(); //class and grips are removed - delete tables[id]; //clean up data - }; - - - /** - * Function to create all the grips associated with the table given by parameters - * @param {jQuery ref} t - table object - */ - var createGrips = function(t){ - - var th = t.find(">thead>tr>th,>thead>tr>td"); //if table headers are specified in its semantically correct tag, are obtained - if(!th.length) th = t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td"); //but headers can also be included in different ways - th = th.filter(":visible"); //filter invisible columns - t.cg = t.find("col"); //a table can also contain a colgroup with col elements - t.ln = th.length; //table length is stored - if(t.p && S && S[t.id])memento(t,th); //if 'postbackSafe' is enabled and there is data for the current table, its coloumn layout is restored - th.each(function(i){ //iterate through the table column headers - var c = $(this); //jquery wrap for the current column - var g = $(t.gc.append('
')[0].lastChild); //add the visual node to be used as grip - g.append(t.opt.gripInnerHtml).append('
'); - if(i == t.ln-1){ - g.addClass("JCLRLastGrip"); - if(t.f) g.html(""); - } - g.bind('touchstart mousedown', onGripMouseDown); //bind the mousedown event to start dragging - - g.t = t; g.i = i; g.c = c; c.w =c.width(); //some values are stored in the grip's node data - t.g.push(g); t.c.push(c); //the current grip and column are added to its table object - c.width(c.w).removeAttr("width"); //the width of the column is converted into pixel-based measurements - g.data(SIGNATURE, {i:i, t:t.attr(ID), last: i == t.ln-1}); //grip index and its table name are stored in the HTML - }); - t.cg.removeAttr("width"); //remove the width attribute from elements in the colgroup - syncGrips(t); //the grips are positioned according to the current table layout - //there is a small problem, some cells in the table could contain dimension values interfering with the - //width value set by this plugin. Those values are removed - t.find('td, th').not(th).not('table th, table td').each(function(){ - $(this).removeAttr('width'); //the width attribute is removed from all table cells which are not nested in other tables and dont belong to the header - }); - if(!t.f){ - t.removeAttr('width').addClass(FLEX); //if not fixed, let the table grow as needed - } - - - }; - - - /** - * Function to allow the persistence of columns dimensions after a browser postback. It is based in - * the HTML5 sessionStorage object, which can be emulated for older browsers using sessionstorage.js - * @param {jQuery ref} t - table object - * @param {jQuery ref} th - reference to the first row elements (only set in deserialization) - */ - var memento = function(t, th){ - var w,m=0,i=0,aux =[],tw; - if(th){ //in deserialization mode (after a postback) - t.cg.removeAttr("width"); - if(t.opt.flush){ S[t.id] =""; return;} //if flush is activated, stored data is removed - w = S[t.id].split(";"); //column widths is obtained - tw = w[t.ln+1]; - if(!t.f && tw) t.width(tw); //it not fixed and table width data available its size is restored - for(;i*{cursor:"+ t.opt.dragCursor +"!important}"); //change the mouse cursor - g.addClass(t.opt.draggingClass); //add the dragging class (to allow some visual feedback) - drag = g; //the current grip is stored as the current dragging object - if(t.c[o.i].l) for(var i=0,c; i com.github.ulisesbocchio jasypt-spring-boot-starter - 1.18 @@ -92,12 +91,10 @@ org.thymeleaf.extras thymeleaf-extras-springsecurity4 - 3.0.2.RELEASE org.thymeleaf.extras thymeleaf-extras-java8time - 3.0.2.RELEASE @@ -108,7 +105,6 @@ net.sourceforge.nekohtml nekohtml - 1.9.22 @@ -123,12 +119,10 @@ io.springfox springfox-swagger2 - ${swagger2.version} io.springfox springfox-swagger-ui - ${swagger2.version} @@ -160,7 +154,6 @@ com.alibaba druid-spring-boot-starter - 1.1.10 mysql @@ -175,23 +168,19 @@ ojdbc14 ojdbc14 - 10.2.0.3.0 org.apache.httpcomponents httpclient - 4.5.3 com.google.code.gson gson - 2.8.5 com.alibaba fastjson - 1.2.47 @@ -203,17 +192,14 @@ org.mybatis.spring.boot mybatis-spring-boot-starter - 1.3.2 org.mybatis.generator mybatis-generator-maven-plugin - 1.3.7 org.mybatis.generator mybatis-generator-core - 1.3.7 @@ -234,7 +220,6 @@ org.freemarker freemarker - 2.3.27-incubating @@ -243,40 +228,33 @@ com.alibaba dayu - 1.0 com.alibaba dayu-source - 1.0 commons-io commons-io - 2.4 org.apache.commons commons-lang3 - 3.7 commons-codec commons-codec - 1.10 commons-dbcp commons-dbcp - 1.4 commons-pool commons-pool - 1.6 @@ -284,33 +262,30 @@ com.qiniu qiniu-java-sdk - [7.2.0, 7.2.99] - + + + org.yaml snakeyaml - 1.23 com.alipay.sdk alipay-sdk-java - 3.3.4.ALL com.github.binarywang weixin-java-pay - ${weixin-java-pay.version} org.webjars.npm @@ -524,7 +505,7 @@ org.webjars easyui - 1.6.10 + 1.7.0 org.webjars @@ -541,6 +522,12 @@ 0.0.1 + + + com.simon + common + 1.3.0 + diff --git a/web/src/main/java/com/simon/WebApplication.java b/web/src/main/java/com/simon/WebApplication.java index 9898fcecbf59e927ac04d5afe595327807f26c40..52181232133b69d3d94d4316619aadf1fc89ab2f 100644 --- a/web/src/main/java/com/simon/WebApplication.java +++ b/web/src/main/java/com/simon/WebApplication.java @@ -1,9 +1,11 @@ package com.simon; +import com.simon.service.QuartzJobService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; -import tk.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import tk.mybatis.spring.annotation.MapperScan; import java.util.TimeZone; @@ -11,6 +13,8 @@ import java.util.TimeZone; @MapperScan("com.simon.mapper") //@EnableDiscoveryClient public class WebApplication implements CommandLineRunner { + @Autowired + private QuartzJobService quartzJobService; public static void main(String[] args) { TimeZone.setDefault(TimeZone.getTimeZone("GMT+8")); @@ -20,6 +24,6 @@ public class WebApplication implements CommandLineRunner { @Override public void run(String... strings) throws Exception { - + quartzJobService.runJobsOnStart(); } } diff --git a/web/src/main/java/com/simon/common/annotation/CurrentUser.java b/web/src/main/java/com/simon/common/annotation/CurrentUser.java deleted file mode 100644 index 487006dc6b089c9fc876e78fe581cd56996f662d..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/annotation/CurrentUser.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.simon.common.annotation; - -import java.lang.annotation.*; - -/** - * 当前登录用户 - * - * @author simon - * @create 2018-07-22 10:21 - **/ -@Target({ElementType.PARAMETER}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface CurrentUser { -} diff --git a/web/src/main/java/com/simon/common/annotation/IgnoreSecurity.java b/web/src/main/java/com/simon/common/annotation/IgnoreSecurity.java deleted file mode 100644 index a635f6397afdf1cf900533ccc3c062465304ea56..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/annotation/IgnoreSecurity.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.simon.common.annotation; - -import java.lang.annotation.*; - -/** - * 忽略登录检查 - * - * @author simon - * @create 2018-07-22 10:23 - **/ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface IgnoreSecurity { -} diff --git a/web/src/main/java/com/simon/common/aspect/ControllerLogInterceptor.java b/web/src/main/java/com/simon/common/aspect/ControllerLogInterceptor.java new file mode 100644 index 0000000000000000000000000000000000000000..6144fca12c08a58cf3797a95623a118514d1bfe6 --- /dev/null +++ b/web/src/main/java/com/simon/common/aspect/ControllerLogInterceptor.java @@ -0,0 +1,82 @@ +package com.simon.common.aspect; + +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.mvc.method.annotation.ExtendedServletRequestDataBinder; + +import javax.servlet.http.HttpServletResponseWrapper; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * @author simon + * @date 2018-12-25 + **/ + +@Slf4j +@Aspect +@Component +@Order(1) +public class ControllerLogInterceptor { + + //创建Pointcut表示式,表示所有controller请求 + @Pointcut("execution(* com..*.controller..*(..))") + private void controllerAspect() { + }// 请求method前打印内容 + + @Around(value = "controllerAspect()") + public Object around(ProceedingJoinPoint pjp) throws Throwable { + //通过uuid关联请求参数和返回参数 + String uuid = UUID.randomUUID().toString().replaceAll("-", ""); + //String uuid = ""; + methodBefore(pjp, uuid); + try { + Object proceed = pjp.proceed(); + methodAfterReturing(proceed, uuid); + return proceed; + } catch (Exception e) { + log.error("[{}]Response异常内容:{}", uuid, e); + throw e; + } + } + + public void methodBefore(JoinPoint joinPoint, String uuid) { + // 打印请求内容 + try { + // 下面两个数组中,参数值和参数名的个数和位置是一一对应的。 + Object[] objs = joinPoint.getArgs(); + String[] argNames = ((MethodSignature) joinPoint.getSignature()).getParameterNames(); // 参数名 + Map paramMap = new HashMap(); + for (int i = 0; i < objs.length; i++) { + if (!(objs[i] instanceof ExtendedServletRequestDataBinder) && !(objs[i] instanceof HttpServletResponseWrapper)) { + paramMap.put(argNames[i], objs[i]); + } + } + if (paramMap.size() > 0) { + log.info("[{}]方法:{}", uuid, joinPoint.getSignature()); + log.info("[{}]参数:{}", uuid, JSONObject.toJSONString(paramMap)); + } + } catch (Exception e) { + log.error("[{}]AOP methodBefore:", uuid, e); + } + } + + public void methodAfterReturing(Object o, String uuid) { + try { + if (o != null){ + log.info("[{}]返回:{}", uuid, JSONObject.toJSON(o)); + } + } catch (Exception e) { + log.error("[{}]AOP methodAfterReturing:", uuid, e); + } + } +} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/aspect/SimpleAspect.java b/web/src/main/java/com/simon/common/aspect/SimpleAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..4429b5e2dab81caceda31ac202635e21bb57c256 --- /dev/null +++ b/web/src/main/java/com/simon/common/aspect/SimpleAspect.java @@ -0,0 +1,61 @@ +package com.simon.common.aspect; + +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; + +/** + * AOP示例 + * + * @author simon + * @date 2018-12-24 + **/ +@Slf4j +/*@Aspect +@Component*/ +public class SimpleAspect { + + @Pointcut("execution( * com.simon..controller.*.*(..))")//两个..代表所有子目录,最后括号里的两个..代表所有参数 + public void logPointCut(){ + + } + + @Before("logPointCut()") + public void doBefore(JoinPoint joinPoint){ + // 接收到请求,记录请求内容 + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = attributes.getRequest(); + // 记录下请求内容 + log.info("请求地址 : " + request.getRequestURL().toString()); + log.info("HTTP METHOD : " + request.getMethod()); + // 获取真实的ip地址 + //logger.info("IP : " + IPAddressUtil.getClientIpAddress(request)); + log.info("CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName() + "." + + joinPoint.getSignature().getName()); + log.info("参数 : " + Arrays.toString(joinPoint.getArgs())); +// loggger.info("参数 : " + joinPoint.getArgs()); + } + + @AfterReturning(returning = "ret", pointcut = "logPointCut()")// returning的值和doAfterReturning的参数名一致 + public void doAfterReturning(Object ret) throws Throwable { + // 处理完请求,返回内容(返回值太复杂时,打印的是物理存储空间的地址) + log.debug("返回值 : " + ret); + } + + @Around("logPointCut()") + public Object doAround(ProceedingJoinPoint pjp) throws Throwable { + long startTime = System.currentTimeMillis(); + Object ob = pjp.proceed();// ob 为方法的返回值 + log.info("耗时 : " + (System.currentTimeMillis() - startTime)); + return ob; + } +} diff --git a/web/src/main/java/com/simon/common/code/DbType.java b/web/src/main/java/com/simon/common/code/DbType.java deleted file mode 100644 index e4b4c5aede9d3e3686f41fa6837161ab278116b1..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/code/DbType.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.simon.common.code; - -/** - * 数据库类型 - * - * @author simon - * @date 2018-09-22 - **/ - -public class DbType { - public static final int MYSQL = 1; - public static final int POSTGRESQL = 2; - public static final int ORACLE = 3; -} diff --git a/web/src/main/java/com/simon/common/code/EntityDataModel.java b/web/src/main/java/com/simon/common/code/EntityDataModel.java deleted file mode 100644 index c7a1726a0b42627e8dfe0a648ec5d11fa1b236b1..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/code/EntityDataModel.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.simon.common.code; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 模板生成属性 - * @author simon - * @date 2018-08-07 - */ -@Data -public class EntityDataModel implements Serializable { - private static final long serialVersionUID = 32546422336594242L; - - /** - * 实体类名首字母大写 - */ - private String modelNameLowerCamel; - - /** - * 实体类名小写下划线 - */ - private String modelNameUpperCamel; - - /** - * 基础包名,在pom.xml中配置 - */ - private String basePackage; - - /** - * 实体类包名 - */ - private String entityPackage; - /** - * 文件名后缀 - */ - private String fileSuffix = ".java"; - - /** - * 实体名 - */ - private String entityName; - - /** - * 作者 默认 - */ - private String AUTHOR=CodeGenerator.AUTHOR; - - /** - * 创建时间 - */ - private String CREATE = CodeGenerator.CREATE; - - /** - * 表名 - */ - private String tableName; - - /** - * 表标注 - */ - private String tableComment; - - /** - * 字段集合 - */ - private List columns; - -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java b/web/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java deleted file mode 100644 index 28c86b141154e226b1a7ea734bb753c64500c8d7..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.simon.common.code; - -import com.simon.common.utils.DbUtil; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.sql.Connection; -import java.sql.DriverManager; - -/** - * 代码生成器工具类 - * @author simon - * @date 2018-08-07 - **/ -@Slf4j -public class FreeMarkerGeneratorUtil { - - /** - * 仅生成dao层 - * @param driver - * @param url - * @param user - * @param pwd - * @param tableName - * @param modelName - * @param basePackage - */ - public static void generatorMvcCode(String driver, String url, String user, String pwd, String tableName, - String modelName, String basePackage) { - - Connection con = null; - //注册驱动 - try { - Class.forName(driver); - con = DriverManager.getConnection(url, user, pwd); - } catch (Exception e) { - log.error("获取数据连接失败,{}", e.getMessage()); - return; - } - - //获取模板路径 - String templatePath = CodeGenerator.TEMPLATE_FILE_PATH; - //log.info("当前模板路径为:{}", templatePath); - - try { - - String entityDir = null; - //根据实体包名创建目录 - File projectPathFile = new File(CodeGenerator.PROJECT_PATH); - if (!projectPathFile.isDirectory()) { - throw new IOException("Path " + CodeGenerator.PROJECT_PATH + " is not directory!"); - } - File[] ls = projectPathFile.listFiles(); - for (File f: ls) { - String currModule = f.toString(); - boolean matches = currModule.matches("(.*?pojo.*?)|(.*?domain.*?)|(.*?entity.*?)"); - if (f.isDirectory()&&matches){ - entityDir = f.toString()+ CodeGenerator.JAVA_PATH + "/" + basePackage.replace(".", "/"); - break; - } - } - if (StringUtils.isBlank(entityDir)){ - entityDir = CodeGenerator.PROJECT_PATH + CodeGenerator.JAVA_PATH + "/" + basePackage.replace(".", "/"); - } - File entityDirFile = new File(entityDir); - if (!entityDirFile.exists()) { - entityDirFile.mkdirs(); - log.info("创建目录:{} 成功! ",entityDir); - } - EntityDataModel entityModel = DbUtil.getEntityModel(con, tableName, CodeGenerator.BASE_PACKAGE, modelName); - //生成每个表实体 - generateCode(entityModel, templatePath, "entity.ftl", entityDir); - - } catch (Exception e) { - log.error("代码生成出错 {}", e.getMessage()); - } - - } - - /** - * - * @param dataModel - * @param templatePath - * @param templateName - * @param outDir - * @throws IOException - * @throws TemplateException - */ - private static void generateCode(EntityDataModel dataModel, String templatePath, String templateName, String outDir) - throws IOException, TemplateException { - - String file = outDir +"/"+ dataModel.getEntityName() + dataModel.getFileSuffix(); - File targetFile = new File(file); - if (targetFile.exists()){ - Files.delete(targetFile.toPath()); - } - //获取模板对象 - Configuration conf = new Configuration(freemarker.template.Configuration.VERSION_2_3_23); - File temp = new File(templatePath); - conf.setDirectoryForTemplateLoading(temp); - Template template = conf.getTemplate(templateName); - Writer writer = new FileWriter(file); - //填充数据模型 - template.process(dataModel, writer); - writer.close(); - log.info("代码生成成功,文件位置:{}",file); - } -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/code/TableInfo.java b/web/src/main/java/com/simon/common/code/TableInfo.java deleted file mode 100644 index fba361753cc1659c6d04251bd29875b4e9c0da4d..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/code/TableInfo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.simon.common.code; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 表信息 - * - * @author simon - * @date 2018-10-07 - **/ - -@ApiModel(description = "表信息") -@Data -@EqualsAndHashCode(callSuper = false) -public class TableInfo { - @ApiModelProperty(value = "表名") - private String tableName; - - @ApiModelProperty(value = "表标注") - private String tableComment; - - @ApiModelProperty(value = "实体类名") - private String entityName; -} diff --git a/web/src/main/java/com/simon/common/code/TypeTranslator.java b/web/src/main/java/com/simon/common/code/TypeTranslator.java deleted file mode 100644 index 76ff98c2e621e1180ccf025ee6aabd2eea6b1c91..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/code/TypeTranslator.java +++ /dev/null @@ -1,218 +0,0 @@ -package com.simon.common.code; - -/** - * 数据表列类型转换为java类型 - * - * @author simon - * @create 2018-08-08 21:09 - **/ - -public class TypeTranslator { - private static String BIT = "BIT"; - private static String BIT1 = "BIT(1)"; - private static String TINYINT = "TINYINT"; - private static String TINYINT1 = "TINYINT(1)"; - private static String SMALLINT = "SMALLINT"; - private static String MEDIUMINT = "MEDIUMINT"; - private static String INTEGER = "INTEGER"; - private static String INT = "INT"; - private static String YEAR = "YEAR"; - private static String UNSIGNED = "UNSIGNED"; - private static String BIGINT = "BIGINT"; - private static String FLOAT = "FLOAT"; - private static String DOUBLE = "DOUBLE"; - private static String DECIMAL = "DECIMAL"; - private static String NUMERIC = "NUMERIC"; - private static String DATE = "DATE"; - private static String TIME = "TIME"; - private static String DATETIME = "DATETIME"; - private static String TIMESTAMP = "TIMESTAMP"; - private static String VARCHAR = "VARCHAR"; - private static String CHAR = "CHAR"; - private static String TEXT = "TEXT"; - private static String BINARY = "BINARY"; - private static String BLOB = "BLOB"; - private static String SERIAL = "SERIAL"; - private static String BIGSERIAL = "BIGSERIAL"; - private static String CHARACTER = "CHARACTER"; - private static String BOOLEAN = "BOOLEAN"; - private static String BOOL = "BOOL"; - private static String REAL = "REAL"; - private static String BYTEA = "BYTEA"; - private static String LONGTEXT = "LONGTEXT"; - - private static String LONG = "LONG"; - private static String VARCHAR2 = "VARCHAR2"; - private static String NUMBER = "NUMBER"; - private static String RAW = "RAW"; - private static String LONGRAW = "LONGRAW"; - - /** - * 参考https://documentation.progress.com/output/DataDirect/DataDirectCloud/index.html#page/queries%2Fmysql-data-types.html%23 - * @param columnType 列类型 - * @param dataType 数据类型 - * @return java数据类型 - */ - public static String translateMySQL(String columnType, String dataType){ - columnType = columnType.toUpperCase(); - dataType = dataType.toUpperCase(); - if(dataType.contains(BIT)){ - if(BIT1.equals(dataType)){ - return "Boolean"; - }else{ - return "Byte[]"; - } - } - if(dataType.contains(TINYINT)){ - if(TINYINT1.equals(columnType)){ - return "Boolean"; - }else{ - return "Integer"; - } - } - if(BOOLEAN.equals(dataType) || BOOL.equals(dataType)){ - return "Boolean"; - } - if(SMALLINT.equals(dataType)){ - return "Short"; - } - if(MEDIUMINT.equals(dataType) || YEAR.equals(dataType) || INT.equals(dataType)){ - return "Integer"; - } - if(dataType.contains(INTEGER)){ - if(dataType.contains(UNSIGNED)){ - return "Long"; - }else{ - return "Integer"; - } - } - if(dataType.contains(BIGINT)){ - if(dataType.contains(UNSIGNED)){ - return "BigInteger"; - } - return "Long"; - } - if(FLOAT.equals(dataType)){ - return "Float"; - } - if(DOUBLE.equals(dataType)){ - return "Double"; - } - if(DECIMAL.equals(dataType) || NUMERIC.equals(dataType)){ - return "BigDecimal"; - } - if(DATE.equals(dataType) || DATETIME.equals(dataType) || TIMESTAMP.equals(dataType)){ - return "Date"; - } - if(TIME.equals(dataType)){ - return "Time"; - } - if(dataType.contains(CHAR) || TEXT.equals(dataType) || LONGTEXT.equals(dataType)){ - return "String"; - } - if(dataType.contains(BINARY) || BLOB.equals(dataType)){ - return "Byte[]"; - } - return "Object"; - } - - /** - * 参考https://documentation.progress.com/output/DataDirect/DataDirectCloud/index.html#page/queries/postgresql-data-types.html - * @param columnType 列类型 - * @param dataType 数据类型 - * @return java数据类型 - */ - public static String translatePostgreSQL(String columnType, String dataType){ - columnType = columnType.toUpperCase(); - dataType = dataType.toUpperCase(); - - if(dataType.contains(BIT)){ - if(BIT1.equals(dataType)){ - return "Boolean"; - }else{ - return "Byte[]"; - } - } - if(SMALLINT.equals(dataType)){ - return "Short"; - } - if(INTEGER.equals(dataType) || SERIAL.equals(dataType)){ - return "Integer"; - } - if(BIGINT.equals(dataType) || BIGSERIAL.equals(dataType)){ - return "Long"; - } - if(dataType.contains(CHARACTER) || dataType.contains(TEXT)){ - return "String"; - } - if(BOOLEAN.equals(dataType)){ - return "Boolean"; - } - if(DECIMAL.equals(dataType) || NUMERIC.equals(dataType)){ - return "BigDecimal"; - } - if(REAL.equals(dataType)){ - return "Float"; - } - if(dataType.contains(DOUBLE)){ - return "Double"; - } - if(dataType.contains(TIME) || DATE.equals(dataType)){ - return "Date"; - } - if(BYTEA.equals(dataType)){ - return "Byte[]"; - } - return "Object"; - } - - /** - * Oracle数据类型转java类型 - * @param columnType DATA_LENGTH - * @param dataType DATA_TYPE - * @return - */ - public static String translateOracle(String columnType, String dataType){ - Integer dataLength = Integer.parseInt(columnType); - dataType = dataType.toUpperCase(); - if(CHAR.equals(dataType) || VARCHAR2.equals(dataType) || LONG.equals(dataType)){ - if (1 == dataLength){ - return "Boolean"; - }else{ - return "String"; - } - } - if(RAW.equals(dataType) || LONGRAW.equals(dataType)){ - return "Byte[]"; - } - if(DATE.equals(dataType)){ - return "Date"; - } - if (dataType.contains(TIMESTAMP)){ - return "Timestamp"; - } - if(NUMBER.equals(dataType)){ - if (1 == dataLength){ - return "Boolean"; - } - if (2 ==dataLength){ - return "Byte"; - } - if (3 <= dataLength && dataLength <= 4){ - return "Short"; - } - if(5 <= dataLength && dataLength <= 9){ - return "Integer"; - } - if(10 <= dataLength && dataLength <= 18){ - return "Long"; - }else{ - return "BigDecimal"; - } - } - if(BLOB.equals(dataType)){ - return "Object"; - } - return "Object"; - } -} diff --git a/web/src/main/java/com/simon/common/controller/BaseController.java b/web/src/main/java/com/simon/common/controller/BaseController.java deleted file mode 100644 index ab3ee3b4b92ca548af845ab19106192912c44b35..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/controller/BaseController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.simon.common.controller; - -import org.springframework.beans.propertyeditors.CustomDateEditor; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; - -import java.sql.Time; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * Base Controller - * - * @author simon - * @create 2018-09-06 17:49 - **/ - -public class BaseController { - /** - * 字符串绑定Date类型 - * @param binder - */ - @InitBinder - protected void initDateBinder(WebDataBinder binder) { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - //setLenient用于设置Calendar是否宽松解析字符串,如果为false,则严格解析;默认为true,宽松解析 - dateFormat.setLenient(false); - //第二个参数是控制是否支持传入的值是空,这个值很关键,如果指定为false,那么如果前台没有传值的话就会报错 - binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); - } - - /** - * 字符串绑定Time类型 - * @param binder - */ - @InitBinder - protected void initTimeBinder(WebDataBinder binder){ - SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); - dateFormat.setLenient(false); - //第二个参数是控制是否支持传入的值是空,这个值很关键,如果指定为false,那么如果前台没有传值的话就会报错 - binder.registerCustomEditor(Time.class, new CustomDateEditor(dateFormat, true)); - } -} diff --git a/web/src/main/java/com/simon/common/domain/BillStatus.java b/web/src/main/java/com/simon/common/domain/BillStatus.java deleted file mode 100644 index b04a7461671da77853b45d95bfca86ea1b9b65c4..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/domain/BillStatus.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.simon.common.domain; - -/** - * 订单状态 - * - * @author simon - * @date 2018-11-23 - **/ - -public enum BillStatus { - WAIT_PAY(1, "待付款"), - PAYED(2, "已付款,待发货"), - DELIVERED(3, "已发货,待收货"), - SUCCESS(4, "交易成功"), - CLOSED(5, "交易关闭"), - REFUNDING(6, "退款中"); - - - private final int code; - private final String msg; - - - BillStatus(int code, String msg){ - this.code = code; - this.msg = msg; - } - - public int getCode() { - return code; - } - - public String getMsg() { - return msg; - } - - @Override - public String toString() { - return "BillStatus{" + - "code=" + code + - ", msg='" + msg + '\'' + - '}'; - } -} diff --git a/web/src/main/java/com/simon/common/domain/EasyUIDataGridResult.java b/web/src/main/java/com/simon/common/domain/EasyUIDataGridResult.java deleted file mode 100644 index 10c23e27a17e0536720d8ecdec2fb42fca0850e8..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/domain/EasyUIDataGridResult.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.simon.common.domain; - -import com.github.pagehelper.PageInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springframework.data.domain.Page; - -import java.io.Serializable; -import java.util.List; - -/** - * EasyUI DataGrid数据格式 - * - * @author simon - * @date 2018-10-27 - **/ -@ApiModel(description = "EasyUI DataGrid数据格式") -@Data -@EqualsAndHashCode(callSuper = false) -public class EasyUIDataGridResult implements Serializable { - private static final long serialVersionUID = -1778687339119859732L; - - @ApiModelProperty(value = "记录总数") - private Long total; - - @ApiModelProperty(value = "记录列表") - private List rows; - - public EasyUIDataGridResult(){ - - } - - public EasyUIDataGridResult(Long total, List rows){ - this.total = total; - this.rows = rows; - } - - public EasyUIDataGridResult(PageInfo pageInfo){ - this.total = pageInfo.getTotal(); - this.rows = pageInfo.getList(); - } - - public EasyUIDataGridResult(Page page){ - this.total = page.getTotalElements(); - this.rows = page.getContent(); - } -} diff --git a/web/src/main/java/com/simon/common/domain/PaymentType.java b/web/src/main/java/com/simon/common/domain/PaymentType.java deleted file mode 100644 index a6bed1019a3f22daa8c2ed65f7b08f6cafbd93c6..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/domain/PaymentType.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.simon.common.domain; - -/** - * 支付方式 - * - * @author simon - * @date 2018-11-23 - **/ - -public enum PaymentType { - ALI_PAY(1, "alipay"), - WX_PAY(2, "wxpay"); - - private final int code; - private final String msg; - - - PaymentType(int code, String msg){ - this.code = code; - this.msg = msg; - } - - public int getCode() { - return code; - } - - public String getMsg() { - return msg; - } - - @Override - public String toString() { - return "PaymentType{" + - "code=" + code + - ", msg='" + msg + '\'' + - '}'; - } -} diff --git a/web/src/main/java/com/simon/common/domain/ResultCode.java b/web/src/main/java/com/simon/common/domain/ResultCode.java deleted file mode 100644 index 835f9ba8d76bd07e156f9023c2d7f35c6c331a48..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/domain/ResultCode.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.simon.common.domain; - -/** - * 结果码 - * - * @author simon - * @date 2018-10-31 - **/ - -public enum ResultCode { - - SUCCESS(200, "操作成功"), - FAIL(500, "服务器内部错误"), - ERROR_VERI_CODE(404001, "验证码错误"); - - private final int code; - private final String msg; - - ResultCode(int code, String msg){ - this.code = code; - this.msg = msg; - } - - public int getCode() { - return code; - } - - public String getMsg() { - return msg; - } - - public static String getMsg(int code){ - for(ResultCode resultCode : ResultCode.values()){ - if (resultCode.getCode() == code){ - return resultCode.getMsg(); - } - } - return null; - } - - public static boolean codeExists(int code){ - for(ResultCode resultCode : ResultCode.values()){ - if (resultCode.getCode() == code){ - return true; - } - } - return false; - } - - @Override - public String toString() { - return "ResultCode{" + - "code=" + code + - ", msg='" + msg + '\'' + - '}'; - } -} diff --git a/web/src/main/java/com/simon/common/domain/ResultMsg.java b/web/src/main/java/com/simon/common/domain/ResultMsg.java deleted file mode 100644 index 11230ae02a1bc7c02b741e6abaf9d041bac325fa..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/domain/ResultMsg.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.simon.common.domain; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - * 标准返回格式 - * @author simon - * @date 2018-09-18 - */ -@ApiModel(description = "标准返回格式") -@Data -@EqualsAndHashCode(callSuper = false) -public class ResultMsg implements Serializable { - private static final long serialVersionUID = -452209559974344268L; - - @ApiModelProperty(value = "返回码", required = true) - private Integer code; - - @ApiModelProperty(value = "返回信息", required = true) - private String message; - - @ApiModelProperty(value = "返回数据", required = true) - private T data; - - public ResultMsg() { - } - - public ResultMsg(Integer code, String message) { - this.code = code; - this.message = message; - this.data = null; - } - - public ResultMsg(Integer code, String message, T data) { - this.code = code; - this.message = message; - this.data = data; - } - - public static ResultMsg success(){ - return resultCode(ResultCode.SUCCESS); - } - - public static ResultMsg success(Integer code, String message){ - return new ResultMsg<>(code, message); - } - - public static ResultMsg success(T data){ - return resultCode(ResultCode.SUCCESS, data); - } - - public static ResultMsg success(Integer code, String message, T data){ - return new ResultMsg<>(code, message, data); - } - - public static ResultMsg fail(Integer code, String message, T data){ - return new ResultMsg<>(code, message, data); - } - - public static ResultMsg fail(Integer code, String message){ - return new ResultMsg<>(code, message, null); - } - - public static ResultMsg fail(ResultCode resultCode){ - return new ResultMsg<>(resultCode.getCode(), resultCode.getMsg(), null); - } - - public static ResultMsg resultCode(ResultCode resultCode){ - return new ResultMsg(resultCode.getCode(), resultCode.getMsg()); - } - - public static ResultMsg resultCode(ResultCode resultCode, T data){ - return new ResultMsg<>(resultCode.getCode(), resultCode.getMsg(), data); - } -} diff --git a/web/src/main/java/com/simon/common/exception/CodeInvalidException.java b/web/src/main/java/com/simon/common/exception/CodeInvalidException.java deleted file mode 100644 index b53c332bcdd0bc1271135d282e71694c73dd4891..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/exception/CodeInvalidException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.simon.common.exception; - -/** - * 验证码失效 - * - * @author simon - * @create 2018-07-31 20:11 - **/ - -public class CodeInvalidException extends RuntimeException { -} diff --git a/web/src/main/java/com/simon/common/exception/CustomOauthException.java b/web/src/main/java/com/simon/common/exception/CustomOauthException.java deleted file mode 100644 index ede570f16f04fb3f1f24d56dab5d374bd5c5aa18..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/exception/CustomOauthException.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.simon.common.exception; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; - -/** - * 自定义Oauth异常 - * - * @author simon - * @create 2018-05-31 18:14 - **/ -@JsonSerialize(using = CustomOauthExceptionSerializer.class) -public class CustomOauthException extends OAuth2Exception { - public CustomOauthException(String msg) { - super(msg); - } -} diff --git a/web/src/main/java/com/simon/common/exception/CustomOauthExceptionSerializer.java b/web/src/main/java/com/simon/common/exception/CustomOauthExceptionSerializer.java deleted file mode 100644 index efbe0828f87678c36f1bb00a1d5a0d04333092c3..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/exception/CustomOauthExceptionSerializer.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.simon.common.exception; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.simon.common.config.AppConfig; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.util.Map; - -/** - * 序列化 - * - * @author simon - * @create 2018-05-31 18:16 - **/ -@Slf4j -public class CustomOauthExceptionSerializer extends StdSerializer { - - public CustomOauthExceptionSerializer() { - super(CustomOauthException.class); - } - - @Override - public void serialize(CustomOauthException value, JsonGenerator gen, SerializerProvider provider) throws IOException { - log.warn("CustomOauthException = " + value); - - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - - gen.writeStartObject(); - gen.writeNumberField(AppConfig.CODE, value.getHttpErrorCode()); - gen.writeStringField(AppConfig.MESSAGE, value.getMessage()); - gen.writeNullField(AppConfig.DATA); -// gen.writeStringField("message", "用户名或密码错误"); - //gen.writeStringField("path", request.getServletPath()); - //gen.writeStringField("timestamp", String.valueOf(new Date().getTime())); - if (value.getAdditionalInformation()!=null) { - for (Map.Entry entry : value.getAdditionalInformation().entrySet()) { - String key = entry.getKey(); - String add = entry.getValue(); - log.warn("key = " + key); - log.warn("add = " + add); - gen.writeStringField(key, add); - } - } - gen.writeEndObject(); - } -} diff --git a/web/src/main/java/com/simon/common/exception/RegisterException.java b/web/src/main/java/com/simon/common/exception/RegisterException.java deleted file mode 100644 index aefde74135171ceaa4484fc8611f293a4bd3b6b2..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/exception/RegisterException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.simon.common.exception; - -/** - * 注册异常 - * - * @author simon - * @date 2018-12-07 - **/ - -public class RegisterException extends RuntimeException { - private static final long serialVersionUID = -2606099856338881866L; - - public RegisterException(){ - - } - - public RegisterException(String message){ - super(message); - } -} diff --git a/web/src/main/java/com/simon/common/exception/UserExistsException.java b/web/src/main/java/com/simon/common/exception/UserExistsException.java deleted file mode 100644 index 66f6f5de669539e81e22e5f0ec001470bf90f80e..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/exception/UserExistsException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.simon.common.exception; - -/** - * 用户已存在 - * - * @author simon - * @date 2018-12-07 - **/ - -public class UserExistsException extends RuntimeException { - private static final long serialVersionUID = 848351055098685051L; - - public UserExistsException(){ - - } - - public UserExistsException(String message){ - super(message); - } -} diff --git a/web/src/main/java/com/simon/common/exception/UserNotValidException.java b/web/src/main/java/com/simon/common/exception/UserNotValidException.java deleted file mode 100644 index b479bdbbc4c0fb4a2855a7af07ec7e3d5ee32acb..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/exception/UserNotValidException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.simon.common.exception; - -/** - * 用户无效 - * - * @author simon - * @create 2018-07-31 10:17 - **/ - -public class UserNotValidException extends RuntimeException { - private static final long serialVersionUID = 6379257682308144691L; - - public UserNotValidException() { - - } - - public UserNotValidException(String message) { - super(message); - } -} diff --git a/web/src/main/java/com/simon/common/mapper/MyMapper.java b/web/src/main/java/com/simon/common/mapper/MyMapper.java deleted file mode 100644 index 0b2642de5a649a6f2b81976ea6e55064c4a393b9..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/mapper/MyMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.simon.common.mapper; - -import tk.mybatis.mapper.common.BaseMapper; -import tk.mybatis.mapper.common.ConditionMapper; -import tk.mybatis.mapper.common.IdsMapper; -import tk.mybatis.mapper.common.special.InsertListMapper; - -/** - * 通用mapper - * - * @author simon - * @create 2018-07-23 0:37 - **/ - -public interface MyMapper extends BaseMapper,ConditionMapper,IdsMapper,InsertListMapper { -} diff --git a/web/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java b/web/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java index c265f0a8dd9d82c043f558cd5365bda640a591a2..774c7dc25ee23630e07c130423ac4e2e643c5dab 100644 --- a/web/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java +++ b/web/src/main/java/com/simon/common/plugins/oauth/UsernamePasswordAuthenticator.java @@ -2,6 +2,8 @@ package com.simon.common.plugins.oauth; import com.simon.common.config.AppConfig; import com.simon.common.domain.UserEntity; +import com.simon.common.exception.BusinessException; +import com.simon.common.utils.ValidUtil; import com.simon.model.Authority; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -34,7 +36,9 @@ public class UsernamePasswordAuthenticator extends AbstractPreparableIntegration private Locale locale = AppConfig.getLocale(); - private final String sqlLoadUser; + private final String sqlLoadUserByPhone; + private final String sqlLoadUserByEmail; + private final String sqlLoadUserByName; private final String sqlLoadAuthorities; private final RowMapper myUserDetailsRowMapper; private final RowMapper authorityRowMapper; @@ -42,7 +46,9 @@ public class UsernamePasswordAuthenticator extends AbstractPreparableIntegration private final static String PASSWORD_AUTH_TYPE = "password"; public UsernamePasswordAuthenticator(){ - sqlLoadUser = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where username=? OR phone=? OR email=?"; + sqlLoadUserByPhone = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where phone=?"; + sqlLoadUserByEmail = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where email=?"; + sqlLoadUserByName = "select id,username,password,enabled,phone,email,address,birth,age,head_photo,person_brief,sex from t_users where username=?"; sqlLoadAuthorities = "select user_id,authority from t_authorities where user_id = ?"; myUserDetailsRowMapper = (rs, i) -> new UserEntity(rs.getLong(1), rs.getString(2), rs.getString(3), rs.getBoolean(4), rs.getString("phone"), rs.getString("email"),rs.getString("address"), rs.getDate("birth"), rs.getInt("age"), rs.getString("head_photo"), rs.getString("person_brief"), rs.getBoolean("sex")); @@ -59,7 +65,16 @@ public class UsernamePasswordAuthenticator extends AbstractPreparableIntegration public UserEntity authenticate(IntegrationAuthentication integrationAuthentication) { log.info("password authenticate"); try{ - UserEntity userFromQuery = jdbcTemplate.queryForObject(sqlLoadUser, myUserDetailsRowMapper, integrationAuthentication.getUsername(), integrationAuthentication.getUsername(), integrationAuthentication.getUsername()); + UserEntity userFromQuery = null; + if(ValidUtil.isEmail(integrationAuthentication.getUsername())){ + userFromQuery = jdbcTemplate.queryForObject(sqlLoadUserByEmail, myUserDetailsRowMapper, integrationAuthentication.getUsername()); + }else if(ValidUtil.isMobile(integrationAuthentication.getUsername())){ + userFromQuery = jdbcTemplate.queryForObject(sqlLoadUserByPhone, myUserDetailsRowMapper, integrationAuthentication.getUsername()); + }else{ + //userFromQuery = jdbcTemplate.queryForObject(sqlLoadUserByName, myUserDetailsRowMapper, integrationAuthentication.getUsername()); + throw new BusinessException("不支持的登录方式"); + } + log.info("查询得到用户:{}", userFromQuery); List authorities = jdbcTemplate.query(sqlLoadAuthorities, authorityRowMapper, userFromQuery.getId()); log.info("得到其权限:{}", authorities); diff --git a/web/src/main/java/com/simon/common/plugins/quartz/QuartzConfig.java b/web/src/main/java/com/simon/common/plugins/quartz/QuartzConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..e0bac352bd415522ff94c163c1f818e9a831d88a --- /dev/null +++ b/web/src/main/java/com/simon/common/plugins/quartz/QuartzConfig.java @@ -0,0 +1,47 @@ +package com.simon.common.plugins.quartz; + +import org.quartz.Scheduler; +import org.quartz.spi.TriggerFiredBundle; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.quartz.AdaptableJobFactory; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; +import org.springframework.stereotype.Component; + +/** + * quartz定时任务配置 + * + * @author simon + * @date 2018-12-21 + **/ +@Configuration +public class QuartzConfig { + //解决Job中注入Spring Bean为null的问题 + @Component("quartzJobFactory") + private class QuartzJobFactory extends AdaptableJobFactory { + //这个对象Spring会帮我们自动注入进来,也属于Spring技术范畴. + @Autowired + private AutowireCapableBeanFactory capableBeanFactory; + + protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { + //调用父类的方法 + Object jobInstance = super.createJobInstance(bundle); + //进行注入,这属于Spring的技术,不清楚的可以查看Spring的API. + capableBeanFactory.autowireBean(jobInstance); + return jobInstance; + } + } + //注入scheduler到spring,在下面quartzManege会用到 + @Bean(name = "scheduler") + public Scheduler scheduler(QuartzJobFactory quartzJobFactory) throws Exception { + + SchedulerFactoryBean factoryBean=new SchedulerFactoryBean(); + factoryBean.setJobFactory(quartzJobFactory); + factoryBean.afterPropertiesSet(); + Scheduler scheduler=factoryBean.getScheduler(); + scheduler.start(); + return scheduler; + } +} diff --git a/web/src/main/java/com/simon/common/plugins/quartz/QuartzManage.java b/web/src/main/java/com/simon/common/plugins/quartz/QuartzManage.java new file mode 100644 index 0000000000000000000000000000000000000000..8b8c01c9ba124177066dde7ac49b96191cfbdf72 --- /dev/null +++ b/web/src/main/java/com/simon/common/plugins/quartz/QuartzManage.java @@ -0,0 +1,93 @@ +package com.simon.common.plugins.quartz; + +import com.simon.model.QuartzJob; +import org.quartz.*; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +import static org.quartz.TriggerBuilder.newTrigger; + +/** + * 任务管理类 + * + * @author simon + * @date 2018-12-21 + **/ + +@Component +public class QuartzManage { + @Resource(name = "scheduler") + private Scheduler scheduler; + + public void addJob(QuartzJob job) throws SchedulerException, ClassNotFoundException, IllegalAccessException, InstantiationException { + //通过类名获取实体类,即要执行的定时任务的类 + Class clazz = Class.forName(job.getBeanName()); + Job jobEntity = (Job)clazz.newInstance(); + //通过实体类和任务名创建 JobDetail + JobDetail jobDetail = JobBuilder.newJob(jobEntity.getClass()) + .withDescription(job.getDescription()) + .withIdentity(job.getJobName()) + .build(); + //通过触发器名和cron 表达式创建 Trigger + Trigger cronTrigger = newTrigger() + .withIdentity(job.getTriggerName()) + //一旦加入scheduler,立即生效 + .startNow() + //使用cron表达式触发器 + .withSchedule(CronScheduleBuilder.cronSchedule(job.getCronExpression())) + .build(); + //执行定时任务 + scheduler.scheduleJob(jobDetail,cronTrigger); + } + + /** + * 更新job cron表达式 + * @param quartzJob + * @throws SchedulerException + */ + public void updateJobCron(QuartzJob quartzJob) throws SchedulerException { + + TriggerKey triggerKey = TriggerKey.triggerKey(quartzJob.getJobName()); + CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(quartzJob.getCronExpression()); + trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); + scheduler.rescheduleJob(triggerKey, trigger); + } + /** + * 删除一个job + * @param quartzJob + * @throws SchedulerException + */ + public void deleteJob(QuartzJob quartzJob) throws SchedulerException { + JobKey jobKey = JobKey.jobKey(quartzJob.getJobName()); + scheduler.deleteJob(jobKey); + } + /** + * 恢复一个job + * @param quartzJob + * @throws SchedulerException + */ + public void resumeJob(QuartzJob quartzJob) throws SchedulerException { + JobKey jobKey = JobKey.jobKey(quartzJob.getJobName()); + scheduler.resumeJob(jobKey); + } + /** + * 立即执行job + * @param quartzJob + * @throws SchedulerException + */ + public void runAJobNow(QuartzJob quartzJob) throws SchedulerException { + JobKey jobKey = JobKey.jobKey(quartzJob.getJobName()); + scheduler.triggerJob(jobKey); + } + /** + * 暂停一个job + * @param quartzJob + * @throws SchedulerException + */ + public void pauseJob(QuartzJob quartzJob) throws SchedulerException { + JobKey jobKey = JobKey.jobKey(quartzJob.getJobName()); + scheduler.pauseJob(jobKey); + } +} diff --git a/web/src/main/java/com/simon/common/service/BasicService.java b/web/src/main/java/com/simon/common/service/BasicService.java deleted file mode 100644 index 005446e0e9d89eb88b7e74308a49d0fd6cc3419e..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/service/BasicService.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.simon.common.service; - -import com.github.pagehelper.PageInfo; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; - -import java.util.List; - -/** - * Basic Service - * - * @author simon - * @date 2018-08-02 - **/ - -public interface BasicService { - /** - * 统计记录总条数 - * @return 记录总条数 - */ - long count(); - - /** - * 保存记录 - * @param model 记录 - * @return 保存后的记录 - */ - T save(T model); - - /** - * 批量保存记录 - * @param modelList 记录列表 - * @return 保存后的记录列表 - */ - List save(List modelList); - - /** - * PageHelper分页查询 - * @param pageNo 页码 - * @param pageSize 每页记录数 - * @param orderBy 排序 - * @return 分页数据 - */ - PageInfo findAll(Integer pageNo, Integer pageSize, String orderBy); - - /** - * JPA分页查询 - * @param pageable 分页对象 - * @return 分页数据 - */ - Page findAll(Pageable pageable); - - /** - * 查询所有记录 - * @return 所有记录 - */ - List findAll(); - - /** - * 根据id删除记录 - * @param id 记录id - */ - void delete(ID id); - - /** - * 根据id批量删除记录 - * @param ids 批量记录id,逗号隔开 - * @return 影响的记录条数 - */ - int deleteByIds(String ids); - - /** - * 根据id查询记录 - * @param id 记录id - * @return 记录 - */ - T findById(ID id); - - /** - * 批量插入记录 - * @param list 记录列表 - * @return 影响的记录条数 - */ - int insertList(List list); - - /** - * 插入记录 - * @param model 记录 - * @return 影响的记录条数 - */ - int insert(T model); - - /** - * 可选地插入记录(只保存记录的非空属性) - * @param model 记录 - * @return 影响的记录条数 - */ - int insertSelective(T model); - - /** - * 根据id更新记录(更新记录的全部属性) - * @param model 待更新记录 - * @return 影响的记录条数 - */ - int updateByPrimaryKey(T model); - - /** - * 根据id更新记录(只更新记录的非空属性) - * @param model 待更新记录 - * @return 影响的记录条数 - */ - int updateByPrimaryKeySelective(T model); -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/utils/AccountValidatorUtil.java b/web/src/main/java/com/simon/common/utils/AccountValidatorUtil.java deleted file mode 100644 index 17b7fadda1b911a351eeb71250a13a4e7761315d..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/AccountValidatorUtil.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.simon.common.utils; - -import java.util.regex.Pattern; - -/** - * 账户相关属性验证工具 - * - * @author simon - * @date 2018-12-07 - **/ - -public class AccountValidatorUtil { - /** - * 正则表达式:验证用户名 - */ - public static final String REGEX_USERNAME = "^[a-zA-Z]\\w{5,20}$"; - - /** - * 正则表达式:验证密码 - */ - public static final String REGEX_PASSWORD = "^[a-zA-Z0-9]{6,20}$"; - - /** - * 正则表达式:验证手机号 - */ - public static final String REGEX_MOBILE ="^[1](([3][0-9])|([4][5,7,9])|([5][^4,6,9])|([6][6])|([7][3,5,6,7,8])|([8][0-9])|([9][8,9]))[0-9]{8}$"; - - /** - * 正则表达式:验证邮箱 - */ - public static final String REGEX_EMAIL = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; - - /** - * 正则表达式:验证汉字 - */ - public static final String REGEX_CHINESE = "^[\u4e00-\u9fa5],{0,}$"; - - /** - * 正则表达式:验证身份证 - */ - public static final String REGEX_ID_CARD = "(^\\d{18}$)|(^\\d{15}$)"; - - /** - * 正则表达式:验证URL - */ - public static final String REGEX_URL = "http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?"; - - /** - * 正则表达式:验证IP地址 - */ - public static final String REGEX_IP_ADDR = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)"; - - /** - * 校验用户名 - * - * @param username - * @return 校验通过返回true,否则返回false - */ - public static boolean isUsername(String username) { - return Pattern.matches(REGEX_USERNAME, username); - } - - /** - * 校验密码 - * - * @param password - * @return 校验通过返回true,否则返回false - */ - public static boolean isPassword(String password) { - return Pattern.matches(REGEX_PASSWORD, password); - } - - /** - * 校验手机号 - * - * @param mobile - * @return 校验通过返回true,否则返回false - */ - public static boolean isMobile(String mobile) { - return Pattern.matches(REGEX_MOBILE, mobile); - } - - /** - * 校验邮箱 - * - * @param email - * @return 校验通过返回true,否则返回false - */ - public static boolean isEmail(String email) { - return Pattern.matches(REGEX_EMAIL, email); - } - - /** - * 校验汉字 - * - * @param chinese - * @return 校验通过返回true,否则返回false - */ - public static boolean isChinese(String chinese) { - return Pattern.matches(REGEX_CHINESE, chinese); - } - - /** - * 校验身份证 - * - * @param idCard - * @return 校验通过返回true,否则返回false - */ - public static boolean isIDCard(String idCard) { - return Pattern.matches(REGEX_ID_CARD, idCard); - } - - /** - * 校验URL - * - * @param url - * @return 校验通过返回true,否则返回false - */ - public static boolean isUrl(String url) { - return Pattern.matches(REGEX_URL, url); - } - - /** - * 校验IP地址 - * - * @param ipAddr - * @return - */ - public static boolean isIPAddr(String ipAddr) { - return Pattern.matches(REGEX_IP_ADDR, ipAddr); - } -} diff --git a/web/src/main/java/com/simon/common/utils/BeanUtils.java b/web/src/main/java/com/simon/common/utils/BeanUtils.java deleted file mode 100644 index 5bd8646a1c9a98d0bac1d0efa923cc6e60b9eea2..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/BeanUtils.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.simon.common.utils; - -import org.springframework.beans.BeanWrapper; -import org.springframework.beans.BeanWrapperImpl; - -import java.util.HashSet; -import java.util.Set; - -/** - * Bean复制工具类 - * - * @author simon - * @date 2018-10-30 - **/ - -public class BeanUtils extends org.springframework.beans.BeanUtils { - private static String[] getNullPropertyNames (Object source) { - final BeanWrapper src = new BeanWrapperImpl(source); - java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors(); - - Set emptyNames = new HashSet<>(); - for(java.beans.PropertyDescriptor pd : pds) { - Object srcValue = src.getPropertyValue(pd.getName()); - if (srcValue == null){ - emptyNames.add(pd.getName()); - } - } - String[] result = new String[emptyNames.size()]; - return emptyNames.toArray(result); - } - - public static void copyPropertiesIgnoreNull(Object src, Object target){ - org.springframework.beans.BeanUtils.copyProperties(src, target, getNullPropertyNames(src)); - } -} diff --git a/web/src/main/java/com/simon/common/utils/CodeUtil.java b/web/src/main/java/com/simon/common/utils/CodeUtil.java deleted file mode 100644 index 9d7beeb4cd4c734b1b6e9287a6bc78ab76139fea..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/CodeUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.simon.common.utils; - -import java.util.UUID; - -/** - * @Description: TODO(说明) - * @author HWJ - * @date 2018年3月24日 - */ -public class CodeUtil { - /** - * 生成6位随机数 - * - * @return - */ - public static String get6Code() { - int code = (int) ((Math.random() * 9 + 1) * 100000); - return code + ""; - } - - /** - * 生成4位随机数 - * - * @return - */ - public static String get4Code() { - int code = (int) ((Math.random() * 9 + 1) * 1000); - return code + ""; - } - - /** - * 生成表单token - * - * @return - */ - public static String getFormToken() { - return MD5Util.sign(getUUID()); - } - - /** - * 获取uuid - * - * @return - */ - public static String getUUID() { - return UUID.randomUUID().toString(); - } - - - public static void main(String[] args) { - System.out.println(getFormToken()); - } - -} diff --git a/web/src/main/java/com/simon/common/utils/DateUtil.java b/web/src/main/java/com/simon/common/utils/DateUtil.java deleted file mode 100644 index e4cc8dab2075b38e03f6aaa5f2257fe923360c45..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/DateUtil.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.simon.common.utils; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * 时间工具类 - * - * @author simon - * @create 2018-06-10 11:06 - **/ - -public class DateUtil { - private static final SimpleDateFormat ISO8601_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"); - - public static String formatISO(Date date){ - return ISO8601_DATE_FORMAT.format(date); - } - - public static String formatISO(long timestamp){ - return formatISO(new Date(timestamp)); - } - - public static String format(Date date, String pattern){ - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - return sdf.format(date); - } - - public static String format(long timestamp, String pattern){ - return format(new Date(timestamp), pattern); - } - - public static String getCurTimestampStr() { - DateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmss"); - return fmt.format(System.currentTimeMillis()); - } -} diff --git a/web/src/main/java/com/simon/common/utils/FileUploadUtil.java b/web/src/main/java/com/simon/common/utils/FileUploadUtil.java deleted file mode 100644 index 5a1e85018cd58df8080454124a19ad5bda4ccb8e..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/FileUploadUtil.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.simon.common.utils; - -import com.alibaba.fastjson.JSON; -import com.simon.common.config.AppConfig; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.multipart.MultipartFile; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -/** - * 文件上传工具类 - * - * @author simon - * @date 2018-06-06 - **/ -@Slf4j -public class FileUploadUtil { - private static final String ROOT = AppConfig.FILE_UPLOAD_DIR; - - public FileUploadUtil(){ - - } - - public static String[] saveFiles(MultipartFile[] files){ - if(!Files.exists(Paths.get(ROOT))){ - try{ - Files.createDirectories(Paths.get(ROOT)); - }catch (IOException e){ - log.error(e.getMessage()); - } - } - - int len = files.length; - if (len > 0){ - String[] imgUrlArr = new String[len]; - for(int i = 0; i < len; i++){ - if (!files[i].isEmpty()){ - try { - //SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmssSSSS"); - String originFileName = files[i].getOriginalFilename(); - String fileType = originFileName.substring(originFileName.lastIndexOf(".")); - log.info("originFileName=" + originFileName); - log.info("fileType=" + fileType); - //String imgUrl = ROOT + "/" + fmt.format(new Date()) + fileType; - - String imgUrl = ROOT + "/" + originFileName; - Path path = Paths.get(imgUrl); - if (!Files.exists(path)){ - Files.copy(files[i].getInputStream(), path); - log.info(files[i].getName()); - log.info(files[i].getOriginalFilename()); - log.info(files[i].getContentType()); - } - imgUrlArr[i] = "/" + imgUrl; - } catch (IOException e) { - e.printStackTrace(); - log.error(e.getMessage()); - } - } - } - log.info(JSON.toJSONString(imgUrlArr)); - return imgUrlArr; - }else{ - return null; - } - } -} diff --git a/web/src/main/java/com/simon/common/utils/IpUtil.java b/web/src/main/java/com/simon/common/utils/IpUtil.java deleted file mode 100644 index 87240e59d0fc81b8ae1afeec4a0672ebdd2875d6..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/IpUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.simon.common.utils; - -import org.apache.commons.lang3.StringUtils; - -import javax.servlet.http.HttpServletRequest; -import java.net.InetAddress; -import java.net.UnknownHostException; - -public class IpUtil { - - public static String getIpAddr(HttpServletRequest request){ - String ipAddress = request.getHeader("x-forwarded-for"); - if(StringUtils.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { - ipAddress = request.getHeader("Proxy-Client-IP"); - } - if(StringUtils.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { - ipAddress = request.getHeader("WL-Proxy-Client-IP"); - } - if(StringUtils.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { - ipAddress = request.getRemoteAddr(); - if(ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")){ - try { - //根据网卡取本机配置的IP - InetAddress inet = InetAddress.getLocalHost(); - ipAddress = inet.getHostAddress(); - } catch (UnknownHostException e) { - e.printStackTrace(); - } - } - } - //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 - if(ipAddress!=null && ipAddress.length()>15){ //"***.***.***.***".length() = 15 - if(ipAddress.indexOf(",")>0){ - ipAddress = ipAddress.substring(0,ipAddress.indexOf(",")); - } - } - return ipAddress; - } -} diff --git a/web/src/main/java/com/simon/common/utils/MD5Util.java b/web/src/main/java/com/simon/common/utils/MD5Util.java deleted file mode 100644 index da08b082e833372681b166f1ea7a35b353fe202e..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/MD5Util.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.simon.common.utils; - -import org.apache.commons.codec.digest.DigestUtils; - -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.SignatureException; - -/** - * @Description: MD5工具 - * @author HWJ - * @date 2018年3月24日 - */ -public class MD5Util { - - /** - * 将传入的字符串做MD5摘要 - * - * @param text - * 需要摘要的字符串 - * @return 摘要结果 - */ - public static String sign(String text) { - return DigestUtils.md5Hex(getContentBytes(text, "utf-8")); - } - - /** - * 将传入的明文做MD5摘要,比较传入的摘要,判断是否相等 - * - * @param text - * 需要摘要的字符串 - * @param sign - * 需要比较的摘要对象 - * @return 验证结果 - */ - public static boolean verify(String text, String sign) { - String mysign = DigestUtils.md5Hex(getContentBytes(text, "utf-8")); - if (mysign.equals(sign)) { - return true; - } else { - return false; - } - } - - /** - * @param content - * @param charset - * @return - * @throws SignatureException - * @throws UnsupportedEncodingException - */ - private static byte[] getContentBytes(String content, String charset) { - if (charset == null || "".equals(charset)) { - return content.getBytes(); - } - try { - return content.getBytes(charset); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException("MD5签名过程中出现错误,指定的编码集不对,您目前指定的编码集是:" + charset); - } - } - - - private final static String[] hexDigits = {"0", "1", "2", "3", "4", "5", "6", "7", - "8", "9", "a", "b", "c", "d", "e", "f"}; - - /** - * 转换字节数组为16进制字串 - * @param b 字节数组 - * @return 16进制字串 - */ - public static String byteArrayToHexString(byte[] b) { - StringBuilder resultSb = new StringBuilder(); - for (byte aB : b) { - resultSb.append(byteToHexString(aB)); - } - return resultSb.toString(); - } - - /** - * 转换byte到16进制 - * @param b 要转换的byte - * @return 16进制格式 - */ - private static String byteToHexString(byte b) { - int n = b; - if (n < 0) { - n = 256 + n; - } - int d1 = n / 16; - int d2 = n % 16; - return hexDigits[d1] + hexDigits[d2]; - } - - /** - * MD5编码 - * @param origin 原始字符串 - * @return 经过MD5加密之后的结果 - */ - public static String MD5Encode(String origin) { - String resultString = null; - try { - resultString = origin; - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(resultString.getBytes("UTF-8")); - resultString = byteArrayToHexString(md.digest()); - } catch (Exception e) { - e.printStackTrace(); - } - return resultString; - } - - public static String md5(String str) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(str.getBytes()); - byte[] byteDigest = md.digest(); - int i; - StringBuffer buf = new StringBuffer(""); - for (byte element : byteDigest) { - i = element; - if (i < 0) { - i += 256; - } - if (i < 16) { - buf.append("0"); - } - buf.append(Integer.toHexString(i)); - } - return buf.toString(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/web/src/main/java/com/simon/common/utils/RandomUtil.java b/web/src/main/java/com/simon/common/utils/RandomUtil.java deleted file mode 100644 index 09e8787d676ec5e44f696e1662ca1d0c33a3bb80..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/RandomUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.simon.common.utils; - -import java.util.Random; - -/** - * 随机工具 - * - * @author simon - * @date 2018-12-07 - **/ - -public class RandomUtil { - - /** - * 生成指定长度的随机的字母数字串 - * @param length 长度 - * @return 指定长度的随机的字母数字串 - */ - public static String randomCharAndNum(int length) { - StringBuilder sb = new StringBuilder(); - //随机用以下三个随机生成器 - Random rand = new Random(); - Random randData = new Random(); - int data; - for (int i = 0; i < length; i++) { - int index = rand.nextInt(3); - //目的是随机选择生成数字,大小写字母 - switch (index) { - case 0: - //仅仅会生成0~9 - data = randData.nextInt(10); - sb.append(data); - break; - case 1: - //保证只会产生65~90之间的整数 - data = randData.nextInt(26) + 65; - sb.append((char) data); - break; - case 2: - //保证只会产生97~122之间的整数 - data = randData.nextInt(26) + 97; - sb.append((char) data); - break; - default: - break; - } - } - return sb.toString(); - } -} diff --git a/web/src/main/java/com/simon/common/utils/SmsUtil.java b/web/src/main/java/com/simon/common/utils/SmsUtil.java deleted file mode 100644 index dd311b7fb1b9ab3c1c466151a94dc89708b4da1a..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/SmsUtil.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.simon.common.utils; - -import com.alibaba.fastjson.JSON; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.protocol.HTTP; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -/** - * 短信工具类 - * - * @author simon - * @date 2018-12-03 - **/ - -@Slf4j -public class SmsUtil { - private static final String DEFAULT_CHARSET = "UTF-8"; - - private static SmsUtil instance = new SmsUtil(); - - /** - * @see org.apache.http.client.HttpClient - */ - private HttpClient httpclient = HttpClientBuilder.create().build(); - - private SmsUtil() { - } - - public static SmsUtil getInstance(){ - return instance; - } - - /** - * 发送短信 - * - * @param clientid 帐号 - * @param password 密码 - * @param mobile 发送手机号码 - * @param content 短信内容 - * @param smsType 0:通知短信,4:验证码短信,5:营销短信 - */ - @SuppressWarnings("unchecked") - public String sendSMS(String clientid, String password, String mobile, String content, String smsType) { - Map param = getRequestParam(clientid, password, mobile, content, smsType); - try { - String uri = String.valueOf(param.get("uri")); - HttpPost httppost = new HttpPost(uri); - password = DigestUtils.md5Hex(String.valueOf(param.get("password")).getBytes(DEFAULT_CHARSET)) - .toLowerCase(); - param.remove("uri"); - param.put("password", password); - - String params = JSON.toJSONString(param); - HttpEntity requestEntity = new StringEntity(params, DEFAULT_CHARSET); - httppost.setEntity(requestEntity); - httppost.setHeader(HTTP.CONTENT_ENCODING, DEFAULT_CHARSET); - httppost.setHeader(HTTP.CONTENT_TYPE, "application/json;charset=utf-8;"); - httppost.setHeader("Accept", "application/json"); - HttpResponse httpresponse = httpclient.execute(httppost); - HttpEntity responseEntity = httpresponse.getEntity(); - InputStream in = responseEntity.getContent(); - if (in != null) { - return IOUtils.toString(in, DEFAULT_CHARSET); - } - } catch (Exception e) { - log.debug("发送短信验证码出错", e); - } - return null; - } - - /** - * 获取请求参数 - * - * @param clientid clientid - * @param password password - * @param mobile mobile - * @param content content - * @param smsType smsType - * @return map - */ - private Map getRequestParam(String clientid, String password, String mobile, String content, - String smsType) { - - Map requestParam = new HashMap<>(); - requestParam.put("uid", "00"); - requestParam.put("extend", "00"); - requestParam.put("smstype", smsType); - requestParam.put("clientid", clientid); - requestParam.put("password", password); - requestParam.put("content", content); - requestParam.put("mobile", mobile); - requestParam.put("uri", "https://api.ucpaas.com/sms-partner/access/" + clientid + "/sendsms"); - return requestParam; - } -} diff --git a/web/src/main/java/com/simon/common/utils/SnowflakeGenId.java b/web/src/main/java/com/simon/common/utils/SnowflakeGenId.java deleted file mode 100644 index e358d0a1b08896343fdb4dc8963f1057ff0c6ded..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/SnowflakeGenId.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.simon.common.utils; - -import com.simon.common.utils.snowflake.Sequence; -import tk.mybatis.mapper.genid.GenId; - -/** - * 基于Twitter的Snowflake算法 - * - * @author simon - * @create 2018-08-17 22:18 - **/ - -public class SnowflakeGenId implements GenId { - private Sequence sequence = new Sequence(1, 1); - @Override - public Long genId(String table, String column) { - return sequence.nextId(); - } -} diff --git a/web/src/main/java/com/simon/common/utils/SpringUtils.java b/web/src/main/java/com/simon/common/utils/SpringUtils.java deleted file mode 100644 index a60214d568ad63ecb39afcc5271ceff74a3c038b..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/SpringUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.simon.common.utils; - - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -/** - * @author simon - */ -@Component -public class SpringUtils implements ApplicationContextAware { - - private static ApplicationContext applicationContext = null; - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - if(SpringUtils.applicationContext == null){ - SpringUtils.applicationContext = applicationContext; - } - } - - - /** - * 获取applicationContext - * @return - */ - public static ApplicationContext getApplicationContext() { - return applicationContext; - } - - /** - * 通过name获取 Bean. - * @param name - * @return - */ - public static Object getBean(String name){ - return getApplicationContext().getBean(name); - } - - /** - * 通过class获取Bean. - * @param clazz - * @param - * @return - */ - public static T getBean(Class clazz){ - return getApplicationContext().getBean(clazz); - } - - /** - * 通过name,以及Clazz返回指定的Bean - * @param name - * @param clazz - * @param - * @return - */ - public static T getBean(String name,Class clazz){ - return getApplicationContext().getBean(name, clazz); - } - -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/utils/UUIdGenId.java b/web/src/main/java/com/simon/common/utils/UUIdGenId.java deleted file mode 100644 index e4a4aa314e1bc699f2a0788868f10296dedcc29e..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/UUIdGenId.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.simon.common.utils; - -import tk.mybatis.mapper.genid.GenId; - -/** - * uuid生成 - * - * @author simon - * @create 2018-08-17 13:23 - **/ - -public class UUIdGenId implements GenId { - @Override - public String genId(String table, String column) { - return UuidUtils.getUUID(); - } -} diff --git a/web/src/main/java/com/simon/common/utils/UsernameUtil.java b/web/src/main/java/com/simon/common/utils/UsernameUtil.java deleted file mode 100644 index 549e8f9b511d4a87122dd9aeb58777b11959b31f..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/UsernameUtil.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.simon.common.utils; - -import org.apache.commons.lang3.RandomUtils; - -/** - * 用户名工具 - * - * @author simon - * @date 2018-12-07 - **/ - -public class UsernameUtil { - public static String generateByPhone(String phone){ - return RandomUtils.nextInt(1000000, 9999999) + "" + phone.substring(phone.length() - 4); - } - - public static String generateByEmail(String email){ - return RandomUtil.randomCharAndNum(11).toLowerCase(); - } -} diff --git a/web/src/main/java/com/simon/common/utils/UuidGenerator.java b/web/src/main/java/com/simon/common/utils/UuidGenerator.java deleted file mode 100644 index 9eb8768470c6fba3940a66a5a9bf160dcaa4828e..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/UuidGenerator.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.simon.common.utils; - -import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.id.IdentifierGenerator; - -import java.io.Serializable; - -/** - * uuid generator - * - * @author simon - * @create 2018-08-06 11:31 - **/ - -public class UuidGenerator implements IdentifierGenerator { - @Override - public Serializable generate(SessionImplementor sessionImplementor, Object o) throws HibernateException { - return UuidUtils.getUUID(); - } -} diff --git a/web/src/main/java/com/simon/common/utils/UuidUtils.java b/web/src/main/java/com/simon/common/utils/UuidUtils.java deleted file mode 100644 index ac4fd040cc7c44159fb0e6759a598a84189da8c8..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/UuidUtils.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.simon.common.utils; - -import java.util.UUID; - -/** - * UUID生成工具 - * - * @author simon - * @create 2018-08-02 17:18 - **/ - -public class UuidUtils { - public synchronized static String getUUID(){ - return UUID.randomUUID().toString().replace("-", "").toLowerCase(); - } -} diff --git a/web/src/main/java/com/simon/common/utils/snowflake/Sequence.java b/web/src/main/java/com/simon/common/utils/snowflake/Sequence.java deleted file mode 100644 index 88d6f3799a555e90ad3b6794655c2fdfec7f9fae..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/snowflake/Sequence.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.simon.common.utils.snowflake; - -/** - * 基于Twitter的Snowflake算法实现分布式高效有序ID生产黑科技(sequence) - * - *
- * SnowFlake的结构如下(每部分用-分开):
- *
- * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000
- *
- * 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0
- *
- * 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截) - * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69
- *
- * 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId
- *
- * 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号
- *
- *
- * 加起来刚好64位,为一个Long型。
- * SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。 - * - * @author lry - */ -public class Sequence { - - /** 起始时间戳,用于用当前时间戳减去这个时间戳,算出偏移量 **/ - private final long startTime = 1519740777809L; - - /** workerId占用的位数5(表示只允许workId的范围为:0-1023)**/ - private final long workerIdBits = 5L; - /** dataCenterId占用的位数:5 **/ - private final long dataCenterIdBits = 5L; - /** 序列号占用的位数:12(表示只允许workId的范围为:0-4095)**/ - private final long sequenceBits = 12L; - - /** workerId可以使用的最大数值:31 **/ - private final long maxWorkerId = -1L ^ (-1L << workerIdBits); - /** dataCenterId可以使用的最大数值:31 **/ - private final long maxDataCenterId = -1L ^ (-1L << dataCenterIdBits); - - private final long workerIdShift = sequenceBits; - private final long dataCenterIdShift = sequenceBits + workerIdBits; - private final long timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits; - - /** 用mask防止溢出:位与运算保证计算的结果范围始终是 0-4095 **/ - private final long sequenceMask = -1L ^ (-1L << sequenceBits); - - private long workerId; - private long dataCenterId; - private long sequence = 0L; - private long lastTimestamp = -1L; - private boolean isClock = false; - - /** - * 基于Snowflake创建分布式ID生成器 - *

- * 注:sequence - * - * @param workerId 工作机器ID,数据范围为0~31 - * @param dataCenterId 数据中心ID,数据范围为0~31 - */ - public Sequence(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 void setClock(boolean clock) { - isClock = clock; - } - - /** - * 获取ID - * - * @return - */ - public synchronized Long nextId() { - long timestamp = this.timeGen(); - - // 闰秒:如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 - if (timestamp < lastTimestamp) { - long offset = lastTimestamp - timestamp; - if (offset <= 5) { - try { - this.wait(offset << 1); - timestamp = this.timeGen(); - if (timestamp < lastTimestamp) { - throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", offset)); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } else { - throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", offset)); - } - } - - // 解决跨毫秒生成ID序列号始终为偶数的缺陷:如果是同一时间生成的,则进行毫秒内序列 - if (lastTimestamp == timestamp) { - // 通过位与运算保证计算的结果范围始终是 0-4095 - sequence = (sequence + 1) & sequenceMask; - if (sequence == 0) { - timestamp = this.tilNextMillis(lastTimestamp); - } - } else { - // 时间戳改变,毫秒内序列重置 - sequence = 0L; - } - - lastTimestamp = timestamp; - - /* - * 1.左移运算是为了将数值移动到对应的段(41、5、5,12那段因为本来就在最右,因此不用左移) - * 2.然后对每个左移后的值(la、lb、lc、sequence)做位或运算,是为了把各个短的数据合并起来,合并成一个二进制数 - * 3.最后转换成10进制,就是最终生成的id - */ - return ((timestamp - startTime) << timestampLeftShift) | - (dataCenterId << dataCenterIdShift) | - (workerId << workerIdShift) | - sequence; - } - - /** - * 保证返回的毫秒数在参数之后(阻塞到下一个毫秒,直到获得新的时间戳) - * - * @param lastTimestamp - * @return - */ - private long tilNextMillis(long lastTimestamp) { - long timestamp = this.timeGen(); - while (timestamp <= lastTimestamp) { - timestamp = this.timeGen(); - } - - return timestamp; - } - - /** - * 获得系统当前毫秒数 - * - * @return timestamp - */ - private long timeGen() { - if (isClock) { - // 解决高并发下获取时间戳的性能问题 - return SystemClock.now(); - } else { - return System.currentTimeMillis(); - } - } - -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/utils/snowflake/SequenceId.java b/web/src/main/java/com/simon/common/utils/snowflake/SequenceId.java deleted file mode 100644 index 493c13b97c34b0dc08b66905c80d14b788086320..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/snowflake/SequenceId.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.simon.common.utils.snowflake; - -import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.id.IdentifierGenerator; - -import java.io.Serializable; - -/** - * @author simon - * @create 2018-08-06 2:48 - **/ - -public class SequenceId implements IdentifierGenerator { - /** 起始时间戳,用于用当前时间戳减去这个时间戳,算出偏移量 **/ - private final long startTime = 1519740777809L; - - /** workerId占用的位数5(表示只允许workId的范围为:0-1023)**/ - private final long workerIdBits = 5L; - /** dataCenterId占用的位数:5 **/ - private final long dataCenterIdBits = 5L; - /** 序列号占用的位数:12(表示只允许workId的范围为:0-4095)**/ - private final long sequenceBits = 12L; - - /** workerId可以使用的最大数值:31 **/ - private final long maxWorkerId = -1L ^ (-1L << workerIdBits); - /** dataCenterId可以使用的最大数值:31 **/ - private final long maxDataCenterId = -1L ^ (-1L << dataCenterIdBits); - - private final long workerIdShift = sequenceBits; - private final long dataCenterIdShift = sequenceBits + workerIdBits; - private final long timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits; - - /** 用mask防止溢出:位与运算保证计算的结果范围始终是 0-4095 **/ - private final long sequenceMask = -1L ^ (-1L << sequenceBits); - - private long workerId; - private long dataCenterId; - private long sequence = 0L; - private long lastTimestamp = -1L; - private boolean isClock = false; - - public SequenceId() { - } - - /** - * 基于Snowflake创建分布式ID生成器 - *

- * 注:sequence - * - * @param workerId 工作机器ID,数据范围为0~31 - * @param dataCenterId 数据中心ID,数据范围为0~31 - */ - public SequenceId(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 void setClock(boolean clock) { - isClock = clock; - } - - /** - * 获取ID - * - * @return - */ - public synchronized Long nextId() { - long timestamp = this.timeGen(); - - // 闰秒:如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 - if (timestamp < lastTimestamp) { - long offset = lastTimestamp - timestamp; - if (offset <= 5) { - try { - this.wait(offset << 1); - timestamp = this.timeGen(); - if (timestamp < lastTimestamp) { - throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", offset)); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } else { - throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", offset)); - } - } - - // 解决跨毫秒生成ID序列号始终为偶数的缺陷:如果是同一时间生成的,则进行毫秒内序列 - if (lastTimestamp == timestamp) { - // 通过位与运算保证计算的结果范围始终是 0-4095 - sequence = (sequence + 1) & sequenceMask; - if (sequence == 0) { - timestamp = this.tilNextMillis(lastTimestamp); - } - } else { - // 时间戳改变,毫秒内序列重置 - sequence = 0L; - } - - lastTimestamp = timestamp; - - /* - * 1.左移运算是为了将数值移动到对应的段(41、5、5,12那段因为本来就在最右,因此不用左移) - * 2.然后对每个左移后的值(la、lb、lc、sequence)做位或运算,是为了把各个短的数据合并起来,合并成一个二进制数 - * 3.最后转换成10进制,就是最终生成的id - */ - return ((timestamp - startTime) << timestampLeftShift) | - (dataCenterId << dataCenterIdShift) | - (workerId << workerIdShift) | - sequence; - } - - /** - * 保证返回的毫秒数在参数之后(阻塞到下一个毫秒,直到获得新的时间戳) - * - * @param lastTimestamp - * @return - */ - private long tilNextMillis(long lastTimestamp) { - long timestamp = this.timeGen(); - while (timestamp <= lastTimestamp) { - timestamp = this.timeGen(); - } - - return timestamp; - } - - /** - * 获得系统当前毫秒数 - * - * @return timestamp - */ - private long timeGen() { - if (isClock) { - // 解决高并发下获取时间戳的性能问题 - return SystemClock.now(); - } else { - return System.currentTimeMillis(); - } - } - - @Override - public Serializable generate(SessionImplementor sessionImplementor, Object o) throws HibernateException { - return nextId(); - } -} diff --git a/web/src/main/java/com/simon/common/utils/snowflake/SnowFlake.java b/web/src/main/java/com/simon/common/utils/snowflake/SnowFlake.java deleted file mode 100644 index 10019e3179896167d4793a2ef49af8e7397cc8c0..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/snowflake/SnowFlake.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.simon.common.utils.snowflake; - -/** - * twitter的snowflake算法 -- java实现 - * - * @author beyond - * @date 2016/11/26 - */ -public class SnowFlake { - - /** - * 起始的时间戳 - */ - private final static long START_STMP = 1533491178000L; - - /** - * 每一部分占用的位数 - */ - private final static long SEQUENCE_BIT = 12; //序列号占用的位数 - private final static long MACHINE_BIT = 5; //机器标识占用的位数 - private final static long DATACENTER_BIT = 5;//数据中心占用的位数 - - /** - * 每一部分的最大值 - */ - private final static long MAX_DATACENTER_NUM = -1L ^ (-1L << DATACENTER_BIT); - private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT); - private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT); - - /** - * 每一部分向左的位移 - */ - private final static long MACHINE_LEFT = SEQUENCE_BIT; - private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT; - private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT; - - private long datacenterId; //数据中心 - private long machineId; //机器标识 - private long sequence = 0L; //序列号 - private long lastStmp = -1L;//上一次时间戳 - - public SnowFlake(long datacenterId, long machineId) { - if (datacenterId > MAX_DATACENTER_NUM || datacenterId < 0) { - throw new IllegalArgumentException("datacenterId can't be greater than MAX_DATACENTER_NUM or less than 0"); - } - if (machineId > MAX_MACHINE_NUM || machineId < 0) { - throw new IllegalArgumentException("machineId can't be greater than MAX_MACHINE_NUM or less than 0"); - } - this.datacenterId = datacenterId; - this.machineId = machineId; - } - - /** - * 产生下一个ID - * - * @return - */ - public synchronized long nextId() { - long currStmp = getNewstmp(); - if (currStmp < lastStmp) { - throw new RuntimeException("Clock moved backwards. Refusing to generate id"); - } - - if (currStmp == lastStmp) { - //相同毫秒内,序列号自增 - sequence = (sequence + 1) & MAX_SEQUENCE; - //同一毫秒的序列数已经达到最大 - if (sequence == 0L) { - currStmp = getNextMill(); - } - } else { - //不同毫秒内,序列号置为0 - sequence = 0L; - } - - lastStmp = currStmp; - - return (currStmp - START_STMP) << TIMESTMP_LEFT //时间戳部分 - | datacenterId << DATACENTER_LEFT //数据中心部分 - | machineId << MACHINE_LEFT //机器标识部分 - | sequence; //序列号部分 - } - - private long getNextMill() { - long mill = getNewstmp(); - while (mill <= lastStmp) { - mill = getNewstmp(); - } - return mill; - } - - private long getNewstmp() { - return System.currentTimeMillis(); - } - - public static void main(String[] args) { - SnowFlake snowFlake = new SnowFlake(2, 3); - - for (int i = 0; i < (1 << 12); i++) { - System.out.println(snowFlake.nextId()); - } - - } -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/utils/snowflake/SnowFlakeId.java b/web/src/main/java/com/simon/common/utils/snowflake/SnowFlakeId.java deleted file mode 100644 index c0dfa2ebdd25d7adc3ad6de1358cf0016fac5386..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/snowflake/SnowFlakeId.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.simon.common.utils.snowflake; - -import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.id.IdentifierGenerator; - -import java.io.Serializable; - -/** - * Twitter_Snowflake
- * SnowFlake的结构如下(每部分用-分开):
- * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000
- * 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0
- * 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截) - * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69
- * 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId
- * 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号
- * 加起来刚好64位,为一个Long型。
- * SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。 - * @author : felixu - * @createTime : 2017/11/28. - */ -public class SnowFlakeId implements IdentifierGenerator{ - - // ==============================Fields=========================================== - /** - * 开始时间截 (2018-08-06) - */ - private static final long TWEPOCH = 1533491178000L; - - /** - * 机器id所占的位数 - */ - private static final long WORKER_ID_BITS = 5L; - - /** - * 数据标识id所占的位数 - */ - private static final long DATA_CENTER_ID_BITS = 5L; - - /** - * 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) - */ - private static final long MAX_WORKER_ID = -1L ^ (-1L << WORKER_ID_BITS); - - /** - * 支持的最大数据标识id,结果是31 - */ - private static final long MAX_DATA_CENTER_ID = -1L ^ (-1L << DATA_CENTER_ID_BITS); - - /** - * 序列在id中占的位数 - */ - private static final long SEQUENCE_BITS = 12L; - - /** - * 机器ID向左移12位 - */ - private static final long WORKER_ID_SHIFT = SEQUENCE_BITS; - - /** - * 数据标识id向左移17位(12+5) - */ - private static final long DATA_CENTER_ID_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS; - - /** - * 时间截向左移22位(5+5+12) - */ - private static final long TIMESTAMP_LEFT_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS + DATA_CENTER_ID_BITS; - - /** - * 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) - */ - private static final long SEQUENCE_MASK = -1L ^ (-1L << SEQUENCE_BITS); - - /** - * 工作机器ID(0~31) - */ - private static long workerId; - - /** - * 数据中心ID(0~31) - */ - private static long datacenterId; - - /** - * 毫秒内序列(0~4095) - */ - private static long sequence = 0L; - - /** - * 上次生成ID的时间截 - */ - private static long lastTimestamp = -1L; - - //==============================Constructors===================================== - - public SnowFlakeId() { - } - - /** - * 构造函数 - * - * @param workerId 工作ID (0~31) - * @param datacenterId 数据中心ID (0~31) - */ - private SnowFlakeId(long workerId, long datacenterId) { - if (workerId > MAX_WORKER_ID || workerId < 0) { - throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", MAX_WORKER_ID)); - } - if (datacenterId > MAX_DATA_CENTER_ID || datacenterId < 0) { - throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", MAX_DATA_CENTER_ID)); - } - SnowFlakeId.workerId = workerId; - SnowFlakeId.datacenterId = datacenterId; - } - - // ==============================Methods========================================== - - /** - * 获得下一个ID (该方法是线程安全的) - * - * @return SnowFlakeId - */ - public static synchronized long getId() { - System.out.println(workerId + "," + datacenterId); - long timestamp = timeGen(); - - //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 - 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) & SEQUENCE_MASK; - //毫秒内序列溢出 - if (sequence == 0) { - //阻塞到下一个毫秒,获得新的时间戳 - timestamp = tilNextMillis(lastTimestamp); - } - } - //时间戳改变,毫秒内序列重置 - else { - sequence = 0L; - } - - //上次生成ID的时间截 - lastTimestamp = timestamp; - - //移位并通过或运算拼到一起组成64位的ID - return ((timestamp - TWEPOCH) << TIMESTAMP_LEFT_SHIFT) - | (datacenterId << DATA_CENTER_ID_SHIFT) - | (workerId << WORKER_ID_SHIFT) - | sequence; - } - - /** - * 阻塞到下一个毫秒,直到获得新的时间戳 - * - * @param lastTimestamp 上次生成ID的时间截 - * @return 当前时间戳 - */ - protected static long tilNextMillis(long lastTimestamp) { - long timestamp = timeGen(); - while (timestamp <= lastTimestamp) { - timestamp = timeGen(); - } - return timestamp; - } - - /** - * 返回以毫秒为单位的当前时间 - * - * @return 当前时间(毫秒) - */ - protected static long timeGen() { - return System.currentTimeMillis(); - } - - @Override - public Serializable generate(SessionImplementor s, Object obj) { - return getId(); - } -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/utils/snowflake/SystemClock.java b/web/src/main/java/com/simon/common/utils/snowflake/SystemClock.java deleted file mode 100644 index 609eaff9ad25c27ece40888cbdc66c545210a20c..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/utils/snowflake/SystemClock.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.simon.common.utils.snowflake; - -import java.sql.Timestamp; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; - -/** - * 高并发场景下System.currentTimeMillis()的性能问题的优化 - *

- * System.currentTimeMillis()的调用比new一个普通对象要耗时的多(具体耗时高出多少我还没测试过,有人说是100倍左右)

- * System.currentTimeMillis()之所以慢是因为去跟系统打了一次交道

- * 后台定时更新时钟,JVM退出时,线程自动回收

- * 10亿:43410,206,210.72815533980582%

- * 1亿:4699,29,162.0344827586207%

- * 1000万:480,12,40.0%

- * 100万:50,10,5.0%

- * @author lry - */ -public class SystemClock { - - private final long period; - private final AtomicLong now; - - private SystemClock(long period) { - this.period = period; - this.now = new AtomicLong(System.currentTimeMillis()); - scheduleClockUpdating(); - } - - private static class InstanceHolder { - public static final SystemClock INSTANCE = new SystemClock(1); - } - - private static SystemClock instance() { - return InstanceHolder.INSTANCE; - } - - private void scheduleClockUpdating() { - ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { - public Thread newThread(Runnable runnable) { - Thread thread = new Thread(runnable, "System Clock"); - thread.setDaemon(true); - return thread; - } - }); - scheduler.scheduleAtFixedRate(new Runnable() { - public void run() { - now.set(System.currentTimeMillis()); - } - }, period, period, TimeUnit.MILLISECONDS); - } - - private long currentTimeMillis() { - return now.get(); - } - - public static long now() { - return instance().currentTimeMillis(); - } - - public static String nowDate() { - return new Timestamp(instance().currentTimeMillis()).toString(); - } - -} \ No newline at end of file diff --git a/web/src/main/java/com/simon/common/wrapper/OrderByRequestWrapper.java b/web/src/main/java/com/simon/common/wrapper/OrderByRequestWrapper.java deleted file mode 100644 index c70bf348f048fa321c7e0faf8231808b3683168b..0000000000000000000000000000000000000000 --- a/web/src/main/java/com/simon/common/wrapper/OrderByRequestWrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.simon.common.wrapper; - -import com.google.common.base.CaseFormat; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import java.util.Enumeration; - -/** - * orderBy wrapper - * - * @author simon - * @date 2018-11-23 - **/ - -public class OrderByRequestWrapper extends HttpServletRequestWrapper { - public OrderByRequestWrapper(HttpServletRequest request) { - super(request); - } - - @Override - public Enumeration getParameterNames() { - return super.getParameterNames(); - } - - @Override - public String[] getParameterValues(String name) { - if("orderBy".equals(name)){ - return new String[]{CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, getParameter("orderBy"))}; - } - return super.getParameterValues(name); - } -} diff --git a/web/src/main/java/com/simon/controller/FileUploadController.java b/web/src/main/java/com/simon/controller/FileUploadController.java index 1865ed9eb57210e9db37ab08b4ebf8de4f87537a..19a2df035cae037b03571cf9bd87b7906f3bb17d 100644 --- a/web/src/main/java/com/simon/controller/FileUploadController.java +++ b/web/src/main/java/com/simon/controller/FileUploadController.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.simon.common.config.AppConfig; import com.simon.common.controller.BaseController; import com.simon.common.domain.ResultMsg; +import com.simon.common.exception.BusinessException; import com.simon.common.plugins.qiniu.QiNiuUtil; import com.simon.common.utils.FileUploadUtil; import com.simon.dto.ueditor.FileInfo; @@ -40,7 +41,9 @@ public class FileUploadController extends BaseController { private final ResourceLoader resourceLoader; private final String ROOT = AppConfig.FILE_UPLOAD_DIR; - private final String fileUploadType = AppConfig.FILE_UPLOAD_TYPE; + + @Value("${file.upload.type}") + private String fileUploadType; @Value("${server.port}") private String serverPort; @@ -102,26 +105,30 @@ public class FileUploadController extends BaseController { @RequestMapping(value = "/ueditor/upload/file") public FileInfo uploadFile(HttpServletRequest request){ List files = ((MultipartHttpServletRequest) request).getFiles("file"); - QiNiuUtil.getInstance().setZoneType(QiNiuUtil.ZoneType.ZONE_PUBLIC).uploadCommonsMultipartFile(files.get(0), ROOT + "/" + files.get(0).getOriginalFilename(), true); - FileInfo fileInfo = new FileInfo(); - fileInfo.setCode(200); - fileInfo.setState("SUCCESS"); - fileInfo.setOriginal(files.get(0).getOriginalFilename()); - fileInfo.setUrl("http://pjiiukt1g.bkt.clouddn.com/" + ROOT + "/" + files.get(0).getOriginalFilename()); - fileInfo.setTitle(files.get(0).getOriginalFilename()); - return fileInfo; + if (null == files || files.size() <= 0){ + throw new BusinessException("缺少文件"); + } + if(AppConfig.FILE_UPLOAD_TYPE_QINIU.equals(fileUploadType)){ + QiNiuUtil.getInstance().setZoneType(QiNiuUtil.ZoneType.ZONE_PUBLIC).uploadCommonsMultipartFile(files.get(0), ROOT + "/" + files.get(0).getOriginalFilename(), true); + FileInfo fileInfo = new FileInfo(); + fileInfo.setCode(200); + fileInfo.setState("SUCCESS"); + fileInfo.setOriginal(files.get(0).getOriginalFilename()); + fileInfo.setUrl(QiNiuUtil.getInstance().setZoneType(QiNiuUtil.ZoneType.ZONE_PUBLIC).getDomainOfBucket() + "/" + ROOT + "/" + files.get(0).getOriginalFilename()); + fileInfo.setTitle(files.get(0).getOriginalFilename()); + return fileInfo; + }else{ + String[] savedFiles = FileUploadUtil.saveFiles(files.toArray(new MultipartFile[files.size()])); + if(null == savedFiles || savedFiles.length <= 0){ + throw new BusinessException("存储文件失败"); + } + FileInfo fileInfo = new FileInfo(); + fileInfo.setCode(200); + fileInfo.setState("SUCCESS"); + fileInfo.setOriginal(files.get(0).getOriginalFilename()); + fileInfo.setUrl("http://localhost:" + serverPort + savedFiles[0]); + fileInfo.setTitle(files.get(0).getOriginalFilename()); + return fileInfo; + } } - - /*@ApiOperation(value = "文件下载") - @GetMapping("/fileUpload/{filename:.+}") - public ResponseEntity getFile(@PathVariable String filename) { - Resource file = resourceLoader.getResource("file:" + Paths.get(ROOT, filename)); - return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getFilename() + "\"").body(file); - }*/ - - /*@ApiOperation(value = "文件获取") - @GetMapping("/fileUpload/{filename:.+}") - public ResponseEntity getFile(@PathVariable String filename){ - return ResponseEntity.ok().header(HttpHeaders.CONTENT_TYPE, "application/octet-stream").body(resourceLoader.getResource("file:" + Paths.get(ROOT, filename).toString())); - }*/ } diff --git a/web/src/main/java/com/simon/controller/OauthUserController.java b/web/src/main/java/com/simon/controller/OauthUserController.java index 0cfde06a2072e7c70578a7749318fd1c046aca22..4e97c29ec0ec29b028a9cfebde920cec0400b197 100644 --- a/web/src/main/java/com/simon/controller/OauthUserController.java +++ b/web/src/main/java/com/simon/controller/OauthUserController.java @@ -79,7 +79,6 @@ public class OauthUserController extends BaseController { @PostMapping(value = "") @ResponseBody public ResultMsg add(@RequestBody OauthUser body){ - body.setPassword(passwordEncoder.encode(body.getPassword())); oauthUserService.save(body); return ResultMsg.success(); } diff --git a/web/src/main/java/com/simon/controller/QuartzJobController.java b/web/src/main/java/com/simon/controller/QuartzJobController.java new file mode 100644 index 0000000000000000000000000000000000000000..e684cc7989fcc11253d669a9b481c876f58c3abb --- /dev/null +++ b/web/src/main/java/com/simon/controller/QuartzJobController.java @@ -0,0 +1,120 @@ +package com.simon.controller; + +import com.simon.common.controller.BaseController; +import com.simon.common.domain.EasyUIDataGridResult; +import com.simon.common.domain.ResultMsg; +import com.simon.common.domain.UserEntity; +import com.simon.common.plugins.quartz.QuartzManage; +import com.simon.model.QuartzJob; +import com.simon.service.QuartzJobService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +/** +* quartz任务 +* +* @author SimonSun +* @date 2018-12-22 +**/ +@Slf4j +@Api(description = "quartz任务") +@Controller +@RequestMapping("/api/quartzJobs") +public class QuartzJobController extends BaseController{ + + @Autowired + private QuartzJobService quartzJobService; + + @Autowired + private QuartzManage quartzManage; + + @ApiIgnore + @ApiOperation(value = "列表页面") + @GetMapping(params = "easyui-list") + public String getEasyUIList(){ + return "easyui/quartz_job"; + } + + @ApiIgnore + @ApiOperation(value = "列表数据") + @GetMapping("easyui/list") + @ResponseBody + public EasyUIDataGridResult getEasyUIList( + @ApiParam(value = "类名") @RequestParam(required = false) String beanName, + @ApiParam(value = "job状态") @RequestParam(required = false) Integer jobStatus, + @ApiParam(value = "页码", defaultValue = "1", required = true) @RequestParam Integer pageNo, + @ApiParam(value = "每页条数", defaultValue = "10", required = true)@RequestParam Integer pageSize, + @ApiParam(value = "排序")@RequestParam(required = false, defaultValue = "") String orderBy){ + Map params = new LinkedHashMap<>(); + params.put("beanName", beanName); + params.put("jobStatus", jobStatus); + return new EasyUIDataGridResult<>(quartzJobService.getList(params, pageNo, pageSize, orderBy)); + } + + @ApiOperation(value = "新增") + @PostMapping + @ResponseBody + public ResultMsg add(@RequestBody QuartzJob body){ + quartzJobService.insertSelective(body); + return ResultMsg.success(); + } + + @ApiOperation(value = "修改") + @PatchMapping + @ResponseBody + public ResultMsg update(@RequestBody QuartzJob body){ + quartzJobService.updateByPrimaryKeySelective(body); + return ResultMsg.success(); + } + + @ApiOperation(value = "删除") + @DeleteMapping("/id/{ids}") + @ResponseBody + public ResultMsg delete(@PathVariable String ids){ + quartzJobService.deleteByIds(ids); + return ResultMsg.success(); + } + + //@PreAuthorize("isAuthenticated()") + @PreAuthorize("hasRole('ADMIN') or hasRole('SU')") + @ApiOperation(value = "定时任务操作(启动,暂停)") + @PostMapping("/id/{id}/jobStatus/{jobStatus}") + @ResponseBody + public ResultMsg operation( + Authentication authentication, + @PathVariable Long id, + @ApiParam(value = "job状态[0:off, 1:on]", required = true)@PathVariable int jobStatus) throws ClassNotFoundException, InstantiationException, SchedulerException, IllegalAccessException { + Object principal = authentication.getPrincipal(); + UserEntity userEntity = null; + if(principal instanceof UserEntity){ + userEntity = (UserEntity)principal; + } + + QuartzJob quartzJob = quartzJobService.findById(id); + + if(0 == jobStatus){ + quartzManage.pauseJob(quartzJob); + }else{ + quartzManage.resumeJob(quartzJob); + } + + quartzJob.setJobStatus(jobStatus); + quartzJob.setUpdateBy(userEntity.getId()); + quartzJob.setUpdateDate(new Date()); + quartzJobService.updateByPrimaryKeySelective(quartzJob); + return ResultMsg.success(); + } +} \ No newline at end of file diff --git a/web/src/main/java/com/simon/controller/TableController.java b/web/src/main/java/com/simon/controller/TableController.java index 4ecdcf08b1e51d8c4927945ee27c4545b65db772..61f5ce26114340e32307f6fbb16e1ea33fd1a3f5 100644 --- a/web/src/main/java/com/simon/controller/TableController.java +++ b/web/src/main/java/com/simon/controller/TableController.java @@ -156,10 +156,9 @@ public class TableController extends BaseController { @RequestParam String tableName, @RequestParam String entityName, @RequestParam String tableComment, - @ApiParam(value = "表id列类型", required = false, example = "Long") @RequestParam(required = false, defaultValue = "Long") String idType, - @RequestParam(required = false, defaultValue = "controllerAndPage") String genModules, + @RequestParam String idType, + @RequestParam String genModules, @RequestParam String columns){ - log.info(columns); List columnList = JSON.parseArray(columns, Column.class); EntityDataModel entityDataModel = new EntityDataModel(); entityDataModel.setBasePackage(CodeGenerator.BASE_PACKAGE); @@ -172,7 +171,6 @@ public class TableController extends BaseController { entityDataModel.setModelNameUpperCamel(entityName); entityDataModel.setModelNameLowerCamel(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entityDataModel.getEntityName())); CodeGenerator.genCodeByCustomModelName(tableName, entityName, idType, genModules, null, entityDataModel); - log.info(JSON.toJSONString(columnList)); return ResultMsg.success(); } } diff --git a/web/src/main/java/com/simon/mapper/AccountBindMapper.java b/web/src/main/java/com/simon/mapper/AccountBindMapper.java index bf62bf9a590b382a68bfe8371b51033aaa5a9fd5..02a9da616662e0677ee70b53fba858d280b34afe 100644 --- a/web/src/main/java/com/simon/mapper/AccountBindMapper.java +++ b/web/src/main/java/com/simon/mapper/AccountBindMapper.java @@ -2,6 +2,11 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.AccountBind; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface AccountBindMapper extends MyMapper { + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/AuthorityMapper.java b/web/src/main/java/com/simon/mapper/AuthorityMapper.java index b830819924b087ce99b24701c4d0922c3c3d8b86..d48d485aab425f04431bae1a3e1aa97cf949d892 100644 --- a/web/src/main/java/com/simon/mapper/AuthorityMapper.java +++ b/web/src/main/java/com/simon/mapper/AuthorityMapper.java @@ -22,4 +22,6 @@ public interface AuthorityMapper extends MyMapper { * @return 影响记录行数 */ int deleteByUserIds(@Param("userIds") String userIds); + + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/BillMapper.java b/web/src/main/java/com/simon/mapper/BillMapper.java index b7de85ac53418fe42811bd117629d2317b7282e7..fba817d4cc98eececab99ac4d6d20e555fc1fd7c 100644 --- a/web/src/main/java/com/simon/mapper/BillMapper.java +++ b/web/src/main/java/com/simon/mapper/BillMapper.java @@ -11,4 +11,6 @@ public interface BillMapper extends MyMapper { int updateBillStatusByOutTradeNo(String billStatus, String outTradeNo); List getDtoList(@Param("map") Map params); + + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/DictTypeGroupMapper.java b/web/src/main/java/com/simon/mapper/DictTypeGroupMapper.java index 849b93d1e846704dcfa3672ae4cd3541fe24de8e..c203703a861753a1a8b8cbc3fbf0deb821fb0f9f 100644 --- a/web/src/main/java/com/simon/mapper/DictTypeGroupMapper.java +++ b/web/src/main/java/com/simon/mapper/DictTypeGroupMapper.java @@ -12,4 +12,6 @@ public interface DictTypeGroupMapper extends MyMapper { List getAll(); List getTreeGridDtos(@Param("map") Map map); + + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/DictTypeMapper.java b/web/src/main/java/com/simon/mapper/DictTypeMapper.java index 614078db0ad713968a825ce28d954b66abc330d9..6f814c3192e3dbaccfc940b4ff1cda75070de40e 100644 --- a/web/src/main/java/com/simon/mapper/DictTypeMapper.java +++ b/web/src/main/java/com/simon/mapper/DictTypeMapper.java @@ -6,6 +6,7 @@ import com.simon.model.DictType; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * @author simon @@ -19,4 +20,6 @@ public interface DictTypeMapper extends MyMapper { List getByGroupCode(@Param("groupCode") String groupCode); List getTreeGridDtos(@Param("groupCode") String groupCode); + + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/LogLoginMapper.java b/web/src/main/java/com/simon/mapper/LogLoginMapper.java index fbb075159ce0e024716993d93825d2366fd23e05..1aa73fb3ffaf1568c0096c0da05db0fcfd8db512 100644 --- a/web/src/main/java/com/simon/mapper/LogLoginMapper.java +++ b/web/src/main/java/com/simon/mapper/LogLoginMapper.java @@ -2,6 +2,11 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.LogLogin; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface LogLoginMapper extends MyMapper { + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/NewsTagMapper.java b/web/src/main/java/com/simon/mapper/NewsTagMapper.java index 91d6b9faab67b305288b3072eacbd35ad8e6262b..4abc1bf22d924cbb913bcf4b0fc7a887a5d157ed 100644 --- a/web/src/main/java/com/simon/mapper/NewsTagMapper.java +++ b/web/src/main/java/com/simon/mapper/NewsTagMapper.java @@ -2,6 +2,11 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.NewsTag; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface NewsTagMapper extends MyMapper { + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/NoticeMsgMapper.java b/web/src/main/java/com/simon/mapper/NoticeMsgMapper.java index 5ccbe766c591945f044bb5c715d25ac0581bbb40..5026761c73cba99b0d8df63a6fe552ec5d912e07 100644 --- a/web/src/main/java/com/simon/mapper/NoticeMsgMapper.java +++ b/web/src/main/java/com/simon/mapper/NoticeMsgMapper.java @@ -2,6 +2,11 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.NoticeMsg; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface NoticeMsgMapper extends MyMapper { + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/OauthUserMapper.java b/web/src/main/java/com/simon/mapper/OauthUserMapper.java index edef51f1bef44883f05ca7b97e07d17bfcf0cb73..c0d1878b5f0456d85eb1396ddf96614b984328cb 100644 --- a/web/src/main/java/com/simon/mapper/OauthUserMapper.java +++ b/web/src/main/java/com/simon/mapper/OauthUserMapper.java @@ -14,4 +14,6 @@ public interface OauthUserMapper extends MyMapper { List findByMap(@Param("map") Map map); List sexRatio(); + + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/QrCodeMapper.java b/web/src/main/java/com/simon/mapper/QrCodeMapper.java index ea4b8c53c4b509e14305b58086e6fdab9dc9e060..4d686eb9d3fb65f9faeeb732c47d7c326212dccf 100644 --- a/web/src/main/java/com/simon/mapper/QrCodeMapper.java +++ b/web/src/main/java/com/simon/mapper/QrCodeMapper.java @@ -2,6 +2,11 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.QrCode; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface QrCodeMapper extends MyMapper { + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/QuartzJobMapper.java b/web/src/main/java/com/simon/mapper/QuartzJobMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..6df27adea45bd647fba701d8946a47d8f2df7ee5 --- /dev/null +++ b/web/src/main/java/com/simon/mapper/QuartzJobMapper.java @@ -0,0 +1,24 @@ +package com.simon.mapper; + +import com.simon.common.mapper.MyMapper; +import com.simon.model.QuartzJob; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** +* QuartzJob +* @author SimonSun +* @date 2018-12-22 +**/ +public interface QuartzJobMapper extends MyMapper { + /** + * 使用Map查询 + * @param map map查询条件 + * @return 查询结果 + */ + List getList(@Param("map") Map map); + + int updateJobStatus(@Param("jobStatus") int jobStatus); +} \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java b/web/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java index 032dbb10260cd295f8880ffc32466708fee45f25..8ae8f0c812885c9234c60173a7c88ebbeb07c72f 100644 --- a/web/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java +++ b/web/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java @@ -2,6 +2,11 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.ResetPwdInfo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface ResetPwdInfoMapper extends MyMapper { + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/SideMenuMapper.java b/web/src/main/java/com/simon/mapper/SideMenuMapper.java index 79011948e4802e20b28edd2e0eb39f6d9d7df8f7..97618adc4288e164e899eebc3c6b2fe076ce2e1b 100644 --- a/web/src/main/java/com/simon/mapper/SideMenuMapper.java +++ b/web/src/main/java/com/simon/mapper/SideMenuMapper.java @@ -39,4 +39,6 @@ public interface SideMenuMapper extends MyMapper { List selectTreeGrid(); List findAll(); + + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/mapper/VeriCodeMapper.java b/web/src/main/java/com/simon/mapper/VeriCodeMapper.java index 2d8e14982e5ae8a40c8fcf2203a75d5ecabeccf3..bad1ec81e144f5fc8043774e3474fab7ff810571 100644 --- a/web/src/main/java/com/simon/mapper/VeriCodeMapper.java +++ b/web/src/main/java/com/simon/mapper/VeriCodeMapper.java @@ -2,6 +2,11 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.VeriCode; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface VeriCodeMapper extends MyMapper { + List getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/model/OauthUser.java b/web/src/main/java/com/simon/model/OauthUser.java index a37114097268d6a91ee563d9c0dce39df99eeb7d..b64f62d4f89ce3e76f4dcf0295010fd2cf2d644a 100644 --- a/web/src/main/java/com/simon/model/OauthUser.java +++ b/web/src/main/java/com/simon/model/OauthUser.java @@ -114,4 +114,8 @@ public class OauthUser implements Serializable{ @ApiModelProperty(value = "登录时间") @Column(name = "login_date") private Date loginDate; + + @ApiModelProperty(value = "角色") + @Transient + private String authorities; } \ No newline at end of file diff --git a/web/src/main/java/com/simon/model/QuartzJob.java b/web/src/main/java/com/simon/model/QuartzJob.java new file mode 100644 index 0000000000000000000000000000000000000000..87f99b9678538ecfff7162f8a79f1f054b0e9421 --- /dev/null +++ b/web/src/main/java/com/simon/model/QuartzJob.java @@ -0,0 +1,98 @@ +package com.simon.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.simon.common.config.AppConfig; +import com.simon.common.utils.SnowflakeGenId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.annotations.GenericGenerator; +import tk.mybatis.mapper.annotation.KeySql; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** +* quartz任务 +* @author SimonSun +* @date 2018-12-22 +**/ +@ApiModel(description = "quartz任务") +@Data +@EqualsAndHashCode(callSuper = false) +@Entity +@Table(name="t_s_quartz_job") +public class QuartzJob implements Serializable{ + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "id") + @KeySql(genId = SnowflakeGenId.class) + @GeneratedValue(generator = "sequenceId") + @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") + private Long id; + + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE) + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = AppConfig.DATE_PATTERN_DATETIME, timezone = AppConfig.DATE_TIMEZONE) + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + + @ApiModelProperty(value = "cron表达式") + @Column(name = "cron_expression") + private String cronExpression; + + @ApiModelProperty(value = "任务调用的方法名") + @Column(name = "method_name") + private String methodName; + + @ApiModelProperty(value = "任务是否有状态") + @Column(name = "is_concurrent") + private Integer isConcurrent; + + @ApiModelProperty(value = "描述") + @Column(name = "description") + private String description; + + @ApiModelProperty(value = "任务执行时调用哪个类的方法 包名+类名,完全限定名") + @Column(name = "bean_name") + private String beanName; + + @ApiModelProperty(value = "触发器名称") + @Column(name = "trigger_name") + private String triggerName; + + @ApiModelProperty(value = "任务状态") + @Column(name = "job_status") + private Integer jobStatus; + + @ApiModelProperty(value = "spring_bean") + @Column(name = "spring_bean") + private String springBean; + + @ApiModelProperty(value = "任务名") + @Column(name = "job_name") + private String jobName; + + @ApiModelProperty(value = "创建人名称") + @Transient + private String createUser; + + @ApiModelProperty(value = "更新人名称") + @Transient + private String updateUser; +} \ No newline at end of file diff --git a/web/src/main/java/com/simon/repository/QuartzJobRepository.java b/web/src/main/java/com/simon/repository/QuartzJobRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..995eacc338811b37d44aebc93e5d9f8d9f63bb6e --- /dev/null +++ b/web/src/main/java/com/simon/repository/QuartzJobRepository.java @@ -0,0 +1,15 @@ +package com.simon.repository; + +import com.simon.model.QuartzJob; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** +* @author SimonSun +* @date 2018-12-21 +**/ +@Repository +public interface QuartzJobRepository extends JpaRepository { +} diff --git a/web/src/main/java/com/simon/service/LoggingEventService.java b/web/src/main/java/com/simon/service/LoggingEventService.java index 7df31841bbad33ca644f7e4955ff9f08229b4778..c2355cd6a562e00924431cd2f46a2d113f3150d5 100644 --- a/web/src/main/java/com/simon/service/LoggingEventService.java +++ b/web/src/main/java/com/simon/service/LoggingEventService.java @@ -1,16 +1,12 @@ package com.simon.service; -import com.github.pagehelper.PageInfo; import com.simon.common.service.BasicService; import com.simon.model.LoggingEvent; -import java.util.Map; - /** * @author SimonSun * @date 2018-11-09 **/ public interface LoggingEventService extends BasicService { - PageInfo getList(Map params, Integer limit, Integer offset, String orderBy); void deleteAll(); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/NewsInfoService.java b/web/src/main/java/com/simon/service/NewsInfoService.java index f56f11d001971acddb40f4e4197d6c4c8a242fc7..b5fe6a3abd1bc20b0cb6a4000093f324cf004f8c 100644 --- a/web/src/main/java/com/simon/service/NewsInfoService.java +++ b/web/src/main/java/com/simon/service/NewsInfoService.java @@ -1,15 +1,12 @@ package com.simon.service; -import com.github.pagehelper.PageInfo; import com.simon.common.service.BasicService; import com.simon.model.NewsInfo; -import java.util.Map; - /** * @author SimonSun * @create 2018-08-05 18:00:13 **/ public interface NewsInfoService extends BasicService { - PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy); + } \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/QuartzJobService.java b/web/src/main/java/com/simon/service/QuartzJobService.java new file mode 100644 index 0000000000000000000000000000000000000000..be848caab31ea5b0c5c599dfaef7662565d06e21 --- /dev/null +++ b/web/src/main/java/com/simon/service/QuartzJobService.java @@ -0,0 +1,12 @@ +package com.simon.service; +import com.simon.model.QuartzJob; +import com.simon.common.service.BasicService; +import org.quartz.SchedulerException; + +/** +* @author SimonSun +* @date 2018-12-21 +**/ +public interface QuartzJobService extends BasicService { + void runJobsOnStart() throws ClassNotFoundException, InstantiationException, SchedulerException, IllegalAccessException; +} \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/SideMenuService.java b/web/src/main/java/com/simon/service/SideMenuService.java index fb3675e4f2c040268af8b81c74aa2934de46425e..8adba66337ec19645cd11c02e025d4def4eac45d 100644 --- a/web/src/main/java/com/simon/service/SideMenuService.java +++ b/web/src/main/java/com/simon/service/SideMenuService.java @@ -14,5 +14,4 @@ import java.util.Map; public interface SideMenuService extends BasicService { PageInfo getAll(Map params, Integer limit, Integer offset); List getAll(); - PageInfo getList(Map params, Integer limit, Integer offset, String orderBy); } \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java b/web/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java index 020d72b8a2889d4ba5d39a1896a69eae6ef81231..6aa54db46100503b2b9bf127dec826878526a150 100644 --- a/web/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/AccountBindServiceImpl.java @@ -1,22 +1,22 @@ package com.simon.service.impl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simon.common.config.AppConfig; import com.simon.mapper.AccountBindMapper; import com.simon.model.AccountBind; -import com.simon.service.AccountBindService; import com.simon.repository.AccountBindRepository; -import com.simon.common.config.AppConfig; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; +import com.simon.service.AccountBindService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.beans.factory.annotation.Autowired; -import org.apache.commons.lang3.StringUtils; -import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -110,4 +110,19 @@ public class AccountBindServiceImpl implements AccountBindService { public int updateByPrimaryKeySelective(AccountBind accountBind){ return accountBindMapper.updateByPrimaryKeySelective(accountBind); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + List list = accountBindMapper.getList(params); + return new PageInfo<>(list); + } } \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java b/web/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java index 1a57abec4154cb058db675f4db23266b72a07d90..f5c401fddcaa80fc3c582e4a4ea784c76e091d8f 100644 --- a/web/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/AuthorityServiceImpl.java @@ -115,6 +115,21 @@ public class AuthorityServiceImpl implements AuthorityService { return authorityMapper.updateByPrimaryKeySelective(authority); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + List list = authorityMapper.getList(params); + return new PageInfo<>(list); + } + @Override public PageInfo getDtoList(Map params, Integer pageNo, Integer pageSize, String orderBy) { if (null == pageSize){ diff --git a/web/src/main/java/com/simon/service/impl/BillServiceImpl.java b/web/src/main/java/com/simon/service/impl/BillServiceImpl.java index b8ba2460739af895c0233093a42c3e5733526913..67ca9f4be707a036d792491fe7a2e55e2cfd1b42 100644 --- a/web/src/main/java/com/simon/service/impl/BillServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/BillServiceImpl.java @@ -117,6 +117,21 @@ public class BillServiceImpl implements BillService { return billMapper.updateByPrimaryKeySelective(bill); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + List list = billMapper.getList(params); + return new PageInfo<>(list); + } + @Override public Bill createBill(BillRequest billRequest) { Bill bill = new Bill(); diff --git a/web/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java b/web/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java index 4b24b382e91806796f91f3708e7c54f736afccf0..66373265a72a425d28736152ab20321bba03f86c 100644 --- a/web/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java @@ -118,6 +118,21 @@ public class DictTypeGroupServiceImpl implements DictTypeGroupService { return dictTypeGroupMapper.updateByPrimaryKeySelective(dictTypeGroup); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + var list = dictTypeGroupMapper.getList(params); + return new PageInfo<>(list); + } + @Override public List getDtos(Integer limit, Integer offset) { List dtoList = new ArrayList<>(); diff --git a/web/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java b/web/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java index 5dd0809076db0f86ecd39f9f6fe53503bc931221..641b6f53c0f24cbb0ad5cf88646947bb71a9718c 100644 --- a/web/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java @@ -11,6 +11,7 @@ import com.simon.model.DictTypeGroup; import com.simon.repository.DictTypeGroupRepository; import com.simon.repository.DictTypeRepository; import com.simon.service.DictTypeService; +import lombok.var; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -117,6 +119,21 @@ public class DictTypeServiceImpl implements DictTypeService { return dictTypeMapper.updateByPrimaryKeySelective(dictType); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + var list = dictTypeMapper.getList(params); + return new PageInfo<>(list); + } + @Override public List getTypeByGroupCode(String groupCode) { return dictTypeMapper.getByGroupCode(groupCode); diff --git a/web/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java b/web/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java index 24d732d47e233433903cfb3ae86543136e6c2558..386f93c2550279bcf238f26e7344228ef1a26a02 100644 --- a/web/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/NewsTagServiceImpl.java @@ -8,6 +8,7 @@ import com.simon.mapper.NewsTagMapper; import com.simon.model.NewsTag; import com.simon.repository.NewsTagRepository; import com.simon.service.NewsTagService; +import lombok.var; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -16,6 +17,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -109,4 +111,19 @@ public class NewsTagServiceImpl implements NewsTagService { public int updateByPrimaryKeySelective(NewsTag newsTag) { return newsTagMapper.updateByPrimaryKeySelective(newsTag); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + var list = newsTagMapper.getList(params); + return new PageInfo<>(list); + } } \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java b/web/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java index 3a920de869c09fe7042939762bfee1d6c9d3f359..b7a83823dd581a35b5a89f9c26ba69a7cf0ea11a 100644 --- a/web/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/NoticeMsgServiceImpl.java @@ -8,6 +8,7 @@ import com.simon.repository.NoticeMsgRepository; import com.simon.common.config.AppConfig; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import lombok.var; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -17,6 +18,7 @@ import org.apache.commons.lang3.StringUtils; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -110,4 +112,19 @@ public class NoticeMsgServiceImpl implements NoticeMsgService { public int updateByPrimaryKeySelective(NoticeMsg noticeMsg){ return noticeMsgMapper.updateByPrimaryKeySelective(noticeMsg); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + var list = noticeMsgMapper.getList(params); + return new PageInfo<>(list); + } } \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java b/web/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java index 6b0051f26ff3189cb933909133b9c0c4d20ff44a..7e1dc9142fdd92b8838746fca5923184ba4d9b30 100644 --- a/web/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/OauthUserServiceImpl.java @@ -8,11 +8,11 @@ import com.simon.common.exception.CodeInvalidException; import com.simon.common.exception.PhoneRegisteredException; import com.simon.common.exception.UserExistsException; import com.simon.common.exception.UserNotValidException; -import com.simon.common.utils.AccountValidatorUtil; +import com.simon.common.utils.ValidUtil; import com.simon.common.utils.BeanUtils; -import com.simon.common.utils.RandomUtil; import com.simon.common.utils.UsernameUtil; import com.simon.dto.StatisticDto; +import com.simon.mapper.AuthorityMapper; import com.simon.mapper.OauthUserMapper; import com.simon.model.Authority; import com.simon.model.OauthUser; @@ -22,7 +22,6 @@ import com.simon.repository.VeriCodeRepository; import com.simon.service.OauthUserService; import lombok.extern.slf4j.Slf4j; import lombok.var; -import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.Cache; @@ -34,6 +33,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -59,6 +59,9 @@ public class OauthUserServiceImpl implements OauthUserService { @Autowired private AuthorityRepository authorityRepository; + @Autowired + private AuthorityMapper authorityMapper; + @Autowired private CacheManager cacheManager; @@ -137,7 +140,27 @@ public class OauthUserServiceImpl implements OauthUserService { @Override public OauthUser save(OauthUser oauthUser) { - return oauthUserRepository.save(oauthUser); + oauthUser.setPassword(passwordEncoder.encode(oauthUser.getPassword())); + oauthUserMapper.insertSelective(oauthUser); + + if(StringUtils.isEmpty(oauthUser.getAuthorities())){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(AppConfig.ROLE_USER); + authorityMapper.insertSelective(authority); + }else{ + String[] authorities = oauthUser.getAuthorities().split(","); + List authorityList = new ArrayList<>(); + for(int i = 0; i < authorities.length; i++){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(authorities[i]); + authorityList.add(authority); + } + authorityMapper.insertList(authorityList); + } + + return oauthUser; } @Override @@ -201,13 +224,32 @@ public class OauthUserServiceImpl implements OauthUserService { } @Override - public int insert(OauthUser model) { - return oauthUserMapper.insert(model); + public int insert(OauthUser oauthUser) { + return insertSelective(oauthUser); } @Override - public int insertSelective(OauthUser model) { - return oauthUserMapper.insertSelective(model); + public int insertSelective(OauthUser oauthUser) { + oauthUser.setPassword(passwordEncoder.encode(oauthUser.getPassword())); + int result = oauthUserMapper.insertSelective(oauthUser); + + if(StringUtils.isEmpty(oauthUser.getAuthorities())){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(AppConfig.ROLE_USER); + authorityMapper.insertSelective(authority); + }else{ + String[] authorities = oauthUser.getAuthorities().split(","); + List authorityList = new ArrayList<>(); + for(int i = 0; i < authorities.length; i++){ + Authority authority = new Authority(); + authority.setUserId(oauthUser.getId()); + authority.setAuthority(authorities[i]); + authorityList.add(authority); + } + authorityMapper.insertList(authorityList); + } + return result; } //@CachePut(key="#model.username", cacheNames = {"oauthUserCache"}) @@ -313,10 +355,10 @@ public class OauthUserServiceImpl implements OauthUserService { @Override public OauthUser registerByAccountAndPwd(String account, String password) { - if(AccountValidatorUtil.isMobile(account)){ + if(ValidUtil.isMobile(account)){ //account是手机号 - }else if(AccountValidatorUtil.isEmail(account)){ + }else if(ValidUtil.isEmail(account)){ //account是邮箱 }else{ diff --git a/web/src/main/java/com/simon/service/impl/QuartzJobServiceImpl.java b/web/src/main/java/com/simon/service/impl/QuartzJobServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3b377e42cb725a55f1397e9e43a60048851fde5c --- /dev/null +++ b/web/src/main/java/com/simon/service/impl/QuartzJobServiceImpl.java @@ -0,0 +1,145 @@ + +package com.simon.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simon.common.config.AppConfig; +import com.simon.common.plugins.quartz.QuartzManage; +import com.simon.mapper.QuartzJobMapper; +import com.simon.model.QuartzJob; +import com.simon.repository.QuartzJobRepository; +import com.simon.service.QuartzJobService; +import lombok.extern.slf4j.Slf4j; +import lombok.var; +import org.apache.commons.lang3.StringUtils; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** +* @author SimonSun +* @date 2018-12-21 +**/ +@Slf4j +@Service +@Transactional(rollbackFor = {Exception.class}) +public class QuartzJobServiceImpl implements QuartzJobService { + @Autowired + private QuartzJobMapper quartzJobMapper; + + @Autowired + private QuartzJobRepository quartzJobRepository; + + @Autowired + private QuartzManage quartzManage; + + @Override + public long count() { + return quartzJobRepository.count(); + } + + @Override + public QuartzJob save(QuartzJob quartzJob){ + return quartzJobRepository.save(quartzJob); + } + + @Override + public List save(List quartzJobList) { + return quartzJobRepository.save(quartzJobList); + } + + @Override + public PageInfo findAll(Integer pageNo, Integer pageSize, String orderBy){ + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + List list = quartzJobMapper.selectAll(); + return new PageInfo<>(list); + } + + @Override + public Page findAll(Pageable pageable){ + return quartzJobRepository.findAll(pageable); + } + + @Override + public List findAll(){ + return quartzJobRepository.findAll(); + } + + @Override + public void delete(Long id){ + quartzJobRepository.delete(id); + } + + @Override + public int deleteByIds(String ids){ + return quartzJobMapper.deleteByIds(ids); + } + + @Override + public QuartzJob findById(Long id){ + return quartzJobRepository.findOne(id); + } + + @Override + public int insertList(List list){ + return quartzJobMapper.insertList(list); + } + + @Override + public int insert(QuartzJob quartzJob){ + return quartzJobMapper.insert(quartzJob); + } + + @Override + public int insertSelective(QuartzJob quartzJob){ + return quartzJobMapper.insertSelective(quartzJob); + } + + @Override + public int updateByPrimaryKey(QuartzJob quartzJob){ + return quartzJobMapper.updateByPrimaryKey(quartzJob); + } + + @Override + public int updateByPrimaryKeySelective(QuartzJob quartzJob){ + return quartzJobMapper.updateByPrimaryKeySelective(quartzJob); + } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + var list = quartzJobMapper.getList(params); + return new PageInfo<>(list); + } + + @Override + public void runJobsOnStart() throws ClassNotFoundException, InstantiationException, SchedulerException, IllegalAccessException { + List quartzJobs = quartzJobMapper.selectAll(); + for(QuartzJob quartzJob : quartzJobs){ + quartzManage.addJob(quartzJob); + } + quartzJobMapper.updateJobStatus(1); + } +} \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java b/web/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java index 8f65023838b0f381ac4c5b66d845c9c579032608..32d27bc78ecaf8542827a20569495bd78354ca99 100644 --- a/web/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/ResetPwdInfoServiceImpl.java @@ -8,6 +8,7 @@ import com.simon.mapper.ResetPwdInfoMapper; import com.simon.model.ResetPwdInfo; import com.simon.repository.ResetPwdInfoRepository; import com.simon.service.ResetPwdInfoService; +import lombok.var; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -16,6 +17,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Map; /** * @author SimonSun @@ -109,4 +111,19 @@ public class ResetPwdInfoServiceImpl implements ResetPwdInfoService { public int updateByPrimaryKeySelective(ResetPwdInfo resetPwdInfo) { return resetPwdInfoMapper.updateByPrimaryKeySelective(resetPwdInfo); } + + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + var list = resetPwdInfoMapper.getList(params); + return new PageInfo<>(list); + } } \ No newline at end of file diff --git a/web/src/main/java/com/simon/service/impl/SmsServiceImpl.java b/web/src/main/java/com/simon/service/impl/SmsServiceImpl.java index 0e85755a1175357779dbdc0dbe0efa6bbd075bf0..ff0f38eace6258ce7a0a4cf03d518ad7c5bdf8f3 100644 --- a/web/src/main/java/com/simon/service/impl/SmsServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/SmsServiceImpl.java @@ -2,6 +2,7 @@ package com.simon.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.simon.common.config.AppConfig; import com.simon.common.utils.SmsUtil; import com.simon.service.SmsService; import lombok.extern.slf4j.Slf4j; @@ -33,8 +34,8 @@ public class SmsServiceImpl implements SmsService { @Value("${sms.password}") private String password; - @Value("${sms.identity-code-msg-template}") - private String identityCodeMsgTemplate; + //@Value("${sms.identity-code-msg-template}") + private String identityCodeMsgTemplate = AppConfig.SMS_TEMPLATE; @Autowired private org.springframework.cache.CacheManager cacheManager; @@ -85,6 +86,9 @@ public class SmsServiceImpl implements SmsService { } } + //删除缓存 + cache.evict(mobile); + return result; } } diff --git a/web/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java b/web/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java index 41e71c727bd977d00c7700e150ab820e54184e7d..16a87d3b4df7dd402d6661ed1335c3665c957bc2 100644 --- a/web/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java +++ b/web/src/main/java/com/simon/service/impl/VeriCodeServiceImpl.java @@ -8,6 +8,7 @@ import com.simon.model.VeriCode; import com.simon.repository.VeriCodeRepository; import com.simon.service.VeriCodeService; import lombok.extern.slf4j.Slf4j; +import lombok.var; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -15,6 +16,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; /** * 验证码 @@ -112,6 +114,21 @@ public class VeriCodeServiceImpl implements VeriCodeService { return veriCodeMapper.updateByPrimaryKeySelective(veriCode); } + @Override + public PageInfo getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + var list = veriCodeMapper.getList(params); + return new PageInfo<>(list); + } + @Override public VeriCode findByPhone(String phone) { return veriCodeRepository.findByPhone(phone); diff --git a/web/src/main/java/com/simon/task/SampleTask.java b/web/src/main/java/com/simon/task/SampleTask.java new file mode 100644 index 0000000000000000000000000000000000000000..5f6015710c830ee0c44d39ca62d11ea824c1abf3 --- /dev/null +++ b/web/src/main/java/com/simon/task/SampleTask.java @@ -0,0 +1,23 @@ +package com.simon.task; + +import com.simon.common.utils.DateUtil; +import lombok.extern.slf4j.Slf4j; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import java.util.Date; + +/** + * 任务示例 + * + * @author simon + * @date 2018-12-21 + **/ +@Slf4j +public class SampleTask implements Job { + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + log.info(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")); + } +} diff --git a/web/src/main/resources/ehcache.xml b/web/src/main/resources/ehcache.xml index cad5d1a1abf76d8b52ffa1b2030844a2e30d659a..7b97cd4d955e36c09dbd6b1147240766e19cdf58 100644 --- a/web/src/main/resources/ehcache.xml +++ b/web/src/main/resources/ehcache.xml @@ -2,6 +2,24 @@ + + + + @@ -23,10 +41,12 @@ overflowToDisk="true" memoryStoreEvictionPolicy="LRU" /> - + diff --git a/web/src/main/resources/mapping/QuartzJobMapper.xml b/web/src/main/resources/mapping/QuartzJobMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4b92400d1b48f400be4873442fd4a8a91212390c --- /dev/null +++ b/web/src/main/resources/mapping/QuartzJobMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update t_s_quartz_job set job_status=#{jobStatus} + + \ No newline at end of file diff --git a/web/src/main/resources/static/css/easyui/common.css b/web/src/main/resources/static/css/easyui/common.css index ed47db891a47b17cd654d5639613a162ad4eafaf..0df2d83cb29361281c4792369323b5c1fb5b1412 100644 --- a/web/src/main/resources/static/css/easyui/common.css +++ b/web/src/main/resources/static/css/easyui/common.css @@ -15,4 +15,8 @@ form>div{ */ .button-group i.fa{ font-size:12px; +} + +.c-primary,.c-secondary,.c-success,.c-info,.c-warning,.c-danger,.c-dark,.c-light,.c-basic{ + } \ No newline at end of file diff --git a/web/src/main/resources/static/css/login/coverr.css b/web/src/main/resources/static/css/login/coverr.css new file mode 100644 index 0000000000000000000000000000000000000000..c4643ad8e39a6e636bcc630c19c495e5d3fc4cf9 --- /dev/null +++ b/web/src/main/resources/static/css/login/coverr.css @@ -0,0 +1,51 @@ +/** +* +* User: simon +* Date: 2018/06/09 +* Time: 3:14 +**/ +/** +* +* User: simon +* Date: 2018/06/09 +* Time: 3:14 +**/ +.homepage-hero-module { + border-right: none; + border-left: none; + position: relative; +} +.no-video .video-container video, +.touch .video-container video { + display: none; +} +.no-video .video-container .poster, +.touch .video-container .poster { + display: block !important; +} +.video-container { + position: relative; + bottom: 0%; + left: 0%; + height: 100%; + width: 100%; + overflow: hidden; +} +.video-container .poster img { + width: 100%; + bottom: 0; + position: absolute; +} +.video-container .filter { + z-index: 100; + position: absolute; + width: 100%; +} +.video-container video { + position: absolute; + z-index: 0; + bottom: 0; +} +.video-container video.fillWidth { + width: 100%; +} \ No newline at end of file diff --git a/web/src/main/resources/static/css/login/login.css b/web/src/main/resources/static/css/login/login.css new file mode 100644 index 0000000000000000000000000000000000000000..aa0e69525820c2f842ab81f6995a443c36e03f51 --- /dev/null +++ b/web/src/main/resources/static/css/login/login.css @@ -0,0 +1,59 @@ +/** +* +* User: simon +* Date: 2018/12/26 +* Time: 12:30 +**/ +body { + width: 100%; + height:100%; + overflow:scroll; + overflow-x:hidden; + overflow-y:hidden; +} + +#code,#codeimg{ + width:100%; + font-size:16px; + font-style:italic; + color:green; + border:0; + letter-spacing:3px; + font-weight:bolder; +} + +#qrcode { + width:200px; + height:200px; + text-align:center; + margin:0 auto; +} + +#refreshQrCode{ + visibility: hidden; + text-align:center; +} + +#jumpHint{ + display: none; + margin:0 auto 6px auto;//上右下左 +} + +.hint{ + color:white; + text-align:center; + margin: 0 auto; + border:1px solid #a1a1a1; + padding:6px 6px; + width:200px; + border-radius:25px; + -moz-border-radius:25px; /* 老的 Firefox */ +} + +.success{ + background-color: mediumseagreen; +} + +.warn{ + background-color: red; +} \ No newline at end of file diff --git a/web/src/main/resources/static/img/Concrete_Jungle.jpg b/web/src/main/resources/static/img/Concrete_Jungle.jpg deleted file mode 100644 index dfce8a1e9274c6acbcec87d03aebe043180fa32f..0000000000000000000000000000000000000000 Binary files a/web/src/main/resources/static/img/Concrete_Jungle.jpg and /dev/null differ diff --git a/web/src/main/resources/static/img/bg_login.jpg b/web/src/main/resources/static/img/bg_login.jpg new file mode 100644 index 0000000000000000000000000000000000000000..019c09522e6650607683b8c74f00e26c65cf01f2 Binary files /dev/null and b/web/src/main/resources/static/img/bg_login.jpg differ diff --git a/web/src/main/resources/static/js/easyui/common.js b/web/src/main/resources/static/js/easyui/common.js index bd8184d583462b3164cabc488b747e5161499f80..1291fd9df1ac206b1879816907e126cbb815cbfc 100644 --- a/web/src/main/resources/static/js/easyui/common.js +++ b/web/src/main/resources/static/js/easyui/common.js @@ -18,8 +18,8 @@ $(function(){ setTokenInHeader(); //只用一种初始化方法来声明easyUI组件以避免重复的提交请求,即删除html中的class声明(class="easyui-datagrid") - $('#tt').treegrid({ - onBeforeLoad: function (row, param) { + $('#tt').datagrid({ + onBeforeLoad: function (param) { let pageNo = param.page; delete param.page; param.pageNo = pageNo; @@ -41,6 +41,29 @@ $(function(){ } }); + $('#table_tg').treegrid({ + onBeforeLoad: function (row, param) { + let pageNo = param.page; + delete param.page; + param.pageNo = pageNo; + let pageSize = param.rows; + delete param.rows; + param.pageSize = pageSize; + let sort = param.sort; + delete param.sort; + let order = param.order; + delete param.order; + let orderBy = ((!sort) ? "" : sort) + " " + ((!order) ? "" : order); + orderBy = orderBy.trim(); + param.orderBy = orderBy; + }, + onLoadSuccess: function (row, data) { + //重新渲染 + $(".easyui-linkbutton").linkbutton(); + $(".easyui-numberbox").numberbox(); + } + }); + $('body').on('click', 'img.image-thumb',function (event) { $('#dlg').html('头像'); $('#dlg').dialog('open'); @@ -174,6 +197,37 @@ function formatDate(val, row){ return new Date(parseInt(val)).format('yyyy-MM-dd hh:mm:ss'); } +function commonRequest(options) { + $.ajax({ + url: options.url, + type: options.type, + data: JSON.stringify(options.extraData), + contentType: "application/json;charset=UTF-8", + beforeSend: function(){ + $.messager.progress({ + title: '提示信息', + msg: '请稍候......' + }); + }, + complete: function(){ + $.messager.progress('close'); + }, + success:function (data) { + console.log(data); + if(data.code == 200){ + $('#tt').datagrid('reload'); + $('#table_tg').treegrid('reload'); + $.messager.show({ + title:'提示信息', + msg:'操作成功!', + timeout:3000, + showType:'slide' + }); + } + } + }); +} + function doRequest(options) { if($(options.formId).form('validate')){ let requestData = $(options.formId).serializeArray(); @@ -213,7 +267,8 @@ function doRequest(options) { $('#addModal').window('close'); $('#editModal').window('close'); - $('#tt').treegrid('reload'); + $('#tt').datagrid('reload'); + $('#table_tg').treegrid('reload'); $.messager.show({ title:'提示信息', msg:'操作成功!', @@ -250,7 +305,8 @@ function emptyRequest(url) { if(data.code == 200){ $('#addModal').window('close'); $('#editModal').window('close'); - $('#tt').treegrid('reload'); + $('#tt').datagrid('reload'); + $('#table_tg').treegrid('reload'); $.messager.show({ title:'提示信息', msg:'操作成功!', @@ -295,6 +351,7 @@ function deleteRequest(urlPrefix){ $('#addModal').window('close'); $('#editModal').window('close'); $('#tt').treegrid('reload'); + $('#table_tg').treegrid('reload'); $.messager.show({ title:'提示信息', msg:'操作成功!', @@ -342,6 +399,7 @@ function deleteRequestByUserId(urlPrefix){ $('#addModal').window('close'); $('#editModal').window('close'); $('#tt').treegrid('reload'); + $('#table_tg').treegrid('reload'); $.messager.show({ title:'提示信息', msg:'操作成功!', @@ -464,7 +522,7 @@ $.extend($.fn.validatebox.defaults.rules, { //select即选择框的验证 selectValid:{ validator:function(value,param){ - console.log('selectValid' + value + '-' + param[0]); + //console.log('selectValid' + value + '-' + param[0]); if(value == param[0]){ return false; }else{ diff --git a/web/src/main/resources/static/js/login/coverr.js b/web/src/main/resources/static/js/login/coverr.js new file mode 100644 index 0000000000000000000000000000000000000000..4536ca007199b9104a7ad6eb41dd1e37a54c0b49 --- /dev/null +++ b/web/src/main/resources/static/js/login/coverr.js @@ -0,0 +1,63 @@ +//jQuery is required to run this code +$( document ).ready(function() { + + scaleVideoContainer(); + + initBannerVideoSize('.video-container .poster img'); + initBannerVideoSize('.video-container .filter'); + initBannerVideoSize('.video-container video'); + + $(window).on('resize', function() { + scaleVideoContainer(); + scaleBannerVideoSize('.video-container .poster img'); + scaleBannerVideoSize('.video-container .filter'); + scaleBannerVideoSize('.video-container video'); + }); + +}); + +function scaleVideoContainer() { + + var height = $(window).height() + 5; + var unitHeight = parseInt(height) + 'px'; + $('.homepage-hero-module').css('height',unitHeight); + +} + +function initBannerVideoSize(element){ + + $(element).each(function(){ + $(this).data('height', $(this).height()); + $(this).data('width', $(this).width()); + }); + + scaleBannerVideoSize(element); + +} + +function scaleBannerVideoSize(element){ + + var windowWidth = $(window).width(), + windowHeight = $(window).height() + 5, + videoWidth, + videoHeight; + + // console.log(windowHeight); + + $(element).each(function(){ + var videoAspectRatio = $(this).data('height')/$(this).data('width'); + + $(this).width(windowWidth); + + if(windowWidth < 1000){ + videoHeight = windowHeight; + videoWidth = videoHeight / videoAspectRatio; + $(this).css({'margin-top' : 0, 'margin-left' : -(videoWidth - windowWidth) / 2 + 'px'}); + + $(this).width(videoWidth).height(videoHeight); + } + + $('.homepage-hero-module .video-container video').addClass('fadeIn animated'); + + }); +} \ No newline at end of file diff --git a/web/src/main/resources/static/js/login/login-form.js b/web/src/main/resources/static/js/login/login-form.js new file mode 100644 index 0000000000000000000000000000000000000000..2a0b42bfae9235cdba4ab3c6062cf54b7caa71d3 --- /dev/null +++ b/web/src/main/resources/static/js/login/login-form.js @@ -0,0 +1,36 @@ +//账号密码登录 +$().ready(function() { + //createCode(); + + jQuery.validator.addMethod("password", function (value, element, param) { + var rex = /^(?![A-Z]+$)(?![a-z]+$)(?!\d+$)(?![\W_]+$)\S{6,16}$/; + return this.optional(element) || (rex.test(value)); + }, "必须包含数字、字母或特殊字符"); + + jQuery.validator.addMethod("vericode", function (value, element, param) { + return validate(value); + }, "验证码错误"); + + $("#loginForm").validate({ + rules:{ + username: { + required: true, + minlength: 1 + }, + password: { + required: true, + rangelength: [6,20], + password: true + }, + input_vericode: { + required: true, + minlength: 4, + vericode: true + } + }, + errorPlacement: function(error, element) { + error.appendTo(element.parent()); + }, + errorElement: "span" + }); +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/login/login-qrcode.js b/web/src/main/resources/static/js/login/login-qrcode.js new file mode 100644 index 0000000000000000000000000000000000000000..38dae7ef53b67c97d89998a75cd007e1cc548a9d --- /dev/null +++ b/web/src/main/resources/static/js/login/login-qrcode.js @@ -0,0 +1,76 @@ +//扫码登录 + +var qrCode = new QRCode(document.getElementById("qrcode"), { + width : 200, + height : 200 +}); + +var loopVar; + +function initQrCode(){ + console.log("initQrCode"); + + setTokenInHeader(); + + var qrCodeData = $.cookie('qrCodeData'); + //console.log(qrCodeData); + if(!qrCodeData || "null" == qrCodeData){ + refreshQrCode(); + }else{ + qrCode.makeCode(qrCodeData); + loop(); + } +} + +function refreshQrCode() { + $.getJSON("users/uuid", function (data) { + //存cookie + var expiresDate= new Date(); + expiresDate.setTime(expiresDate.getTime() + (2 * 60 * 1000));//2分钟过期 + $.cookie('qrCodeData', JSON.stringify(data),{ + expires: expiresDate + }); + + qrCode.makeCode(JSON.stringify(data)); + loop(); + }); +} + +//循环检查是否被扫码 +function loop() { + clearInterval(loopVar);//先清除上次的定时任务(防止用户反复在账号登录和二维码登录的图片间切换造成的多次循环检查问题。) + loopVar = setInterval(function () { + //获取qrCodeData + var qrCodeData = $.cookie('qrCodeData'); + //检查qrCodeData是否失效 + if(!qrCodeData){ + console.log("二维码已失效"); + clearInterval(loop); + $("#refreshQrCode").css("visibility","visible"); + }else{ + var cookieQrCode = JSON.parse(qrCodeData); + var sid = cookieQrCode.sid; + + $.getJSON("users/loopCheck/" + sid, function(data){ + //console.log(data); + if(data['code'] == 200){ + clearInterval(loop); + $.cookie('qrCodeData', null);//赋值"null"字符串 + $("#refreshQrCode").css("display", "none"); + $("#jumpHint").css("display", "block"); + setTimeout(function(){ + window.location.href = "/index"; + },2000); + }else if(data['code'] == 500){ + clearInterval(loopVar); + //console.log(data['message']); + } + }); + } + }, 1000); +} + +$("#refreshQrCode > a").click(function () { + $("#refreshQrCode").css("visibility","hidden"); + initQrCode(); +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/login/login.js b/web/src/main/resources/static/js/login/login.js new file mode 100644 index 0000000000000000000000000000000000000000..a7a964da6eca7485383823d0e85c669acbc34672 --- /dev/null +++ b/web/src/main/resources/static/js/login/login.js @@ -0,0 +1,27 @@ +$(function(){ + $(".switchMode").on({ + click:function(e){ + if($(this).attr("src").indexOf('qrcode-40x40.png') != -1){ + //$(this).attr("src", "img/pc-40x40.png"); + //window.location.href = "login?qrcode=true"; + var qrcode = $.cookie('qrcode'); + console.log("qrcode=" + qrcode); + if(qrcode == 'false' || !qrcode){ + console.log("准备执行initQrCode"); + $.cookie('qrcode', true); + initQrCode(); + } + $('#form-qrcode').css('display', 'inline'); + $('#form-normal').css('display', 'none'); + }else { + //$(this).attr("src", "img/qrcode-40x40.png"); + //window.location.href = "login"; + if(qrcode == true || !qrcode){ + $.cookie('qrcode', false); + } + $('#form-qrcode').css('display', 'none'); + $('#form-normal').css('display', 'inline'); + } + } + }); +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/login/vcode.js b/web/src/main/resources/static/js/login/vcode.js new file mode 100644 index 0000000000000000000000000000000000000000..c2611c7ad552ec1105fa566cbff96946dbd71007 --- /dev/null +++ b/web/src/main/resources/static/js/login/vcode.js @@ -0,0 +1,81 @@ +var code = ""; +$().ready(function() { + //将函数返回值赋给code + code = createCode(); + + //点击canvas图片更换验证码 + $("#codeimg").click(function () { + code = createCode(); + }); + + /*随机字符函数*/ + function rand(){ + //去掉i,I,l,o,O等易混淆字母 + var str="abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789"; + //将字符串分隔为数组 + var arr=str.split(""); + //随机字符在[0,56]之间 + var ranNum=Math.floor(Math.random()*57); + var captcha=arr[ranNum]; + return captcha; + } + + /*随机干扰线条函数*/ + function drawline(canvas, context) { + //若省略beginPath,则每点击一次验证码会累积干扰线的条数 + context.beginPath(); + //起点与终点在canvas宽高内随机 + context.moveTo(Math.floor(Math.random() * canvas.width), Math.floor(Math.random() * canvas.height)); + context.lineTo(Math.floor(Math.random() * canvas.width), Math.floor(Math.random() * canvas.height)); + context.lineWidth = 1; + context.strokeStyle = '#275DB3'; + context.stroke(); + } + + /*生成验证码*/ + function createCode(){ + //每次生成code先将其清空防止叠加 + code = ""; + var canvas = document.getElementById("codeimg"); + if(!canvas){ + return null; + } + var context = canvas.getContext("2d"); + + //清空画布 + context.clearRect(0, 0, canvas.width, canvas.height); + + context.strokeStyle = "#FFF"; + context.strokeRect(0, 0, canvas.width, canvas.height); + + //生成干扰线,数量随意 + for (var i = 0; i < 10; i++) { + drawline(canvas, context); + } + + //循环生成4位验证码 + for (var k = 0; k < 4; k++) { + context.font='76px Arial'; + //将初始状态保存 + context.save(); + //获得-1到1的随机数 + var rA = 1-Math.random()*2; + //获取随机倾斜角 + var angle = rA / 8 ; + var ranNum = rand(); + //旋转生成的随机字符 + context.rotate(angle); + //把rand()生成的随机数文本依次填充到canvas中,注意x坐标 + context.fillText(ranNum,20+45*k,100); + //恢复初始状态,以便下一次循环 + context.restore(); + code += ranNum; + } + //返回生成的验证码字符串 + return code; + } +}); + +function validate(value) { + return value.toUpperCase() === code.toUpperCase(); +} \ No newline at end of file diff --git a/web/src/main/resources/static/video/Concrete_Jungle.mp4 b/web/src/main/resources/static/video/Concrete_Jungle.mp4 deleted file mode 100644 index 704334d716d28227d3817a0f0b11df25d392bb23..0000000000000000000000000000000000000000 Binary files a/web/src/main/resources/static/video/Concrete_Jungle.mp4 and /dev/null differ diff --git a/web/src/main/resources/static/video/Concrete_Jungle.webm b/web/src/main/resources/static/video/Concrete_Jungle.webm deleted file mode 100644 index df7af39f330b0f10748f1550637983726e5ba56e..0000000000000000000000000000000000000000 Binary files a/web/src/main/resources/static/video/Concrete_Jungle.webm and /dev/null differ diff --git a/web/src/main/resources/templates/code/controllerWithPage.ftl b/web/src/main/resources/templates/code/controllerWithPage.ftl index dee9ce810c21bd77855f33cce851bd70b33d3eae..f116c3354b6a8cc7d128cea1c27b0c1a03085b23 100644 --- a/web/src/main/resources/templates/code/controllerWithPage.ftl +++ b/web/src/main/resources/templates/code/controllerWithPage.ftl @@ -71,7 +71,7 @@ public class ${entityName}Controller extends BaseController{ @PostMapping @ResponseBody public ResultMsg add(@RequestBody ${entityName} body){ - ${entityName?uncap_first}Service.save(body); + ${entityName?uncap_first}Service.insertSelective(body); return ResultMsg.success(); } diff --git a/web/src/main/resources/templates/code/list.ftl b/web/src/main/resources/templates/code/list.ftl index d5053d9d217a70a2ca62edd726660935e7f0f5d6..c60ba0af5e605d1767d6846b5de218902c8771c7 100644 --- a/web/src/main/resources/templates/code/list.ftl +++ b/web/src/main/resources/templates/code/list.ftl @@ -18,15 +18,13 @@ - - + +

-
-
- - - -
+
+ + +
@@ -105,7 +103,7 @@ }); function doSearch() { - $('#tt').treegrid('load', { + $('#tt').datagrid('load', { <#list columns as column> <#if column.allowSearch> <#switch column.easyuiType> diff --git a/web/src/main/resources/templates/code/mapper.ftl b/web/src/main/resources/templates/code/mapper.ftl index 3c345d3555c625fa506e46e00c653350f1cc1dad..39b615d9cfd799bb61b5e07b31e619af4a9a8262 100644 --- a/web/src/main/resources/templates/code/mapper.ftl +++ b/web/src/main/resources/templates/code/mapper.ftl @@ -1,15 +1,22 @@ package ${basePackage}.mapper; import ${basePackage}.common.mapper.MyMapper; -import ${basePackage}.model.DictTypeGroup; +import ${basePackage}.model.${modelNameUpperCamel}; +import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * ${modelNameUpperCamel} * @author ${AUTHOR} * @date ${CREATE} **/ -public interface DictTypeGroupMapper extends MyMapper<${modelNameUpperCamel}> { - +public interface ${modelNameUpperCamel}Mapper extends MyMapper<${modelNameUpperCamel}> { + /** + * 使用Map查询 + * @param map map查询条件 + * @return 查询结果 + */ + List<${modelNameUpperCamel}> getList(@Param("map") Map map); } \ No newline at end of file diff --git a/web/src/main/resources/templates/code/service-impl.ftl b/web/src/main/resources/templates/code/service-impl.ftl index 3659930066fd49cae7ae46f45ef1fef8b0610ada..8452993b64fb098d7835b1b18d3262ecfbd01f06 100644 --- a/web/src/main/resources/templates/code/service-impl.ftl +++ b/web/src/main/resources/templates/code/service-impl.ftl @@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * @author ${AUTHOR} @@ -113,4 +114,19 @@ public class ${modelNameUpperCamel}ServiceImpl implements ${modelNameUpperCamel} public int updateByPrimaryKeySelective(${modelNameUpperCamel} ${modelNameLowerCamel}){ return ${modelNameLowerCamel}Mapper.updateByPrimaryKeySelective(${modelNameLowerCamel}); } + + @Override + public PageInfo<${modelNameUpperCamel}> getList(Map params, Integer pageNo, Integer pageSize, String orderBy) { + if (null == pageSize){ + pageSize = AppConfig.DEFAULT_PAGE_SIZE; + } + orderBy = orderBy.trim(); + if (StringUtils.isEmpty(orderBy)){ + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(pageNo, pageSize, orderBy); + } + List<${modelNameUpperCamel}> list = ${modelNameLowerCamel}Mapper.getList(params); + return new PageInfo<>(list); + } } \ No newline at end of file diff --git a/web/src/main/resources/templates/components/easyui/easyui-list.html b/web/src/main/resources/templates/components/easyui/easyui-list.html index 20a1350dc1cb2f4c394007bf59e58bdbcdfc4dfc..ea4cf2e0c04f1ea6ce2b20510367c1cdf3260e9e 100644 --- a/web/src/main/resources/templates/components/easyui/easyui-list.html +++ b/web/src/main/resources/templates/components/easyui/easyui-list.html @@ -9,8 +9,10 @@ - - + + + + @@ -35,10 +37,9 @@
- - - - + + + diff --git a/web/src/main/resources/templates/components/easyui/easyui-module.html b/web/src/main/resources/templates/components/easyui/easyui-module.html new file mode 100644 index 0000000000000000000000000000000000000000..d851f6da3f6494f44f84672738e2ac97d6eecfaf --- /dev/null +++ b/web/src/main/resources/templates/components/easyui/easyui-module.html @@ -0,0 +1,13 @@ + + + + + + + EasyUI Module + + + + + \ No newline at end of file diff --git a/web/src/main/resources/templates/easyui/authority.html b/web/src/main/resources/templates/easyui/authority.html index b819af890356468d624ee397f735ae6da03af7bd..0e896578fd9417b2abb795ca3794a5d22c61d882 100644 --- a/web/src/main/resources/templates/easyui/authority.html +++ b/web/src/main/resources/templates/easyui/authority.html @@ -8,16 +8,13 @@ 用户id: 用户名: 权限: - - - + +
-
-
- - - -
+
+ + +
@@ -39,8 +36,8 @@
- - + +
@@ -54,15 +51,15 @@
- - + +
+ + \ No newline at end of file diff --git a/web/src/main/resources/templates/easyui/side_menu.html b/web/src/main/resources/templates/easyui/side_menu.html index 85ab18aee4d40c864bfbf4ea02fa36ac477ca254..548ff27c2ba011e5de662dadda99b4f89f042d6b 100644 --- a/web/src/main/resources/templates/easyui/side_menu.html +++ b/web/src/main/resources/templates/easyui/side_menu.html @@ -6,19 +6,16 @@
菜单名称: 权限: - - - + +
-
-
- - - -
+
+ + +
-
+
@@ -55,8 +52,8 @@
- - + +
@@ -88,8 +85,8 @@
- - + +
@@ -138,7 +135,7 @@ }); function doSearch() { - $('#tt').treegrid('load', { + $('#table_tg').treegrid('load', { name: $('#search_name').val(), authority: $('#search_authority').val() }); @@ -196,7 +193,7 @@ //获取选中的第一行数据 //var row = $('#tt').datagrid('getSelected'); //获取选中的所有行数据 - let rows = $('#tt').datagrid('getSelections'); + let rows = $('#table_tg').treegrid('getSelections'); if(rows.length == 1){ let row = rows[0]; console.log(row); @@ -209,6 +206,8 @@ $('#edit_icon').textbox('setValue', row.icon); $('#edit_orderNum').numberbox('setValue', '' + row.orderNum); $('#editModal').window('open'); + + $.parser.parse($('#edit_orderNum').parent()); }else{ $.messager.alert('提示信息','请选择一条数据!','error'); } diff --git a/web/src/main/resources/templates/easyui/tab2.html b/web/src/main/resources/templates/easyui/tab2.html index ef533ad3cbe26d64c9e82414bc5965b71d7f6418..01ad4e712ee36ef36a86fd05f2091062e8c38f8f 100644 --- a/web/src/main/resources/templates/easyui/tab2.html +++ b/web/src/main/resources/templates/easyui/tab2.html @@ -1,84 +1,51 @@ - + - - - - - - 日志管理 - - - - - - - - - - - - + + DataGrid Pagination - jQuery EasyUI Demo + + + + -
-
- 日志等级: - - - - -
-
- -
+

DataGrid Pagination Demo

+
+

Click the page bar to change page number or page size.

-
+

+ Pagination on + + Style + +

+ +
- - - - - - - +
id时间日志等级调用类调用方法调用行号Item ID
-
Dialog Content.
- - - - - - - \ No newline at end of file diff --git a/web/src/main/resources/templates/easyui/table_list.html b/web/src/main/resources/templates/easyui/table_list.html index c1d11ed4b7765118cba7c88d0a71ecd836c8ddc7..e12edf8b8186685520e01b88f5e9c9d21e7d29b6 100644 --- a/web/src/main/resources/templates/easyui/table_list.html +++ b/web/src/main/resources/templates/easyui/table_list.html @@ -5,8 +5,8 @@
表名: 表标注: - 查询 - + +
@@ -53,8 +53,8 @@
- 生成 - + 生成 +
@@ -62,6 +62,7 @@ - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\225\260\346\215\256\345\210\235\345\247\213\345\214\226\350\204\232\346\234\254.sql" "b/\346\225\260\346\215\256\345\210\235\345\247\213\345\214\226\350\204\232\346\234\254.sql" index aed2853da66d421a35f35cf76cbc2b98dbe9d6aa..b73363d28ade55d90349b97a2d7170a77bca9645 100644 --- "a/\346\225\260\346\215\256\345\210\235\345\247\213\345\214\226\350\204\232\346\234\254.sql" +++ "b/\346\225\260\346\215\256\345\210\235\345\247\213\345\214\226\350\204\232\346\234\254.sql" @@ -11,7 +11,7 @@ Target Server Version : 50709 File Encoding : 65001 - Date: 19/12/2018 17:24:28 + Date: 01/01/2019 21:18:21 */ SET NAMES utf8mb4; @@ -38,7 +38,7 @@ CREATE TABLE `logging_event` ( `caller_line` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `event_id` bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`event_id`) USING BTREE -) ENGINE = MyISAM AUTO_INCREMENT = 7451 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; +) ENGINE = MyISAM AUTO_INCREMENT = 8062 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for logging_event_exception @@ -79,8 +79,8 @@ CREATE TABLE `oauth_access_token` ( -- ---------------------------- -- Records of oauth_access_token -- ---------------------------- -INSERT INTO `oauth_access_token` VALUES ('dbdc89913760b5d103d72ee705359171', 0xACED0005737200436F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F4175746832416363657373546F6B656E0CB29E361B24FACE0200064C00156164646974696F6E616C496E666F726D6174696F6E74000F4C6A6176612F7574696C2F4D61703B4C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B4C000C72656672657368546F6B656E74003F4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F636F6D6D6F6E2F4F417574683252656672657368546F6B656E3B4C000573636F706574000F4C6A6176612F7574696C2F5365743B4C0009746F6B656E547970657400124C6A6176612F6C616E672F537472696E673B4C000576616C756571007E000578707372001E6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794D6170593614855ADCE7D002000078707372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000016768CC7807787372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E71007E0002787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C756571007E0005787074002436316338653237612D376662652D343037362D393333352D3336316466343735613737337371007E0009770800000168956410DD78737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C0001637400164C6A6176612F7574696C2F436F6C6C656374696F6E3B7870737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000023F40000000000001740010726561642C77726974652C74727573747874000662656172657274002434313832616336632D666638362D346331352D383338612D396633613936386266616562, '94bf174601ac4fe6414b91116b3cec6a', 'jeesun', 'clientIdPassword', 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A6578700000000277040000000273720019636F6D2E73696D6F6E2E6D6F64656C2E417574686F7269747900000000000000010200084C0009617574686F726974797400124C6A6176612F6C616E672F537472696E673B4C000863726561746542797400104C6A6176612F6C616E672F4C6F6E673B4C000A637265617465446174657400104C6A6176612F7574696C2F446174653B4C0002696471007E000F4C0008757064617465427971007E000F4C000A7570646174654461746571007E00104C000675736572496471007E000F4C0008757365726E616D6571007E000E787074000A524F4C455F41444D494E70707070707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000001707371007E000D740009524F4C455F55534552707070707071007E0015707871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B726564697265637455726971007E000E4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E001B787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000E4C001172657175657374506172616D657465727371007E00194C000573636F706571007E001B7870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E00197870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000677080000000800000003740009617574685F74797065740003736D7374000A6772616E745F7479706574000870617373776F7264740008757365726E616D657400066A656573756E78737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E002C770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000E7870740009524F4C455F555345527371007E003074000A524F4C455F41444D494E787371007E00213F40000000000000770800000010000000007870707371007E002C770C000000103F40000000000000787371007E002C770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017371007E00077371007E000B0000000277040000000271007E001171007E00167871007E003B737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00213F400000000000067708000000080000000371007E002371007E002471007E002571007E002671007E002771007E002878007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000E4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C0005626972746871007E00104C0005656D61696C71007E000E4C00096865616450686F746F71007E000E4C0002696471007E000F4C000870617373776F726471007E000E4C000B706572736F6E427269656671007E000E4C000570686F6E6571007E000E4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000E787001740012E6B19FE88B8FE79C81E88B8FE5B79EE5B882737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C75657871007E0014000000007371007E000B0000000277040000000271007E001171007E0016787372000D6A6176612E73716C2E4461746514FA46683F3566970200007872000E6A6176612E7574696C2E44617465686A81014B59741903000078707708000001662B3538007874001973696D6F6E2E73756E2E64657640686F746D61696C2E636F6D7400202F66696C6555706C6F61642F313439313830393330313531323531302E6A706771007E001574003C243261243131247434616B56636866674F7630305878422F5A4B4C6C4F6D7765556F4C2F4165643443694A71516A6169524C5A704255334157667875740009E5B7A8E89FB9E5AE8574000B3138333632313032343237737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870017400066A656573756E, 'b52303f8717138c559a95cc465faedda'); -INSERT INTO `oauth_access_token` VALUES ('94389ad24947e3d1fd9f776b681242f0', 0xACED0005737200436F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F4175746832416363657373546F6B656E0CB29E361B24FACE0200064C00156164646974696F6E616C496E666F726D6174696F6E74000F4C6A6176612F7574696C2F4D61703B4C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B4C000C72656672657368546F6B656E74003F4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F636F6D6D6F6E2F4F417574683252656672657368546F6B656E3B4C000573636F706574000F4C6A6176612F7574696C2F5365743B4C0009746F6B656E547970657400124C6A6176612F6C616E672F537472696E673B4C000576616C756571007E000578707372001E6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794D6170593614855ADCE7D002000078707372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000167704DBC01787372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E71007E0002787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C756571007E0005787074002463663131313963312D636363312D343130362D393363332D6165613932326461396635347371007E00097708000001689D7943C678737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C0001637400164C6A6176612F7574696C2F436F6C6C656374696F6E3B7870737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C74727573747874000662656172657274002439663464386430362D303763372D346335342D623038382D316139376238343665346336, '34f369fbcae782d72d9c6860c522f43a', 'user2711', 'clientIdPassword', 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A657870000000007704000000007871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B72656469726563745572697400124C6A6176612F6C616E672F537472696E673B4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E0011787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000F4C001172657175657374506172616D657465727371007E000E4C000573636F706571007E00117870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E000E7870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000677080000000800000003740009617574685F74797065740003736D7374000A6772616E745F7479706574000870617373776F7264740008757365726E616D6574000B313838363039303237313178737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E0022770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000F7870740009524F4C455F555345527371007E002674000A524F4C455F41444D494E787371007E00173F40000000000000770800000010000000007870707371007E0022770C000000103F40000000000000787371007E0022770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017372001F6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794C6973747AB817B43CA79EDE0200007870737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00173F400000000000067708000000080000000371007E001971007E001A71007E001B71007E001C71007E001D71007E001E78007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000F4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C000562697274687400104C6A6176612F7574696C2F446174653B4C0005656D61696C71007E000F4C00096865616450686F746F71007E000F4C000269647400104C6A6176612F6C616E672F4C6F6E673B4C000870617373776F726471007E000F4C000B706572736F6E427269656671007E000F4C000570686F6E6571007E000F4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000F787001707070737200126A6176612E73716C2E54696D657374616D702618D5C80153BF650200014900056E616E6F737872000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000016142A5880078000000007400133138383630393032373131403136332E636F6D707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000274003C24326124313124536D70654531425A715534342E585A457A564645522E5A6339424D72686D6D5843754C5177563043446E75344941623958393677437074000B3138383630393032373131737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870007400087573657232373131, 'e56da6428734c5bc15bbb2d97eab9314'); +INSERT INTO `oauth_access_token` VALUES ('dc6ce6b5152c9a97d34639ea87cd4d1a', 0xACED0005737200436F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F4175746832416363657373546F6B656E0CB29E361B24FACE0200064C00156164646974696F6E616C496E666F726D6174696F6E74000F4C6A6176612F7574696C2F4D61703B4C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B4C000C72656672657368546F6B656E74003F4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F636F6D6D6F6E2F4F417574683252656672657368546F6B656E3B4C000573636F706574000F4C6A6176612F7574696C2F5365743B4C0009746F6B656E547970657400124C6A6176612F6C616E672F537472696E673B4C000576616C756571007E000578707372001E6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794D6170593614855ADCE7D002000078707372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000167E98B65E4787372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E71007E0002787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C756571007E0005787074002436316338653237612D376662652D343037362D393333352D3336316466343735613737337371007E0009770800000168956410DD78737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C0001637400164C6A6176612F7574696C2F436F6C6C656374696F6E3B7870737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000023F40000000000001740010726561642C77726974652C74727573747874000662656172657274002435313737326663622D333061382D343934352D396565312D396166316130346431323965, '94bf174601ac4fe6414b91116b3cec6a', 'jeesun', 'clientIdPassword', 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A6578700000000277040000000273720019636F6D2E73696D6F6E2E6D6F64656C2E417574686F7269747900000000000000010200084C0009617574686F726974797400124C6A6176612F6C616E672F537472696E673B4C000863726561746542797400104C6A6176612F6C616E672F4C6F6E673B4C000A637265617465446174657400104C6A6176612F7574696C2F446174653B4C0002696471007E000F4C0008757064617465427971007E000F4C000A7570646174654461746571007E00104C000675736572496471007E000F4C0008757365726E616D6571007E000E787074000A524F4C455F41444D494E70707070707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000001707371007E000D740009524F4C455F55534552707070707071007E0015707871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B726564697265637455726971007E000E4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E001B787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000E4C001172657175657374506172616D657465727371007E00194C000573636F706571007E001B7870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E00197870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F400000000000037708000000040000000274000A6772616E745F7479706574000870617373776F7264740008757365726E616D657400066A656573756E78737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E002A770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000E7870740009524F4C455F555345527371007E002E74000A524F4C455F41444D494E787371007E00213F40000000000000770800000010000000007870707371007E002A770C000000103F40000000000000787371007E002A770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017371007E00077371007E000B0000000277040000000271007E001171007E00167871007E0039737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00213F400000000000067708000000080000000271007E002371007E002471007E002571007E002678007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000E4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C0005626972746871007E00104C0005656D61696C71007E000E4C00096865616450686F746F71007E000E4C0002696471007E000F4C000870617373776F726471007E000E4C000B706572736F6E427269656671007E000E4C000570686F6E6571007E000E4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000E787001740012E6B19FE88B8FE79C81E88B8FE5B79EE5B882737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C75657871007E0014000000127371007E000B0000000277040000000271007E001171007E0016787372000D6A6176612E73716C2E4461746514FA46683F3566970200007872000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000016460DF3C007874001973696D6F6E2E73756E2E64657640686F746D61696C2E636F6D7400202F66696C6555706C6F61642F313439313830393330313531323531302E6A706771007E001574003C243261243131247434616B56636866674F7630305878422F5A4B4C6C4F6D7765556F4C2F4165643443694A71516A6169524C5A704255334157667875740009E5B7A8E89FB9E5AE8574000B3138333632313032343237737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870017400066A656573756E, 'b52303f8717138c559a95cc465faedda'); +INSERT INTO `oauth_access_token` VALUES ('f96e5b9eca9bde64256e92af9bf816ec', 0xACED0005737200436F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F4175746832416363657373546F6B656E0CB29E361B24FACE0200064C00156164646974696F6E616C496E666F726D6174696F6E74000F4C6A6176612F7574696C2F4D61703B4C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B4C000C72656672657368546F6B656E74003F4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F636F6D6D6F6E2F4F417574683252656672657368546F6B656E3B4C000573636F706574000F4C6A6176612F7574696C2F5365743B4C0009746F6B656E547970657400124C6A6176612F6C616E672F537472696E673B4C000576616C756571007E000578707372001E6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794D6170593614855ADCE7D002000078707372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000167E9EE887D787372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E71007E0002787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C756571007E0005787074002463663131313963312D636363312D343130362D393363332D6165613932326461396635347371007E00097708000001689D7943C678737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C0001637400164C6A6176612F7574696C2F436F6C6C656374696F6E3B7870737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000023F40000000000001740010726561642C77726974652C74727573747874000662656172657274002462653637396438632D366337382D346630312D393034362D353337326230343165646162, '34f369fbcae782d72d9c6860c522f43a', 'user2711', 'clientIdPassword', 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A657870000000007704000000007871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B72656469726563745572697400124C6A6176612F6C616E672F537472696E673B4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E0011787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000F4C001172657175657374506172616D657465727371007E000E4C000573636F706571007E00117870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E000E7870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000677080000000800000003740009617574685F74797065740003736D7374000A6772616E745F7479706574000870617373776F7264740008757365726E616D6574000B313838363039303237313178737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E0022770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000F7870740009524F4C455F555345527371007E002674000A524F4C455F41444D494E787371007E00173F40000000000000770800000010000000007870707371007E0022770C000000103F40000000000000787371007E0022770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017372001F6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794C6973747AB817B43CA79EDE0200007870737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00173F400000000000067708000000080000000371007E001971007E001A71007E001B71007E001C71007E001D71007E001E78007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000F4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C000562697274687400104C6A6176612F7574696C2F446174653B4C0005656D61696C71007E000F4C00096865616450686F746F71007E000F4C000269647400104C6A6176612F6C616E672F4C6F6E673B4C000870617373776F726471007E000F4C000B706572736F6E427269656671007E000F4C000570686F6E6571007E000F4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000F787001707070737200126A6176612E73716C2E54696D657374616D702618D5C80153BF650200014900056E616E6F737872000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000016142A5880078000000007400133138383630393032373131403136332E636F6D707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000274003C24326124313124514979676A676273617A39756F4568686C4B38516F2E74304154674B3467544A6E7A676141736B336231617552726958723841564F7074000B3138383630393032373131737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870007400087573657232373131, 'e56da6428734c5bc15bbb2d97eab9314'); -- ---------------------------- -- Table structure for oauth_client_details @@ -135,8 +135,8 @@ CREATE TABLE `oauth_refresh_token` ( -- ---------------------------- -- Records of oauth_refresh_token -- ---------------------------- -INSERT INTO `oauth_refresh_token` VALUES ('b52303f8717138c559a95cc465faedda', 0xACED00057372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C75657400124C6A6176612F6C616E672F537472696E673B787074002436316338653237612D376662652D343037362D393333352D3336316466343735613737337372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000168956410DD78, 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A6578700000000277040000000273720019636F6D2E73696D6F6E2E6D6F64656C2E417574686F7269747900000000000000010200084C0009617574686F726974797400124C6A6176612F6C616E672F537472696E673B4C000863726561746542797400104C6A6176612F6C616E672F4C6F6E673B4C000A637265617465446174657400104C6A6176612F7574696C2F446174653B4C0002696471007E000F4C0008757064617465427971007E000F4C000A7570646174654461746571007E00104C000675736572496471007E000F4C0008757365726E616D6571007E000E787074000A524F4C455F41444D494E70707070707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000001707371007E000D740009524F4C455F55534552707070707071007E0015707871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B726564697265637455726971007E000E4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E001B787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000E4C001172657175657374506172616D657465727371007E00194C000573636F706571007E001B7870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E00197870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000677080000000800000003740009617574685F74797065740003736D7374000A6772616E745F7479706574000870617373776F7264740008757365726E616D657400066A656573756E78737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E002C770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000E7870740009524F4C455F555345527371007E003074000A524F4C455F41444D494E787371007E00213F40000000000000770800000010000000007870707371007E002C770C000000103F40000000000000787371007E002C770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017371007E00077371007E000B0000000277040000000271007E001171007E00167871007E003B737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00213F400000000000067708000000080000000371007E002371007E002471007E002571007E002671007E002771007E002878007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000E4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C0005626972746871007E00104C0005656D61696C71007E000E4C00096865616450686F746F71007E000E4C0002696471007E000F4C000870617373776F726471007E000E4C000B706572736F6E427269656671007E000E4C000570686F6E6571007E000E4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000E787001740012E6B19FE88B8FE79C81E88B8FE5B79EE5B882737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C75657871007E0014000000007371007E000B0000000277040000000271007E001171007E0016787372000D6A6176612E73716C2E4461746514FA46683F3566970200007872000E6A6176612E7574696C2E44617465686A81014B59741903000078707708000001662B3538007874001973696D6F6E2E73756E2E64657640686F746D61696C2E636F6D7400202F66696C6555706C6F61642F313439313830393330313531323531302E6A706771007E001574003C243261243131247434616B56636866674F7630305878422F5A4B4C6C4F6D7765556F4C2F4165643443694A71516A6169524C5A704255334157667875740009E5B7A8E89FB9E5AE8574000B3138333632313032343237737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870017400066A656573756E); -INSERT INTO `oauth_refresh_token` VALUES ('e56da6428734c5bc15bbb2d97eab9314', 0xACED00057372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C75657400124C6A6176612F6C616E672F537472696E673B787074002463663131313963312D636363312D343130362D393363332D6165613932326461396635347372000E6A6176612E7574696C2E44617465686A81014B59741903000078707708000001689D7943C678, 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A657870000000007704000000007871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B72656469726563745572697400124C6A6176612F6C616E672F537472696E673B4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E0011787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000F4C001172657175657374506172616D657465727371007E000E4C000573636F706571007E00117870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E000E7870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000677080000000800000003740009617574685F74797065740003736D7374000A6772616E745F7479706574000870617373776F7264740008757365726E616D6574000B313838363039303237313178737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E0022770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000F7870740009524F4C455F555345527371007E002674000A524F4C455F41444D494E787371007E00173F40000000000000770800000010000000007870707371007E0022770C000000103F40000000000000787371007E0022770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017372001F6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794C6973747AB817B43CA79EDE0200007870737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00173F400000000000067708000000080000000371007E001971007E001A71007E001B71007E001C71007E001D71007E001E78007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000F4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C000562697274687400104C6A6176612F7574696C2F446174653B4C0005656D61696C71007E000F4C00096865616450686F746F71007E000F4C000269647400104C6A6176612F6C616E672F4C6F6E673B4C000870617373776F726471007E000F4C000B706572736F6E427269656671007E000F4C000570686F6E6571007E000F4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000F787001707070737200126A6176612E73716C2E54696D657374616D702618D5C80153BF650200014900056E616E6F737872000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000016142A5880078000000007400133138383630393032373131403136332E636F6D707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000274003C24326124313124536D70654531425A715534342E585A457A564645522E5A6339424D72686D6D5843754C5177563043446E75344941623958393677437074000B3138383630393032373131737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870007400087573657232373131); +INSERT INTO `oauth_refresh_token` VALUES ('b52303f8717138c559a95cc465faedda', 0xACED00057372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C75657400124C6A6176612F6C616E672F537472696E673B787074002436316338653237612D376662652D343037362D393333352D3336316466343735613737337372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000168956410DD78, 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A6578700000000277040000000273720019636F6D2E73696D6F6E2E6D6F64656C2E417574686F7269747900000000000000010200084C0009617574686F726974797400124C6A6176612F6C616E672F537472696E673B4C000863726561746542797400104C6A6176612F6C616E672F4C6F6E673B4C000A637265617465446174657400104C6A6176612F7574696C2F446174653B4C0002696471007E000F4C0008757064617465427971007E000F4C000A7570646174654461746571007E00104C000675736572496471007E000F4C0008757365726E616D6571007E000E787074000A524F4C455F41444D494E70707070707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000001707371007E000D740009524F4C455F55534552707070707071007E0015707871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B726564697265637455726971007E000E4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E001B787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000E4C001172657175657374506172616D657465727371007E00194C000573636F706571007E001B7870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E00197870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F400000000000037708000000040000000274000A6772616E745F7479706574000870617373776F7264740008757365726E616D657400066A656573756E78737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E002A770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000E7870740009524F4C455F555345527371007E002E74000A524F4C455F41444D494E787371007E00213F40000000000000770800000010000000007870707371007E002A770C000000103F40000000000000787371007E002A770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017371007E00077371007E000B0000000277040000000271007E001171007E00167871007E0039737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00213F400000000000067708000000080000000271007E002371007E002471007E002571007E002678007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000E4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C0005626972746871007E00104C0005656D61696C71007E000E4C00096865616450686F746F71007E000E4C0002696471007E000F4C000870617373776F726471007E000E4C000B706572736F6E427269656671007E000E4C000570686F6E6571007E000E4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000E787001740012E6B19FE88B8FE79C81E88B8FE5B79EE5B882737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C75657871007E0014000000127371007E000B0000000277040000000271007E001171007E0016787372000D6A6176612E73716C2E4461746514FA46683F3566970200007872000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000016460DF3C007874001973696D6F6E2E73756E2E64657640686F746D61696C2E636F6D7400202F66696C6555706C6F61642F313439313830393330313531323531302E6A706771007E001574003C243261243131247434616B56636866674F7630305878422F5A4B4C6C4F6D7765556F4C2F4165643443694A71516A6169524C5A704255334157667875740009E5B7A8E89FB9E5AE8574000B3138333632313032343237737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870017400066A656573756E); +INSERT INTO `oauth_refresh_token` VALUES ('e56da6428734c5bc15bbb2d97eab9314', 0xACED00057372004C6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744578706972696E674F417574683252656672657368546F6B656E2FDF47639DD0C9B70200014C000A65787069726174696F6E7400104C6A6176612F7574696C2F446174653B787200446F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E636F6D6D6F6E2E44656661756C744F417574683252656672657368546F6B656E73E10E0A6354D45E0200014C000576616C75657400124C6A6176612F6C616E672F537472696E673B787074002463663131313963312D636363312D343130362D393363332D6165613932326461396635347372000E6A6176612E7574696C2E44617465686A81014B59741903000078707708000001689D7943C678, 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A657870000000007704000000007871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B72656469726563745572697400124C6A6176612F6C616E672F537472696E673B4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E0011787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000F4C001172657175657374506172616D657465727371007E000E4C000573636F706571007E00117870740010636C69656E74496450617373776F7264737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E000E7870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000677080000000800000003740009617574685F74797065740003736D7374000A6772616E745F7479706574000870617373776F7264740008757365726E616D6574000B313838363039303237313178737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F40000000000001740010726561642C77726974652C747275737478017371007E0022770C000000103F40000000000002737200426F72672E737072696E676672616D65776F726B2E73656375726974792E636F72652E617574686F726974792E53696D706C654772616E746564417574686F7269747900000000000001A40200014C0004726F6C6571007E000F7870740009524F4C455F555345527371007E002674000A524F4C455F41444D494E787371007E00173F40000000000000770800000010000000007870707371007E0022770C000000103F40000000000000787371007E0022770C000000103F40000000000000787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000001A40200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017372001F6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794C6973747AB817B43CA79EDE0200007870737200176A6176612E7574696C2E4C696E6B6564486173684D617034C04E5C106CC0FB0200015A000B6163636573734F726465727871007E00173F400000000000067708000000080000000371007E001971007E001A71007E001B71007E001C71007E001D71007E001E78007073720022636F6D2E73696D6F6E2E636F6D6D6F6E2E646F6D61696E2E55736572456E7469747927563A93CB7D3A4C02000D5A0007656E61626C65644C00076164647265737371007E000F4C00036167657400134C6A6176612F6C616E672F496E74656765723B4C000B617574686F72697469657371007E00084C000562697274687400104C6A6176612F7574696C2F446174653B4C0005656D61696C71007E000F4C00096865616450686F746F71007E000F4C000269647400104C6A6176612F6C616E672F4C6F6E673B4C000870617373776F726471007E000F4C000B706572736F6E427269656671007E000F4C000570686F6E6571007E000F4C00037365787400134C6A6176612F6C616E672F426F6F6C65616E3B4C0008757365726E616D6571007E000F787001707070737200126A6176612E73716C2E54696D657374616D702618D5C80153BF650200014900056E616E6F737872000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000016142A5880078000000007400133138383630393032373131403136332E636F6D707372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000274003C243261243131242F464A564C646F3478304261645075745345687733654C6879486B6B4C6A6F585944445479324D654A49316A385548424F4E6F45437074000B3138383630393032373131737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C75657870007400087573657232373131); -- ---------------------------- -- Table structure for t_account_bind @@ -178,10 +178,10 @@ CREATE TABLE `t_authorities` ( -- ---------------------------- -- Records of t_authorities -- ---------------------------- -INSERT INTO `t_authorities` VALUES (1, NULL, NULL, NULL, NULL, 1, 'ROLE_ADMIN'); -INSERT INTO `t_authorities` VALUES (2, NULL, NULL, NULL, NULL, 1, 'ROLE_USER'); -INSERT INTO `t_authorities` VALUES (3, NULL, NULL, NULL, NULL, 2, 'ROLE_ADMIN'); -INSERT INTO `t_authorities` VALUES (4, NULL, NULL, NULL, NULL, 3, 'ROLE_USER'); +INSERT INTO `t_authorities` VALUES (1, NULL, NULL, NULL, NULL, 1000000000, 'ROLE_ADMIN'); +INSERT INTO `t_authorities` VALUES (2, NULL, NULL, NULL, NULL, 1000000000, 'ROLE_USER'); +INSERT INTO `t_authorities` VALUES (3, NULL, NULL, NULL, NULL, 1000000002, 'ROLE_ADMIN'); +INSERT INTO `t_authorities` VALUES (4, NULL, NULL, NULL, NULL, 1000000003, 'ROLE_USER'); -- ---------------------------- -- Table structure for t_bill @@ -253,7 +253,7 @@ CREATE TABLE `t_dict_type` ( `order_num` int(4) NULL DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) USING BTREE, INDEX `fk_type_group_id`(`type_group_id`) USING BTREE -) ENGINE = MyISAM AUTO_INCREMENT = 106353713701978113 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典' ROW_FORMAT = Dynamic; +) ENGINE = MyISAM AUTO_INCREMENT = 108265787696873473 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_dict_type @@ -318,6 +318,8 @@ INSERT INTO `t_dict_type` VALUES (106350652392734720, NULL, '2018-12-18 09:32:29 INSERT INTO `t_dict_type` VALUES (106351861832876032, NULL, '2018-12-18 09:38:29', NULL, NULL, 'rich_text', '富文本', 99135515659337729, 'easyui_component', 1); INSERT INTO `t_dict_type` VALUES (106353594952843264, NULL, '2018-12-18 09:44:11', NULL, NULL, 't:select', 't:select', 99135515659337729, 'easyui_component', NULL); INSERT INTO `t_dict_type` VALUES (106353713701978112, NULL, '2018-12-18 09:44:39', NULL, NULL, 't:dict', 't:dict', 99135515659337729, 'easyui_component', NULL); +INSERT INTO `t_dict_type` VALUES (108265713587716096, NULL, '2018-12-23 16:24:47', NULL, NULL, '1', 'on', 108265224984854528, 'job_status', 1); +INSERT INTO `t_dict_type` VALUES (108265787696873472, NULL, '2018-12-23 18:01:51', NULL, NULL, '0', 'off', 108265224984854528, 'job_status', 2); -- ---------------------------- -- Table structure for t_dict_type_group @@ -332,7 +334,7 @@ CREATE TABLE `t_dict_type_group` ( `type_group_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典组编码', `type_group_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典组名称', PRIMARY KEY (`id`) USING BTREE -) ENGINE = MyISAM AUTO_INCREMENT = 99135515659337730 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典组' ROW_FORMAT = Dynamic; +) ENGINE = MyISAM AUTO_INCREMENT = 108265224984854529 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典组' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_dict_type_group @@ -350,6 +352,7 @@ INSERT INTO `t_dict_type_group` VALUES (97365554750291968, NULL, '2018-11-23 14: INSERT INTO `t_dict_type_group` VALUES (97535843673047040, NULL, '2018-11-24 01:45:35', NULL, NULL, 'msg_type', '消息类型'); INSERT INTO `t_dict_type_group` VALUES (99135515659337728, NULL, '2018-11-28 11:42:07', NULL, NULL, 'news_type', '新闻类型'); INSERT INTO `t_dict_type_group` VALUES (99135515659337729, NULL, NULL, NULL, NULL, 'easyui_component', 'EasyUI组件'); +INSERT INTO `t_dict_type_group` VALUES (108265224984854528, NULL, '2018-12-23 16:20:19', NULL, NULL, 'job_status', 'job状态'); -- ---------------------------- -- Table structure for t_log_login @@ -411,7 +414,7 @@ CREATE TABLE `t_news_info` ( INSERT INTO `t_news_info` VALUES (1, 1, '2018-11-15 21:58:04', 1, '2018-11-15 21:58:07', '被库克批评之后,扎克伯格下令FB高管都用安卓手机', 1, 1, '

大苏打\"gangtiexia.jpg\"/

', '/fileUpload/6026febf5dc24c5a9ffdeefa9c727364.jpeg', '2018-11-15 22:08:18', NULL, 0); INSERT INTO `t_news_info` VALUES (94611785297952768, NULL, '2018-11-16 00:08:52', NULL, '2018-11-16 00:08:49', '标题测试', NULL, NULL, '

的撒大苏打

', NULL, '2018-11-16 00:08:59', NULL, 0); INSERT INTO `t_news_info` VALUES (94775027517358080, NULL, NULL, NULL, NULL, '图片上传测试', NULL, NULL, '

', NULL, NULL, NULL, 0); -INSERT INTO `t_news_info` VALUES (94776970356719616, NULL, NULL, NULL, NULL, '再次测试图片上传', NULL, NULL, '

', NULL, NULL, NULL, 0); +INSERT INTO `t_news_info` VALUES (94776970356719616, NULL, NULL, NULL, NULL, '再次测试图片上传', NULL, NULL, '

\"f498e01633b5b704ebfe0385f52bad20.jpg\"

', NULL, NULL, NULL, 0); INSERT INTO `t_news_info` VALUES (99132408858673152, NULL, NULL, NULL, NULL, '测试图文混排', NULL, NULL, '

测试图文混排

', NULL, NULL, NULL, 1); INSERT INTO `t_news_info` VALUES (99132665180979200, NULL, NULL, NULL, NULL, '新图文混排', NULL, NULL, '

测试图文混排

', NULL, NULL, NULL, 1); @@ -481,6 +484,33 @@ CREATE TABLE `t_reset_pwd_info` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; +-- ---------------------------- +-- Table structure for t_s_quartz_job +-- ---------------------------- +DROP TABLE IF EXISTS `t_s_quartz_job`; +CREATE TABLE `t_s_quartz_job` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建人id', + `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` bigint(20) NULL DEFAULT NULL COMMENT '更新人id', + `update_date` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `cron_expression` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'cron表达式', + `method_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务调用的方法名', + `is_concurrent` int(4) NULL DEFAULT NULL COMMENT '任务是否有状态', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `bean_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '全限定名', + `trigger_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '触发器名称', + `job_status` int(4) NULL DEFAULT NULL COMMENT '任务状态', + `spring_bean` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `job_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务名', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'quartz任务' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of t_s_quartz_job +-- ---------------------------- +INSERT INTO `t_s_quartz_job` VALUES (1, 1, '2018-12-21 22:21:26', 1000000000, '2019-01-01 21:08:28', '*/5 * * * * ?', 'execute', 0, '测试', 'com.simon.task.SampleTask', 'org.quartz.CronTrigger', 0, NULL, 'com.simon.task.SampleTask'); + -- ---------------------------- -- Table structure for t_side_menu -- ---------------------------- @@ -498,7 +528,7 @@ CREATE TABLE `t_side_menu` ( `pid` bigint(20) NULL DEFAULT NULL COMMENT '菜单组id', `order_num` int(4) NULL DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) USING BTREE -) ENGINE = MyISAM AUTO_INCREMENT = 97352700890447873 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '侧边菜单表' ROW_FORMAT = Dynamic; +) ENGINE = MyISAM AUTO_INCREMENT = 107876685461848065 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '侧边菜单表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_side_menu @@ -510,6 +540,7 @@ INSERT INTO `t_side_menu` VALUES (90997036798705664, NULL, NULL, NULL, NULL, 'dr INSERT INTO `t_side_menu` VALUES (8, NULL, NULL, NULL, NULL, '菜单管理', '/sideMenus?easyui-list', 'ROLE_ADMIN', 'fa fa-list-ol', 1, 1); INSERT INTO `t_side_menu` VALUES (94108390556434432, NULL, '2018-11-14 14:46:07', NULL, NULL, '了解OauthServer', '/easyui/home.html', 'ROLE_USER,ROLE_ADMIN,ROLE_SU', '', 94105929343041536, 1); INSERT INTO `t_side_menu` VALUES (1, NULL, NULL, NULL, NULL, '系统管理', '', 'ROLE_ADMIN,ROLE_SU', 'fa fa-cog', 0, 2); +INSERT INTO `t_side_menu` VALUES (107876685461848064, NULL, '2018-12-22 14:36:24', NULL, NULL, '定时任务', '/api/quartzJobs?easyui-list', 'ROLE_ADMIN,ROLE_SU', 'fa fa-user', 1, NULL); INSERT INTO `t_side_menu` VALUES (93126997827387392, NULL, NULL, NULL, NULL, '日志管理', '/api/loggingEvents?easyui-list', 'ROLE_USER', 'fa fa-book', 90995059306004480, 4); INSERT INTO `t_side_menu` VALUES (79367527003586560, NULL, NULL, NULL, NULL, '二级菜单测试', NULL, 'ROLE_USER,ROLE_ADMIN', 'fa fa-user', 79360945591156736, 1); INSERT INTO `t_side_menu` VALUES (80832133433655296, NULL, NULL, NULL, NULL, '代码生成', '/tables?easyui-list', 'ROLE_ADMIN', 'fa fa-table', 90995059306004480, NULL); @@ -534,7 +565,7 @@ CREATE TABLE `t_users` ( `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', `enabled` tinyint(1) NOT NULL COMMENT '有效', `area_code` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机区号', - `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号', + `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '手机号', `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱', `ssoid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'oppo账号ssoid', `album_id` bigint(20) NULL DEFAULT NULL COMMENT '播放列表id', @@ -549,18 +580,19 @@ CREATE TABLE `t_users` ( `login_status` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登录状态', `login_date` datetime(0) NULL DEFAULT NULL COMMENT '登录时间', PRIMARY KEY (`id`) USING BTREE, - INDEX `email`(`email`) USING BTREE, - INDEX `phone`(`phone`) USING BTREE -) ENGINE = MyISAM AUTO_INCREMENT = 88613627539488769 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; + UNIQUE INDEX `phone`(`phone`) USING BTREE, + INDEX `email`(`email`) USING BTREE +) ENGINE = MyISAM AUTO_INCREMENT = 1000000006 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_users -- ---------------------------- -INSERT INTO `t_users` VALUES (1, NULL, NULL, NULL, NULL, 'jeesun', '$2a$11$t4akVchfgOv00XxB/ZKLlOmweUoL/Aed4CiJqQjaiRLZpBU3AWfxu', 1, '+86', '18362102427', 'simon.sun.dev@hotmail.com', NULL, NULL, '江苏省苏州市', 18, '2018-07-04', '/fileUpload/1491809301512510.jpg', '巨蟹宅', 1, NULL, NULL, NULL, NULL); -INSERT INTO `t_users` VALUES (2, NULL, NULL, NULL, NULL, 'user2711', '$2a$11$BUiKPp8.pcym7sxXYPvZeOjl0BOoVl3PZT.1Wfb3kmIgooO/GfQ4G', 1, '+86', '18860902711', '18860902711@163.com', NULL, NULL, NULL, NULL, '2018-01-30', NULL, NULL, 0, NULL, NULL, NULL, '2018-10-27 02:56:23'); -INSERT INTO `t_users` VALUES (3, NULL, NULL, NULL, NULL, 'user6745', '$2a$11$a7XDbu2RvLjZdr4kCvqh2u7gwVXhwxdauIzbX3ZizbBU.HeV8BOky', 1, '+86', '18550046745', NULL, NULL, NULL, NULL, NULL, '2009-09-14', NULL, NULL, 0, NULL, NULL, NULL, '2018-10-27 03:38:24'); -INSERT INTO `t_users` VALUES (88603625256910848, NULL, NULL, NULL, NULL, 'simon', '123456', 1, '+86', '18362102427', NULL, NULL, NULL, NULL, NULL, NULL, '/fileUpload/微信图片_20181016142155.png', NULL, 0, NULL, NULL, NULL, NULL); -INSERT INTO `t_users` VALUES (88612918546923520, NULL, NULL, NULL, NULL, 'sss', '$2a$11$rTQdNRld6Cc02vK9btH6tupdQW7aqbfcNlaD8ioigbADeHJWEcLM6', 1, '+86', '', '', NULL, NULL, NULL, NULL, NULL, NULL, '', 1, NULL, NULL, NULL, NULL); +INSERT INTO `t_users` VALUES (1000000000, NULL, NULL, NULL, NULL, 'jeesun', '$2a$11$t4akVchfgOv00XxB/ZKLlOmweUoL/Aed4CiJqQjaiRLZpBU3AWfxu', 1, '+86', '18362102427', 'simon.sun.dev@hotmail.com', NULL, NULL, '江苏省苏州市', 18, '2018-07-04', '/fileUpload/1491809301512510.jpg', '巨蟹宅', 1, NULL, NULL, NULL, NULL); +INSERT INTO `t_users` VALUES (1000000001, NULL, NULL, NULL, NULL, 'user2711', '$2a$11$BUiKPp8.pcym7sxXYPvZeOjl0BOoVl3PZT.1Wfb3kmIgooO/GfQ4G', 1, '+86', '18860902711', '18860902711@163.com', NULL, NULL, NULL, NULL, '2018-01-30', NULL, NULL, 0, NULL, NULL, NULL, '2018-10-27 02:56:23'); +INSERT INTO `t_users` VALUES (1000000002, NULL, NULL, NULL, NULL, 'user6745', '$2a$11$a7XDbu2RvLjZdr4kCvqh2u7gwVXhwxdauIzbX3ZizbBU.HeV8BOky', 1, '+86', '18550046745', '', NULL, NULL, NULL, NULL, '2009-09-14', NULL, NULL, 0, NULL, NULL, NULL, '2018-10-27 03:38:24'); +INSERT INTO `t_users` VALUES (1000000003, NULL, NULL, NULL, NULL, 'simon', '$2a$11$t4akVchfgOv00XxB/ZKLlOmweUoL/Aed4CiJqQjaiRLZpBU3AWfxu', 1, '+86', '18362102421', '', NULL, NULL, NULL, NULL, NULL, '/fileUpload/微信图片_20181016142155.png', NULL, 0, NULL, NULL, NULL, NULL); +INSERT INTO `t_users` VALUES (1000000004, NULL, NULL, NULL, NULL, 'sss', '$2a$11$rTQdNRld6Cc02vK9btH6tupdQW7aqbfcNlaD8ioigbADeHJWEcLM6', 1, '+86', '18362202422', '', NULL, NULL, NULL, NULL, NULL, NULL, '', 1, NULL, NULL, NULL, NULL); +INSERT INTO `t_users` VALUES (1000000005, NULL, NULL, NULL, NULL, 'admin', '$2a$11$7pwrZUA2nOx8jWr6P1H3f.eEsmUnFmzZOs1jVxEEQSXa3HForbGKS', 1, '+86', '18362102622', '', NULL, NULL, '', NULL, NULL, NULL, '', 1, NULL, NULL, NULL, NULL); -- ---------------------------- -- Table structure for t_veri_code diff --git "a/\351\234\200\350\246\201\345\256\211\350\243\205\347\232\204jars/easyui-1.7.0.jar" "b/\351\234\200\350\246\201\345\256\211\350\243\205\347\232\204jars/easyui-1.7.0.jar" new file mode 100644 index 0000000000000000000000000000000000000000..f20d289f975fc2a4af4544e2aaa8c1297441ed3f Binary files /dev/null and "b/\351\234\200\350\246\201\345\256\211\350\243\205\347\232\204jars/easyui-1.7.0.jar" differ diff --git "a/\351\234\200\350\246\201\345\256\211\350\243\205\347\232\204jars/install.bat" "b/\351\234\200\350\246\201\345\256\211\350\243\205\347\232\204jars/install.bat" index fe7602109352b251249a5989140f436e74f8b03b..0386c8b34eb21458fb184e93198dcd8ce8f311d6 100644 --- "a/\351\234\200\350\246\201\345\256\211\350\243\205\347\232\204jars/install.bat" +++ "b/\351\234\200\350\246\201\345\256\211\350\243\205\347\232\204jars/install.bat" @@ -1,4 +1,4 @@ call mvn install:install-file -Dfile=taobao-sdk-java-auto_1455552377940-20160607.jar -DgroupId=com.alibaba -DartifactId=dayu -Dversion=1.0 -Dpackaging=jar call mvn install:install-file -Dfile=taobao-sdk-java-auto_1455552377940-20160607-source.jar -DgroupId=com.alibaba -DartifactId=dayu-source -Dversion=1.0 -Dpackaging=jar -call mvn install:install-file -Dfile=easyui-1.6.10.jar -DgroupId=org.webjars -DartifactId=easyui -Dversion=1.6.10 -Dpackaging=jar +call mvn install:install-file -Dfile=easyui-1.7.0.jar -DgroupId=org.webjars -DartifactId=easyui -Dversion=1.7.0 -Dpackaging=jar call mvn install:install-file -Dfile=FroalaWysiwygEditor-2.8.5.jar -DgroupId=org.webjars.bower -DartifactId=FroalaWysiwygEditor -Dversion=2.8.5 -Dpackaging=jar \ No newline at end of file