mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-04 16:26:40 +00:00
Compare commits
12 Commits
release_v3
...
release_v3
Author | SHA1 | Date | |
---|---|---|---|
f03ab953d0 | |||
5cc9dfa1bc | |||
2fbda60617 | |||
39c19ac004 | |||
7494fe431a | |||
c9f1500976 | |||
f61c252e71 | |||
6fd183c2ae | |||
c3daaecaaa | |||
1b6cc8ccd5 | |||
0a10504461 | |||
1046a7ffc1 |
@ -19,10 +19,6 @@ Gitee仓库地址: https://gitee.com/novel_dev_team/novel-cloud
|
|||||||
[点击前往](http://47.106.243.172:8888/)
|
[点击前往](http://47.106.243.172:8888/)
|
||||||
|
|
||||||
|
|
||||||
#### 前言
|
|
||||||
|
|
||||||
小说精品屋-plus致力于打造一个完整的商用小说门户平台,使用前建议先阅读此文档。
|
|
||||||
|
|
||||||
#### 项目介绍
|
#### 项目介绍
|
||||||
|
|
||||||
小说精品屋-plus是在[小说精品屋](https://github.com/201206030/fiction_house)的基础上,去除了漫画和弹幕模块,专注于小说,是一个多端(PC、WAP)阅读、功能完善的原创文学CMS系统,由前台门户系统、作家后台管理系统、平台后台管理系统、爬虫管理系统等多个子系统构成,支持会员充值、订阅模式、新闻发布和实时统计报表等功能。
|
小说精品屋-plus是在[小说精品屋](https://github.com/201206030/fiction_house)的基础上,去除了漫画和弹幕模块,专注于小说,是一个多端(PC、WAP)阅读、功能完善的原创文学CMS系统,由前台门户系统、作家后台管理系统、平台后台管理系统、爬虫管理系统等多个子系统构成,支持会员充值、订阅模式、新闻发布和实时统计报表等功能。
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel-admin</artifactId>
|
<artifactId>novel-admin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>novel-admin</name>
|
<name>novel-admin</name>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
java2nb:
|
java2nb:
|
||||||
uploadPath: c:/var/java2nb/uploaded_files/
|
uploadPath: /var/pic/
|
||||||
username: admin
|
username: admin
|
||||||
password: 111111
|
password: 111111
|
||||||
logging:
|
logging:
|
||||||
@ -10,7 +10,7 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: com.mysql.jdbc.Driver
|
driverClassName: com.mysql.jdbc.Driver
|
||||||
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||||
username: root
|
username: root
|
||||||
password: test123456
|
password: test123456
|
||||||
#password:
|
#password:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -1,21 +1,30 @@
|
|||||||
package com.java2nb.novel.core.advice;
|
package com.java2nb.novel.core.advice;
|
||||||
|
|
||||||
import com.java2nb.novel.core.bean.ResultBean;
|
import com.java2nb.novel.core.bean.ResultBean;
|
||||||
|
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||||
import com.java2nb.novel.core.exception.BusinessException;
|
import com.java2nb.novel.core.exception.BusinessException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用的异常处理器
|
* 通用的异常处理器
|
||||||
*
|
*
|
||||||
* @author 11797*/
|
* @author 11797*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ControllerAdvice
|
@RestControllerAdvice(basePackages = "com.java2nb.novel.controller")
|
||||||
@ResponseBody
|
|
||||||
public class CommonExceptionHandler {
|
public class CommonExceptionHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理后台数据校验异常
|
||||||
|
* */
|
||||||
|
@ExceptionHandler(BindException.class)
|
||||||
|
public ResultBean handlerBindException(BindException e){
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
return ResultBean.fail(ResponseStatus.PARAM_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理业务异常
|
* 处理业务异常
|
||||||
* */
|
* */
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.java2nb.novel.core.advice;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面异常处理器
|
||||||
|
*
|
||||||
|
* @author 11797
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@ControllerAdvice(basePackages = "com.java2nb.novel.page")
|
||||||
|
public class PageExceptionHandler {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理所有异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public String handlerException(Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
//跳转页面过程中出现异常时统一跳转到404页面
|
||||||
|
return "404";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.java2nb.novel.core.valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据的校验分组
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
*/
|
||||||
|
public interface AddGroup {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.java2nb.novel.core.valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据的校验分组
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
*/
|
||||||
|
public interface UpdateGroup {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,36 +1,56 @@
|
|||||||
package com.java2nb.novel.entity;
|
package com.java2nb.novel.entity;
|
||||||
|
|
||||||
|
import com.java2nb.novel.core.valid.AddGroup;
|
||||||
|
import com.java2nb.novel.core.valid.UpdateGroup;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import javax.annotation.Generated;
|
import javax.annotation.Generated;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class, UpdateGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
@NotBlank(groups = {AddGroup.class},message="手机号不能为空!")
|
||||||
|
@Pattern(groups = {AddGroup.class},regexp="^1[3|4|5|6|7|8|9][0-9]{9}$",message="手机号格式不正确!")
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
@NotBlank(groups = {AddGroup.class},message="密码不能为空!")
|
||||||
|
@Null(groups = {UpdateGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private String userPhoto;
|
private String userPhoto;
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class})
|
||||||
|
@Min(value = 0,groups = {UpdateGroup.class})
|
||||||
|
@Max(value = 1,groups = {UpdateGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Byte userSex;
|
private Byte userSex;
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Long accountBalance;
|
private Long accountBalance;
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Byte status;
|
private Byte status;
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.java2nb.novel.core.crawl;
|
package com.java2nb.novel.core.crawl;
|
||||||
|
|
||||||
import com.java2nb.novel.core.utils.HttpUtil;
|
import com.java2nb.novel.core.utils.*;
|
||||||
import com.java2nb.novel.core.utils.IdWorker;
|
|
||||||
import com.java2nb.novel.core.utils.RandomBookInfoUtil;
|
|
||||||
import com.java2nb.novel.core.utils.RestTemplateUtil;
|
|
||||||
import com.java2nb.novel.entity.Book;
|
import com.java2nb.novel.entity.Book;
|
||||||
import com.java2nb.novel.entity.BookContent;
|
import com.java2nb.novel.entity.BookContent;
|
||||||
import com.java2nb.novel.entity.BookIndex;
|
import com.java2nb.novel.entity.BookIndex;
|
||||||
@ -37,7 +34,7 @@ public class CrawlParser {
|
|||||||
|
|
||||||
private static RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
|
private static RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
|
||||||
|
|
||||||
private static ThreadLocal <Integer> retryCount = new ThreadLocal<>();
|
private static ThreadLocal<Integer> retryCount = new ThreadLocal<>();
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public static Book parseBook(RuleBean ruleBean, String bookId) {
|
public static Book parseBook(RuleBean ruleBean, String bookId) {
|
||||||
@ -65,7 +62,7 @@ public class CrawlParser {
|
|||||||
boolean isFindPicUrl = picUrlMatch.find();
|
boolean isFindPicUrl = picUrlMatch.find();
|
||||||
if (isFindPicUrl) {
|
if (isFindPicUrl) {
|
||||||
String picUrl = picUrlMatch.group(1);
|
String picUrl = picUrlMatch.group(1);
|
||||||
if(StringUtils.isNotBlank(picUrl) && StringUtils.isNotBlank(ruleBean.getPicUrlPrefix())) {
|
if (StringUtils.isNotBlank(picUrl) && StringUtils.isNotBlank(ruleBean.getPicUrlPrefix())) {
|
||||||
picUrl = ruleBean.getPicUrlPrefix() + picUrl;
|
picUrl = ruleBean.getPicUrlPrefix() + picUrl;
|
||||||
}
|
}
|
||||||
//设置封面图片路径
|
//设置封面图片路径
|
||||||
@ -96,11 +93,11 @@ public class CrawlParser {
|
|||||||
String desc = bookDetailHtml.substring(bookDetailHtml.indexOf(ruleBean.getDescStart()) + ruleBean.getDescStart().length());
|
String desc = bookDetailHtml.substring(bookDetailHtml.indexOf(ruleBean.getDescStart()) + ruleBean.getDescStart().length());
|
||||||
desc = desc.substring(0, desc.indexOf(ruleBean.getDescEnd()));
|
desc = desc.substring(0, desc.indexOf(ruleBean.getDescEnd()));
|
||||||
//过滤掉简介中的特殊标签
|
//过滤掉简介中的特殊标签
|
||||||
desc = desc.replaceAll("<a[^<]+</a>","")
|
desc = desc.replaceAll("<a[^<]+</a>", "")
|
||||||
.replaceAll("<font[^<]+</font>","")
|
.replaceAll("<font[^<]+</font>", "")
|
||||||
.replaceAll("<p>\\s*</p>","")
|
.replaceAll("<p>\\s*</p>", "")
|
||||||
.replaceAll("<p>","")
|
.replaceAll("<p>", "")
|
||||||
.replaceAll("</p>","<br/>");
|
.replaceAll("</p>", "<br/>");
|
||||||
//设置书籍简介
|
//设置书籍简介
|
||||||
book.setBookDesc(desc);
|
book.setBookDesc(desc);
|
||||||
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
||||||
@ -146,9 +143,9 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Integer, List> parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean, Map<Integer, BookIndex> hasIndexs) {
|
public static Map<Integer, List> parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean, Map<Integer, BookIndex> hasIndexs) {
|
||||||
Map<Integer,List> result = new HashMap<>(2);
|
Map<Integer, List> result = new HashMap<>(2);
|
||||||
result.put(BOOK_INDEX_LIST_KEY,new ArrayList(0));
|
result.put(BOOK_INDEX_LIST_KEY, new ArrayList(0));
|
||||||
result.put(BOOK_CONTENT_LIST_KEY,new ArrayList(0));
|
result.put(BOOK_CONTENT_LIST_KEY, new ArrayList(0));
|
||||||
|
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
|
|
||||||
@ -159,7 +156,7 @@ public class CrawlParser {
|
|||||||
String indexListHtml = getByHttpClientWithChrome(indexListUrl);
|
String indexListHtml = getByHttpClientWithChrome(indexListUrl);
|
||||||
|
|
||||||
if (indexListHtml != null) {
|
if (indexListHtml != null) {
|
||||||
if(StringUtils.isNotBlank(ruleBean.getBookIndexStart())){
|
if (StringUtils.isNotBlank(ruleBean.getBookIndexStart())) {
|
||||||
indexListHtml = indexListHtml.substring(indexListHtml.indexOf(ruleBean.getBookIndexStart()) + ruleBean.getBookIndexStart().length());
|
indexListHtml = indexListHtml.substring(indexListHtml.indexOf(ruleBean.getBookIndexStart()) + ruleBean.getBookIndexStart().length());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,10 +171,7 @@ public class CrawlParser {
|
|||||||
int indexNum = 0;
|
int indexNum = 0;
|
||||||
|
|
||||||
//总字数
|
//总字数
|
||||||
Integer totalWordCount = 0;
|
Integer totalWordCount = book.getWordCount() == null ? 0 : book.getWordCount();
|
||||||
//最新目录
|
|
||||||
Long lastIndexId = null;
|
|
||||||
String lastIndexName = null;
|
|
||||||
|
|
||||||
while (isFindIndex) {
|
while (isFindIndex) {
|
||||||
|
|
||||||
@ -189,12 +183,12 @@ public class CrawlParser {
|
|||||||
String sourceIndexId = indexIdMatch.group(1);
|
String sourceIndexId = indexIdMatch.group(1);
|
||||||
String bookContentUrl = ruleBean.getBookContentUrl();
|
String bookContentUrl = ruleBean.getBookContentUrl();
|
||||||
int calStart = bookContentUrl.indexOf("{cal_");
|
int calStart = bookContentUrl.indexOf("{cal_");
|
||||||
if(calStart != -1){
|
if (calStart != -1) {
|
||||||
//内容页URL需要进行计算才能得到
|
//内容页URL需要进行计算才能得到
|
||||||
String calStr = bookContentUrl.substring(calStart,calStart+bookContentUrl.substring(calStart).indexOf("}"));
|
String calStr = bookContentUrl.substring(calStart, calStart + bookContentUrl.substring(calStart).indexOf("}"));
|
||||||
String[] calArr = calStr.split("_");
|
String[] calArr = calStr.split("_");
|
||||||
int calType = Integer.parseInt(calArr[1]);
|
int calType = Integer.parseInt(calArr[1]);
|
||||||
if(calType == 1) {
|
if (calType == 1) {
|
||||||
///{cal_1_1_3}_{bookId}/{indexId}.html
|
///{cal_1_1_3}_{bookId}/{indexId}.html
|
||||||
//第一种计算规则,去除第x个参数的最后y个字母
|
//第一种计算规则,去除第x个参数的最后y个字母
|
||||||
int x = Integer.parseInt(calArr[2]);
|
int x = Integer.parseInt(calArr[2]);
|
||||||
@ -206,12 +200,12 @@ public class CrawlParser {
|
|||||||
calResult = sourceIndexId.substring(0, sourceBookId.length() - y);
|
calResult = sourceIndexId.substring(0, sourceBookId.length() - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(calResult.length() == 0){
|
if (calResult.length() == 0) {
|
||||||
calResult = "0";
|
calResult = "0";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bookContentUrl = bookContentUrl.replace(calStr+"}", calResult);
|
bookContentUrl = bookContentUrl.replace(calStr + "}", calResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -223,54 +217,43 @@ public class CrawlParser {
|
|||||||
if (contentHtml != null && !contentHtml.contains("正在手打中")) {
|
if (contentHtml != null && !contentHtml.contains("正在手打中")) {
|
||||||
String content = contentHtml.substring(contentHtml.indexOf(ruleBean.getContentStart()) + ruleBean.getContentStart().length());
|
String content = contentHtml.substring(contentHtml.indexOf(ruleBean.getContentStart()) + ruleBean.getContentStart().length());
|
||||||
content = content.substring(0, content.indexOf(ruleBean.getContentEnd()));
|
content = content.substring(0, content.indexOf(ruleBean.getContentEnd()));
|
||||||
//TODO插入章节目录和章节内容
|
//插入章节目录和章节内容
|
||||||
BookIndex bookIndex = new BookIndex();
|
BookIndex bookIndex = new BookIndex();
|
||||||
|
|
||||||
bookIndex.setIndexName(indexName);
|
bookIndex.setIndexName(indexName);
|
||||||
bookIndex.setIndexNum(indexNum);
|
bookIndex.setIndexNum(indexNum);
|
||||||
|
Integer wordCount = StringUtil.getStrValidWordCount(content);
|
||||||
|
bookIndex.setWordCount(wordCount);
|
||||||
indexList.add(bookIndex);
|
indexList.add(bookIndex);
|
||||||
BookContent bookContent = new BookContent();
|
|
||||||
|
|
||||||
|
BookContent bookContent = new BookContent();
|
||||||
bookContent.setContent(content);
|
bookContent.setContent(content);
|
||||||
contentList.add(bookContent);
|
contentList.add(bookContent);
|
||||||
|
|
||||||
//判断是新增还是更新
|
if (hasIndex != null) {
|
||||||
if(hasIndexs.size() == 0){
|
//章节更新
|
||||||
//新书入库
|
bookIndex.setId(hasIndex.getId());
|
||||||
|
bookContent.setIndexId(hasIndex.getId());
|
||||||
|
|
||||||
|
//计算总字数
|
||||||
|
totalWordCount = (totalWordCount+wordCount-hasIndex.getWordCount());
|
||||||
|
} else {
|
||||||
|
//章节插入
|
||||||
//设置目录和章节内容
|
//设置目录和章节内容
|
||||||
Long indexId = idWorker.nextId();
|
Long indexId = idWorker.nextId();
|
||||||
lastIndexId = indexId;
|
|
||||||
lastIndexName = indexName;
|
|
||||||
bookIndex.setId(indexId);
|
bookIndex.setId(indexId);
|
||||||
bookIndex.setBookId(book.getId());
|
bookIndex.setBookId(book.getId());
|
||||||
Integer wordCount = bookContent.getContent().length();
|
|
||||||
totalWordCount += wordCount;
|
|
||||||
bookIndex.setWordCount(wordCount);
|
|
||||||
bookIndex.setCreateTime(currentDate);
|
bookIndex.setCreateTime(currentDate);
|
||||||
bookIndex.setUpdateTime(currentDate);
|
|
||||||
|
|
||||||
bookContent.setIndexId(indexId);
|
bookContent.setIndexId(indexId);
|
||||||
|
|
||||||
//设置小说基础信息
|
//计算总字数
|
||||||
book.setWordCount(totalWordCount);
|
totalWordCount += wordCount;
|
||||||
book.setLastIndexId(lastIndexId);
|
|
||||||
book.setLastIndexName(lastIndexName);
|
|
||||||
book.setLastIndexUpdateTime(currentDate);
|
|
||||||
book.setCreateTime(currentDate);
|
|
||||||
book.setUpdateTime(currentDate);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
//老书更新
|
|
||||||
}
|
}
|
||||||
|
bookIndex.setUpdateTime(currentDate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(hasIndex != null){
|
|
||||||
bookIndex.setId(hasIndex.getId());
|
|
||||||
bookContent.setIndexId(hasIndex.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -279,15 +262,29 @@ public class CrawlParser {
|
|||||||
isFindIndex = indexIdMatch.find() & indexNameMatch.find();
|
isFindIndex = indexIdMatch.find() & indexNameMatch.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (indexList.size() > 0) {
|
||||||
|
//如果有爬到最新章节,则设置小说主表的最新章节信息
|
||||||
|
//获取爬取到的最新章节
|
||||||
|
BookIndex lastIndex = indexList.get(indexList.size()-1);
|
||||||
|
book.setLastIndexId(lastIndex.getId());
|
||||||
|
book.setLastIndexName(lastIndex.getIndexName());
|
||||||
|
book.setLastIndexUpdateTime(currentDate);
|
||||||
|
|
||||||
|
}
|
||||||
|
book.setWordCount(totalWordCount);
|
||||||
|
book.setUpdateTime(currentDate);
|
||||||
|
|
||||||
if (indexList.size() == contentList.size() && indexList.size() > 0) {
|
if (indexList.size() == contentList.size() && indexList.size() > 0) {
|
||||||
|
|
||||||
result.put(BOOK_INDEX_LIST_KEY,indexList);
|
result.put(BOOK_INDEX_LIST_KEY, indexList);
|
||||||
result.put(BOOK_CONTENT_LIST_KEY,contentList);
|
result.put(BOOK_CONTENT_LIST_KEY, contentList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +294,7 @@ public class CrawlParser {
|
|||||||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
|
||||||
if (forEntity.getStatusCode() == HttpStatus.OK) {
|
if (forEntity.getStatusCode() == HttpStatus.OK) {
|
||||||
String body = forEntity.getBody();
|
String body = forEntity.getBody();
|
||||||
if(body.length() < Constants.INVALID_HTML_LENGTH){
|
if (body.length() < Constants.INVALID_HTML_LENGTH) {
|
||||||
return processErrorHttpResult(url);
|
return processErrorHttpResult(url);
|
||||||
}
|
}
|
||||||
//成功获得html内容
|
//成功获得html内容
|
||||||
@ -314,11 +311,11 @@ public class CrawlParser {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
String body = HttpUtil.getByHttpClientWithChrome(url);
|
String body = HttpUtil.getByHttpClientWithChrome(url);
|
||||||
if(body != null && body.length() < Constants.INVALID_HTML_LENGTH){
|
if (body != null && body.length() < Constants.INVALID_HTML_LENGTH) {
|
||||||
return processErrorHttpResult(url);
|
return processErrorHttpResult(url);
|
||||||
}
|
}
|
||||||
//成功获得html内容
|
//成功获得html内容
|
||||||
return body;
|
return body;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -327,13 +324,13 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private static String processErrorHttpResult(String url){
|
private static String processErrorHttpResult(String url) {
|
||||||
Integer count = retryCount.get();
|
Integer count = retryCount.get();
|
||||||
if(count == null){
|
if (count == null) {
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
if(count < Constants.HTTP_FAIL_RETRY_COUNT){
|
if (count < Constants.HTTP_FAIL_RETRY_COUNT) {
|
||||||
Thread.sleep( new Random().nextInt(10*1000));
|
Thread.sleep(new Random().nextInt(10 * 1000));
|
||||||
retryCount.set(++count);
|
retryCount.set(++count);
|
||||||
return getByHttpClient(url);
|
return getByHttpClient(url);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ public class StarterListener implements ServletContextListener {
|
|||||||
Book book = CrawlParser.parseBook(ruleBean, needUpdateBook.getCrawlBookId());
|
Book book = CrawlParser.parseBook(ruleBean, needUpdateBook.getCrawlBookId());
|
||||||
//这里只做老书更新
|
//这里只做老书更新
|
||||||
book.setId(needUpdateBook.getId());
|
book.setId(needUpdateBook.getId());
|
||||||
|
book.setWordCount(needUpdateBook.getWordCount());
|
||||||
if (needUpdateBook.getPicUrl() != null && needUpdateBook.getPicUrl().contains(Constants.LOCAL_PIC_PREFIX)) {
|
if (needUpdateBook.getPicUrl() != null && needUpdateBook.getPicUrl().contains(Constants.LOCAL_PIC_PREFIX)) {
|
||||||
//本地图片则不更新
|
//本地图片则不更新
|
||||||
book.setPicUrl(null);
|
book.setPicUrl(null);
|
||||||
|
@ -65,9 +65,8 @@ public interface BookService {
|
|||||||
* @param book 小说数据
|
* @param book 小说数据
|
||||||
* @param bookIndexList 目录集合
|
* @param bookIndexList 目录集合
|
||||||
* @param bookContentList 内容集合
|
* @param bookContentList 内容集合
|
||||||
* @param existBookIndexMap 已存在的章节Map
|
* @param existBookIndexMap 已存在的章节Map */
|
||||||
* */
|
void updateBookAndIndexAndContent(Book book, List<BookIndex> bookIndexList, List<BookContent> bookContentList, Map<Integer, BookIndex> existBookIndexMap);
|
||||||
void updateBookAndIndexAndContent(Book book, List<BookIndex> bookIndexList, List<BookContent> bookContentList, Map<Integer, BookIndex> existBookIndexMap);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新一下最后一次的抓取时间
|
* 更新一下最后一次的抓取时间
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.java2nb.novel.service.impl;
|
package com.java2nb.novel.service.impl;
|
||||||
|
|
||||||
import com.java2nb.novel.core.utils.IdWorker;
|
|
||||||
import com.java2nb.novel.entity.Book;
|
import com.java2nb.novel.entity.Book;
|
||||||
import com.java2nb.novel.entity.BookContent;
|
import com.java2nb.novel.entity.BookContent;
|
||||||
import com.java2nb.novel.entity.BookIndex;
|
import com.java2nb.novel.entity.BookIndex;
|
||||||
@ -79,12 +78,9 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
if(bookIndexList.size()>0) {
|
if(bookIndexList.size()>0) {
|
||||||
|
|
||||||
if (book.getId() == null) {
|
|
||||||
book.setId(new IdWorker().nextId());
|
|
||||||
}
|
|
||||||
|
|
||||||
//保存小说主表
|
//保存小说主表
|
||||||
|
|
||||||
|
book.setCreateTime(new Date());
|
||||||
bookMapper.insertSelective(book);
|
bookMapper.insertSelective(book);
|
||||||
|
|
||||||
//批量保存目录和内容
|
//批量保存目录和内容
|
||||||
@ -109,7 +105,7 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, BookIndex> queryExistBookIndexMap(Long bookId) {
|
public Map<Integer, BookIndex> queryExistBookIndexMap(Long bookId) {
|
||||||
List<BookIndex> bookIndexs = bookIndexMapper.selectMany(select(BookIndexDynamicSqlSupport.id,BookIndexDynamicSqlSupport.indexNum,BookIndexDynamicSqlSupport.indexName)
|
List<BookIndex> bookIndexs = bookIndexMapper.selectMany(select(BookIndexDynamicSqlSupport.id,BookIndexDynamicSqlSupport.indexNum,BookIndexDynamicSqlSupport.indexName,BookIndexDynamicSqlSupport.wordCount)
|
||||||
.from(BookIndexDynamicSqlSupport.bookIndex)
|
.from(BookIndexDynamicSqlSupport.bookIndex)
|
||||||
.where(BookIndexDynamicSqlSupport.bookId,isEqualTo(bookId))
|
.where(BookIndexDynamicSqlSupport.bookId,isEqualTo(bookId))
|
||||||
.build()
|
.build()
|
||||||
@ -122,36 +118,19 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void updateBookAndIndexAndContent(Book book, List<BookIndex> bookIndexList, List<BookContent> bookContentList, Map<Integer, BookIndex> existBookIndexMap) {
|
public void updateBookAndIndexAndContent(Book book, List<BookIndex> bookIndexList, List<BookContent> bookContentList, Map<Integer, BookIndex> existBookIndexMap) {
|
||||||
Date currentDate = new Date();
|
|
||||||
for (int i = 0; i < bookIndexList.size(); i++) {
|
for (int i = 0; i < bookIndexList.size(); i++) {
|
||||||
BookIndex bookIndex = bookIndexList.get(i);
|
BookIndex bookIndex = bookIndexList.get(i);
|
||||||
BookContent bookContent = bookContentList.get(i);
|
BookContent bookContent = bookContentList.get(i);
|
||||||
|
|
||||||
//插入或更新目录
|
|
||||||
Integer wordCount = bookContent.getContent().length();
|
|
||||||
bookIndex.setWordCount(wordCount);
|
|
||||||
bookIndex.setUpdateTime(currentDate);
|
|
||||||
|
|
||||||
if(bookIndex.getId() == null) {
|
if(!existBookIndexMap.containsKey(bookIndex.getIndexNum())) {
|
||||||
//插入
|
//插入
|
||||||
bookIndex.setBookId(book.getId());
|
|
||||||
Long indexId = new IdWorker().nextId();
|
|
||||||
bookIndex.setId(indexId);
|
|
||||||
bookIndex.setCreateTime(currentDate);
|
|
||||||
bookIndexMapper.insertSelective(bookIndex);
|
bookIndexMapper.insertSelective(bookIndex);
|
||||||
}else{
|
|
||||||
//更新
|
|
||||||
bookIndexMapper.updateByPrimaryKeySelective(bookIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bookContent.getIndexId() == null) {
|
|
||||||
//插入
|
|
||||||
bookContent.setIndexId(bookIndex.getId());
|
|
||||||
bookContentMapper.insertSelective(bookContent);
|
bookContentMapper.insertSelective(bookContent);
|
||||||
}else{
|
}else{
|
||||||
//更新
|
//更新
|
||||||
|
bookIndexMapper.updateByPrimaryKeySelective(bookIndex);
|
||||||
bookContentMapper.update(update(BookContentDynamicSqlSupport.bookContent)
|
bookContentMapper.update(update(BookContentDynamicSqlSupport.bookContent)
|
||||||
.set(BookContentDynamicSqlSupport.content)
|
.set(BookContentDynamicSqlSupport.content)
|
||||||
.equalTo(bookContent.getContent())
|
.equalTo(bookContent.getContent())
|
||||||
@ -160,21 +139,10 @@ public class BookServiceImpl implements BookService {
|
|||||||
.render(RenderingStrategies.MYBATIS3));
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新小说主表
|
//更新小说主表
|
||||||
if(bookIndexList.size()>0) {
|
|
||||||
//有更新章节,才需要更新以下字段
|
|
||||||
book.setWordCount(queryTotalWordCount(book.getId()));
|
|
||||||
BookIndex lastIndex = bookIndexList.get(bookIndexList.size()-1);
|
|
||||||
if(!existBookIndexMap.containsKey(lastIndex.getIndexNum())) {
|
|
||||||
//如果最新章节不在已存在章节中,那么更新小说表最新章节信息
|
|
||||||
book.setLastIndexId(lastIndex.getId());
|
|
||||||
book.setLastIndexName(lastIndex.getIndexName());
|
|
||||||
book.setLastIndexUpdateTime(currentDate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
book.setUpdateTime(currentDate);
|
|
||||||
book.setBookName(null);
|
book.setBookName(null);
|
||||||
book.setAuthorName(null);
|
book.setAuthorName(null);
|
||||||
if(Constants.VISIT_COUNT_DEFAULT.equals(book.getVisitCount())) {
|
if(Constants.VISIT_COUNT_DEFAULT.equals(book.getVisitCount())) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<select id="queryNeedUpdateBook" resultType="com.java2nb.novel.entity.Book">
|
<select id="queryNeedUpdateBook" resultType="com.java2nb.novel.entity.Book">
|
||||||
|
|
||||||
select id,crawl_source_id,crawl_book_id,crawl_last_time,pic_url
|
select id,crawl_source_id,crawl_book_id,crawl_last_time,pic_url,word_count
|
||||||
from book where last_index_update_time > #{startDate} and crawl_source_id is not null
|
from book where last_index_update_time > #{startDate} and crawl_source_id is not null
|
||||||
order by crawl_last_time
|
order by crawl_last_time
|
||||||
limit ${limit}
|
limit ${limit}
|
||||||
@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
<select id="queryTotalWordCount" parameterType="long" resultType="int">
|
<select id="queryTotalWordCount" parameterType="long" resultType="int">
|
||||||
|
|
||||||
select sum(t2.word_count) from book t1 inner join book_index t2
|
select sum(word_count) from book_index where book_id = #{bookId}
|
||||||
on t1.id = t2.book_id and t1.id = #{bookId}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateCrawlLastTime">
|
<update id="updateCrawlLastTime">
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -6,15 +6,16 @@ import com.java2nb.novel.core.bean.UserDetails;
|
|||||||
import com.java2nb.novel.core.cache.CacheService;
|
import com.java2nb.novel.core.cache.CacheService;
|
||||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||||
import com.java2nb.novel.core.utils.RandomValidateCodeUtil;
|
import com.java2nb.novel.core.utils.RandomValidateCodeUtil;
|
||||||
|
import com.java2nb.novel.core.valid.AddGroup;
|
||||||
|
import com.java2nb.novel.core.valid.UpdateGroup;
|
||||||
import com.java2nb.novel.entity.User;
|
import com.java2nb.novel.entity.User;
|
||||||
import com.java2nb.novel.entity.UserBuyRecord;
|
import com.java2nb.novel.entity.UserBuyRecord;
|
||||||
import com.java2nb.novel.form.UserForm;
|
|
||||||
import com.java2nb.novel.service.BookService;
|
import com.java2nb.novel.service.BookService;
|
||||||
import com.java2nb.novel.service.UserService;
|
import com.java2nb.novel.service.UserService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -42,12 +43,7 @@ public class UserController extends BaseController {
|
|||||||
* 登陆
|
* 登陆
|
||||||
*/
|
*/
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public ResultBean login(@Valid UserForm user, BindingResult result) {
|
public ResultBean login(User user) {
|
||||||
//判断参数是否合法
|
|
||||||
if (result.hasErrors()) {
|
|
||||||
log.info(result.getAllErrors().toString());
|
|
||||||
return ResultBean.fail(ResponseStatus.PARAM_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
//登陆
|
//登陆
|
||||||
UserDetails userDetails = userService.login(user);
|
UserDetails userDetails = userService.login(user);
|
||||||
@ -64,13 +60,8 @@ public class UserController extends BaseController {
|
|||||||
* 注册
|
* 注册
|
||||||
*/
|
*/
|
||||||
@PostMapping("register")
|
@PostMapping("register")
|
||||||
public ResultBean register(@Valid UserForm user, @RequestParam(value = "velCode", defaultValue = "") String velCode, BindingResult result) {
|
public ResultBean register(@Validated({AddGroup.class}) User user, @RequestParam(value = "velCode", defaultValue = "") String velCode) {
|
||||||
|
|
||||||
//判断参数是否合法
|
|
||||||
if (result.hasErrors()) {
|
|
||||||
log.info(result.getAllErrors().toString());
|
|
||||||
return ResultBean.fail(ResponseStatus.PARAM_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断验证码是否正确
|
//判断验证码是否正确
|
||||||
if (!velCode.equals(cacheService.get(RandomValidateCodeUtil.RANDOM_CODE_KEY))) {
|
if (!velCode.equals(cacheService.get(RandomValidateCodeUtil.RANDOM_CODE_KEY))) {
|
||||||
@ -225,7 +216,7 @@ public class UserController extends BaseController {
|
|||||||
* 更新个人信息
|
* 更新个人信息
|
||||||
* */
|
* */
|
||||||
@PostMapping("updateUserInfo")
|
@PostMapping("updateUserInfo")
|
||||||
public ResultBean updateUserInfo(User user,HttpServletRequest request) {
|
public ResultBean updateUserInfo(@Validated({UpdateGroup.class}) User user, HttpServletRequest request) {
|
||||||
UserDetails userDetails = getUserDetails(request);
|
UserDetails userDetails = getUserDetails(request);
|
||||||
if (userDetails == null) {
|
if (userDetails == null) {
|
||||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.java2nb.novel.core.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.web.server.ErrorPage;
|
||||||
|
import org.springframework.boot.web.server.ErrorPageRegistrar;
|
||||||
|
import org.springframework.boot.web.server.ErrorPageRegistry;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误页面配置
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class ErrorPageConfig implements ErrorPageRegistrar {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerErrorPages(ErrorPageRegistry registry) {
|
||||||
|
/*1.错误类型为404,默认显示404.html网页*/
|
||||||
|
ErrorPage e404 = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
|
||||||
|
/**
|
||||||
|
TODO 2.错误类型为500,表示服务器响应错误,默认显示/500.html网页
|
||||||
|
*/
|
||||||
|
registry.addErrorPages(e404);
|
||||||
|
}
|
||||||
|
}
|
@ -86,7 +86,11 @@ public class JwtTokenUtil {
|
|||||||
*/
|
*/
|
||||||
private boolean isTokenExpired(String token) {
|
private boolean isTokenExpired(String token) {
|
||||||
Date expiredDate = getExpiredDateFromToken(token);
|
Date expiredDate = getExpiredDateFromToken(token);
|
||||||
return expiredDate.before(new Date());
|
if(expiredDate == null){
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
return expiredDate.before(new Date());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,7 +98,7 @@ public class JwtTokenUtil {
|
|||||||
*/
|
*/
|
||||||
private Date getExpiredDateFromToken(String token) {
|
private Date getExpiredDateFromToken(String token) {
|
||||||
Claims claims = getClaimsFromToken(token);
|
Claims claims = getClaimsFromToken(token);
|
||||||
return claims.getExpiration();
|
return claims != null ? claims.getExpiration() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package com.java2nb.novel.form;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.annotation.Generated;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class UserForm {
|
|
||||||
@NotBlank(message="手机号不能为空!")
|
|
||||||
@Pattern(regexp="^1[3|4|5|6|7|8|9][0-9]{9}$",message="手机号格式不正确!")
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@NotBlank(message="密码不能为空!")
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
package com.java2nb.novel.controller;
|
package com.java2nb.novel.page;
|
||||||
|
|
||||||
import com.java2nb.novel.core.bean.ResultBean;
|
import com.java2nb.novel.controller.BaseController;
|
||||||
import com.java2nb.novel.core.bean.UserDetails;
|
import com.java2nb.novel.core.bean.UserDetails;
|
||||||
import com.java2nb.novel.core.utils.ThreadLocalUtil;
|
import com.java2nb.novel.core.utils.ThreadLocalUtil;
|
||||||
import com.java2nb.novel.entity.*;
|
import com.java2nb.novel.entity.*;
|
||||||
@ -9,16 +9,16 @@ import com.java2nb.novel.service.BookService;
|
|||||||
import com.java2nb.novel.service.NewsService;
|
import com.java2nb.novel.service.NewsService;
|
||||||
import com.java2nb.novel.service.UserService;
|
import com.java2nb.novel.service.UserService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.net.URLEncoder;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +27,7 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Controller
|
@Controller
|
||||||
public class PageController extends BaseController{
|
public class PageController extends BaseController {
|
||||||
|
|
||||||
private final BookService bookService;
|
private final BookService bookService;
|
||||||
|
|
||||||
@ -97,6 +97,7 @@ public class PageController extends BaseController{
|
|||||||
/**
|
/**
|
||||||
* 详情页
|
* 详情页
|
||||||
* */
|
* */
|
||||||
|
@SneakyThrows
|
||||||
@RequestMapping("/book/{bookId}.html")
|
@RequestMapping("/book/{bookId}.html")
|
||||||
public String bookDetail(@PathVariable("bookId") Long bookId, Model model) {
|
public String bookDetail(@PathVariable("bookId") Long bookId, Model model) {
|
||||||
Book book = bookService.queryBookDetail(bookId);
|
Book book = bookService.queryBookDetail(bookId);
|
||||||
@ -112,6 +113,7 @@ public class PageController extends BaseController{
|
|||||||
/**
|
/**
|
||||||
* 目录页
|
* 目录页
|
||||||
* */
|
* */
|
||||||
|
@SneakyThrows
|
||||||
@RequestMapping("/book/indexList-{bookId}.html")
|
@RequestMapping("/book/indexList-{bookId}.html")
|
||||||
public String indexList(@PathVariable("bookId") Long bookId, Model model) {
|
public String indexList(@PathVariable("bookId") Long bookId, Model model) {
|
||||||
Book book = bookService.queryBookDetail(bookId);
|
Book book = bookService.queryBookDetail(bookId);
|
||||||
@ -125,13 +127,14 @@ public class PageController extends BaseController{
|
|||||||
/**
|
/**
|
||||||
* 内容页
|
* 内容页
|
||||||
* */
|
* */
|
||||||
|
@SneakyThrows
|
||||||
@RequestMapping("/book/{bookId}/{bookIndexId}.html")
|
@RequestMapping("/book/{bookId}/{bookIndexId}.html")
|
||||||
public String indexList(@PathVariable("bookId") Long bookId,@PathVariable("bookIndexId") Long bookIndexId, HttpServletRequest request,Model model) {
|
public String indexList(@PathVariable("bookId") Long bookId,@PathVariable("bookIndexId") Long bookIndexId, HttpServletRequest request, Model model) {
|
||||||
//查询书籍
|
//查询书籍
|
||||||
Book book = bookService.queryBookDetail(bookId);
|
Book book = bookService.queryBookDetail(bookId);
|
||||||
model.addAttribute("book",book);
|
|
||||||
//查询目录
|
//查询目录
|
||||||
BookIndex bookIndex = bookService.queryBookIndex(bookIndexId);
|
BookIndex bookIndex = bookService.queryBookIndex(bookIndexId);
|
||||||
|
model.addAttribute("book",book);
|
||||||
model.addAttribute("bookIndex",bookIndex);
|
model.addAttribute("bookIndex",bookIndex);
|
||||||
//查询上一章节目录ID
|
//查询上一章节目录ID
|
||||||
Long preBookIndexId = bookService.queryPreBookIndexId(bookId,bookIndex.getIndexNum());
|
Long preBookIndexId = bookService.queryPreBookIndexId(bookId,bookIndex.getIndexNum());
|
@ -3,7 +3,6 @@ package com.java2nb.novel.service;
|
|||||||
|
|
||||||
import com.java2nb.novel.core.bean.UserDetails;
|
import com.java2nb.novel.core.bean.UserDetails;
|
||||||
import com.java2nb.novel.entity.UserBuyRecord;
|
import com.java2nb.novel.entity.UserBuyRecord;
|
||||||
import com.java2nb.novel.form.UserForm;
|
|
||||||
import com.java2nb.novel.vo.BookReadHistoryVO;
|
import com.java2nb.novel.vo.BookReadHistoryVO;
|
||||||
import com.java2nb.novel.vo.BookShelfVO;
|
import com.java2nb.novel.vo.BookShelfVO;
|
||||||
import com.java2nb.novel.entity.User;
|
import com.java2nb.novel.entity.User;
|
||||||
@ -19,17 +18,17 @@ public interface UserService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户注册
|
* 用户注册
|
||||||
* @param form 用户注册提交信息类
|
* @param user 用户注册信息类
|
||||||
* @return jwt载体信息类
|
* @return jwt载体信息类
|
||||||
* */
|
* */
|
||||||
UserDetails register(UserForm form);
|
UserDetails register(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登陆
|
* 用户登陆
|
||||||
* @param form 用户登陆提交信息类
|
* @param user 用户登陆信息类
|
||||||
* @return jwt载体信息类
|
* @return jwt载体信息类
|
||||||
* */
|
* */
|
||||||
UserDetails login(UserForm form);
|
UserDetails login(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询小说是否已加入书架
|
* 查询小说是否已加入书架
|
||||||
|
@ -5,7 +5,6 @@ import com.java2nb.novel.core.bean.UserDetails;
|
|||||||
import com.java2nb.novel.core.utils.BeanUtil;
|
import com.java2nb.novel.core.utils.BeanUtil;
|
||||||
import com.java2nb.novel.entity.*;
|
import com.java2nb.novel.entity.*;
|
||||||
import com.java2nb.novel.entity.User;
|
import com.java2nb.novel.entity.User;
|
||||||
import com.java2nb.novel.form.UserForm;
|
|
||||||
import com.java2nb.novel.service.UserService;
|
import com.java2nb.novel.service.UserService;
|
||||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||||
import com.java2nb.novel.core.exception.BusinessException;
|
import com.java2nb.novel.core.exception.BusinessException;
|
||||||
@ -29,7 +28,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.book;
|
|
||||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.id;
|
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.id;
|
||||||
import static com.java2nb.novel.mapper.UserBookshelfDynamicSqlSupport.userBookshelf;
|
import static com.java2nb.novel.mapper.UserBookshelfDynamicSqlSupport.userBookshelf;
|
||||||
import static com.java2nb.novel.mapper.UserDynamicSqlSupport.*;
|
import static com.java2nb.novel.mapper.UserDynamicSqlSupport.*;
|
||||||
@ -59,11 +57,11 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetails register(UserForm form) {
|
public UserDetails register(User user) {
|
||||||
//查询用户名是否已注册
|
//查询用户名是否已注册
|
||||||
SelectStatementProvider selectStatement = select(count(id))
|
SelectStatementProvider selectStatement = select(count(id))
|
||||||
.from(user)
|
.from(UserDynamicSqlSupport.user)
|
||||||
.where(username, isEqualTo(form.getUsername()))
|
.where(username, isEqualTo(user.getUsername()))
|
||||||
.build()
|
.build()
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
.render(RenderingStrategies.MYBATIS3);
|
||||||
long count = userMapper.count(selectStatement);
|
long count = userMapper.count(selectStatement);
|
||||||
@ -72,7 +70,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
throw new BusinessException(ResponseStatus.USERNAME_EXIST);
|
throw new BusinessException(ResponseStatus.USERNAME_EXIST);
|
||||||
}
|
}
|
||||||
User entity = new User();
|
User entity = new User();
|
||||||
BeanUtils.copyProperties(form,entity);
|
BeanUtils.copyProperties(user,entity);
|
||||||
//数据库生成注册记录
|
//数据库生成注册记录
|
||||||
Long id = new IdWorker().nextId();
|
Long id = new IdWorker().nextId();
|
||||||
entity.setId(id);
|
entity.setId(id);
|
||||||
@ -91,12 +89,12 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetails login(UserForm form) {
|
public UserDetails login(User user) {
|
||||||
//根据用户名密码查询记录
|
//根据用户名密码查询记录
|
||||||
SelectStatementProvider selectStatement = select(id, username,nickName)
|
SelectStatementProvider selectStatement = select(id, username,nickName)
|
||||||
.from(user)
|
.from(UserDynamicSqlSupport.user)
|
||||||
.where(username, isEqualTo(form.getUsername()))
|
.where(username, isEqualTo(user.getUsername()))
|
||||||
.and(password, isEqualTo(MD5Util.MD5Encode(form.getPassword(), Charsets.UTF_8.name())))
|
.and(password, isEqualTo(MD5Util.MD5Encode(user.getPassword(), Charsets.UTF_8.name())))
|
||||||
.build()
|
.build()
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
.render(RenderingStrategies.MYBATIS3);
|
||||||
List<User> users = userMapper.selectMany(selectStatement);
|
List<User> users = userMapper.selectMany(selectStatement);
|
||||||
@ -105,10 +103,10 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
//生成UserDetail对象并返回
|
//生成UserDetail对象并返回
|
||||||
UserDetails userDetails = new UserDetails();
|
UserDetails userDetails = new UserDetails();
|
||||||
User user = users.get(0);
|
user = users.get(0);
|
||||||
userDetails.setId(user.getId());
|
userDetails.setId(user.getId());
|
||||||
userDetails.setNickName(user.getNickName());
|
userDetails.setNickName(user.getNickName());
|
||||||
userDetails.setUsername(form.getUsername());
|
userDetails.setUsername(user.getUsername());
|
||||||
return userDetails;
|
return userDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,12 +230,9 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUserInfo(Long userId, User user) {
|
public void updateUserInfo(Long userId, User user) {
|
||||||
User updateUser = new User();
|
user.setId(userId);
|
||||||
updateUser.setId(userId);
|
user.setUpdateTime(new Date());
|
||||||
updateUser.setNickName(user.getNickName());
|
userMapper.updateByPrimaryKeySelective(user);
|
||||||
updateUser.setUserSex(user.getUserSex());
|
|
||||||
updateUser.setUpdateTime(new Date());
|
|
||||||
userMapper.updateByPrimaryKeySelective(updateUser);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
novel-front/src/main/resources/static/images/404.jpeg
Normal file
BIN
novel-front/src/main/resources/static/images/404.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
17
novel-front/src/main/resources/templates/404.html
Normal file
17
novel-front/src/main/resources/templates/404.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Page Not Found</title>
|
||||||
|
<script>
|
||||||
|
setTimeout(function () {
|
||||||
|
location.href = '/';
|
||||||
|
},3000)
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body style="background: url(/images/404.jpeg) no-repeat;" >
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>novel-common</module>
|
<module>novel-common</module>
|
||||||
<module>novel-front</module>
|
<module>novel-front</module>
|
||||||
|
@ -491,13 +491,6 @@ CREATE TABLE `sys_dept` (
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of sys_dept
|
-- Records of sys_dept
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `sys_dept` VALUES ('6', '0', '研发部', '1', '1');
|
|
||||||
INSERT INTO `sys_dept` VALUES ('7', '6', '研發一部', '1', '1');
|
|
||||||
INSERT INTO `sys_dept` VALUES ('8', '6', '研发二部', '2', '1');
|
|
||||||
INSERT INTO `sys_dept` VALUES ('9', '0', '销售部', '2', '1');
|
|
||||||
INSERT INTO `sys_dept` VALUES ('10', '9', '销售一部', '1', '1');
|
|
||||||
INSERT INTO `sys_dept` VALUES ('11', '0', '产品部', '3', '1');
|
|
||||||
INSERT INTO `sys_dept` VALUES ('12', '11', '产品一部', '1', '1');
|
|
||||||
INSERT INTO `sys_dept` VALUES ('13', '0', '测试部', '5', '1');
|
INSERT INTO `sys_dept` VALUES ('13', '0', '测试部', '5', '1');
|
||||||
INSERT INTO `sys_dept` VALUES ('14', '13', '测试一部', '1', '1');
|
INSERT INTO `sys_dept` VALUES ('14', '13', '测试一部', '1', '1');
|
||||||
INSERT INTO `sys_dept` VALUES ('15', '13', '测试二部', '2', '1');
|
INSERT INTO `sys_dept` VALUES ('15', '13', '测试二部', '2', '1');
|
||||||
@ -894,52 +887,6 @@ CREATE TABLE `sys_log` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1412 DEFAULT CHARSET=utf8 COMMENT='系统日志';
|
) ENGINE=InnoDB AUTO_INCREMENT=1412 DEFAULT CHARSET=utf8 COMMENT='系统日志';
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_log
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_log` VALUES ('1369', '-1', '获取用户信息为空', '登录', '462', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:09:21');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1370', '-1', '获取用户信息为空', '登录', '19', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:09:26');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1371', '1', 'admin', '登录', '98', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:09:33');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1372', '1', 'admin', '请求访问主页', '372', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:09:33');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1373', '1', 'admin', '请求访问主页', '28', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:12:41');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1374', '1', 'admin', '编辑角色', '11', 'com.java2nb.system.controller.RoleController.edit()', null, '127.0.0.1', '2020-05-13 11:18:42');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1375', '1', 'admin', '添加菜单', '2', 'com.java2nb.system.controller.MenuController.add()', null, '127.0.0.1', '2020-05-13 11:19:55');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1376', '1', 'admin', '保存菜单', '225', 'com.java2nb.system.controller.MenuController.save()', null, '127.0.0.1', '2020-05-13 11:24:42');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1377', '1', 'admin', '编辑菜单', '15', 'com.java2nb.system.controller.MenuController.edit()', null, '127.0.0.1', '2020-05-13 11:24:54');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1378', '1', 'admin', '编辑菜单', '11', 'com.java2nb.system.controller.MenuController.edit()', null, '127.0.0.1', '2020-05-13 11:24:58');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1379', '1', 'admin', '更新菜单', '241', 'com.java2nb.system.controller.MenuController.update()', null, '127.0.0.1', '2020-05-13 11:25:12');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1380', '1', 'admin', '编辑菜单', '8', 'com.java2nb.system.controller.MenuController.edit()', null, '127.0.0.1', '2020-05-13 11:25:16');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1381', '1', 'admin', '更新菜单', '199', 'com.java2nb.system.controller.MenuController.update()', null, '127.0.0.1', '2020-05-13 11:25:26');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1382', '1', 'admin', '编辑角色', '13', 'com.java2nb.system.controller.RoleController.edit()', null, '127.0.0.1', '2020-05-13 11:26:11');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1383', '1', 'admin', '更新角色', '931', 'com.java2nb.system.controller.RoleController.update()', null, '127.0.0.1', '2020-05-13 11:26:36');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1384', '-1', '获取用户信息为空', '登录', '11', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:27:02');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1385', '1', 'admin', '登录', '19', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:27:08');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1386', '1', 'admin', '请求访问主页', '27', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:27:08');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1387', '1', 'admin', '登录', '272', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:27:56');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1388', '1', 'admin', '请求访问主页', '109', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:27:56');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1389', '1', 'admin', '编辑角色', '8', 'com.java2nb.system.controller.RoleController.edit()', null, '127.0.0.1', '2020-05-13 11:30:36');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1390', '1', 'admin', '更新角色', '567', 'com.java2nb.system.controller.RoleController.update()', null, '127.0.0.1', '2020-05-13 11:30:42');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1391', '-1', '获取用户信息为空', '登录', '246', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:31:38');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1392', '1', 'admin', '登录', '38', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:31:42');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1393', '1', 'admin', '请求访问主页', '110', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:31:43');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1394', '1', 'admin', 'error', null, 'http://127.0.0.1/test/order/list', 'org.springframework.jdbc.BadSqlGrammarException: \r\n### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Table \'novel_plus.fb_order\' doesn\'t exist\r\n### The error may exist in file [E:\\baseprojectparent\\novel-plus\\novel-admin\\target\\classes\\mybatis\\test\\OrderMapper.xml]\r\n### The error may involve defaultParameterMap\r\n### The error occurred while setting parameters\r\n### SQL: select `id`,`fb_merchant_code`,`merchant_order_sn`,`order_sn`,`platform_order_no`,`trade_no`,`order_state`,`fn_coupon`,`red_packet`,`total_fee`,`order_price`,`fee`,`body`,`attach`,`store_id`,`cashier_id`,`device_no`,`user_id`,`user_logon_id`,`pay_time`,`pay_channel`,`no_cash_coupon_fee`,`cash_coupon_fee`,`cash_fee`,`sign`,`options`,`create_time`,`push_time`,`push_ip`,`mcht_id`,`sn` from fb_order order by id desc limit ?, ?\r\n### Cause: java.sql.SQLSyntaxErrorException: Table \'novel_plus.fb_order\' doesn\'t exist\n; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Table \'novel_plus.fb_order\' doesn\'t exist', null, '2020-05-13 11:33:27');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1395', '1', 'admin', '登录', '276', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:39:20');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1396', '1', 'admin', '请求访问主页', '95', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:39:20');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1397', '1', 'admin', '登录', '285', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:47:00');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1398', '1', 'admin', '请求访问主页', '90', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:47:00');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1399', '1', 'admin', '登录', '251', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 11:48:28');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1400', '1', 'admin', '请求访问主页', '95', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 11:48:28');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1401', '1', 'admin', '登录', '302', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 14:09:33');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1402', '1', 'admin', '请求访问主页', '88', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 14:09:34');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1403', '1', 'admin', '请求更改用户密码', '3', 'com.java2nb.system.controller.UserController.resetPwd()', null, '127.0.0.1', '2020-05-13 14:11:49');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1404', '1', 'admin', 'admin提交更改用户密码', '140', 'com.java2nb.system.controller.UserController.adminResetPwd()', null, '127.0.0.1', '2020-05-13 14:11:50');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1405', '1', 'admin', '请求更改用户密码', '4', 'com.java2nb.system.controller.UserController.resetPwd()', null, '127.0.0.1', '2020-05-13 14:12:11');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1406', '1', 'admin', '登录', '275', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 14:14:26');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1407', '1', 'admin', '请求访问主页', '73', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 14:14:27');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1408', '1', 'admin', 'error', null, 'http://127.0.0.1/novel/author/update', 'org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors\nField error in object \'authorDO\' on field \'id\': rejected value [1,1]; codes [typeMismatch.authorDO.id,typeMismatch.id,typeMismatch.java.lang.Long,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [authorDO.id,id]; arguments []; default message [id]]; default message [Failed to convert property value of type \'java.lang.String\' to required type \'java.lang.Long\' for property \'id\'; nested exception is java.lang.NumberFormatException: For input string: \"1,1\"]', null, '2020-05-13 14:14:38');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1409', '1', 'admin', 'error', null, 'http://127.0.0.1/novel/author/update', 'org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors\nField error in object \'authorDO\' on field \'id\': rejected value [1,1]; codes [typeMismatch.authorDO.id,typeMismatch.id,typeMismatch.java.lang.Long,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [authorDO.id,id]; arguments []; default message [id]]; default message [Failed to convert property value of type \'java.lang.String\' to required type \'java.lang.Long\' for property \'id\'; nested exception is java.lang.NumberFormatException: For input string: \"1,1\"]', null, '2020-05-13 14:14:47');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1410', '1', 'admin', '登录', '261', 'com.java2nb.system.controller.LoginController.ajaxLogin()', null, '127.0.0.1', '2020-05-13 14:18:07');
|
|
||||||
INSERT INTO `sys_log` VALUES ('1411', '1', 'admin', '请求访问主页', '83', 'com.java2nb.system.controller.LoginController.index()', null, '127.0.0.1', '2020-05-13 14:18:07');
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for sys_menu
|
-- Table structure for sys_menu
|
||||||
@ -1047,9 +994,6 @@ CREATE TABLE `sys_role` (
|
|||||||
-- Records of sys_role
|
-- Records of sys_role
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `sys_role` VALUES ('1', '超级用户角色', 'admin', '拥有最高权限', '2', '2017-08-12 00:43:52', '2017-08-12 19:14:59');
|
INSERT INTO `sys_role` VALUES ('1', '超级用户角色', 'admin', '拥有最高权限', '2', '2017-08-12 00:43:52', '2017-08-12 19:14:59');
|
||||||
INSERT INTO `sys_role` VALUES ('59', '普通用户', null, '基本用户权限', null, null, null);
|
|
||||||
INSERT INTO `sys_role` VALUES ('60', '测试', null, '<div>', null, null, null);
|
|
||||||
INSERT INTO `sys_role` VALUES ('61', 'test', null, '测试', null, null, null);
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for sys_role_data_perm
|
-- Table structure for sys_role_data_perm
|
||||||
@ -1497,19 +1441,7 @@ CREATE TABLE `sys_user` (
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of sys_user
|
-- Records of sys_user
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `sys_user` VALUES ('1', 'admin', '超级管理员', 'd633268afedf209e1e4ea0f5f43228a8', '6', 'admin@example.com', '17699999999', '1', '1', '2017-08-15 21:40:39', '2017-08-15 21:41:00', '96', '2017-12-14 00:00:00', '148', 'ccc', '122;121;', '北京市', '北京市市辖区', '东城区');
|
INSERT INTO `sys_user` VALUES ('1', 'admin', '超级管理员', 'd633268afedf209e1e4ea0f5f43228a8', '14', 'admin@example.com', '17699999999', '1', '1', '2017-08-15 21:40:39', '2017-08-15 21:41:00', '96', '2017-12-14 00:00:00', '148', 'ccc', '122;121;', '北京市', '北京市市辖区', '东城区');
|
||||||
INSERT INTO `sys_user` VALUES ('2', 'test', '临时用户', 'd0af8fa1272ef5a152d9e27763eea293', '6', 'test@bootdo.com', null, '1', '1', '2017-08-14 13:43:05', '2017-08-14 21:15:36', null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('36', 'ldh', '刘德华', 'bfd9394475754fbe45866eba97738c36', '7', 'ldh@bootdo.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('123', 'zxy', '张学友', '35174ba93f5fe7267f1fb3c1bf903781', '6', 'zxy@bootdo', null, '0', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('124', 'wyf', '吴亦凡', 'e179e6f687bbd57b9d7efc4746c8090a', '6', 'wyf@bootdo.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('130', 'lh', '鹿晗', '7924710cd673f68967cde70e188bb097', '9', 'lh@bootdo.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('131', 'lhc', '令狐冲', 'd515538e17ecb570ba40344b5618f5d4', '6', 'lhc@bootdo.com', null, '0', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('132', 'lyf', '刘亦菲', '7fdb1d9008f45950c1620ba0864e5fbd', '13', 'lyf@bootdo.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('134', 'lyh', '李彦宏', 'dc26092b3244d9d432863f2738180e19', '8', 'lyh@bootdo.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('135', 'wjl', '王健林', '3967697dfced162cf6a34080259b83aa', '6', 'wjl@bootod.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('136', 'gdg', '郭德纲', '3bb1bda86bc02bf6478cd91e42135d2f', '9', 'gdg@bootdo.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('137', 'test2', 'test2', '649169898e69272c0e5bc899baf1e904', null, '1179705413@qq.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
INSERT INTO `sys_user` VALUES ('138', 'test3', 'test3', '79ba2d0b58d8a2e94f6b18744c8cd280', '16', '1179705413@qq.com', null, '1', null, null, null, null, null, null, null, null, null, null, null);
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for sys_user_role
|
-- Table structure for sys_user_role
|
||||||
|
Reference in New Issue
Block a user