| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,38 +45,23 @@ | |||
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | 47 | ### 更新日志 | |
| 48 | + 由于更新日志占用篇幅太多,单独用一个文件存放。链接地址 [更新日志(详细)](/changeLog.md),这里只展示更新简介 | ||
| 49 | + | ||
| 48 | 50 | - 2017-09-02 api模块: 添加swagger-bootstrap-ui,和原有ui并行存在。 | |
| 49 | 51 | http://localhost:8080 默认UI | |
| 50 | - http://localhost:808/doc.html bootstrap-ui | ||
| 51 | - | ||
| 52 | - ``` | ||
| 53 | - 1. spring boot版本从1.4.3更新到1.5.6 | ||
| 54 | - 2. 修复不配置数据库信息无法启动的bug | ||
| 55 | - 3. 版本号更新到2017.1 | ||
| 56 | - 4. api模块(swagger)添加开源库swagger-bootstrap-ui,和swagger默认UI同时存在。 | ||
| 57 | - 5. web模块添加数据库sql文件,导入后一键启动可直接访问到web界面。 | ||
| 58 | - ``` | ||
| 59 | - | ||
| 60 | - - 2017-09-06 更新记录 | ||
| 61 | - | ||
| 62 | - ``` | ||
| 63 | - 1. mybatis模块:添加USER.sql,启动后访问:http://localhost:8080 即可看到接口数据 | ||
| 64 | - 2. 所有模块: 添加 characterEncoding=utf8&useSSL=true 解决高版本mysql的sll警告 | ||
| 65 | - 3. 添加代码贡献者列表和支持者,赞助商链接。 | ||
| 66 | - ``` | ||
| 67 | - | ||
| 68 | -  | ||
| 69 | - | ||
| 70 | - #### swagger | ||
| 71 | -  | ||
| 72 | - | ||
| 52 | + http://localhost:808/doc.html bootstrap-ui | ||
| 73 | 53 | ||
| 74 | - #### bootstrap-ui | ||
| 75 | -  | ||
| 54 | + - 2017-09-02 spring boot版本从1.4.3更新到1.5.6 | ||
| 55 | + - 2017-09-02 修复不配置数据库信息无法启动的bug | ||
| 56 | + - 2017-09-02 版本号更新到2017.1 | ||
| 57 | + - 2017-09-02 api模块(swagger)添加开源库swagger-bootstrap-ui,和swagger默认UI同时存在。 | ||
| 58 | + - 2017-09-02 web模块添加数据库sql文件,导入后一键启动可直接访问到web界面。 | ||
| 59 | + - 2017-09-06 mybatis模块:添加USER.sql,启动后访问:http://localhost:8080 即可看到接口数据 | ||
| 60 | + - 2017-09-06 所有模块: 添加 characterEncoding=utf8&useSSL=true 解决高版本mysql的sll警告 | ||
| 61 | + - 2017-09-06 添加代码贡献者列表和支持者,赞助商链接。 | ||
| 62 | + - 2017-09-08 crawler模块(网络爬虫):修复本地文件目录不存在会报错的bug。处理方式为:不存在则自动创建 | ||
| 76 | 63 | ||
| 77 | -  | ||
| 78 | 64 | ||
| 79 | -  | ||
| 80 | 65 | ||
| 81 | 66 | ||
| 82 | 67 | ### 项目说明 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,45 @@ | |||
| 1 | + - 2017-09-02 api模块: 添加swagger-bootstrap-ui,和原有ui并行存在。 | ||
| 2 | + http://localhost:8080 默认UI | ||
| 3 | + http://localhost:808/doc.html bootstrap-ui | ||
| 4 | + | ||
| 5 | + ``` | ||
| 6 | + 1. spring boot版本从1.4.3更新到1.5.6 | ||
| 7 | + 2. 修复不配置数据库信息无法启动的bug | ||
| 8 | + 3. 版本号更新到2017.1 | ||
| 9 | + 4. api模块(swagger)添加开源库swagger-bootstrap-ui,和swagger默认UI同时存在。 | ||
| 10 | + 5. web模块添加数据库sql文件,导入后一键启动可直接访问到web界面。 | ||
| 11 | + ``` | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +  | ||
| 16 | + | ||
| 17 | + #### swagger | ||
| 18 | +  | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + #### bootstrap-ui | ||
| 22 | +  | ||
| 23 | + | ||
| 24 | +  | ||
| 25 | + | ||
| 26 | +  | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + - 2017-09-06 更新记录 | ||
| 31 | + | ||
| 32 | + ``` | ||
| 33 | + 1. mybatis模块:添加USER.sql,启动后访问:http://localhost:8080 即可看到接口数据 | ||
| 34 | + 2. 所有模块: 添加 characterEncoding=utf8&useSSL=true 解决高版本mysql的sll警告 | ||
| 35 | + 3. 添加代码贡献者列表和支持者,赞助商链接。 | ||
| 36 | + ``` | ||
| 37 | + | ||
| 38 | + - 2017-09-08 更新记录 | ||
| 39 | + | ||
| 40 | + ``` | ||
| 41 | + 1. crawler模块(网络爬虫):修复本地文件目录不存在会报错的bug。处理方式为:不存在则自动创建 | ||
| 42 | + ``` | ||
| 43 | + | ||
| 44 | +  | ||
| 45 | +  | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,7 @@ | |||
| 1 | 1 | package info.xiaomo.core.untils; | |
| 2 | 2 | ||
| 3 | + import lombok.extern.slf4j.Slf4j; | ||
| 4 | + | ||
| 3 | 5 | import java.io.File; | |
| 4 | 6 | import java.io.FileOutputStream; | |
| 5 | 7 | import java.io.InputStream; | |
@@ -9,8 +11,10 @@ | |||
| 9 | 11 | ||
| 10 | 12 | /** | |
| 11 | 13 | * author 小莫 (https://xiaomo.info) (https://github.com/xiaomoinfo) | |
| 14 | + * | ||
| 12 | 15 | * @created : 2016/12/26 13:25 | |
| 13 | 16 | */ | |
| 17 | + @Slf4j | ||
| 14 | 18 | public class DownUtil { | |
| 15 | 19 | ||
| 16 | 20 | public static void download(String urlString) throws Exception { | |
@@ -40,10 +44,11 @@ public static void download(String urlString) throws Exception { | |||
| 40 | 44 | ||
| 41 | 45 | /** | |
| 42 | 46 | * 下载图片 | |
| 47 | + * | ||
| 43 | 48 | * @param urlString url | |
| 44 | - * @param filePath 存储路径 D:\MIR\config\data\ | ||
| 49 | + * @param filePath 存储路径 D:\MIR\config\data\ | ||
| 45 | 50 | */ | |
| 46 | - public static void download(String urlString,String filePath) throws Exception { | ||
| 51 | + public static void download(String urlString, String filePath) throws Exception { | ||
| 47 | 52 | File file = new File(urlString); | |
| 48 | 53 | String filename = file.getName(); | |
| 49 | 54 | // 构造URL | |
@@ -57,7 +62,16 @@ public static void download(String urlString,String filePath) throws Exception { | |||
| 57 | 62 | // 读取到的数据长度 | |
| 58 | 63 | int len; | |
| 59 | 64 | // 输出的文件流 | |
| 60 | - OutputStream os = new FileOutputStream(filePath+filename); | ||
| 65 | + | ||
| 66 | + File output = new File(filePath); | ||
| 67 | + if (!output.exists()){ | ||
| 68 | + boolean res = output.mkdir(); | ||
| 69 | + if (res){ | ||
| 70 | + log.debug("{} 目录创建成功", filePath); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + OutputStream os = new FileOutputStream(filePath + filename); | ||
| 61 | 75 | // 开始读取 | |
| 62 | 76 | while ((len = is.read(bs)) != -1) { | |
| 63 | 77 | os.write(bs, 0, len); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,25 +5,27 @@ | |||
| 5 | 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
| 6 | 6 | import org.springframework.context.annotation.ComponentScan; | |
| 7 | 7 | import org.springframework.context.annotation.Configuration; | |
| 8 | + import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
| 8 | 9 | import org.springframework.scheduling.annotation.EnableScheduling; | |
| 9 | 10 | ||
| 10 | 11 | /** | |
| 11 | 12 | * 把今天最好的表现当作明天最新的起点..~ | |
| 12 | 13 | * いま 最高の表現 として 明日最新の始発..~ | |
| 13 | 14 | * Today the best performance as tomorrow newest starter! | |
| 14 | 15 | * Created by IntelliJ IDEA. | |
| 15 | - * | ||
| 16 | + * <p> | ||
| 16 | 17 | * author: xiaomo | |
| 17 | 18 | * github: https://github.com/xiaomoinfo | |
| 18 | 19 | * email: xiaomo@xiaomo.info | |
| 19 | - | ||
| 20 | + * <p> | ||
| 20 | 21 | * Date: 2016/4/1 15:38 | |
| 21 | 22 | * Copyright(©) 2015 by xiaomo. | |
| 22 | 23 | **/ | |
| 23 | 24 | @Configuration | |
| 24 | 25 | @EnableAutoConfiguration | |
| 25 | 26 | @EnableScheduling | |
| 26 | 27 | @Configurable | |
| 28 | + @EnableJpaRepositories("info.xiaomo.*.dao") | ||
| 27 | 29 | @ComponentScan("info.xiaomo") | |
| 28 | 30 | public class CrawlerMain { | |
| 29 | 31 | public static void main(String[] args) throws Exception { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,11 +2,13 @@ | |||
| 2 | 2 | ||
| 3 | 3 | import info.xiaomo.crawler.model.ShikigamiModel; | |
| 4 | 4 | import org.springframework.data.jpa.repository.JpaRepository; | |
| 5 | + import org.springframework.stereotype.Repository; | ||
| 5 | 6 | ||
| 6 | 7 | /** | |
| 7 | 8 | * author 小莫 (https://xiaomo.info) (https://github.com/xiaomoinfo) | |
| 8 | 9 | * @created : 2016/12/24 15:55 | |
| 9 | 10 | */ | |
| 11 | + @Repository | ||
| 10 | 12 | public interface ShikigamaDao extends JpaRepository<ShikigamiModel, Long> { | |
| 11 | 13 | ||
| 12 | 14 | ShikigamiModel findByName(String name); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,7 +52,7 @@ public void downImage() throws Exception { | |||
| 52 | 52 | List<ShikigamiModel> shikigamiModel = shikigamaService.findAll(); | |
| 53 | 53 | for (ShikigamiModel aShikigamiModel : shikigamiModel) { | |
| 54 | 54 | String url = aShikigamiModel.getImage(); | |
| 55 | - DownUtil.download(url, "C:\\Users\\xiaomo\\Desktop\\yss\\"); | ||
| 55 | + DownUtil.download(url, "D:\\yys\\"); | ||
| 56 | 56 | LOGGER.debug("开始下载图片:{}", url); | |
| 57 | 57 | } | |
| 58 | 58 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,19 @@ | |||
| 1 | + logging.config=classpath:config/logback-dev.xml | ||
| 2 | + server.port=8080 | ||
| 3 | + server.session.timeout=1800 | ||
| 4 | + server.max-http-header-size=20971520 | ||
| 5 | + | ||
| 6 | + #datasource | ||
| 7 | + spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true | ||
| 8 | + # ?useUnicode=true&characterEncoding=UTF-8 | ||
| 9 | + spring.datasource.username=username | ||
| 10 | + spring.datasource.password=password | ||
| 11 | + spring.datasource.driver-class-name=com.mysql.jdbc.Driver | ||
| 12 | + # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4 | ||
| 13 | + #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss | ||
| 14 | + #spring.jackson.time-zone=GMT+8 | ||
| 15 | + | ||
| 16 | + #jpa | ||
| 17 | + spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect | ||
| 18 | + spring.jpa.hibernate.ddl-auto=update | ||
| 19 | + spring.jpa.show-sql=true | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments