作者 cmy

Initial commit

正在显示 36 个修改的文件 包含 4796 行增加0 行删除

要显示太多修改。

为保证性能只显示 36 of 36+ 个文件。

  1 +Manifest-Version: 1.0
  2 +Class-Path:
  3 +
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  3 + <display-name>RestartGateWay</display-name>
  4 + <welcome-file-list>
  5 + <welcome-file>index.html</welcome-file>
  6 + <welcome-file>index.htm</welcome-file>
  7 + <welcome-file>index.jsp</welcome-file>
  8 + <welcome-file>default.html</welcome-file>
  9 + <welcome-file>default.htm</welcome-file>
  10 + <welcome-file>default.jsp</welcome-file>
  11 + </welcome-file-list>
  12 +
  13 +
  14 + <context-param>
  15 + <param-name>contextConfigLocation</param-name>
  16 + <param-value>com.sinocontact.app.App</param-value>
  17 + </context-param>
  18 +
  19 + <listener>
  20 + <listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
  21 + </listener>
  22 +
  23 +</web-app>
  1 +<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
  2 +<%
  3 +String path = request.getContextPath();
  4 +String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  5 +%>
  6 +
  7 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  8 +<html>
  9 + <head>
  10 + <base href="<%=basePath%>">
  11 +
  12 + <title>My JSP 'index.jsp' starting page</title>
  13 + <meta http-equiv="pragma" content="no-cache">
  14 + <meta http-equiv="cache-control" content="no-cache">
  15 + <meta http-equiv="expires" content="0">
  16 + <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  17 + <meta http-equiv="description" content="This is my page">
  18 + <!--
  19 + <link rel="stylesheet" type="text/css" href="styles.css">
  20 + -->
  21 + </head>
  22 +
  23 + <body>
  24 + This is my JSP page. <br>
  25 + </body>
  26 +</html>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 +
  5 + <parent>
  6 + <groupId>org.springframework.boot</groupId>
  7 + <artifactId>spring-boot-starter-parent</artifactId>
  8 + <version>1.5.15.RELEASE</version>
  9 + <relativePath/> <!-- lookup parent from repository -->
  10 + </parent>
  11 +
  12 + <groupId>com.sinocontact</groupId>
  13 + <artifactId>poet_ready_system</artifactId>
  14 + <version>0.0.1-SNAPSHOT</version>
  15 + <packaging>war</packaging>
  16 + <name>prs</name>
  17 + <description/>
  18 +
  19 + <properties>
  20 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  21 + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  22 + <java.version>1.8</java.version>
  23 + </properties>
  24 +
  25 +
  26 + <dependencies>
  27 +
  28 + <dependency>
  29 + <groupId>org.springframework.boot</groupId>
  30 + <artifactId>spring-boot-starter</artifactId>
  31 + <exclusions>
  32 + <exclusion>
  33 + <groupId>org.springframework.boot</groupId>
  34 + <artifactId>spring-boot-starter-logging</artifactId>
  35 + </exclusion>
  36 + </exclusions>
  37 + </dependency>
  38 +
  39 + <dependency>
  40 + <groupId>org.springframework.boot</groupId>
  41 + <artifactId>spring-boot-starter-web</artifactId>
  42 + <exclusions>
  43 + <exclusion>
  44 + <groupId>org.springframework.boot</groupId>
  45 + <artifactId>spring-boot-starter-logging</artifactId>
  46 + </exclusion>
  47 + </exclusions>
  48 + </dependency>
  49 +
  50 +
  51 + <dependency>
  52 + <groupId>org.mybatis.spring.boot</groupId>
  53 + <artifactId>mybatis-spring-boot-starter</artifactId>
  54 + <version>1.3.2</version>
  55 + </dependency>
  56 +
  57 + <dependency>
  58 + <groupId>org.springframework.boot</groupId>
  59 + <artifactId>spring-boot-starter-log4j</artifactId>
  60 + <version>1.3.8.RELEASE</version>
  61 + </dependency>
  62 +
  63 +
  64 + <dependency>
  65 + <groupId>mysql</groupId>
  66 + <artifactId>mysql-connector-java</artifactId>
  67 + <version>5.1.21</version>
  68 + </dependency>
  69 +
  70 + <dependency>
  71 + <groupId>org.springframework.boot</groupId>
  72 + <artifactId>spring-boot-starter-freemarker</artifactId>
  73 + </dependency>
  74 +
  75 +
  76 + <dependency>
  77 + <groupId>org.springframework.boot</groupId>
  78 + <artifactId>spring-boot-starter-test</artifactId>
  79 + <scope>test</scope>
  80 + </dependency>
  81 +
  82 + <dependency>
  83 + <groupId>org.jsoup</groupId>
  84 + <artifactId>jsoup</artifactId>
  85 + <version>1.11.3</version>
  86 + </dependency>
  87 +
  88 +
  89 + <dependency>
  90 + <groupId>com.alibaba</groupId>
  91 + <artifactId>fastjson</artifactId>
  92 + <version>1.2.15</version>
  93 + </dependency>
  94 +
  95 + <dependency>
  96 + <groupId>com.alibaba</groupId>
  97 + <artifactId>druid</artifactId>
  98 + <version>1.1.0</version>
  99 + </dependency>
  100 +
  101 + <dependency>
  102 + <groupId>org.springframework.boot</groupId>
  103 + <artifactId>spring-boot-devtools</artifactId>
  104 + <optional>true</optional>
  105 + </dependency>
  106 +
  107 + <!--上传小说封面到OSS-->
  108 + <dependency>
  109 + <groupId>com.aliyun.oss</groupId>
  110 + <artifactId>aliyun-sdk-oss</artifactId>
  111 + <version>2.8.3</version>
  112 + </dependency>
  113 +
  114 + <!--腾讯云短信发送验证码-->
  115 + <dependency>
  116 + <groupId>com.github.qcloudsms</groupId>
  117 + <artifactId>qcloudsms</artifactId>
  118 + <version>1.0.6</version>
  119 + </dependency>
  120 +
  121 + </dependencies>
  122 +
  123 + <build>
  124 + <plugins>
  125 + <plugin>
  126 + <groupId>org.springframework.boot</groupId>
  127 + <artifactId>spring-boot-maven-plugin</artifactId>
  128 + </plugin>
  129 + </plugins>
  130 + </build>
  131 +
  132 +</project>
  1 +package com.sinocontact.app;
  2 +
  3 +import org.mybatis.spring.annotation.MapperScan;
  4 +import org.springframework.boot.SpringApplication;
  5 +import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  6 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  7 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  8 +import org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration;
  9 +import org.springframework.boot.builder.SpringApplicationBuilder;
  10 +import org.springframework.boot.web.support.SpringBootServletInitializer;
  11 +import org.springframework.context.annotation.Configuration;
  12 +import org.springframework.transaction.annotation.EnableTransactionManagement;
  13 +
  14 +@Configuration
  15 +@EnableTransactionManagement
  16 +@MapperScan(basePackages = "com.sinocontact.app.dao")
  17 +@SpringBootApplication
  18 +public class App extends SpringBootServletInitializer {
  19 +
  20 + @Override
  21 + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  22 + return application.sources(App.class);
  23 + }
  24 +
  25 +
  26 + public static void main(String[] args) {
  27 + SpringApplication.run(App.class, args);
  28 + }
  29 +
  30 +}
  31 +
  1 +package com.sinocontact.app.common;
  2 +
  3 +/**
  4 + * 静态常量
  5 + * @author todd
  6 + * @since 2019/1/21
  7 + */
  8 +public class CommonConstant {
  9 + //登录成功
  10 + public final static String SESSION_KEY="user";
  11 +
  12 + /**
  13 + * 图形验证码
  14 + */
  15 + public static final String VERCODE_KEY = "verCode";
  16 +
  17 + /**
  18 + * 短信验证码
  19 + */
  20 + public static final String PHONE = "phone";
  21 +
  22 +
  23 + /**
  24 + * 短信应用sdk APPID
  25 + */
  26 + public final static Integer APP_ID = 1400182140;
  27 +
  28 + /**
  29 + * 短信应用SDK APPkey
  30 + */
  31 + public final static String APP_KEY = "215c6a0a0b4347b1034d0151a4a046dc";
  32 +
  33 + /**
  34 + * 短信模板ID(注册验证模板)
  35 + */
  36 + public final static Integer TEMPLATE_ID = 323792;
  37 +
  38 + /**
  39 + * 短信模板id(找回密码)
  40 + */
  41 + public static final Integer TEMPLATE_FORGET_ID = 274720;
  42 +
  43 + /**
  44 + * 短信签名 “羲阳阅读网”
  45 + */
  46 + public final static String SIGN = "羲阳阅读网";
  47 +
  48 + /**
  49 + * 检索标记
  50 + */
  51 + public final static Integer CLICK_FLAG = 1;
  52 + public final static Integer RECOMMEND_FLAG = 2;
  53 + public final static Integer COLLECT_FLAG = 3;
  54 + public final static Integer TOTAL_FLAG = 0;
  55 +
  56 +
  57 + /**
  58 + * 未登录
  59 + */
  60 + public final static String ONE_MONTH_NO_LOGIN = "未登录";
  61 +
  62 +
  63 + /**
  64 + * 登录过
  65 + */
  66 + public final static String ONE_MONTH_LOGIN = "登录过";
  67 +
  68 + /**
  69 + * 分页数据大小
  70 + */
  71 + public final static Integer PAGE_SIZE = 10;
  72 +
  73 +
  74 + /**
  75 + * 当昵称为空时留言显示
  76 + */
  77 + public final static String NICKNAME_IS_NULL = "佚名";
  78 +
  79 +}
  1 +package com.sinocontact.app.config;
  2 +
  3 +import com.sinocontact.app.interceptor.SecurityInterceptor;
  4 +import org.apache.log4j.Logger;
  5 +import org.springframework.context.annotation.Configuration;
  6 +import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
  7 +import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
  8 +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
  9 +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
  10 +
  11 +@Configuration
  12 +public class AppWebConfig extends WebMvcConfigurerAdapter {
  13 + private static final Logger logger= Logger.getLogger(AppWebConfig.class);
  14 + /**
  15 + *添加资源路径
  16 + */
  17 + @Override
  18 + public void addResourceHandlers(ResourceHandlerRegistry registry){
  19 + //添加静态资源路径
  20 + registry.addResourceHandler("/static/**").addResourceLocations("classPath/static/");
  21 + //添加其他资源路径
  22 + //....
  23 + }
  24 +
  25 + /**
  26 + * 添加拦截器
  27 + */
  28 +
  29 + public void addInterceptors(InterceptorRegistry registry){
  30 + //添加一个登录拦截器
  31 + addSecurityInterceptors(registry);
  32 + }
  33 +
  34 + /**
  35 + * 添加登录拦截器
  36 + * @author todd
  37 + * @since 2019/1/21
  38 + */
  39 + private void addSecurityInterceptors(InterceptorRegistry registry){
  40 + InterceptorRegistration addInterceptor = registry.addInterceptor(new SecurityInterceptor());
  41 +
  42 + //登录相关
  43 + addInterceptor.excludePathPatterns("/user/**");
  44 +
  45 +
  46 + // 拦截配置
  47 + addInterceptor.addPathPatterns("/**");
  48 + }
  49 +
  50 +}
  1 +package com.sinocontact.app.controller;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.sinocontact.app.common.CommonConstant;
  5 +import com.sinocontact.app.dao.ranking.RankingMapper;
  6 +import com.sinocontact.app.entity.User;
  7 +import com.sinocontact.app.service.ranking.RankingService;
  8 +import org.apache.log4j.Logger;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.ui.Model;
  11 +import org.springframework.web.bind.annotation.ModelAttribute;
  12 +
  13 +import javax.servlet.http.Cookie;
  14 +import javax.servlet.http.HttpServletRequest;
  15 +import javax.servlet.http.HttpServletResponse;
  16 +import javax.servlet.http.HttpSession;
  17 +
  18 +/**
  19 + * 所有controller的基类
  20 + * @author todd
  21 + * @since 2019/1/22
  22 + */
  23 +@Controller
  24 +public class BaseController {
  25 +
  26 + private static final Logger logger = Logger.getLogger(BaseController.class);
  27 +
  28 + //公用
  29 + private HttpServletRequest request ;
  30 + private HttpServletResponse response;
  31 + private Model model;
  32 + private HttpSession session;
  33 +
  34 + public HttpServletRequest getRequest() {
  35 + return request;
  36 + }
  37 + public HttpServletResponse getResponse() {
  38 + return response;
  39 + }
  40 + public Model getModel() {
  41 + return model;
  42 + }
  43 + public HttpSession getSession() {
  44 + return session;
  45 + }
  46 +
  47 + @ModelAttribute
  48 + public void setModel(HttpServletRequest request,HttpServletResponse response,Model model,HttpSession session){
  49 + this.model = model;
  50 + this.request = request;
  51 + this.response = response;
  52 + this.session = session;
  53 + }
  54 +
  55 + /**
  56 + * 得到request中参数
  57 + * @author todd
  58 + * @since 2019/1/22
  59 + */
  60 + public String getParameter(String name){
  61 + return this.getRequest().getParameter(name);
  62 + }
  63 +
  64 + /**
  65 + * 添加页面变量属性
  66 + * @author todd
  67 + * @since 2019/1/22
  68 + */
  69 + public void putObject(String name, Object obj){
  70 + model.addAttribute(name, obj);
  71 + }
  72 +
  73 + /**
  74 + * 向cookie中写入一条记录
  75 + * @author todd
  76 + * @since 2019/1/22
  77 + */
  78 + public void setCookieValue(String name, String value){
  79 + try{
  80 + Cookie cookie = new Cookie(name,value);
  81 + cookie.setPath("/");
  82 + response.addCookie(cookie);
  83 + }catch(Exception e){
  84 + logger.error("向cookie中写入name="+name+",value="+value+"出现异常:",e);
  85 + }
  86 + }
  87 +
  88 + /**
  89 + * 设置cookie失效时间
  90 + * @param expiry 失效时间(秒)
  91 + * @author todd
  92 + * @since 2019/1/22
  93 + */
  94 + public void setCookieValue(String name, String value, int expiry){
  95 + try{
  96 + Cookie cookie = new Cookie(name,value);
  97 + cookie.setMaxAge(expiry);
  98 + cookie.setPath("/");
  99 + response.addCookie(cookie);
  100 + }catch(Exception e){
  101 + logger.error("向cookie中写入name="+name+",value="+value+"出现异常:",e);
  102 + }
  103 + }
  104 +
  105 + /**
  106 + * 删除指定的cookie
  107 + * @author todd
  108 + * @since 2019/1/22
  109 + */
  110 + public void deleteCookie(String name){
  111 + try{
  112 + Cookie cookie = new Cookie(name,"");
  113 + cookie.setMaxAge(0);
  114 + cookie.setPath("/");
  115 + response.addCookie(cookie);
  116 + }catch(Exception e){
  117 + logger.error("删除cookie"+name+"出现异常:",e);
  118 + }
  119 + }
  120 +
  121 + /**
  122 + * 从cookie中获取key为name的值
  123 + * @author todd
  124 + * @since 2019/1/22
  125 + */
  126 + public String getCookieValue(String name){
  127 + String value = null;
  128 + try{
  129 + Cookie[] cookies = request.getCookies();
  130 + if(cookies == null)
  131 + return value;
  132 +
  133 + //遍历方式查找Cookies中是否存在 name
  134 + for(Cookie c : cookies){
  135 + if(c.getName().equals(name) == true){//在cookies中找到name的cookie
  136 + value = c.getValue();
  137 + break;
  138 + }
  139 + }
  140 + }catch(Exception e){
  141 + value = null;
  142 + logger.error("获取cookie中name="+name+"的数据时出现异常:",e);
  143 + }
  144 + return value;
  145 + }
  146 +
  147 + /**
  148 + * 把javabean转换为json字符串
  149 + * @author todd
  150 + * @since 2019/1/22
  151 + */
  152 + public String renderJSON(Object javaObject){
  153 + return JSON.toJSON(javaObject).toString();
  154 + }
  155 +
  156 + /**
  157 + * 获取用户信息
  158 + * @return User
  159 + * @author caoMingYang
  160 + * @since 2019/4/12 15:12
  161 + */
  162 + public User getUserInfo(){
  163 + return (User) getSession().getAttribute(CommonConstant.SESSION_KEY);
  164 + }
  165 +
  166 +
  167 +
  168 + /**
  169 + * 得到ip地址
  170 + * @author todd
  171 + * @since 2019/1/22
  172 + */
  173 + public String getIp() {
  174 + String ip = getRequest().getHeader("x-forwarded-for");
  175 + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
  176 + ip = getRequest().getHeader("Proxy-Client-IP");
  177 + }
  178 + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
  179 + ip = getRequest().getHeader("WL-Proxy-Client-IP");
  180 + }
  181 + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
  182 + ip = getRequest().getRemoteAddr();
  183 + }
  184 + return ip;
  185 + }
  186 +}
  1 +package com.sinocontact.app.controller;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.common.CommonConstant;
  5 +import com.sinocontact.app.entity.Chapter;
  6 +import com.sinocontact.app.entity.Comment;
  7 +import com.sinocontact.app.entity.Novel;
  8 +import com.sinocontact.app.entity.User;
  9 +import com.sinocontact.app.service.HomeService;
  10 +import com.sun.org.apache.bcel.internal.generic.NOP;
  11 +import com.sun.org.apache.bcel.internal.generic.RET;
  12 +import com.sun.org.apache.regexp.internal.RE;
  13 +import org.apache.ibatis.annotations.Param;
  14 +import org.apache.log4j.Logger;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.scheduling.annotation.Scheduled;
  17 +import org.springframework.scheduling.annotation.Schedules;
  18 +import org.springframework.stereotype.Controller;
  19 +import org.springframework.web.bind.annotation.RequestMapping;
  20 +import org.springframework.web.bind.annotation.RequestParam;
  21 +import org.springframework.web.bind.annotation.ResponseBody;
  22 +
  23 +import java.util.List;
  24 +
  25 +/**
  26 + * 公共的控制类
  27 + * @author caoMingYang
  28 + * @since 2019/4/25 16:10
  29 + **/
  30 +@Controller
  31 +@RequestMapping("/home")
  32 +public class HomeController extends BaseController{
  33 + private static Logger logger = Logger.getLogger(HomeController.class);
  34 +
  35 + @Autowired
  36 + private HomeService service;
  37 +
  38 + /**
  39 + * 跳转到小说详情页面
  40 + * @param novelId 小说id
  41 + * @author caoMingYang
  42 + * @since 2019/4/25 16:17
  43 + */
  44 + @RequestMapping("/novelInfo")
  45 + public String novelInfo(@RequestParam("novelId")Integer novelId){
  46 + Novel novel = service.getNovelById(novelId);
  47 + List<Chapter> chapterList = service.queryChapterList(novelId);
  48 + this.putObject("novel",novel);
  49 + this.putObject("list",chapterList);
  50 + return "views/home/novelInfo";
  51 + }
  52 +
  53 + /**
  54 + * 通过小说id获取小说最新的章节
  55 + * @param novelId 小说id
  56 + * @return chapterList
  57 + * @author caoMingYang
  58 + * @since 2019/4/27 12:27
  59 + */
  60 + @ResponseBody
  61 + @RequestMapping("/getNewChapter")
  62 + public String getNewChapter(@RequestParam("novelId")Integer novelId){
  63 + JSONObject job = new JSONObject();
  64 + List<Chapter> chapterList = service.queryFiveChapter(novelId);
  65 + if (null == chapterList){
  66 + job.put("code",-1);
  67 + job.put("msg","fail");
  68 + }else{
  69 + job.put("code",0);
  70 + job.put("msg","success");
  71 + job.put("data",chapterList);
  72 + }
  73 + return job.toJSONString();
  74 + }
  75 +
  76 + /**
  77 + * 增加点击
  78 + * @param novelId 小说id
  79 + * @author caoMingYang
  80 + * @since 2019/4/26 0:13
  81 + */
  82 + @ResponseBody
  83 + @RequestMapping("/addClick")
  84 + public String addClick(@RequestParam("novelId")Integer novelId){
  85 + JSONObject job = new JSONObject();
  86 + boolean flag = service.addClick(novelId);
  87 + if (flag) {
  88 + job.put("code", 0);
  89 + job.put("msg", "success");
  90 + }
  91 + return job.toJSONString();
  92 + }
  93 +
  94 + /**
  95 + * 推荐小说
  96 + * @param novelId 小说id
  97 + * @author caoMingYang
  98 + * @since 2019/4/28 20:33
  99 + */
  100 + @ResponseBody
  101 + @RequestMapping("/recommend")
  102 + public String recommend(@RequestParam("novelId")Integer novelId){
  103 + JSONObject job = new JSONObject();
  104 + User user = this.getUserInfo();
  105 + Integer num = service.updateRecommend(novelId,user);
  106 + if (num == 0){
  107 + job.put("code",0);
  108 + job.put("msg","success");
  109 + }else if (num == -1){
  110 + job.put("code",-1);
  111 + job.put("msg","推荐失败,系统异常!");
  112 + }else if (num == -2){
  113 + job.put("code",-1);
  114 + job.put("msg","今日已推荐三次,请明天再来!");
  115 + }
  116 + return job.toJSONString();
  117 + }
  118 +
  119 + /**
  120 + * 通过小说id将小说加入书架
  121 + * @param novelId 小说id
  122 + * @author caoMingYang
  123 + * @since 2019/4/29 22:19
  124 + */
  125 + @ResponseBody
  126 + @RequestMapping("/addBookCase")
  127 + public String addBookCase(@RequestParam("novelId")Integer novelId,
  128 + @RequestParam(value = "chapterId",defaultValue = "0")Integer chapterId){
  129 + JSONObject job = new JSONObject();
  130 + Integer num = service.addBookCase(novelId,this.getUserInfo(),chapterId);
  131 + if (num == -1){
  132 + job.put("code",-1);
  133 + job.put("msg","fail");
  134 + }else {
  135 + job.put("code",0);
  136 + job.put("msg","success");
  137 + }
  138 + return job.toJSONString();
  139 + }
  140 +
  141 + /**
  142 + * 获取小说评论
  143 + * @param novelId 小说id
  144 + * @author caoMingYang
  145 + * @since 2019/4/27 17:35
  146 + */
  147 + @ResponseBody
  148 + @RequestMapping("/getNovelComment")
  149 + public String getNovelComment(@RequestParam("novelId")Integer novelId){
  150 + JSONObject job = new JSONObject();
  151 + List<Comment> commentList = service.getNovelComment(novelId);
  152 + if (null != commentList){
  153 + job.put("code",0);
  154 + job.put("msg","success");
  155 + job.put("data",commentList);
  156 + }else{
  157 + job.put("code",-1);
  158 + job.put("msg","fail");
  159 + }
  160 + return job.toJSONString();
  161 + }
  162 +
  163 + /**
  164 + * 通过id获取小说章节详情
  165 + * @param novelId 小说id
  166 + * @param chapterId 章节id
  167 + * @author caoMingYang
  168 + * @since 2019/5/11 13:23
  169 + */
  170 + @ResponseBody
  171 + @RequestMapping("/getChapterInfo")
  172 + public String getChapterInfo(@RequestParam("novelId")Integer novelId,
  173 + @RequestParam("chapterId")Integer chapterId){
  174 + JSONObject job = new JSONObject();
  175 + Chapter chapter = service.getChapter(novelId, chapterId);
  176 + if (null != chapter){
  177 + job.put("code",0);
  178 + job.put("msg","success");
  179 + job.put("data",chapter);
  180 + }else{
  181 + job.put("code",-1);
  182 + job.put("msg","fail");
  183 + }
  184 + return job.toJSONString();
  185 + }
  186 +
  187 + /**
  188 + * 获取章节内容
  189 + * @param novelId 小说id
  190 + * @param chapterId 章节id
  191 + * @author caoMingYang
  192 + * @since 2019/5/11 18:30
  193 + */
  194 + @ResponseBody
  195 + @RequestMapping("/previousChapter")
  196 + public String previousChapter(@RequestParam("novelId")Integer novelId,
  197 + @RequestParam("chapterId")Integer chapterId){
  198 + JSONObject job = new JSONObject();
  199 + Chapter chapter = service.previousChapter(novelId, chapterId);
  200 + if (null != chapter){
  201 + if (chapter.getChapterId() != -1){
  202 + job.put("code",0);
  203 + job.put("msg","success");
  204 + job.put("data",chapter);
  205 + }else {
  206 + job.put("code",1);
  207 + job.put("msg","success");
  208 + }
  209 + }else {
  210 + job.put("code",-1);
  211 + job.put("msg","fail");
  212 + }
  213 + return job.toJSONString();
  214 + }
  215 +
  216 + /**
  217 + * 获取章节内容
  218 + * @param novelId 小说id
  219 + * @param chapterId 章节id
  220 + * @author caoMingYang
  221 + * @since 2019/5/11 18:30
  222 + */
  223 + @ResponseBody
  224 + @RequestMapping("/nextChapter")
  225 + public String nextChapter(@RequestParam("novelId")Integer novelId,
  226 + @RequestParam("chapterId")Integer chapterId){
  227 + JSONObject job = new JSONObject();
  228 + Chapter chapter = service.nextChapter(novelId, chapterId);
  229 + if (null != chapter){
  230 + if (chapter.getChapterId() != -1){
  231 + job.put("code",0);
  232 + job.put("msg","success");
  233 + job.put("data",chapter);
  234 + }else {
  235 + job.put("code",1);
  236 + job.put("msg","success");
  237 + }
  238 + }else {
  239 + job.put("code",-1);
  240 + job.put("msg","fail");
  241 + }
  242 + return job.toJSONString();
  243 + }
  244 +
  245 + /**
  246 + * 保存用户评论
  247 + * @param novelId 小说id
  248 + * @param comment 评论
  249 + * @author caoMingYang
  250 + * @since 2019/5/25 13:53
  251 + */
  252 + @ResponseBody
  253 + @RequestMapping("/saveComment")
  254 + public String saveComment(@RequestParam("novelId")Integer novelId,
  255 + @RequestParam(value = "comment",defaultValue = "")String comment){
  256 + JSONObject job = new JSONObject();
  257 + User user = (User) this.getSession().getAttribute(CommonConstant.SESSION_KEY);
  258 + boolean flag = service.saveComment(user.getUserId(),novelId,comment);
  259 + if (flag){
  260 + job.put("code",0);
  261 + job.put("msg","success");
  262 + }else{
  263 + job.put("code",-1);
  264 + job.put("msg","fail");
  265 + }
  266 + return job.toJSONString();
  267 + }
  268 +
  269 + /**
  270 + * 更新用户推荐次数
  271 + * @author caoMingYang
  272 + * @since 2019/5/18 0:18
  273 + */
  274 + @Scheduled(cron = "0 0 1 * * ?")
  275 + public void updateUserRecommendTimes(){
  276 + logger.info("推荐次数更新开始>>>>>>>>>>>>>>>>>>>>>>>>>");
  277 + Integer num = service.updateRecommendTimes();
  278 + if (num == -1 || num == 0){
  279 + logger.error("更新用户每日推荐次数异常");
  280 + }else {
  281 + logger.info("更新了【"+num+"】人的每日推荐次数!");
  282 + }
  283 + logger.info("推荐次数更新结束<<<<<<<<<<<<<<<<<<<<<<<<<");
  284 + }
  285 +
  286 +}
  1 +package com.sinocontact.app.controller.authorCenter;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.sinocontact.app.common.CommonConstant;
  6 +import com.sinocontact.app.controller.BaseController;
  7 +import com.sinocontact.app.entity.Novel;
  8 +import com.sinocontact.app.entity.User;
  9 +import com.sinocontact.app.service.authorCenter.AuthorCenterService;
  10 +import org.apache.log4j.Logger;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Controller;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.bind.annotation.ResponseBody;
  16 +
  17 +import java.io.File;
  18 +import java.util.List;
  19 +
  20 +/**
  21 + * 作者中心
  22 + * @author caoMingYang
  23 + * @Description TODO
  24 + * @since 2019/5/20 14:03
  25 + **/
  26 +@Controller
  27 +@RequestMapping("/author")
  28 +public class AuthorCenterController extends BaseController {
  29 +
  30 + private static Logger logger = Logger.getLogger(AuthorCenterController.class);
  31 +
  32 + @Autowired
  33 + private AuthorCenterService service;
  34 +
  35 + /**
  36 + * 跳转到作者所有作品页面
  37 + */
  38 + @RequestMapping("/index")
  39 + public String index(){
  40 + return "views/authorCenter/index";
  41 + }
  42 +
  43 +
  44 + /**
  45 + * 获取作者写的所有小说
  46 + * @param page 页码
  47 + * @param pageSize 一页数据条数
  48 + * @author caoMingYang
  49 + * @since 2019/5/20 22:51
  50 + */
  51 + @ResponseBody
  52 + @RequestMapping("novelList")
  53 + public String novelList(@RequestParam(value = "page",defaultValue = "1")Integer page,
  54 + @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
  55 + User user = (User) this.getSession().getAttribute(CommonConstant.SESSION_KEY);
  56 + JSONObject job = new JSONObject();
  57 + List<Novel> novelList = service.queryNovelList(user.getUserId(),page,pageSize);
  58 + Integer count = service.queryNovelCount(user.getUserId());
  59 + job.put("code",0);
  60 + job.put("msg","success");
  61 + job.put("data",novelList);
  62 + job.put("count",count);
  63 + return job.toJSONString();
  64 + }
  65 +
  66 + /**
  67 + * 通过id获取小说信息
  68 + * @param novelId 小说id
  69 + * @author caoMingYang
  70 + * @since 2019/5/21 21:27
  71 + */
  72 + @ResponseBody
  73 + @RequestMapping("/novelInfo")
  74 + public String novelInfoById(@RequestParam("novelId")Integer novelId){
  75 + Novel novel = service.queryNovelInfo(novelId);
  76 + JSONObject job = new JSONObject();
  77 + if (null != novel){
  78 + job.put("code",0);
  79 + job.put("msg","success");
  80 + job.put("data",novel);
  81 + }else{
  82 + job.put("code",-1);
  83 + job.put("msg","fail");
  84 + }
  85 + return job.toJSONString();
  86 + }
  87 +
  88 + /**
  89 + * 校验小说名称是否重复
  90 + * @param novelId 小说id
  91 + * @param novelName 小说名称
  92 + * @author caoMingYang
  93 + * @since 2019/5/24 21:28
  94 + */
  95 + @ResponseBody
  96 + @RequestMapping("/checkNovelName")
  97 + public String checkNovelName(@RequestParam("novelId")Integer novelId,
  98 + @RequestParam(value = "novelName",defaultValue = "")String novelName){
  99 + JSONObject job = new JSONObject();
  100 + boolean flag = service.checkNovelName(novelId, novelName);
  101 + if (flag){
  102 + job.put("code",0);
  103 + job.put("msg","success");
  104 + }else{
  105 + job.put("code",-1);
  106 + job.put("msg","fail");
  107 + }
  108 + return job.toJSONString();
  109 + }
  110 +
  111 + /**
  112 + * 更新小说基本信息
  113 + * @param novelId 小说id
  114 + * @param novelName 小说名称
  115 + * @param novelTypeStr 类型
  116 + * @param novelInfo 简介
  117 + * @param novelImg 封面
  118 + * @param keyword 关键字
  119 + * @param status 状态
  120 + * @author caoMingYang
  121 + * @since 2019/5/24 21:41
  122 + */
  123 + @ResponseBody
  124 + @RequestMapping("/updateNovelInfo")
  125 + public String updateNovelInfo(@RequestParam("novelId")Integer novelId,
  126 + @RequestParam(value = "novelName",defaultValue = "")String novelName,
  127 + @RequestParam(value = "novelTypeStr",defaultValue = "")String novelTypeStr,
  128 + @RequestParam("novelInfo")String novelInfo,
  129 + @RequestParam(value = "novelImg",defaultValue = "")String novelImg,
  130 + @RequestParam("keyword")String keyword,
  131 + @RequestParam(value = "status",defaultValue = "1")Integer status){
  132 + JSONObject job = new JSONObject();
  133 + boolean flag = service.updateNovel(novelId,novelName,novelImg,novelInfo,novelTypeStr,keyword,status);
  134 + if (flag){
  135 + job.put("code",0);
  136 + job.put("msg","success");
  137 + }else{
  138 + job.put("code",-1);
  139 + job.put("msg","fail");
  140 + }
  141 + return job.toJSONString();
  142 + }
  143 +
  144 + /**
  145 + * 跳转到上传页面
  146 + */
  147 + @RequestMapping("/uploadNovel")
  148 + public String uploadNovel(){
  149 + return "views/authorCenter/upload";
  150 + }
  151 +
  152 +
  153 + /**
  154 + * 保存小说基本信息
  155 + * @param novelName 小说名称
  156 + * @param novelTypeStr 类型
  157 + * @param novelInfo 简介
  158 + * @param novelImg 封面
  159 + * @param keyword 关键字
  160 + * @param status 状态
  161 + * @author caoMingYang
  162 + * @since 2019/5/24 21:41
  163 + */
  164 + @ResponseBody
  165 + @RequestMapping("/saveNovelInfo")
  166 + public String saveNovelInfo(@RequestParam(value = "novelName",defaultValue = "")String novelName,
  167 + @RequestParam(value = "novelTypeStr",defaultValue = "")String novelTypeStr,
  168 + @RequestParam("novelInfo")String novelInfo,
  169 + @RequestParam(value = "novelImg",defaultValue = "")String novelImg,
  170 + @RequestParam("keyword")String keyword,
  171 + @RequestParam(value = "status",defaultValue = "1")Integer status){
  172 + JSONObject job = new JSONObject();
  173 + User user = (User) this.getSession().getAttribute(CommonConstant.SESSION_KEY);
  174 + Integer novelId = 0;
  175 + try {
  176 + novelId = service.saveNovel(user, novelName, novelImg, novelInfo, novelTypeStr, keyword, status);
  177 + }catch (Exception e){
  178 + logger.error("保存小说信息异常",e);
  179 + }
  180 + if (novelId > 0){
  181 + job.put("code",0);
  182 + job.put("msg","success");
  183 + job.put("data",novelId);
  184 + }else{
  185 + job.put("code",-1);
  186 + job.put("msg","fail");
  187 + }
  188 + return job.toJSONString();
  189 + }
  190 +
  191 + /**
  192 + * 保存小说章节
  193 + * @param chapterTitle 标题
  194 + * @param chapterContent 章节内容
  195 + * @param novelId 小说id
  196 + * @author caoMingYang
  197 + * @since 2019/5/25 1:22
  198 + */
  199 + @ResponseBody
  200 + @RequestMapping("/uploadChapter")
  201 + public String uploadChapter(@RequestParam("chapterTitle")String chapterTitle,
  202 + @RequestParam("chapterNum")String chapterNumStr,
  203 + @RequestParam("chapterContent")String chapterContent,
  204 + @RequestParam("novelId")Integer novelId){
  205 + JSONObject job = new JSONObject();
  206 + Integer chapterNum = 0;
  207 + try {
  208 + chapterNum = service.saveChapter(chapterNumStr, chapterTitle, chapterContent, novelId);
  209 + }catch (Exception e){
  210 + logger.error("保存章节信息异常",e);
  211 + }
  212 + if (chapterNum > 0){
  213 + job.put("code",0);
  214 + job.put("msg","success");
  215 + job.put("data",chapterNum);
  216 + }else{
  217 + job.put("code",-1);
  218 + job.put("msg","fail");
  219 + }
  220 + return job.toJSONString();
  221 + }
  222 +
  223 + @ResponseBody
  224 + @RequestMapping("/queryChapterNum")
  225 + public String queryChapterNum(@RequestParam("novelId")Integer novelId){
  226 + JSONObject job = new JSONObject();
  227 + Integer num = service.queryChapterNum(novelId);
  228 + if (num > 0){
  229 + job.put("code",0);
  230 + job.put("msg","success");
  231 + job.put("data",num);
  232 + }else {
  233 + job.put("code",-1);
  234 + job.put("msg","fail");
  235 + }
  236 + return job.toJSONString();
  237 + }
  238 +
  239 +
  240 +}
  1 +package com.sinocontact.app.controller.jsoup;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.controller.BaseController;
  5 +import com.sinocontact.app.entity.Chapter;
  6 +import com.sinocontact.app.entity.CrawlNovel;
  7 +import com.sinocontact.app.entity.DChapter;
  8 +import com.sinocontact.app.entity.Novel;
  9 +import com.sinocontact.app.service.jsoup.JSoupService;
  10 +import org.apache.log4j.Logger;
  11 +import org.jsoup.Jsoup;
  12 +import org.jsoup.nodes.Document;
  13 +import org.jsoup.nodes.Element;
  14 +import org.jsoup.select.Elements;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.scheduling.annotation.EnableScheduling;
  17 +import org.springframework.scheduling.annotation.Scheduled;
  18 +import org.springframework.stereotype.Controller;
  19 +import org.springframework.web.bind.annotation.RequestMapping;
  20 +import org.springframework.web.bind.annotation.RequestParam;
  21 +import org.springframework.web.bind.annotation.ResponseBody;
  22 +
  23 +import java.util.ArrayList;
  24 +import java.util.List;
  25 +
  26 +
  27 +/**
  28 + * @author caoMingYang
  29 + * @Description TODO
  30 + * @since 2019/5/12 17:08
  31 + **/
  32 +@Controller
  33 +@EnableScheduling
  34 +@RequestMapping("/jsoup")
  35 +public class JSoupController extends BaseController {
  36 +
  37 + private static final Logger logger = Logger.getLogger(JSoupController.class);
  38 +
  39 + @Autowired
  40 + private JSoupService service;
  41 +
  42 +
  43 + /**
  44 + * 保存需要爬取的小说信息
  45 + * @param novelName 小说名称
  46 + * @param novelAuthor 作者
  47 + * @param flUrl 飞卢网地址
  48 + * @param ddUrl 顶点网地址
  49 + * @author caoMingYang
  50 + * @since 2019/5/12 17:11
  51 + */
  52 + @ResponseBody
  53 + @RequestMapping("/saveNovelUrl")
  54 + public String saveNovelUrl(@RequestParam(value = "novelName",defaultValue = "")String novelName,
  55 + @RequestParam(value = "novelAuthor",defaultValue = "")String novelAuthor,
  56 + @RequestParam(value = "flUrl",defaultValue = "")String flUrl,
  57 + @RequestParam(value = "ddUrl",defaultValue = "")String ddUrl,
  58 + @RequestParam(value = "ddChapterUrl",defaultValue = "")String ddChapterUrl){
  59 + JSONObject job = new JSONObject();
  60 + boolean flag = service.saveNovelUrl(novelName, novelAuthor, flUrl, ddUrl,ddChapterUrl);
  61 + if (flag) {
  62 + job.put("code", 0);
  63 + job.put("msg", "success");
  64 + }else{
  65 + job.put("code",-1);
  66 + job.put("msg","fail");
  67 + }
  68 + return job.toJSONString();
  69 + }
  70 +
  71 + /**
  72 + * 定时拉取存入待爬取小说表中的小说数据
  73 + */
  74 + @Scheduled(cron = "0 0 1 * * ?")
  75 +// @Scheduled(cron = "5 * * * * ?")
  76 + public void crawlNovel(){
  77 + logger.info("爬取小说开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
  78 + List<CrawlNovel> crawlNovelList = service.queryNovelList();
  79 + if (null != crawlNovelList && crawlNovelList.size()>0){
  80 + logger.info("共有"+crawlNovelList.size()+"条待抓取记录...");
  81 + for (CrawlNovel crawlNovel : crawlNovelList){
  82 + logger.info("开始抓取,小说【"+crawlNovel.getNovelName()+"】");
  83 + try {
  84 + Document document = Jsoup.connect(crawlNovel.getDdUrl()).get();
  85 + //获取小说信息
  86 + Novel novel = service.getNovel(document);
  87 + //获取章节信息
  88 + List<DChapter> dChapters = new ArrayList<DChapter>();
  89 + Document chapterDocument = Jsoup.connect(crawlNovel.getDdChapterUrl()).get();
  90 + Elements elements = chapterDocument.getElementById("at").getElementsByTag("td");
  91 + for (Element element : elements){
  92 + DChapter dChapter = new DChapter();
  93 + Element a = element.getElementsByTag("a").first();
  94 + dChapter.setChapterName(a.text());
  95 + dChapter.setChapterUrl(a.attr("href"));
  96 + dChapters.add(dChapter);
  97 + }
  98 + //获取的章节信息
  99 + List<Chapter> chapterList = service.getChapterList(dChapters);
  100 + //获取关键字
  101 + String keyWord = service.getKeyWord(crawlNovel.getFlUrl());
  102 + novel.setKeyword(keyWord);
  103 + boolean flag = service.saveNovelInfo(novel,chapterList,crawlNovel.getId());
  104 + if (!flag){
  105 + logger.error("小说保存异常,名称【"+novel.getNovelName()+"】,作者【"+novel.getNovelAuthor()+"】");
  106 + }
  107 + }catch (Exception e){
  108 + logger.error("抓取小说异常",e);
  109 + }
  110 + }
  111 + }else{
  112 + logger.error("待爬取的小说为空!");
  113 + }
  114 + logger.info("小说爬取结束<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
  115 + }
  116 +
  117 +}
  1 +package com.sinocontact.app.controller.library;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.controller.BaseController;
  5 +import com.sinocontact.app.entity.Novel;
  6 +import com.sinocontact.app.service.library.LibraryService;
  7 +import org.apache.log4j.Logger;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +
  14 +import java.util.List;
  15 +
  16 +/**
  17 + * 书库
  18 + * @author caoMingYang
  19 + * @since 2019/4/19 16:49
  20 + */
  21 +@Controller
  22 +@RequestMapping("/library")
  23 +public class LibraryController extends BaseController {
  24 + private static final Logger logger = Logger.getLogger(LibraryController.class);
  25 +
  26 + @Autowired
  27 + private LibraryService service;
  28 +
  29 +
  30 +
  31 + /**
  32 + * 跳转到全部作品页面
  33 + * @author caoMingYang
  34 + * @since 2019/4/19 17:17
  35 + */
  36 + @RequestMapping("/index")
  37 + public String libraryIndex(){
  38 + return "views/library/index";
  39 + }
  40 +
  41 + /**
  42 + * 跳转到都市小说页面
  43 + * @author caoMingYang
  44 + * @since 2019/4/23 21:01
  45 + */
  46 + @RequestMapping("/cityIndex")
  47 + public String cityIndex(){
  48 + List<Novel> hotNovelList = service.queryCityHotNovel();
  49 + putObject("hotNovelList",hotNovelList);
  50 + return "views/library/cityIndex";
  51 + }
  52 +
  53 + /**
  54 + * 跳转到玄幻小说页面
  55 + * @author caoMingYang
  56 + * @since 2019/4/23 23:48
  57 + */
  58 + @RequestMapping("/fantasy")
  59 + public String fantasyPage(){
  60 + List<Novel> hotNovelList = service.queryFantasyHotNovel();
  61 + putObject("hotNovelList",hotNovelList);
  62 + return "views/library/fantasy";
  63 + }
  64 +
  65 +
  66 + /**
  67 + * 跳转到仙侠小说页面
  68 + * @author caoMingYang
  69 + * @since 2019/4/24 20:24
  70 + */
  71 + @RequestMapping("/fairySpiderman")
  72 + public String fairySpidermanPage(){
  73 + List<Novel> novelList = service.queryFairyHotNovel();
  74 + putObject("hotNovelList",novelList);
  75 + return "views/library/fairy";
  76 + }
  77 +
  78 + /**
  79 + * 跳转到科幻小说页面
  80 + * @author caoMingYang
  81 + * @since 2019/4/24 20:47
  82 + */
  83 + @RequestMapping("/scienceFiction")
  84 + public String scienceFiction(){
  85 + List<Novel> novelList = service.queryScienceFictionHotNovel();
  86 + putObject("hotNovelList",novelList);
  87 + return "views/library/scienceFiction";
  88 + }
  89 +
  90 + /**
  91 + * 跳转到历史军事小说页面
  92 + * @author caoMingYang
  93 + * @since 2019/4/24 23:36
  94 + */
  95 + @RequestMapping("/militaryHistory")
  96 + public String militaryHistory(){
  97 + List<Novel> novelList = service.queryMilitaryHistoryHotNovel();
  98 + putObject("hotNovelList",novelList);
  99 + return "views/library/militaryHistory";
  100 + }
  101 +
  102 + /**
  103 + * 跳转到武侠小说页面
  104 + * @author caoMingYang
  105 + * @since 2019/4/24 23:39
  106 + */
  107 + @RequestMapping("/dragon")
  108 + public String dragon(){
  109 + List<Novel> novelList = service.queryDragonHotNovel();
  110 + putObject("hotNovelList",novelList);
  111 + return "views/library/dragon";
  112 + }
  113 +
  114 + /**
  115 + * 跳转到网游竞技页面
  116 + * @author caoMingYang
  117 + * @since 2019/4/24 23:40
  118 + */
  119 + @RequestMapping("/athletic")
  120 + public String athletic(){
  121 + List<Novel> novelList = service.queryAthleticHotNovel();
  122 + putObject("hotNovelList",novelList);
  123 + return "views/library/athletic";
  124 + }
  125 +
  126 + /**
  127 + * 跳转到悬疑灵异页面
  128 + * @author caoMingYang
  129 + * @since 2019/4/24 23:42
  130 + */
  131 + @RequestMapping("/suspenseParanormal")
  132 + public String suspenseParanormal(){
  133 + List<Novel> novelList = service.querySuspenseParanormalHotNovel();
  134 + putObject("hotNovelList",novelList);
  135 + return "views/library/suspenseParanormal";
  136 + }
  137 +
  138 + /**
  139 + * 跳转到其他小说页面
  140 + * @author caoMingYang
  141 + * @since 2019/4/24 23:43
  142 + */
  143 + @RequestMapping("/other")
  144 + public String other(){
  145 + List<Novel> novelList = service.queryOtherHotNovel();
  146 + putObject("hotNovelList",novelList);
  147 + return "views/library/other";
  148 + }
  149 +
  150 +
  151 + /**
  152 + * 获取小说列表
  153 + * @param novelType 小说分类
  154 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  155 + * @param novelStatus 小说状态(连载、完结)
  156 + * @param novelWords 字数
  157 + * @param page 页码
  158 + * @author caoMingYang
  159 + * @since 2019/4/19 17:17
  160 + */
  161 + @ResponseBody
  162 + @RequestMapping("/novelList")
  163 + public String novelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  164 + @RequestParam(value = "novelType",defaultValue = "")String novelType,
  165 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  166 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  167 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  168 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  169 + JSONObject job = new JSONObject();
  170 + List<Novel> novelList = service.queryTotalNovel(page, sortFlag, novelType, novelStatus, novelWords, novelInfo);
  171 + Integer count = service.getNovelCount(sortFlag,novelType,novelStatus,novelWords,novelInfo);
  172 + job.put("code",0);
  173 + job.put("msg","success");
  174 + job.put("count",count);
  175 + job.put("data",novelList);
  176 + String jsonText = job.toJSONString();
  177 + logger.info(jsonText);
  178 + return jsonText;
  179 + }
  180 +
  181 + /**
  182 + * 获取都市小说列表
  183 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  184 + * @param novelStatus 小说状态(连载、完结)
  185 + * @param novelWords 字数
  186 + * @param page 页码
  187 + * @author caoMingYang
  188 + * @since 2019/4/23 23:17
  189 + */
  190 + @ResponseBody
  191 + @RequestMapping("/cityNovelList")
  192 + public String cityNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  193 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  194 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  195 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  196 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  197 + JSONObject job = new JSONObject();
  198 + List<Novel> novelList = service.queryTotalCityNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  199 + Integer count = service.getNovelCityCount(sortFlag,novelStatus,novelWords,novelInfo);
  200 + job.put("code",0);
  201 + job.put("msg","success");
  202 + job.put("count",count);
  203 + job.put("data",novelList);
  204 + String jsonText = job.toJSONString();
  205 + logger.info(jsonText);
  206 + return jsonText;
  207 + }
  208 +
  209 + /**
  210 + * 获取玄幻小说列表
  211 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  212 + * @param novelStatus 小说状态(连载、完结)
  213 + * @param novelWords 字数
  214 + * @param page 页码
  215 + * @author caoMingYang
  216 + * @since 2019/4/23 23:57
  217 + */
  218 + @ResponseBody
  219 + @RequestMapping("/fantasyNovelList")
  220 + public String fantasyNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  221 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  222 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  223 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  224 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  225 + JSONObject job = new JSONObject();
  226 + List<Novel> novelList = service.queryTotalFantasyNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  227 + Integer count = service.getNovelFantasyCount(sortFlag,novelStatus,novelWords,novelInfo);
  228 + job.put("code",0);
  229 + job.put("msg","success");
  230 + job.put("count",count);
  231 + job.put("data",novelList);
  232 + String jsonText = job.toJSONString();
  233 + logger.info(jsonText);
  234 + return jsonText;
  235 + }
  236 +
  237 + /**
  238 + * 获取仙侠小说列表
  239 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  240 + * @param novelStatus 小说状态(连载、完结)
  241 + * @param novelWords 字数
  242 + * @param page 页码
  243 + * @author caoMingYang
  244 + * @since 2019/4/24 20:25
  245 + */
  246 + @ResponseBody
  247 + @RequestMapping("/fairyNovelList")
  248 + public String fairyNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  249 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  250 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  251 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  252 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  253 + JSONObject job = new JSONObject();
  254 + List<Novel> novelList = service.queryTotalFairyNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  255 + Integer count = service.getNovelFairyCount(sortFlag,novelStatus,novelWords,novelInfo);
  256 + job.put("code",0);
  257 + job.put("msg","success");
  258 + job.put("count",count);
  259 + job.put("data",novelList);
  260 + String jsonText = job.toJSONString();
  261 + logger.info(jsonText);
  262 + return jsonText;
  263 + }
  264 +
  265 + /**
  266 + * 获取仙侠小说列表
  267 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  268 + * @param novelStatus 小说状态(连载、完结)
  269 + * @param novelWords 字数
  270 + * @param page 页码
  271 + * @author caoMingYang
  272 + * @since 2019/4/24 20:25
  273 + */
  274 + @ResponseBody
  275 + @RequestMapping("/scienceFictionNovelList")
  276 + public String scienceFictionNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  277 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  278 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  279 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  280 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  281 + JSONObject job = new JSONObject();
  282 + List<Novel> novelList = service.queryTotalScienceFictionNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  283 + Integer count = service.getNovelScienceFictionCount(sortFlag,novelStatus,novelWords,novelInfo);
  284 + job.put("code",0);
  285 + job.put("msg","success");
  286 + job.put("count",count);
  287 + job.put("data",novelList);
  288 + String jsonText = job.toJSONString();
  289 + logger.info(jsonText);
  290 + return jsonText;
  291 + }
  292 +
  293 +
  294 + /**
  295 + * 获取历史军事小说列表
  296 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  297 + * @param novelStatus 小说状态(连载、完结)
  298 + * @param novelWords 字数
  299 + * @param page 页码
  300 + * @author caoMingYang
  301 + * @since 2019/4/24 20:25
  302 + */
  303 + @ResponseBody
  304 + @RequestMapping("/militaryHistoryNovelList")
  305 + public String militaryHistoryNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  306 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  307 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  308 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  309 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  310 + JSONObject job = new JSONObject();
  311 + List<Novel> novelList = service.queryTotalMilitaryHistoryNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  312 + Integer count = service.getNovelMilitaryHistoryCount(sortFlag,novelStatus,novelWords,novelInfo);
  313 + job.put("code",0);
  314 + job.put("msg","success");
  315 + job.put("count",count);
  316 + job.put("data",novelList);
  317 + String jsonText = job.toJSONString();
  318 + logger.info(jsonText);
  319 + return jsonText;
  320 + }
  321 +
  322 + /**
  323 + * 获取武侠小说列表
  324 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  325 + * @param novelStatus 小说状态(连载、完结)
  326 + * @param novelWords 字数
  327 + * @param page 页码
  328 + * @author caoMingYang
  329 + * @since 2019/4/24 20:25
  330 + */
  331 + @ResponseBody
  332 + @RequestMapping("/dragonNovelList")
  333 + public String dragonNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  334 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  335 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  336 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  337 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  338 + JSONObject job = new JSONObject();
  339 + List<Novel> novelList = service.queryTotalDragonNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  340 + Integer count = service.getNovelDragonCount(sortFlag,novelStatus,novelWords,novelInfo);
  341 + job.put("code",0);
  342 + job.put("msg","success");
  343 + job.put("count",count);
  344 + job.put("data",novelList);
  345 + String jsonText = job.toJSONString();
  346 + logger.info(jsonText);
  347 + return jsonText;
  348 + }
  349 +
  350 + /**
  351 + * 获取网游竞技小说列表
  352 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  353 + * @param novelStatus 小说状态(连载、完结)
  354 + * @param novelWords 字数
  355 + * @param page 页码
  356 + * @author caoMingYang
  357 + * @since 2019/4/24 20:25
  358 + */
  359 + @ResponseBody
  360 + @RequestMapping("/athleticNovelList")
  361 + public String athleticNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  362 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  363 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  364 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  365 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  366 + JSONObject job = new JSONObject();
  367 + List<Novel> novelList = service.queryTotalAthleticNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  368 + Integer count = service.getNovelAthleticCount(sortFlag,novelStatus,novelWords,novelInfo);
  369 + job.put("code",0);
  370 + job.put("msg","success");
  371 + job.put("count",count);
  372 + job.put("data",novelList);
  373 + String jsonText = job.toJSONString();
  374 + logger.info(jsonText);
  375 + return jsonText;
  376 + }
  377 +
  378 + /**
  379 + * 获取悬疑灵异小说列表
  380 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  381 + * @param novelStatus 小说状态(连载、完结)
  382 + * @param novelWords 字数
  383 + * @param page 页码
  384 + * @author caoMingYang
  385 + * @since 2019/4/24 20:25
  386 + */
  387 + @ResponseBody
  388 + @RequestMapping("/suspenseParanormalNovelList")
  389 + public String suspenseParanormalNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  390 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  391 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  392 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  393 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  394 + JSONObject job = new JSONObject();
  395 + List<Novel> novelList = service.queryTotalSuspenseParanormalNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  396 + Integer count = service.getNovelSuspenseParanormalCount(sortFlag,novelStatus,novelWords,novelInfo);
  397 + job.put("code",0);
  398 + job.put("msg","success");
  399 + job.put("count",count);
  400 + job.put("data",novelList);
  401 + String jsonText = job.toJSONString();
  402 + logger.info(jsonText);
  403 + return jsonText;
  404 + }
  405 +
  406 + /**
  407 + * 获取其他小说列表
  408 + * @param sortFlag 排序状态(点击、收藏、推荐、总)
  409 + * @param novelStatus 小说状态(连载、完结)
  410 + * @param novelWords 字数
  411 + * @param page 页码
  412 + * @author caoMingYang
  413 + * @since 2019/4/24 20:25
  414 + */
  415 + @ResponseBody
  416 + @RequestMapping("/otherNovelList")
  417 + public String otherNovelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  418 + @RequestParam(value = "sortFlag",defaultValue = "0")Integer sortFlag,
  419 + @RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  420 + @RequestParam(value = "novelWords",defaultValue = "")String novelWords,
  421 + @RequestParam(value = "page",defaultValue = "1")Integer page){
  422 + JSONObject job = new JSONObject();
  423 + List<Novel> novelList = service.queryTotalOtherNovel(page, sortFlag, novelStatus, novelWords, novelInfo);
  424 + Integer count = service.getNovelOtherCount(sortFlag,novelStatus,novelWords,novelInfo);
  425 + job.put("code",0);
  426 + job.put("msg","success");
  427 + job.put("count",count);
  428 + job.put("data",novelList);
  429 + String jsonText = job.toJSONString();
  430 + logger.info(jsonText);
  431 + return jsonText;
  432 + }
  433 +}
  1 +package com.sinocontact.app.controller.memberCenter;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.controller.BaseController;
  5 +import com.sinocontact.app.entity.BookCaseInfo;
  6 +import com.sinocontact.app.service.memberCenter.BookCaseService;
  7 +import org.apache.log4j.Logger;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +
  14 +import java.util.List;
  15 +
  16 +/**
  17 + * 书架
  18 + * @author caoMingYang
  19 + * @since 2019/4/14 21:07
  20 + */
  21 +@Controller
  22 +@RequestMapping("/bookCase")
  23 +public class BookCaseController extends BaseController {
  24 +
  25 + private static Logger logger = Logger.getLogger(BookCaseController.class);
  26 +
  27 + @Autowired
  28 + private BookCaseService service;
  29 +
  30 +
  31 + /**
  32 + * 书架首页
  33 + * @author caoMingYang
  34 + * @since 2019/4/14 21:09
  35 + */
  36 + @RequestMapping("/index")
  37 + public String index(){
  38 + Integer userId = this.getUserInfo().getUserId();
  39 + List<BookCaseInfo> bookCaseInfoList = service.queryBookCaseList(userId);
  40 + this.putObject("data",bookCaseInfoList);
  41 + return "views/memberCenter/bookCase";
  42 + }
  43 +
  44 + /**
  45 + * 删除书架中小说
  46 + * @param novelId 小说id
  47 + * @author caoMingYang
  48 + * @since 2019/4/15 10:41
  49 + */
  50 + @ResponseBody
  51 + @RequestMapping("/deleteNovel")
  52 + public String deleteNovel(@RequestParam("novelId")Integer novelId){
  53 + JSONObject job = new JSONObject();
  54 + boolean flag = service.deleteNovel(this.getUserInfo().getUserId(),novelId);
  55 + if (flag){
  56 + job.put("code",0);
  57 + job.put("msg","success");
  58 + }else{
  59 + job.put("code",-1);
  60 + job.put("msg","fail");
  61 + }
  62 + String jsonText = job.toJSONString();
  63 + logger.info("deleteNovel>>>"+jsonText);
  64 + return jsonText;
  65 + }
  66 +}
  1 +package com.sinocontact.app.controller.memberCenter;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.common.CommonConstant;
  5 +import com.sinocontact.app.controller.BaseController;
  6 +import com.sinocontact.app.entity.User;
  7 +import com.sinocontact.app.service.memberCenter.UserBasicInfoService;
  8 +import org.apache.log4j.Logger;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Controller;
  11 +import org.springframework.util.StringUtils;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.ResponseBody;
  15 +
  16 +/**
  17 + * 用户基本信息
  18 + * @author caoMingYang
  19 + * @since 2019/4/6 11:23
  20 + */
  21 +@Controller
  22 +@RequestMapping("/memberCenter")
  23 +public class UserBasicInfoController extends BaseController {
  24 +
  25 + private static Logger logger = Logger.getLogger(UserBasicInfoController.class);
  26 +
  27 + @Autowired
  28 + private UserBasicInfoService service;
  29 +
  30 + /**
  31 + * 用户信息首页
  32 + * @author caoMingYang
  33 + * @since 2019/4/6 11:25
  34 + */
  35 + @RequestMapping("/baseInfo")
  36 + public String index(){
  37 + User user = (User) this.getSession().getAttribute(CommonConstant.SESSION_KEY);
  38 + putObject(CommonConstant.SESSION_KEY,user);
  39 + return "views/memberCenter/userInfo";
  40 + }
  41 +
  42 + /**
  43 + * 跳转到修改密码页面
  44 + * @author caoMingYang
  45 + * @since 2019/4/14 11:54
  46 + */
  47 + @RequestMapping("/password")
  48 + public String password(){
  49 + User user = (User) this.getSession().getAttribute(CommonConstant.SESSION_KEY);
  50 + putObject(CommonConstant.SESSION_KEY,user);
  51 + return "views/memberCenter/updatePassword";
  52 + }
  53 +
  54 + /**
  55 + * 更新密码
  56 + * @param password 新密码
  57 + * @author caoMingYang
  58 + * @since 2019/4/14 12:14
  59 + */
  60 + @ResponseBody
  61 + @RequestMapping("/updatePassword")
  62 + public String updatePassword(@RequestParam(value = "password",defaultValue = "")String password){
  63 + JSONObject job = new JSONObject();
  64 + boolean flag = service.updatePassword(password,this.getUserInfo().getUserId());
  65 + if (flag){
  66 + job.put("code",0);
  67 + job.put("msg","success");
  68 + User user = this.getUserInfo();
  69 + user.setPassword(password);
  70 + this.getSession().setAttribute(CommonConstant.SESSION_KEY,user);
  71 + }else{
  72 + job.put("code",-1);
  73 + job.put("msg","fail");
  74 + }
  75 + String jsonText = job.toJSONString();
  76 + logger.info("updatePassword>>>"+jsonText);
  77 + return jsonText;
  78 + }
  79 +
  80 + /**
  81 + * 校验用户名是否存在
  82 + * @param account 用户名
  83 + * @author caoMingYang
  84 + * @since 2019/4/11 23:32
  85 + */
  86 + @ResponseBody
  87 + @RequestMapping("checkAccount")
  88 + public String checkAccount(@RequestParam("account")String account){
  89 + JSONObject job = new JSONObject();
  90 + boolean flag = service.checkAccount(account,this.getUserInfo().getUserId());
  91 + if (!flag){
  92 + job.put("code",-1);
  93 + job.put("msg","此用户名已存在");
  94 + }else {
  95 + job.put("code",0);
  96 + job.put("msg","success");
  97 + }
  98 + String jsonText = job.toJSONString();
  99 + logger.info("checkAccount>>>>"+jsonText);
  100 + return jsonText;
  101 + }
  102 +
  103 + /**
  104 + * 更新用户信息
  105 + * @param account 用户名称
  106 + * @param nickname 昵称
  107 + * @author caoMingYang
  108 + * @since 2019/4/12 15:01
  109 + */
  110 + @ResponseBody
  111 + @RequestMapping("updateUserInfo")
  112 + public String updateUserInfo(@RequestParam(value = "account",defaultValue = "")String account,
  113 + @RequestParam(value = "nickname",defaultValue = "")String nickname){
  114 + JSONObject job = new JSONObject();
  115 + boolean flag = service.updateUserInfo(account,nickname,this.getUserInfo().getUserId());
  116 + if (flag){
  117 + job.put("code",0);
  118 + job.put("msg","success");
  119 + //更新session中用户信息
  120 + this.updateSessionUserCache(account,nickname,0);
  121 + }else{
  122 + job.put("code",-1);
  123 + job.put("msg","fail");
  124 + }
  125 + String jsonText = job.toJSONString();
  126 + logger.info("updateUserInfo>>>"+jsonText);
  127 + return jsonText;
  128 + }
  129 +
  130 + /**
  131 + * 申请成为作者
  132 + * @author caoMingYang
  133 + * @since 2019/4/12 18:36
  134 + */
  135 + @ResponseBody
  136 + @RequestMapping("applyForAuthor")
  137 + public String applyForAuthor(){
  138 + JSONObject job = new JSONObject();
  139 + boolean flag = service.applyForAuthor(this.getUserInfo().getUserId());
  140 + if (flag){
  141 + job.put("code",0);
  142 + job.put("msg","success");
  143 + this.updateSessionUserCache("","",1);
  144 + }else{
  145 + job.put("code",-1);
  146 + job.put("msg","fail");
  147 + }
  148 + String jsonText = job.toJSONString();
  149 + logger.info("applyForAuthor>>>"+jsonText);
  150 + return jsonText;
  151 + }
  152 +
  153 +
  154 + /**
  155 + * 更新session中的用户信息
  156 + * @param account 用户名
  157 + * @param nickname 昵称
  158 + * @param applyAuthorStatus 申请成为作者的状态
  159 + * @author caoMingYang
  160 + * @since 2019/4/14 11:55
  161 + */
  162 + private void updateSessionUserCache(String account,String nickname,Integer applyAuthorStatus){
  163 + User user = service.getUser(this.getUserInfo().getUserId());
  164 + if (user !=null){
  165 + this.getSession().setAttribute(CommonConstant.SESSION_KEY,user);
  166 + }else{
  167 + User sessionUser = this.getUserInfo();
  168 + if (!StringUtils.isEmpty(account)){
  169 + sessionUser.setAccount(account);
  170 + }
  171 + if (!StringUtils.isEmpty(nickname)){
  172 + sessionUser.setNickname(nickname);
  173 + }
  174 + if (applyAuthorStatus == 1){
  175 + sessionUser.setApplyAuthorStatus(applyAuthorStatus);
  176 + }
  177 + this.getSession().setAttribute(CommonConstant.SESSION_KEY,sessionUser);
  178 + }
  179 + }
  180 +}
  1 +package com.sinocontact.app.controller.oss;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.controller.BaseController;
  5 +import com.sinocontact.app.service.oss.OSSService;
  6 +import org.apache.log4j.Logger;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Controller;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +import org.springframework.web.bind.annotation.ResponseBody;
  12 +import org.springframework.web.multipart.MultipartFile;
  13 +
  14 +/**
  15 + * OSS 上传
  16 + * @author caoMingYang
  17 + * @Description TODO
  18 + * @since 2019/5/24 13:50
  19 + **/
  20 +@Controller
  21 +@RequestMapping("/oss")
  22 +public class OSSController extends BaseController {
  23 + private static Logger logger = Logger.getLogger(OSSController.class);
  24 +
  25 + @Autowired
  26 + private OSSService service;
  27 +
  28 + /**
  29 + * 上传图片
  30 + * @param file 图片文件
  31 + * @return 图片地址
  32 + * @author caoMingYang
  33 + * @since 2019/5/24 15:43
  34 + */
  35 + @ResponseBody
  36 + @RequestMapping("/uploadImg")
  37 + public String uploadImg(@RequestParam("file") MultipartFile file){
  38 + JSONObject job = new JSONObject();
  39 + String imgUrl = service.uploadImg(file);
  40 + if (null != imgUrl){
  41 + logger.info("图片阿里云地址"+imgUrl);
  42 + job.put("code",0);
  43 + job.put("msg","success");
  44 + job.put("data",imgUrl);
  45 + }else{
  46 + job.put("code",-1);
  47 + job.put("msg","fail");
  48 + }
  49 + return job.toJSONString();
  50 + }
  51 +}
  1 +package com.sinocontact.app.controller.ranking;
  2 +
  3 +import com.sinocontact.app.controller.BaseController;
  4 +import com.sinocontact.app.entity.Novel;
  5 +import com.sinocontact.app.service.ranking.RankingService;
  6 +import org.apache.log4j.Logger;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Controller;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 排行榜
  16 + * @author caoMingYang
  17 + * @since 2019/4/15 13:54
  18 + */
  19 +@Controller
  20 +@RequestMapping("/ranking")
  21 +public class RankingController extends BaseController {
  22 + private static Logger logger = Logger.getLogger(RankingController.class);
  23 +
  24 + @Autowired
  25 + private RankingService service;
  26 +
  27 + /**
  28 + * 跳转到点击榜页面
  29 + * @author caoMingYang
  30 + * @since 2019/4/15 13:55
  31 + */
  32 + @RequestMapping("/clickIndex")
  33 + public String clickIndex(@RequestParam(value = "page",defaultValue = "1")Integer page){
  34 + //获取点击榜小说
  35 + List<Novel> novelList = service.queryNovelListByPage(page);
  36 + //获取小说总条数
  37 + Integer count = service.queryNovelCount();
  38 + this.putObject("novelList",novelList);
  39 + this.putObject("count",count);
  40 + this.putObject("currentPage",page);
  41 + return "views/ranking/clickIndex";
  42 + }
  43 +
  44 + /**
  45 + * 跳转到收藏榜页面
  46 + * @param page 当前页码
  47 + * @author caoMingYang
  48 + * @since 2019/4/18 23:36
  49 + */
  50 + @RequestMapping("/collectIndex")
  51 + public String collectIndex(@RequestParam(value = "page",defaultValue = "1")Integer page){
  52 + List<Novel> novelList = service.queryCollectNovelList(page);
  53 + Integer count = service.queryNovelCount();
  54 + this.putObject("novelList",novelList);
  55 + this.putObject("count",count);
  56 + this.putObject("currentPage",page);
  57 + return "views/ranking/collectIndex";
  58 + }
  59 +
  60 + /**
  61 + * 获取总排行榜数据
  62 + * @param page 页码
  63 + * @return novelList
  64 + * @author caoMingYang
  65 + * @since 2019/4/19 11:25
  66 + */
  67 + @RequestMapping("/totalNumber")
  68 + public String totalNumber(@RequestParam(value = "page",defaultValue = "1")Integer page){
  69 + List<Novel> novelList = service.queryTotalNumber(page);
  70 + Integer count = service.queryNovelCount();
  71 + this.putObject("novelList",novelList);
  72 + this.putObject("count",count);
  73 + this.putObject("currentPage",page);
  74 + return "views/ranking/totalNumber";
  75 + }
  76 +
  77 +
  78 + /**
  79 + * 获取总推荐榜数据
  80 + * @param page 页码
  81 + * @return novelList
  82 + * @author caoMingYang
  83 + * @since 2019/4/19 11:25
  84 + */
  85 + @RequestMapping("/recommendList")
  86 + public String recommendList(@RequestParam(value = "page",defaultValue = "1")Integer page){
  87 + List<Novel> novelList = service.queryRecommendList(page);
  88 + Integer count = service.queryNovelCount();
  89 + this.putObject("novelList",novelList);
  90 + this.putObject("count",count);
  91 + this.putObject("currentPage",page);
  92 + return "views/ranking/recommendList";
  93 + }
  94 +
  95 + /**
  96 + * 获取最近更新数据
  97 + * @param page 页码
  98 + * @return novelList
  99 + * @author caoMingYang
  100 + * @since 2019/4/19 11:25
  101 + */
  102 + @RequestMapping("/nowUpdate")
  103 + public String nowUpdate(@RequestParam(value = "page",defaultValue = "1")Integer page){
  104 + List<Novel> novelList = service.queryNowUpdate(page);
  105 + Integer count = service.queryNovelCount();
  106 + this.putObject("novelList",novelList);
  107 + this.putObject("count",count);
  108 + this.putObject("currentPage",page);
  109 + return "views/ranking/nowUpdate";
  110 + }
  111 +
  112 + /**
  113 + * 获取最新入库数据
  114 + * @param page 页码
  115 + * @return novelList
  116 + * @author caoMingYang
  117 + * @since 2019/4/19 11:25
  118 + */
  119 + @RequestMapping("/nowPutStorage")
  120 + public String nowPutStorage(@RequestParam(value = "page",defaultValue = "1")Integer page){
  121 + List<Novel> novelList = service.queryNowPutStorage(page);
  122 + Integer count = service.queryNovelCount();
  123 + this.putObject("novelList",novelList);
  124 + this.putObject("count",count);
  125 + this.putObject("currentPage",page);
  126 + return "views/ranking/nowPutStorage";
  127 + }
  128 +
  129 + /**
  130 + * 获取字数排行数据
  131 + * @param page 页码
  132 + * @return novelList
  133 + * @author caoMingYang
  134 + * @since 2019/4/19 11:25
  135 + */
  136 + @RequestMapping("/wordsList")
  137 + public String wordsList(@RequestParam(value = "page",defaultValue = "1")Integer page){
  138 + List<Novel> novelList = service.queryWordsList(page);
  139 + Integer count = service.queryNovelCount();
  140 + this.putObject("novelList",novelList);
  141 + this.putObject("count",count);
  142 + this.putObject("currentPage",page);
  143 + return "views/ranking/wordsList";
  144 + }
  145 +
  146 +
  147 +}
  1 +package com.sinocontact.app.controller.systemSetting;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.entity.NovelType;
  5 +import com.sinocontact.app.service.systemSetting.ClassifyManageService;
  6 +import org.apache.log4j.Logger;
  7 +import org.omg.PortableInterceptor.INACTIVE;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +
  14 +import java.util.List;
  15 +
  16 +/**
  17 + * 分类管理
  18 + * @author Cao
  19 + * @since 2019/3/16 16:58
  20 + */
  21 +@Controller
  22 +@RequestMapping("/classifyManage")
  23 +public class ClassifyManageController {
  24 + private static Logger logger = Logger.getLogger(ClassifyManageService.class);
  25 +
  26 + @Autowired
  27 + private ClassifyManageService service;
  28 +
  29 + /**
  30 + * 跳转到分类列表页
  31 + */
  32 + @RequestMapping("/classifyList")
  33 + public String classifyList(){
  34 + return "views/systemSetting/classifyManage/classifyList";
  35 + }
  36 +
  37 + /**
  38 + * 获取分类列表
  39 + * @author Cao
  40 + * @param
  41 + * @since 2019/3/16 18:47
  42 + * @return json
  43 + */
  44 + @ResponseBody
  45 + @RequestMapping(value = "/novelTypeList",produces = "application/json;charset=utf-8")
  46 + public String getNovelTypes(){
  47 + JSONObject job = new JSONObject();
  48 + //分类列表
  49 + List<NovelType> novelTypes = service.queryNovelTypeList();
  50 + //分类条数
  51 + Integer total = service.queryNovelTypeCount();
  52 + job.put("code",0);
  53 + job.put("msg","success");
  54 + job.put("count",total);
  55 + job.put("data",novelTypes);
  56 + String jsonText = job.toJSONString();
  57 + logger.info("分类列表获取成功>>>>>>>>"+jsonText);
  58 + return jsonText;
  59 + }
  60 +
  61 + /**
  62 + * 删除分类信息
  63 + * @author Cao
  64 + * @param typeId 分类id
  65 + * @since 2019/3/17 13:47
  66 + * @return
  67 + */
  68 + @ResponseBody
  69 + @RequestMapping("/delType")
  70 + public String delNovelType(@RequestParam("typeId")String typeId){
  71 + JSONObject job = new JSONObject();
  72 + Integer id = Integer.valueOf(typeId);
  73 + boolean flag = service.deleteNovelTypeById(id);
  74 + String jsonText = setJson(job,flag);
  75 + logger.info("删除分类信息>>>>>>"+jsonText);
  76 + return jsonText;
  77 + }
  78 +
  79 + /**
  80 + * 添加分类信息
  81 + * @author Cao
  82 + * @param typeName 分类名称
  83 + * @since 2019/3/17 13:47
  84 + * @return
  85 + */
  86 + @ResponseBody
  87 + @RequestMapping("/addType")
  88 + public String addNovelType(@RequestParam("typeName")String typeName){
  89 + JSONObject job = new JSONObject();
  90 + boolean flag = service.addNovelType(typeName);
  91 + String jsonText = setJson(job,flag);
  92 + logger.info("添加分类信息>>>>>>"+jsonText);
  93 + return jsonText;
  94 + }
  95 +
  96 + /**
  97 + * 更新分类信息
  98 + * @author Cao
  99 + * @param typeName 分类名称
  100 + * @since 2019/3/17 13:47
  101 + * @return
  102 + */
  103 + @ResponseBody
  104 + @RequestMapping("/updateType")
  105 + public String addNovelType(@RequestParam(value = "typeName",defaultValue = "")String typeName,@RequestParam(value = "typeId",defaultValue = "0")Integer typeId){
  106 + JSONObject job = new JSONObject();
  107 + boolean flag = service.updateNovelType(typeName,typeId);
  108 + String jsonText = setJson(job,flag);
  109 + logger.info("更新分类信息>>>>>>"+jsonText);
  110 + return jsonText;
  111 + }
  112 +
  113 +
  114 + /**
  115 + * 获取json字符串
  116 + * @author Cao
  117 + * @param job jsonObject flag true or false
  118 + * @since 2019/3/17 14:41
  119 + * @return
  120 + */
  121 + private String setJson(JSONObject job,boolean flag){
  122 + if (!flag){
  123 + job.put("code",-1);
  124 + job.put("msg","fail");
  125 + }
  126 + job.put("code",0);
  127 + job.put("msg","success");
  128 + return job.toJSONString();
  129 + }
  130 +}
  1 +package com.sinocontact.app.controller.systemSetting;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.entity.Comment;
  5 +import com.sinocontact.app.entity.Novel;
  6 +import com.sinocontact.app.service.systemSetting.CommentManageService;
  7 +import org.apache.log4j.Logger;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +
  14 +import java.io.InputStreamReader;
  15 +import java.util.List;
  16 +
  17 +/**
  18 + * 评论管理
  19 + * @author Cao
  20 + * @since 2019/3/16 16:59
  21 + */
  22 +@Controller
  23 +@RequestMapping("/commentManage")
  24 +public class CommentManageController {
  25 + private static final Logger logger = Logger.getLogger(CommentManageController.class);
  26 +
  27 + @Autowired
  28 + private CommentManageService service;
  29 +
  30 + /**
  31 + * 跳转到评论管理首页
  32 + * @return java.lang.String
  33 + * @author caoMingYang
  34 + * @since 2019/3/30 14:34
  35 + */
  36 + @RequestMapping("/index")
  37 + public String index(){
  38 + return "views/systemSetting/commentManage/commentList";
  39 + }
  40 +
  41 +
  42 + /**
  43 + * 获取小说列表
  44 + * @param novelInfo 作者或书名
  45 + * @param novelType 类型
  46 + * @param page 页码
  47 + * @param pageSize 当前页数据条数
  48 + * @return java.lang.String
  49 + * @author caoMingYang
  50 + * @since 2019/3/30 14:46
  51 + */
  52 + @ResponseBody
  53 + @RequestMapping("/novelList")
  54 + public String novelList(@RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  55 + @RequestParam(value = "novelType",defaultValue = "")String novelType,
  56 + @RequestParam(value = "page",defaultValue = "1")Integer page,
  57 + @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
  58 + JSONObject job = new JSONObject();
  59 + //获取小说信息
  60 + List<Novel> novelList = service.getNovelList(novelInfo, novelType, page, pageSize);
  61 + //获取小说总条数
  62 + Integer count = service.getNovelCount(novelInfo, novelType);
  63 + job.put("code",0);
  64 + job.put("msg","success");
  65 + job.put("count",count);
  66 + job.put("data",novelList);
  67 + String jsonText = job.toJSONString();
  68 + logger.info("获取小说列表>>>>>"+jsonText);
  69 + return jsonText;
  70 + }
  71 +
  72 + /**
  73 + * 获取小说的评论列表
  74 + * @param startDate 开始时间
  75 + * @param endDate 结束时间
  76 + * @param commentInfo 评论
  77 + * @param page 页码
  78 + * @param pageSize 当前页最大数据
  79 + * @param novelId 小说id
  80 + * @author caoMingYang
  81 + * @since 2019/4/5 16:04
  82 + */
  83 + @ResponseBody
  84 + @RequestMapping("/commentList")
  85 + public String commentList(@RequestParam(value = "startDate",defaultValue = "")String startDate,
  86 + @RequestParam(value = "endDate",defaultValue = "")String endDate,
  87 + @RequestParam(value = "commentInfo",defaultValue = "")String commentInfo,
  88 + @RequestParam(value = "page",defaultValue = "1")Integer page,
  89 + @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
  90 + @RequestParam(value = "novelId")Integer novelId){
  91 + JSONObject job = new JSONObject();
  92 + //评论
  93 + List<Comment> commentList = service.getCommentList(startDate, endDate, commentInfo,novelId, page, pageSize);
  94 + //总数
  95 + Integer count = service.getCommentCount(startDate, endDate, commentInfo, novelId);
  96 + job.put("code",0);
  97 + job.put("msg","success");
  98 + job.put("count",count);
  99 + job.put("data",commentList);
  100 + String jsonText = job.toJSONString();
  101 + logger.info("获取小说评论列表>>>>"+jsonText);
  102 + return jsonText;
  103 + }
  104 +
  105 +
  106 + /**
  107 + * 和谐小说
  108 + * @param novelId 小说id
  109 + * @param commentId 评论id
  110 + * @author caoMingYang
  111 + * @since 2019/4/5 18:43
  112 + */
  113 + @ResponseBody
  114 + @RequestMapping("/accordNovel")
  115 + public String accordNovel(@RequestParam(value = "novelId")Integer novelId,
  116 + @RequestParam(value = "commentId")Integer commentId,
  117 + @RequestParam(value = "accordReason",defaultValue = "")String accordReason){
  118 + JSONObject job = new JSONObject();
  119 + boolean flag = service.accordReason(novelId,commentId,accordReason);
  120 + if (flag){
  121 + job.put("code",0);
  122 + job.put("msg","success");
  123 + }else{
  124 + job.put("code",-1);
  125 + job.put("msg","fail");
  126 + }
  127 + String jsonText = job.toJSONString();
  128 + logger.info("和谐小说>>>>"+jsonText);
  129 + return jsonText;
  130 + }
  131 +
  132 +
  133 +}
  1 +package com.sinocontact.app.controller.systemSetting;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.controller.BaseController;
  5 +import com.sinocontact.app.entity.Novel;
  6 +import com.sinocontact.app.service.systemSetting.NovelManageService;
  7 +import org.apache.log4j.Logger;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +/**
  19 + * 小说管理
  20 + * @author Cao
  21 + * @since 2019/3/16 12:19
  22 + */
  23 +@Controller
  24 +@RequestMapping("/novelManage")
  25 +public class NovelManageController extends BaseController {
  26 + private static Logger logger = Logger.getLogger(NovelManageController.class);
  27 +
  28 + @Autowired
  29 + private NovelManageService service;
  30 +
  31 + /**
  32 + * 跳转到小说管理页面
  33 + * @author cao
  34 + * @since 2019/03/23 17:28:45
  35 + */
  36 + @RequestMapping("/index")
  37 + public String index(){
  38 + return "views/systemSetting/novelManage/novelList";
  39 + }
  40 +
  41 +
  42 + /**
  43 + * 获取分类下拉数据
  44 + * @author cao
  45 + * @since 2019/03/24 1:01:23
  46 + */
  47 + @ResponseBody
  48 + @RequestMapping(value = "/selectData",produces = "application/json;charset=utf-8")
  49 + public String getSelectData(){
  50 + JSONObject job = new JSONObject();
  51 + List<String> typeList = service.getNovelType();
  52 + if (null == typeList){
  53 + job.put("code",-1);
  54 + job.put("msg","fail");
  55 + }else{
  56 + job.put("code",0);
  57 + job.put("msg","success");
  58 + job.put("data",typeList);
  59 + }
  60 + String jsonText = job.toJSONString();
  61 + logger.info("获取分类下拉框数据》》》》"+jsonText);
  62 + return jsonText;
  63 + }
  64 +
  65 +
  66 + /**
  67 + * 获取所有小说信息
  68 + * @param novelStatus 状态
  69 + * @param novelType 类型
  70 + * @param novelInfo 作者或书名
  71 + * @author cao
  72 + * @since 2019/03/24 22:24:44
  73 + */
  74 + @ResponseBody
  75 + @RequestMapping("/novelList")
  76 + public String novelList(@RequestParam(value = "novelStatus",defaultValue = "0")Integer novelStatus,
  77 + @RequestParam(value = "novelType",defaultValue = "")String novelType,
  78 + @RequestParam(value = "novelInfo",defaultValue = "")String novelInfo,
  79 + @RequestParam(value = "page",defaultValue = "1")Integer page,
  80 + @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
  81 + logger.info("获取所有小说信息》》》novelStatus>>"+novelStatus+",novelType>>"+novelType+",novelInfo>>"+novelInfo+",page>>"+page+",pageSize>>"+pageSize);
  82 + //获取所有小说信息
  83 + List<Novel> novels = service.getNovelList(novelStatus,novelType,novelInfo,page,pageSize);
  84 + //获取总条数
  85 + Integer count = service.getNovelCount(novelStatus,novelType,novelInfo);
  86 + JSONObject job = new JSONObject();
  87 + job.put("code",0);
  88 + job.put("msg","success");
  89 + job.put("count",count);
  90 + job.put("data",novels);
  91 + String jsonText = job.toJSONString();
  92 + logger.info(jsonText);
  93 + return jsonText;
  94 + }
  95 +
  96 + /**
  97 + * 上架小说
  98 + * @param novelIdArray 小说id
  99 + * @return java.lang.String
  100 + * @author caoMingYang
  101 + * @since 2019/3/27 22:40
  102 + */
  103 + @ResponseBody
  104 + @RequestMapping(value = "checkNovelPass",produces = "application/json;charset=utf-8")
  105 + public String checkNovelPass(@RequestParam("novelIdArray")String novelIdArray,@RequestParam("reason")String reason){
  106 + Integer result = service.checkNovelPass(novelIdArray,reason);
  107 + JSONObject jsonObject = new JSONObject();
  108 + if (result == -1){
  109 + jsonObject.put("code",-1);
  110 + jsonObject.put("msg","fail");
  111 + }else{
  112 + jsonObject.put("code",0);
  113 + jsonObject.put("msg","success");
  114 + }
  115 + String jsonText = jsonObject.toJSONString();
  116 + logger.info("上架小说>>>>>>>"+jsonText);
  117 + return jsonText;
  118 + }
  119 +
  120 + /**
  121 + * 和谐小说
  122 + * @param novelIdArray 小说id
  123 + * @return java.lang.String
  124 + * @author caoMingYang
  125 + * @since 2019/3/29 20:40
  126 + */
  127 + @ResponseBody
  128 + @RequestMapping(value = "/checkNovelNoPass",produces = "application/json;charset=utf-8")
  129 + public String checkNovelNoPass(@RequestParam("novelIdArray")String novelIdArray,@RequestParam("reason")String reason){
  130 + Integer result = service.checkNovelNoPass(novelIdArray,reason);
  131 + JSONObject jsonObject = new JSONObject();
  132 + if (result == -1){
  133 + jsonObject.put("code",-1);
  134 + jsonObject.put("msg","fail");
  135 + }else{
  136 + jsonObject.put("code",0);
  137 + jsonObject.put("msg","success");
  138 + }
  139 + String jsonText = jsonObject.toJSONString();
  140 + logger.info("和谐小说>>>>>>>"+jsonText);
  141 + return jsonText;
  142 + }
  143 +}
  1 +package com.sinocontact.app.controller.systemSetting;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.entity.CheckUser;
  5 +import com.sinocontact.app.entity.User;
  6 +import com.sinocontact.app.service.systemSetting.UserManageService;
  7 +import org.apache.log4j.Logger;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.*;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 用户管理
  16 + * @author Cao
  17 + * @since 2019/3/16 16:57
  18 + */
  19 +@Controller
  20 +@RequestMapping("/userManage")
  21 +public class UserManageController {
  22 + private static Logger logger = Logger.getLogger(UserManageController.class);
  23 +
  24 + @Autowired
  25 + private UserManageService service;
  26 +
  27 +
  28 + /**
  29 + * 用户首页
  30 + * @author todd
  31 + * @since 2019/3/19
  32 + */
  33 + @RequestMapping("/index")
  34 + public String index(){
  35 + return "views/systemSetting/userManage/userList";
  36 + }
  37 +
  38 + /**
  39 + * 获取所有的用户信息
  40 + * @author todd
  41 + * @since 2019/3/19
  42 + */
  43 + @ResponseBody
  44 + @RequestMapping("/userList")
  45 + public String userList(@RequestParam(value = "startDate",defaultValue = "")String startDate,
  46 + @RequestParam(value = "endDate",defaultValue = "")String endDate,
  47 + @RequestParam(value = "userInfo",defaultValue = "")String userInfo,
  48 + @RequestParam(value = "role",defaultValue = "0")Integer role,
  49 + @RequestParam(value = "page",defaultValue = "1")Integer page,
  50 + @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
  51 + logger.info("startDate>>>>"+startDate+" ,endDate>>>>"+endDate+" ,userInfo>>>>"+userInfo+" ,role>>>>"+role+" ,page>>>>"+page+" ,pageSize>>>>"+pageSize);
  52 + //所有用户信息
  53 + List<User> userList = service.getUserList(startDate,endDate,userInfo,role,page,pageSize);
  54 + //用户总条数
  55 + Integer userCount = service.getUserCount(startDate,endDate,userInfo,role);
  56 + JSONObject job = new JSONObject();
  57 + job.put("code",0);
  58 + job.put("msg","success");
  59 + job.put("count",userCount);
  60 + job.put("data",userList);
  61 + String jsonText = job.toJSONString();
  62 + logger.info("获取所有用户信息》》》》》》"+jsonText);
  63 + return jsonText;
  64 + }
  65 +
  66 + /**
  67 + * 获取用户审核信息列表
  68 + * @author todd
  69 + * @since 2019/3/21
  70 + */
  71 + @ResponseBody
  72 + @RequestMapping(value = "/userCheckList",produces = "application/json;charset=utf-8")
  73 + public String userCheckList(@RequestParam(value = "checkStatus",defaultValue = "0")Integer checkStatus,
  74 + @RequestParam(value = "page",defaultValue = "1")Integer page,
  75 + @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
  76 + logger.info("用户审核信息列表》》》 checkStatus>>>"+checkStatus+",page>>>"+page+",pageSize>>>"+pageSize);
  77 + //获取审核信息
  78 + List<CheckUser> checkUserList = service.getCheckUserList(checkStatus,page,pageSize);
  79 + //获取总条数
  80 + Integer count = service.getCheckUserCount(checkStatus);
  81 + JSONObject job = new JSONObject();
  82 + job.put("code",0);
  83 + job.put("msg","success");
  84 + job.put("count",count);
  85 + job.put("data",checkUserList);
  86 + String jsonText = job.toJSONString();
  87 + logger.info("获取所有用户审核信息》》》》"+jsonText);
  88 + return jsonText;
  89 + }
  90 +
  91 + /**
  92 + * 审核用户权限申请
  93 + * @author todd
  94 + * @since 2019/3/22
  95 + */
  96 + @ResponseBody
  97 + @RequestMapping(value = "/checkUser",produces = "application/json;charset=utf-8")
  98 + public String checkUser(@RequestParam("checkIdArray") String checkIdArray,
  99 + @RequestParam("userIdArray")String userIds){
  100 + logger.info("审核通过id》》》"+checkIdArray);
  101 + Integer code = 0;
  102 + try {
  103 + code = service.checkUserPass(checkIdArray,userIds);
  104 + }catch (Exception e){
  105 + logger.error("审核通过异常",e);
  106 + }
  107 + JSONObject job = new JSONObject();
  108 + if (code < 1){
  109 + job.put("code",-1);
  110 + job.put("msg","fail");
  111 + }else{
  112 + job.put("code",0);
  113 + job.put("msg","success");
  114 + }
  115 + String jsonText = job.toJSONString();
  116 + logger.info("审核用户权限为通过》》》》"+jsonText);
  117 + return jsonText;
  118 + }
  119 +
  120 + /**
  121 + * 审核用户权限申请不通过
  122 + * @author todd
  123 + * @since 2019/3/22
  124 + */
  125 + @ResponseBody
  126 + @RequestMapping(value = "checkUserNoPass",produces = "application/json;charset=utf-8")
  127 + public String checkUserNoPass(@RequestParam("checkIdArray")String checkIdArray){
  128 + logger.info("审核不通过id>>>>"+checkIdArray);
  129 + Integer code = service.checkUserNoPass(checkIdArray);
  130 + JSONObject job = new JSONObject();
  131 + if (code < 1){
  132 + job.put("code",-1);
  133 + job.put("msg","fail");
  134 + }else{
  135 + job.put("code",0);
  136 + job.put("msg","success");
  137 + }
  138 + String jsonText = job.toJSONString();
  139 + logger.info("审核用户权限为不通过》》》》"+jsonText);
  140 + return jsonText;
  141 + }
  142 +
  143 +
  144 + /**
  145 + * 获取用户近一个月登录情况
  146 + * @author todd
  147 + * @since 2019/3/19
  148 + */
  149 + @ResponseBody
  150 + @RequestMapping(value = "/userLoginInfo",method = RequestMethod.POST ,produces = "application/json;charset=utf-8")
  151 + public String userLoginInfo(){
  152 + String eChartData = service.userLoginInfo();
  153 + JSONObject job = new JSONObject();
  154 + if (null == eChartData){
  155 + job.put("code",-1);
  156 + job.put("msg","fail");
  157 + }else{
  158 + job.put("code",0);
  159 + job.put("msg","success");
  160 + job.put("data",eChartData);
  161 + }
  162 + String jsonText = job.toJSONString();
  163 + logger.info("获取近一个月的用户登录情况》》》》》》》"+jsonText);
  164 + return jsonText;
  165 + }
  166 +}
  1 +package com.sinocontact.app.controller.user;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sinocontact.app.common.CommonConstant;
  5 +import com.sinocontact.app.controller.BaseController;
  6 +import com.sinocontact.app.entity.Novel;
  7 +import com.sinocontact.app.entity.User;
  8 +import com.sinocontact.app.service.user.UserService;
  9 +import com.sinocontact.app.utils.VerifyCodeUtil;
  10 +import org.apache.ibatis.annotations.Param;
  11 +import org.apache.log4j.Logger;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Controller;
  14 +import org.springframework.util.StringUtils;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RequestMethod;
  17 +import org.springframework.web.bind.annotation.RequestParam;
  18 +import org.springframework.web.bind.annotation.ResponseBody;
  19 +
  20 +import javax.servlet.http.HttpServletResponse;
  21 +import javax.servlet.http.HttpSession;
  22 +import java.io.OutputStream;
  23 +import java.util.List;
  24 +
  25 +/**
  26 + * 用户登录
  27 + * @author todd
  28 + * @since 2019/1/21
  29 + */
  30 +@Controller
  31 +@RequestMapping("/user")
  32 +public class UserController extends BaseController{
  33 + private static Logger logger = Logger.getLogger(UserController.class);
  34 +
  35 + @Autowired
  36 + private UserService userService;
  37 +
  38 + /**
  39 + * 跳转到用户登录界面
  40 + * @author todd
  41 + * @since 2019/1/23
  42 + */
  43 + @RequestMapping("/login")
  44 + public String getUser(){
  45 + return "views/user/login";
  46 + }
  47 +
  48 +
  49 + /**
  50 + * 跳转到用户注册界面
  51 + * @author todd
  52 + * @since 2019/1/26
  53 + */
  54 + @RequestMapping("/loginReg")
  55 + public String reg(){
  56 + return "views/user/reg";
  57 + }
  58 +
  59 + /**
  60 + * 跳转到找回密码界面
  61 + * @author todd
  62 + * @since 2019/1/26
  63 + */
  64 + @RequestMapping("/loginGetPassword")
  65 + public String getPassword(){
  66 + return "views/user/forget";
  67 + }
  68 +
  69 +
  70 + /**
  71 + * 检验用户登录信息
  72 + * @author todd
  73 + * @since 2019/1/23
  74 + */
  75 + @ResponseBody
  76 + @RequestMapping(value="/loginCheck", produces = "application/json;charset=UTF-8")
  77 + public String checkLogin(@RequestParam(value = "username")String username,
  78 + @RequestParam(value = "password")String password,
  79 + @RequestParam(value = "code",defaultValue = "")String verifyCode) throws Exception{
  80 +
  81 + String verCode = (String) this.getSession().getAttribute(CommonConstant.VERCODE_KEY);
  82 + //校验输入的用户名、密码和图形验证码获的状态码
  83 + Integer code = userService.checkUser(username,password,verifyCode,verCode);
  84 + JSONObject job = new JSONObject();
  85 + if (code == 1){ //登录成功
  86 + this.getSession().setAttribute(CommonConstant.SESSION_KEY,userService.getUserByAccount(username));
  87 + job.put("code",code);
  88 + job.put("msg","登录成功!");
  89 + }else if (code == -1){
  90 + job.put("code",code);
  91 + job.put("msg","密码或用户名有误,请重新输入!");
  92 + }else if (code == -2){
  93 + job.put("code",code);
  94 + job.put("msg","您输入的用户名不存在!");
  95 + }else if (code == -3){
  96 + job.put("code",code);
  97 + job.put("msg","验证码有误,请重新输入");
  98 + }
  99 + String jobText = job.toJSONString();
  100 + logger.info(jobText);
  101 + return jobText;
  102 + }
  103 +
  104 + /**
  105 + * 校验找回密码的手机号
  106 + * @param phone 手机号
  107 + * @param verifyCode 图形验证码
  108 + * @param phoneCode 手机验证码
  109 + * @author caoMingYang
  110 + * @since 2019/5/4 10:09
  111 + */
  112 + @ResponseBody
  113 + @RequestMapping("/forget")
  114 + public String checkForget(@RequestParam("phone")String phone,
  115 + @RequestParam("verifyCode")String verifyCode,
  116 + @RequestParam("phoneCode")String phoneCode){
  117 + JSONObject job = new JSONObject();
  118 + String sessionCode = (String) this.getSession().getAttribute(CommonConstant.VERCODE_KEY);
  119 + Integer num = userService.checkForget(phone,verifyCode,sessionCode,phoneCode);
  120 + this.getSession().setAttribute(CommonConstant.PHONE,phone);
  121 + if (num == 0){
  122 + job.put("code",0);
  123 + job.put("msg","success");
  124 + }else if (num == -1){
  125 + job.put("code",-1);
  126 + job.put("msg","手机号未注册,请先注册!");
  127 + }else if (num == -2){
  128 + job.put("code",-2);
  129 + job.put("msg","验证码超时,请重新获取!");
  130 + }else if (num == -3){
  131 + job.put("code",-3);
  132 + job.put("msg","验证码输入有误!");
  133 + }else if (num == -4){
  134 + job.put("code",-4);
  135 + job.put("msg","请先获取手机验证码!");
  136 + }else if (num == -5){
  137 + job.put("code",-5);
  138 + job.put("msg","图形验证码输入有误!");
  139 + }
  140 + return job.toJSONString();
  141 + }
  142 +
  143 + /**
  144 + * 重置密码
  145 + * @param password 密码
  146 + * @author caoMingYang
  147 + * @since 2019/5/4 15:47
  148 + */
  149 + @ResponseBody
  150 + @RequestMapping("/resetPassword")
  151 + public String resetPassword(@RequestParam("password")String password){
  152 + String phone = (String) this.getSession().getAttribute(CommonConstant.PHONE);
  153 + boolean flag = userService.updatePassword(phone,password);
  154 + JSONObject job = new JSONObject();
  155 + if (flag){
  156 + job.put("code",0);
  157 + job.put("msg","success");
  158 + }else{
  159 + job.put("code",-1);
  160 + job.put("msg","密码重置失败,请稍后再试!");
  161 + }
  162 + return job.toJSONString();
  163 + }
  164 +
  165 + /**
  166 + * 获取短信验证码
  167 + * @author todd
  168 + * @since 2019/1/29
  169 + */
  170 + @ResponseBody
  171 + @RequestMapping(value="/loginGetCode", produces = "application/json;charset=UTF-8")
  172 + public String getPhoneCode(@RequestParam("phone")String phone)throws Exception{
  173 + logger.info(phone);
  174 + Integer code = userService.getPhoneCode(phone);
  175 + JSONObject job = new JSONObject();
  176 + if (code == -1){//发送失败
  177 + job.put("code",code);
  178 + job.put("msg","验证码发送失败");
  179 + }else{
  180 + job.put("code",code);
  181 + job.put("msg","验证码发送成功");
  182 + }
  183 + String jobText = job.toJSONString();
  184 + logger.info(jobText);
  185 + return jobText;
  186 + }
  187 +
  188 + /**
  189 + * 找回密码验证码
  190 + * @param phone 手机号
  191 + * @author caoMingYang
  192 + * @since 2019/5/4 9:35
  193 + */
  194 + @ResponseBody
  195 + @RequestMapping("/forgetCode")
  196 + public String forgetCode(@RequestParam("phone")String phone){
  197 + JSONObject job = new JSONObject();
  198 + Integer num = userService.forgetCode(phone);
  199 + if (num == 0){
  200 + job.put("code",0);
  201 + job.put("msg","success");
  202 + }else{
  203 + job.put("code",-1);
  204 + job.put("msg","fail");
  205 + }
  206 + return job.toJSONString();
  207 + }
  208 +
  209 + /**
  210 + * 保存用户的注册信息
  211 + * @param username 用户名
  212 + * @param password 密码
  213 + * @param phone 电话号码
  214 + * @param nickname 昵称
  215 + * @author caoMingYang
  216 + * @since 2019/5/2 11:02
  217 + */
  218 + @ResponseBody
  219 + @RequestMapping(value = "/saveUser",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
  220 + public String saveUser(@RequestParam("username")String username,
  221 + @RequestParam("password")String password,
  222 + @RequestParam("phone")String phone,
  223 + @RequestParam("nickname")String nickname,
  224 + @RequestParam("verifyCode")String verifyCode){
  225 + JSONObject job = new JSONObject();
  226 + Integer num = userService.saveUser(username, password, phone, nickname,verifyCode);
  227 + if (num == 1){
  228 + job.put("code",0);
  229 + job.put("msg","success");
  230 + }else if (num == 0){
  231 + job.put("code",-1);
  232 + job.put("msg","系统异常,请稍后再试!");
  233 + }else if (num == -1){
  234 + job.put("code",-1);
  235 + job.put("msg","验证码超时,请再次获取!");
  236 + }else if (num == -2){
  237 + job.put("code",-1);
  238 + job.put("msg","验证码错误!");
  239 + }else if (num == -3){
  240 + job.put("code",-1);
  241 + job.put("msg","请先获取短信验证码!");
  242 + }else if (num == -4){
  243 + job.put("code",-1);
  244 + job.put("msg","此号码已注册过,请直接登录或找回密码");
  245 + }
  246 + return job.toJSONString();
  247 + }
  248 +
  249 +
  250 + /**
  251 + * 获取图形验证码
  252 + * @param session
  253 + * @param response
  254 + * @author caoMingYang
  255 + * @since 2019/4/4 20:17
  256 + */
  257 + @RequestMapping("/verifyCode")
  258 + public void generalVerify(HttpServletResponse response, HttpSession session){
  259 + response.setContentType("image/jpeg");
  260 + String verifyCode = VerifyCodeUtil.getRandomVerifyCode();
  261 + try {
  262 + OutputStream os = response.getOutputStream();
  263 + session.setAttribute(CommonConstant.VERCODE_KEY, verifyCode);
  264 + VerifyCodeUtil.outputImage(verifyCode, os);
  265 + os.close();
  266 + } catch (Exception e) {
  267 + logger.error("", e);
  268 + }
  269 + }
  270 +
  271 +
  272 + /**
  273 + * 跳转到首页
  274 + * @author todd
  275 + * @since 2019/1/30
  276 + */
  277 + @RequestMapping("/index")
  278 + public String toIndex(){
  279 + User user = (User) this.getSession().getAttribute(CommonConstant.SESSION_KEY);
  280 + putObject("user",user);
  281 + //后台管理页面
  282 + if (user.getRole() == 100){
  283 + return "views/indexRear_end";
  284 + }
  285 + //前台网站页面
  286 + return "views/index";
  287 + }
  288 +
  289 + /**
  290 + * 首页
  291 + * @author todd
  292 + * @since 2019/1/30
  293 + */
  294 + @RequestMapping("/console")
  295 + public String console(){
  296 + List<Novel> hotNovelList = userService.queryHotNovel();
  297 + List<Novel> recommendList = userService.queryRecommendList();
  298 + List<Novel> nowUpdateList = userService.queryNowUpdate();
  299 + List<Novel> wordsList = userService.queryWordsList();
  300 +
  301 + this.putObject("hotNovelList",hotNovelList);
  302 + this.putObject("recommendList",recommendList);
  303 + this.putObject("nowUpdateList",nowUpdateList);
  304 + this.putObject("wordsList",wordsList);
  305 + return "views/home/console";
  306 + }
  307 +
  308 + /**
  309 + * 退出登录
  310 + * @author todd
  311 + * @since 2019/1/24
  312 + */
  313 + @RequestMapping("/loginOut")
  314 + public String loginOut(){
  315 + this.getSession().removeAttribute(CommonConstant.SESSION_KEY);
  316 + return "views/user/login";
  317 + }
  318 +
  319 +}
  1 +package com.sinocontact.app.dao;
  2 +
  3 +import com.sinocontact.app.entity.Chapter;
  4 +import com.sinocontact.app.entity.Comment;
  5 +import com.sinocontact.app.entity.Novel;
  6 +import org.apache.ibatis.annotations.Mapper;
  7 +import org.apache.ibatis.annotations.Param;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 公共dao
  13 + * @author caoMingYang
  14 + * @since 2019/4/25 16:13
  15 + */
  16 +@Mapper
  17 +public interface HomeMapper {
  18 +
  19 + /**
  20 + * 通过id获取小说信息
  21 + * @param novelId 小说id
  22 + * @return novel
  23 + * @throws Exception
  24 + * @author caoMingYang
  25 + * @since 2019/4/25 16:18
  26 + */
  27 + Novel getNovelById(@Param("novelId")Integer novelId) throws Exception;
  28 +
  29 +
  30 + /**
  31 + * 添加点击
  32 + * @param novelId 小说id
  33 + * @return 影响行数
  34 + * @throws Exception
  35 + * @author caoMingYang
  36 + * @since 2019/4/26 0:14
  37 + */
  38 + Integer addClick(@Param("novelId")Integer novelId,
  39 + @Param("novelClick")Integer novelClick) throws Exception;
  40 +
  41 + /**
  42 + * 获取点击数量
  43 + * @param novelId 小说id
  44 + * @return 点击数量
  45 + * @throws Exception
  46 + * @author caoMingYang
  47 + * @since 2019/4/26 0:23
  48 + */
  49 + Integer getNovelClick(@Param("novelId")Integer novelId) throws Exception;
  50 +
  51 + /**
  52 + * 通过小说id获得最新的五条章节信息
  53 + * @param novelId 小说id
  54 + * @return chapterList
  55 + * @throws Exception 异常
  56 + * @author caoMingYang
  57 + * @since 2019/4/27 12:28
  58 + */
  59 + List<Chapter> queryFiveChapter(@Param("novelId")Integer novelId)throws Exception;
  60 +
  61 + /**
  62 + * 通过小说id获取用户评论
  63 + * @param novelId 小说id
  64 + * @return commentList
  65 + * @throws Exception
  66 + * @author caoMingYang
  67 + * @since 2019/4/27 17:38
  68 + */
  69 + List<Comment> getNovelComment(@Param("novelId")Integer novelId)throws Exception;
  70 +
  71 + /**
  72 + * 通过小说id获取小说所有章节
  73 + * @param novelId 小说 id
  74 + * @return chapterList
  75 + * @throws Exception
  76 + * @author caoMingYang
  77 + * @since 2019/4/27 22:33
  78 + */
  79 + List<Chapter> queryChapterList(@Param("novelId")Integer novelId)throws Exception;
  80 +
  81 +
  82 + /**
  83 + * 通过用户id获取用户当前推荐次数
  84 + * @param userId 用户id
  85 + * @return 推荐次数
  86 + * @throws Exception
  87 + * @author caoMingYang
  88 + * @since 2019/5/3 9:48
  89 + */
  90 + Integer queryRecommendNumById(@Param("userId")Integer userId)throws Exception;
  91 +
  92 +
  93 + /**
  94 + * 通过小说id更新小说推荐数
  95 + * @param novelId 小说id
  96 + * @return 影响行数
  97 + * @author caoMingYang
  98 + * @since 2019/4/28 20:37
  99 + */
  100 + Integer updateRecommendById(@Param("novelId")Integer novelId);
  101 +
  102 +
  103 + /**
  104 + * 通过id更新用户每日推荐次数
  105 + * @param userId 用户id
  106 + * @author caoMingYang
  107 + * @since 2019/4/28 20:45
  108 + */
  109 + Integer updateUserRecommendNum(@Param("userId")Integer userId);
  110 +
  111 +
  112 + /**
  113 + * 通过小说id和用户id判断小说是否在用户书架中
  114 + * @param novelId 小说id
  115 + * @param userId 用户id
  116 + * @throws Exception
  117 + * @author caoMingYang
  118 + * @since 2019/4/30 20:19
  119 + */
  120 + Integer checkBookCase(@Param("novelId")Integer novelId,
  121 + @Param("userId")Integer userId,
  122 + @Param("chapterId")Integer chapterId)throws Exception;
  123 +
  124 + /**
  125 + * 添加小说到用户书架
  126 + * @param novelId 小说id
  127 + * @param userId 用户id
  128 + * @param chapterId 章节id
  129 + * @throws Exception
  130 + * @author caoMingYang
  131 + * @since 2019/4/30 20:19
  132 + */
  133 + Integer addBookCase(@Param("novelId")Integer novelId,
  134 + @Param("userId")Integer userId,
  135 + @Param(value = "chapterId")Integer chapterId)throws Exception;
  136 +
  137 + /**
  138 + * 更新用户书架信息
  139 + * @param novelId 小说id
  140 + * @param userId 用户id
  141 + * @param chapterId 章节id
  142 + * @throws Exception
  143 + * @author caoMingYang
  144 + * @since 2019/5/1 8:23
  145 + */
  146 + Integer updateBookCase(@Param("novelId")Integer novelId,
  147 + @Param("userId")Integer userId,
  148 + @Param("chapterId")Integer chapterId) throws Exception;
  149 +
  150 +
  151 + /**
  152 + * 通过id获取小说章节信息
  153 + * @param novelId 小说id
  154 + * @param chapterId 章节id
  155 + * @return chapter
  156 + * @throws Exception
  157 + * @author caoMingYang
  158 + * @since 2019/5/11 13:25
  159 + */
  160 + Chapter getChapterInfo(@Param("novelId")Integer novelId,
  161 + @Param("chapterId")Integer chapterId) throws Exception;
  162 +
  163 + /**
  164 + * 通过id获取小说章节信息
  165 + * @param novelId 小说id
  166 + * @param chapterId 章节id
  167 + * @return chapter
  168 + * @throws Exception
  169 + * @author caoMingYang
  170 + * @since 2019/5/11 13:25
  171 + */
  172 + Chapter previousChapter(@Param("novelId")Integer novelId,
  173 + @Param("chapterId")Integer chapterId) throws Exception;
  174 +
  175 + /**
  176 + * 获取是否存在上一章
  177 + * @param novelId 小说id
  178 + * @param chapterId 章节id
  179 + * @return 0 不存在
  180 + * @throws Exception
  181 + * @author caoMingYang
  182 + * @since 2019/5/11 19:00
  183 + */
  184 + Integer previousChapterCount(@Param("novelId")Integer novelId,
  185 + @Param("chapterId")Integer chapterId)throws Exception;
  186 +
  187 +
  188 + /**
  189 + * 通过id获取小说章节信息
  190 + * @param novelId 小说id
  191 + * @param chapterId 章节id
  192 + * @return chapter
  193 + * @throws Exception
  194 + * @author caoMingYang
  195 + * @since 2019/5/11 13:25
  196 + */
  197 + Chapter nextChapter(@Param("novelId")Integer novelId,
  198 + @Param("chapterId")Integer chapterId) throws Exception;
  199 +
  200 + /**
  201 + * 是否存在下一章
  202 + * @param novelId 小说id
  203 + * @param chapterId 章节id
  204 + * @return 0 不存在
  205 + * @throws Exception
  206 + * @author caoMingYang
  207 + * @since 2019/5/11 13:25
  208 + */
  209 + Integer nextChapterCount(@Param("novelId")Integer novelId,
  210 + @Param("chapterId")Integer chapterId) throws Exception;
  211 +
  212 + /**
  213 + * 更新用户每日推荐次数
  214 + * @author caoMingYang
  215 + * @since 2019/5/18 0:23
  216 + */
  217 + Integer updateRecommendTimes()throws Exception;
  218 +
  219 +
  220 +
  221 + Integer saveComment(@Param("novelId")Integer novelId,
  222 + @Param("userId")Integer userId,
  223 + @Param("comment")String comment) throws Exception;
  224 +}
  1 +package com.sinocontact.app.dao.authorCenter;
  2 +
  3 +import com.sinocontact.app.entity.Chapter;
  4 +import com.sinocontact.app.entity.Novel;
  5 +import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 作者中心
  12 + */
  13 +@Mapper
  14 +public interface AuthorCenterMapper {
  15 +
  16 + /**
  17 + * 通过用户id获取用户创作的小说
  18 + * @param userId 用户id
  19 + * @param page 页码
  20 + * @param pageSize 一页数据条数
  21 + * @throws Exception
  22 + */
  23 + List<Novel> queryNovelList(@Param("userId")Integer userId,
  24 + @Param("page")Integer page,
  25 + @Param("pageSize")Integer pageSize)throws Exception;
  26 +
  27 + /**
  28 + * 获取用户创作的小说总条数
  29 + * @param userId 用户id
  30 + * @return 条数
  31 + * @throws Exception
  32 + * @author caoMingYang
  33 + * @since 2019/5/20 23:04
  34 + */
  35 + Integer queryNovelCount(@Param("userId")Integer userId) throws Exception;
  36 +
  37 +
  38 + /**
  39 + * 通过id获取小说信息
  40 + * @param novelId 小说id
  41 + * @return novel
  42 + * @throws Exception
  43 + * @author caoMingYang
  44 + * @since 2019/5/21 21:30
  45 + */
  46 + Novel queryNovelInfo(@Param("novelId")Integer novelId) throws Exception;
  47 +
  48 + /**
  49 + * 校验小说名称是否重复
  50 + * @param novelId 小说id
  51 + * @param novelName 小说名称
  52 + * @return 大于0 重复
  53 + * @throws Exception
  54 + * @author caoMingYang
  55 + * @since 2019/5/24 21:30
  56 + */
  57 + Integer checkNovelName(@Param("novelId")Integer novelId,
  58 + @Param("novelName")String novelName)throws Exception;
  59 +
  60 + /**
  61 + * 更新小说信息
  62 + * @param novel 小说
  63 + * @throws Exception
  64 + * @author caoMingYang
  65 + * @since 2019/5/24 21:42
  66 + */
  67 + Integer updateNovel(@Param("novel") Novel novel) throws Exception;
  68 +
  69 + /**
  70 + * 保存小说信息
  71 + * @param novel 小说
  72 + * @throws Exception
  73 + * @author caoMingYang
  74 + * @since 2019/5/24 21:42
  75 + */
  76 + Integer saveNovel(Novel novel) throws Exception;
  77 +
  78 + /**
  79 + * 保存小说扩展表信息
  80 + * @param novelId 小说id
  81 + * @throws Exception
  82 + * @author caoMingYang
  83 + * @since 2019/5/24 23:54
  84 + */
  85 + Integer saveNovelExt(@Param("novelId")Integer novelId) throws Exception;
  86 +
  87 +
  88 + /**
  89 + * 保存作者小说关联表信息
  90 + * @param novelId 小说id
  91 + * @param userId 用户id
  92 + * @throws Exception
  93 + * @author caoMingYang
  94 + * @since 2019/5/25 0:00
  95 + */
  96 + Integer saveAuthorNovel(@Param("novelId")Integer novelId,
  97 + @Param("userId")Integer userId) throws Exception;
  98 +
  99 +
  100 + Integer saveChapter(Chapter chapter) throws Exception;
  101 +
  102 + Integer queryNovelWords(@Param("novelId")Integer novelId) throws Exception;
  103 +
  104 + Integer updateLastChapter(@Param("chapter")Chapter chapter,
  105 + @Param("novelId")Integer novelId,
  106 + @Param("words")Integer words) throws Exception;
  107 +
  108 +
  109 + String queryChapterNum(@Param("novelId")Integer novelId)throws Exception;
  110 +
  111 +}
  1 +package com.sinocontact.app.dao.jsoup;
  2 +
  3 +import com.sinocontact.app.entity.Chapter;
  4 +import com.sinocontact.app.entity.CrawlNovel;
  5 +import com.sinocontact.app.entity.Novel;
  6 +import org.apache.ibatis.annotations.Mapper;
  7 +import org.apache.ibatis.annotations.Param;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 爬取小说
  13 + * @author caoMingYang
  14 + * @since 2019/5/12 17:14
  15 + */
  16 +@Mapper
  17 +public interface JSoupMapper {
  18 +
  19 + /**
  20 + * 保存待爬取小说信息
  21 + * @param novelName 名称
  22 + * @param novelAuthor 作者
  23 + * @param flUrl 飞卢网地址
  24 + * @param ddUrl 顶点网地址
  25 + * @return true 成功,false 失败
  26 + * @author caoMingYang
  27 + * @since 2019/5/12 17:14
  28 + */
  29 + Integer saveNovelUrl(@Param("novelName")String novelName,
  30 + @Param("novelAuthor")String novelAuthor,
  31 + @Param("flUrl")String flUrl,
  32 + @Param("ddUrl")String ddUrl,
  33 + @Param("ddChapterUrl")String ddChapterUrl) throws Exception;
  34 +
  35 + /**
  36 + * 获取待抓取小说信息
  37 + * @return crawlNovelList
  38 + * @throws Exception
  39 + * @author caoMingYang
  40 + * @since 2019/5/12 20:02
  41 + */
  42 + List<CrawlNovel> queryNovelList() throws Exception;
  43 +
  44 + /**
  45 + * 保存爬取的小说信息
  46 + * @param novel 小说
  47 + * @author caoMingYang
  48 + * @since 2019/5/14 20:40
  49 + */
  50 + Integer saveNovelInfo(Novel novel)throws Exception;
  51 +
  52 + /**
  53 + * 保存爬取小说扩展信息
  54 + * @param novel 小说信息
  55 + * @author caoMingYang
  56 + * @since 2019/5/14 21:00
  57 + */
  58 + Integer saveNovelExtInfo(Novel novel)throws Exception;
  59 +
  60 + /**
  61 + * 保存章节信息
  62 + * @param chapterList 章节信息
  63 + * @author caoMingYang
  64 + * @since 2019/5/14 20:43
  65 + */
  66 + Integer saveChapterInfo(List<Chapter> chapterList)throws Exception;
  67 +
  68 + /**
  69 + * 更新爬取成功小说的状态
  70 + * @param novelId 小说id
  71 + * @throws Exception
  72 + * @author caoMingYang
  73 + * @since 2019/5/17 8:32
  74 + */
  75 + Integer updateCrawlNovel(@Param("id")Integer novelId)throws Exception;
  76 +}
  1 +package com.sinocontact.app.dao.library;
  2 +
  3 +import com.sinocontact.app.entity.Novel;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 书库
  11 + * @author caoMingYang
  12 + * @since 2019/4/19 16:52
  13 + */
  14 +@Mapper
  15 +public interface LibraryMapper {
  16 +
  17 + /**
  18 + * 获取全部作品页面数据
  19 + * @param page 页码
  20 + * @param pageSize 页数据条数
  21 + * @param novelType 类型
  22 + * @param sortFlag 检索标记
  23 + * @param startWords 开始字数
  24 + * @param endWords 结束字数
  25 + * @param novelStatus 状态
  26 + * @return novelList
  27 + * @throws Exception
  28 + * @author caoMingYang
  29 + * @since 2019/4/19 17:28
  30 + */
  31 + List<Novel> queryTotalNovelList(@Param("page")Integer page,
  32 + @Param("pageSize")Integer pageSize,
  33 + @Param("novelType")String novelType,
  34 + @Param("sortFlag")Integer sortFlag,
  35 + @Param("start")Integer startWords,
  36 + @Param("end")Integer endWords,
  37 + @Param("novelStatus")Integer novelStatus,
  38 + @Param("novelInfo")String novelInfo)throws Exception;
  39 +
  40 + /**
  41 + * 获取小说总条数
  42 + * @param novelInfo 书名、作者
  43 + * @param novelType 类型
  44 + * @param endWords 结束字数
  45 + * @param novelStatus 状态
  46 + * @param sortFlag 排序
  47 + * @param startWords 开始字数
  48 + * @return java.lang.Integer
  49 + * @author caoMingYang
  50 + * @since 2019/4/19 17:28
  51 + */
  52 + Integer getNovelCount(@Param("novelType")String novelType,
  53 + @Param("sortFlag")Integer sortFlag,
  54 + @Param("start")Integer startWords,
  55 + @Param("end")Integer endWords,
  56 + @Param("novelStatus")Integer novelStatus,
  57 + @Param("novelInfo")String novelInfo)throws Exception;
  58 +
  59 +
  60 + /**
  61 + * 获取都市小说页面数据
  62 + * @param page 页码
  63 + * @param pageSize 页数据条数
  64 + * @param sortFlag 检索标记
  65 + * @param startWords 开始字数
  66 + * @param endWords 结束字数
  67 + * @param novelStatus 状态
  68 + * @return novelList
  69 + * @throws Exception
  70 + * @author caoMingYang
  71 + * @since 2019/4/23 23:17
  72 + */
  73 + List<Novel> queryTotalCityNovelList(@Param("page")Integer page,
  74 + @Param("pageSize")Integer pageSize,
  75 + @Param("sortFlag")Integer sortFlag,
  76 + @Param("start")Integer startWords,
  77 + @Param("end")Integer endWords,
  78 + @Param("novelStatus")Integer novelStatus,
  79 + @Param("novelInfo")String novelInfo)throws Exception;
  80 +
  81 + /**
  82 + * 获取都市小说总条数
  83 + * @param novelInfo 书名、作者
  84 + * @param endWords 结束字数
  85 + * @param novelStatus 状态
  86 + * @param sortFlag 排序
  87 + * @param startWords 开始字数
  88 + * @return java.lang.Integer
  89 + * @author caoMingYang
  90 + * @since 2019/4/23 23:17
  91 + */
  92 + Integer getNovelCityCount(@Param("sortFlag")Integer sortFlag,
  93 + @Param("start")Integer startWords,
  94 + @Param("end")Integer endWords,
  95 + @Param("novelStatus")Integer novelStatus,
  96 + @Param("novelInfo")String novelInfo)throws Exception;
  97 +
  98 + /**
  99 + * 获取都市热门小说
  100 + * @return novelList
  101 + * @throws Exception
  102 + * @author caoMingYang
  103 + * @since 2019/4/23 23:32
  104 + */
  105 + List<Novel> queryCityHotNovel()throws Exception;
  106 +
  107 +
  108 + /**
  109 + * 玄幻热门小说
  110 + * @return novelList
  111 + * @throws Exception
  112 + * @author caoMingYang
  113 + * @since 2019/4/23 23:50
  114 + */
  115 + List<Novel> queryFantasyHotNovel()throws Exception;
  116 +
  117 + /**
  118 + * 获取玄幻小说页面数据
  119 + * @param page 页码
  120 + * @param pageSize 页数据条数
  121 + * @param sortFlag 检索标记
  122 + * @param startWords 开始字数
  123 + * @param endWords 结束字数
  124 + * @param novelStatus 状态
  125 + * @return novelList
  126 + * @throws Exception
  127 + * @author caoMingYang
  128 + * @since 2019/4/23 23:50
  129 + */
  130 + List<Novel> queryTotalFantasyNovelList(@Param("page")Integer page,
  131 + @Param("pageSize")Integer pageSize,
  132 + @Param("sortFlag")Integer sortFlag,
  133 + @Param("start")Integer startWords,
  134 + @Param("end")Integer endWords,
  135 + @Param("novelStatus")Integer novelStatus,
  136 + @Param("novelInfo")String novelInfo)throws Exception;
  137 +
  138 + /**
  139 + * 获取玄幻小说总条数
  140 + * @param novelInfo 书名、作者
  141 + * @param endWords 结束字数
  142 + * @param novelStatus 状态
  143 + * @param sortFlag 排序
  144 + * @param startWords 开始字数
  145 + * @return java.lang.Integer
  146 + * @author caoMingYang
  147 + * @since 2019/4/23 23:51
  148 + */
  149 + Integer getNovelFantasyCount(@Param("sortFlag")Integer sortFlag,
  150 + @Param("start")Integer startWords,
  151 + @Param("end")Integer endWords,
  152 + @Param("novelStatus")Integer novelStatus,
  153 + @Param("novelInfo")String novelInfo)throws Exception;
  154 +
  155 +
  156 + /**
  157 + * 仙侠热门小说
  158 + * @return novelList
  159 + * @throws Exception
  160 + * @author caoMingYang
  161 + * @since 2019/4/23 23:50
  162 + */
  163 + List<Novel> queryFairyHotNovel()throws Exception;
  164 +
  165 + /**
  166 + * 获取仙侠小说页面数据
  167 + * @param page 页码
  168 + * @param pageSize 页数据条数
  169 + * @param sortFlag 检索标记
  170 + * @param startWords 开始字数
  171 + * @param endWords 结束字数
  172 + * @param novelStatus 状态
  173 + * @return novelList
  174 + * @throws Exception
  175 + * @author caoMingYang
  176 + * @since 2019/4/23 23:50
  177 + */
  178 + List<Novel> queryTotalFairyNovelList(@Param("page")Integer page,
  179 + @Param("pageSize")Integer pageSize,
  180 + @Param("sortFlag")Integer sortFlag,
  181 + @Param("start")Integer startWords,
  182 + @Param("end")Integer endWords,
  183 + @Param("novelStatus")Integer novelStatus,
  184 + @Param("novelInfo")String novelInfo)throws Exception;
  185 +
  186 + /**
  187 + * 获取仙侠小说总条数
  188 + * @param novelInfo 书名、作者
  189 + * @param endWords 结束字数
  190 + * @param novelStatus 状态
  191 + * @param sortFlag 排序
  192 + * @param startWords 开始字数
  193 + * @return java.lang.Integer
  194 + * @author caoMingYang
  195 + * @since 2019/4/23 23:51
  196 + */
  197 + Integer getNovelFairyCount(@Param("sortFlag")Integer sortFlag,
  198 + @Param("start")Integer startWords,
  199 + @Param("end")Integer endWords,
  200 + @Param("novelStatus")Integer novelStatus,
  201 + @Param("novelInfo")String novelInfo)throws Exception;
  202 +
  203 + /**
  204 + * 科幻热门小说
  205 + * @return novelList
  206 + * @throws Exception
  207 + * @author caoMingYang
  208 + * @since 2019/4/23 23:50
  209 + */
  210 + List<Novel> queryScienceFictionHotNovel()throws Exception;
  211 +
  212 + /**
  213 + * 获取科幻小说页面数据
  214 + * @param page 页码
  215 + * @param pageSize 页数据条数
  216 + * @param sortFlag 检索标记
  217 + * @param startWords 开始字数
  218 + * @param endWords 结束字数
  219 + * @param novelStatus 状态
  220 + * @return novelList
  221 + * @throws Exception
  222 + * @author caoMingYang
  223 + * @since 2019/4/23 23:50
  224 + */
  225 + List<Novel> queryTotalScienceFictionNovelList(@Param("page")Integer page,
  226 + @Param("pageSize")Integer pageSize,
  227 + @Param("sortFlag")Integer sortFlag,
  228 + @Param("start")Integer startWords,
  229 + @Param("end")Integer endWords,
  230 + @Param("novelStatus")Integer novelStatus,
  231 + @Param("novelInfo")String novelInfo)throws Exception;
  232 +
  233 + /**
  234 + * 获取科幻小说总条数
  235 + * @param novelInfo 书名、作者
  236 + * @param endWords 结束字数
  237 + * @param novelStatus 状态
  238 + * @param sortFlag 排序
  239 + * @param startWords 开始字数
  240 + * @return java.lang.Integer
  241 + * @author caoMingYang
  242 + * @since 2019/4/23 23:51
  243 + */
  244 + Integer getNovelScienceFictionCount(@Param("sortFlag")Integer sortFlag,
  245 + @Param("start")Integer startWords,
  246 + @Param("end")Integer endWords,
  247 + @Param("novelStatus")Integer novelStatus,
  248 + @Param("novelInfo")String novelInfo)throws Exception;
  249 +
  250 +
  251 + /**
  252 + * 历史军事热门小说
  253 + * @return novelList
  254 + * @throws Exception
  255 + * @author caoMingYang
  256 + * @since 2019/4/23 23:50
  257 + */
  258 + List<Novel> queryMilitaryHistoryHotNovel()throws Exception;
  259 +
  260 + /**
  261 + * 获取历史军事小说页面数据
  262 + * @param page 页码
  263 + * @param pageSize 页数据条数
  264 + * @param sortFlag 检索标记
  265 + * @param startWords 开始字数
  266 + * @param endWords 结束字数
  267 + * @param novelStatus 状态
  268 + * @return novelList
  269 + * @throws Exception
  270 + * @author caoMingYang
  271 + * @since 2019/4/23 23:50
  272 + */
  273 + List<Novel> queryTotalMilitaryHistoryNovelList(@Param("page")Integer page,
  274 + @Param("pageSize")Integer pageSize,
  275 + @Param("sortFlag")Integer sortFlag,
  276 + @Param("start")Integer startWords,
  277 + @Param("end")Integer endWords,
  278 + @Param("novelStatus")Integer novelStatus,
  279 + @Param("novelInfo")String novelInfo)throws Exception;
  280 +
  281 + /**
  282 + * 获取历史军事小说总条数
  283 + * @param novelInfo 书名、作者
  284 + * @param endWords 结束字数
  285 + * @param novelStatus 状态
  286 + * @param sortFlag 排序
  287 + * @param startWords 开始字数
  288 + * @return java.lang.Integer
  289 + * @author caoMingYang
  290 + * @since 2019/4/23 23:51
  291 + */
  292 + Integer getNovelMilitaryHistoryCount(@Param("sortFlag")Integer sortFlag,
  293 + @Param("start")Integer startWords,
  294 + @Param("end")Integer endWords,
  295 + @Param("novelStatus")Integer novelStatus,
  296 + @Param("novelInfo")String novelInfo)throws Exception;
  297 +
  298 + /**
  299 + * 武侠小说
  300 + * @return novelList
  301 + * @throws Exception
  302 + * @author caoMingYang
  303 + * @since 2019/4/23 23:50
  304 + */
  305 + List<Novel> queryDragonHotNovel()throws Exception;
  306 +
  307 + /**
  308 + * 获取武侠小说页面数据
  309 + * @param page 页码
  310 + * @param pageSize 页数据条数
  311 + * @param sortFlag 检索标记
  312 + * @param startWords 开始字数
  313 + * @param endWords 结束字数
  314 + * @param novelStatus 状态
  315 + * @return novelList
  316 + * @throws Exception
  317 + * @author caoMingYang
  318 + * @since 2019/4/23 23:50
  319 + */
  320 + List<Novel> queryTotalDragonNovelList(@Param("page")Integer page,
  321 + @Param("pageSize")Integer pageSize,
  322 + @Param("sortFlag")Integer sortFlag,
  323 + @Param("start")Integer startWords,
  324 + @Param("end")Integer endWords,
  325 + @Param("novelStatus")Integer novelStatus,
  326 + @Param("novelInfo")String novelInfo)throws Exception;
  327 +
  328 + /**
  329 + * 获取武侠小说总条数
  330 + * @param novelInfo 书名、作者
  331 + * @param endWords 结束字数
  332 + * @param novelStatus 状态
  333 + * @param sortFlag 排序
  334 + * @param startWords 开始字数
  335 + * @return java.lang.Integer
  336 + * @author caoMingYang
  337 + * @since 2019/4/23 23:51
  338 + */
  339 + Integer getNovelDragonCount(@Param("sortFlag")Integer sortFlag,
  340 + @Param("start")Integer startWords,
  341 + @Param("end")Integer endWords,
  342 + @Param("novelStatus")Integer novelStatus,
  343 + @Param("novelInfo")String novelInfo)throws Exception;
  344 +
  345 +
  346 + /**
  347 + * 网游竞技小说
  348 + * @return novelList
  349 + * @throws Exception
  350 + * @author caoMingYang
  351 + * @since 2019/4/23 23:50
  352 + */
  353 + List<Novel> queryAthleticHotNovel()throws Exception;
  354 +
  355 + /**
  356 + * 获取网游竞技小说页面数据
  357 + * @param page 页码
  358 + * @param pageSize 页数据条数
  359 + * @param sortFlag 检索标记
  360 + * @param startWords 开始字数
  361 + * @param endWords 结束字数
  362 + * @param novelStatus 状态
  363 + * @return novelList
  364 + * @throws Exception
  365 + * @author caoMingYang
  366 + * @since 2019/4/23 23:50
  367 + */
  368 + List<Novel> queryTotalAthleticNovelList(@Param("page")Integer page,
  369 + @Param("pageSize")Integer pageSize,
  370 + @Param("sortFlag")Integer sortFlag,
  371 + @Param("start")Integer startWords,
  372 + @Param("end")Integer endWords,
  373 + @Param("novelStatus")Integer novelStatus,
  374 + @Param("novelInfo")String novelInfo)throws Exception;
  375 +
  376 + /**
  377 + * 获取网游竞技小说总条数
  378 + * @param novelInfo 书名、作者
  379 + * @param endWords 结束字数
  380 + * @param novelStatus 状态
  381 + * @param sortFlag 排序
  382 + * @param startWords 开始字数
  383 + * @return java.lang.Integer
  384 + * @author caoMingYang
  385 + * @since 2019/4/23 23:51
  386 + */
  387 + Integer getNovelAthleticCount(@Param("sortFlag")Integer sortFlag,
  388 + @Param("start")Integer startWords,
  389 + @Param("end")Integer endWords,
  390 + @Param("novelStatus")Integer novelStatus,
  391 + @Param("novelInfo")String novelInfo)throws Exception;
  392 +
  393 +
  394 + /**
  395 + * 其他小说
  396 + * @return novelList
  397 + * @throws Exception
  398 + * @author caoMingYang
  399 + * @since 2019/4/23 23:50
  400 + */
  401 + List<Novel> querySuspenseParanormalHotNovel()throws Exception;
  402 +
  403 + /**
  404 + * 获取其他小说页面数据
  405 + * @param page 页码
  406 + * @param pageSize 页数据条数
  407 + * @param sortFlag 检索标记
  408 + * @param startWords 开始字数
  409 + * @param endWords 结束字数
  410 + * @param novelStatus 状态
  411 + * @return novelList
  412 + * @throws Exception
  413 + * @author caoMingYang
  414 + * @since 2019/4/23 23:50
  415 + */
  416 + List<Novel> queryTotalSuspenseParanormalNovelList(@Param("page")Integer page,
  417 + @Param("pageSize")Integer pageSize,
  418 + @Param("sortFlag")Integer sortFlag,
  419 + @Param("start")Integer startWords,
  420 + @Param("end")Integer endWords,
  421 + @Param("novelStatus")Integer novelStatus,
  422 + @Param("novelInfo")String novelInfo)throws Exception;
  423 +
  424 + /**
  425 + * 获取其他小说总条数
  426 + * @param novelInfo 书名、作者
  427 + * @param endWords 结束字数
  428 + * @param novelStatus 状态
  429 + * @param sortFlag 排序
  430 + * @param startWords 开始字数
  431 + * @return java.lang.Integer
  432 + * @author caoMingYang
  433 + * @since 2019/4/23 23:51
  434 + */
  435 + Integer getNovelSuspenseParanormalCount(@Param("sortFlag")Integer sortFlag,
  436 + @Param("start")Integer startWords,
  437 + @Param("end")Integer endWords,
  438 + @Param("novelStatus")Integer novelStatus,
  439 + @Param("novelInfo")String novelInfo)throws Exception;
  440 +
  441 +
  442 + /**
  443 + * 其他小说
  444 + * @return novelList
  445 + * @throws Exception
  446 + * @author caoMingYang
  447 + * @since 2019/4/23 23:50
  448 + */
  449 + List<Novel> queryOtherHotNovel()throws Exception;
  450 +
  451 + /**
  452 + * 获取其他小说页面数据
  453 + * @param page 页码
  454 + * @param pageSize 页数据条数
  455 + * @param sortFlag 检索标记
  456 + * @param startWords 开始字数
  457 + * @param endWords 结束字数
  458 + * @param novelStatus 状态
  459 + * @return novelList
  460 + * @throws Exception
  461 + * @author caoMingYang
  462 + * @since 2019/4/23 23:50
  463 + */
  464 + List<Novel> queryTotalOtherNovelList(@Param("page")Integer page,
  465 + @Param("pageSize")Integer pageSize,
  466 + @Param("sortFlag")Integer sortFlag,
  467 + @Param("start")Integer startWords,
  468 + @Param("end")Integer endWords,
  469 + @Param("novelStatus")Integer novelStatus,
  470 + @Param("novelInfo")String novelInfo)throws Exception;
  471 +
  472 + /**
  473 + * 获取其他小说总条数
  474 + * @param novelInfo 书名、作者
  475 + * @param endWords 结束字数
  476 + * @param novelStatus 状态
  477 + * @param sortFlag 排序
  478 + * @param startWords 开始字数
  479 + * @return java.lang.Integer
  480 + * @author caoMingYang
  481 + * @since 2019/4/23 23:51
  482 + */
  483 + Integer getNovelOtherCount(@Param("sortFlag")Integer sortFlag,
  484 + @Param("start")Integer startWords,
  485 + @Param("end")Integer endWords,
  486 + @Param("novelStatus")Integer novelStatus,
  487 + @Param("novelInfo")String novelInfo)throws Exception;
  488 +
  489 +}
  1 +package com.sinocontact.app.dao.memberCenter;
  2 +
  3 +import com.sinocontact.app.entity.BookCaseInfo;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 书架
  11 + * @author caoMingYang
  12 + * @since 2019/4/14 21:44
  13 + */
  14 +@Mapper
  15 +public interface BookCaseMapper {
  16 +
  17 + /**
  18 + * 获取用户书架信息
  19 + * @param userId
  20 + * @return bookCaseList
  21 + * @throws Exception
  22 + * @author caoMingYang
  23 + * @since 2019/4/14 22:13
  24 + */
  25 + List<BookCaseInfo> queryBookCaseList(@Param("userId")Integer userId)throws Exception;
  26 +
  27 + /**
  28 + * 删除书架小说信息
  29 + * @param userId 用户id
  30 + * @param novelId 小说id
  31 + * @return int
  32 + * @throws Exception
  33 + * @author caoMingYang
  34 + * @since 2019/4/14 23:38
  35 + */
  36 + Integer deleteNovelById(@Param("userId")Integer userId,
  37 + @Param("novelId")Integer novelId)throws Exception;
  38 +}
  1 +package com.sinocontact.app.dao.memberCenter;
  2 +
  3 +import com.sinocontact.app.entity.User;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +
  8 +/**
  9 + * @author caoMingYang
  10 + * @since 2019/4/11 23:20
  11 + */
  12 +@Mapper
  13 +public interface UserBasicInfoMapper {
  14 +
  15 + /**
  16 + * 通过用户名获取用户信息
  17 + * @param account 用户名
  18 + * @return 数据条数
  19 + * @throws Exception
  20 + * @author caoMingYang
  21 + * @since 2019/4/11 23:21
  22 + */
  23 + User userInfoByAccount(@Param("account")String account)throws Exception;
  24 +
  25 +
  26 + /**
  27 + * 更新用户信息
  28 + * @param account 用户名
  29 + * @param nickname 昵称
  30 + * @param userId 用户id
  31 + * @throws Exception
  32 + * @author caoMingYang
  33 + * @since 2019/4/12 15:03
  34 + */
  35 + Integer updateUserInfo(@Param("account")String account,
  36 + @Param("nickname")String nickname,
  37 + @Param("userId")Integer userId)throws Exception;
  38 +
  39 + /**
  40 + * 获取用户信息
  41 + * @param userId 用户id
  42 + * @return User
  43 + * @throws Exception
  44 + * @author caoMingYang
  45 + * @since 2019/4/12 16:57
  46 + */
  47 + User getUser(@Param("userId")Integer userId)throws Exception;
  48 +
  49 + /**
  50 + * 申请成为作者
  51 + * @param userId 用户id
  52 + * @throws Exception
  53 + * @author caoMingYang
  54 + * @since 2019/4/12 19:44
  55 + */
  56 + Integer applyForAuthor(@Param("userId")Integer userId)throws Exception;
  57 +
  58 +
  59 + /**
  60 + * 更改用户申请状态
  61 + * @param userId 用户id
  62 + * @throws Exception
  63 + * @author caoMingYang
  64 + * @since 2019/4/12 20:59
  65 + */
  66 + Integer updateApplyStatus(@Param("userId")Integer userId)throws Exception;
  67 +
  68 +
  69 + /**
  70 + * 更新用户密码
  71 + * @param password 密码
  72 + * @param userId 用户id
  73 + * @throws Exception
  74 + * @author caoMingYang
  75 + * @since 2019/4/14 12:19
  76 + */
  77 + Integer updatePassword(@Param("password")String password,
  78 + @Param("userId")Integer userId) throws Exception;
  79 +}
  1 +package com.sinocontact.app.dao.ranking;
  2 +
  3 +import com.sinocontact.app.entity.Novel;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 排行榜
  11 + * @author caoMingYang
  12 + * @since 2019/4/15 13:58
  13 + */
  14 +@Mapper
  15 +public interface RankingMapper {
  16 +
  17 + /**
  18 + * 分页查询点击排行榜数据
  19 + * @param page 页码
  20 + * @param pageSize 一页数据条数
  21 + * @return novelList
  22 + * @throws Exception
  23 + * @author caoMingYang
  24 + * @since 2019/4/16 13:48
  25 + */
  26 + List<Novel> queryClickNovelLimit(@Param("page")Integer page,
  27 + @Param("pageSize")Integer pageSize) throws Exception;
  28 +
  29 + /**
  30 + * 获取收藏榜数据
  31 + * @param page 页码
  32 + * @param pageSize 页数据条数
  33 + * @return novelList
  34 + * @throws Exception
  35 + * @author caoMingYang
  36 + * @since 2019/4/18 23:40
  37 + */
  38 + List<Novel> queryCollectList(@Param("page")Integer page,
  39 + @Param("pageSize")Integer pageSize) throws Exception;
  40 +
  41 + /**
  42 + * 获取总排行榜数据
  43 + * @param page 页码
  44 + * @param pageSize 页数据条数
  45 + * @return novelList
  46 + * @throws Exception
  47 + * @author caoMingYang
  48 + * @since 2019/4/19 11:25
  49 + */
  50 + List<Novel> queryTotalNumber(@Param("page")Integer page,
  51 + @Param("pageSize")Integer pageSize)throws Exception;
  52 +
  53 + /**
  54 + * 获取总推荐榜数据
  55 + * @param page 页码
  56 + * @param pageSize 页数据条数
  57 + * @return novelList
  58 + * @throws Exception
  59 + * @author caoMingYang
  60 + * @since 2019/4/19 11:25
  61 + */
  62 + List<Novel> queryRecommendList(@Param("page")Integer page,
  63 + @Param("pageSize")Integer pageSize)throws Exception;
  64 +
  65 +
  66 + /**
  67 + * 最近更新
  68 + * @param page 页码
  69 + * @param pageSize 页数据条数
  70 + * @return novelList
  71 + * @throws Exception
  72 + * @author caoMingYang
  73 + * @since 2019/4/19 11:25
  74 + */
  75 + List<Novel> queryNowUpdate(@Param("page")Integer page,
  76 + @Param("pageSize")Integer pageSize)throws Exception;
  77 +
  78 +
  79 +
  80 + /**
  81 + * 最新入库
  82 + * @param page 页码
  83 + * @param pageSize 页数据条数
  84 + * @return novelList
  85 + * @throws Exception
  86 + * @author caoMingYang
  87 + * @since 2019/4/19 11:25
  88 + */
  89 + List<Novel> queryNowPutStorage(@Param("page")Integer page,
  90 + @Param("pageSize")Integer pageSize)throws Exception;
  91 +
  92 +
  93 +
  94 + /**
  95 + * 字数排行
  96 + * @param page 页码
  97 + * @param pageSize 页数据条数
  98 + * @return novelList
  99 + * @throws Exception
  100 + * @author caoMingYang
  101 + * @since 2019/4/19 11:25
  102 + */
  103 + List<Novel> queryWordsList(@Param("page")Integer page,
  104 + @Param("pageSize")Integer pageSize)throws Exception;
  105 +
  106 +
  107 +
  108 + /**
  109 + * 获取小说总条数
  110 + * @return 总条数
  111 + * @throws Exception
  112 + * @author caoMingYang
  113 + * @since 2019/4/17 0:09
  114 + */
  115 + int queryNovelCount()throws Exception;
  116 +}
  1 +package com.sinocontact.app.dao.systemSetting;
  2 +
  3 +import com.sinocontact.app.entity.NovelType;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 分类管理
  10 + * @author Cao
  11 + * @since 2019/3/16 16:57
  12 + */
  13 +@Mapper
  14 +public interface ClassifyManageMapper {
  15 +
  16 + /**
  17 + * 获取所有的小说类型
  18 + * @author Cao
  19 + * @param
  20 + * @since 2019/3/16 18:09
  21 + * @return List<NovelType>
  22 + */
  23 + List<NovelType> selectNovelTypeList();
  24 +
  25 + /**
  26 + * 获取分类的总条数
  27 + * @author Cao
  28 + * @param
  29 + * @since 2019/3/16 19:26
  30 + * @return 条数
  31 + */
  32 + Integer selectNovelTypeCount();
  33 +
  34 + /**
  35 + * 更新分类信息
  36 + * @author Cao
  37 + * @param novelType 分类信息
  38 + * @since 2019/3/16 18:27
  39 + * @return
  40 + */
  41 + Integer updateNovelType(NovelType novelType);
  42 +
  43 + /**
  44 + * 通过id删除分类信息
  45 + * @author Cao
  46 + * @param typeId 分类ID
  47 + * @since 2019/3/16 18:28
  48 + * @return
  49 + */
  50 + Integer deleteNovelTypeById(Integer typeId);
  51 +
  52 + /**
  53 + * 添加分类信息
  54 + * @author Cao
  55 + * @param typeName 分类名称
  56 + * @since 2019/3/17 14:32
  57 + * @return
  58 + */
  59 + Integer addNovelType(String typeName);
  60 +}
  1 +package com.sinocontact.app.dao.systemSetting;
  2 +
  3 +import com.sinocontact.app.entity.Comment;
  4 +import com.sinocontact.app.entity.Novel;
  5 +import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Param;
  7 +import org.omg.PortableInterceptor.INACTIVE;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 评论管理
  13 + * @author Cao
  14 + * @since 2019/3/16 16:56
  15 + */
  16 +@Mapper
  17 +public interface CommentManageMapper {
  18 +
  19 + /**
  20 + * 获取小说列表
  21 + * @param novelInfo 书名或作者
  22 + * @param novelType 分类
  23 + * @param page 页码
  24 + * @param pageSize 当前页数据条数
  25 + * @return novelList
  26 + * @author caoMingYang
  27 + * @since 2019/3/30 14:48
  28 + */
  29 + List<Novel> getNovelList(@Param("novelInfo")String novelInfo,
  30 + @Param("novelType")String novelType,
  31 + @Param("page")Integer page,
  32 + @Param("pageSize")Integer pageSize)throws Exception;
  33 +
  34 + /**
  35 + * 获取小说总条数
  36 + * @param novelInfo 书名、作者
  37 + * @param novelType 类型
  38 + * @return java.lang.Integer
  39 + * @author caoMingYang
  40 + * @since 2019/3/30 14:57
  41 + */
  42 + Integer getNovelCount(@Param("novelInfo")String novelInfo,
  43 + @Param("novelType")String novelType)throws Exception;
  44 +
  45 +
  46 + /**
  47 + * 获取小说评论列表
  48 + * @param startDate 开始时间
  49 + * @param endDate 结束时间
  50 + * @param commentInfo 评论
  51 + * @param novelId 小说id
  52 + * @param page 页码
  53 + * @param pageSize 当前页数据条数
  54 + * @return commentList
  55 + * @throws Exception
  56 + * @author caoMingYang
  57 + * @since 2019/4/5 16:09
  58 + */
  59 + List<Comment> getCommentList(@Param("startDate")String startDate,
  60 + @Param("endDate")String endDate,
  61 + @Param("commentInfo")String commentInfo,
  62 + @Param("novelId")Integer novelId,
  63 + @Param("page")Integer page,
  64 + @Param("pageSize")Integer pageSize) throws Exception;
  65 +
  66 + /**
  67 + * 获取小说评论条数
  68 + * @param startDate 开始时间
  69 + * @param endDate 结束时间
  70 + * @param commentInfo 评论
  71 + * @param novelId 小说id
  72 + * @return num
  73 + * @throws Exception
  74 + * @author caoMingYang
  75 + * @since 2019/4/5 16:10
  76 + */
  77 + Integer getCommentCount(@Param("startDate")String startDate,
  78 + @Param("endDate")String endDate,
  79 + @Param("commentInfo")String commentInfo,
  80 + @Param("novelId")Integer novelId)throws Exception;
  81 +
  82 + /**
  83 + * 和谐评论
  84 + * @param commentId 评论id
  85 + * @param novelId 小说id
  86 + * @param accordReason 和谐理由
  87 + * @return num
  88 + * @author caoMingYang
  89 + * @since 2019/4/5 18:50
  90 + */
  91 + Integer accordNovel(@Param("commentId")Integer commentId,
  92 + @Param("novelId")Integer novelId,
  93 + @Param("accordReason")String accordReason)throws Exception;
  94 +}
  1 +package com.sinocontact.app.dao.systemSetting;
  2 +
  3 +import com.sinocontact.app.entity.Novel;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.HashMap;
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 小说管理
  12 + * @author Cao
  13 + * @since 2019/3/16 12:16
  14 + */
  15 +@Mapper
  16 +public interface NovelManageMapper {
  17 +
  18 + /**
  19 + * 获取所以分类信息
  20 + * @author cao
  21 + * @since 2019/03/24 1:00
  22 + * @return 分类信息
  23 + * @throws Exception
  24 + */
  25 + List<String> getNovelType()throws Exception;
  26 +
  27 + /**
  28 + * 获取所有的小说信息
  29 + * @param novelStatus 状态
  30 + * @param novelType 类型
  31 + * @param novelInfo 作者或书名
  32 + * @param page 当前页
  33 + * @param pageSize 每页数据条数
  34 + * @return 小说集合
  35 + * @throws Exception
  36 + * @author caoMingYang
  37 + * @since 2019/3/26 22:42
  38 + */
  39 + List<Novel> getNovelList(@Param("novelStatus")Integer novelStatus,
  40 + @Param("novelType")String novelType,
  41 + @Param("novelInfo")String novelInfo,
  42 + @Param("page")Integer page,
  43 + @Param("pageSize")Integer pageSize)throws Exception;
  44 +
  45 +
  46 + /**
  47 + * 获取小说总条数
  48 + * @author caoMingYang
  49 + * @since 2019/3/26 23:02
  50 + */
  51 + Integer getNovelCount(@Param("novelStatus")Integer novelStatus,
  52 + @Param("novelType")String novelType,
  53 + @Param("novelInfo")String novelInfo)throws Exception;
  54 +
  55 + /**
  56 + * 批量和谐小说
  57 + * @param reason 和谐理由
  58 + * @param idList 小说id数组
  59 + * @return 受影响行数
  60 + * @author caoMingYang
  61 + * @since 2019/3/30 9:52
  62 + */
  63 + Integer updateNovelNoPass(@Param("idList")List idList,@Param("reason")String reason)throws Exception;
  64 +
  65 +
  66 + /**
  67 + * 批量上架小说
  68 + * @param reason 上架理由
  69 + * @param idList 小说id数组
  70 + * @return 受影响行数
  71 + * @author caoMingYang
  72 + * @since 2019/3/30 9:52
  73 + */
  74 + Integer updateNovelPass(@Param("idList")List idList,@Param("reason")String reason)throws Exception;
  75 +}
  1 +package com.sinocontact.app.dao.systemSetting;
  2 +
  3 +import com.sinocontact.app.entity.CheckUser;
  4 +import com.sinocontact.app.entity.User;
  5 +import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 用户管理
  12 + * @author Cao
  13 + * @Date 2019/3/10 18:37
  14 + */
  15 +@Mapper
  16 +public interface UserManageMapper {
  17 +
  18 + //获取所有的用户信息
  19 + List<User> getUserList(@Param("startDate")String startDate,
  20 + @Param("endDate")String endDate,
  21 + @Param("userInfo")String userInfo,
  22 + @Param("role")Integer role,
  23 + @Param("page")Integer page,
  24 + @Param("pageSize")Integer pageSize) throws Exception;
  25 +
  26 + //获取所有用户总条数
  27 + Integer getUserCount(@Param("startDate")String startDate,
  28 + @Param("endDate")String endDate,
  29 + @Param("userInfo")String userInfo,
  30 + @Param("role")Integer role) throws Exception;
  31 +
  32 + //获取所有用户
  33 + Integer getUserNum()throws Exception;
  34 +
  35 + //获取近一个月登录的用户数量
  36 + Integer getUserLoginNum(@Param("startDate")String startDate,
  37 + @Param("endDate")String endDate) throws Exception;
  38 +
  39 + //获取所有用户审核信息
  40 + List<CheckUser> getCheckUserList(@Param("checkStatus")Integer checkStatus,
  41 + @Param("page")Integer page,
  42 + @Param("pageSize")Integer pageSize) throws Exception;
  43 +
  44 + //获取所有用户审核信息总条数
  45 + Integer getCheckUserCount(@Param("checkStatus")Integer checkStatus)throws Exception;
  46 +
  47 + //审核通过
  48 + Integer checkUserPass(@Param("list")List<Integer> idList)throws Exception;
  49 +
  50 + //更新用户权限
  51 + Integer updateUserRole(@Param("list")List<Integer> idList) throws Exception;
  52 +
  53 + //审核不通过
  54 + Integer checkUserNoPass(@Param("list")List<Integer> idList) throws Exception;
  55 +
  56 +}
  1 +package com.sinocontact.app.dao.user;
  2 +
  3 +import com.sinocontact.app.entity.Novel;
  4 +import com.sinocontact.app.entity.User;
  5 +import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Param;
  7 +import org.omg.PortableInterceptor.INACTIVE;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 用户登录
  13 + * @author todd
  14 + * @since 2019/1/21
  15 + */
  16 +@Mapper
  17 +public interface UserMapper {
  18 +
  19 + //通过用户名查询用户信息
  20 + User checkUser(String username)throws Exception;
  21 +
  22 +
  23 + //通过手机号查询用户信息
  24 + User getUserByPhone(String phone)throws Exception;
  25 +
  26 + //更新用户登录时间
  27 + Integer updateLoginTime(Integer userId) throws Exception;
  28 +
  29 + /**
  30 + * 保存用户注册信息
  31 + * @param username 用户名
  32 + * @param password 密码
  33 + * @param nickname 昵称
  34 + * @param phone 手机号
  35 + * @throws Exception
  36 + * @author caoMingYang
  37 + * @since 2019/5/2 11:05
  38 + */
  39 + Integer saveUser(@Param("username")String username,
  40 + @Param("password")String password,
  41 + @Param("nickname")String nickname,
  42 + @Param("phone")String phone) throws Exception;
  43 +
  44 + /**
  45 + * 校验此手机号是否注册
  46 + * @param phone 手机号
  47 + * @throws Exception
  48 + * @author caoMingYang
  49 + * @since 2019/5/4 10:20
  50 + */
  51 + Integer checkPhone(@Param("phone")String phone) throws Exception;
  52 +
  53 + /**
  54 + * 更新用户密码
  55 + * @param phone 手机号
  56 + * @param password 密码
  57 + * @throws Exception
  58 + * @author caoMingYang
  59 + * @since 2019/5/4 19:15
  60 + */
  61 + Integer updatePassword(@Param("phone")String phone,
  62 + @Param("password")String password) throws Exception;
  63 +
  64 + //热门小说
  65 + List<Novel> queryHotNovel()throws Exception;
  66 +
  67 + //总推荐榜
  68 + List<Novel> queryRecommendList()throws Exception;
  69 +
  70 + //总字数榜
  71 + List<Novel> queryWordsList()throws Exception;
  72 +
  73 + //最新入库
  74 + List<Novel> queryNowUpdate()throws Exception;
  75 +}
  1 +package com.sinocontact.app.entity;
  2 +
  3 +/**
  4 + * 作者和小说关联
  5 + * @author Cao
  6 + * @since 2019/3/16 16:34
  7 + */
  8 +public class AuthorNovel {
  9 +
  10 + /**
  11 + * ID
  12 + */
  13 + private Integer id;
  14 +
  15 + /**
  16 + * 用户ID
  17 + */
  18 + private Integer userId;
  19 +
  20 + /**
  21 + * 小说ID
  22 + */
  23 + private Integer novelId;
  24 +
  25 + /**
  26 + * 状态 0:有效;-1:无效
  27 + */
  28 + private Integer status;
  29 +
  30 + /**
  31 + * 创建时间
  32 + */
  33 + private String createTime;
  34 +
  35 + /**
  36 + * 更新时间
  37 + */
  38 + private String updateTime;
  39 +
  40 + @Override
  41 + public String toString() {
  42 + return "BookCaseInfo{" +
  43 + "id=" + id +
  44 + ", userId=" + userId +
  45 + ", novelId=" + novelId +
  46 + ", status=" + status +
  47 + ", createTime='" + createTime + '\'' +
  48 + ", updateTime='" + updateTime + '\'' +
  49 + '}';
  50 + }
  51 +
  52 + public Integer getId() {
  53 + return id;
  54 + }
  55 +
  56 + public void setId(Integer id) {
  57 + this.id = id;
  58 + }
  59 +
  60 + public Integer getUserId() {
  61 + return userId;
  62 + }
  63 +
  64 + public void setUserId(Integer userId) {
  65 + this.userId = userId;
  66 + }
  67 +
  68 + public Integer getNovelId() {
  69 + return novelId;
  70 + }
  71 +
  72 + public void setNovelId(Integer novelId) {
  73 + this.novelId = novelId;
  74 + }
  75 +
  76 + public Integer getStatus() {
  77 + return status;
  78 + }
  79 +
  80 + public void setStatus(Integer status) {
  81 + this.status = status;
  82 + }
  83 +
  84 + public String getCreateTime() {
  85 + return createTime;
  86 + }
  87 +
  88 + public void setCreateTime(String createTime) {
  89 + this.createTime = createTime;
  90 + }
  91 +
  92 + public String getUpdateTime() {
  93 + return updateTime;
  94 + }
  95 +
  96 + public void setUpdateTime(String updateTime) {
  97 + this.updateTime = updateTime;
  98 + }
  99 +}
  1 +package com.sinocontact.app.entity;
  2 +
  3 +/**
  4 + * 书架
  5 + * @author Cao
  6 + * @since 2019/3/16 16:34
  7 + */
  8 +public class BookCaseInfo {
  9 +
  10 + /**
  11 + * ID
  12 + */
  13 + private Integer id;
  14 +
  15 + /**
  16 + * 用户ID
  17 + */
  18 + private Integer userId;
  19 +
  20 + /**
  21 + * 小说ID
  22 + */
  23 + private Integer novelId;
  24 +
  25 + /**
  26 + * 小说名称
  27 + */
  28 + private String novelName;
  29 +
  30 + /**
  31 + * 章节id
  32 + */
  33 + private Integer chapterId;
  34 +
  35 + /**
  36 + * 章节名称
  37 + */
  38 + private String chapterName;
  39 +
  40 + /**
  41 + * 最新章节
  42 + */
  43 + private String lastChapter;
  44 +
  45 + /**
  46 + * 状态 0:有效;-1:无效
  47 + */
  48 + private Integer status;
  49 +
  50 + /**
  51 + * 创建时间
  52 + */
  53 + private String createTime;
  54 +
  55 + /**
  56 + * 更新时间
  57 + */
  58 + private String updateTime;
  59 +
  60 + @Override
  61 + public String toString() {
  62 + return "BookCaseInfo{" +
  63 + "id=" + id +
  64 + ", userId=" + userId +
  65 + ", novelId=" + novelId +
  66 + ", novelName='" + novelName + '\'' +
  67 + ", chapterId=" + chapterId +
  68 + ", chapterName='" + chapterName + '\'' +
  69 + ", status=" + status +
  70 + ", createTime='" + createTime + '\'' +
  71 + ", updateTime='" + updateTime + '\'' +
  72 + '}';
  73 + }
  74 +
  75 + public String getLastChapter() {
  76 + return lastChapter;
  77 + }
  78 +
  79 + public void setLastChapter(String lastChapter) {
  80 + this.lastChapter = lastChapter;
  81 + }
  82 +
  83 + public String getNovelName() {
  84 + return novelName;
  85 + }
  86 +
  87 + public void setNovelName(String novelName) {
  88 + this.novelName = novelName;
  89 + }
  90 +
  91 + public Integer getChapterId() {
  92 + return chapterId;
  93 + }
  94 +
  95 + public void setChapterId(Integer chapterId) {
  96 + this.chapterId = chapterId;
  97 + }
  98 +
  99 + public String getChapterName() {
  100 + return chapterName;
  101 + }
  102 +
  103 + public void setChapterName(String chapterName) {
  104 + this.chapterName = chapterName;
  105 + }
  106 +
  107 + public Integer getId() {
  108 + return id;
  109 + }
  110 +
  111 + public void setId(Integer id) {
  112 + this.id = id;
  113 + }
  114 +
  115 + public Integer getUserId() {
  116 + return userId;
  117 + }
  118 +
  119 + public void setUserId(Integer userId) {
  120 + this.userId = userId;
  121 + }
  122 +
  123 + public Integer getNovelId() {
  124 + return novelId;
  125 + }
  126 +
  127 + public void setNovelId(Integer novelId) {
  128 + this.novelId = novelId;
  129 + }
  130 +
  131 + public Integer getStatus() {
  132 + return status;
  133 + }
  134 +
  135 + public void setStatus(Integer status) {
  136 + this.status = status;
  137 + }
  138 +
  139 + public String getCreateTime() {
  140 + return createTime;
  141 + }
  142 +
  143 + public void setCreateTime(String createTime) {
  144 + this.createTime = createTime;
  145 + }
  146 +
  147 + public String getUpdateTime() {
  148 + return updateTime;
  149 + }
  150 +
  151 + public void setUpdateTime(String updateTime) {
  152 + this.updateTime = updateTime;
  153 + }
  154 +}
  1 +package com.sinocontact.app.entity;
  2 +
  3 +/**
  4 + * 小说章节
  5 + * @author Cao
  6 + * @since 2019/3/16 15:33
  7 + */
  8 +public class Chapter {
  9 +
  10 + /**
  11 + * 章节ID
  12 + */
  13 + private Integer chapterId;
  14 +
  15 + /**
  16 + * 小说ID
  17 + */
  18 + private Integer novelId;
  19 +
  20 + /**
  21 + * 章节名称
  22 + */
  23 + private String chapterName;
  24 +
  25 + /**
  26 + * 章节内容
  27 + */
  28 + private String chapterContent;
  29 +
  30 + /**
  31 + * 创建时间
  32 + */
  33 + private String createTime;
  34 +
  35 + /**
  36 + * 更新时间
  37 + */
  38 + private String updateTime;
  39 +
  40 + private Integer status;
  41 +
  42 + @Override
  43 + public String toString() {
  44 + return "Chapter{" +
  45 + "chapterId=" + chapterId +
  46 + ", novelId=" + novelId +
  47 + ", chapterName='" + chapterName + '\'' +
  48 + ", chapterContent='" + chapterContent + '\'' +
  49 + ", createTime='" + createTime + '\'' +
  50 + ", updateTime='" + updateTime + '\'' +
  51 + '}';
  52 + }
  53 +
  54 + public Integer getStatus() {
  55 + return status;
  56 + }
  57 +
  58 + public void setStatus(Integer status) {
  59 + this.status = status;
  60 + }
  61 +
  62 + public Integer getChapterId() {
  63 + return chapterId;
  64 + }
  65 +
  66 + public void setChapterId(Integer chapterId) {
  67 + this.chapterId = chapterId;
  68 + }
  69 +
  70 + public Integer getNovelId() {
  71 + return novelId;
  72 + }
  73 +
  74 + public void setNovelId(Integer novelId) {
  75 + this.novelId = novelId;
  76 + }
  77 +
  78 + public String getChapterName() {
  79 + return chapterName;
  80 + }
  81 +
  82 + public void setChapterName(String chapterName) {
  83 + this.chapterName = chapterName;
  84 + }
  85 +
  86 + public String getChapterContent() {
  87 + return chapterContent;
  88 + }
  89 +
  90 + public void setChapterContent(String chapterContent) {
  91 + this.chapterContent = chapterContent;
  92 + }
  93 +
  94 + public String getCreateTime() {
  95 + return createTime;
  96 + }
  97 +
  98 + public void setCreateTime(String createTime) {
  99 + this.createTime = createTime;
  100 + }
  101 +
  102 + public String getUpdateTime() {
  103 + return updateTime;
  104 + }
  105 +
  106 + public void setUpdateTime(String updateTime) {
  107 + this.updateTime = updateTime;
  108 + }
  109 +}