添加 redstar-book , 这是一个文档查看工具
This commit is contained in:
parent
8bda35d4ee
commit
6530c7ba05
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.2.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<groupId>redstar</groupId>
|
||||
<artifactId>redstar-book</artifactId>
|
||||
<version>1.00</version>
|
||||
<name>redstar-book</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibeetl</groupId>
|
||||
<artifactId>beetl-framework-starter</artifactId>
|
||||
<version>1.2.38.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.commonmark</groupId>
|
||||
<artifactId>commonmark</artifactId>
|
||||
<version>0.18.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.commonmark</groupId>
|
||||
<artifactId>commonmark-ext-gfm-tables</artifactId>
|
||||
<version>0.18.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.Banner;
|
||||
import org.springframework.boot.ansi.AnsiOutput;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.core.SpringVersion;
|
||||
|
||||
@Slf4j
|
||||
@ComponentScan({"business.page,redstar.framework"})
|
||||
@SpringBootApplication
|
||||
public class RedstarApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 设置显示颜色
|
||||
AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS);
|
||||
new SpringApplicationBuilder(RedstarApplication.class)
|
||||
.main(SpringVersion.class)
|
||||
.bannerMode(Banner.Mode.CONSOLE)
|
||||
.run(args);
|
||||
|
||||
|
||||
}
|
||||
public void run(String... args) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印 bean 列表
|
||||
* @param ctx
|
||||
*/
|
||||
public static void printBeans(ApplicationContext ctx) {
|
||||
String[] beanDefinitionNames = ctx.getBeanDefinitionNames();
|
||||
log.info("[*_*] Bean 打印开始=>");
|
||||
for (String beanName : beanDefinitionNames) {
|
||||
log.info("[*_*] beanName: " + beanName);
|
||||
}
|
||||
log.info("[*_*] Bean 打印完成。");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package business.book.listener;
|
||||
|
||||
@Slf4j
|
||||
//有个很重要的点 DirMoListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
|
||||
public class BookListener extends AnalysisEventListener<DirMo> {
|
||||
|
||||
/**
|
||||
* 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收
|
||||
*/
|
||||
private static final int BATCH_COUNT = 5;
|
||||
List<DirMo> list = new ArrayList<DirMo>();
|
||||
/**
|
||||
* 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。
|
||||
*/
|
||||
private DemoDAO demoDAO;
|
||||
public DirMoListener() {
|
||||
// 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数
|
||||
demoDAO = new DemoDAO();
|
||||
}
|
||||
/**
|
||||
* 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来
|
||||
*
|
||||
* @param demoDAO
|
||||
*/
|
||||
public DirMoListener(DemoDAO demoDAO) {
|
||||
this.demoDAO = demoDAO;
|
||||
}
|
||||
/**
|
||||
* 这个每一条数据解析都会来调用
|
||||
*
|
||||
* @param data
|
||||
* one row value. Is is same as {@link AnalysisContext#readRowHolder()}
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void invoke(DirMo data, AnalysisContext context) {
|
||||
log.info("解析到一条数据:{}", JSON.toJSONString(data));
|
||||
list.add(data);
|
||||
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
|
||||
if (list.size() >= BATCH_COUNT) {
|
||||
saveData();
|
||||
// 存储完成清理 list
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 所有数据解析完成了 都会来调用
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
|
||||
saveData();
|
||||
log.info("所有数据解析完成!");
|
||||
}
|
||||
/**
|
||||
* 加上存储数据库
|
||||
*/
|
||||
private void saveData() {
|
||||
log.info("{}条数据,开始存储数据库!", list.size());
|
||||
demoDAO.save(list);
|
||||
log.info("存储数据库成功!");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package business.book.mo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DirMo {
|
||||
|
||||
|
||||
private String title;
|
||||
private String fileName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package business.page.error;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
public class ErrorController {
|
||||
/**
|
||||
* 用来处理没有处理的页面
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/error/404.html")
|
||||
public String error404(HttpServletRequest request) {
|
||||
return "/error/404.html";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用来显示500错误页面
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/error/500.html")
|
||||
public String error500(HttpServletRequest request) {
|
||||
return "/error/500.html";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package business.page.index;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import redstar.framework.config.BookConfig;
|
||||
/**
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@CrossOrigin
|
||||
public class IndexPage {
|
||||
|
||||
|
||||
@Autowired
|
||||
BookConfig bookConfig;
|
||||
/**
|
||||
* 根目录
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/")
|
||||
public ModelAndView root() {
|
||||
return new ModelAndView("redirect:/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/index.html")
|
||||
public ModelAndView index() {
|
||||
bookConfig.show();
|
||||
return new ModelAndView("index");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package redstar.framework.beetl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.beetl.core.Context;
|
||||
import org.beetl.core.Function;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.servlet.support.RequestContextUtils;
|
||||
|
||||
public class BeetlI18n implements Function {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(BeetlI18n.class);
|
||||
|
||||
@Override
|
||||
public Object call(Object[] obj, Context context) {
|
||||
HttpServletRequest request = (HttpServletRequest) context.getGlobal("request");
|
||||
|
||||
ApplicationContext ctx = RequestContextUtils.findWebApplicationContext(request);
|
||||
Object[] arg = null;
|
||||
if (obj[0] != null) {
|
||||
return ctx.getMessage((String) obj[0], arg, RequestContextUtils.getLocale(request));
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package redstar.framework.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
|
||||
@Component
|
||||
public class BookConfig {
|
||||
@Value("${book.dir}")
|
||||
private String bookDir;
|
||||
|
||||
public void show(){
|
||||
System.out.println("===========================================");
|
||||
System.out.println("string : " + bookDir);
|
||||
System.out.println("===========================================");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package redstar.framework.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**") // 允许跨域访问的路径
|
||||
.allowedOrigins("*") // 允许跨域访问的源
|
||||
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE") // 允许请求方法
|
||||
.maxAge(168000) // 预检间隔时间
|
||||
.allowedHeaders("*") // 允许头部设置
|
||||
.allowCredentials(true); // 是否发送cookie
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package redstar.framework.config;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class I18nConfig {
|
||||
@Bean
|
||||
public LocaleChangeInterceptor localeChangeInterceptor() {
|
||||
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
|
||||
localeChangeInterceptor.setParamName("lang");
|
||||
return localeChangeInterceptor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LocaleResolver localeResolver() {
|
||||
SessionLocaleResolver slr = new SessionLocaleResolver();
|
||||
// 默认语言
|
||||
slr.setDefaultLocale(Locale.US);
|
||||
return slr;
|
||||
}
|
||||
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(localeChangeInterceptor());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package redstar.framework.config;
|
||||
|
||||
import org.beetl.core.resource.ClasspathResourceLoader;
|
||||
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
|
||||
import org.beetl.ext.spring.BeetlSpringViewResolver;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import redstar.framework.beetl.BeetlI18n;
|
||||
|
||||
@Configuration
|
||||
public class ViewBeetlConfig {
|
||||
|
||||
// 模板根目录 ,比如 "templates"
|
||||
@Value("${beetl.templatesPath}")
|
||||
String templatesPath;
|
||||
|
||||
@Bean(name = "beetlConfig")
|
||||
public BeetlGroupUtilConfiguration getBeetlGroupUtilConfiguration() {
|
||||
BeetlGroupUtilConfiguration beetlGroupUtilConfiguration = new BeetlGroupUtilConfiguration();
|
||||
// 获取Spring Boot 的ClassLoader
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
if (loader == null) {
|
||||
loader = ViewBeetlConfig.class.getClassLoader();
|
||||
}
|
||||
// beetlGroupUtilConfiguration.setConfigProperties(extProperties);//额外的配置,可以覆盖默认配置,一般不需要
|
||||
ClasspathResourceLoader cploder = new ClasspathResourceLoader(loader, templatesPath);
|
||||
beetlGroupUtilConfiguration.setResourceLoader(cploder);
|
||||
beetlGroupUtilConfiguration.init();
|
||||
// 如果使用了优化编译器,涉及到字节码操作,需要添加ClassLoader
|
||||
beetlGroupUtilConfiguration.getGroupTemplate().setClassLoader(loader);
|
||||
beetlGroupUtilConfiguration.getGroupTemplate().registerFunction("i18n", new BeetlI18n());
|
||||
return beetlGroupUtilConfiguration;
|
||||
|
||||
}
|
||||
|
||||
@Bean(name = "beetlViewResolver")
|
||||
public BeetlSpringViewResolver getBeetlSpringViewResolver(
|
||||
@Qualifier("beetlConfig") BeetlGroupUtilConfiguration beetlGroupUtilConfiguration) {
|
||||
BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver();
|
||||
beetlSpringViewResolver.setSuffix(".html");
|
||||
beetlSpringViewResolver.setContentType("text/html;charset=UTF-8");
|
||||
beetlSpringViewResolver.setOrder(0);
|
||||
beetlSpringViewResolver.setConfig(beetlGroupUtilConfiguration);
|
||||
return beetlSpringViewResolver;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package redstar.framework.config;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig {
|
||||
|
||||
@Bean
|
||||
public ObjectMapper getObjectMapper() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
return mapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package redstar.framework.markdown;
|
||||
|
||||
public class ExcelDirTool {
|
||||
@Test
|
||||
public void simpleRead() {
|
||||
String fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
|
||||
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
|
||||
EasyExcel.read(fileName, DemoData.class, new DemoDataListener()).sheet().doRead();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package redstar.framework.markdown;
|
||||
|
||||
public class MarkdownTool {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
spring:
|
||||
mvc:
|
||||
favicon:
|
||||
enabled: false
|
||||
beetl:
|
||||
templatesPath: templates
|
||||
enabled: true
|
||||
|
||||
book:
|
||||
dir: c:/
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
spring:
|
||||
mvc:
|
||||
favicon:
|
||||
enabled: false
|
||||
beetl:
|
||||
templatesPath: templates
|
||||
enabled: true
|
||||
|
||||
book:
|
||||
dir: c:/
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
spring:
|
||||
mvc:
|
||||
favicon:
|
||||
enabled: false
|
||||
beetl:
|
||||
templatesPath: templates
|
||||
enabled: true
|
||||
|
||||
book:
|
||||
dir: c:/
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
spring:
|
||||
application:
|
||||
name: redstar-front
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
server:
|
||||
# 端口号
|
||||
port: 9000
|
||||
servlet:
|
||||
context-path: /
|
||||
# 是否启用压缩
|
||||
compression:
|
||||
enabled: true
|
||||
# tomcat配置
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
|
||||
management:
|
||||
security:
|
||||
enabled: false
|
||||
|
||||
version:
|
||||
base: 1.0
|
||||
svnid: $[prefix.revision]
|
||||
time: $[package.time]
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
${AnsiColor.RED}
|
||||
____ __ __
|
||||
/\ _`\ /\ \ /\ \__
|
||||
\ \ \L\ \ __ \_\ \ ____\ \ ,_\ __ _ __
|
||||
\ \ , / /'__`\ /'_` \ /',__\\ \ \/ /'__`\ /\`'__\
|
||||
\ \ \\ \ /\ __//\ \L\ \/\__, `\\ \ \_/\ \L\.\_\ \ \/
|
||||
\ \_\ \_\ \____\ \___,_\/\____/ \ \__\ \__/.\_\\ \_\
|
||||
\/_/\/ /\/____/\/__,_ /\/___/ \/__/\/__/\/_/ \/_/
|
||||
|
||||
[+_+] 启动红星文档 V1.00
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# nav menu
|
||||
nav.menu.index = \u9996\u9875
|
||||
nav.menu.task = \u4EFB\u52A1
|
||||
nav.menu.dairy = \u65E5\u8BB0
|
||||
nav.menu.chinese = \u4E2D\u6587
|
||||
nav.menu.english = English
|
||||
|
||||
common.param.error = [500 error] - \u53C2\u6570\u9519\u8BEF
|
||||
common.db.error = [500 error] - \u6570\u636E\u5E93\u9519\u8BEF
|
||||
|
||||
dairy.menu.dairy = \u65E5\u8BB0
|
||||
dairy.menu.all = \u6240\u6709
|
||||
dairy.menu.week = \u5468
|
||||
dairy.menu.month = \u6708
|
||||
dairy.menu.year = \u5E74
|
||||
dairy.menu.today = \u4ECA\u5929
|
||||
|
||||
dairy.tab.today = \u4ECA\u5929
|
||||
dairy.tab.mon = \u661F\u671F\u4E00
|
||||
dairy.tab.tue = \u661F\u671F\u4E8C
|
||||
dairy.tab.wed = \u661F\u671F\u4E09
|
||||
dairy.tab.thu = \u661F\u671F\u56DB
|
||||
dairy.tab.fri = \u661F\u671F\u4E94
|
||||
dairy.tab.sat = \u661F\u671F\u516D
|
||||
dairy.tab.sun = \u661F\u671F\u5929
|
||||
|
||||
user.welcome = \u6B22\u8FCE\u4F60,
|
||||
user.login = \u767B\u5F55
|
||||
user.logout = \u9000\u51FA
|
||||
|
||||
user.form.login.title = \u7528\u6237\u767B\u5F55
|
||||
user.form.userName.tips = \u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801\u6216\u90AE\u7BB1
|
||||
user.form.password.tips = \u8BF7\u8F93\u5165\u5BC6\u7801
|
||||
|
||||
|
||||
#success info
|
||||
user.append.ok = \u6DFB\u52A0\u7528\u6237\u6210\u529F
|
||||
user.disable.ok = \u7981\u6B62\u7528\u6237\u6210\u529F
|
||||
user.login.ok = \u767B\u5F55\u6210\u529F
|
||||
|
||||
#error info
|
||||
user.param.error = \u53C2\u6570\u9519\u8BEF
|
||||
user.db.error = \u6570\u636E\u5E93\u9519\u8BEF
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# nav menu
|
||||
nav.menu.index = index
|
||||
nav.menu.task = task
|
||||
nav.menu.dairy = dairy
|
||||
nav.menu.chinese = \u4E2D\u6587
|
||||
nav.menu.english = English
|
||||
|
||||
common.param.error = [500 error] - param error
|
||||
common.db.error = [500 error] - db error
|
||||
|
||||
dairy.menu.dairy = dairy
|
||||
dairy.menu.all = all
|
||||
dairy.menu.week = week
|
||||
dairy.menu.month = month
|
||||
dairy.menu.year = year
|
||||
dairy.menu.today = today
|
||||
|
||||
dairy.tab.today = today
|
||||
dairy.tab.mon = Monday
|
||||
dairy.tab.tue = Tuesday
|
||||
dairy.tab.wed = Wednesday
|
||||
dairy.tab.thu = Thursday
|
||||
dairy.tab.fri = Friday
|
||||
dairy.tab.sat = Saturday
|
||||
dairy.tab.sun = Sunday
|
||||
|
||||
user.welcome = welcome,
|
||||
user.login = Login
|
||||
user.logout = Exit
|
||||
|
||||
user.form.login.title = Login
|
||||
user.form.userName.tips = Please input mobile or email
|
||||
user.form.password.tips = Please input password
|
||||
|
||||
|
||||
#success info
|
||||
user.append.ok = append new user ok
|
||||
user.disable.ok = disable a user ok
|
||||
user.login.ok = login ok
|
||||
|
||||
#error info
|
||||
user.param.error = param error
|
||||
user.db.error = database error
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# nav menu
|
||||
nav.menu.index = \u9996\u9875
|
||||
nav.menu.task = \u4EFB\u52A1
|
||||
nav.menu.dairy = \u65E5\u8BB0
|
||||
nav.menu.chinese = \u4E2D\u6587
|
||||
nav.menu.english = English
|
||||
|
||||
common.param.error = [500 error] - \u53C2\u6570\u9519\u8BEF
|
||||
common.db.error = [500 error] - \u6570\u636E\u5E93\u9519\u8BEF
|
||||
|
||||
dairy.menu.dairy = \u65E5\u8BB0
|
||||
dairy.menu.all = \u6240\u6709
|
||||
dairy.menu.week = \u5468
|
||||
dairy.menu.month = \u6708
|
||||
dairy.menu.year = \u5E74
|
||||
dairy.menu.today = \u4ECA\u5929
|
||||
|
||||
dairy.tab.today = \u4ECA\u5929
|
||||
dairy.tab.mon = \u661F\u671F\u4E00
|
||||
dairy.tab.tue = \u661F\u671F\u4E8C
|
||||
dairy.tab.wed = \u661F\u671F\u4E09
|
||||
dairy.tab.thu = \u661F\u671F\u56DB
|
||||
dairy.tab.fri = \u661F\u671F\u4E94
|
||||
dairy.tab.sat = \u661F\u671F\u516D
|
||||
dairy.tab.sun = \u661F\u671F\u5929
|
||||
|
||||
user.welcome = \u6B22\u8FCE\u4F60,
|
||||
user.login = \u767B\u5F55
|
||||
user.logout = \u9000\u51FA
|
||||
|
||||
user.form.login.title = \u7528\u6237\u767B\u5F55
|
||||
user.form.userName.tips = \u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801\u6216\u90AE\u7BB1
|
||||
user.form.password.tips = \u8BF7\u8F93\u5165\u5BC6\u7801
|
||||
|
||||
|
||||
#success info
|
||||
user.append.ok = \u6DFB\u52A0\u7528\u6237\u6210\u529F
|
||||
user.disable.ok = \u7981\u6B62\u7528\u6237\u6210\u529F
|
||||
user.login.ok = \u767B\u5F55\u6210\u529F
|
||||
|
||||
#error info
|
||||
user.param.error = \u53C2\u6570\u9519\u8BEF
|
||||
user.db.error = \u6570\u636E\u5E93\u9519\u8BEF
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!--
|
||||
%p:输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL
|
||||
%r:输出自应用启动到输出该日志讯息所耗费的毫秒数
|
||||
%t:输出产生该日志事件的线程名
|
||||
%f:输出日志讯息所属的类别的类别名
|
||||
%c:输出日志讯息所属的类的全名
|
||||
%d:输出日志时间点的日期或时间,指定格式的方式: %d{yyyy-MM-dd HH:mm:ss}
|
||||
%l:输出日志事件的发生位置,即输出日志讯息的语句在他所在类别的第几行。
|
||||
%m:输出代码中指定的讯息,如log(message)中的message
|
||||
%n:输出一个换行符号
|
||||
uid:[%X{wtraceid}] ip:[%X{ip}] url:[%X{url}] params:[%X{params}]
|
||||
-->
|
||||
<contextName>logback</contextName>
|
||||
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>
|
||||
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-5level] [%logger{5}.%M]\(%F:%L\) [%msg] %n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--按体积生成日志,避免服务器磁盘撑死-->
|
||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- rollover daily -->
|
||||
<fileNamePattern>logs/app.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<!-- each file should be at most 200MB, keep 3 days worth of history, but at most 1GB -->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<maxHistory>3</maxHistory>
|
||||
<totalSizeCap>1GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>
|
||||
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] uid:%X{wtraceid} ip:%X{ip} url:%X{url} params:%X{params} %highlight(%-5level) %cyan(%logger{5}).%M\(%F:%L\) %msg %n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org" level="INFO"/>
|
||||
<logger name="com" level="INFO"/>
|
||||
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="stdout"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="business.db.system.mapper.SysDictMapper" >
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="business.db.user.mapper.UserMapper" >
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
|
||||
<allow-access-from domain="*.meitu.com"/>
|
||||
</cross-domain-policy>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
|
|
@ -0,0 +1,35 @@
|
|||
@charset "utf-8";
|
||||
|
||||
/* 清除浮动 */
|
||||
.clear{ clear:both}
|
||||
|
||||
/* 中间独立的内容块 */
|
||||
.mblock {
|
||||
position:absolute;
|
||||
overflow:auto;
|
||||
top:50px;
|
||||
bottom:30px;
|
||||
left:0px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
/* 中间为左右布局的场景 */
|
||||
/* 左边菜单块 */
|
||||
.lblock{
|
||||
position:absolute;
|
||||
overflow:hidden;
|
||||
top:50px;
|
||||
bottom:30px;
|
||||
left:0px;
|
||||
width:200px;
|
||||
}
|
||||
|
||||
/* 右边内容块 */
|
||||
.rblock{
|
||||
position:absolute;
|
||||
overflow:auto;
|
||||
top:50px;
|
||||
bottom:30px;
|
||||
left:200px;
|
||||
width:calc(100% - 200px);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
@charset "utf-8";
|
||||
/*页脚*/
|
||||
.footer{
|
||||
font-size:12px;
|
||||
width:100%;
|
||||
position:absolute;
|
||||
bottom:0px;
|
||||
left:0px;
|
||||
height:40px;
|
||||
line-height:40px;
|
||||
border-top: 1px solid #F2EEE8;
|
||||
background-color:#FFF;
|
||||
opacity:0.95;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
@charset "utf-8";
|
||||
/*头部导航*/
|
||||
.header{
|
||||
font-size:16px;
|
||||
color:#BD2E2A;
|
||||
height: 50px;
|
||||
line-height:50px;
|
||||
border-bottom: 1px solid #F2EEE8;
|
||||
position:absolute;
|
||||
top:0;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.logo{
|
||||
display: inline-block;
|
||||
float: left;
|
||||
margin-left:20px;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
background: transparent url("../../img/logo.png") 9 9 9 9 no-repeat;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
.panel{
|
||||
margin:20px;
|
||||
display: block;
|
||||
border: 1px solid #DEDEDE;
|
||||
}
|
||||
|
||||
.panel .title{
|
||||
font-size:16px;
|
||||
height: 40px;
|
||||
line-height:40px;
|
||||
padding-left: 20px;
|
||||
background:#F3F3F8;
|
||||
}
|
||||
|
||||
.panel .content{
|
||||
padding: 20px;
|
||||
|
||||
}
|
||||
.content p{
|
||||
line-height:25px;
|
||||
}
|
||||
.content li{
|
||||
line-height:25px;
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
@charset "utf-8";
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置常用元素 */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
html, body, div, p,
|
||||
h1, h2, h3, h4, h5, h6,
|
||||
form, input, textarea,
|
||||
ul, ol, li,
|
||||
dl, dt, dd,
|
||||
i
|
||||
{
|
||||
font-size:14px;
|
||||
font-style:normal;
|
||||
font-weight:normal;
|
||||
font-family:"微软雅黑";
|
||||
margin:0;
|
||||
padding:0;
|
||||
list-style:none;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置列表 */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
ul, ol, li,
|
||||
dl, dt, dd {
|
||||
list-style-image:none;
|
||||
list-style-position:outside;
|
||||
list-style-type:none;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置img */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
img {
|
||||
border:none;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置table */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
table {
|
||||
border-collapse:collapse;
|
||||
border-spacing:0;
|
||||
}
|
||||
table th {
|
||||
font-weight:normal;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置表单元素 */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
textarea{
|
||||
border:none;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
input{
|
||||
font-size:100%;
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置图标元素 */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
em,i{
|
||||
font-style:normal;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置地址引用等元素 */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
address, cite, dfn, em, var {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* 重置分割线 */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
hr{
|
||||
border:0;
|
||||
height:1px;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,34 @@
|
|||
let REGISTER_CODE = 1;
|
||||
let FIND_PASSWORD_CODE = 2;
|
||||
$(document).ready(function(){
|
||||
$("#registerBtn,#findPwdBtn").click(function () {
|
||||
var id = $(this).attr('id');
|
||||
if (id == "registerBtn"){
|
||||
getverrificationCode(REGISTER_CODE);
|
||||
} else{
|
||||
getverrificationCode(FIND_PASSWORD_CODE);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
* @param type 验证码类型 1-注册 2-找回密码
|
||||
*/
|
||||
function getverrificationCode(type) {
|
||||
var mobile = $("#mobile").val();
|
||||
var param = {
|
||||
type: type,
|
||||
mobile: mobile
|
||||
}
|
||||
$.ajax({
|
||||
url: '/stub/verification?' + $.param(param),
|
||||
type: 'post',
|
||||
success: function (data) {
|
||||
$("#code").val(data.data);
|
||||
},
|
||||
error: function (e) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# **API接口规范**
|
||||
|
||||
一、 说明
|
||||
|
||||
API统一采用,类似Restful 风格,采用JSON数据传输
|
||||
|
||||
|
||||
|
||||
二、返回结果体
|
||||
|
||||
返回结果对象名称为ReponseVo,每个接口不管成功或者失败,都会返回此json结构。
|
||||
|
||||
| **字段名** | **类型** | **字段描述** |
|
||||
| ---------- | -------- | ------------------------------------------------------------ |
|
||||
| code | int | 结果码 :0:代表成功;-1:代表服务器内部错误;其他业务码可有各个业务模块划分定义 |
|
||||
| message | string | 客户端提示消息 |
|
||||
| log | string | 错误log日志,生产环境需要关闭开关 |
|
||||
| data | object | 实际数据对象 |
|
||||
|
||||
|
||||
|
||||
三、分页请求参数PageForm
|
||||
|
||||
| **字段名** | **类型** | **字段描述** |
|
||||
| ---------- | -------- | ------------ |
|
||||
| pageSize | int | 显示分页条数 |
|
||||
| pageNum | int | 显示当前页数 |
|
||||
|
||||
|
||||
|
||||
四、分页响应参数 PageResponseVo
|
||||
|
||||
PageResponseVo从ReponseVo继承,除了code, message, log等参数以外。
|
||||
|
||||
还增加了分页相关参数。
|
||||
|
||||
| **字段名** | **类型** | **字段描述** |
|
||||
| ---------- | -------- | ------------ |
|
||||
| pageSize | int | 显示分页条数 |
|
||||
| pageNum | int | 显示当前页数 |
|
||||
| totalNum | int | 显示总条数 |
|
||||
| totalPage | int | 显示总页数 |
|
||||
| data | object | 显示结果集 |
|
||||
|
||||
|
||||
|
||||
五、API名称定义规范
|
||||
|
||||
| **接口名** | |
|
||||
| ------------------------- | -------------------------------------------------------- |
|
||||
| /user/view | 查看单个用户 |
|
||||
| /user/list | 查看用户列表 |
|
||||
| /user/add | 添加用户 |
|
||||
| /user/logicalDelete | 逻辑删除用户, 放到回收站 (如果字段中有isDelete) |
|
||||
| /user/logicalRestore | 逻辑恢复用户,从回收站中取出用户(如果字段中有isDelete) |
|
||||
| /user/update | 根据主键更新用户 |
|
||||
| /user/delete | 根据主键删除用户 |
|
||||
| | |
|
||||
| /user/batchLogicalDelete | 批量逻辑删除用户(如果字段中有isDelete) |
|
||||
| /user/batchLogicalRestore | 批量逻辑恢复用户(如果字段中有isDelete) |
|
||||
| /user/batchDelete | 根据主键列表批量删除用户 |
|
||||
| /user/batchUpdate | 根据更新列表中的主键,批量更新用户 |
|
||||
| /user/batchExport | 批量导出用户,导出为xls文件列表 |
|
||||
| /user/batchInport | 批量导入用户,导入为xls文件列表 |
|
||||
| /user/batchInsert | 批量插入用户,从列表中进行插入 |
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<link rel="stylesheet" type="text/css" href="${ctxPath!}/static/css/common/reset.css">
|
||||
<link rel="stylesheet" type="text/css" href="${ctxPath!}/static/css/common/common.css">
|
||||
<link rel="stylesheet" type="text/css" href="${ctxPath!}/static/css/common/header.css">
|
||||
<link rel="stylesheet" type="text/css" href="${ctxPath!}/static/css/common/footer.css">
|
||||
<link rel="stylesheet" type="text/css" href="${ctxPath!}/static/css/common/panel.css">
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<div class="footer clear">
|
||||
CopyRight 2018 星空下の花生 页面执行耗时${executeTime!0}毫秒
|
||||
</div>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<div class="header clear" >
|
||||
<i class="logo"></i><span>[红星微服务] - v1.00</span>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<script type="text/javascript" src="${ctxPath!}/static/js/jquery-3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="${ctxPath!}/static/js/stub/stub.js"></script>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<% include("/common/css.html"){} %>
|
||||
</head>
|
||||
<body>
|
||||
<% include("/common/header.html"){} %>
|
||||
<div class="mblock">
|
||||
<div class="panel">
|
||||
<div class="title">404错误</div>
|
||||
<div class="content">
|
||||
<p>timestamp=${timestamp!}</p>
|
||||
<p>status=${status!}</p>
|
||||
<p>error=${error!}</p>
|
||||
<p>message=${message!}</p>
|
||||
<p>path=${path!}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% include("/common/footer.html"){} %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<% include("/common/css.html"){} %>
|
||||
</head>
|
||||
<body>
|
||||
<% include("/common/header.html"){} %>
|
||||
<div class="mblock">
|
||||
<div class="panel">
|
||||
<div class="title">500错误</h1></div>
|
||||
<div class="content">
|
||||
<p>${message!}</p>
|
||||
<p>${trace!}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% include("/common/footer.html"){} %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<% include("/common/css.html"){} %>
|
||||
</head>
|
||||
<body>
|
||||
<% include("/common/header.html"){} %>
|
||||
<div class="mblock">
|
||||
<div class="panel">
|
||||
<div class="title">红星文档V1.00介绍</div>
|
||||
<div class="content">
|
||||
<p>欢迎使用红星文档V1.00。<br/>
|
||||
红星文档V1.00主要使用了以下组件进行开发,目的是打造一个快速编写文档的工具。<br/>
|
||||
</p>
|
||||
<br/>
|
||||
<h1>技术栈选型</h1>
|
||||
<ul>
|
||||
<li><a href="#" target="_blank">spring boot 2.1.4.RELEASE</a></li>
|
||||
<li><a href="http://ibeetl.com/guide/#beetl" target="_blank">beetl</a></li>
|
||||
</ul>
|
||||
<br/>
|
||||
<h1>开发环境准备</h1>
|
||||
<ul>
|
||||
<li><a href="#">安装 JAVA</a></li>
|
||||
<li><a href="#">安装 Maven</a></li>
|
||||
<li><a href="#">安装 Eclipse</a></li>
|
||||
<li><a href="#">安装 Svn</a></li>
|
||||
<li><a href="#">安装 Xshell</a></li>
|
||||
<li><a href="#">安装 ActiveMq</a></li>
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
<h1>常见问题</h1>
|
||||
<ul>
|
||||
<li><a href="#"></a></li>
|
||||
<li><a href="#"></a></li>
|
||||
<li><a href="#"></a></li>
|
||||
<li><a href="#"></a></li>
|
||||
<li><a href="#"></a></li>
|
||||
<li><a href="#"></a></li>
|
||||
<li><a href="#"></a></li>
|
||||
<li><a href="#"></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% include("/common/footer.html"){} %>
|
||||
<% include("/common/js.html"){} %>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue