├── .classpath
├── .idea
├── .gitignore
├── compiler.xml
├── encodings.xml
├── jarRepositories.xml
├── libraries
│ ├── Maven__ch_qos_logback_logback_classic_1_2_3.xml
│ ├── Maven__ch_qos_logback_logback_core_1_2_3.xml
│ ├── Maven__com_alibaba_druid_1_1_18.xml
│ ├── Maven__com_alibaba_druid_spring_boot_starter_1_1_18.xml
│ ├── Maven__com_alibaba_fastjson_1_2_3.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_11_3.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_11_3.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_11_3.xml
│ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_11_3.xml
│ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_11_3.xml
│ ├── Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_11_3.xml
│ ├── Maven__com_google_code_findbugs_jsr305_3_0_2.xml
│ ├── Maven__com_google_errorprone_error_prone_annotations_2_3_4.xml
│ ├── Maven__com_google_guava_failureaccess_1_0_1.xml
│ ├── Maven__com_google_guava_guava_28_2_jre.xml
│ ├── Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml
│ ├── Maven__com_google_j2objc_j2objc_annotations_1_3.xml
│ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml
│ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml
│ ├── Maven__com_zaxxer_HikariCP_3_4_5.xml
│ ├── Maven__commons_codec_commons_codec_1_15.xml
│ ├── Maven__commons_collections_commons_collections_3_2_2.xml
│ ├── Maven__commons_io_commons_io_2_7.xml
│ ├── Maven__jakarta_activation_jakarta_activation_api_1_2_2.xml
│ ├── Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml
│ ├── Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_3.xml
│ ├── Maven__mysql_mysql_connector_java_8_0_22.xml
│ ├── Maven__net_bytebuddy_byte_buddy_1_10_18.xml
│ ├── Maven__net_bytebuddy_byte_buddy_agent_1_10_18.xml
│ ├── Maven__net_minidev_accessors_smart_1_2.xml
│ ├── Maven__net_minidev_json_smart_2_3.xml
│ ├── Maven__org_apache_commons_commons_lang3_3_11.xml
│ ├── Maven__org_apache_commons_commons_pool2_2_9_0.xml
│ ├── Maven__org_apache_httpcomponents_httpclient_4_5_13.xml
│ ├── Maven__org_apache_httpcomponents_httpcore_4_4_13.xml
│ ├── Maven__org_apache_logging_log4j_log4j_api_2_13_3.xml
│ ├── Maven__org_apache_logging_log4j_log4j_to_slf4j_2_13_3.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_39.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_39.xml
│ ├── Maven__org_apiguardian_apiguardian_api_1_1_0.xml
│ ├── Maven__org_aspectj_aspectjweaver_1_9_6.xml
│ ├── Maven__org_assertj_assertj_core_3_18_1.xml
│ ├── Maven__org_checkerframework_checker_qual_2_10_0.xml
│ ├── Maven__org_glassfish_jakarta_el_3_0_3.xml
│ ├── Maven__org_hamcrest_hamcrest_2_2.xml
│ ├── Maven__org_jsoup_jsoup_1_10_3.xml
│ ├── Maven__org_junit_jupiter_junit_jupiter_5_7_0.xml
│ ├── Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml
│ ├── Maven__org_junit_jupiter_junit_jupiter_engine_5_7_0.xml
│ ├── Maven__org_junit_jupiter_junit_jupiter_params_5_7_0.xml
│ ├── Maven__org_junit_platform_junit_platform_commons_1_7_0.xml
│ ├── Maven__org_junit_platform_junit_platform_engine_1_7_0.xml
│ ├── Maven__org_mockito_mockito_core_3_6_0.xml
│ ├── Maven__org_mockito_mockito_junit_jupiter_3_6_0.xml
│ ├── Maven__org_mybatis_mybatis_3_5_5.xml
│ ├── Maven__org_mybatis_mybatis_spring_2_0_5.xml
│ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_1_3.xml
│ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_1_3.xml
│ ├── Maven__org_objenesis_objenesis_3_1.xml
│ ├── Maven__org_opentest4j_opentest4j_1_2_0.xml
│ ├── Maven__org_ow2_asm_asm_5_0_4.xml
│ ├── Maven__org_projectlombok_lombok_1_18_16.xml
│ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml
│ ├── Maven__org_slf4j_jul_to_slf4j_1_7_30.xml
│ ├── Maven__org_slf4j_slf4j_api_1_7_30.xml
│ ├── Maven__org_springframework_boot_spring_boot_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_aop_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_jdbc_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_json_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_logging_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_test_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_web_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_test_2_4_0.xml
│ ├── Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_4_0.xml
│ ├── Maven__org_springframework_spring_aop_5_3_1.xml
│ ├── Maven__org_springframework_spring_beans_5_3_1.xml
│ ├── Maven__org_springframework_spring_context_5_3_1.xml
│ ├── Maven__org_springframework_spring_core_5_3_1.xml
│ ├── Maven__org_springframework_spring_expression_5_3_1.xml
│ ├── Maven__org_springframework_spring_jcl_5_3_1.xml
│ ├── Maven__org_springframework_spring_jdbc_5_3_1.xml
│ ├── Maven__org_springframework_spring_test_5_3_1.xml
│ ├── Maven__org_springframework_spring_tx_5_3_1.xml
│ ├── Maven__org_springframework_spring_web_5_3_1.xml
│ ├── Maven__org_springframework_spring_webmvc_5_3_1.xml
│ ├── Maven__org_xmlunit_xmlunit_core_2_7_0.xml
│ ├── Maven__org_yaml_snakeyaml_1_27.xml
│ ├── Maven__redis_clients_jedis_3_3_0.xml
│ ├── Maven__us_codecraft_webmagic_core_0_7_4.xml
│ ├── Maven__us_codecraft_webmagic_extension_0_7_4.xml
│ └── Maven__us_codecraft_xsoup_0_3_1.xml
├── misc.xml
└── modules.xml
├── .project
├── .settings
├── org.eclipse.core.resources.prefs
├── org.eclipse.jdt.core.prefs
├── org.eclipse.m2e.core.prefs
└── org.eclipse.wst.common.project.facet.core.xml
├── README.md
├── image
├── 1.png
├── 2.png
├── 3.png
├── 4.png
├── 5.png
└── 6.png
├── pom.xml
├── read-cloud.iml
└── src
├── main
├── java
│ └── zl
│ │ └── readCloud
│ │ ├── Application.java
│ │ ├── ReadCloudApplication.java
│ │ ├── aop
│ │ └── HttpAspect.java
│ │ ├── config
│ │ ├── AsyncConfig.java
│ │ ├── CorsConfiguration.java
│ │ ├── MyWebAppConfigurer.java
│ │ └── UpdateBookConfig.java
│ │ ├── controller
│ │ ├── after
│ │ │ ├── AfAdminController.java
│ │ │ ├── AfBannerController.java
│ │ │ ├── AfBookController.java
│ │ │ ├── AfChapterController.java
│ │ │ ├── AfTypeController.java
│ │ │ ├── AfUserController.java
│ │ │ └── dto
│ │ │ │ ├── BannerDTO.java
│ │ │ │ └── BookChapterDTO.java
│ │ ├── common
│ │ │ └── commonController.java
│ │ └── front
│ │ │ ├── FrController.java
│ │ │ └── FrLoginController.java
│ │ ├── dao
│ │ ├── AdminDao.java
│ │ ├── BannerDao.java
│ │ ├── BookDao.java
│ │ ├── BookShelfDao.java
│ │ ├── ChapterDao.java
│ │ ├── TypeDao.java
│ │ └── UserDao.java
│ │ ├── pojo
│ │ ├── AdminPO.java
│ │ ├── BannerPO.java
│ │ ├── BookPO.java
│ │ ├── BookShelfPO.java
│ │ ├── ChapterPO.java
│ │ ├── TypePO.java
│ │ └── UserPO.java
│ │ ├── service
│ │ ├── after
│ │ │ ├── AfAdminService.java
│ │ │ ├── AfBannerService.java
│ │ │ ├── AfBookService.java
│ │ │ ├── AfChapterService.java
│ │ │ ├── AfTypeService.java
│ │ │ ├── AfUserService.java
│ │ │ └── Impl
│ │ │ │ ├── AfAdminServiceImpl.java
│ │ │ │ ├── AfBannerServiceImpl.java
│ │ │ │ ├── AfBookServiceImpl.java
│ │ │ │ ├── AfChapterServiceImpl.java
│ │ │ │ ├── AfTypeServiceImpl.java
│ │ │ │ └── AfUserServiceImpl.java
│ │ ├── crawler
│ │ │ ├── Impl
│ │ │ │ └── UpdateBookImpl.java
│ │ │ └── UpdateBook.java
│ │ └── front
│ │ │ ├── FrDetailsService.java
│ │ │ ├── FrIndexService.java
│ │ │ ├── FrLoginService.java
│ │ │ ├── FrReadingService.java
│ │ │ └── Impl
│ │ │ ├── FrDetailsServiceImpl.java
│ │ │ ├── FrIndexServiceImpl.java
│ │ │ ├── FrLoginServiceImpl.java
│ │ │ └── FrReadingServiceImpl.java
│ │ ├── task
│ │ └── UpdateBookTask.java
│ │ └── utils
│ │ ├── DateUtils.java
│ │ ├── IpUtil.java
│ │ ├── JsoupUtil.java
│ │ ├── Result.java
│ │ └── ToolsUtils.java
└── resources
│ └── application.yml
└── test
└── java
└── zl
└── readCloud
└── ReadCloudApplicationTests.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_alibaba_druid_1_1_18.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_alibaba_druid_spring_boot_starter_1_1_18.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_alibaba_fastjson_1_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_11_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_11_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_11_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_11_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_11_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_11_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_3_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_guava_guava_28_2_jre.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_zaxxer_HikariCP_3_4_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_codec_commons_codec_1_15.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_io_commons_io_2_7.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__jakarta_activation_jakarta_activation_api_1_2_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_22.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_10_18.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_10_18.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_minidev_json_smart_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_commons_commons_pool2_2_9_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_13.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_13.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_13_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_13_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_39.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_39.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_assertj_assertj_core_3_18_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_checkerframework_checker_qual_2_10_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_glassfish_jakarta_el_3_0_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hamcrest_hamcrest_2_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_jsoup_jsoup_1_10_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_7_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_7_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_7_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_7_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_7_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_7_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mockito_mockito_core_3_6_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mockito_mockito_junit_jupiter_3_6_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_mybatis_3_5_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_mybatis_spring_2_0_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_objenesis_objenesis_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_projectlombok_lombok_1_18_16.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_30.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_30.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_aop_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_beans_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_context_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_core_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_expression_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_jcl_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_jdbc_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_test_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_tx_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_web_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_webmvc_5_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_7_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_yaml_snakeyaml_1_27.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__redis_clients_jedis_3_3_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__us_codecraft_webmagic_core_0_7_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__us_codecraft_webmagic_extension_0_7_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__us_codecraft_xsoup_0_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | read-cloud
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.common.project.facet.core.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 | org.springframework.ide.eclipse.core.springbuilder
25 |
26 |
27 |
28 |
29 | org.springframework.ide.eclipse.boot.validation.springbootbuilder
30 |
31 |
32 |
33 |
34 |
35 | org.springframework.ide.eclipse.core.springnature
36 | org.eclipse.jdt.core.javanature
37 | org.eclipse.m2e.core.maven2Nature
38 | org.eclipse.wst.common.project.facet.core.nature
39 |
40 |
41 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding//src/main/resources=UTF-8
4 | encoding//src/test/java=UTF-8
5 | encoding/=UTF-8
6 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=10
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13 | org.eclipse.jdt.core.compiler.release=disabled
14 | org.eclipse.jdt.core.compiler.source=10
15 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 基于Springboot的在线电子书小说阅读系统
2 | =
3 | ### 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/))
4 | ### 作者微信:19941326836 QQ:952045282
5 | ### 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习
6 | ### 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务
7 | ### 所有选题地址https://github.com/nature924/allProject
8 |
9 | 一、项目介绍
10 | ---
11 | 基于Spring Boot框架实现的在线电子书小说阅读系统,系统包含三种角色:管理员、用户,顾问主要功能如下。
12 | ### 【用户功能】
13 | 1. 首页:查看系统主要信息和最新动态。
14 | 2. 公告:浏览系统发布的公告信息。
15 | 3. 顾问:浏览可提供咨询服务的顾问列表。
16 | 4. 健康知识:获取系统提供的健康知识信息。
17 | 5. 个人中心:管理个人信息。
18 |
19 | ### 【管理员功能】
20 | 1. 系统首页:查看系统整体情况和关键信息。
21 | 2. 个人中心:管理管理员的个人信息。
22 | 3. 管理员管理:维护系统管理员的账户信息。
23 | 4. 基础数据管理:管理系统的基础数据。
24 | 5. 公告管理:发布、编辑和管理系统的公告信息。
25 | 6. 顾问管理:管理可提供咨询服务的顾问信息。
26 | 7. 用户咨询管理:查看和管理用户的咨询信息。
27 | 8. 顾问预约管理:处理用户对顾问的预约请求。
28 | 9. 健康知识管理:发布、编辑和管理健康知识信息。
29 | 10. 用户管理:维护系统用户的账户信息。
30 | 11. 轮播图信息:管理系统首页轮播图的展示内容。
31 |
32 |
33 |
34 |
35 |
36 | 二、项目技术
37 | ---
38 | - 编程语言:Java
39 | - 数据库:MySQL
40 | - 项目管理工具:Maven
41 | - 前端技术:VUE、HTML、Jquery、Bootstrap
42 | - 后端技术:Spring、SpringMVC、MyBatis
43 |
44 | 三、运行环境
45 | ---
46 | - 操作系统:Windows、macOS都可以
47 | - JDK版本:JDK1.8以上都可以
48 | - 开发工具:IDEA、Ecplise、Myecplise都可以
49 | - 数据库: MySQL5.7以上都可以
50 | - Tomcat:任意版本都可以
51 | - Maven:任意版本都可以
52 |
53 | 四、运行截图
54 | ---
55 |
56 |
57 | ### 程序截图:
58 | 
59 | 
60 | 
61 | 
62 | 
63 | 
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/image/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No237Online-e-book-novel-reading-system/01f4c37f87f6704cb6d64088a6f8e0adb09b81df/image/1.png
--------------------------------------------------------------------------------
/image/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No237Online-e-book-novel-reading-system/01f4c37f87f6704cb6d64088a6f8e0adb09b81df/image/2.png
--------------------------------------------------------------------------------
/image/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No237Online-e-book-novel-reading-system/01f4c37f87f6704cb6d64088a6f8e0adb09b81df/image/3.png
--------------------------------------------------------------------------------
/image/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No237Online-e-book-novel-reading-system/01f4c37f87f6704cb6d64088a6f8e0adb09b81df/image/4.png
--------------------------------------------------------------------------------
/image/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No237Online-e-book-novel-reading-system/01f4c37f87f6704cb6d64088a6f8e0adb09b81df/image/5.png
--------------------------------------------------------------------------------
/image/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nature924/No237Online-e-book-novel-reading-system/01f4c37f87f6704cb6d64088a6f8e0adb09b81df/image/6.png
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.4.0
9 |
10 |
11 | zl.read
12 | read-cloud
13 | 0.0.3-SNAPSHOT
14 | read-cloud
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-starter-web
27 |
28 |
29 |
30 | org.projectlombok
31 | lombok
32 | true
33 |
34 |
35 |
36 | mysql
37 | mysql-connector-java
38 | runtime
39 |
40 |
41 |
42 | com.alibaba
43 | fastjson
44 | 1.2.3
45 |
46 |
47 |
48 | org.mybatis.spring.boot
49 | mybatis-spring-boot-starter
50 | 2.1.3
51 |
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-starter-aop
56 |
57 |
58 |
59 | com.alibaba
60 | druid-spring-boot-starter
61 | 1.1.18
62 |
63 |
64 |
65 |
66 | us.codecraft
67 | webmagic-core
68 | 0.7.4
69 |
70 |
71 | slf4j-log4j12
72 | org.slf4j
73 |
74 |
75 |
76 |
77 |
78 | us.codecraft
79 | webmagic-extension
80 | 0.7.4
81 |
82 |
83 |
84 | com.google.guava
85 | guava
86 | 28.2-jre
87 |
88 |
89 |
90 | org.springframework.boot
91 | spring-boot-starter-test
92 | test
93 |
94 |
95 |
96 |
97 |
98 |
99 | org.springframework.boot
100 | spring-boot-maven-plugin
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/Application.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud;
2 |
3 | import zl.readCloud.task.UpdateBookTask;
4 |
5 | import java.util.concurrent.Executors;
6 | import java.util.concurrent.ScheduledExecutorService;
7 | import java.util.concurrent.TimeUnit;
8 |
9 | /**
10 | * @author ZhangLei
11 | * @Description:
12 | */
13 | public class Application {
14 |
15 | public Application() {
16 |
17 | ScheduledExecutorService service = Executors.newScheduledThreadPool(20);
18 |
19 | service.scheduleAtFixedRate(new UpdateBookTask(), 0, 3, TimeUnit.SECONDS);
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/ReadCloudApplication.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud;
2 |
3 |
4 | import org.mybatis.spring.annotation.MapperScan;
5 | import org.springframework.boot.SpringApplication;
6 | import org.springframework.boot.autoconfigure.SpringBootApplication;
7 | import org.springframework.scheduling.annotation.EnableScheduling;
8 |
9 |
10 | @MapperScan("zl.readCloud.dao")
11 | @SpringBootApplication
12 | @EnableScheduling
13 | public class ReadCloudApplication {
14 |
15 | private static Application mApplication;
16 |
17 | public static void main(String[] args) {
18 | // mApplication = new Application();
19 | SpringApplication.run(ReadCloudApplication.class, args);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/aop/HttpAspect.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.aop;
2 |
3 |
4 |
5 | import org.aspectj.lang.JoinPoint;
6 | import org.aspectj.lang.annotation.*;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.stereotype.Component;
10 | import org.springframework.web.context.request.RequestContextHolder;
11 | import org.springframework.web.context.request.ServletRequestAttributes;
12 | //import zl.readCloud.utils.IpUtil;
13 |
14 | import javax.servlet.http.HttpServletRequest;
15 |
16 | /**
17 | * 通过aop拦截请求 记录运行信息
18 | *
19 | */
20 | @Aspect
21 | @Component
22 | public class HttpAspect {
23 |
24 | private static long startTime;
25 | private static long endTime;
26 |
27 | private static final Logger log = LoggerFactory.getLogger(zl.readCloud.aop.HttpAspect.class);
28 |
29 | /**
30 | * 切点表达式
31 | */
32 | @Pointcut("execution(public * zl.readCloud.controller..*.*(..))")
33 |
34 | /**
35 | * 切点签名
36 | */
37 | public void print() {
38 |
39 | }
40 |
41 | /**
42 | * @Before注解表示在具体的方法之前执行
43 | * @param joinPoint
44 | */
45 | @Before("print()")
46 | public void before(JoinPoint joinPoint) {
47 | startTime = System.currentTimeMillis();
48 | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
49 | HttpServletRequest request = requestAttributes.getRequest();
50 | String requestURI = request.getRequestURI();
51 | String remoteAddr = "127.0.0.1";
52 | String requestMethod = request.getMethod();
53 | String declaringTypeNamepeName = joinPoint.getSignature().getDeclaringTypeName();
54 | String methodName = joinPoint.getSignature().getName();
55 | Object[] args = joinPoint.getArgs();
56 | log.info("请求url:=" + requestURI + ",客户端ip:=" + remoteAddr + ",请求方式:=" + requestMethod + ",请求的类名:=" + declaringTypeNamepeName + ",方法名:=" + methodName);
57 | }
58 |
59 |
60 | /**
61 | * @After注解表示在方法执行之后执行
62 | */
63 | @After("print()")
64 | public void after() {
65 | endTime = System.currentTimeMillis() - startTime;
66 | }
67 |
68 |
69 | /**
70 | * @AfterReturning注解用于获取方法的返回值
71 | * @param object
72 | */
73 | @AfterReturning(pointcut = "print()", returning = "object")
74 | public void getAfterReturn(Object object) {
75 | log.info("本次接口耗时={}ms", endTime);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/config/AsyncConfig.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.config;
2 |
3 | import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
4 | import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
5 | import org.springframework.context.annotation.ComponentScan;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.scheduling.annotation.AsyncConfigurer;
8 | import org.springframework.scheduling.annotation.EnableAsync;
9 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
10 |
11 | import java.util.concurrent.Executor;
12 | import java.util.concurrent.ThreadPoolExecutor;
13 |
14 | /**
15 | * @author coffee
16 | * @Description: 配置类实现AsyncConfigurer接口,并重写getAsyncExecutor方法,并返回一个ThreadPoolTaskExecutor,
17 | * 这样我们就获得一个基于线程池TaskExecutor
18 | *
19 | */
20 | @Configuration
21 | @ComponentScan("zl.readCloud.service") //必须加此注解扫描包
22 | @EnableAsync( proxyTargetClass = true)//利用@EnableAsync注解开启异步任务支持
23 | public class AsyncConfig implements AsyncConfigurer {
24 |
25 | @Override
26 | public Executor getAsyncExecutor() {
27 | ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
28 | //设置核心线程数
29 | taskExecutor.setCorePoolSize(3);
30 | //设置最大线程数
31 | taskExecutor.setMaxPoolSize(10);
32 | //线程池所使用的缓冲队列容量
33 | taskExecutor.setQueueCapacity(20);
34 | //等待任务在关机时完成--表明等待所有线程执行完
35 | taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
36 | // 等待时间 (默认为0,此时立即停止),并没等待xx秒后强制停止
37 | taskExecutor.setAwaitTerminationSeconds(5);
38 | // 线程名称前缀
39 | taskExecutor.setThreadNamePrefix("my-Executor-");
40 | // 拒绝策略 由调用线程处理该任务
41 | taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
42 | // 初始化线程
43 | taskExecutor.initialize();
44 | return taskExecutor;
45 | }
46 |
47 | @Override
48 | public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
49 | return new SimpleAsyncUncaughtExceptionHandler();
50 | }
51 | }
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/config/CorsConfiguration.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.config;
2 |
3 | import org.springframework.context.annotation.Configuration;
4 | import org.springframework.web.servlet.config.annotation.CorsRegistry;
5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
6 |
7 | /**
8 | * 允许跨域
9 | */
10 | @Configuration
11 | public class CorsConfiguration implements WebMvcConfigurer {
12 | @Override
13 | public void addCorsMappings(CorsRegistry corsRegistry) {
14 | // 允许跨域访问资源定义: / 所有资源
15 | corsRegistry.addMapping("/**")
16 | //只允许本地的8001端口访.allowedOrigins("http://localhost:8001", "http://127.0.0.1:8001")
17 | // spring5.3.1的CorsFilter类针对CorsConfiguration新增了校验
18 | .allowedOriginPatterns("*")
19 | // .allowedOrigins("*") 不用这个了
20 | // 允许发送Cookie
21 | .allowCredentials(true)
22 | // 允许所有方法
23 | .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD");
24 | }
25 | }
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/config/MyWebAppConfigurer.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.config;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.springframework.beans.factory.annotation.Value;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
8 |
9 | /**
10 | * @Author:ZhangLei
11 | */
12 | @Slf4j
13 | @Configuration
14 | public class MyWebAppConfigurer implements WebMvcConfigurer {
15 |
16 | @Value("${winResource.imgPath}")
17 | private String windowsFilepath;
18 |
19 |
20 | @Override
21 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
22 | String windowsFilepathPre = System.getProperty("user.dir").replace('\\', '/');
23 | log.info("路径为: "+ windowsFilepathPre + windowsFilepath);
24 | // 映射资源路径
25 | registry.addResourceHandler("/**")
26 | // 将资源映射到配置的文件夹
27 | .addResourceLocations("file:" + windowsFilepathPre + windowsFilepath);
28 |
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/config/UpdateBookConfig.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.config;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.scheduling.annotation.Scheduled;
7 | import zl.readCloud.aop.HttpAspect;
8 | import zl.readCloud.dao.BookDao;
9 | import zl.readCloud.pojo.BookPO;
10 | import zl.readCloud.service.crawler.UpdateBook;
11 |
12 | import javax.annotation.Resource;
13 | import java.util.List;
14 |
15 |
16 | /**
17 | * @author ZhangLei
18 | * @Description:
19 | * @date 2021/11/15 9:51
20 | */
21 | @Configuration
22 | public class UpdateBookConfig {
23 |
24 | @Resource
25 | private BookDao bookDao;
26 |
27 | @Resource
28 | private UpdateBook updateBook;
29 |
30 | private static final Logger log = LoggerFactory.getLogger(HttpAspect.class);
31 |
32 | //秒 分 时 日 月 周
33 | @Scheduled(cron = "1 * * * * ?") //更新时间
34 | public void update(){
35 | updateBook();
36 | }
37 |
38 | private void updateBook(){
39 | // 获取所有地址不为空的小说
40 | // List bookPOS = bookDao.getBookListUrl();
41 | // // 循环更新小说
42 | // for (BookPO bookPO : bookPOS){
43 | // updateBook.updateBook(bookPO.getBId(),bookPO.getBookUrl());
44 | // try {
45 | // // 间隔3秒
46 | // Thread.sleep(1000 * 5);
47 | // } catch (InterruptedException e) {
48 | // log.info("线程休眠异常");
49 | // e.printStackTrace();
50 | // }
51 | // }
52 | // log.info("开始更新小说");
53 |
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/AfAdminController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after;
2 |
3 | import org.springframework.web.bind.annotation.*;
4 | import zl.readCloud.pojo.AdminPO;
5 | import zl.readCloud.service.after.AfAdminService;
6 | import zl.readCloud.utils.Result;
7 |
8 | import javax.annotation.Resource;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpSession;
11 |
12 | /**
13 | * @Author:ZhangLei
14 | */
15 |
16 | @RequestMapping("/after/admin")
17 | @RestController
18 | public class AfAdminController {
19 |
20 |
21 | @Resource
22 | private AfAdminService afAdminService;
23 |
24 | /**
25 | * 登录验证
26 | */
27 | @PostMapping(value = "/login")
28 | public Result login(@RequestBody AdminPO admin, HttpServletRequest request){
29 | AdminPO res = afAdminService.showOne(admin);
30 | HttpSession session = request.getSession();
31 | if (res != null){
32 | session.setAttribute("admin",res);
33 | }
34 | return Result.success(res);
35 | }
36 |
37 | @GetMapping("/showAA")
38 | public Result showAA(String password,String account){
39 | AdminPO admin = new AdminPO();
40 | admin.setPassword(password);
41 | admin.setAccount(account);
42 | return Result.success(afAdminService.showOne(admin));
43 | }
44 |
45 | /**
46 | * 旧密码通过验证后,修改密码
47 | */
48 | @GetMapping("/updateByUAccount")
49 | Result updateByUAccount(String password,String account){
50 | return Result.success(afAdminService.updateByUAccount(password,account));
51 | }
52 |
53 | /**
54 | * 查询所有的管理员
55 | */
56 | @PostMapping(value = "/showAll")
57 | public Result showAll(){
58 | return Result.success(Result.SUCCESS,afAdminService.showAll().size(),afAdminService.showAll());
59 | }
60 |
61 | /**
62 | * 删除管理员
63 | */
64 | @PostMapping(value = "/deleteByAccount")
65 | public Result deleteByAccount(String account){
66 | return Result.success(afAdminService.deleteByAccount(account));
67 | }
68 |
69 |
70 | /**
71 | * 添加管理员
72 | */
73 | @PostMapping("/addOne")
74 | public Result addOne(@RequestBody AdminPO admin){
75 | System.out.println(admin);
76 | return Result.success(afAdminService.addOne(admin));
77 | }
78 |
79 | /**
80 | * 查找管理员
81 | */
82 | @GetMapping("/showByAccount")
83 | public Result showByAccount(String account){
84 | return Result.success(afAdminService.showByAccount(account));
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/AfBannerController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.*;
5 | import zl.readCloud.controller.after.dto.BannerDTO;
6 | import zl.readCloud.pojo.BannerPO;
7 | import zl.readCloud.pojo.BookPO;
8 | import zl.readCloud.service.after.Impl.AfBannerServiceImpl;
9 | import zl.readCloud.service.after.Impl.AfBookServiceImpl;
10 | import zl.readCloud.utils.Result;
11 | import zl.readCloud.utils.ToolsUtils;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | * @author ZhangLei
17 | * @Description:
18 | * @date 2021/10/14 11:23
19 | */
20 | @RequestMapping("/banner")
21 | @RestController
22 | public class AfBannerController {
23 |
24 | @Autowired
25 | private AfBannerServiceImpl afBannerService;
26 |
27 | @Autowired
28 | private AfBookServiceImpl afBookService;
29 |
30 | @GetMapping("/getBannerList")
31 | public Result getBannerList(Integer page, Integer limit) {
32 | if ( page == null) {
33 | return Result.error(0,"没有页数");
34 | }
35 | Integer pages = (page - 1) * limit;
36 | List list = afBannerService.getBannerList(pages, limit);
37 | Integer count = afBannerService.getBannerListCount();
38 | for (int i = 0; i < list.size(); i++) {
39 | list.get(i).setBaPicture(ToolsUtils.getImgPath(list.get(i).getBaPicture()));
40 | }
41 | return Result.success(Result.SUCCESS, count, list);
42 | }
43 |
44 | @PostMapping("/addBanner")
45 | public Result addBanner(@RequestBody BannerDTO bannerDTO ) {
46 | BookPO book = afBookService.showByBTitle(bannerDTO.getBTitle());
47 | BannerPO banner = new BannerPO();
48 | banner.setBaId(bannerDTO.getBaId());
49 | banner.setBaLevel(bannerDTO.getBaLevel());
50 | banner.setBaPicture(bannerDTO.getBaPicture());
51 | banner.setBId(book.getBId());
52 | banner.setStartDt(bannerDTO.getStartDt());
53 | banner.setEndDt(bannerDTO.getEndDt());
54 | return Result.success(afBannerService.addBanner(banner));
55 | }
56 |
57 | @PostMapping("/updateBanner")
58 | public Result updateBanner(@RequestBody BannerPO banner) {
59 | return Result.success(afBannerService.updateBanner(banner));
60 | }
61 |
62 | @GetMapping("/deleteBanner")
63 | public Result deleteBanner(@RequestParam("baId")Integer baId) {
64 | return Result.success(afBannerService.deleteBanner(baId));
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/AfBookController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after;
2 |
3 | import org.slf4j.LoggerFactory;
4 | import org.springframework.transaction.annotation.Transactional;
5 | import org.springframework.web.bind.annotation.*;
6 | import org.springframework.web.multipart.MultipartFile;
7 | import zl.readCloud.pojo.BookPO;
8 | import zl.readCloud.pojo.ChapterPO;
9 | import zl.readCloud.service.after.AfBookService;
10 | import zl.readCloud.utils.DateUtils;
11 | import zl.readCloud.utils.Result;
12 | import zl.readCloud.utils.ToolsUtils;
13 |
14 | import javax.annotation.Resource;
15 | import java.io.File;
16 | import java.text.SimpleDateFormat;
17 | import java.util.*;
18 |
19 | import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
20 |
21 | /**
22 | * @Author:ZhangLei
23 | */
24 | @Transactional
25 | @RequestMapping("/after/book")
26 | @RestController
27 | public class AfBookController {
28 |
29 | @Resource
30 | AfBookService afBookService;
31 |
32 | /**
33 | * detail: 分页展示所有书籍,条件查询
34 | */
35 | @PostMapping("/showAll")
36 | public Result showAll(Integer page, Integer limit, BookPO book) {
37 | if ("".equals(book.getAuthor())) {
38 | book.setAuthor(null);
39 | }
40 | if ("".equals(book.getBTitle())) {
41 | book.setBTitle(null);
42 | }
43 | if ("".equals(book.getCate())) {
44 | book.setCate(null);
45 | }
46 | // integer类型,前台传值时为空,转化为null
47 | if (book.getAuthor() == null && book.getBTitle() == null
48 | && book.getCate() == null && book.getGoodNum() == null
49 | && book.getReadNum() == null) {
50 | Integer pages = (page - 1) * limit;
51 | List list = afBookService.showAll(pages, limit);
52 | for (int i = 0; i < list.size(); i++) {
53 | list.get(i).setBPicture(ToolsUtils.getImgPath(list.get(i).getBPicture()));
54 | }
55 | Integer count = afBookService.showAllItem().size();
56 | return Result.success(Result.SUCCESS, count, list);
57 | }
58 | List list = afBookService.showScreen(book);
59 | for (int i = 0; i < list.size(); i++) {
60 | list.get(i).setBPicture(ToolsUtils.getImgPath(list.get(i).getBPicture()));
61 | }
62 | LoggerFactory.getLogger(AfBookController.class).info(list.toString());
63 | return Result.success(list);
64 | }
65 |
66 | /**
67 | * detail: 添加书籍
68 | */
69 | @PostMapping("/addOne")
70 | public Result addOne(@RequestBody BookPO book) {
71 | // 获取一个当前时间,精确到毫秒,确保添加时间不会重,为后面客户端页面排序做准备
72 | Date date = new Date();
73 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
74 | String dateStr = simpleDateFormat.format(date);
75 | book.setUpdateTime(dateStr);
76 | if (book.getBPicture() == null || book.getBPicture() == "") {
77 | book.setBPicture(ToolsUtils.DEFAULT_IMG);
78 | }
79 | return Result.success(afBookService.addOne(book));
80 | }
81 |
82 | /**
83 | * detail: 删除书籍,改变状态
84 | *
85 | * @param bId
86 | * @return int
87 | */
88 | @PostMapping("/deleteById")
89 | public Result deleteById(Integer bId, Integer status) {
90 | if (status == 1) {
91 | return Result.success(200, "下架成功", 200, afBookService.deleteById(bId, 0));
92 | }
93 | return Result.success(200, "上架成功", 200, afBookService.deleteById(bId, 1));
94 | }
95 |
96 | /**
97 | * detail: 编辑书籍
98 | *
99 | * @param book
100 | * @return int
101 | */
102 | @PostMapping("/updateOne")
103 | public Result updateOne(@RequestBody BookPO book) {
104 | return Result.success(afBookService.updateOne(book));
105 | }
106 |
107 | /**
108 | * detail: 添加章节内容
109 | *
110 | * @param chapter
111 | * @return int
112 | */
113 | @PostMapping("/addChap")
114 | public Result addChap(ChapterPO chapter){
115 | //获取一个当前时间,精确到毫秒,确保添加时间不会重,为后面客户端页面排序做准备
116 | //创建一个date对象保存当前时间
117 | // Date date = new Date();
118 | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
119 | //format()方法将Date转换成指定格式的String
120 | // String dateStr = simpleDateFormat.format(date);
121 | chapter.setETime(DateUtils.getCurrentTime());
122 | Integer bId = chapter.getBId();
123 | afBookService.updateByBId(bId,DateUtils.getCurrentTime());
124 | afBookService.deleteById(bId,1);
125 | return Result.success(afBookService.addChap(chapter));
126 | }
127 |
128 | /**
129 | * detail: 根据小说bId查询小说的所有条数,进而得出下一章的数字
130 | *
131 | * @param bId
132 | * @return int
133 | */
134 | @GetMapping("/showByBId")
135 | public Result showByBId(Integer bId){
136 | return Result.success(afBookService.showByBId(bId).size());
137 | }
138 |
139 | @GetMapping("/showByBTitle")
140 | public Result showByBTitle(String bTitle) {
141 | BookPO book = afBookService.showByBTitle(bTitle);
142 | if (book != null) {
143 | return Result.success(Result.SUCCESS,1,book);
144 | }
145 | return Result.success(Result.SUCCESS,0,null);
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/AfChapterController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after;
2 |
3 | import org.springframework.web.bind.annotation.*;
4 | import zl.readCloud.pojo.ChapterPO;
5 | import zl.readCloud.service.after.AfChapterService;
6 | import zl.readCloud.utils.Result;
7 |
8 | import javax.annotation.Resource;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | @RequestMapping("/after/chapter")
15 | @RestController
16 | public class AfChapterController {
17 |
18 |
19 | @Resource
20 | AfChapterService afChapterService;
21 |
22 | @GetMapping("/showByBTitle")
23 | public Result showByBTitle(String bTitle, String index){
24 | // index = index - 1;
25 | List list = afChapterService.showByBTitle(bTitle, index);
26 | if (list.size() == 0 ){
27 | return Result.success(0);
28 | }
29 | return Result.success(list);
30 | }
31 |
32 | @PostMapping("/updateByCTitle")
33 | public Result updateByCTitle(String cTitle, String words){
34 | return Result.success(afChapterService.updateByCTitle(cTitle, words));
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/AfTypeController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after;
2 |
3 | import org.springframework.web.bind.annotation.*;
4 | import zl.readCloud.pojo.TypePO;
5 | import zl.readCloud.service.after.AfTypeService;
6 | import zl.readCloud.utils.Result;
7 |
8 | import javax.annotation.Resource;
9 |
10 | /**
11 | * @Author:ZhangLei
12 | */
13 | @RequestMapping("/after/type")
14 | @RestController
15 | public class AfTypeController {
16 |
17 |
18 | @Resource
19 | AfTypeService afTypeService;
20 |
21 | @PostMapping("/addType")
22 | public Result addType(String cate) {
23 | if (afTypeService.showByType(cate) == null){
24 | return Result.success(200,"添加成功",0,afTypeService.addType(cate));
25 | }
26 | return Result.success(200,"该分类已存在,请添加新分类",0,0);
27 | }
28 |
29 | @PostMapping("/showAll")
30 | public Result showAll() {
31 | return Result.success(Result.SUCCESS, afTypeService.showAll().size(),afTypeService.showAll());
32 | }
33 |
34 | @GetMapping("/updateById")
35 | public Result updateById(@RequestBody TypePO type) {
36 | return Result.success(afTypeService.updateById(type));
37 | }
38 |
39 | @PostMapping("/deleteById")
40 | public Result deleteById(Integer tId) {
41 | return Result.success(afTypeService.deleteById(tId));
42 | }
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/AfUserController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after;
2 |
3 | import org.springframework.web.bind.annotation.*;
4 | import zl.readCloud.pojo.UserPO;
5 | import zl.readCloud.service.after.AfUserService;
6 | import zl.readCloud.utils.Result;
7 |
8 | import javax.annotation.Resource;
9 |
10 | /**
11 | * @Author:ZhangLei
12 | */
13 | @RequestMapping("/after/user")
14 | @RestController
15 | public class AfUserController {
16 |
17 |
18 | @Resource
19 | AfUserService afUserService;
20 |
21 | /**
22 | * detail: 分页展示所有用户、及查询用户
23 | * 1.layui会自动传page和limit两个参数过来,进行分页操作
24 | * 2.layui方法的重载,会在额外在传过来uAcc参数
25 | * @param
26 | * @return List
27 | */
28 | @PostMapping("/showAll")
29 | Result showAll(Integer page, Integer limit, String uAcc){
30 | if (uAcc == null || uAcc == ""){
31 | Integer pages = (page-1) * limit;
32 | return Result.success(Result.SUCCESS, afUserService.showAllItem().size(), afUserService.showAll(pages, limit));
33 | }
34 | return Result.success(Result.SUCCESS, afUserService.showByUAccount(uAcc));
35 |
36 |
37 | }
38 |
39 | /**
40 | * detail: 注销用户,启用用户
41 | * @param uId
42 | * @return int
43 | */
44 | @PostMapping("/deleteById")
45 | Result deleteById(Integer uId,Integer status){
46 | if (status == 1){
47 | return Result.success(200,"注销成功",200,afUserService.deleteById(uId,0));
48 | }
49 | return Result.success(200,"启用成功",200,afUserService.deleteById(uId,1));
50 | }
51 |
52 | /**
53 | * detail: 批量注销用户
54 | * @param uIds
55 | * @return int
56 | */
57 | @PostMapping("/deleteByIds")
58 | Result deleteByIds(Integer[] uIds){
59 | return Result.success(afUserService.deleteByIds(uIds));
60 | }
61 |
62 | /**
63 | * detail: 验证用户,账号和密码
64 | * @param uAccount
65 | * @param uPassword
66 | * @return int
67 | */
68 | @GetMapping("/showOne")
69 | Result showOne(String uAccount,String uPassword){
70 | return Result.success(afUserService.showOne(uAccount,uPassword));
71 | }
72 |
73 | /**
74 | * detail: 修改密码操作:
75 | * 第一步,showOne,验证通过后,才可以修改密码
76 | * 第二步,根据已登录的用户名修改密码
77 | * @param uPassword
78 | * @param uAccount
79 | * @return int
80 | */
81 | @GetMapping("/updateByUAccount")
82 | Result updateByUAccount(String uPassword,String uAccount){
83 | return Result.success(afUserService.updateByUAccount(uPassword,uAccount));
84 | }
85 |
86 | /**
87 | * detail: 通过账号查询
88 | * @param uAccount
89 | * @return int
90 | */
91 | @GetMapping("/showByUAccount")
92 | Result showByUAccount(String uAccount){
93 | return Result.success(afUserService.showByUAccount(uAccount));
94 | }
95 |
96 | /**
97 | * detail: 添加用户
98 | * @param user
99 | * @return int
100 | */
101 | @PostMapping("/addOne")
102 | Result addOne(@RequestBody UserPO user){
103 | return Result.success(afUserService.addOne(user));
104 | }
105 |
106 | /**
107 | * detail: 编辑用户基本信息
108 | * @param user
109 | * @return int
110 | */
111 | @PostMapping("/updateById")
112 | Result updateById(@RequestBody UserPO user){
113 | return Result.success(afUserService.updateById(user));
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/dto/BannerDTO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after.dto;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @author ZhangLei
10 | * @Description:
11 | * @date 2021/10/22 15:37
12 | */
13 | @Data
14 | @AllArgsConstructor
15 | @NoArgsConstructor
16 | public class BannerDTO {
17 |
18 | /**
19 | * banner图id
20 | */
21 | @JsonProperty("baId")
22 | Integer baId;
23 |
24 | /**
25 | * banner图地址
26 | */
27 | @JsonProperty("baPicture")
28 | String baPicture;
29 |
30 | /**
31 | * banner 书籍名
32 | */
33 | @JsonProperty("bTitle")
34 | String bTitle;
35 |
36 | /**
37 | * banner图开始展示时间
38 | */
39 | @JsonProperty("start_dt")
40 | String startDt;
41 |
42 | /**
43 | * banner图结束展示时间
44 | */
45 | @JsonProperty("end_dt")
46 | String endDt;
47 |
48 | /**
49 | * 级别
50 | */
51 | @JsonProperty("ba_level")
52 | String baLevel;
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/after/dto/BookChapterDTO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.after.dto;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class BookChapterDTO {
15 |
16 |
17 | /**
18 | * 书bId
19 | */
20 | @JsonProperty(value = "bId")
21 | Integer bId;
22 |
23 | /**
24 | * 书籍类型
25 | */
26 | String cate;
27 |
28 | /**
29 | * 书名
30 | */
31 | @JsonProperty(value = "bTitle")
32 | String bTitle;
33 |
34 | /**
35 | * 章节名
36 | */
37 | @JsonProperty(value = "cTitle")
38 | String cTitle;
39 |
40 | /**
41 | * 作者
42 | */
43 | String author;
44 |
45 | /**
46 | * 最后一次更新时间,最后一次添加章节的时间
47 | */
48 | @JsonProperty(value = "eTime")
49 | String eTime;
50 |
51 | /**
52 | * 章节内容
53 | */
54 | String words;
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/common/commonController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.common;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.*;
5 | import org.springframework.web.multipart.MultipartFile;
6 | import zl.readCloud.utils.Result;
7 | import zl.readCloud.utils.ToolsUtils;
8 |
9 | import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
10 |
11 | /**
12 | * @author ZhangLei
13 | * @Description:
14 | * @date 2021/11/8 16:46
15 | */
16 | @RestController
17 | @RequestMapping("/common")
18 | public class commonController {
19 |
20 | @Autowired
21 | private ToolsUtils toolsUtils;
22 |
23 | /**
24 | * 上传图片
25 | */
26 | @PostMapping("/uploadPic")
27 | public Result uploadPic(MultipartFile file, @RequestParam("type_img")Integer typeImg) {
28 | try {
29 | String res = toolsUtils.uploadImg(file,typeImg);
30 | if (!"".equals(res) && res != null) {
31 | return Result.success(Result.SUCCESS,res);
32 | }else {
33 | return Result.success(Result.NULL, null);
34 | }
35 | } catch (Exception e) {
36 | log.print(e);
37 | return Result.error(Result.COLLAPSE, String.valueOf(e));
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/front/FrController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.front;
2 |
3 | import org.springframework.web.bind.annotation.CrossOrigin;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 | import zl.readCloud.controller.after.dto.BannerDTO;
8 | import zl.readCloud.pojo.BannerPO;
9 | import zl.readCloud.pojo.BookPO;
10 | import zl.readCloud.pojo.ChapterPO;
11 | import zl.readCloud.pojo.TypePO;
12 | import zl.readCloud.service.front.FrDetailsService;
13 | import zl.readCloud.service.front.FrIndexService;
14 | import zl.readCloud.service.front.FrReadingService;
15 | import zl.readCloud.utils.Result;
16 | import zl.readCloud.controller.after.dto.BookChapterDTO;
17 | import zl.readCloud.utils.ToolsUtils;
18 |
19 | import javax.annotation.Resource;
20 | import java.text.SimpleDateFormat;
21 | import java.util.*;
22 |
23 | /**
24 | * @Author:ZhangLei
25 | */
26 | @RequestMapping("/front")
27 | @RestController
28 | public class FrController {
29 |
30 | // 首页banner图的数量
31 | private static final Integer BANNER_COUNT = 5;
32 |
33 | @Resource
34 | FrIndexService frIndexService;
35 |
36 | @Resource
37 | FrDetailsService frDetailsService;
38 |
39 | @Resource
40 | FrReadingService frReadingService;
41 |
42 | /**
43 | * 头部的搜索功能
44 | * @return list
45 | * @param bTitle 输入的书籍名称,模糊查询
46 | */
47 | @GetMapping("/frSearch")
48 | public Result frSearch(String bTitle){
49 | List types = frIndexService.showTypeAll();
50 | List books = frIndexService.showBTitleByLike(bTitle);
51 | if (books.size() == 0) {
52 |
53 | }
54 | Map map = new HashMap<>();
55 | map.put("types",types);
56 | map.put("books",books);
57 | return Result.success(map);
58 | }
59 |
60 |
61 | /**
62 | * index页面的所有数据
63 | * @return map
64 | * @param lastNnm 最近更新章节的条数
65 | * @param lastBookNum 最近上架书籍的条数
66 | */
67 | @GetMapping("/frIndex")
68 | public Result frIndex(Integer lastNnm, Integer lastBookNum){
69 | Date time = new Date();
70 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
71 | String nowDate = sdf.format(time);
72 | List types = frIndexService.showTypeAll();
73 | List banners = frIndexService.getBannerList2(nowDate);
74 | for (BannerPO banner : banners) {
75 | banner.setBaPicture(ToolsUtils.getImgPath(banner.getBaPicture()));
76 | }
77 | List hotRec = frIndexService.showByHotRec(null);
78 | for (BookPO book : hotRec) {
79 | book.setBPicture(ToolsUtils.getImgPath(book.getBPicture()) );
80 | }
81 | List lastChapter = frIndexService.showLastUpdate(lastNnm,null);
82 | List lastBook = frIndexService.showLastUpdateBook(lastBookNum);
83 | Map map = new HashMap<>();
84 | map.put("types",types);
85 | map.put("banners",banners);
86 | map.put("hotRec",hotRec);
87 | map.put("lastChapter",lastChapter);
88 | map.put("lastBook",lastBook);
89 | return Result.success(map);
90 | }
91 |
92 |
93 | /**
94 | * type页面的所有数据
95 | * @return map
96 | * @param cate 类型
97 | * @param lastNnm 最近更新章节的条数
98 | */
99 | @GetMapping("/frType")
100 | public Result frType(Integer lastNnm, String cate){
101 | List types = frIndexService.showTypeAll();
102 | List hotRec = frIndexService.showByHotRec(cate);
103 | for (BookPO bookPO : hotRec) {
104 | bookPO.setBPicture(ToolsUtils.getImgPath(bookPO.getBPicture()));
105 | }
106 | List lastChapter = frIndexService.showLastUpdate(lastNnm,cate);
107 | Map map = new HashMap<>();
108 | map.put("types",types);
109 | map.put("hotRec",hotRec);
110 | map.put("lastChapter",lastChapter);
111 | return Result.success(map);
112 | }
113 |
114 | /**
115 | * details页面的所有数据
116 | * @return map
117 | * @param bId
118 | */
119 | @GetMapping("/frDetail")
120 | public Result frDetail(Integer bId){
121 | List types = frIndexService.showTypeAll();
122 | BookPO book = frDetailsService.showBookByBId(bId);
123 | book.setBPicture(ToolsUtils.getImgPath(book.getBPicture()));
124 | List list = new ArrayList<>();
125 | list.add(book);
126 | List chapters = frDetailsService.showChapterByBId(bId);
127 | Map map = new HashMap<>();
128 | map.put("types",types);
129 | map.put("book",list);
130 | map.put("chapters", chapters);
131 | return Result.success(map);
132 | }
133 |
134 |
135 | /**
136 | * reading页面的所有数据
137 | * @return map
138 | * @param bId
139 | */
140 | @GetMapping("/frReading")
141 | public Result frReading(Integer bId,String cTitle){
142 | List types = frIndexService.showTypeAll();
143 | List chapter = frReadingService.showReadingChapter(bId,cTitle);
144 | Map map = new HashMap<>();
145 | map.put("types",types);
146 | map.put("chapter",chapter);
147 | return Result.success(map);
148 | }
149 |
150 | /**
151 | * reading页面的翻页
152 | * @return map
153 | * @param bId
154 | */
155 | @GetMapping("/frNextOrPrevious")
156 | public Result frNextOrPrevious(Integer bId, String eTime, String compare){
157 | if ("".equals(compare)){
158 | return Result.success(frReadingService.showNextOrPrevious(bId,eTime,null));
159 | }
160 | return Result.success(frReadingService.showNextOrPrevious(bId,eTime,compare));
161 | }
162 |
163 |
164 | }
165 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/controller/front/FrLoginController.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.controller.front;
2 |
3 | import org.springframework.web.bind.annotation.*;
4 | import zl.readCloud.pojo.UserPO;
5 | import zl.readCloud.service.front.FrLoginService;
6 | import zl.readCloud.utils.Result;
7 |
8 | import javax.annotation.Resource;
9 |
10 | /**
11 | * @Author:ZhangLei
12 | */
13 | @RequestMapping("/front/login")
14 | @RestController
15 | public class FrLoginController {
16 |
17 |
18 | @Resource
19 | FrLoginService frLoginService;
20 |
21 | /**
22 | * 注册用户
23 | */
24 | @PostMapping("/addOne")
25 | public Result addOne(UserPO user){
26 | return Result.success(frLoginService.addOne(user));
27 | }
28 |
29 | /**
30 | * 用户登录
31 | */
32 | @GetMapping("/showOne")
33 | public Result showOne(String uAccount,String uPassword){
34 | return Result.success(frLoginService.showOne(uAccount,uPassword));
35 | }
36 |
37 | /**
38 | * 查重用户名
39 | */
40 | @GetMapping("/showByUAccount")
41 | public Result showByUAccount(String uAccount){
42 | return Result.success(frLoginService.showByUAccount(uAccount));
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/dao/AdminDao.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.dao;
2 |
3 | import org.apache.ibatis.annotations.*;
4 | import zl.readCloud.pojo.AdminPO;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | * detail: 管理员所有方法
11 | */
12 | public interface AdminDao {
13 |
14 |
15 | /**
16 | * detail: 展示所有管理员
17 | * @return List
18 | */
19 | @Select("select * from admin")
20 | List showAll();
21 |
22 | /**
23 | * detail: 添加管理员
24 | * @param admin
25 | * @return admin
26 | */
27 | @Insert("insert into admin values (null,#{account},#{password},null)")
28 | int addOne(AdminPO admin);
29 |
30 | /**
31 | * detail: 管理员登录验证 和 修改密码,验证用户,账号和密码
32 | * @param admin
33 | * @return admin
34 | */
35 | @Select("select * from admin " +
36 | "where account = #{account} and password = #{password}")
37 | AdminPO showOne(AdminPO admin);
38 |
39 | /**
40 | * detail: 修改密码操作:
41 | * 第一步,showOne,验证通过后,才可以修改密码
42 | * 第二步,根据已登录的用户名修改密码
43 | * @param password
44 | * @param account
45 | * @return int
46 | */
47 | @Update("update admin set password = #{password} where account = #{account}")
48 | int updateByUAccount(String password, String account);
49 |
50 |
51 |
52 | /**
53 | * detail: 删除管理员
54 | * @param account
55 | * @return int
56 | */
57 | @Delete("delete from admin where account = #{account}")
58 | int deleteByAccount(String account);
59 |
60 | /**
61 | * detail: 查找管理员
62 | * @param account
63 | * @return Admin
64 | */
65 | @Select("select * from admin where account = #{account}")
66 | AdminPO showByAccount(String account);
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/dao/BannerDao.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.dao;
2 |
3 | import org.apache.ibatis.annotations.Delete;
4 | import org.apache.ibatis.annotations.Insert;
5 | import org.apache.ibatis.annotations.Select;
6 | import org.apache.ibatis.annotations.Update;
7 | import zl.readCloud.controller.after.dto.BannerDTO;
8 | import zl.readCloud.pojo.BannerPO;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @Author:ZhangLei
14 | */
15 | public interface BannerDao {
16 |
17 |
18 | /**
19 | * 查询banner列表,后台展示
20 | */
21 | @Select("select baId,baPicture,bTitle,start_dt,end_dt,ba_level " +
22 | "from banner a INNER JOIN book b ON a.bId = b.bId order by start_dt limit #{pages},#{limit} ")
23 | List getBannerList(Integer pages, Integer limit);
24 |
25 | // /**
26 | // * 查询banner列表,首页展示
27 | // */
28 | // @Select("select baId,baPicture,bId,start_dt,end_dt,ba_level " +
29 | // "from banner where start_dt < #{nowDate} and end_dt > #{nowDate} order by ba_level desc limit 3 ")
30 | // List getBannerList2(String nowDate);
31 | /**
32 | * 查询banner列表,首页展示
33 | */
34 | @Select("select baId,baPicture,bId,start_dt,end_dt,ba_level " +
35 | "from banner where 1=1 order by ba_level desc limit 3 ")
36 | List getBannerList2(String nowDate);
37 | /**
38 | * 查询banner列表条数
39 | */
40 | @Select("select count(*) from banner a INNER JOIN book b ON a.bId = b.bId ")
41 | Integer getBannerListCount();
42 |
43 | /**
44 | * 添加banner
45 | */
46 | @Insert("insert into banner values (null,#{baPicture},#{bId},#{startDt},null,#{endDt},#{baLevel})")
47 | int addBanner(BannerPO banner);
48 |
49 | /**
50 | * 更新banner信息
51 | */
52 | @Update("update banner baPicture = #{baPicture}, bId = #{bId}, start_dt = #{startDt}, " +
53 | "end_dt = #{endDt}, ba_level = #{baLevel} set where baId = #{baId}")
54 | int updateBanner(BannerPO banner);
55 |
56 | /**
57 | * 删除banner信息
58 | */
59 | @Delete("delete from banner where baId = #{baId}")
60 | int deleteBanner(int baId);
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/dao/BookDao.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.dao;
2 |
3 | import org.apache.ibatis.annotations.Insert;
4 | import org.apache.ibatis.annotations.Select;
5 | import org.apache.ibatis.annotations.Update;
6 | import zl.readCloud.pojo.BookPO;
7 | import zl.readCloud.controller.after.dto.BookChapterDTO;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | public interface BookDao {
15 |
16 |
17 | /**
18 | * 查所有
19 | * @return List
20 | */
21 | @Select("select * from book")
22 | List showAllItem();
23 |
24 | /**
25 | * 查所有地址不为空的书籍
26 | * @return List
27 | */
28 | @Select("select * from book where bookUrl != ''")
29 | List getBookListUrl();
30 |
31 | /**
32 | * detail: 展示一页书籍,分页展示
33 | * @param pages
34 | * @param limit
35 | * @return List
36 | */
37 | @Select("select * from book limit #{pages},#{limit}")
38 | List showAll(Integer pages, Integer limit);
39 |
40 | /**
41 | * detail: 添加书籍
42 | * @param book
43 | * @return int
44 | */
45 | @Insert("insert into book values (null,#{bTitle},#{bPicture}," +
46 | "0,0,#{author},#{cate},2,#{introduce},#{updateTime})")
47 | int addOne(BookPO book);
48 |
49 | /**
50 | * detail: 改变书籍状态
51 | * @param bId
52 | * @param status
53 | * @return int
54 | */
55 | @Update("update book set status = #{status} where bId = #{bId}")
56 | int deleteById(Integer bId, Integer status);
57 |
58 | /**
59 | * detail: 编辑书籍,改变状态
60 | * @param book
61 | * @return int
62 | */
63 | @Update("update book set " +
64 | "bTitle = #{bTitle},readNum = #{readNum},goodNum = #{goodNum}," +
65 | "author = #{author},cate = #{cate},introduce = #{introduce}, bPicture = #{bPicture} " +
66 | "where bId = #{bId}")
67 | int updateOne(BookPO book);
68 |
69 | /**
70 | * detail: 更新书籍的章节更新时间
71 | * @param bId
72 | * @param updateTime
73 | * @return int
74 | */
75 | @Update("update book set updateTime = #{updateTime} where bId = #{bId}")
76 | int updateByBId(Integer bId,String updateTime);
77 |
78 | /**
79 | * detail: 查看书籍,多条件筛选
80 | * @param book
81 | * @return List
82 | */
83 | @Select("")
92 | List showScreen(BookPO book);
93 |
94 | /**
95 | * detail: 根据书名,查询
96 | * @param bTitle
97 | * @return List
98 | */
99 | @Select("select * from book where bTitle = #{bTitle}")
100 | BookPO showByBTitle(String bTitle);
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 | /**
112 | * 客户端
113 | *
114 | *
115 | */
116 |
117 | /**
118 | * detail: 根据bId,查询
119 | * @param bId
120 | * @return List
121 | */
122 | @Select("select * from book where bId = #{bId}")
123 | BookPO showBookByBId(Integer bId);
124 |
125 | /**
126 | * detail: 根据书名模糊查询 顺序是:完全匹配>开头匹配>最后匹配>中间匹配
127 | * @param bTitle
128 | * @return List
129 | */
130 | @Select("select * from book where bTitle like concat('%',#{bTitle},'%') " +
131 | "ORDER BY ( " +
132 | "CASE " +
133 | "WHEN bTitle = #{bTitle} THEN 1 " +
134 | "WHEN bTitle like concat(#{bTitle},'%') THEN 2 " +
135 | "WHEN bTitle like concat('%',#{bTitle}) THEN 3 " +
136 | "WHEN bTitle like concat('%',#{bTitle},'%') THEN 4 " +
137 | "ELSE 5 END )")
138 | List showBTitleByLike(String bTitle);
139 |
140 | /**
141 | * detail: 热门推荐:根据阅读量排排序并取前6条(如果有类型,就只查单个类型)
142 | * @param
143 | * @return List
144 | */
145 | @Select("")
150 | List showByReadNum(String cate);
151 |
152 | /**
153 | * detail: 热门推荐:根据点赞量排排序并取前6条(如果有类型,就只查单个类型)
154 | * @param
155 | * @return List
156 | */
157 | @Select("")
162 | List showByGoodNum(String cate);
163 |
164 | /**
165 | * detail: 查询最后更新的两本书各自的最后一章数据,且阅读量不能为0,状态必须为1(含有章节),
166 | * @param
167 | * @return List
168 | */
169 | @Select("")
179 | List showLastUpdate(Integer num, String cate);
180 |
181 | /**
182 | * detail: 查询最近上架的图书,阅读量为0,状态为1(含有章节)
183 | * @param
184 | * @return List
185 | */
186 | @Select("SELECT bId,cate,bTitle,author from book where readNum = 0 and `status` = 1 " +
187 | "ORDER BY updateTime DESC LIMIT #{num} ")
188 | List showLastUpdateBook(Integer num);
189 |
190 | /**
191 | * detail: 精确查询一章
192 | * @param bId
193 | * @param cTitle
194 | * @return List
195 | */
196 | @Select("select bo.bId,bo.cate,bo.bTitle,ch.cTitle,ch.words,ch.eTime from chapter as ch,book as bo " +
197 | "where bo.bId = ch.bId and bo.bId = #{bId} and ch.cTitle = #{cTitle}")
198 | List showReadingChapter(Integer bId, String cTitle);
199 |
200 |
201 | }
202 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/dao/BookShelfDao.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.dao;
2 |
3 | import zl.readCloud.pojo.BookShelfPO;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @author ZhangLei
9 | * @Description:
10 | * @date 2021/10/21 18:09
11 | */
12 | public interface BookShelfDao {
13 |
14 | List getBookShelfBy();
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/dao/ChapterDao.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.dao;
2 |
3 | import org.apache.ibatis.annotations.Insert;
4 | import org.apache.ibatis.annotations.Select;
5 | import org.apache.ibatis.annotations.Update;
6 | import zl.readCloud.pojo.ChapterPO;
7 | import zl.readCloud.controller.after.dto.BookChapterDTO;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | public interface ChapterDao {
15 |
16 |
17 | /**
18 | * detail: 添加一章内容
19 | * @param chapter
20 | * @return int
21 | */
22 | @Insert("insert into chapter values (null ,#{cTitle} ,#{sort} ,#{bId} ,#{words} ,#{eTime} ,#{chapterUrl})")
23 | int addChap(ChapterPO chapter);
24 |
25 | /**
26 | * detail: 查询一本书的所有章节,升序(前一章的时间一定早与下一章的时间,修改章节内容不更新时间)
27 | * @return int
28 | */
29 | @Select("select * from chapter where bId = #{bId} order by eTime")
30 | List showByBId(Integer bId);
31 |
32 | /**
33 | * 根据书名 章节下标,连表查询 作者列,章节列,和章节内容列
34 | */
35 | @Select("SELECT author,cTitle,words FROM book AS bb,chapter AS cc " +
36 | "WHERE bb.bId = cc.bId AND bb.bId = (SELECT bId FROM book where bTitle = #{bTitle})" +
37 | "and cTitle = #{index} limit 1" )
38 | List showByBTitle(String bTitle, String index);
39 |
40 | /**
41 | * 根据书章节标题,更新内容
42 | */
43 | @Update("update chapter set words = #{words} where cTitle = #{cTitle}")
44 | int updateByCTitle(String cTitle, String words);
45 |
46 | /**
47 | * detail: 查询上一章或下一章
48 | * 动态sql,根据参数(compare),不为null max(t.eTime) < ($lt;) 上一章
49 | * 为null min(t.eTime) > ($gt;) 下一章
50 | * @param bId
51 | * @param eTime
52 | * @param compare
53 | * @return List
54 | */
55 | @Select("")
66 | List showNextOrPrevious(Integer bId, String eTime, String compare);
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/dao/TypeDao.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.dao;
2 |
3 |
4 | import org.apache.ibatis.annotations.Delete;
5 | import org.apache.ibatis.annotations.Insert;
6 | import org.apache.ibatis.annotations.Select;
7 | import org.apache.ibatis.annotations.Update;
8 | import zl.readCloud.pojo.TypePO;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @Author:ZhangLei
14 | * detail: 分类所有方法
15 | */
16 | public interface TypeDao {
17 |
18 |
19 | /**
20 | * detail: 添加一个分类
21 | * @param cate
22 | * @return int
23 | */
24 | @Insert("insert into type values (null,#{cate},null)")
25 | int addType(String cate);
26 |
27 | /**
28 | * detail: 展示所有分类
29 | * @param
30 | * @return List
31 | */
32 | @Select("select * from type")
33 | List showAll();
34 |
35 | /**
36 | * detail: 搜索分类
37 | * @param cate
38 | * @return Type
39 | */
40 | @Select("select * from type where cate = #{cate}")
41 | TypePO showByType(String cate);
42 |
43 | /**
44 | * detail: 更新分类名
45 | * @param type
46 | * @return int
47 | */
48 | @Update("update type set cate = #{cate} where tId = #{tId}")
49 | int updateById(TypePO type);
50 |
51 | /**
52 | * detail: 删除一个分类
53 | * @param tId
54 | * @return int
55 | */
56 | @Delete("delete from type where tId = #{tId} ")
57 | int deleteById(Integer tId);
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/dao/UserDao.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.dao;
2 |
3 | import org.apache.ibatis.annotations.Insert;
4 | import org.apache.ibatis.annotations.Select;
5 | import org.apache.ibatis.annotations.Update;
6 | import zl.readCloud.pojo.UserPO;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @Author:ZhangLei
12 | */
13 | public interface UserDao {
14 |
15 |
16 | /**
17 | * 查所有
18 | * @return List
19 | */
20 | @Select("select * from user")
21 | List showAllItem();
22 |
23 | /**
24 | * detail: 展示一页所有用户
25 | * @param pages
26 | * @param limit
27 | * @return List
28 | */
29 | @Select("select * from user limit #{pages},#{limit}")
30 | List showAll(Integer pages, Integer limit);
31 |
32 | /**
33 | * detail: 根据账号查寻用户
34 | * @param uAccount
35 | * @return User
36 | */
37 | @Select("select * from user where uAccount = #{uAccount}")
38 | List showByUAccount(String uAccount);
39 |
40 | /**
41 | * detail: 注销用户
42 | * @param uId
43 | * @param status
44 | * @return uId
45 | */
46 | @Update("update user set status = #{status} where uId = #{uId} ")
47 | int deleteById(Integer uId ,Integer status);
48 |
49 | /**
50 | * detail: 批量注销用户
51 | * @param uIds
52 | * @return int
53 | */
54 | @Update("")
58 | int deleteByIds(Integer[] uIds);
59 |
60 | /**
61 | * detail: 验证用户,账号和密码
62 | * @param uAccount
63 | * @param uPassword
64 | * @return int
65 | */
66 | @Select("select * from user where uPassword = #{uPassword} and uAccount = #{uAccount}")
67 | UserPO showOne(String uAccount, String uPassword);
68 |
69 | /**
70 | * detail: 修改密码操作:
71 | * 第一步,showOne,验证通过后,才可以修改密码
72 | * 第二步,根据已登录的用户名修改密码
73 | * @param uPassword
74 | * @param uAccount
75 | * @return int
76 | */
77 | @Update("update user set uPassword = #{uPassword} where uAccount = #{uAccount}")
78 | int updateByUAccount(String uPassword,String uAccount);
79 |
80 | /**
81 | * detail: 添加用户
82 | * @param user
83 | * @return int
84 | */
85 | @Insert("insert into user values " +
86 | "(null,#{uAccount},#{uPassword},#{sex},1,#{phone},#{email},#{remark2})")
87 | int addOne(UserPO user);
88 |
89 | /**
90 | * detail: 编辑用户基本信息
91 | * @param user
92 | * @return int
93 | */
94 | @Update("update user set uAccount = #{uAccount},sex = #{sex},phone = #{phone},email = #{email} " +
95 | "where uId = #{uId}")
96 | int updateById(UserPO user);
97 | }
98 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/pojo/AdminPO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.pojo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class AdminPO {
15 |
16 |
17 | /**
18 | * id,主键
19 | */
20 | private Integer id;
21 |
22 | /**
23 | * 账号,唯一
24 | */
25 | private String account;
26 |
27 | /**
28 | * 密码
29 | */
30 | private String password;
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/pojo/BannerPO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.pojo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class BannerPO {
15 |
16 |
17 | /**
18 | * banner图id
19 | */
20 | @JsonProperty("baId")
21 | Integer baId;
22 |
23 | /**
24 | * banner图地址
25 | */
26 | @JsonProperty("baPicture")
27 | String baPicture;
28 |
29 | /**
30 | * banner图的书籍id
31 | */
32 | @JsonProperty("bId")
33 | Integer bId;
34 |
35 | /**
36 | * banner图开始展示时间
37 | */
38 | @JsonProperty("start_dt")
39 | String startDt;
40 |
41 | /**
42 | * banner图结束展示时间
43 | */
44 | @JsonProperty("end_dt")
45 | String endDt;
46 |
47 | /**
48 | * 备用字段
49 | */
50 | @JsonProperty("ba_level")
51 | String baLevel;
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/pojo/BookPO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.pojo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class BookPO {
15 |
16 |
17 | /**
18 | * 主键
19 | */
20 | @JsonProperty(value = "bId")
21 | private Integer bId;
22 |
23 | /**
24 | * 书名
25 | */
26 | @JsonProperty(value = "bTitle")
27 | private String bTitle;
28 |
29 | /**
30 | * 书的照片(存地址)
31 | */
32 | @JsonProperty(value = "bPicture")
33 | private String bPicture;
34 |
35 | /**
36 | * 阅读量
37 | */
38 | @JsonProperty(value = "readNum")
39 | private Integer readNum;
40 |
41 | /**
42 | * 点赞量
43 | */
44 | @JsonProperty(value = "goodNum")
45 | private Integer goodNum;
46 |
47 | /**
48 | * 作者
49 | */
50 | private String author;
51 |
52 | /**
53 | * 类型
54 | */
55 | private String cate;
56 |
57 | /**
58 | * 状态(1:上架(且已添加章节),0:下架,2:上架(还没有添加章节))
59 | */
60 | private Integer status;
61 |
62 | /**
63 | * 简介
64 | */
65 | private String introduce;
66 |
67 | /**
68 | * 书籍最后更新时间
69 | */
70 | @JsonProperty(value = "updateTime")
71 | private String updateTime;
72 |
73 | /**
74 | * 书籍url
75 | */
76 | @JsonProperty(value = "bookUrl")
77 | private String bookUrl;
78 |
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/pojo/BookShelfPO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.pojo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @author ZhangLei
10 | * @Description:
11 | * @date 2021/10/14 14:19
12 | */
13 | @Data
14 | @AllArgsConstructor
15 | @NoArgsConstructor
16 | public class BookShelfPO {
17 |
18 | /**
19 | * id
20 | */
21 | @JsonProperty("bsId")
22 | int bsId;
23 |
24 | /**
25 | * 用户id
26 | */
27 | @JsonProperty("uId")
28 | int uId;
29 |
30 | /**
31 | * 章节id
32 | */
33 | @JsonProperty("cId")
34 | int cId;
35 |
36 | /**
37 | * 书籍id
38 | */
39 | @JsonProperty("bId")
40 | int bId;
41 |
42 | /**
43 | * 最后阅读时间
44 | */
45 | @JsonProperty("endTiem")
46 | int endTiem;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/pojo/ChapterPO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.pojo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import javax.management.StandardEmitterMBean;
9 |
10 | /**
11 | * @Author:ZhangLei
12 | */
13 | @Data
14 | @AllArgsConstructor
15 | @NoArgsConstructor
16 | public class ChapterPO {
17 |
18 | /**
19 | * 章节表id
20 | */
21 | @JsonProperty(value = "cId")
22 | Integer cId;
23 |
24 | /**
25 | * 章节标题
26 | */
27 | @JsonProperty(value = "cTitle")
28 | String cTitle;
29 |
30 | /**
31 | * 小说ID
32 | */
33 | @JsonProperty(value = "bId")
34 | Integer bId;
35 |
36 | /**
37 | * 小说章节内容
38 | */
39 | String words;
40 |
41 | /**
42 | * 时间
43 | */
44 | @JsonProperty(value = "eTime")
45 | String eTime;
46 |
47 | /**
48 | * 自定义的字段 book表中的作者字段
49 | */
50 | String author;
51 |
52 | /**
53 | * 章节地址
54 | */
55 | @JsonProperty(value = "chapterUrl")
56 | private String chapterUrl;
57 |
58 | /**
59 | * sort 排序
60 | */
61 | @JsonProperty(value = "sort")
62 | private Integer sort;
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/pojo/TypePO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.pojo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class TypePO {
15 |
16 |
17 | /**
18 | * Integer驼峰命名必须加次注解,不然拿不到值
19 | * id,主键
20 | */
21 | @JsonProperty(value = "tId")
22 | private Integer tId;
23 |
24 | /**
25 | * 分类名,
26 | */
27 | private String cate;
28 |
29 | /**
30 | * 备用
31 | */
32 | private String remark;
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/pojo/UserPO.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.pojo;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class UserPO {
15 |
16 |
17 | /**
18 | * 主键
19 | */
20 | @JsonProperty(value = "uId")
21 | private Integer uId;
22 |
23 | /**
24 | * 账号,唯一
25 | */
26 | @JsonProperty(value = "uAccount")
27 | private String uAccount;
28 |
29 | /**
30 | * 密码
31 | */
32 | @JsonProperty(value = "uPassword")
33 | private String uPassword;
34 |
35 | /**
36 | * 性别(1:男,0:女)
37 | */
38 | private Integer sex;
39 |
40 | /**
41 | * 状态(1:正常,0:注销)
42 | */
43 | private Integer status;
44 |
45 | /**
46 | * 手机号,11位数字
47 | */
48 | private String phone;
49 |
50 | /**
51 | * 邮箱
52 | */
53 | private String email;
54 |
55 | /**
56 | * 备用字段2
57 | */
58 | private String remark2;
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/AfAdminService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after;
2 |
3 | import zl.readCloud.pojo.AdminPO;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @Author:ZhangLei
9 | */
10 | public interface AfAdminService {
11 | /**
12 | * detail: 展示所有管理员
13 | * @return List
14 | */
15 | List showAll();
16 |
17 |
18 | /**
19 | * detail: 添加管理员
20 | * @param admin
21 | * @return admin
22 | */
23 | int addOne(AdminPO admin);
24 |
25 | /**
26 | * detail: 管理员登录验证
27 | * @param admin
28 | * @return admin
29 | */
30 | AdminPO showOne(AdminPO admin);
31 |
32 | /**
33 | * detail: 删除管理员
34 | * @param account
35 | * @return int
36 | */
37 | int deleteByAccount(String account);
38 |
39 | /**
40 | * detail: 修改密码操作:
41 | * 第一步,showOne,验证通过后,才可以修改密码
42 | * 第二步,根据已登录的用户名修改密码
43 | * @param password
44 | * @param account
45 | * @return int
46 | */
47 | int updateByUAccount(String password, String account);
48 |
49 | /**
50 | * detail: 查找管理员
51 | * @param account
52 | * @return Admin
53 | */
54 | AdminPO showByAccount(String account);
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/AfBannerService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after;
2 |
3 | import org.apache.ibatis.annotations.Delete;
4 | import org.apache.ibatis.annotations.Insert;
5 | import org.apache.ibatis.annotations.Update;
6 | import zl.readCloud.controller.after.dto.BannerDTO;
7 | import zl.readCloud.pojo.BannerPO;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author ZhangLei
13 | * @Description:
14 | * @date 2021/10/14 11:19
15 | */
16 | public interface AfBannerService {
17 |
18 | /**
19 | * 拉取banner列表
20 | */
21 | List getBannerList(Integer pages, Integer limit);
22 |
23 | /**
24 | * 拉取banner列表条数
25 | */
26 | Integer getBannerListCount();
27 |
28 | /**
29 | * 添加banner
30 | */
31 | @Insert("insert into banner values (null,#{baPicture},#{bId},#{startDt},#{endDt},#{baLevel})")
32 | int addBanner(BannerPO banner);
33 |
34 | /**
35 | * 更新banner信息
36 | */
37 | @Update("update banner baPicture = #{baPicture}, bId = #{bId}, start_dt = #{startDt}, end_dt = #{endDt}, ba_level = #{baLevel} set where baId = #{baId}")
38 | int updateBanner(BannerPO banner);
39 |
40 | /**
41 | * 删除banner信息
42 | */
43 | @Delete("delete from banner where baId = #{baId}")
44 | int deleteBanner(int baId);
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/AfBookService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after;
2 |
3 | import zl.readCloud.pojo.BookPO;
4 | import zl.readCloud.pojo.ChapterPO;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | public interface AfBookService {
12 |
13 |
14 | /**
15 | * 查所有
16 | * @return List
17 | */
18 | List showAllItem();
19 |
20 | /**
21 | * detail: 展示一页书籍,分页展示
22 | * @param pages
23 | * @param limit
24 | * @return List
25 | */
26 | List showAll(Integer pages, Integer limit);
27 |
28 | /**
29 | * detail: 添加书籍
30 | * @param book
31 | * @return int
32 | */
33 | int addOne(BookPO book);
34 |
35 | /**
36 | * detail: 修改书籍最后更新时间
37 | * @param bId
38 | * @param updateTime
39 | * @return int
40 | */
41 | int updateByBId(Integer bId,String updateTime);
42 |
43 | /**
44 | * detail: 删除书籍,改变状态
45 | * @param bId
46 | * @param status
47 | * @return int
48 | */
49 | int deleteById(Integer bId, Integer status);
50 |
51 | /**
52 | * detail: 编辑书籍,改变状态
53 | * @param book
54 | * @return int
55 | */
56 | int updateOne(BookPO book);
57 |
58 | /**
59 | * detail: 查看书籍,多条件筛选
60 | * @param book
61 | * @return List
62 | */
63 | List showScreen(BookPO book);
64 |
65 | /**
66 | * detail: 添加一章内容
67 | * @param chapter
68 | * @return int
69 | */
70 | int addChap(ChapterPO chapter);
71 |
72 | /**
73 | * detail: 查询一本书的所有章节
74 | * @param bId
75 | * @return int
76 | */
77 | List showByBId(Integer bId);
78 |
79 | /**
80 | * detail: 根据书名,查询
81 | * @param bTitle
82 | * @return List
83 | */
84 | BookPO showByBTitle(String bTitle);
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/AfChapterService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after;
2 |
3 | import zl.readCloud.pojo.ChapterPO;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @Author:ZhangLei
9 | */
10 | public interface AfChapterService {
11 |
12 |
13 | /**
14 | * 根据书名,连表查询 作者列,章节列,和章节内容列
15 | */
16 | List showByBTitle(String bTitle, String index);
17 |
18 | /**
19 | * 根据书章节标题,更新内容
20 | */
21 | int updateByCTitle(String cTitle, String words);
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/AfTypeService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after;
2 |
3 | import zl.readCloud.pojo.TypePO;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @Author:ZhangLei
9 | */
10 | public interface AfTypeService {
11 |
12 |
13 | /**
14 | * detail: 添加一个分类
15 | * @param cate
16 | * @return int
17 | */
18 | int addType(String cate);
19 |
20 | /**
21 | * detail: 展示所有分类
22 | * @param
23 | * @return List
24 | */
25 | List showAll();
26 |
27 | /**
28 | * detail: 搜索分类
29 | * @param cate
30 | * @return Type
31 | */
32 | TypePO showByType(String cate);
33 |
34 | /**
35 | * detail: 更新分类名
36 | * @param type
37 | * @return int
38 | */
39 | int updateById(TypePO type);
40 |
41 | /**
42 | * detail: 删除一个分类
43 | * @param tId
44 | * @return int
45 | */
46 | int deleteById(Integer tId);
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/AfUserService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after;
2 |
3 | import zl.readCloud.pojo.UserPO;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @Author:ZhangLei
9 | */
10 | public interface AfUserService {
11 |
12 |
13 | /**
14 | * detail: 展示所有用户
15 | * @param
16 | * @return List
17 | */
18 | List showAllItem();
19 |
20 | /**
21 | * detail: 分页展示用户,每页用户的数据
22 | * @param pages
23 | * @param limit
24 | * @return List
25 | */
26 | List showAll(Integer pages, Integer limit);
27 |
28 | /**
29 | * detail: 根据id查寻用户
30 | * @param uAccount
31 | * @return User
32 | */
33 | List showByUAccount(String uAccount);
34 |
35 | /**
36 | * detail: 注销用户,和启用用户
37 | * @param uId
38 | * @param status
39 | * @return int
40 | */
41 | int deleteById(Integer uId,Integer status);
42 |
43 | /**
44 | * detail: 批量注销用户
45 | * @param uIds
46 | * @return int
47 | */
48 | int deleteByIds(Integer[] uIds);
49 |
50 | /**
51 | * detail: 验证用户,账号和密码
52 | * @param uAccount
53 | * @param uPassword
54 | * @return int
55 | */
56 | UserPO showOne(String uAccount, String uPassword);
57 |
58 | /**
59 | * detail: 修改密码操作:
60 | * 第一步,showOne,验证通过后,才可以修改密码
61 | * 第二步,根据已登录的用户名修改密码
62 | * @param uPassword
63 | * @param uAccount
64 | * @return int
65 | */
66 | int updateByUAccount(String uPassword,String uAccount);
67 |
68 | /**
69 | * detail: 添加用户
70 | * @param user
71 | * @return int
72 | */
73 | int addOne(UserPO user);
74 |
75 | /**
76 | * detail: 编辑用户基本信息
77 | * @param user
78 | * @return int
79 | */
80 | int updateById(UserPO user);
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/Impl/AfAdminServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.AdminDao;
5 | import zl.readCloud.pojo.AdminPO;
6 | import zl.readCloud.service.after.AfAdminService;
7 |
8 | import javax.annotation.Resource;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | @Service
15 | public class AfAdminServiceImpl implements AfAdminService {
16 |
17 |
18 | @Resource
19 | private AdminDao adminDao;
20 |
21 | /**
22 | * detail: 展示所有管理员
23 | * @return List
24 | */
25 | @Override
26 | public List showAll(){
27 | return adminDao.showAll();
28 | }
29 |
30 | /**
31 | * detail: 添加管理员
32 | * @param admin
33 | * @return admin
34 | */
35 | @Override
36 | public int addOne(AdminPO admin){
37 | return adminDao.addOne(admin);
38 | }
39 |
40 | /**
41 | * detail: 管理员登录验证
42 | * @param admin
43 | * @return admin
44 | */
45 | @Override
46 | public AdminPO showOne(AdminPO admin) {
47 | return adminDao.showOne(admin);
48 | }
49 |
50 |
51 | /**
52 | * detail: 修改密码操作:
53 | * 第一步,showOne,验证通过后,才可以修改密码
54 | * 第二步,根据已登录的用户名修改密码
55 | *
56 | * @param password
57 | * @param account
58 | * @return int
59 | */
60 | @Override
61 | public int updateByUAccount(String password, String account) {
62 | return adminDao.updateByUAccount(password,account);
63 | }
64 |
65 | @Override
66 | public AdminPO showByAccount(String account) {
67 | return adminDao.showByAccount(account);
68 | }
69 |
70 | /**
71 | * detail: 删除管理员,只改变状态
72 | * @param account
73 | * @return int
74 | */
75 | @Override
76 | public int deleteByAccount(String account){
77 | return adminDao.deleteByAccount(account);
78 | }
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/Impl/AfBannerServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after.Impl;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Service;
5 | import zl.readCloud.dao.BannerDao;
6 | import zl.readCloud.controller.after.dto.BannerDTO;
7 | import zl.readCloud.pojo.BannerPO;
8 | import zl.readCloud.service.after.AfBannerService;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author ZhangLei
14 | * @Description:
15 | * @date 2021/10/14 11:20
16 | */
17 | @Service
18 | public class AfBannerServiceImpl implements AfBannerService {
19 |
20 | @Autowired
21 | private BannerDao bannerDao;
22 |
23 |
24 | @Override
25 | public List getBannerList(Integer pages, Integer limit) {
26 | return bannerDao.getBannerList(pages, limit);
27 | }
28 |
29 | @Override
30 | public Integer getBannerListCount() {
31 | return bannerDao.getBannerListCount();
32 | }
33 |
34 | @Override
35 | public int addBanner(BannerPO banner) {
36 | return bannerDao.addBanner(banner);
37 | }
38 |
39 | @Override
40 | public int updateBanner(BannerPO banner) {
41 | return bannerDao.updateBanner(banner);
42 | }
43 |
44 | @Override
45 | public int deleteBanner(int baId) {
46 | return bannerDao.deleteBanner(baId);
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/Impl/AfBookServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.BookDao;
5 | import zl.readCloud.dao.ChapterDao;
6 | import zl.readCloud.pojo.BookPO;
7 | import zl.readCloud.pojo.ChapterPO;
8 | import zl.readCloud.service.after.AfBookService;
9 |
10 | import javax.annotation.Resource;
11 | import java.util.List;
12 |
13 | /**
14 | * @Author:ZhangLei
15 | */
16 | @Service
17 | public class AfBookServiceImpl implements AfBookService {
18 |
19 |
20 | @Resource
21 | BookDao bookDao;
22 |
23 | @Resource
24 | ChapterDao chapterDao;
25 |
26 | @Override
27 | public List showAllItem() {
28 | return bookDao.showAllItem();
29 | }
30 |
31 | @Override
32 | public List showAll(Integer pages, Integer limit) {
33 | return bookDao.showAll(pages,limit);
34 | }
35 |
36 | @Override
37 | public int addOne(BookPO book) {
38 | return bookDao.addOne(book);
39 | }
40 |
41 | @Override
42 | public int updateByBId(Integer bId, String updateTime) {
43 | return bookDao.updateByBId(bId,updateTime);
44 | }
45 |
46 | @Override
47 | public int deleteById(Integer bId, Integer status) {
48 | return bookDao.deleteById(bId,status);
49 | }
50 |
51 | @Override
52 | public int updateOne(BookPO book) {
53 | return bookDao.updateOne(book);
54 | }
55 |
56 |
57 | @Override
58 | public List showScreen(BookPO book) {
59 | return bookDao.showScreen(book);
60 | }
61 |
62 | @Override
63 | public int addChap(ChapterPO chapter) {
64 | return chapterDao.addChap(chapter);
65 | }
66 |
67 | @Override
68 | public List showByBId(Integer bId) {
69 | return chapterDao.showByBId(bId);
70 | }
71 |
72 | @Override
73 | public BookPO showByBTitle(String bTitle) {
74 | return bookDao.showByBTitle(bTitle);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/Impl/AfChapterServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.ChapterDao;
5 | import zl.readCloud.pojo.ChapterPO;
6 | import zl.readCloud.service.after.AfChapterService;
7 |
8 | import javax.annotation.Resource;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | @Service
15 | public class AfChapterServiceImpl implements AfChapterService {
16 |
17 |
18 | @Resource
19 | ChapterDao chapterDao;
20 |
21 | @Override
22 | public List showByBTitle(String bTitle, String index) {
23 | return chapterDao.showByBTitle(bTitle, index);
24 | }
25 |
26 | @Override
27 | public int updateByCTitle(String cTitle, String words) {
28 | return chapterDao.updateByCTitle(cTitle, words);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/Impl/AfTypeServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.TypeDao;
5 | import zl.readCloud.pojo.TypePO;
6 | import zl.readCloud.service.after.AfTypeService;
7 |
8 | import javax.annotation.Resource;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | @Service
15 | public class AfTypeServiceImpl implements AfTypeService {
16 |
17 |
18 | @Resource
19 | TypeDao typeDao;
20 |
21 | @Override
22 | public int addType(String cate) {
23 | return typeDao.addType(cate);
24 | }
25 |
26 | @Override
27 | public List showAll() {
28 | return typeDao.showAll();
29 | }
30 |
31 | @Override
32 | public TypePO showByType(String cate) {
33 | return typeDao.showByType(cate);
34 | }
35 |
36 | @Override
37 | public int updateById(TypePO type) {
38 | return typeDao.updateById(type);
39 | }
40 |
41 | @Override
42 | public int deleteById(Integer tId) {
43 | return typeDao.deleteById(tId);
44 | }
45 |
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/after/Impl/AfUserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.after.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.UserDao;
5 | import zl.readCloud.pojo.UserPO;
6 | import zl.readCloud.service.after.AfUserService;
7 |
8 | import javax.annotation.Resource;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | @Service
15 | public class AfUserServiceImpl implements AfUserService {
16 |
17 |
18 | @Resource
19 | UserDao userDao;
20 |
21 |
22 | @Override
23 | public List showAllItem() {
24 | return userDao.showAllItem();
25 | }
26 |
27 | @Override
28 | public List showAll(Integer pages, Integer limit) {
29 | return userDao.showAll(pages, limit);
30 | }
31 |
32 |
33 | @Override
34 | public List showByUAccount(String uAccount) {
35 | return userDao.showByUAccount(uAccount);
36 | }
37 |
38 | @Override
39 | public int deleteById(Integer uId, Integer status) {
40 | return userDao.deleteById(uId,status);
41 | }
42 |
43 | @Override
44 | public int deleteByIds(Integer[] uIds) {
45 | return userDao.deleteByIds(uIds);
46 | }
47 |
48 | @Override
49 | public UserPO showOne(String uAccount, String uPassword) {
50 | return userDao.showOne(uAccount,uPassword);
51 | }
52 |
53 | @Override
54 | public int updateByUAccount(String uPassword, String uAccount) {
55 | return userDao.updateByUAccount(uPassword,uAccount);
56 | }
57 |
58 | @Override
59 | public int addOne(UserPO user) {
60 | return userDao.addOne(user);
61 | }
62 |
63 | @Override
64 | public int updateById(UserPO user) {
65 | return userDao.updateById(user);
66 | }
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/crawler/Impl/UpdateBookImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.crawler.Impl;
2 |
3 | import org.jsoup.nodes.Document;
4 | import org.jsoup.nodes.Element;
5 | import org.jsoup.select.Elements;
6 | import org.springframework.scheduling.annotation.Async;
7 | import org.springframework.stereotype.Service;
8 | import zl.readCloud.dao.BookDao;
9 | import zl.readCloud.dao.ChapterDao;
10 | import zl.readCloud.pojo.BookPO;
11 | import zl.readCloud.pojo.ChapterPO;
12 | import zl.readCloud.service.after.AfBookService;
13 | import zl.readCloud.service.crawler.UpdateBook;
14 | import zl.readCloud.utils.DateUtils;
15 | import zl.readCloud.utils.JsoupUtil;
16 |
17 | import javax.annotation.Resource;
18 | import java.util.List;
19 |
20 | /**
21 | * @author ZhangLei
22 | * @Description:
23 | * @date 2021/11/15 9:46
24 | */
25 | @Service
26 | public class UpdateBookImpl implements UpdateBook {
27 |
28 | @Resource
29 | private ChapterDao chapterDao;
30 |
31 | @Resource
32 | private BookDao bookDao;
33 |
34 | @Resource
35 | private AfBookService afBookService;
36 |
37 | /**
38 | * 系统调度 定时更新小说 此处开启了事务
39 | *
40 | * @param bId
41 | * @param bookUrl
42 | */
43 | @Async
44 | @Override
45 | public void updateBook(int bId, String bookUrl) {
46 |
47 | BookPO bookPO = bookDao.showBookByBId(bId);
48 | // 获取章节
49 | List list = chapterDao.showByBId(bId);
50 | // 现有小说章节的数量
51 | int catLength = list.size();
52 | // 获取url页面数据
53 | Document doc = JsoupUtil.getDoc(bookUrl);
54 | //获取章节内容
55 | Elements elements = doc.select("dd>a");
56 | // 上面的12个为,最新章节,,减掉它们
57 | int elnLength = elements.size() - 12;
58 | // 现有小说章节的数量 跟 网页的小说章节的数量
59 | if (catLength != elnLength) {
60 | // 现有小说章节的数量为0
61 | if (catLength == 0) {
62 | // 用来排序
63 | int sort = 1;
64 | // 帮助跳过前12个最新章节
65 | int cot = 0;
66 | ChapterPO chapterPO = new ChapterPO();
67 | for (Element element : elements) {
68 | if (cot < 12) {
69 | cot++;
70 | continue;
71 | }
72 | // 获取绝对路径url
73 | String url = element.attr("abs:href");
74 | Document document = JsoupUtil.getDoc(url);
75 | // 章节标题
76 | String title = document.select("h1").text();
77 | // 章节内容
78 | String text = document.getElementById("content").html();
79 | String date = DateUtils.getCurrentTime();
80 | chapterPO.setBId(bId);
81 | chapterPO.setCTitle(title);
82 | chapterPO.setWords(text);
83 | chapterPO.setETime(date);
84 | System.out.println(url);
85 | chapterPO.setChapterUrl(url);
86 | chapterPO.setSort(sort);
87 | // 保存小说内容
88 | chapterDao.addChap(chapterPO);
89 | afBookService.updateByBId(bId, date);
90 | System.out.println("重新抓取小说:" + title);
91 | sort++;
92 | }
93 | } else {
94 | //有更新
95 | ChapterPO chapterPO = new ChapterPO();
96 | int i = elements.size() - catLength - 12;
97 | System.out.println(bookPO.getBTitle() + "最新章节有:" + i + "章");
98 | int sort = catLength + 1;
99 | //最新章节下标
100 | int k = catLength + 12;
101 | // Chapter chapter=new Chapter();
102 | for (int j = 0; j < i; j++) {
103 | String date = DateUtils.getCurrentTime();
104 | String url = elements.get(k).attr("abs:href");
105 | Document document = JsoupUtil.getDoc(url);
106 | //章节标题
107 | String title = document.select("h1").text();
108 | //章节内容
109 | String text = document.getElementById("content").html();
110 | chapterPO.setCTitle(title);
111 | chapterPO.setChapterUrl(url);
112 | chapterPO.setWords(text);
113 | chapterPO.setBId(bId);
114 | chapterPO.setETime(date);
115 | chapterPO.setSort(sort);
116 | k++;
117 | sort++;//排序
118 | // 保存小说内容
119 | chapterDao.addChap(chapterPO);
120 | afBookService.updateByBId(bId, date);
121 | }
122 | }
123 | } else {
124 | System.out.println(bookPO.getBTitle() + "小说已经是最新");
125 | }
126 |
127 | }
128 |
129 | @Override
130 | public int getBookList(String cTitle) {
131 |
132 | return 0;
133 | }
134 |
135 |
136 | }
137 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/crawler/UpdateBook.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.crawler;
2 |
3 | /**
4 | * @author ZhangLei
5 | * @Description:
6 | * @date 2021/11/15 9:45
7 | */
8 | public interface UpdateBook {
9 |
10 | /**
11 | * 更新数据库中的小说
12 | */
13 | void updateBook(int bId, String bookUrl);
14 |
15 | /**
16 | * 搜索功能,查不到时,去爬取网站的小说
17 | */
18 | int getBookList(String cTitle);
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/FrDetailsService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front;
2 |
3 |
4 | import zl.readCloud.pojo.BookPO;
5 | import zl.readCloud.pojo.ChapterPO;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @Author:ZhangLei
11 | */
12 | public interface FrDetailsService {
13 |
14 |
15 | /**
16 | * detail: 展示一本书的所有详情信息
17 | * @param
18 | * @return List
19 | */
20 | BookPO showBookByBId(Integer bId);
21 |
22 | /**
23 | * detail: 展示一本书的所有章节
24 | * @param
25 | * @return List
26 | */
27 | List showChapterByBId(Integer bId);
28 |
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/FrIndexService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front;
2 |
3 |
4 | import zl.readCloud.controller.after.dto.BannerDTO;
5 | import zl.readCloud.pojo.BannerPO;
6 | import zl.readCloud.pojo.BookPO;
7 | import zl.readCloud.pojo.TypePO;
8 | import zl.readCloud.controller.after.dto.BookChapterDTO;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @Author:ZhangLei
14 | */
15 | public interface FrIndexService {
16 |
17 |
18 | /**
19 | * detail: 展示所有分类:展示在页面头部的分类导航
20 | * @param
21 | * @return List
22 | */
23 | List showTypeAll();
24 |
25 | /**
26 | * detail: 热门推荐:从阅读量排序中取前6,在点赞量排序中取前6,合并两个list集合
27 | * @param
28 | * @return List
29 | */
30 | List showByHotRec(String cate);
31 |
32 | /**
33 | * detail: 查询最后更新的两本书各自的最后一章数据
34 | * @param: num
35 | * @return List
36 | */
37 | List showLastUpdate(Integer num, String cate);
38 |
39 | /**
40 | * detail: 查询最近上架的图书,阅读量为0,状态为1(含有章节)
41 | * @param
42 | * @return List
43 | */
44 | List showLastUpdateBook(Integer num);
45 |
46 | /**
47 | * 查询banner
48 | */
49 | List getBannerList2(String nowDate);
50 |
51 | /**
52 | * 模糊查询
53 | */
54 | List showBTitleByLike(String bTitle);
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/FrLoginService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front;
2 |
3 | import zl.readCloud.pojo.UserPO;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @Author:ZhangLei
9 | */
10 | public interface FrLoginService {
11 |
12 |
13 | /**
14 | * detail: 根据账号查寻用户
15 | * @param uAccount
16 | * @return User
17 | */
18 | UserPO showOne(String uAccount, String uPassword);
19 |
20 | /**
21 | * detail: 添加用户
22 | * @param user
23 | * @return int
24 | */
25 | int addOne(UserPO user);
26 |
27 | /**
28 | * detail: 根据账号查寻用户
29 | * @param uAccount
30 | * @return User
31 | */
32 | List showByUAccount(String uAccount);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/FrReadingService.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front;
2 |
3 |
4 | import zl.readCloud.controller.after.dto.BookChapterDTO;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | public interface FrReadingService {
12 |
13 |
14 | /**
15 | * detail: 精确查询一章
16 | * @param bId
17 | * @param cTitle
18 | * @return List
19 | */
20 | List showReadingChapter(Integer bId, String cTitle);
21 |
22 | /**
23 | * detail: 查询上一章或下一章
24 | * 动态sql,根据参数(compare),为空 max(t.eTime) <
25 | * 不为空min(t.eTime) >
26 | * @param bId
27 | * @param eTime
28 | * @param compare
29 | * @return List
30 | */
31 | List showNextOrPrevious(Integer bId, String eTime, String compare);
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/Impl/FrDetailsServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.BookDao;
5 | import zl.readCloud.dao.ChapterDao;
6 | import zl.readCloud.pojo.BookPO;
7 | import zl.readCloud.pojo.ChapterPO;
8 | import zl.readCloud.service.front.FrDetailsService;
9 |
10 | import javax.annotation.Resource;
11 | import java.util.List;
12 |
13 | /**
14 | * @Author:ZhangLei
15 | */
16 | @Service
17 | public class FrDetailsServiceImpl implements FrDetailsService {
18 |
19 |
20 | @Resource
21 | BookDao bookDao;
22 |
23 | @Resource
24 | ChapterDao chapterDao;
25 |
26 | @Override
27 | public BookPO showBookByBId(Integer bId) {
28 | return bookDao.showBookByBId(bId);
29 | }
30 |
31 | @Override
32 | public List showChapterByBId(Integer bId) {
33 | return chapterDao.showByBId(bId);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/Impl/FrIndexServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.controller.after.dto.BannerDTO;
5 | import zl.readCloud.dao.BannerDao;
6 | import zl.readCloud.dao.BookDao;
7 | import zl.readCloud.dao.TypeDao;
8 | import zl.readCloud.pojo.BannerPO;
9 | import zl.readCloud.pojo.BookPO;
10 | import zl.readCloud.pojo.TypePO;
11 | import zl.readCloud.service.front.FrIndexService;
12 | import zl.readCloud.controller.after.dto.BookChapterDTO;
13 |
14 | import javax.annotation.Resource;
15 | import java.util.List;
16 |
17 | /**
18 | * @Author:ZhangLei
19 | */
20 | @Service
21 | public class FrIndexServiceImpl implements FrIndexService {
22 |
23 |
24 | @Resource
25 | TypeDao typeDao;
26 |
27 | @Resource
28 | BookDao bookDao;
29 |
30 | @Resource
31 | BannerDao bannerDao;
32 |
33 | @Override
34 | public List showTypeAll() {
35 | return typeDao.showAll();
36 | }
37 |
38 | @Override
39 | public List showByHotRec(String cate) {
40 | List list = bookDao.showByReadNum(cate);
41 | List list2 = bookDao.showByGoodNum(cate);
42 | list.addAll(list2);
43 | return list;
44 | }
45 |
46 | @Override
47 | public List showLastUpdate(Integer num, String cate) {
48 | return bookDao.showLastUpdate(num,cate);
49 | }
50 |
51 | @Override
52 | public List showLastUpdateBook(Integer num) {
53 | return bookDao.showLastUpdateBook(num);
54 | }
55 |
56 | @Override
57 | public List getBannerList2(String nowDate) {
58 | return bannerDao.getBannerList2(nowDate);
59 | }
60 |
61 | @Override
62 | public List showBTitleByLike(String bTitle) {
63 | return bookDao.showBTitleByLike(bTitle);
64 | }
65 |
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/Impl/FrLoginServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.UserDao;
5 | import zl.readCloud.pojo.UserPO;
6 | import zl.readCloud.service.front.FrLoginService;
7 |
8 | import javax.annotation.Resource;
9 | import java.util.List;
10 |
11 | /**
12 | * @Author:ZhangLei
13 | */
14 | @Service
15 | public class FrLoginServiceImpl implements FrLoginService {
16 |
17 |
18 | @Resource
19 | UserDao userDao;
20 |
21 | @Override
22 | public UserPO showOne(String uAccount, String uPassword) {
23 | return userDao.showOne(uAccount,uPassword);
24 | }
25 |
26 | @Override
27 | public int addOne(UserPO user) {
28 | return userDao.addOne(user);
29 | }
30 |
31 | @Override
32 | public List showByUAccount(String uAccount) {
33 | return userDao.showByUAccount(uAccount);
34 | }
35 |
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/service/front/Impl/FrReadingServiceImpl.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.service.front.Impl;
2 |
3 | import org.springframework.stereotype.Service;
4 | import zl.readCloud.dao.BookDao;
5 | import zl.readCloud.dao.ChapterDao;
6 | import zl.readCloud.service.front.FrReadingService;
7 | import zl.readCloud.controller.after.dto.BookChapterDTO;
8 |
9 | import javax.annotation.Resource;
10 | import java.util.List;
11 |
12 | /**
13 | * @Author:ZhangLei
14 | */
15 | @Service
16 | public class FrReadingServiceImpl implements FrReadingService {
17 |
18 |
19 | @Resource
20 | BookDao bookDao;
21 |
22 | @Resource
23 | ChapterDao chapterDao;
24 |
25 | @Override
26 | public List showReadingChapter(Integer bId, String cTitle) {
27 | return bookDao.showReadingChapter(bId,cTitle);
28 | }
29 |
30 | @Override
31 | public List showNextOrPrevious(Integer bId, String eTime, String compare) {
32 | return chapterDao.showNextOrPrevious(bId,eTime,compare);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/task/UpdateBookTask.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.task;
2 |
3 | /**
4 | * @author ZhangLei
5 | * @Description:
6 | * @date 2021/11/11 18:53
7 | */
8 | public class UpdateBookTask implements Runnable {
9 |
10 | public UpdateBookTask() {
11 |
12 | }
13 |
14 | @Override
15 | public void run() {
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/utils/DateUtils.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.utils;
2 |
3 | import org.springframework.stereotype.Component;
4 | import org.springframework.util.StringUtils;
5 |
6 | import java.text.ParseException;
7 | import java.text.SimpleDateFormat;
8 | import java.util.*;
9 |
10 | /**
11 | * @author ZhangLei
12 | * @Description: 日期工具类
13 | */
14 | @Component
15 | public class DateUtils {
16 |
17 | /**
18 | * 获得当前日期 yyyy-MM-dd HH:mm:ss.SSS
19 | *
20 | * @return 2019-08-27 14:12:40.019
21 | */
22 | public static String getCurrentTime() {
23 | // 小写的hh取得12小时,大写的HH取的是24小时
24 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
25 | Date date = new Date();
26 | return df.format(date);
27 | }
28 |
29 | /**
30 | * 获取系统当前时间戳
31 | *
32 | * @return 1566889186583
33 | */
34 | public static String getSystemTime() {
35 | String current = String.valueOf(System.currentTimeMillis());
36 | return current;
37 | }
38 |
39 |
40 | /**
41 | * 获取当前日期 yy-MM-dd
42 | *
43 | * @return 2019-08-27
44 | */
45 | public static String getDateByString() {
46 | Date date = new Date();
47 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
48 | return sdf.format(date);
49 | }
50 |
51 | /**
52 | * 得到两个时间差 格式yyyy-MM-dd HH:mm:ss
53 | *
54 | * @param start 2019-06-27 14:12:40
55 | * @param end 2019-08-27 14:12:40
56 | * @return 5270400000
57 | */
58 | public static long dateSubtraction(String start, String end) {
59 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
60 | try {
61 | Date date1 = df.parse(start);
62 | Date date2 = df.parse(end);
63 | return date2.getTime() - date1.getTime();
64 | } catch (ParseException e) {
65 | e.printStackTrace();
66 | return 0;
67 | }
68 | }
69 |
70 | /**
71 | * 得到两个时间差
72 | *
73 | * @param start 开始时间
74 | * @param end 结束时间
75 | * @return
76 | */
77 | public static long dateTogether(Date start, Date end) {
78 | return end.getTime() - start.getTime();
79 | }
80 |
81 | /**
82 | * 转化long值的日期为yyyy-MM-dd HH:mm:ss.SSS格式的日期
83 | *
84 | * @param millSec 日期long值 5270400000
85 | * @return 日期,以yyyy-MM-dd HH:mm:ss.SSS格式输出 1970-03-03 08:00:00.000
86 | */
87 | public static String transferLongToDate(String millSec) {
88 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
89 | Date date = new Date(Long.parseLong(millSec));
90 | return sdf.format(date);
91 | }
92 |
93 | /**
94 | * 获得当前日期 yyyy-MM-dd HH:mm:ss
95 | *
96 | * @return
97 | */
98 | public static String getOkDate(String date) {
99 | try {
100 | if (StringUtils.isEmpty(date)) {
101 | return null;
102 | }
103 | Date date1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH).parse(date);
104 | //格式化
105 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
106 | return sdf.format(date1);
107 | } catch (Exception e) {
108 | e.printStackTrace();
109 | }
110 | return null;
111 | }
112 |
113 |
114 | /**
115 | * 获取当前日期是一个星期的第几天
116 | *
117 | * @return 2
118 | */
119 | public static int getDayOfWeek() {
120 | Calendar cal = Calendar.getInstance();
121 | cal.setTime(new Date());
122 | return cal.get(Calendar.DAY_OF_WEEK) - 1;
123 | }
124 |
125 |
126 | /**
127 | * 判断当前时间是否在[startTime, endTime]区间,注意时间格式要一致
128 | *
129 | * @param nowTime 当前时间
130 | * @param dateSection 时间区间 2018-01-08,2019-09-09
131 | * @return
132 | * @author jqlin
133 | */
134 | public static boolean isEffectiveDate(Date nowTime, String dateSection) {
135 | try {
136 | String[] times = dateSection.split(",");
137 | String format = "yyyy-MM-dd";
138 | Date startTime = new SimpleDateFormat(format).parse(times[0]);
139 | Date endTime = new SimpleDateFormat(format).parse(times[1]);
140 | if (nowTime.getTime() == startTime.getTime()
141 | || nowTime.getTime() == endTime.getTime()) {
142 | return true;
143 | }
144 | Calendar date = Calendar.getInstance();
145 | date.setTime(nowTime);
146 |
147 | Calendar begin = Calendar.getInstance();
148 | begin.setTime(startTime);
149 |
150 | Calendar end = Calendar.getInstance();
151 | end.setTime(endTime);
152 |
153 | if (isSameDay(date, begin) || isSameDay(date, end)) {
154 | return true;
155 | }
156 | if (date.after(begin) && date.before(end)) {
157 | return true;
158 | } else {
159 | return false;
160 | }
161 | } catch (Exception e) {
162 | e.printStackTrace();
163 | return false;
164 | }
165 | }
166 |
167 | public static boolean isSameDay(Calendar cal1, Calendar cal2) {
168 | if (cal1 != null && cal2 != null) {
169 | return cal1.get(0) == cal2.get(0) && cal1.get(1) == cal2.get(1) && cal1.get(6) == cal2.get(6);
170 | } else {
171 | throw new IllegalArgumentException("The date must not be null");
172 | }
173 | }
174 |
175 | public static long getTimeByDate(String time) {
176 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
177 | try {
178 | Date date = format.parse(time);
179 | //日期转时间戳(毫秒)
180 | return date.getTime();
181 | } catch (Exception e) {
182 | e.printStackTrace();
183 | return 0;
184 | }
185 | }
186 |
187 | /**
188 | * 获取当前小时 :2019-08-23 17
189 | *
190 | * @return 2019-08-27 17
191 | */
192 | public static String getCurrentHour() {
193 | GregorianCalendar calendar = new GregorianCalendar();
194 | int hour = calendar.get(Calendar.HOUR_OF_DAY);
195 | if (hour < 10) {
196 | return DateUtils.getCurrentTime() + " 0" + hour;
197 | }
198 | return DateUtils.getDateByString() + " " + hour;
199 | }
200 |
201 | /**
202 | * 获取当前时间一个小时前
203 | *
204 | * @return 2019-08-27 16
205 | */
206 | public static String getCurrentHourBefore() {
207 | GregorianCalendar calendar = new GregorianCalendar();
208 | int hour = calendar.get(Calendar.HOUR_OF_DAY);
209 | if (hour > 0) {
210 | hour = calendar.get(Calendar.HOUR_OF_DAY) - 1;
211 | if (hour < 10) {
212 | return DateUtils.getDateByString() + " 0" + hour;
213 | }
214 | return DateUtils.getDateByString() + " " + hour;
215 | }
216 | //获取当前日期前一天
217 | return DateUtils.getBeforeDay() + " " + 23;
218 | }
219 |
220 | /**
221 | * 获取当前日期前一天
222 | *
223 | * @return 2019-08-26
224 | */
225 | public static String getBeforeDay() {
226 |
227 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
228 | Date date = new Date();
229 | Calendar calendar = Calendar.getInstance();
230 | calendar.setTime(date);
231 | calendar.add(Calendar.DAY_OF_MONTH, -1);
232 | date = calendar.getTime();
233 | return sdf.format(date);
234 | }
235 |
236 |
237 | /**
238 | * 获取最近七天
239 | *
240 | * @return 2019-08-20
241 | */
242 | public static String getServen() {
243 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
244 |
245 | Calendar c = Calendar.getInstance();
246 |
247 | c.add(Calendar.DATE, -7);
248 |
249 | Date monday = c.getTime();
250 |
251 | String preMonday = sdf.format(monday);
252 |
253 | return preMonday;
254 | }
255 |
256 | /**
257 | * 获取最近一个月
258 | *
259 | * @return 2019-07-27
260 | */
261 | public static String getOneMonth() {
262 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
263 |
264 | Calendar c = Calendar.getInstance();
265 |
266 | c.add(Calendar.MONTH, -1);
267 |
268 | Date monday = c.getTime();
269 |
270 | String preMonday = sdf.format(monday);
271 |
272 | return preMonday;
273 | }
274 |
275 | /**
276 | * 获取最近三个月
277 | *
278 | * @return 2019-05-27
279 | */
280 | public static String getThreeMonth() {
281 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
282 |
283 | Calendar c = Calendar.getInstance();
284 |
285 | c.add(Calendar.MONTH, -3);
286 |
287 | Date monday = c.getTime();
288 |
289 | String preMonday = sdf.format(monday);
290 |
291 | return preMonday;
292 | }
293 |
294 | /**
295 | * 获取最近一年
296 | *
297 | * @return 2018-08-27
298 | */
299 | public static String getOneYear() {
300 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
301 | Calendar c = Calendar.getInstance();
302 | c.add(Calendar.YEAR, -1);
303 | Date start = c.getTime();
304 | String startDay = sdf.format(start);
305 | return startDay;
306 | }
307 |
308 |
309 | private static int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
310 |
311 | /**
312 | * 获取今年月份数据
313 | * 说明 有的需求前端需要根据月份查询每月数据,此时后台给前端返回今年共有多少月份
314 | *
315 | * @return [1, 2, 3, 4, 5, 6, 7, 8]
316 | */
317 | public static List getMonthList() {
318 | List list = new ArrayList();
319 | for (int i = 1; i <= month; i++) {
320 | list.add(i);
321 | }
322 | return list;
323 | }
324 |
325 | /**
326 | * 返回当前年度季度list
327 | * 本年度截止目前共三个季度,然后根据1,2,3分别查询相关起止时间
328 | *
329 | * @return [1, 2, 3]
330 | */
331 | public static List getQuartList() {
332 | int quart = month / 3 + 1;
333 | List list = new ArrayList();
334 | for (int i = 1; i <= quart; i++) {
335 | list.add(i);
336 | }
337 | return list;
338 | }
339 |
340 | public static void main(String[] args) {
341 | System.out.println(DateUtils.getQuartList());
342 | }
343 | }
344 |
345 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/utils/IpUtil.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.utils;
2 |
3 |
4 | import javax.servlet.http.HttpServletRequest;
5 | import java.net.InetAddress;
6 | import java.net.UnknownHostException;
7 |
8 | /**
9 | * @author ZhangLei
10 | * @Description :
11 | * @Point: Keep a good mood
12 | **/
13 | public class IpUtil {
14 | public static String getIpAddr(HttpServletRequest request) {
15 | String ipAddress = null;
16 | try {
17 | ipAddress = request.getHeader("x-forwarded-for");
18 | if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
19 | ipAddress = request.getHeader("Proxy-Client-IP");
20 | }
21 | if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
22 | ipAddress = request.getHeader("WL-Proxy-Client-IP");
23 | }
24 | if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
25 | ipAddress = request.getRemoteAddr();
26 | if (ipAddress.equals("127.0.0.1")) {
27 | // 根据网卡取本机配置的IP
28 | InetAddress inet = null;
29 | try {
30 | inet = InetAddress.getLocalHost();
31 | } catch (UnknownHostException e) {
32 | e.printStackTrace();
33 | }
34 | ipAddress = inet.getHostAddress();
35 | }
36 | }
37 | // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
38 | if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length()
39 | // = 15
40 | if (ipAddress.indexOf(",") > 0) {
41 | ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
42 | }
43 | }
44 | } catch (Exception e) {
45 | ipAddress="";
46 | }
47 | // ipAddress = this.getRequest().getRemoteAddr();
48 |
49 | return ipAddress;
50 | }
51 | }
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/utils/JsoupUtil.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.utils;
2 |
3 | import org.jsoup.Jsoup;
4 | import org.jsoup.nodes.Document;
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import zl.readCloud.aop.HttpAspect;
8 |
9 | import java.io.IOException;
10 | import java.io.UnsupportedEncodingException;
11 | import java.net.HttpURLConnection;
12 | import java.net.URL;
13 | import java.util.HashMap;
14 | import java.util.Map;
15 |
16 | /**
17 | * @author ZhangLei
18 | * Jsoup 工具类
19 | */
20 | public class JsoupUtil {
21 |
22 | private static final Logger log = LoggerFactory.getLogger(HttpAspect.class);
23 | /**
24 | * @param content
25 | * @return 删除Html标签
26 | */
27 | public static String delHTMLTag(String content) {
28 | content = content.replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
29 |
30 | // 去除字符串中的空格 回车 换行符 制表符 等
31 |
32 | content = content.replaceAll("\\s*|\t|\r|\n", "");
33 |
34 | // 去除空格
35 | content = content.replaceAll(" ", "");
36 |
37 | return content;
38 | }
39 |
40 | /**
41 | * 字符串转化为UTF-8
42 | *
43 | * @param str
44 | * @return
45 | */
46 | public static String toUTF8(String str) {
47 | String result = str;
48 | try {
49 | result = changeCharSet(str, "UTF-8");
50 | } catch (UnsupportedEncodingException e) {
51 | e.printStackTrace();
52 | }
53 | return result;
54 |
55 | }
56 |
57 | /**
58 | * @param str
59 | * @param newCharset
60 | * @return
61 | * @throws UnsupportedEncodingException
62 | */
63 | private static String changeCharSet(String str, String newCharset) throws UnsupportedEncodingException {
64 | if (str != null) {
65 | // 用默认字符编码解码字符串。
66 | byte[] bs = str.getBytes();
67 | // 用新的字符编码生成字符串
68 | return new String(bs, newCharset);
69 | }
70 | return str;
71 | }
72 |
73 | /**
74 | * @param str
75 | * @return
76 | */
77 | public static String sub(String str) {
78 |
79 | if (!str.isEmpty()) {
80 | return str.substring(str.indexOf(":") + 1);
81 | }
82 | return null;
83 | }
84 |
85 | public static String subContent(String str) {
86 |
87 | if (!str.isEmpty()) {
88 | return str.substring(0, str.indexOf("http"));
89 | }
90 | return null;
91 | }
92 |
93 | /**
94 | * 获取链接的document对象
95 | *
96 | * @param url 小说的地址
97 | * @return document
98 | */
99 | public static Document getDoc(String url) {
100 | // Map header = new HashMap();
101 | // // 指定请求的服务器的域名和端口号
102 | // header.put("Host", "http://info.bet007.com");
103 | // // 客户端使用的操作系统和浏览器的名称和版本响应头 User-Agent的内容包含发出请求的用户信息
104 | // header.put("User-Agent", " Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0");
105 | // // 客户端能接收的资源类型
106 | // header.put("Accept", " text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
107 | // // 浏览器可接受的语言
108 | // header.put("Accept-Language", "zh-cn,zh;q=0.5");
109 | // // 浏览器可以接受的字符编码集。
110 | // header.put("Accept-Charset", " GB2312,utf-8;q=0.7,*;q=0.7");
111 | // // keep-alive 当一个网页打开完成后,客户端和服务器之间用于传输HTTP数据的TCP连接不会关闭,如果客户端再次访问这个服务器上的网页,
112 | // // 会继续使用这一条已经建立的连接 Connection: close 代表一个Request完成后,客户端和服务器之间用于传输HTTP数据的TCP连接会关闭,
113 | // // 当客户端再次发送Request,需要重新建立TCP连接。
114 | // // 表示是否需要持久连接。
115 | // header.put("Connection", "keep-alive");
116 | boolean flag = false;
117 | Document document = null;
118 | int i=0;
119 | do {
120 | try {
121 | document = Jsoup
122 | .connect(url)
123 | .header("Host","www.shuquge.com")
124 | .header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
125 | // 指定浏览器可以支持的web服务器返回内容压缩编码类型。
126 | .header("Accept-Encoding","gzip, deflate")
127 | .header("Accept-Language","zh-CN,zh;q=0.9")
128 | // 指定请求和响应遵循的缓存机制
129 | .header("Cache-Control","no-cache")
130 | .header("Connection","keep-alive")
131 | // 用来包含实现特定的指令 pragma是http/1.1之前版本的历史遗留字段,仅作为与http的向后兼容而定义。
132 | .header("Pragma","no-cache")
133 | // 在https页面中,如果调用了http资源,那么浏览器就会抛出一些错误。为了改变成这一状况,
134 | // chrome(谷歌浏览器)会在http请求中加入 'Upgrade-Insecure-Requests: 1' ,服务器收到请求后
135 | // 会返回 "Content-Security-Policy: upgrade-insecure-requests" 头,告诉浏览器,可以把所属本站
136 | // 的所有 http 连接升级为 https 连接。
137 | .header("Upgrade-Insecure-Requests","1")
138 | .timeout(5000)
139 | .userAgent("Mozilla")//模拟浏览器
140 | .get();
141 | flag = false;
142 | } catch (IOException e) {
143 | i++;
144 | log.info("获取html失败了"+i+"次");
145 | flag = true;
146 | }
147 | } while (flag);
148 | return document;
149 | }
150 |
151 | // public static void main(String[] args) {
152 | // Document doc = getDoc("http://www.shuquge.com/txt/8659/33435905.html");
153 | // System.out.println("doc = " + doc);
154 | // }
155 |
156 | public static boolean isConnection(String url) {
157 | boolean flag = false;
158 | int counts = 0;
159 | if (null == url || url.length() <= 0) {
160 | return flag;
161 | }
162 | while (counts < 10) {
163 | try {
164 | HttpURLConnection connection = (HttpURLConnection) new URL(url)
165 | .openConnection();
166 | int state = connection.getResponseCode();
167 | if (state == 200) {
168 | flag = true;
169 | }
170 | break;
171 | } catch (Exception e) {
172 | counts++;
173 | continue;
174 | }
175 | }
176 | return flag;
177 | }
178 |
179 | }
180 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/utils/Result.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.utils;
2 |
3 | import lombok.Data;
4 | import org.springframework.http.HttpStatus;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * @Author:ZhangLei
10 | */
11 | @Data
12 | public class Result implements Serializable {
13 |
14 |
15 | private static final long serialVersionUID = -1802122468331526708L;
16 |
17 | public static final Integer SUCCESS = 200;
18 | public static final Integer COLLAPSE = 500;
19 | public static final Integer NULL = -1;
20 |
21 | /**
22 | * 状态码
23 | */
24 | private Integer code;
25 | /**
26 | * 提示信息
27 | */
28 | private String msg;
29 | /**
30 | * 总记录数
31 | */
32 | private Integer count;
33 | /**
34 | * 返回数据
35 | */
36 | private Object data;
37 |
38 |
39 |
40 | /**
41 | * 自定义code,msg,data,count
42 | * 返回所有
43 | */
44 | public Result(Integer code, String msg, Integer count, Object data) {
45 | this.code = code;
46 | this.msg = msg;
47 | this.count = count;
48 | this.data = data;
49 | }
50 |
51 | /**
52 | * 自定义data
53 | * 只传入数据,自动获取状态码和提示信息
54 | */
55 | private Result(Object data) {
56 | this.data = data;
57 | this.code = HttpStatus.OK.value();
58 | this.msg = HttpStatus.OK.getReasonPhrase();
59 | }
60 |
61 | /**
62 | * 自定义data,count
63 | * 只传入数据和总记录条数,自动获取状态码和提示信息
64 | */
65 | private Result(Integer code, Integer count, Object data) {
66 | this.data = data;
67 | this.count = count;
68 | this.code = code;
69 | this.msg = HttpStatus.OK.getReasonPhrase();
70 | }
71 |
72 | /**
73 | * 自定义code,msg
74 | */
75 | private Result(Integer code, String msg) {
76 | this.code = code;
77 | this.msg = msg;
78 | }
79 |
80 | /**
81 | * 自定义code,data
82 | */
83 | private Result(Integer code, Object data) {
84 | this.code = code;
85 | this.data = data;
86 | }
87 |
88 | /**
89 | * 只有状态码和提示信息
90 | */
91 | private Result() {
92 | this.code = HttpStatus.OK.value();
93 | this.msg = HttpStatus.OK.getReasonPhrase();
94 | }
95 |
96 | /**
97 | * 以下所有方法,调用时,给什么参数返回什么
98 | * 不输值,就返回一个空对象
99 | */
100 |
101 |
102 | public static Result success(Integer code, String msg, Integer count, Object data) {
103 | return new Result(code, msg, count, data);
104 | }
105 |
106 | public static Result error(Integer code, String msg) {
107 | return new Result(code, msg);
108 | }
109 |
110 | public static Result success(Integer code, Object data) {
111 | return new Result(code, data);
112 | }
113 |
114 | public static Result success(Integer code, Integer count, Object data) {
115 | return new Result(code,count,data);
116 | }
117 |
118 | public static Result success(Object data) {
119 | return new Result(data);
120 | }
121 |
122 | public static Result success() {
123 | return new Result();
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/src/main/java/zl/readCloud/utils/ToolsUtils.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud.utils;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.stereotype.Component;
5 | import org.springframework.web.multipart.MultipartFile;
6 |
7 | import java.io.File;
8 | import java.text.SimpleDateFormat;
9 | import java.util.Date;
10 | import java.util.UUID;
11 |
12 |
13 | /**
14 | * @author ZhangLei
15 | * @Description:
16 | * @date 2021/11/5 11:36
17 | */
18 | @Component
19 | public class ToolsUtils {
20 |
21 | @Value("${winResource.imgPath}")
22 | public String winFilePath;
23 |
24 | // 无图片时加载的默认图片路径
25 | public static final String DEFAULT_IMG = "default_novel_img/default.jpg";
26 | // 书籍照片类型
27 | private static final Integer TYPE_IMG_BOOK = 1;
28 | // banner照片类型
29 | private static final Integer TYPE_IMG_BANNER = 2;
30 | private static final String IMG_BANNER_FOLDER = "banner";
31 | // 广告照片类型
32 | private static final Integer TYPE_IMG_ADVERTISEMENT = 3;
33 | private static final String IMG_ADVERTISEMENT_FOLDER = "advertisement";
34 |
35 |
36 |
37 | // 上传照片
38 | public String uploadImg(MultipartFile file, Integer typeImg) throws Exception {
39 | String suffix = "";
40 | String filepathF = "";
41 | String filepath = "";
42 | if (file != null) {
43 | // 获取文件上传时的文件名
44 | String originalName = file.getOriginalFilename();
45 | // 获取后缀名
46 | suffix = originalName.substring(originalName.lastIndexOf(".") + 1);
47 | // 获取一个8位的uuid名字
48 | String[] uuid8 = UUID.randomUUID().toString().split("-");
49 | String uuid = uuid8[0];
50 | // 定义上传的图片存储的相对路径及名字
51 | if (typeImg == TYPE_IMG_BOOK) {
52 | String dateStr = "";
53 | Date date = new Date();
54 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
55 | dateStr = simpleDateFormat.format(date);
56 | filepath += dateStr + "/" + uuid + "." + suffix;
57 | }else if (typeImg == TYPE_IMG_BANNER) {
58 | filepath += IMG_BANNER_FOLDER + "/" + uuid + "." + suffix;
59 | }else if (typeImg == TYPE_IMG_ADVERTISEMENT) {
60 | filepath += IMG_ADVERTISEMENT_FOLDER + "/" + uuid + "." + suffix;
61 | }
62 | filepathF = System.getProperty("user.dir") + winFilePath + filepath;
63 | File files = new File(filepathF);
64 | // 是否含有文件夹
65 | if (!files.getParentFile().exists()) {
66 | files.getParentFile().mkdirs();
67 | }
68 | file.transferTo(files);
69 | }else if (file == null && typeImg == TYPE_IMG_BOOK) {
70 | filepathF = DEFAULT_IMG;
71 | }
72 | if (!filepathF.equals("")){
73 | return filepath;
74 | }else {
75 | return null;
76 | }
77 | }
78 |
79 | /**
80 | * 获取照片地址
81 | * @param imgPath
82 | * @return
83 | */
84 | public static String getImgPath(String imgPath) {
85 | return "http://127.0.0.1:8001/" + imgPath;
86 | }
87 |
88 |
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8001
3 |
4 | spring:
5 | datasource:
6 | url: jdbc:mysql://127.0.0.1:3306/read_cloud?characterEncoding=utf8&serverTimezone=UTC
7 | username: root
8 | password: 123456
9 | driver-class-name: com.mysql.cj.jdbc.Driver
10 | #阿里云数据源
11 | type: com.alibaba.druid.pool.DruidDataSource
12 | mybatis:
13 | configuration:
14 | map-underscore-to-camel-case: true
15 |
16 | logging:
17 | level:
18 | zl:
19 | readCloud:
20 | dao: debug
21 | winResource:
22 | imgPath: /Zimg/
--------------------------------------------------------------------------------
/src/test/java/zl/readCloud/ReadCloudApplicationTests.java:
--------------------------------------------------------------------------------
1 | package zl.readCloud;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.junit.jupiter.api.Test;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 |
7 | import java.time.*;
8 | import java.time.format.DateTimeFormatter;
9 | import java.time.temporal.TemporalAdjusters;
10 | import java.util.Date;
11 |
12 | @Slf4j
13 | @SpringBootTest
14 | class ReadCloudApplicationTests {
15 |
16 | @Test
17 | void contextLoads() {
18 |
19 | // addAll末尾添加所有
20 | // List list = new ArrayList<>();
21 | // list.add(1);
22 | // list.add(1);
23 | // list.add(1);
24 | // List list1 = new ArrayList<>();
25 | // list1.add(2);
26 | // list1.add(3);
27 | // list1.add(4);
28 | // list.addAll(list1);
29 | //
30 | // for (Integer integer : list) {
31 | // System.out.println(integer);
32 | // }
33 |
34 | // 获取时间
35 | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
36 | //// Date afterDate = new Date(1635330737);
37 | // Map map = new HashMap<>();
38 | //
39 | // System.out.println(map.size());
40 | //
41 | // 获取当前的后5分钟
42 | // Date nextDay = new Date();
43 | // log.info("路径为: "+ nextDay+ "/\n" + "sadfasdf");
44 | // Date afterDate = new Date(nextDay.getTime() + 1000*60*5);
45 | // log.info("路径为: "+ afterDate);
46 | // System.out.println(sdf.format(afterDate));
47 |
48 | // 获取项目根路径
49 | // String path3 = System.getProperty("user.dir");
50 | // System.out.println(path3);
51 | //
52 | // 获取现在时间
53 | // Date sameDay = Date.from(Instant.now());
54 | // System.out.println(sameDay);
55 |
56 |
57 | // 定时任务计算时间
58 | // LocalDate BurstToday = LocalDate.now();
59 | // LocalDate BurstMonday = BurstToday.with(TemporalAdjusters.previousOrSame( DayOfWeek.MONDAY));
60 | // long BurstTimestamp = BurstMonday.atStartOfDay(ZoneOffset.ofHours(8)).toInstant().toEpochMilli();
61 | // System.out.println(BurstTimestamp +"");
62 | // long BurstRankGiftTaskInitDelay = BurstTimestamp + 1000*60*60*2*24+1000*60*60*14+1000*60*29 - System.currentTimeMillis();
63 | // System.out.println(BurstRankGiftTaskInitDelay +"");
64 | // BurstRankGiftTaskInitDelay = BurstRankGiftTaskInitDelay > 0 ? BurstRankGiftTaskInitDelay : 1000*60*60*24*7 + BurstRankGiftTaskInitDelay;
65 | // System.out.println(BurstRankGiftTaskInitDelay +"");
66 |
67 | // 获取现在的时间戳
68 | // System.out.println(new Date().getTime());
69 | // System.out.println(System.currentTimeMillis());
70 |
71 |
72 | // DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
73 | // LocalDate BurstToday = LocalDate.now();
74 | // LocalDateTime toDay = LocalDateTime.now();
75 | // System.out.println(toDay);
76 | // System.out.println(BurstToday);
77 |
78 |
79 | LocalDate to = LocalDate.now();
80 | System.out.println(to.plusDays(-1));
81 |
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------