├── .gitignore ├── LICENSE ├── README.md ├── images ├── create_api_website_for_bt.png ├── create_website_for_bt.png ├── income.png ├── income_report.png ├── reverse_proxy.png ├── schedule.png ├── todo.png ├── update_api_to_ssl.png └── update_to_ssl.png ├── spring-bee ├── config.json ├── mvnw ├── mvnw.cmd ├── package.sh ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── code4everything │ │ │ └── springbee │ │ │ ├── SpringBeeApplication.java │ │ │ ├── config │ │ │ ├── BeeBeanConfiguration.java │ │ │ ├── BeeConfigBean.java │ │ │ └── BeeWebMvcConfiguration.java │ │ │ ├── constant │ │ │ ├── BeeConfigConsts.java │ │ │ └── BeeErrorConsts.java │ │ │ ├── dao │ │ │ ├── AssetDAO.java │ │ │ ├── CategoryDAO.java │ │ │ ├── DailiesDAO.java │ │ │ ├── DailyDAO.java │ │ │ ├── DocumentDAO.java │ │ │ ├── IncomeDAO.java │ │ │ ├── JobDAO.java │ │ │ ├── LogDAO.java │ │ │ ├── SettingDAO.java │ │ │ ├── TodoDAO.java │ │ │ └── UserDAO.java │ │ │ ├── domain │ │ │ ├── Asset.java │ │ │ ├── Category.java │ │ │ ├── Dailies.java │ │ │ ├── Daily.java │ │ │ ├── Document.java │ │ │ ├── Income.java │ │ │ ├── Job.java │ │ │ ├── Log.java │ │ │ ├── Setting.java │ │ │ ├── Todo.java │ │ │ └── User.java │ │ │ ├── model │ │ │ ├── DailiesVO.java │ │ │ ├── DailyVO.java │ │ │ ├── IncomeBillVO.java │ │ │ ├── IncomeVO.java │ │ │ ├── JobVO.java │ │ │ ├── PasswordVO.java │ │ │ ├── RegisterVO.java │ │ │ ├── TodoCountVO.java │ │ │ ├── TodoVO.java │ │ │ └── UserInfoVO.java │ │ │ ├── service │ │ │ ├── CategoryService.java │ │ │ ├── CommonService.java │ │ │ ├── DailiesService.java │ │ │ ├── DailyService.java │ │ │ ├── DocumentService.java │ │ │ ├── IncomeService.java │ │ │ ├── JobService.java │ │ │ ├── SettingService.java │ │ │ ├── TodoService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── CategoryServiceImpl.java │ │ │ │ ├── CommonServiceImpl.java │ │ │ │ ├── DailiesServiceImpl.java │ │ │ │ ├── DailyServiceImpl.java │ │ │ │ ├── DocumentServiceImpl.java │ │ │ │ ├── IncomeServiceImpl.java │ │ │ │ ├── JobServiceImpl.java │ │ │ │ ├── LogServiceImpl.java │ │ │ │ ├── SettingServiceImpl.java │ │ │ │ ├── TodoServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ ├── util │ │ │ ├── BeeUtils.java │ │ │ └── Checker.java │ │ │ └── web │ │ │ ├── AssetController.java │ │ │ ├── CategoryController.java │ │ │ ├── CommonController.java │ │ │ ├── DailiesController.java │ │ │ ├── DailyController.java │ │ │ ├── DocumentController.java │ │ │ ├── IncomeController.java │ │ │ ├── JobController.java │ │ │ ├── SettingController.java │ │ │ ├── TodoController.java │ │ │ └── UserController.java │ └── resources │ │ ├── application-prod.properties │ │ ├── application.properties │ │ ├── logback.xml │ │ └── static │ │ └── .gitkeep │ └── test │ └── java │ └── org │ └── code4everything │ └── springbee │ ├── BaseTest.java │ ├── CommonTest.java │ ├── SpringBeeApplicationTests.java │ ├── constant │ └── TestConsts.java │ └── service │ └── impl │ ├── CategoryServiceImplTest.java │ ├── CommonServiceImplTest.java │ ├── DailiesServiceImplTest.java │ ├── DailyServiceImplTest.java │ ├── IncomeServiceImplTest.java │ ├── TodoServiceImplTest.java │ └── UserServiceImplTest.java └── spring-fee ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js ├── prod.env.js └── test.env.js ├── docs └── api │ └── swagger.json ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── api │ └── api.js ├── assets │ ├── css │ │ └── style.css │ ├── js │ │ └── utils.js │ └── logo.png ├── components │ ├── DaysLeft.vue │ ├── Index.vue │ ├── Login.vue │ ├── PasswordReset.vue │ ├── Register.vue │ ├── container │ │ ├── ScheduleContainer.vue │ │ └── SigninContainer.vue │ ├── index │ │ ├── Daily.vue │ │ ├── Income.vue │ │ ├── Job.vue │ │ ├── Todo.vue │ │ ├── job │ │ │ └── JobLog.vue │ │ └── todo │ │ │ └── TodoItem.vue │ └── modal │ │ ├── AssetModal.vue │ │ └── DailyModal.vue ├── main.js └── router │ └── index.js ├── static ├── .gitkeep ├── css │ ├── bootstrap.min.css │ ├── fileinput.min.css │ ├── fontawesome-all.css │ ├── glyphicons.css │ ├── pretty-checkbox.min.css │ └── weui.min.css ├── font │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── img │ └── logo.png └── js │ ├── bootstrap.min.js │ ├── fileinput.min.js │ ├── jquery-3.3.1.js │ ├── jsencrypt.min.js │ ├── layer.js │ ├── mobile │ ├── layer.js │ └── need │ │ └── layer.css │ ├── piexif.min.js │ ├── popper.min.js │ ├── purify.min.js │ ├── sortable.min.js │ ├── theme │ └── default │ │ ├── icon-ext.png │ │ ├── icon.png │ │ ├── layer.css │ │ ├── loading-0.gif │ │ ├── loading-1.gif │ │ └── loading-2.gif │ └── validator.min.js └── test ├── e2e ├── custom-assertions │ └── elementCount.js ├── nightwatch.conf.js ├── runner.js └── specs │ └── test.js └── unit ├── .eslintrc ├── jest.conf.js ├── setup.js └── specs └── HelloWorld.spec.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Custom 2 | **/document/ 3 | **/target/ 4 | !.mvn/wrapper/maven-wrapper.jar 5 | .mvn/ 6 | */logs/* 7 | 8 | # ---> macOS 9 | *.DS_Store 10 | .AppleDouble 11 | .LSOverride 12 | 13 | # Icon must end with two \r 14 | Icon 15 | 16 | 17 | # Thumbnails 18 | ._* 19 | 20 | # Files that might appear in the root of a volume 21 | .DocumentRevisions-V100 22 | .fseventsd 23 | .Spotlight-V100 24 | .TemporaryItems 25 | .Trashes 26 | .VolumeIcon.icns 27 | .com.apple.timemachine.donotpresent 28 | 29 | # Directories potentially created on remote AFP share 30 | .AppleDB 31 | .AppleDesktop 32 | Network Trash Folder 33 | Temporary Items 34 | .apdisk 35 | 36 | # ---> Windows 37 | # Windows thumbnail cache files 38 | Thumbs.db 39 | ehthumbs.db 40 | ehthumbs_vista.db 41 | 42 | # Folder config file 43 | Desktop.ini 44 | 45 | # Recycle Bin used on file shares 46 | $RECYCLE.BIN/ 47 | 48 | # Windows Installer files 49 | *.cab 50 | *.msi 51 | *.msm 52 | *.msp 53 | 54 | # Windows shortcuts 55 | *.lnk 56 | 57 | # ---> Linux 58 | *~ 59 | 60 | # temporary files which can be created if a process still has a handle open of a deleted file 61 | .fuse_hidden* 62 | 63 | # KDE directory preferences 64 | .directory 65 | 66 | # Linux trash folder which might appear on any partition or disk 67 | .Trash-* 68 | 69 | # .nfs files are created when an open file is removed but is still being accessed 70 | .nfs* 71 | 72 | ### STS ### 73 | .apt_generated 74 | .classpath 75 | .factorypath 76 | .project 77 | .settings 78 | .springBeans 79 | .sts4-cache 80 | 81 | ### IntelliJ IDEA ### 82 | .idea 83 | *.iws 84 | *.iml 85 | *.ipr 86 | /out/ 87 | 88 | ### NetBeans ### 89 | /nbproject/private/ 90 | /build/ 91 | /nbbuild/ 92 | /dist/ 93 | /nbdist/ 94 | /.nb-gradle/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 项目简介 2 | 3 | `Wanna Spring` 是一个记录个人信息,采用前后端分离的项目。 4 | 项目的初衷是我想在这个信息时代,能记录下自己的每一天,也是一个学习前后端分离的实践项目,供大家参考、学习、讨论,小白一枚,写的不好的地方还请多多指教。 5 | 6 | > 对于一个后端同学来说写前端着实太吃力了 :joy: 7 | 8 | ## 开发环境 9 | 10 | 1. JDK 1.8 11 | 12 | 2. Redis 4.0.11 13 | 14 | 3. MongoDB 4.0.0 15 | 16 | 4. IntelliJ IDEA 2018.2.6 17 | 18 | 5. Maven 3.5 19 | 20 | 6. Lombok Plugin 21 | 22 | 7. Node 10.10.0 23 | 24 | 8. Vue 2.9.6 25 | 26 | 9. Spring Boot 2.0.4.RELEASE 27 | 28 | ## 技术选型 29 | 30 | - Spring Boot + Spring + Spring MVC + Spring Data MongoDB + Swagger 31 | 32 | - Redis + MongoDB 33 | 34 | - Vue + JQuery + Bootstrap + Element UI + Axios + DayJS + Validator + JSCookie + VCharts 35 | 36 | ## 主要功能 37 | 38 | - 收益信息,统计支出与收入(每日看一下余额,可达到节省开支的目的哦) 39 | 40 | - 日程信息,对每天进行简单的总结 41 | 42 | - 代办事项,将计划好准备做的事情列出来 43 | 44 | - 工作日志,自己掌握每日上下班的打卡数据 45 | 46 | ## 运行项目 47 | 48 | - 后端 49 | 50 | 运行主类 [SpringBeeApplication](spring-bee/src/main/java/org/code4everything/springbee/SpringBeeApplication.java) 即可 51 | 52 | - 前端 53 | 54 | ``` shell 55 | cd /path/wanna-spring/spring-fee 56 | # 安装依赖 57 | npm install 58 | # 运行项目 59 | npm run dev 60 | ``` 61 | 62 | ## 运行截图 63 | 64 | 收益记录 65 | 66 | ![income](images/income.png) 67 | 68 | 支出报表 69 | 70 | ![income_report](images/income_report.png) 71 | 72 | 日程记录 73 | 74 | ![schedule](images/schedule.png) 75 | 76 | 代办事项 77 | 78 | ![todo](images/todo.png) 79 | 80 | ## 部署项目 81 | 82 | #### 安装宝塔管理工具(推荐) 83 | 84 | - 安装宝塔请移步 [https://www.bt.cn/bbs/thread-19376-1-1.html](https://www.bt.cn/bbs/thread-19376-1-1.html) 85 | 86 | - 安装成功之后,进入宝塔管理界面,进入软件管理,然后安装 `Nginx`、`Redis`、`MongoDB` 87 | 88 | #### 部署后端服务 89 | 90 | 1. 修改必要的配置 91 | 92 | - 修改 [application.properties](spring-bee/src/main/resources/application.properties) 文件 93 | 94 | ``` properties 95 | # 去掉注释 96 | spring.profiles.active=prod 97 | ``` 98 | 99 | - 修改 [application-prod.properties](spring-bee/src/main/resources/application-prod.properties) 文件 100 | 101 | ``` properties 102 | # 下面的信息必须使用自己的,如果示例的邮箱发送邮件过于频繁,将会导致示例邮箱的邮件服务被关闭 103 | # 如何开通邮箱的第三方登录,请自行谷歌百度 104 | spring.mail.host=mail server host 105 | spring.mail.protocol=mail server protocol 106 | spring.mail.username=mail username 107 | spring.mail.password=mail password or key 108 | ``` 109 | 110 | - 根据实际情况修改 [config.json](spring-bee/config.json) 文件 111 | 112 | 2. 打包部署 113 | 114 | ``` shell 115 | # 进入后端项目目录 116 | cd /path/wanna-spring/spring-bee 117 | # 打包 118 | mvn package -Dmaven.test.skip=true 119 | ``` 120 | 121 | > 打包后上传 target 目录下面的 spring-bee-x.x.x.jar 文件至服务器(建议新建一个文件夹),同时将 [config.json](spring-bee/config.json) 上传至同级目录 122 | 123 | 3. 运行 124 | 125 | ``` shell 126 | # 运行,防止BASH窗口关闭时进程挂掉 127 | setsid java -jar spring-bee.x.x.x.jar & 128 | # 关闭进程 129 | lsof -i:8023 # 查找运行的端口,会看到运行在此端口的进程的PID 130 | kill -9 PID # 强制关闭进程 131 | ``` 132 | 133 | 4. 升级HTTPS 134 | 135 | 使用宝塔工具,创建一个站点 136 | 137 | ![create_website](images/create_api_website_for_bt.png) 138 | 139 | 申请证书,开通HTTPS 140 | 141 | ![update_ssl](images/update_api_to_ssl.png) 142 | 143 | 设置反向代理 144 | 145 | ![reverse_proxy](images/reverse_proxy.png) 146 | 147 | #### 部署前端服务 148 | 149 | 1. 修改 [api.js](spring-fee/src/api/api.js) 文件 150 | 151 | ``` javascript 152 | // 修改成自己的主机 153 | const host = 'https://spring-api.yourdomain.com' 154 | ``` 155 | 156 | 2. 打包 157 | 158 | ``` shell 159 | # 进入前端项目目录 160 | cd /path/wanna-spring/spring-fee 161 | # 安装依赖 162 | npm install 163 | # 打包 164 | npm run build 165 | ``` 166 | 167 | 3. 用宝塔创建网站 168 | 169 | ![create_website](images/create_website_for_bt.png) 170 | 171 | 然后压缩 `dist` 目录下的 [index.html & static](spring-fee/dist) 文件,并上传至网站根目录,解压即可 172 | 173 | 4. 升级HTTPS 174 | 175 | ![update_to ssl](images/update_to_ssl.png) 176 | 177 | ## 写在最后 178 | 179 | 欢迎大家一起来交流学习,参与贡献、反馈BUG,如果你有好的建议也欢迎提出哦,鄙人QQ735817834,觉得不错的点个Star支持一下哟。 180 | -------------------------------------------------------------------------------- /images/create_api_website_for_bt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/create_api_website_for_bt.png -------------------------------------------------------------------------------- /images/create_website_for_bt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/create_website_for_bt.png -------------------------------------------------------------------------------- /images/income.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/income.png -------------------------------------------------------------------------------- /images/income_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/income_report.png -------------------------------------------------------------------------------- /images/reverse_proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/reverse_proxy.png -------------------------------------------------------------------------------- /images/schedule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/schedule.png -------------------------------------------------------------------------------- /images/todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/todo.png -------------------------------------------------------------------------------- /images/update_api_to_ssl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/update_api_to_ssl.png -------------------------------------------------------------------------------- /images/update_to_ssl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/images/update_to_ssl.png -------------------------------------------------------------------------------- /spring-bee/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "boot": { 3 | "debug": true, 4 | "redis": { 5 | "host": "192.168.1.234" 6 | }, 7 | "maxUploadSize": 1048576 8 | }, 9 | "tokenExpired": 604800, 10 | "whitePrefixes": [ 11 | "/common", 12 | "/user/password/reset", 13 | "/user/register", 14 | "/user/login" 15 | ], 16 | "interceptPrefixes": [ 17 | "/user" 18 | ], 19 | "blackPrefixes": [], 20 | "storagePath": "" 21 | } 22 | -------------------------------------------------------------------------------- /spring-bee/package.sh: -------------------------------------------------------------------------------- 1 | mvn package -Dmaven.test.skip=true 2 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/SpringBeeApplication.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee; 2 | 3 | import com.spring4all.swagger.EnableSwagger2Doc; 4 | import org.code4everything.boot.base.FileUtils; 5 | import org.code4everything.boot.config.EnableSurfaceMail; 6 | import org.code4everything.springbee.config.BeeConfigBean; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | 10 | /** 11 | * @author pantao 12 | * @since 2018/9/9 13 | */ 14 | @SpringBootApplication 15 | @EnableSwagger2Doc 16 | @EnableSurfaceMail 17 | public class SpringBeeApplication { 18 | 19 | private static BeeConfigBean beeConfigBean = new BeeConfigBean(); 20 | 21 | public static void main(String[] args) { 22 | // 监听配置文件 23 | FileUtils.watchFile(FileUtils.currentWorkDir("config.json"), beeConfigBean); 24 | // 启动项目 25 | SpringApplication.run(SpringBeeApplication.class, args); 26 | } 27 | 28 | public static BeeConfigBean getBeeConfigBean() { 29 | return beeConfigBean; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/config/BeeBeanConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.config; 2 | 3 | import org.code4everything.boot.module.redis.RedisTemplateUtils; 4 | import org.code4everything.boot.web.cors.CorsUtils; 5 | import org.code4everything.springbee.domain.Asset; 6 | import org.code4everything.springbee.domain.Log; 7 | import org.code4everything.springbee.domain.User; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.data.redis.core.RedisTemplate; 11 | import org.springframework.web.filter.CorsFilter; 12 | 13 | /** 14 | * @author pantao 15 | * @since 2018/9/15 16 | */ 17 | @Configuration 18 | public class BeeBeanConfiguration { 19 | 20 | /** 21 | * 跨域过滤器 22 | */ 23 | @Bean 24 | public CorsFilter corsFilter() { 25 | return CorsUtils.newCorsFilter(); 26 | } 27 | 28 | @Bean("stringRedis") 29 | public RedisTemplate stringRedisTemplate() { 30 | return RedisTemplateUtils.newTemplate(String.class); 31 | } 32 | 33 | @Bean 34 | public RedisTemplate assetRedisTemplate() { 35 | return RedisTemplateUtils.newTemplate(Asset.class); 36 | } 37 | 38 | @Bean 39 | public RedisTemplate logRedisTemplate() { 40 | return RedisTemplateUtils.newTemplate(Log.class); 41 | } 42 | 43 | @Bean 44 | public RedisTemplate userRedisTemplate() { 45 | return RedisTemplateUtils.newTemplate(User.class); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/config/BeeConfigBean.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.config; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import lombok.*; 5 | import org.code4everything.boot.web.mvc.FilterPath; 6 | import org.code4everything.springbee.constant.BeeConfigConsts; 7 | 8 | import java.util.Objects; 9 | 10 | /** 11 | * @author pantao 12 | * @since 2018/10/28 13 | */ 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @ToString(callSuper = true) 18 | @EqualsAndHashCode(callSuper = true) 19 | public class BeeConfigBean extends FilterPath { 20 | 21 | private Integer tokenExpired; 22 | 23 | private String storagePath; 24 | 25 | @Override 26 | public void nulls2Default() { 27 | if (StrUtil.isEmpty(storagePath)) { 28 | storagePath = BeeConfigConsts.STORAGE_PATH; 29 | } 30 | if (Objects.isNull(tokenExpired)) { 31 | tokenExpired = BeeConfigConsts.TOKEN_EXPIRED; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/config/BeeWebMvcConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.config; 2 | 3 | import cn.hutool.core.util.ObjectUtil; 4 | import com.google.common.base.Strings; 5 | import org.code4everything.boot.web.http.HttpUtils; 6 | import org.code4everything.boot.web.mvc.DefaultExceptionHandler; 7 | import org.code4everything.boot.web.mvc.DefaultWebInterceptor; 8 | import org.code4everything.boot.web.mvc.PathFilterHandler; 9 | import org.code4everything.boot.web.mvc.exception.ExceptionFactory; 10 | import org.code4everything.springbee.domain.User; 11 | import org.code4everything.springbee.service.UserService; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.context.annotation.Configuration; 16 | import org.springframework.http.HttpStatus; 17 | import org.springframework.web.bind.MethodArgumentNotValidException; 18 | import org.springframework.web.servlet.HandlerExceptionResolver; 19 | import org.springframework.web.servlet.config.annotation.*; 20 | import org.springframework.web.servlet.view.InternalResourceViewResolver; 21 | 22 | import javax.servlet.http.HttpServletRequest; 23 | import javax.servlet.http.HttpServletResponse; 24 | import java.util.List; 25 | 26 | /** 27 | * @author pantao 28 | * @since 2018/9/20 29 | */ 30 | @Configuration 31 | public class BeeWebMvcConfiguration implements WebMvcConfigurer { 32 | 33 | private static final Logger LOGGER = LoggerFactory.getLogger(BeeWebMvcConfiguration.class); 34 | 35 | private final UserService userUserService; 36 | 37 | @Autowired 38 | public BeeWebMvcConfiguration(UserService userUserService) {this.userUserService = userUserService;} 39 | 40 | @Override 41 | public void configureHandlerExceptionResolvers(List resolvers) { 42 | DefaultExceptionHandler handler = new DefaultExceptionHandler(); 43 | // 添加异常信息 44 | handler.addException(400, "参数校验失败", HttpStatus.BAD_REQUEST, MethodArgumentNotValidException.class); 45 | resolvers.add(handler); 46 | } 47 | 48 | @Override 49 | public void configureViewResolvers(ViewResolverRegistry registry) { 50 | InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); 51 | viewResolver.setPrefix("/"); 52 | viewResolver.setSuffix(".html"); 53 | registry.viewResolver(viewResolver); 54 | } 55 | 56 | @Override 57 | public void configurePathMatch(PathMatchConfigurer configurer) { 58 | configurer.setUseSuffixPatternMatch(false); 59 | } 60 | 61 | @Override 62 | public void addViewControllers(ViewControllerRegistry registry) { 63 | registry.addViewController("/index").setViewName("/index"); 64 | } 65 | 66 | @Override 67 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 68 | registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/static/"); 69 | } 70 | 71 | @Override 72 | public void addInterceptors(InterceptorRegistry registry) { 73 | registry.addInterceptor(new DefaultWebInterceptor(new PathFilterHandler() { 74 | 75 | @Override 76 | public String buildCacheKey(HttpServletRequest request) { 77 | return Strings.nullToEmpty(HttpUtils.getToken(request)) + "." + request.getRequestURI(); 78 | } 79 | 80 | @Override 81 | public void handleBlackList(HttpServletRequest request, HttpServletResponse response, Object handler) { 82 | throw ExceptionFactory.urlForbade(); 83 | } 84 | 85 | @Override 86 | public boolean handleInterceptList(HttpServletRequest request, HttpServletResponse response, 87 | Object handler) { 88 | String token = HttpUtils.requireToken(request); 89 | User user = userUserService.getUserByToken(token); 90 | if (ObjectUtil.isNull(user)) { 91 | LOGGER.error("auth error, token: {}, ip: {}", token, request.getRemoteAddr()); 92 | throw ExceptionFactory.userNotLoggedIn(); 93 | } 94 | return true; 95 | } 96 | })); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/constant/BeeConfigConsts.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.constant; 2 | 3 | import org.code4everything.boot.base.FileUtils; 4 | 5 | import java.io.File; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2018/9/13 10 | */ 11 | public class BeeConfigConsts { 12 | 13 | /** 14 | * 会话时长 15 | */ 16 | public static final int TOKEN_EXPIRED = 30 * 60; 17 | 18 | /** 19 | * 自定义配置上传文件保存路径 20 | */ 21 | public static final String STORAGE_PATH = FileUtils.currentWorkDir("document") + File.separator; 22 | 23 | /** 24 | * 如果需要修改文件的映射路径,还需要修改对应的Controller映射路径 25 | */ 26 | public static final String DOCUMENT_MAPPING = "/user/document/"; 27 | 28 | private BeeConfigConsts() {} 29 | } 30 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/constant/BeeErrorConsts.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.constant; 2 | 3 | import org.code4everything.boot.web.mvc.exception.HttpException; 4 | import org.code4everything.boot.web.mvc.exception.template.UsernamePasswordIncorrectException; 5 | 6 | /** 7 | * @author pantao 8 | * @since 2019/5/9 9 | */ 10 | public class BeeErrorConsts { 11 | 12 | public static final HttpException CATEGORY_EXISTS = new HttpException(1001, "该分类已存在,无需添加", true); 13 | 14 | public static final HttpException CODE_EXCEPTION = new HttpException(1002, "请勿频繁发送验证码", true); 15 | 16 | public static final HttpException DAILY_NOT_FOUND = new HttpException(1003, "该日程记录尚未添加", true); 17 | 18 | public static final HttpException DAILIES_NOT_FOUND = new HttpException(1004, "该日程详细记录不存在", true); 19 | 20 | public static final HttpException DATE_FUTURE = new HttpException(1005, "该日期不合法", true); 21 | 22 | public static final HttpException DAILY_EXISTS = new HttpException(1006, "该日程记录已存在", true); 23 | 24 | public static final HttpException INCOME_NOT_FOUND = new HttpException(1007, "收入支付记录不存在", true); 25 | 26 | public static final HttpException JOB_EXISTS = new HttpException(1008, "该工作记录已存在", true); 27 | 28 | public static final HttpException JOB_NOT_FOUND = new HttpException(1009, "该工作记录尚未添加", true); 29 | 30 | public static final HttpException TODO_NOT_FOUND = new HttpException(1010, "该待办事项尚未添加", true); 31 | 32 | public static final HttpException CODE_INCORRECT = new HttpException(1011, "验证码不正确", true); 33 | 34 | public static final HttpException USERNAME_EXISTS = new HttpException(1012, "该用户已被注册啦", true); 35 | 36 | public static final HttpException EMAIL_EXISTS = new HttpException(1012, "该邮箱已被注册啦", true); 37 | 38 | public static final HttpException USERNAME_PASSWORD_INCORRECT = new UsernamePasswordIncorrectException(1013); 39 | 40 | public static final HttpException FILE_UPLOAD_ERROR = new HttpException(1014, "文件上传失败", true); 41 | 42 | private BeeErrorConsts() {} 43 | } 44 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/AssetDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Asset; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2018/9/20 10 | */ 11 | @Repository 12 | public interface AssetDAO extends MongoRepository { 13 | 14 | /** 15 | * 通过用户编号获取资产信息 16 | * 17 | * @param userId 用户编号 18 | * 19 | * @return 资产信息 20 | */ 21 | Asset getByUserId(String userId); 22 | } 23 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/CategoryDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Category; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2018/9/20 12 | */ 13 | @Repository 14 | public interface CategoryDAO extends MongoRepository { 15 | 16 | /** 17 | * 验证分类是否存在 18 | * 19 | * @param userId 用户编号 20 | * @param name 用户名 21 | * 22 | * @return 分类是否存在 23 | */ 24 | boolean existsByUserIdAndName(String userId, String name); 25 | 26 | /** 27 | * 列出用户的所有分类 28 | * 29 | * @param userId 用户编号 30 | * 31 | * @return 分类列表 32 | */ 33 | List getByUserId(String userId); 34 | } 35 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/DailiesDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Dailies; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2018/9/24 12 | */ 13 | @Repository 14 | public interface DailiesDAO extends MongoRepository { 15 | 16 | /** 17 | * 获取日程详细信息 18 | * 19 | * @param dailiesId 日程详细编号 20 | * 21 | * @return 日程详细信息 22 | */ 23 | Dailies getById(String dailiesId); 24 | 25 | /** 26 | * 列出日程所有的详细信息 27 | * 28 | * @param dailyId 日程编号 29 | * 30 | * @return 日程详细信息列表 31 | */ 32 | List getByDailyId(String dailyId); 33 | } 34 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/DailyDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Daily; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2018/9/22 10 | */ 11 | @Repository 12 | public interface DailyDAO extends MongoRepository { 13 | 14 | /** 15 | * 获取日程内容 16 | * 17 | * @param dailyId 日程编号 18 | * 19 | * @return 日程内容 20 | */ 21 | Daily getById(String dailyId); 22 | 23 | /** 24 | * 获取日程内容 25 | * 26 | * @param userId 用户编号 27 | * @param date 日期 28 | * 29 | * @return 日程内容 30 | */ 31 | Daily getByUserIdAndDate(String userId, String date); 32 | } 33 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/DocumentDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Document; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2018/9/13 10 | */ 11 | @Repository 12 | public interface DocumentDAO extends MongoRepository { 13 | 14 | /** 15 | * 通过本地路径或访问链接获取文件信息 16 | * 17 | * @param localPath 本地路径 18 | * @param accessUrl 访问链接 19 | * 20 | * @return 文件信息 21 | */ 22 | Document getByLocalPathOrAccessUrl(String localPath, String accessUrl); 23 | 24 | /** 25 | * 获取文件信息 26 | * 27 | * @param accessUrl 访问链接 28 | * 29 | * @return 文件信息 30 | */ 31 | Document getByAccessUrl(String accessUrl); 32 | } 33 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/IncomeDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Income; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2018/9/24 10 | */ 11 | @Repository 12 | public interface IncomeDAO extends MongoRepository { 13 | 14 | /** 15 | * 获取收益信息 16 | * 17 | * @param incomeId 记录编号 18 | * 19 | * @return 收益消息 20 | */ 21 | Income getById(String incomeId); 22 | } 23 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/JobDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Job; 4 | import org.springframework.data.domain.Page; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.data.mongodb.repository.MongoRepository; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author pantao 13 | * @since 2019/3/1 14 | */ 15 | @Repository 16 | public interface JobDAO extends MongoRepository { 17 | 18 | Page getByUserIdAndCompanyAndWorkWay(String userId, String company, String workWay, Pageable pageable); 19 | 20 | Page getByUserIdAndWorkWay(String userId, String workWay, Pageable pageable); 21 | 22 | Page getByUserIdAndWorkWayAndStatus(String userId, String workWay, String status, Pageable pageable); 23 | 24 | List getByUserId(String userId); 25 | 26 | Job getByUserIdAndWorkTimeStartAfter(String userId, Long today); 27 | } 28 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/LogDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Log; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2018/10/14 10 | */ 11 | @Repository 12 | public interface LogDAO extends MongoRepository {} 13 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/SettingDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Setting; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2019/5/10 10 | */ 11 | @Repository 12 | public interface SettingDAO extends MongoRepository { 13 | 14 | Setting getByUserId(String userId); 15 | } 16 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/TodoDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.Todo; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2018/9/24 12 | */ 13 | @Repository 14 | public interface TodoDAO extends MongoRepository { 15 | 16 | /** 17 | * 列出指定日期之前的代办事项 18 | * 19 | * @param userId 用户编号 20 | * @param status 状态 21 | * @param doingDate 截止日期 22 | * 23 | * @return 待办事项列表 24 | */ 25 | List getByUserIdAndStatusAndDoingDateLessThan(String userId, String status, String doingDate); 26 | 27 | /** 28 | * 获取代办事项信息 29 | * 30 | * @param todoId 事项编号 31 | * 32 | * @return 代办事项 33 | */ 34 | Todo getById(String todoId); 35 | 36 | /** 37 | * 统计指定日期的代办事项数量 38 | * 39 | * @param userId 用户编号 40 | * @param doingDate 日期 41 | * 42 | * @return 待办事项的数量 43 | */ 44 | Integer countByUserIdAndDoingDate(String userId, String doingDate); 45 | 46 | /** 47 | * 列出某个日期的所有代办事项 48 | * 49 | * @param userId 用户编号 50 | * @param doingDate 日期 51 | * 52 | * @return 代办事项列表 53 | */ 54 | List getByUserIdAndDoingDate(String userId, String doingDate); 55 | } 56 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/dao/UserDAO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.dao; 2 | 3 | import org.code4everything.springbee.domain.User; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author pantao 9 | * @since 2018/9/15 10 | */ 11 | @Repository 12 | public interface UserDAO extends MongoRepository { 13 | 14 | /** 15 | * 通过邮箱获取用户 16 | * 17 | * @param mail 邮箱 18 | * 19 | * @return 用户 20 | */ 21 | User getByEmail(String mail); 22 | 23 | /** 24 | * 邮箱是否存在 25 | * 26 | * @param mail 邮箱 27 | * 28 | * @return 是否存在 29 | */ 30 | boolean existsByEmail(String mail); 31 | 32 | /** 33 | * 用户名是否存在 34 | * 35 | * @param username 用户名 36 | * 37 | * @return 是否存在 38 | */ 39 | boolean existsByUsername(String username); 40 | 41 | /** 42 | * 通过用户名或邮箱查找用户 43 | * 44 | * @param username 用户名 45 | * @param mail 邮箱 46 | * 47 | * @return 用户 48 | */ 49 | User getByUsernameOrEmail(String username, String mail); 50 | } 51 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Asset.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.code4everything.boot.base.encoder.Sealed; 11 | import org.springframework.data.annotation.Id; 12 | import org.springframework.data.mongodb.core.mapping.Document; 13 | 14 | import java.io.Serializable; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2018/9/9 19 | */ 20 | @Data 21 | @ToString 22 | @Document 23 | @NoArgsConstructor 24 | @AllArgsConstructor 25 | @ApiModel(description = "资产(可流动资金)") 26 | public class Asset implements BaseDomain { 27 | 28 | private static final long serialVersionUID = 5328542047062705414L; 29 | 30 | @Id 31 | @ApiModelProperty("资产编号") 32 | private String id; 33 | 34 | @Sealed 35 | @ApiModelProperty("用户编号") 36 | private String userId; 37 | 38 | @ApiModelProperty("可用余额,含小数") 39 | private Long balance; 40 | 41 | @ApiModelProperty("创建时间") 42 | private Long createTime; 43 | 44 | @Override 45 | public Serializable primaryKey() { 46 | return id; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Category.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.code4everything.boot.base.encoder.Sealed; 11 | import org.springframework.data.annotation.Id; 12 | import org.springframework.data.mongodb.core.mapping.Document; 13 | 14 | import java.io.Serializable; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2018/9/12 19 | */ 20 | @Data 21 | @ToString 22 | @Document 23 | @NoArgsConstructor 24 | @AllArgsConstructor 25 | @ApiModel(description = "分类") 26 | public class Category implements BaseDomain { 27 | 28 | private static final long serialVersionUID = 8409185108165215228L; 29 | 30 | @Id 31 | @ApiModelProperty("编号") 32 | private String id; 33 | 34 | @Sealed 35 | @ApiModelProperty("用户编号") 36 | private String userId; 37 | 38 | @ApiModelProperty("分类名称") 39 | private String name; 40 | 41 | @ApiModelProperty("创建时间") 42 | private Long createTime; 43 | 44 | @Override 45 | public Serializable primaryKey() { 46 | return id; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Dailies.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.springframework.data.annotation.Id; 11 | import org.springframework.data.mongodb.core.mapping.Document; 12 | 13 | import java.io.Serializable; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2018/9/9 18 | */ 19 | @Data 20 | @ToString 21 | @Document 22 | @NoArgsConstructor 23 | @AllArgsConstructor 24 | @ApiModel(description = "日常记录详情") 25 | public class Dailies implements BaseDomain { 26 | 27 | private static final long serialVersionUID = 7412904612383454457L; 28 | 29 | @Id 30 | @ApiModelProperty("详情编号") 31 | private String id; 32 | 33 | @ApiModelProperty("日常记录编号") 34 | private String dailyId; 35 | 36 | @ApiModelProperty("创建时间") 37 | private Long createTime; 38 | 39 | @ApiModelProperty("开始时间") 40 | private String startTime; 41 | 42 | @ApiModelProperty("结束时间") 43 | private String endTime; 44 | 45 | @ApiModelProperty("详情内容") 46 | private String content; 47 | 48 | @Override 49 | public Serializable primaryKey() { 50 | return id; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Daily.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import lombok.ToString; 10 | import org.code4everything.boot.base.DateUtils; 11 | import org.code4everything.boot.base.bean.BaseDomain; 12 | import org.code4everything.boot.base.encoder.Sealed; 13 | import org.code4everything.boot.web.mvc.AssertUtils; 14 | import org.code4everything.springbee.constant.BeeErrorConsts; 15 | import org.code4everything.springbee.model.DailyVO; 16 | import org.springframework.beans.BeanUtils; 17 | import org.springframework.data.annotation.Id; 18 | import org.springframework.data.mongodb.core.mapping.Document; 19 | 20 | import java.io.Serializable; 21 | import java.sql.Date; 22 | import java.util.Objects; 23 | 24 | /** 25 | * @author pantao 26 | * @since 2018/9/9 27 | */ 28 | @Data 29 | @ToString 30 | @Document 31 | @NoArgsConstructor 32 | @AllArgsConstructor 33 | @ApiModel(description = "日常记录") 34 | public class Daily implements BaseDomain { 35 | 36 | private static final long serialVersionUID = 1469674945908223445L; 37 | 38 | @Id 39 | @ApiModelProperty("记录编号") 40 | private String id; 41 | 42 | @Sealed 43 | @ApiModelProperty("用户编号") 44 | private String userId; 45 | 46 | @ApiModelProperty("记录的日期") 47 | private String date; 48 | 49 | @ApiModelProperty("记录时间") 50 | private Long createTime; 51 | 52 | @ApiModelProperty("评价:0~10,6分以下表现欠佳,6分合格,7分还行,8分优秀,9以上非常优秀") 53 | private Integer score; 54 | 55 | @ApiModelProperty("天气") 56 | private String weather; 57 | 58 | @ApiModelProperty("记录内容(可作为日记)") 59 | private String content; 60 | 61 | public Daily copyFrom(DailyVO dailyVO) { 62 | BeanUtils.copyProperties(dailyVO, this); 63 | if (Objects.isNull(dailyVO.getDate())) { 64 | dailyVO.setDate(new Date(System.currentTimeMillis())); 65 | } else { 66 | AssertUtils.throwIf(dailyVO.getDate().after(DateUtils.getEndOfToday()), BeeErrorConsts.DATE_FUTURE); 67 | } 68 | this.setDate(DateUtil.formatDate(dailyVO.getDate())); 69 | return this; 70 | } 71 | 72 | @Override 73 | public Serializable primaryKey() { 74 | return id; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Document.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.code4everything.boot.base.encoder.Sealed; 11 | import org.springframework.data.annotation.Id; 12 | 13 | import java.io.Serializable; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2018/9/13 18 | */ 19 | @Data 20 | @ToString 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @ApiModel(description = "文件") 24 | @org.springframework.data.mongodb.core.mapping.Document 25 | public class Document implements BaseDomain { 26 | 27 | private static final long serialVersionUID = 6805524282169955828L; 28 | 29 | @Id 30 | @ApiModelProperty("文件编号") 31 | private String id; 32 | 33 | @Sealed 34 | @ApiModelProperty("文件本地路径") 35 | private String localPath; 36 | 37 | @ApiModelProperty("访问链接") 38 | private String accessUrl; 39 | 40 | @ApiModelProperty("文件后缀") 41 | private String suffix; 42 | 43 | @ApiModelProperty("上传时间") 44 | private Long createTime; 45 | 46 | @ApiModelProperty("文件大小") 47 | private Long size; 48 | 49 | @Override 50 | public Serializable primaryKey() { 51 | return id; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Income.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import lombok.ToString; 10 | import org.code4everything.boot.base.bean.BaseDomain; 11 | import org.code4everything.boot.base.encoder.Sealed; 12 | import org.code4everything.springbee.model.IncomeVO; 13 | import org.springframework.beans.BeanUtils; 14 | import org.springframework.data.annotation.Id; 15 | import org.springframework.data.mongodb.core.mapping.Document; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * @author pantao 21 | * @since 2018/9/9 22 | */ 23 | @Data 24 | @ToString 25 | @Document 26 | @NoArgsConstructor 27 | @AllArgsConstructor 28 | @ApiModel(value = "income", description = "收益明细,包括支出") 29 | public class Income implements BaseDomain { 30 | 31 | @Id 32 | @ApiModelProperty("收益编号") 33 | private String id; 34 | 35 | @Sealed 36 | @ApiModelProperty("资产编号") 37 | private String assetId; 38 | 39 | @ApiModelProperty(value = "类型:-1支出,1收入", allowableValues = "-1, 1") 40 | private Integer type; 41 | 42 | @ApiModelProperty(value = "付款方式(1其他,2支付宝,3微信,4银联,5信用卡,6现金)", allowableValues = "0, 1, 2, 3, 4, 5, 6") 43 | private String way; 44 | 45 | @ApiModelProperty("日期") 46 | private String date; 47 | 48 | @ApiModelProperty("金额") 49 | private Long money; 50 | 51 | @ApiModelProperty("分类") 52 | private String category; 53 | 54 | @ApiModelProperty("备注") 55 | private String remark; 56 | 57 | @ApiModelProperty("创建时间") 58 | private Long createTime; 59 | 60 | public Income copyFrom(IncomeVO incomeVO) { 61 | BeanUtils.copyProperties(incomeVO, this); 62 | this.setDate(DateUtil.formatDate(incomeVO.getDate())); 63 | return this; 64 | } 65 | 66 | @Override 67 | public Serializable primaryKey() { 68 | return id; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Job.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.code4everything.boot.base.encoder.Sealed; 11 | import org.springframework.data.annotation.Id; 12 | import org.springframework.data.mongodb.core.mapping.Document; 13 | 14 | import java.io.Serializable; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2019/3/1 19 | */ 20 | @Data 21 | @ToString 22 | @Document 23 | @NoArgsConstructor 24 | @AllArgsConstructor 25 | @ApiModel(value = "job", description = "工作日志") 26 | public class Job implements BaseDomain { 27 | 28 | private static final long serialVersionUID = 604254191203691374L; 29 | 30 | @Id 31 | @ApiModelProperty("编号") 32 | private String id; 33 | 34 | @Sealed 35 | @ApiModelProperty("用户编号") 36 | private String userId; 37 | 38 | @ApiModelProperty("开始工作时间") 39 | private Long workTimeStart; 40 | 41 | @ApiModelProperty("工作结束时间") 42 | private Long workTimeEnd; 43 | 44 | @ApiModelProperty("方式:1正常,2加班") 45 | private String workWay; 46 | 47 | @ApiModelProperty("工作日志") 48 | private String workDiary; 49 | 50 | @ApiModelProperty("公司") 51 | private String company; 52 | 53 | @ApiModelProperty("状态:0未处理,1已处理(加班工资,或调休)") 54 | private String status; 55 | 56 | @ApiModelProperty("创建时间") 57 | private Long createTime; 58 | 59 | @Override 60 | public Serializable primaryKey() { 61 | return id; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Log.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.springframework.data.annotation.Id; 11 | import org.springframework.data.mongodb.core.mapping.Document; 12 | 13 | import java.io.Serializable; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2018/9/10 18 | */ 19 | @Data 20 | @ToString 21 | @Document 22 | @NoArgsConstructor 23 | @AllArgsConstructor 24 | @ApiModel(description = "日志") 25 | public class Log implements BaseDomain { 26 | 27 | private static final long serialVersionUID = -9056492805237354620L; 28 | 29 | @Id 30 | @ApiModelProperty("日志编号") 31 | private String id; 32 | 33 | @ApiModelProperty("用户编号") 34 | private String userId; 35 | 36 | @ApiModelProperty("日志描述") 37 | private String description; 38 | 39 | @ApiModelProperty("远程IP") 40 | private String ip; 41 | 42 | @ApiModelProperty("类名") 43 | private String className; 44 | 45 | @ApiModelProperty("方法名") 46 | private String methodName; 47 | 48 | @ApiModelProperty("生成时间") 49 | private Long createTime; 50 | 51 | @ApiModelProperty("参数集合") 52 | private String args; 53 | 54 | @ApiModelProperty("异常类") 55 | private String exceptionClass; 56 | 57 | @ApiModelProperty("异常详情") 58 | private String exceptionDetail; 59 | 60 | @ApiModelProperty("执行时长") 61 | private Long executedTime; 62 | 63 | @Override 64 | public Serializable primaryKey() { 65 | return id; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Setting.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.code4everything.boot.base.encoder.Sealed; 11 | import org.springframework.data.annotation.Id; 12 | 13 | import java.io.Serializable; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2019/5/10 18 | */ 19 | @Data 20 | @ToString 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @ApiModel(description = "用户配置") 24 | public class Setting implements BaseDomain { 25 | 26 | private static final long serialVersionUID = -4891805531653159414L; 27 | 28 | @Id 29 | @ApiModelProperty("编号") 30 | private String id; 31 | 32 | @Sealed 33 | @ApiModelProperty("用户编号") 34 | private String userId; 35 | 36 | @ApiModelProperty("创建时间") 37 | private Long createTime; 38 | 39 | // ---------------------收入支出模块------------------- 40 | 41 | @ApiModelProperty(value = "默认查询时长(天)", allowableValues = "0, 7, 30") 42 | private Integer incomeDayLength; 43 | 44 | // ---------------------待办事项模块-------------------------------- 45 | 46 | @ApiModelProperty(value = "默认查询时长(天)", allowableValues = "0, 7, 30") 47 | private Integer todoDayLength; 48 | 49 | 50 | // -------------------日程模块---------------------- 51 | 52 | @ApiModelProperty("日程评分规则") 53 | private String dailyEvaluateRule; 54 | 55 | @ApiModelProperty(value = "默认查询时长(天)", allowableValues = "0, 7, 30") 56 | private Integer dailyDayLength; 57 | 58 | @Override 59 | public Serializable primaryKey() { 60 | return id; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/Todo.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.code4everything.boot.base.encoder.Sealed; 11 | import org.springframework.data.annotation.Id; 12 | import org.springframework.data.mongodb.core.mapping.Document; 13 | 14 | import java.io.Serializable; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2018/9/9 19 | */ 20 | @Data 21 | @ToString 22 | @Document 23 | @NoArgsConstructor 24 | @AllArgsConstructor 25 | @ApiModel(description = "待办事项") 26 | public class Todo implements BaseDomain { 27 | 28 | private static final long serialVersionUID = -7735706142745311409L; 29 | 30 | @Id 31 | @ApiModelProperty("事项编号") 32 | private String id; 33 | 34 | @Sealed 35 | @ApiModelProperty("用户编号") 36 | private String userId; 37 | 38 | @ApiModelProperty("计划事项完成的日期") 39 | private String doingDate; 40 | 41 | @ApiModelProperty("事项内容") 42 | private String content; 43 | 44 | @ApiModelProperty("创建时间") 45 | private Long createTime; 46 | 47 | @ApiModelProperty(value = "状态:0待完成,1已完成", allowableValues = "0, 1") 48 | private String status; 49 | 50 | @ApiModelProperty("实际完成时间") 51 | private Long doneTime; 52 | 53 | @Override 54 | public Serializable primaryKey() { 55 | return id; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/domain/User.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import org.code4everything.boot.base.bean.BaseDomain; 10 | import org.code4everything.boot.base.encoder.Sealed; 11 | import org.springframework.data.annotation.Id; 12 | import org.springframework.data.mongodb.core.mapping.Document; 13 | 14 | import java.io.Serializable; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2018/9/9 19 | */ 20 | @Data 21 | @ToString 22 | @Document 23 | @NoArgsConstructor 24 | @AllArgsConstructor 25 | @ApiModel(description = "用户") 26 | public class User implements BaseDomain { 27 | 28 | private static final long serialVersionUID = -6525132818366237428L; 29 | 30 | @Id 31 | @Sealed 32 | @ApiModelProperty("用户编号") 33 | private String id; 34 | 35 | @ApiModelProperty("用户名") 36 | private String username; 37 | 38 | @ApiModelProperty("昵称") 39 | private String nickname; 40 | 41 | @ApiModelProperty("头像地址") 42 | private String avatar; 43 | 44 | @Sealed 45 | @ApiModelProperty("密码") 46 | private String password; 47 | 48 | @ApiModelProperty("个人简介") 49 | private String bio; 50 | 51 | @ApiModelProperty(value = "性别:0未知,1男,2女", allowableValues = "0, 1, 2") 52 | private String gender; 53 | 54 | @ApiModelProperty("邮箱") 55 | private String email; 56 | 57 | @ApiModelProperty(value = "用户状态(0冻结,1待激活,2限制登录,7正常)", allowableValues = "0, 1, 2, 7") 58 | private String status; 59 | 60 | @ApiModelProperty("最近一次登录时间") 61 | private Long loginTime; 62 | 63 | @ApiModelProperty("注册时间") 64 | private Long createTime; 65 | 66 | @Override 67 | public Serializable primaryKey() { 68 | return id; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/DailiesVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | 10 | import javax.validation.constraints.NotBlank; 11 | import java.io.Serializable; 12 | 13 | /** 14 | * @author pantao 15 | * @since 2018/9/11 16 | */ 17 | @Data 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | @ApiModel(description = "日程详情") 21 | public class DailiesVO implements BaseBean, Serializable { 22 | 23 | @NotBlank 24 | @ApiModelProperty("开始时间") 25 | private String startTime; 26 | 27 | @NotBlank 28 | @ApiModelProperty("结束时间") 29 | private String endTime; 30 | 31 | @NotBlank 32 | @ApiModelProperty("详情内容") 33 | private String content; 34 | } 35 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/DailyVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | 10 | import javax.validation.constraints.Max; 11 | import javax.validation.constraints.Min; 12 | import java.io.Serializable; 13 | import java.sql.Date; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2018/9/10 18 | */ 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @ApiModel(description = "日程记录") 23 | public class DailyVO implements BaseBean, Serializable { 24 | 25 | @ApiModelProperty("记录日期(默认为当前日期)") 26 | private Date date; 27 | 28 | @Max(10) 29 | @Min(0) 30 | @ApiModelProperty(value = "评分", required = true) 31 | private Integer score; 32 | 33 | @ApiModelProperty("天气") 34 | private String weather; 35 | 36 | @ApiModelProperty("记录内容") 37 | private String content; 38 | } 39 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/IncomeBillVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * @author pantao 14 | * @since 2018/11/18 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @ApiModel(description = "月账单") 20 | public class IncomeBillVO implements BaseBean, Serializable { 21 | 22 | @ApiModelProperty("日期") 23 | private String date; 24 | 25 | @ApiModelProperty("支出总计") 26 | private Long money; 27 | } 28 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/IncomeVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | import org.hibernate.validator.constraints.Length; 10 | 11 | import javax.validation.constraints.Max; 12 | import javax.validation.constraints.Min; 13 | import javax.validation.constraints.NotBlank; 14 | import javax.validation.constraints.NotNull; 15 | import java.io.Serializable; 16 | import java.sql.Date; 17 | 18 | /** 19 | * @author pantao 20 | * @since 2018/9/11 21 | */ 22 | @Data 23 | @NoArgsConstructor 24 | @AllArgsConstructor 25 | @ApiModel(description = "收益信息") 26 | public class IncomeVO implements BaseBean, Serializable { 27 | 28 | @Max(1) 29 | @Min(-1) 30 | @ApiModelProperty(value = "类型:-1支出,1收入", allowableValues = "-1, 1") 31 | private Integer type; 32 | 33 | @NotBlank 34 | @Length(max = 1) 35 | @ApiModelProperty(value = "付款方式(1其他,2支付宝,3微信,4银联,5信用卡,6现金)", allowableValues = "1, 2, 3, 4, 5, 6") 36 | private String way; 37 | 38 | @NotNull 39 | @ApiModelProperty("日期") 40 | private Date date; 41 | 42 | @NotNull 43 | @ApiModelProperty("金额") 44 | private Long money; 45 | 46 | @ApiModelProperty("分类") 47 | private String category; 48 | 49 | @ApiModelProperty("备注") 50 | private String remark; 51 | } 52 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/JobVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import org.code4everything.boot.base.bean.BaseBean; 10 | import org.code4everything.springbee.domain.Job; 11 | import org.springframework.beans.BeanUtils; 12 | 13 | import java.io.Serializable; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2019/3/1 18 | */ 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @ApiModel(description = "工作日志") 23 | public class JobVO implements Serializable, BaseBean { 24 | 25 | @ApiModelProperty("编号") 26 | private String id; 27 | 28 | @ApiModelProperty("开始工作时间") 29 | private Long workTimeStart; 30 | 31 | @ApiModelProperty("工作结束时间") 32 | private Long workTimeEnd; 33 | 34 | @ApiModelProperty("公司") 35 | private String company; 36 | 37 | @ApiModelProperty("方式:1正常,2加班") 38 | private String workWay; 39 | 40 | @ApiModelProperty("工作日志") 41 | private String workDiary; 42 | 43 | @Override 44 | public T copyInto(T target) { 45 | if (target instanceof Job) { 46 | Job job = (Job) target; 47 | if (StrUtil.isNotEmpty(id)) { 48 | job.setId(id); 49 | } 50 | job.setWorkTimeStart(workTimeStart); 51 | job.setWorkTimeEnd(workTimeEnd); 52 | job.setCompany(company); 53 | job.setWorkWay(workWay); 54 | job.setWorkDiary(workDiary); 55 | } else { 56 | BeanUtils.copyProperties(this, target); 57 | } 58 | return target; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/PasswordVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | import org.hibernate.validator.constraints.Length; 10 | 11 | import javax.validation.constraints.Email; 12 | import java.io.Serializable; 13 | 14 | /** 15 | * @author pantao 16 | * @since 2018/9/19 17 | */ 18 | @Data 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | @ApiModel(description = "重置密码") 22 | public class PasswordVO implements BaseBean, Serializable { 23 | 24 | @Email 25 | @ApiModelProperty(value = "邮箱", required = true) 26 | private String email; 27 | 28 | @Length(min = 6, max = 20) 29 | @ApiModelProperty(value = "新密码", required = true) 30 | private String newPassword; 31 | 32 | @Length(min = 6, max = 20) 33 | @ApiModelProperty(value = "验证码", required = true) 34 | private String vcode; 35 | } 36 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/RegisterVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | import org.hibernate.validator.constraints.Length; 10 | 11 | import javax.validation.constraints.Email; 12 | import javax.validation.constraints.NotBlank; 13 | import java.io.Serializable; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2018/9/10 18 | */ 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | @ApiModel(description = "注册信息") 23 | public class RegisterVO implements BaseBean, Serializable { 24 | 25 | @NotBlank 26 | @ApiModelProperty(value = "用户名", required = true) 27 | private String username; 28 | 29 | @Email 30 | @ApiModelProperty(value = "邮箱", required = true) 31 | private String email; 32 | 33 | @Length(min = 6, max = 20) 34 | @ApiModelProperty(value = "密码", required = true) 35 | private String password; 36 | 37 | @Length(min = 6, max = 6) 38 | @ApiModelProperty(value = "验证码", required = true) 39 | private String vcode; 40 | } 41 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/TodoCountVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * @author pantao 14 | * @since 2018/11/18 15 | */ 16 | @Data 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | @ApiModel(description = "待办事项统计") 20 | public class TodoCountVO implements BaseBean, Serializable { 21 | 22 | @ApiModelProperty("日期") 23 | private String date; 24 | 25 | @ApiModelProperty("数量") 26 | private Integer score; 27 | } 28 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/TodoVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | import org.code4everything.boot.base.bean.BaseBean; 10 | 11 | import javax.validation.constraints.NotBlank; 12 | import java.io.Serializable; 13 | import java.util.Objects; 14 | 15 | /** 16 | * @author pantao 17 | * @since 2019/2/12 18 | */ 19 | @Data 20 | @AllArgsConstructor 21 | @NoArgsConstructor 22 | @EqualsAndHashCode 23 | @ApiModel(description = "待办事项") 24 | public class TodoVO implements BaseBean, Serializable { 25 | 26 | @NotBlank 27 | @ApiModelProperty(value = "计划完成日期", required = true) 28 | private String doingDate; 29 | 30 | @NotBlank 31 | @ApiModelProperty(value = "事项内容", required = true) 32 | private String content; 33 | 34 | @ApiModelProperty("日期偏移") 35 | private Integer offset; 36 | 37 | @ApiModelProperty("重复次数") 38 | private Integer repeat; 39 | 40 | public int getOffsetWell() { 41 | return Objects.isNull(offset) || offset < 0 ? 0 : offset; 42 | } 43 | 44 | public int getRepeatWell() { 45 | return Objects.isNull(repeat) || repeat < 0 ? 0 : repeat; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/model/UserInfoVO.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.model; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.code4everything.boot.base.bean.BaseBean; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * @author pantao 14 | * @since 2018/9/10 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @ApiModel(description = "用户信息") 20 | public class UserInfoVO implements BaseBean, Serializable { 21 | 22 | @ApiModelProperty("昵称") 23 | private String nickname; 24 | 25 | @ApiModelProperty("个人简介") 26 | private String bio; 27 | 28 | @ApiModelProperty("性别") 29 | private String gender; 30 | } 31 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/CategoryService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.springbee.domain.Category; 4 | import org.springframework.scheduling.annotation.Async; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author pantao 10 | * @since 2018/9/20 11 | */ 12 | public interface CategoryService { 13 | 14 | /** 15 | * 更新分类 16 | * 17 | * @param categoryId 分类的编号 18 | * @param userId 用户编号 19 | * @param name 分类名称 20 | */ 21 | @Async 22 | void updateCategory(String categoryId, String userId, String name); 23 | 24 | /** 25 | * 删除分类 26 | * 27 | * @param categoryId 分类的编号 28 | */ 29 | @Async 30 | void removeCategory(String categoryId); 31 | 32 | /** 33 | * 检测分类是否存在 34 | * 35 | * @param userId 用户名 36 | * @param name 分类名 37 | * 38 | * @return 是否存在 39 | */ 40 | boolean exists(String userId, String name); 41 | 42 | /** 43 | * 列出用户所有分类 44 | * 45 | * @param userId 用户编号 46 | * 47 | * @return 分类列表 48 | */ 49 | List listCategory(String userId); 50 | 51 | /** 52 | * 添加分类 53 | * 54 | * @param userId 用户编号 55 | * @param name 分类名称 56 | * 57 | * @return 分类 58 | */ 59 | Category appendCategory(String userId, String name); 60 | } 61 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/CommonService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | /** 4 | * @author pantao 5 | * @since 2018/9/16 6 | */ 7 | public interface CommonService { 8 | 9 | /** 10 | * 检测用户名是否存在 11 | * 12 | * @param username 用户名 13 | * 14 | * @return 是否存在 15 | */ 16 | boolean existsUsername(String username); 17 | 18 | /** 19 | * 检测邮箱是否存在 20 | * 21 | * @param email 邮箱 22 | * 23 | * @return 是否存在 24 | */ 25 | boolean existsEmail(String email); 26 | } 27 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/DailiesService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.springbee.domain.Dailies; 4 | import org.code4everything.springbee.model.DailiesVO; 5 | import org.springframework.scheduling.annotation.Async; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2018/9/24 12 | */ 13 | public interface DailiesService { 14 | 15 | /** 16 | * 列出日程所有的详细记录 17 | * 18 | * @param dailyId 日程编号 19 | * 20 | * @return 详细记录列表 21 | */ 22 | List listDailies(String dailyId); 23 | 24 | /** 25 | * 更新日程详细记录 26 | * 27 | * @param dailiesId 详细记录编号 28 | * @param dailiesVO 详细记录内容 29 | * 30 | * @return 详细记录 31 | */ 32 | Dailies updateDailies(String dailiesId, DailiesVO dailiesVO); 33 | 34 | /** 35 | * 删除详细记录 36 | * 37 | * @param dailiesId 详细记录编号 38 | */ 39 | @Async 40 | void remove(String dailiesId); 41 | 42 | /** 43 | * 保存详细记录信息 44 | * 45 | * @param dailyId 日程编号 46 | * @param dailiesVO 详细记录内容 47 | * 48 | * @return 详细记录 49 | */ 50 | Dailies saveDailies(String dailyId, DailiesVO dailiesVO); 51 | } 52 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/DailyService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.springbee.domain.Daily; 4 | import org.code4everything.springbee.model.DailyVO; 5 | import org.springframework.scheduling.annotation.Async; 6 | 7 | import java.sql.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * @author pantao 12 | * @since 2018/9/22 13 | */ 14 | public interface DailyService { 15 | 16 | /** 17 | * 检测日程是否存在 18 | * 19 | * @param dailyId 日程编号 20 | * 21 | * @return 是否存在 22 | */ 23 | boolean exists(String dailyId); 24 | 25 | /** 26 | * 获取日程信息 27 | * 28 | * @param userId 用户编号 29 | * @param date 日期 30 | * 31 | * @return 日程记录 32 | */ 33 | Daily getDaily(String userId, Date date); 34 | 35 | /** 36 | * 列出日程记录 37 | * 38 | * @param userId 用户编号 39 | * @param startDate 开始日期 40 | * @param endDate 截止日期 41 | * 42 | * @return 日程列表 43 | */ 44 | List listDaily(String userId, Date startDate, Date endDate); 45 | 46 | /** 47 | * 删除日程 48 | * 49 | * @param dailyId 日程编号 50 | */ 51 | @Async 52 | void remove(String dailyId); 53 | 54 | /** 55 | * 保存日程 56 | * 57 | * @param userId 用户编号 58 | * @param dailyVO 日程记录内容 59 | * 60 | * @return 日程记录 61 | */ 62 | Daily saveDaily(String userId, DailyVO dailyVO); 63 | 64 | /** 65 | * 检测日程是否存在 66 | * 67 | * @param userId 用户编号 68 | * @param dailyId 日程编号 69 | * @param date 日程内容 70 | * 71 | * @return 是否存在 72 | */ 73 | boolean exists(String userId, String dailyId, Date date); 74 | 75 | /** 76 | * 更新日程记录 77 | * 78 | * 79 | * @param userId 80 | * @param dailyId 日程编号 81 | * @param dailyVO 日程内容 82 | * 83 | * @return 日程记录 84 | */ 85 | Daily updateDaily(String userId, String dailyId, DailyVO dailyVO); 86 | } 87 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/DocumentService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.boot.service.BootFileService; 4 | import org.code4everything.springbee.domain.Document; 5 | 6 | /** 7 | * @author pantao 8 | * @since 2018/9/13 9 | */ 10 | public interface DocumentService extends BootFileService {} 11 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/IncomeService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.springbee.domain.Income; 4 | import org.code4everything.springbee.model.IncomeBillVO; 5 | import org.code4everything.springbee.model.IncomeVO; 6 | import org.springframework.scheduling.annotation.Async; 7 | 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * @author pantao 13 | * @since 2018/9/20 14 | */ 15 | public interface IncomeService { 16 | 17 | /** 18 | * 获取资产余额 19 | * 20 | * @param userId 用户编号 21 | * 22 | * @return 资产余额 23 | */ 24 | Long getAssetBalance(String userId); 25 | 26 | /** 27 | * 列出收益记录 28 | * 29 | * @param userId 用户编号 30 | * @param category 分类 31 | * @param start 开始日期 32 | * @param end 截止日期 33 | * 34 | * @return 收益记录列表 35 | */ 36 | List listIncome(String userId, String category, Date start, Date end); 37 | 38 | /** 39 | * 列出每年的支出总计 40 | * 41 | * @param userId 用户编号 42 | * @param startYear 开始年份 43 | * @param endYear 截止年份 44 | * 45 | * @return 支出总计列表 46 | */ 47 | List listYear(String userId, Integer startYear, Integer endYear); 48 | 49 | /** 50 | * 列出每月的支出总计 51 | * 52 | * @param userId 用户编号 53 | * @param startMonth 开始月份,格式:2018-06 54 | * @param endMonth 截止月份,格式:2018-12 55 | * 56 | * @return 支出总计列表 57 | */ 58 | List listMonth(String userId, String startMonth, String endMonth); 59 | 60 | /** 61 | * 更新收益信息 62 | * 63 | * @param userId 用户编号 64 | * @param incomeId 收益记录编号 65 | * @param incomeVO 收益信息 66 | * 67 | * @return 收益信息 68 | */ 69 | Income updateIncome(String userId, String incomeId, IncomeVO incomeVO); 70 | 71 | /** 72 | * 删除收益记录 73 | * 74 | * @param userId 用户编号 75 | * @param incomeId 收益记录编号 76 | */ 77 | @Async 78 | void remove(String userId, String incomeId); 79 | 80 | /** 81 | * 保存收益记录 82 | * 83 | * @param userId 用户编号 84 | * @param incomeVO 收益信息 85 | * 86 | * @return 收益信息 87 | */ 88 | Income saveIncome(String userId, IncomeVO incomeVO); 89 | } 90 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/JobService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.springbee.domain.Job; 4 | import org.code4everything.springbee.model.JobVO; 5 | import org.springframework.data.domain.Page; 6 | 7 | import java.util.Set; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2019/3/1 12 | */ 13 | public interface JobService { 14 | 15 | Job updateStatus(String id, String status); 16 | 17 | Set listCompany(String userId); 18 | 19 | Page listByWorkOverTime(String userId, String status, Integer offset, Integer size); 20 | 21 | Page listAllWorked(String userId, Integer offset, Integer size); 22 | 23 | Page listWorkedByCompanies(String userId, String company, Integer offset, Integer size); 24 | 25 | Job writeWorkDiary(String id, String workDiary); 26 | 27 | Job finishedWork(String id, String workWay, String company); 28 | 29 | Job startWorking(String userId, String workWay, String company); 30 | 31 | Job save(String userId, JobVO jobVO); 32 | 33 | Job getJobOfToday(String userId); 34 | } 35 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/SettingService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | /** 4 | * @author pantao 5 | * @since 2019/5/10 6 | */ 7 | public interface SettingService { 8 | 9 | void updateDailyEvaluateRule(String userId, String dailyEvaluateRule); 10 | 11 | String getDailyEvaluateRule(String userId); 12 | } 13 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/TodoService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.springbee.domain.Todo; 4 | import org.code4everything.springbee.model.TodoCountVO; 5 | import org.code4everything.springbee.model.TodoVO; 6 | import org.springframework.scheduling.annotation.Async; 7 | 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * @author pantao 13 | * @since 2018/9/24 14 | */ 15 | public interface TodoService { 16 | 17 | /** 18 | * 列出指定日期之前未完成的待办事项 19 | * 20 | * @param userId 用户编号 21 | * @param date 日期 22 | * 23 | * @return 待办事项列表 24 | */ 25 | List listUndoBeforeDate(String userId, Date date); 26 | 27 | /** 28 | * 列出所有代办事项 29 | * 30 | * @param userId 用户编号 31 | * @param doingDate 日期 32 | * 33 | * @return 待办事项列表 34 | */ 35 | List listTodo(String userId, Date doingDate); 36 | 37 | /** 38 | * 列出所有日期 39 | * 40 | * @param userId 用户编号 41 | * 42 | * @return 日期列表 43 | */ 44 | List listDate(String userId); 45 | 46 | /** 47 | * 统计每天的代办事项数量 48 | * 49 | * @param userId 用户编号 50 | * @param start 开始日期 51 | * @param end 截止日期 52 | * 53 | * @return 数量列表 54 | */ 55 | List listTodoCount(String userId, Date start, Date end); 56 | 57 | /** 58 | * 更新代办事项状态 59 | * 60 | * @param todoId 事项编号 61 | * @param status 状态:0未完成,1已完成 62 | * 63 | * @return 代办事项 64 | */ 65 | Todo updateTodoStatus(String todoId, String status); 66 | 67 | /** 68 | * 更新待办事项内容 69 | * 70 | * @param todoId 事项编号 71 | * @param content 内容 72 | * 73 | * @return 代办事项 74 | */ 75 | Todo updateTodo(String todoId, String content); 76 | 77 | /** 78 | * 删除事项 79 | * 80 | * @param todoId 事项编号 81 | */ 82 | @Async 83 | void remove(String todoId); 84 | 85 | /** 86 | * 保存代办事项 87 | * 88 | * @param userId 用户编号 89 | * @param todoVO 代办事项 90 | * 91 | * @return 待办事项 92 | */ 93 | Todo saveTodo(String userId, TodoVO todoVO); 94 | } 95 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/UserService.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service; 2 | 3 | import org.code4everything.boot.service.BootUserService; 4 | import org.code4everything.springbee.domain.User; 5 | import org.code4everything.springbee.model.RegisterVO; 6 | import org.code4everything.springbee.model.UserInfoVO; 7 | import org.springframework.scheduling.annotation.Async; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2018/9/15 12 | */ 13 | public interface UserService extends BootUserService { 14 | 15 | void updateEmail(User user, String email); 16 | 17 | void updateUsername(User user, String username); 18 | 19 | void updateAvatar(User user, String avatar); 20 | 21 | /** 22 | * 更新用户信息 23 | * 24 | * @param user 用户 25 | * @param userInfoVO 用户信息 26 | * 27 | */ 28 | void updateInfo(User user, UserInfoVO userInfoVO); 29 | 30 | /** 31 | * 注册用户 32 | * 33 | * @param registerVO 注册信息 34 | */ 35 | @Async 36 | void register(RegisterVO registerVO); 37 | 38 | /** 39 | * 重置密码 40 | * 41 | * @param email 邮箱 42 | * @param newPassword 新密码 43 | */ 44 | @Async 45 | void resetPassword(String email, String newPassword); 46 | 47 | /** 48 | * 更新密码 49 | * 50 | * @param user 用户 51 | * @param oldPassword 旧密码 52 | * @param newPassword 新密码 53 | * 54 | * @return 是否更新成功 55 | */ 56 | boolean updatePassword(User user, String oldPassword, String newPassword); 57 | 58 | /** 59 | * 登录 60 | * 61 | * @param loginName 登录名 62 | * @param password 密码 63 | * 64 | * @return 登录 Token 65 | */ 66 | String login(String loginName, String password); 67 | } 68 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | import org.code4everything.boot.log.LogMethod; 5 | import org.code4everything.boot.web.mvc.AssertUtils; 6 | import org.code4everything.springbee.constant.BeeErrorConsts; 7 | import org.code4everything.springbee.dao.CategoryDAO; 8 | import org.code4everything.springbee.domain.Category; 9 | import org.code4everything.springbee.service.CategoryService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | import java.util.Optional; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2018/9/20 19 | */ 20 | @Service 21 | public class CategoryServiceImpl implements CategoryService { 22 | 23 | private final CategoryDAO categoryDAO; 24 | 25 | @Autowired 26 | public CategoryServiceImpl(CategoryDAO categoryDAO) {this.categoryDAO = categoryDAO;} 27 | 28 | @Override 29 | public void updateCategory(String categoryId, String userId, String name) { 30 | // 如果分类名称不存在时,才更新分类名称 31 | if (!exists(userId, name)) { 32 | Optional categoryOptional = categoryDAO.findById(categoryId); 33 | if (categoryOptional.isPresent()) { 34 | Category category = categoryOptional.get(); 35 | category.setName(name); 36 | categoryDAO.save(category); 37 | } 38 | } 39 | } 40 | 41 | @Override 42 | public void removeCategory(String categoryId) { 43 | categoryDAO.deleteById(categoryId); 44 | } 45 | 46 | @Override 47 | @LogMethod("检查分类是否存在") 48 | public boolean exists(String userId, String name) { 49 | return categoryDAO.existsByUserIdAndName(userId, name); 50 | } 51 | 52 | @Override 53 | @LogMethod("列出分类") 54 | public List listCategory(String userId) { 55 | return categoryDAO.getByUserId(userId); 56 | } 57 | 58 | @Override 59 | @LogMethod("添加收益分类") 60 | public Category appendCategory(String userId, String name) { 61 | AssertUtils.throwIf(exists(userId, name), BeeErrorConsts.CATEGORY_EXISTS); 62 | Category category = new Category(); 63 | category.setCreateTime(System.currentTimeMillis()); 64 | category.setId(IdUtil.simpleUUID()); 65 | category.setName(name); 66 | category.setUserId(userId); 67 | return categoryDAO.save(category); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/impl/CommonServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import org.code4everything.boot.log.LogMethod; 4 | import org.code4everything.springbee.dao.UserDAO; 5 | import org.code4everything.springbee.service.CommonService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2018/9/16 12 | */ 13 | @Service 14 | public class CommonServiceImpl implements CommonService { 15 | 16 | private final UserDAO userDAO; 17 | 18 | @Autowired 19 | public CommonServiceImpl(UserDAO userDAO) { 20 | this.userDAO = userDAO; 21 | } 22 | 23 | @Override 24 | @LogMethod("查看用户名是否存在") 25 | public boolean existsUsername(String username) { 26 | return userDAO.existsByUsername(username); 27 | } 28 | 29 | @Override 30 | @LogMethod("查看邮箱是否存在") 31 | public boolean existsEmail(String email) { 32 | return userDAO.existsByEmail(email); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/impl/DailiesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | import org.code4everything.boot.log.LogMethod; 5 | import org.code4everything.boot.web.mvc.AssertUtils; 6 | import org.code4everything.springbee.constant.BeeErrorConsts; 7 | import org.code4everything.springbee.dao.DailiesDAO; 8 | import org.code4everything.springbee.domain.Dailies; 9 | import org.code4everything.springbee.model.DailiesVO; 10 | import org.code4everything.springbee.service.DailiesService; 11 | import org.code4everything.springbee.service.DailyService; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author pantao 19 | * @since 2018/9/24 20 | */ 21 | @Service 22 | public class DailiesServiceImpl implements DailiesService { 23 | 24 | private final DailiesDAO dailiesDAO; 25 | 26 | private final DailyService dailyService; 27 | 28 | @Autowired 29 | public DailiesServiceImpl(DailiesDAO dailiesDAO, DailyService dailyService) { 30 | this.dailiesDAO = dailiesDAO; 31 | this.dailyService = dailyService; 32 | } 33 | 34 | @Override 35 | @LogMethod("获取所有日程记录详情") 36 | public List listDailies(String dailyId) { 37 | return dailiesDAO.getByDailyId(dailyId); 38 | } 39 | 40 | @Override 41 | @LogMethod("更新日程记录详情") 42 | public Dailies updateDailies(String dailiesId, DailiesVO dailiesVO) { 43 | Dailies dailies = dailiesDAO.getById(dailiesId); 44 | AssertUtils.throwIfNull(dailies, BeeErrorConsts.DAILIES_NOT_FOUND); 45 | return dailiesDAO.save(dailiesVO.copyInto(dailies)); 46 | } 47 | 48 | @Override 49 | @LogMethod("删除日程记录详情") 50 | public void remove(String dailiesId) { 51 | dailiesDAO.deleteById(dailiesId); 52 | } 53 | 54 | @Override 55 | @LogMethod("添加日程记录详情信息") 56 | public Dailies saveDailies(String dailyId, DailiesVO dailiesVO) { 57 | AssertUtils.throwIf(!dailyService.exists(dailyId), BeeErrorConsts.DAILY_NOT_FOUND); 58 | Dailies dailies = dailiesVO.copyInto(new Dailies()); 59 | dailies.setDailyId(dailyId); 60 | dailies.setCreateTime(System.currentTimeMillis()); 61 | dailies.setId(IdUtil.simpleUUID()); 62 | return dailiesDAO.save(dailies); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/impl/DailyServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import cn.hutool.core.util.IdUtil; 5 | import cn.hutool.core.util.ObjectUtil; 6 | import org.code4everything.boot.log.LogMethod; 7 | import org.code4everything.boot.web.mvc.AssertUtils; 8 | import org.code4everything.springbee.constant.BeeErrorConsts; 9 | import org.code4everything.springbee.dao.DailyDAO; 10 | import org.code4everything.springbee.domain.Daily; 11 | import org.code4everything.springbee.model.DailyVO; 12 | import org.code4everything.springbee.service.DailyService; 13 | import org.code4everything.springbee.util.BeeUtils; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.data.domain.Sort; 16 | import org.springframework.data.mongodb.core.MongoTemplate; 17 | import org.springframework.data.mongodb.core.query.Criteria; 18 | import org.springframework.data.mongodb.core.query.Query; 19 | import org.springframework.stereotype.Service; 20 | 21 | import java.sql.Date; 22 | import java.util.List; 23 | import java.util.Objects; 24 | 25 | /** 26 | * @author pantao 27 | * @since 2018/9/22 28 | */ 29 | @Service 30 | public class DailyServiceImpl implements DailyService { 31 | 32 | private final DailyDAO dailyDAO; 33 | 34 | private final MongoTemplate mongoTemplate; 35 | 36 | @Autowired 37 | public DailyServiceImpl(DailyDAO dailyDAO, MongoTemplate mongoTemplate) { 38 | this.dailyDAO = dailyDAO; 39 | this.mongoTemplate = mongoTemplate; 40 | } 41 | 42 | @Override 43 | @LogMethod("检测日程记录是否存在") 44 | public boolean exists(String dailyId) { 45 | return dailyDAO.existsById(dailyId); 46 | } 47 | 48 | @Override 49 | @LogMethod("查找日程记录") 50 | public Daily getDaily(String userId, Date date) { 51 | return dailyDAO.getByUserIdAndDate(userId, DateUtil.formatDate(date)); 52 | } 53 | 54 | @Override 55 | @LogMethod("列出日程记录") 56 | public List listDaily(String userId, Date startDate, Date endDate) { 57 | Query query = new Query(); 58 | Criteria criteria = Criteria.where("userId").is(userId); 59 | BeeUtils.betweenStartAndEnd(criteria, startDate, endDate); 60 | query.addCriteria(criteria); 61 | query.with(new Sort(Sort.Direction.ASC, "date")); 62 | return mongoTemplate.find(query, Daily.class); 63 | } 64 | 65 | @Override 66 | @LogMethod("删除日程记录") 67 | public void remove(String dailyId) { 68 | dailyDAO.deleteById(dailyId); 69 | } 70 | 71 | @Override 72 | @LogMethod("添加日程记录") 73 | public Daily saveDaily(String userId, DailyVO dailyVO) { 74 | AssertUtils.throwIf(exists(userId, "", dailyVO.getDate()), BeeErrorConsts.DAILY_EXISTS); 75 | Daily daily = new Daily().copyFrom(dailyVO); 76 | daily.setCreateTime(System.currentTimeMillis()); 77 | daily.setId(IdUtil.simpleUUID()); 78 | daily.setUserId(userId); 79 | return dailyDAO.save(daily); 80 | } 81 | 82 | @Override 83 | @LogMethod("检测日程记录是否存在") 84 | public boolean exists(String userId, String dailyId, Date date) { 85 | if (Objects.isNull(date)) { 86 | date = new Date(System.currentTimeMillis()); 87 | } 88 | Daily daily = dailyDAO.getByUserIdAndDate(userId, DateUtil.formatDate(date)); 89 | return ObjectUtil.isNotNull(daily) && !dailyId.equals(daily.getId()); 90 | } 91 | 92 | @Override 93 | @LogMethod("更新日程记录") 94 | public Daily updateDaily(String userId, String dailyId, DailyVO dailyVO) { 95 | Daily daily = dailyDAO.getById(dailyId); 96 | AssertUtils.throwIfNull(daily, BeeErrorConsts.DAILY_NOT_FOUND); 97 | AssertUtils.throwIf(exists(userId, dailyId, dailyVO.getDate()), BeeErrorConsts.DAILY_EXISTS); 98 | return dailyDAO.save(daily.copyFrom(dailyVO)); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/impl/DocumentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.io.FileUtil; 4 | import cn.hutool.core.util.IdUtil; 5 | import org.code4everything.boot.log.LogMethod; 6 | import org.code4everything.boot.web.http.DustFile; 7 | import org.code4everything.springbee.SpringBeeApplication; 8 | import org.code4everything.springbee.constant.BeeConfigConsts; 9 | import org.code4everything.springbee.dao.DocumentDAO; 10 | import org.code4everything.springbee.domain.Document; 11 | import org.code4everything.springbee.service.DocumentService; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.Objects; 16 | 17 | /** 18 | * @author pantao 19 | * @since 2018/9/13 20 | */ 21 | @Service 22 | public class DocumentServiceImpl implements DocumentService { 23 | 24 | private final DocumentDAO documentDAO; 25 | 26 | @Autowired 27 | public DocumentServiceImpl(DocumentDAO documentDAO) {this.documentDAO = documentDAO;} 28 | 29 | @Override 30 | @LogMethod("通过访问链接获取本地路径") 31 | public String getLocalPathByAccessUrl(String accessUrl) { 32 | Document document = documentDAO.getByAccessUrl(accessUrl); 33 | return Objects.isNull(document) ? "" : document.getLocalPath(); 34 | } 35 | 36 | @Override 37 | @LogMethod("通过访问链接或本地路径获取文件") 38 | public Document getBy(DustFile dustFile) { 39 | String localPath = SpringBeeApplication.getBeeConfigBean().getStoragePath() + dustFile.getFilename(); 40 | String accessUrl = BeeConfigConsts.DOCUMENT_MAPPING + dustFile.getFilename(); 41 | return documentDAO.getByLocalPathOrAccessUrl(localPath, accessUrl); 42 | } 43 | 44 | @Override 45 | @LogMethod("保存文件") 46 | public Document save(DustFile dustFile) { 47 | Document document = getBy(dustFile); 48 | if (Objects.isNull(document)) { 49 | document = new Document(); 50 | document.setId(IdUtil.randomUUID()); 51 | document.setCreateTime(System.currentTimeMillis()); 52 | document.setAccessUrl(BeeConfigConsts.DOCUMENT_MAPPING + dustFile.getFilename()); 53 | document.setLocalPath(SpringBeeApplication.getBeeConfigBean().getStoragePath() + dustFile.getFilename()); 54 | document.setSuffix(FileUtil.extName(dustFile.getOriginalFilename())); 55 | } 56 | document.setSize(dustFile.getSize()); 57 | return documentDAO.save(document); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/impl/LogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | import cn.hutool.core.util.ObjectUtil; 5 | import org.code4everything.boot.log.MethodLog; 6 | import org.code4everything.boot.service.BootLogService; 7 | import org.code4everything.boot.web.http.HttpUtils; 8 | import org.code4everything.springbee.dao.LogDAO; 9 | import org.code4everything.springbee.domain.Log; 10 | import org.code4everything.springbee.domain.User; 11 | import org.code4everything.springbee.service.UserService; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Service; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | 17 | /** 18 | * @author pantao 19 | * @since 2018/10/14 20 | */ 21 | @Service 22 | public class LogServiceImpl implements BootLogService { 23 | 24 | private final LogDAO logDAO; 25 | 26 | private final HttpServletRequest request; 27 | 28 | private final UserService userService; 29 | 30 | @Autowired 31 | public LogServiceImpl(LogDAO logDAO, HttpServletRequest request, UserService userService) { 32 | this.logDAO = logDAO; 33 | this.request = request; 34 | this.userService = userService; 35 | } 36 | 37 | @Override 38 | public Log save(Log log) { 39 | return logDAO.save(log); 40 | } 41 | 42 | @Override 43 | public Log saveException(Log log, Throwable throwable) { 44 | if (ObjectUtil.isNotNull(log) && ObjectUtil.isNotNull(throwable)) { 45 | log.setExceptionClass(throwable.getClass().getName()); 46 | log.setExceptionDetail(throwable.getMessage()); 47 | logDAO.save(log); 48 | } 49 | return log; 50 | } 51 | 52 | @Override 53 | public Log getLog(MethodLog methodLog) { 54 | Log log = methodLog.copyInto(new Log()); 55 | log.setId(IdUtil.simpleUUID()); 56 | log.setCreateTime(System.currentTimeMillis()); 57 | log.setIp(request.getRemoteAddr()); 58 | User user = userService.getUserByToken(HttpUtils.getToken(request)); 59 | log.setUserId(ObjectUtil.isNull(user) ? "anonymous" : user.getId()); 60 | return log; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/service/impl/SettingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | import org.code4everything.boot.log.LogMethod; 5 | import org.code4everything.springbee.dao.SettingDAO; 6 | import org.code4everything.springbee.domain.Setting; 7 | import org.code4everything.springbee.service.SettingService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.Objects; 12 | 13 | /** 14 | * @author pantao 15 | * @since 2019/5/10 16 | */ 17 | @Service 18 | public class SettingServiceImpl implements SettingService { 19 | 20 | private final SettingDAO settingDAO; 21 | 22 | @Autowired 23 | public SettingServiceImpl(SettingDAO settingDAO) {this.settingDAO = settingDAO;} 24 | 25 | @Override 26 | @LogMethod("保存用户自定义日程评分规则") 27 | public void updateDailyEvaluateRule(String userId, String dailyEvaluateRule) { 28 | Setting setting = getSettingByUserId(userId); 29 | setting.setDailyEvaluateRule(dailyEvaluateRule); 30 | settingDAO.save(setting); 31 | } 32 | 33 | @Override 34 | @LogMethod("获取用户自定义日程评分规则") 35 | public String getDailyEvaluateRule(String userId) { 36 | return getSettingByUserId(userId).getDailyEvaluateRule(); 37 | } 38 | 39 | private Setting getSettingByUserId(String userId) { 40 | Setting setting = settingDAO.getByUserId(userId); 41 | if (Objects.isNull(setting)) { 42 | synchronized (SettingServiceImpl.class) { 43 | setting = settingDAO.getByUserId(userId); 44 | if (Objects.isNull(setting)) { 45 | setting = new Setting(); 46 | setting.setId(IdUtil.simpleUUID()); 47 | setting.setUserId(userId); 48 | setting.setCreateTime(System.currentTimeMillis()); 49 | settingDAO.save(setting); 50 | } 51 | } 52 | } 53 | return setting; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/util/BeeUtils.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.util; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import org.springframework.data.mongodb.core.query.Criteria; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * @author pantao 10 | * @since 2018/10/28 11 | */ 12 | public class BeeUtils { 13 | 14 | private BeeUtils() {} 15 | 16 | public static void betweenStartAndEnd(Criteria criteria, Date start, Date end) { 17 | Criteria dateGreatThan = Criteria.where("date").gte(DateUtil.formatDate(start)); 18 | Criteria dateLessThan = Criteria.where("date").lte(DateUtil.formatDate(end)); 19 | criteria.andOperator(dateGreatThan, dateLessThan); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/util/Checker.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.util; 2 | 3 | import org.code4everything.boot.message.VerifyCodeUtils; 4 | import org.code4everything.boot.web.mvc.AssertUtils; 5 | import org.code4everything.springbee.constant.BeeErrorConsts; 6 | import org.code4everything.springbee.service.CommonService; 7 | 8 | /** 9 | * @author pantao 10 | * @since 2019-05-09 11 | */ 12 | public class Checker { 13 | 14 | private Checker() {} 15 | 16 | public static void checkUsername(CommonService commonService, String username) { 17 | AssertUtils.throwIf(commonService.existsUsername(username), BeeErrorConsts.USERNAME_EXISTS); 18 | } 19 | 20 | public static void checkEmail(CommonService commonService, String email) { 21 | AssertUtils.throwIf(commonService.existsEmail(email), BeeErrorConsts.EMAIL_EXISTS); 22 | } 23 | 24 | public static void checkVerifyCode(String email, String vcode) { 25 | VerifyCodeUtils.assertCorrect(email, vcode, true, BeeErrorConsts.CODE_INCORRECT); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/AssetController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.code4everything.boot.web.mvc.BaseSignController; 6 | import org.code4everything.boot.web.mvc.Response; 7 | import org.code4everything.springbee.domain.User; 8 | import org.code4everything.springbee.service.IncomeService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | /** 15 | * @author pantao 16 | * @since 2018/9/11 17 | */ 18 | @RestController 19 | @RequestMapping("/user/asset") 20 | @Api(tags = "资产接口") 21 | public class AssetController extends BaseSignController { 22 | 23 | private final IncomeService incomeService; 24 | 25 | @Autowired 26 | public AssetController(IncomeService incomeService) { 27 | this.incomeService = incomeService; 28 | } 29 | 30 | @GetMapping("/balance") 31 | @ApiOperation("获取流动资产") 32 | public Response getBalance() { 33 | return successResult(incomeService.getAssetBalance(getUser().getId())); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/CategoryController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiImplicitParam; 5 | import io.swagger.annotations.ApiOperation; 6 | import org.code4everything.boot.web.mvc.BaseSignController; 7 | import org.code4everything.boot.web.mvc.Response; 8 | import org.code4everything.springbee.domain.Category; 9 | import org.code4everything.springbee.domain.User; 10 | import org.code4everything.springbee.service.CategoryService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2018/9/12 19 | */ 20 | @RestController 21 | @RequestMapping("/user/category") 22 | @Api(tags = "分类接口") 23 | public class CategoryController extends BaseSignController { 24 | 25 | private final CategoryService categoryService; 26 | 27 | @Autowired 28 | public CategoryController(CategoryService categoryService) { 29 | this.categoryService = categoryService; 30 | } 31 | 32 | @PostMapping("/append") 33 | @ApiOperation("添加分类") 34 | @ApiImplicitParam(name = "name", value = "分类名", required = true) 35 | public Response saveCategory(@RequestParam String name) { 36 | return successResult(categoryService.appendCategory(getUser().getId(), name), true); 37 | } 38 | 39 | @GetMapping("/list") 40 | @ApiOperation("列出我的分类") 41 | public Response> list() { 42 | return parseCollection("您还没有任何添加分类信息哦", categoryService.listCategory(getUser().getId()), true); 43 | } 44 | 45 | @DeleteMapping("/{categoryId}/remove") 46 | @ApiOperation("删除分类") 47 | public Response removeCategory(@PathVariable String categoryId) { 48 | categoryService.removeCategory(categoryId); 49 | return successResult("删除成功"); 50 | } 51 | 52 | @PatchMapping("/{categoryId}/update") 53 | @ApiOperation("更新分类名称") 54 | @ApiImplicitParam(name = "name", value = "分类名", required = true) 55 | public Response updateCategory(@PathVariable String categoryId, @RequestParam String name) { 56 | categoryService.updateCategory(getUser().getId(), categoryId, name); 57 | return successResult("更新成功"); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/CommonController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiImplicitParam; 5 | import io.swagger.annotations.ApiImplicitParams; 6 | import io.swagger.annotations.ApiOperation; 7 | import org.code4everything.boot.message.VerifyCodeUtils; 8 | import org.code4everything.boot.web.mvc.AssertUtils; 9 | import org.code4everything.boot.web.mvc.BaseController; 10 | import org.code4everything.boot.web.mvc.Response; 11 | import org.code4everything.springbee.constant.BeeErrorConsts; 12 | import org.code4everything.springbee.service.CommonService; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | /** 17 | * @author pantao 18 | * @since 2018/9/10 19 | */ 20 | @RestController 21 | @RequestMapping("/common") 22 | @Api(tags = "公共接口") 23 | public class CommonController extends BaseController { 24 | 25 | private final CommonService commonService; 26 | 27 | @Autowired 28 | public CommonController(CommonService commonService) {this.commonService = commonService;} 29 | 30 | @GetMapping("/username/exists") 31 | @ApiOperation("用户名是否存在") 32 | @ApiImplicitParam(name = "username", required = true, value = "用户名") 33 | public Response existsUsername(@RequestParam String username) { 34 | return parseBoolean("用户名已被注册啦", "用户名未被注册", commonService.existsUsername(username)); 35 | } 36 | 37 | @GetMapping("/email/exists") 38 | @ApiOperation("邮箱是否存在") 39 | @ApiImplicitParam(name = "email", value = "邮箱", required = true) 40 | public Response existsEmail(@RequestParam String email) { 41 | return parseBoolean("邮箱已被注册啦", "邮箱未被注册", commonService.existsEmail(email)); 42 | } 43 | 44 | @GetMapping("/vcode/verify") 45 | @ApiOperation("验证码是否正确") 46 | @ApiImplicitParams({@ApiImplicitParam(name = "email", value = "邮箱", required = true), @ApiImplicitParam(name = 47 | "vcode", required = true, value = "验证码")}) 48 | public Response verifyVcode(@RequestParam String email, @RequestParam String vcode) { 49 | return parseBoolean("验证通过", "验证码错误", VerifyCodeUtils.validate(email, vcode)); 50 | } 51 | 52 | @PostMapping("/vcode/send") 53 | @ApiOperation("发送验证码") 54 | @ApiImplicitParam(name = "email", value = "邮箱", required = true) 55 | public Response sendVcode(@RequestParam String email) { 56 | AssertUtils.throwIf(VerifyCodeUtils.isFrequently(email), BeeErrorConsts.CODE_EXCEPTION); 57 | VerifyCodeUtils.sendByMailAsync(email, "验证码", "您的验证码:{},请勿泄漏给他人"); 58 | return successResult("发送成功"); 59 | } 60 | 61 | @GetMapping("/current-time") 62 | @ApiOperation("获取服务器当前时间") 63 | public Response getCurrentTimestamp() { 64 | return successResult(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/DailiesController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiImplicitParam; 5 | import io.swagger.annotations.ApiOperation; 6 | import io.swagger.annotations.ApiParam; 7 | import org.code4everything.boot.web.mvc.BaseController; 8 | import org.code4everything.boot.web.mvc.Response; 9 | import org.code4everything.springbee.domain.Dailies; 10 | import org.code4everything.springbee.model.DailiesVO; 11 | import org.code4everything.springbee.service.DailiesService; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import javax.validation.Valid; 16 | import java.util.List; 17 | 18 | /** 19 | * @author pantao 20 | * @since 2018/9/11 21 | */ 22 | @RestController 23 | @RequestMapping("/user/daily/detail") 24 | @Api(tags = "日程详细记录接口") 25 | public class DailiesController extends BaseController { 26 | 27 | private final DailiesService dailiesService; 28 | 29 | @Autowired 30 | public DailiesController(DailiesService dailiesService) { 31 | this.dailiesService = dailiesService; 32 | } 33 | 34 | @PostMapping("/append/{dailyId}") 35 | @ApiOperation("添加一条详情记录") 36 | public Response append(@PathVariable String dailyId, @RequestBody @ApiParam @Valid DailiesVO dailiesVO) { 37 | return successResult(dailiesService.saveDailies(dailyId, dailiesVO)); 38 | } 39 | 40 | @DeleteMapping("/remove") 41 | @ApiOperation("删除一条详情") 42 | @ApiImplicitParam(name = "dailiesId", value = "详情编号", required = true) 43 | public Response remove(@RequestParam String dailiesId) { 44 | dailiesService.remove(dailiesId); 45 | return successResult("删除成功"); 46 | } 47 | 48 | @PutMapping("/{dailiesId}/update") 49 | @ApiOperation("更新详情") 50 | public Response updateDailies(@PathVariable String dailiesId, 51 | @RequestBody @ApiParam @Valid DailiesVO dailiesVO) { 52 | return successResult(dailiesService.updateDailies(dailiesId, dailiesVO)); 53 | } 54 | 55 | @GetMapping("/list") 56 | @ApiOperation("列出日程详情") 57 | @ApiImplicitParam(name = "dailyId", value = "日程记录编号", required = true) 58 | public Response> listByDailyId(@RequestParam String dailyId) { 59 | return parseCollection("没有找到相关记录哦", dailiesService.listDailies(dailyId)); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/DailyController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.*; 4 | import org.code4everything.boot.web.mvc.BaseSignController; 5 | import org.code4everything.boot.web.mvc.Response; 6 | import org.code4everything.springbee.domain.Daily; 7 | import org.code4everything.springbee.domain.User; 8 | import org.code4everything.springbee.model.DailyVO; 9 | import org.code4everything.springbee.service.DailyService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.validation.Valid; 14 | import java.sql.Date; 15 | import java.util.List; 16 | 17 | /** 18 | * @author pantao 19 | * @since 2018/9/10 20 | */ 21 | @RestController 22 | @RequestMapping("/user/daily") 23 | @Api(tags = "日程接口") 24 | public class DailyController extends BaseSignController { 25 | 26 | private final DailyService dailyService; 27 | 28 | @Autowired 29 | public DailyController(DailyService dailyService) { 30 | this.dailyService = dailyService; 31 | } 32 | 33 | @PostMapping("/create") 34 | @ApiOperation("添加记录") 35 | public Response saveDaily(@RequestBody @ApiParam @Valid DailyVO dailyVO) { 36 | return successResult(dailyService.saveDaily(getUser().getId(), dailyVO), true); 37 | } 38 | 39 | @GetMapping("/get") 40 | @ApiImplicitParam(name = "date", value = "日期", required = true, dataTypeClass = Date.class) 41 | public Response getDaily(@RequestParam Date date) { 42 | return parseResult("该日期还没有记录哦", dailyService.getDaily(getUser().getId(), date), true); 43 | } 44 | 45 | @DeleteMapping("/remove") 46 | @ApiOperation("删除记录") 47 | @ApiImplicitParam(name = "dailyId", value = "记录编号") 48 | public Response removeDaily(@RequestParam String dailyId) { 49 | dailyService.remove(dailyId); 50 | return successResult("删除成功"); 51 | } 52 | 53 | @PutMapping("/{dailyId}/update") 54 | @ApiOperation("更新记录") 55 | public Response updateDaily(@PathVariable String dailyId, @RequestBody @ApiParam @Valid DailyVO dailyVO) { 56 | return successResult(dailyService.updateDaily(getUser().getId(), dailyId, dailyVO), true); 57 | } 58 | 59 | @GetMapping("/list") 60 | @ApiOperation("列出日程记录") 61 | @ApiImplicitParams({@ApiImplicitParam(name = "start", value = "开始时间", required = true, 62 | dataTypeClass = Date.class), @ApiImplicitParam(name = "end", value = "结束时间", required = true, 63 | dataTypeClass = Date.class)}) 64 | public Response> listByDate(@RequestParam Date start, @RequestParam Date end) { 65 | return parseCollection("该时间段还没有日程记录哦", dailyService.listDaily(getUser().getId(), start, end), true); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/DocumentController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.code4everything.boot.web.http.HttpUtils; 6 | import org.code4everything.boot.web.mvc.BaseController; 7 | import org.code4everything.boot.web.mvc.Response; 8 | import org.code4everything.springbee.SpringBeeApplication; 9 | import org.code4everything.springbee.domain.Document; 10 | import org.code4everything.springbee.service.DocumentService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.core.io.InputStreamSource; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.web.bind.annotation.*; 15 | import org.springframework.web.multipart.MultipartFile; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | import java.io.IOException; 19 | 20 | /** 21 | * @author pantao 22 | * @since 2018/9/13 23 | */ 24 | @RestController 25 | @RequestMapping("/user/document") 26 | @Api(tags = "文件资源接口") 27 | public class DocumentController extends BaseController { 28 | 29 | private final DocumentService documentService; 30 | 31 | @Autowired 32 | public DocumentController(DocumentService documentService) { 33 | this.documentService = documentService; 34 | } 35 | 36 | @PostMapping("/upload") 37 | @ApiOperation("上传文件") 38 | public Response upload(@RequestBody MultipartFile file) { 39 | String storagePath = SpringBeeApplication.getBeeConfigBean().getStoragePath(); 40 | return printAndReturn(HttpUtils.upload(documentService, file, storagePath, true)).encode(); 41 | } 42 | 43 | @GetMapping("/**") 44 | @ApiOperation("获取文件资源") 45 | public ResponseEntity get(HttpServletRequest request) throws IOException { 46 | return HttpUtils.responseFile(documentService, request); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/IncomeController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.*; 4 | import org.code4everything.boot.web.mvc.BaseSignController; 5 | import org.code4everything.boot.web.mvc.Response; 6 | import org.code4everything.springbee.domain.Income; 7 | import org.code4everything.springbee.domain.User; 8 | import org.code4everything.springbee.model.IncomeBillVO; 9 | import org.code4everything.springbee.model.IncomeVO; 10 | import org.code4everything.springbee.service.IncomeService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import javax.validation.Valid; 15 | import java.sql.Date; 16 | import java.util.List; 17 | 18 | /** 19 | * @author pantao 20 | * @since 2018/9/11 21 | */ 22 | @RestController 23 | @RequestMapping("/user/asset/income") 24 | @Api(tags = "收益接口") 25 | public class IncomeController extends BaseSignController { 26 | 27 | private final IncomeService incomeService; 28 | 29 | @Autowired 30 | public IncomeController(IncomeService incomeService) { 31 | this.incomeService = incomeService; 32 | } 33 | 34 | @PostMapping("/append") 35 | @ApiOperation("添加一条收益记录") 36 | public Response saveIncome(@RequestBody @ApiParam @Valid IncomeVO incomeVO) { 37 | return successResult(incomeService.saveIncome(getUser().getId(), incomeVO), true); 38 | } 39 | 40 | @DeleteMapping("/remove") 41 | @ApiOperation("删除一条收益记录") 42 | @ApiImplicitParam(name = "incomeId", value = "收益记录编号", required = true) 43 | public Response remove(@RequestParam String incomeId) { 44 | incomeService.remove(getUser().getId(), incomeId); 45 | return successResult("删除成功"); 46 | } 47 | 48 | @PutMapping("/{incomeId}/update") 49 | @ApiOperation("更新记录") 50 | public Response updateIncome(@PathVariable String incomeId, 51 | @RequestBody @ApiParam @Valid IncomeVO incomeVO) { 52 | return successResult(incomeService.updateIncome(getUser().getId(), incomeId, incomeVO), true); 53 | } 54 | 55 | @GetMapping("/list") 56 | @ApiOperation("列出收益详情") 57 | @ApiImplicitParams({@ApiImplicitParam(name = "category", value = "分类"), @ApiImplicitParam(name = "start", value = 58 | "开始日期"), @ApiImplicitParam(name = "end", value = "截止日期")}) 59 | public Response> list(String category, Date start, Date end) { 60 | return parseCollection("没有找到相关数据哦", incomeService.listIncome(getUser().getId(), category, start, end), true); 61 | } 62 | 63 | @GetMapping("/month/list") 64 | @ApiOperation("列出月账单") 65 | @ApiImplicitParams({@ApiImplicitParam(name = "startMonth", value = "开始月份", required = true, example = "2018-01"), 66 | @ApiImplicitParam(name = "endMonth", value = "结束月份", required = true, example = "2018-12")}) 67 | public Response> listMonth(@RequestParam String startMonth, @RequestParam String endMonth) { 68 | return parseCollection("该时间段还没有账单哦", incomeService.listMonth(getUser().getId(), startMonth, endMonth)); 69 | } 70 | 71 | @GetMapping("/year/list") 72 | @ApiOperation("列出年账单") 73 | @ApiImplicitParams({@ApiImplicitParam(name = "startYear", value = "开始年份", required = true, example = "2014", 74 | dataType = "int"), @ApiImplicitParam(name = "endYear", value = "结束年份", required = true, example = "2018", 75 | dataType = "int")}) 76 | public Response> listYear(@RequestParam Integer startYear, @RequestParam Integer endYear) { 77 | return parseCollection("该时间段还没有账单哦", incomeService.listYear(getUser().getId(), startYear, endYear)); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/SettingController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.code4everything.boot.web.mvc.BaseSignController; 6 | import org.code4everything.boot.web.mvc.Response; 7 | import org.code4everything.springbee.domain.User; 8 | import org.code4everything.springbee.service.SettingService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | /** 13 | * @author pantao 14 | * @since 2019/5/10 15 | */ 16 | @RestController 17 | @RequestMapping("/user/setting") 18 | @Api(tags = "用户配置") 19 | public class SettingController extends BaseSignController { 20 | 21 | private final SettingService settingService; 22 | 23 | @Autowired 24 | public SettingController(SettingService settingService) { 25 | this.settingService = settingService; 26 | } 27 | 28 | @GetMapping("/daily/rule/evaluate") 29 | @ApiOperation("获取用户自定义日程评分规则") 30 | public Response getDailyEvaluateRule() { 31 | return successResult("请求成功", settingService.getDailyEvaluateRule(getUser().getId())); 32 | } 33 | 34 | @PatchMapping("/daily/rule/evaluate") 35 | @ApiOperation("更新用户自定义日程评分规则") 36 | public Response updateDailyEvaluateRule(@RequestParam String rule) { 37 | settingService.updateDailyEvaluateRule(getUser().getId(), rule); 38 | return successResult(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/TodoController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiImplicitParam; 5 | import io.swagger.annotations.ApiImplicitParams; 6 | import io.swagger.annotations.ApiOperation; 7 | import org.code4everything.boot.web.mvc.BaseSignController; 8 | import org.code4everything.boot.web.mvc.Response; 9 | import org.code4everything.springbee.domain.Todo; 10 | import org.code4everything.springbee.domain.User; 11 | import org.code4everything.springbee.model.TodoCountVO; 12 | import org.code4everything.springbee.model.TodoVO; 13 | import org.code4everything.springbee.service.TodoService; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | 17 | import java.sql.Date; 18 | import java.util.List; 19 | 20 | /** 21 | * @author pantao 22 | * @since 2018/9/11 23 | */ 24 | @RestController 25 | @RequestMapping("/user/todo") 26 | @Api(tags = "代办事项接口") 27 | public class TodoController extends BaseSignController { 28 | 29 | private final TodoService todoService; 30 | 31 | @Autowired 32 | public TodoController(TodoService todoService) { 33 | this.todoService = todoService; 34 | } 35 | 36 | @PostMapping("/create") 37 | @ApiOperation("添加代办事项") 38 | public Response saveTodo(@RequestBody TodoVO todoVO) { 39 | return successResult(todoService.saveTodo(getUser().getId(), todoVO), true); 40 | } 41 | 42 | @DeleteMapping("/remove") 43 | @ApiOperation("删除一条代办事项") 44 | @ApiImplicitParam(name = "todoId", value = "事项编号", required = true) 45 | public Response remove(@RequestParam String todoId) { 46 | todoService.remove(todoId); 47 | return successResult("删除成功"); 48 | } 49 | 50 | @PatchMapping("/update") 51 | @ApiOperation("更新代办事项内容") 52 | @ApiImplicitParams({@ApiImplicitParam(name = "todoId", value = "事项编号", required = true), @ApiImplicitParam(name = 53 | "content", value = "事项内容", required = true)}) 54 | public Response updateContent(@RequestParam String todoId, @RequestParam String content) { 55 | return successResult(todoService.updateTodo(todoId, content), true); 56 | } 57 | 58 | @PatchMapping("/status/toggle") 59 | @ApiOperation("更新事项状态") 60 | @ApiImplicitParams({@ApiImplicitParam(name = "todoId", value = "事项编号", required = true), @ApiImplicitParam(name = 61 | "status", value = "状态", required = true, allowableValues = "0, 1")}) 62 | public Response updateStatus(@RequestParam String todoId, @RequestParam String status) { 63 | return parseResult("更新失败", todoService.updateTodoStatus(todoId, status), true); 64 | } 65 | 66 | @GetMapping("/date/list") 67 | @ApiOperation("列出所有日期") 68 | public Response> listDate() { 69 | return parseCollection("您还没有待办事项哦", todoService.listDate(getUser().getId())); 70 | } 71 | 72 | @GetMapping("/undo/list") 73 | @ApiOperation("列出某个日期之前未完成的待办事项") 74 | @ApiImplicitParam(name = "date", value = "日期", required = true, dataTypeClass = Date.class) 75 | public Response> listUndo(@RequestParam Date date) { 76 | return parseCollection("没有未完成的待办事项哦", todoService.listUndoBeforeDate(getUser().getId(), date), true); 77 | } 78 | 79 | @GetMapping("/list") 80 | @ApiOperation("列出事项") 81 | @ApiImplicitParam(name = "date", value = "日期", required = true, dataTypeClass = Date.class) 82 | public Response> listTodo(@RequestParam Date date) { 83 | return parseCollection("该日期没有待办事项哦", todoService.listTodo(getUser().getId(), date), true); 84 | } 85 | 86 | @GetMapping("/count/list") 87 | @ApiOperation("列出待办事项统计") 88 | @ApiImplicitParams({@ApiImplicitParam(name = "start", value = "开始时间", required = true, 89 | dataTypeClass = Date.class), @ApiImplicitParam(name = "end", value = "结束时间", required = true, 90 | dataTypeClass = Date.class)}) 91 | public Response> listByDate(@RequestParam Date start, @RequestParam Date end) { 92 | return parseCollection("您还没有待办事项哦", todoService.listTodoCount(getUser().getId(), start, end), true); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /spring-bee/src/main/java/org/code4everything/springbee/web/UserController.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.web; 2 | 3 | import io.swagger.annotations.*; 4 | import org.code4everything.boot.web.mvc.AssertUtils; 5 | import org.code4everything.boot.web.mvc.BaseSignController; 6 | import org.code4everything.boot.web.mvc.Response; 7 | import org.code4everything.springbee.constant.BeeErrorConsts; 8 | import org.code4everything.springbee.domain.Document; 9 | import org.code4everything.springbee.domain.User; 10 | import org.code4everything.springbee.model.PasswordVO; 11 | import org.code4everything.springbee.model.RegisterVO; 12 | import org.code4everything.springbee.model.UserInfoVO; 13 | import org.code4everything.springbee.service.UserService; 14 | import org.code4everything.springbee.util.Checker; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.web.bind.annotation.*; 17 | import org.springframework.web.multipart.MultipartFile; 18 | 19 | import javax.validation.Valid; 20 | 21 | /** 22 | * @author pantao 23 | * @since 2018/9/10 24 | */ 25 | @RestController 26 | @RequestMapping("/user") 27 | @Api(tags = "用户接口") 28 | public class UserController extends BaseSignController { 29 | 30 | private final UserService userService; 31 | 32 | private final DocumentController documentController; 33 | 34 | @Autowired 35 | public UserController(UserService userService, DocumentController documentController) { 36 | this.userService = userService; 37 | this.documentController = documentController; 38 | } 39 | 40 | @PatchMapping("/password/update") 41 | @ApiOperation("更新密码") 42 | @ApiImplicitParams({@ApiImplicitParam(name = "oldPassword", required = true, value = "原密码"), 43 | @ApiImplicitParam(name = "newPassword", required = true, value = "新密码")}) 44 | public Response updatePassword(@RequestParam String oldPassword, @RequestParam String newPassword) { 45 | return parseBoolean("更新成功", "原密码不正确", userService.updatePassword(getUser(), oldPassword, newPassword)); 46 | } 47 | 48 | @PatchMapping("/password/reset") 49 | @ApiOperation("重置密码") 50 | public Response resetPassword(@RequestBody @ApiParam @Valid PasswordVO passwordVO) { 51 | Checker.checkVerifyCode(passwordVO.getEmail(), passwordVO.getVcode()); 52 | userService.resetPassword(passwordVO.getEmail(), passwordVO.getNewPassword()); 53 | return successResult("重置密码成功"); 54 | } 55 | 56 | @PostMapping("/register") 57 | @ApiOperation("注册") 58 | public Response register(@RequestBody @ApiParam @Valid RegisterVO registerVO) { 59 | userService.register(registerVO); 60 | return successResult("注册成功"); 61 | } 62 | 63 | @PostMapping("/login") 64 | @ApiOperation("登录,返回Token") 65 | @ApiImplicitParams({@ApiImplicitParam(name = "loginName", value = "用户名或邮箱", required = true), 66 | @ApiImplicitParam(name = "password", value = "密码", required = true)}) 67 | public Response login(@RequestParam String loginName, @RequestParam String password) { 68 | return successResult("登录成功", userService.login(loginName, password)); 69 | } 70 | 71 | @PatchMapping("/info") 72 | @ApiOperation("更新信息") 73 | public Response updateInfo(@RequestBody @ApiParam @Valid UserInfoVO userInfoVO) { 74 | userService.updateInfo(getUser(), userInfoVO); 75 | return successResult("更新成功"); 76 | } 77 | 78 | @GetMapping("/info") 79 | @ApiOperation("获取用户信息") 80 | public Response getUserInfo() { 81 | return successResult(getUser(), true); 82 | } 83 | 84 | @PatchMapping("/avatar") 85 | @ApiOperation("更新用户头像") 86 | public Response updateAvatar(@RequestBody MultipartFile avatar) { 87 | Response response = documentController.upload(avatar); 88 | AssertUtils.throwIf(response.isError(), BeeErrorConsts.FILE_UPLOAD_ERROR); 89 | userService.updateAvatar(getUser(), response.getData().getAccessUrl()); 90 | return successResult("更新成功", response.getData().getAccessUrl()); 91 | } 92 | 93 | @PatchMapping("/username/{username}") 94 | @ApiOperation("更新用户名") 95 | public Response updateUsername(@PathVariable String username) { 96 | userService.updateUsername(getUser(), username); 97 | return successResult(); 98 | } 99 | 100 | @PatchMapping("/email/{email}") 101 | @ApiOperation("更新邮箱") 102 | @ApiImplicitParam(name = "vcode", value = "验证码", required = true) 103 | public Response updateEmail(@PathVariable String email, @RequestParam String vcode) { 104 | Checker.checkVerifyCode(email, vcode); 105 | userService.updateEmail(getUser(), email); 106 | return successResult(); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /spring-bee/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | # 配置端口# 2 | server.port=8023 3 | # 配置数据源 4 | spring.data.mongodb.uri=mongodb://127.0.0.1:27017/spring 5 | # 配置丝袜哥 6 | swagger.enabled=false 7 | swagger.title=wanna spring 8 | swagger.description=keep personal schedule and income 9 | swagger.version=1.2.0 10 | swagger.license=GPL 3.0 11 | swagger.licenseUrl=https://opensource.org/licenses/GPL-3.0 12 | swagger.termsOfServiceUrl=https://github.com/code4verything/wanna-spring 13 | swagger.contact.name=pantao 14 | swagger.contact.url=https://tao.code4everything.org 15 | swagger.contact.email=tao@zhazhapan.com 16 | swagger.base-package=org.code4everything.springbee 17 | swagger.base-path=/** 18 | swagger.exclude-path=/error, /ops/** 19 | # 配置邮箱(下面配置仅供测试使用请勿生产环境使用) 20 | spring.mail.host=smtp.qq.com 21 | spring.mail.protocol=smtp 22 | spring.mail.username=2786849796@qq.com 23 | spring.mail.password=jwmvskyftrhldgge 24 | spring.mail.properties.mail.smtp.auth=true 25 | spring.mail.properties.mail.smtp.starttls.enable=true 26 | spring.mail.properties.mail.smtp.starttls.required=true 27 | # 不打印NoSQL日志 28 | logging.level.org.springframework.data.mongodb.core=info 29 | # 配置时区 30 | spring.jackson.time-zone=GMT+8 31 | # 应用监控配置 32 | management.endpoint.shutdown.enabled=true 33 | management.endpoint.health.show-details=always 34 | -------------------------------------------------------------------------------- /spring-bee/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 配置端口# 2 | server.port=8099 3 | #spring.profiles.active=prod 4 | # 配置数据源 5 | spring.data.mongodb.uri=mongodb://192.168.1.234:27017/spring 6 | # 配置丝袜哥 7 | swagger.enabled=true 8 | swagger.title=wanna spring 9 | swagger.description=keep personal schedule and income 10 | swagger.version=1.2.0 11 | swagger.license=GPL 3.0 12 | swagger.licenseUrl=https://opensource.org/licenses/GPL-3.0 13 | swagger.termsOfServiceUrl=https://github.com/code4verything/wanna-spring 14 | swagger.contact.name=pantao 15 | swagger.contact.url=https://tao.code4everything.org 16 | swagger.contact.email=easepan@qq.com 17 | swagger.base-package=org.code4everything.springbee 18 | swagger.base-path=/** 19 | swagger.exclude-path=/error, /ops/** 20 | # 配置邮箱(下面配置仅供测试使用请勿生产环境使用) 21 | spring.mail.host=smtp.qq.com 22 | spring.mail.protocol=smtp 23 | spring.mail.username=2786849796@qq.com 24 | spring.mail.password=jwmvskyftrhldgge 25 | spring.mail.properties.mail.smtp.auth=true 26 | spring.mail.properties.mail.smtp.starttls.enable=true 27 | spring.mail.properties.mail.smtp.starttls.required=true 28 | # 配置时区 29 | spring.jackson.time-zone=GMT+8 30 | # 打印NoSQL语句 31 | logging.level.org.springframework.data.mongodb.core=debug 32 | # 应用监控配置 33 | management.endpoint.shutdown.enabled=true 34 | management.endpoint.health.show-details=always 35 | -------------------------------------------------------------------------------- /spring-bee/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ${user.home}/logs/wanna-spring/wanna-spring.log 4 | 5 | ${user.home}/logs/wanna-spring/wanna-spring.%d{yyyy-MM-dd}.log 6 | 30 7 | 1GB 8 | 9 | 10 | %d{yyyy-MM-dd HH:mm:ss.SSS} %5p %c{0}:%L - %m%n 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spring-bee/src/main/resources/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-bee/src/main/resources/static/.gitkeep -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/BaseTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee; 2 | 3 | import org.code4everything.springbee.constant.TestConsts; 4 | import org.code4everything.springbee.dao.UserDAO; 5 | import org.code4everything.springbee.domain.User; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | 9 | /** 10 | * @author pantao 11 | * @since 2018/10/25 12 | */ 13 | @SpringBootTest 14 | public class BaseTest { 15 | 16 | @Autowired 17 | private UserDAO userDAO; 18 | 19 | protected User getUser() { 20 | return userDAO.getByEmail(TestConsts.EMAIL); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/CommonTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import cn.hutool.core.date.DateUtil; 5 | import org.code4everything.springbee.domain.Job; 6 | import org.code4everything.springbee.model.JobVO; 7 | import org.junit.Test; 8 | 9 | import java.util.Date; 10 | 11 | /** 12 | * @author pantao 13 | * @since 2018/11/18 14 | */ 15 | public class CommonTest { 16 | 17 | @Test 18 | public void dateUtil() { 19 | Date start = new Date(); 20 | System.out.println(DateUtil.formatDate(DateUtil.offsetDay(start, 1))); 21 | } 22 | 23 | @Test 24 | public void copy() { 25 | JobVO jobVO = new JobVO(); 26 | jobVO.setCompany("company"); 27 | Job job = new Job(); 28 | job.setId("123456789"); 29 | BeanUtil.copyProperties(jobVO, job); 30 | System.out.println(job); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/SpringBeeApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class SpringBeeApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/constant/TestConsts.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.constant; 2 | 3 | /** 4 | * @author pantao 5 | * @since 2018/10/25 6 | */ 7 | public class TestConsts { 8 | 9 | public static final String EMAIL = "tao@zhazhapan.com"; 10 | 11 | public static final String PASSWORD = "123456"; 12 | 13 | public static final String USERNAME = "pantao"; 14 | 15 | public static final String GENDER = "1"; 16 | 17 | public static final String BIO = "这是一条测试信息"; 18 | 19 | public static final String NICKNAME = "ease"; 20 | 21 | public static final Integer YEAR = 2018; 22 | 23 | public static final String END_TIME = "12:00"; 24 | 25 | public static final String START_TIME = "11:00"; 26 | 27 | public static final Integer TYPE = 1; 28 | 29 | public static final String WAY = "1"; 30 | 31 | public static final String STATUS = "1"; 32 | } 33 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/service/impl/CategoryServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.RandomUtil; 4 | import org.code4everything.springbee.BaseTest; 5 | import org.code4everything.springbee.domain.Category; 6 | import org.code4everything.springbee.service.CategoryService; 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.test.context.SpringBootTest; 12 | import org.springframework.test.context.junit4.SpringRunner; 13 | 14 | import java.util.List; 15 | 16 | @SpringBootTest 17 | @RunWith(SpringRunner.class) 18 | public class CategoryServiceImplTest extends BaseTest { 19 | 20 | @Autowired 21 | private CategoryService categoryService; 22 | 23 | @Test 24 | public void exists() { 25 | Assert.assertFalse(categoryService.exists(getUser().getId(), RandomUtil.randomString(6))); 26 | } 27 | 28 | @Test 29 | public void listCategory() { 30 | List categories = categoryService.listCategory(getUser().getId()); 31 | Assert.assertNotNull(categories); 32 | System.out.println(categories); 33 | } 34 | 35 | @Test 36 | public void appendCategory() { 37 | Assert.assertNotNull(categoryService.appendCategory(getUser().getId(), RandomUtil.randomString(6))); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/service/impl/CommonServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.RandomUtil; 4 | import org.code4everything.boot.message.VerifyCodeUtils; 5 | import org.code4everything.springbee.constant.TestConsts; 6 | import org.code4everything.springbee.service.CommonService; 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.test.context.SpringBootTest; 12 | import org.springframework.test.context.junit4.SpringRunner; 13 | 14 | import javax.mail.MessagingException; 15 | 16 | @SpringBootTest 17 | @RunWith(SpringRunner.class) 18 | public class CommonServiceImplTest { 19 | 20 | @Autowired 21 | private CommonService commonService; 22 | 23 | @Test 24 | public void sendVcode() throws MessagingException { 25 | VerifyCodeUtils.sendByMail(TestConsts.EMAIL, "验证码", "你的验证码:{}"); 26 | } 27 | 28 | @Test 29 | public void existsUsername() { 30 | Assert.assertFalse(commonService.existsUsername(RandomUtil.randomString(16))); 31 | } 32 | 33 | @Test 34 | public void existsEmail() { 35 | Assert.assertFalse(commonService.existsEmail(RandomUtil.randomString(16))); 36 | } 37 | 38 | @Test 39 | public void isVcodeValidated() { 40 | Assert.assertFalse(VerifyCodeUtils.validateAndRemove(TestConsts.EMAIL, RandomUtil.randomString(6))); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/service/impl/DailiesServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.RandomUtil; 4 | import org.code4everything.springbee.constant.TestConsts; 5 | import org.code4everything.springbee.dao.DailiesDAO; 6 | import org.code4everything.springbee.dao.DailyDAO; 7 | import org.code4everything.springbee.domain.Dailies; 8 | import org.code4everything.springbee.model.DailiesVO; 9 | import org.code4everything.springbee.service.DailiesService; 10 | import org.junit.Assert; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.boot.test.context.SpringBootTest; 15 | import org.springframework.test.context.junit4.SpringRunner; 16 | 17 | import java.util.List; 18 | 19 | @SpringBootTest 20 | @RunWith(SpringRunner.class) 21 | public class DailiesServiceImplTest { 22 | 23 | @Autowired 24 | private DailiesService dailiesService; 25 | 26 | @Autowired 27 | private DailyDAO dailyDAO; 28 | 29 | @Autowired 30 | private DailiesDAO dailiesDAO; 31 | 32 | @Test 33 | public void listDailies() { 34 | List dailies = dailiesService.listDailies(dailyDAO.findAll().get(0).getId()); 35 | Assert.assertNotNull(dailies); 36 | System.out.println(dailies); 37 | } 38 | 39 | @Test 40 | public void updateDailies() { 41 | DailiesVO dailiesVO = new DailiesVO(); 42 | dailiesVO.setContent(RandomUtil.randomString(12)); 43 | dailiesVO.setEndTime(TestConsts.START_TIME); 44 | dailiesVO.setStartTime(TestConsts.END_TIME); 45 | Assert.assertNotNull(dailiesService.updateDailies(dailiesDAO.findAll().get(0).getId(), dailiesVO)); 46 | } 47 | 48 | @Test 49 | public void remove() { 50 | dailiesService.remove(dailiesDAO.findAll().get(0).getId()); 51 | } 52 | 53 | @Test 54 | public void saveDailies() { 55 | DailiesVO dailiesVO = new DailiesVO(); 56 | dailiesVO.setContent(RandomUtil.randomString(12)); 57 | dailiesVO.setEndTime(TestConsts.START_TIME); 58 | dailiesVO.setStartTime(TestConsts.END_TIME); 59 | Assert.assertNotNull(dailiesService.saveDailies(dailyDAO.findAll().get(0).getId(), dailiesVO)); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/service/impl/DailyServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | import cn.hutool.core.util.RandomUtil; 5 | import org.code4everything.springbee.BaseTest; 6 | import org.code4everything.springbee.dao.DailyDAO; 7 | import org.code4everything.springbee.domain.Daily; 8 | import org.code4everything.springbee.model.DailyVO; 9 | import org.code4everything.springbee.service.DailyService; 10 | import org.junit.Assert; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.boot.test.context.SpringBootTest; 15 | import org.springframework.test.context.junit4.SpringRunner; 16 | 17 | import java.sql.Date; 18 | import java.util.List; 19 | 20 | @SpringBootTest 21 | @RunWith(SpringRunner.class) 22 | public class DailyServiceImplTest extends BaseTest { 23 | 24 | @Autowired 25 | private DailyService dailyService; 26 | 27 | @Autowired 28 | private DailyDAO dailyDAO; 29 | 30 | @Test 31 | public void exists() { 32 | assert dailyService.exists(dailyDAO.findAll().get(0).getId()); 33 | } 34 | 35 | @Test 36 | public void listDaily() { 37 | Long millis = System.currentTimeMillis(); 38 | Date start = new Date(millis + 30 * 24 * 60 * 60 * 1000); 39 | Date end = new Date(millis); 40 | List dailies = dailyService.listDaily(getUser().getId(), start, end); 41 | Assert.assertNotNull(dailies); 42 | System.out.println(dailies); 43 | } 44 | 45 | @Test 46 | public void remove() { 47 | dailyService.remove(IdUtil.simpleUUID()); 48 | } 49 | 50 | @Test 51 | public void saveDaily() { 52 | DailyVO dailyVO = new DailyVO(); 53 | dailyVO.setContent(RandomUtil.randomString(9)); 54 | dailyVO.setDate(new Date(System.currentTimeMillis())); 55 | dailyVO.setScore(RandomUtil.randomInt(10)); 56 | dailyVO.setWeather(RandomUtil.randomString(3)); 57 | Assert.assertNotNull(dailyService.saveDaily(getUser().getId(), dailyVO)); 58 | } 59 | 60 | @Test 61 | public void exists1() { 62 | DailyVO dailyVO = new DailyVO(); 63 | dailyVO.setDate(new Date(System.currentTimeMillis())); 64 | dailyService.exists(getUser().getId(), "", dailyVO.getDate()); 65 | } 66 | 67 | @Test 68 | public void updateDaily() { 69 | DailyVO dailyVO = new DailyVO(); 70 | dailyVO.setContent(RandomUtil.randomString(9)); 71 | dailyVO.setDate(new Date(System.currentTimeMillis())); 72 | dailyVO.setScore(RandomUtil.randomInt(10)); 73 | dailyVO.setWeather(RandomUtil.randomString(3)); 74 | dailyService.updateDaily(getUser().getId(), dailyDAO.findAll().get(0).getId(), dailyVO); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/service/impl/IncomeServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.RandomUtil; 4 | import org.code4everything.springbee.BaseTest; 5 | import org.code4everything.springbee.constant.TestConsts; 6 | import org.code4everything.springbee.dao.IncomeDAO; 7 | import org.code4everything.springbee.domain.Income; 8 | import org.code4everything.springbee.model.IncomeVO; 9 | import org.code4everything.springbee.model.IncomeBillVO; 10 | import org.code4everything.springbee.service.IncomeService; 11 | import org.junit.Assert; 12 | import org.junit.Test; 13 | import org.junit.runner.RunWith; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.boot.test.context.SpringBootTest; 16 | import org.springframework.test.context.junit4.SpringRunner; 17 | 18 | import java.sql.Date; 19 | import java.util.List; 20 | 21 | @SpringBootTest 22 | @RunWith(SpringRunner.class) 23 | public class IncomeServiceImplTest extends BaseTest { 24 | 25 | @Autowired 26 | private IncomeService incomeService; 27 | 28 | @Autowired 29 | private IncomeDAO incomeDAO; 30 | 31 | @Test 32 | public void getAssetBalance() { 33 | Assert.assertNotNull(incomeService.getAssetBalance(getUser().getId())); 34 | } 35 | 36 | @Test 37 | public void listIncome() { 38 | Long millis = System.currentTimeMillis(); 39 | Date start = new Date(millis - 30 * 24 * 60 * 60 * 1000); 40 | Date end = new Date(millis); 41 | List incomes = incomeService.listIncome(getUser().getId(), "", start, end); 42 | Assert.assertNotNull(incomes); 43 | System.out.println(incomes); 44 | } 45 | 46 | @Test 47 | public void updateIncome() { 48 | IncomeVO incomeVO = new IncomeVO(); 49 | incomeVO.setCategory(RandomUtil.randomString(4)); 50 | incomeVO.setDate(new Date(System.currentTimeMillis())); 51 | incomeVO.setMoney(RandomUtil.randomLong(Integer.MAX_VALUE)); 52 | incomeVO.setRemark(RandomUtil.randomString(6)); 53 | incomeVO.setType(TestConsts.TYPE); 54 | incomeVO.setWay(TestConsts.WAY); 55 | Assert.assertNotNull(incomeService.updateIncome(getUser().getId(), incomeDAO.findAll().get(0).getId(), 56 | incomeVO)); 57 | } 58 | 59 | @Test 60 | public void remove() { 61 | incomeService.remove(getUser().getId(), incomeDAO.findAll().get(0).getId()); 62 | } 63 | 64 | @Test 65 | public void saveIncome() { 66 | IncomeVO incomeVO = new IncomeVO(); 67 | incomeVO.setCategory(RandomUtil.randomString(4)); 68 | incomeVO.setDate(new Date(System.currentTimeMillis())); 69 | incomeVO.setMoney(RandomUtil.randomLong(Integer.MAX_VALUE)); 70 | incomeVO.setRemark(RandomUtil.randomString(6)); 71 | incomeVO.setType(TestConsts.TYPE); 72 | incomeVO.setWay(TestConsts.WAY); 73 | Assert.assertNotNull(incomeService.saveIncome(getUser().getId(), incomeVO)); 74 | } 75 | 76 | @Test 77 | public void listMonth() { 78 | List list = incomeService.listMonth(getUser().getId(), "2018-01", "2018-12"); 79 | Assert.assertNotNull(list); 80 | System.out.println(list); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/service/impl/TodoServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.core.util.RandomUtil; 4 | import org.code4everything.springbee.BaseTest; 5 | import org.code4everything.springbee.constant.TestConsts; 6 | import org.code4everything.springbee.dao.TodoDAO; 7 | import org.code4everything.springbee.domain.Todo; 8 | import org.code4everything.springbee.service.TodoService; 9 | import org.junit.Assert; 10 | import org.junit.Test; 11 | import org.junit.runner.RunWith; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.boot.test.context.SpringBootTest; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | 16 | import java.util.Date; 17 | import java.util.List; 18 | 19 | @SpringBootTest 20 | @RunWith(SpringRunner.class) 21 | public class TodoServiceImplTest extends BaseTest { 22 | 23 | @Autowired 24 | private TodoService todoService; 25 | 26 | @Autowired 27 | private TodoDAO todoDAO; 28 | 29 | @Test 30 | public void listTodo() { 31 | List todos = todoService.listTodo(getUser().getId(), new Date(System.currentTimeMillis())); 32 | Assert.assertNotNull(todos); 33 | System.out.println(todos); 34 | } 35 | 36 | @Test 37 | public void listDate() { 38 | List dates = todoService.listDate(getUser().getId()); 39 | Assert.assertNotNull(dates); 40 | System.out.println(dates); 41 | } 42 | 43 | @Test 44 | public void updateTodoStatus() { 45 | Assert.assertNotNull(todoService.updateTodoStatus(todoDAO.findAll().get(0).getId(), TestConsts.STATUS)); 46 | } 47 | 48 | @Test 49 | public void updateTodo() { 50 | Assert.assertNotNull(todoService.updateTodo(todoDAO.findAll().get(0).getId(), RandomUtil.randomString(6))); 51 | } 52 | 53 | @Test 54 | public void remove() { 55 | todoService.remove(todoDAO.findAll().get(0).getId()); 56 | } 57 | 58 | @Test 59 | public void saveTodo() { 60 | } 61 | 62 | @Test 63 | public void listTodoCount() { 64 | System.out.println(todoService.listTodoCount(getUser().getId(), new Date(), new Date())); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /spring-bee/src/test/java/org/code4everything/springbee/service/impl/UserServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package org.code4everything.springbee.service.impl; 2 | 3 | import cn.hutool.crypto.digest.DigestUtil; 4 | import org.code4everything.springbee.BaseTest; 5 | import org.code4everything.springbee.constant.TestConsts; 6 | import org.code4everything.springbee.model.RegisterVO; 7 | import org.code4everything.springbee.model.UserInfoVO; 8 | import org.code4everything.springbee.service.UserService; 9 | import org.junit.Assert; 10 | import org.junit.Test; 11 | import org.junit.runner.RunWith; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.boot.test.context.SpringBootTest; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | 16 | /** 17 | * You must test method register before any others test 18 | */ 19 | @SpringBootTest 20 | @RunWith(SpringRunner.class) 21 | public class UserServiceImplTest extends BaseTest { 22 | 23 | @Autowired 24 | private UserService userService; 25 | 26 | @Test 27 | public void updateInfo() { 28 | UserInfoVO userInfoVO = new UserInfoVO(); 29 | userInfoVO.setBio(TestConsts.BIO); 30 | userInfoVO.setGender(TestConsts.GENDER); 31 | userInfoVO.setNickname(TestConsts.NICKNAME); 32 | userService.updateInfo(getUser(), userInfoVO); 33 | } 34 | 35 | /** 36 | * must run this method at first, unless the value is already exists 37 | */ 38 | @Test 39 | public void register() { 40 | RegisterVO registerVO = new RegisterVO(); 41 | registerVO.setEmail(TestConsts.EMAIL); 42 | registerVO.setPassword(TestConsts.PASSWORD); 43 | registerVO.setUsername(TestConsts.USERNAME); 44 | userService.register(registerVO); 45 | } 46 | 47 | @Test 48 | public void resetPassword() { 49 | userService.resetPassword(TestConsts.EMAIL, TestConsts.PASSWORD); 50 | Assert.assertEquals(DigestUtil.md5Hex(TestConsts.PASSWORD), getUser().getPassword()); 51 | } 52 | 53 | @Test 54 | public void updatePassword() { 55 | assert userService.updatePassword(getUser(), TestConsts.PASSWORD, TestConsts.PASSWORD); 56 | } 57 | 58 | @Test 59 | public void login() { 60 | Assert.assertNotNull(userService.login(TestConsts.EMAIL, TestConsts.PASSWORD)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /spring-fee/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-fee/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /spring-fee/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | /test/unit/coverage/ 6 | -------------------------------------------------------------------------------- /spring-fee/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint' 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | extends: [ 12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 14 | 'plugin:vue/essential', 15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 16 | 'standard' 17 | ], 18 | // required to lint *.vue files 19 | plugins: [ 20 | 'vue' 21 | ], 22 | // add your custom rules here 23 | rules: { 24 | // allow async-await 25 | 'generator-star-spacing': 'off', 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-fee/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | /test/e2e/reports/ 9 | selenium-debug.log 10 | 11 | # Editor directories and files 12 | .idea 13 | .vscode 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | -------------------------------------------------------------------------------- /spring-fee/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spring-fee/README.md: -------------------------------------------------------------------------------- 1 | # spring-fee 2 | 3 | > wanna spring front end 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | 20 | # run unit tests 21 | npm run unit 22 | 23 | # run e2e tests 24 | npm run e2e 25 | 26 | # run all tests 27 | npm test 28 | ``` 29 | 30 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 31 | -------------------------------------------------------------------------------- /spring-fee/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /spring-fee/build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /spring-fee/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/build/logo.png -------------------------------------------------------------------------------- /spring-fee/build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader' 51 | }) 52 | } else { 53 | return ['vue-style-loader'].concat(loaders) 54 | } 55 | } 56 | 57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 58 | return { 59 | css: generateLoaders(), 60 | postcss: generateLoaders(), 61 | less: generateLoaders('less'), 62 | sass: generateLoaders('sass', { indentedSyntax: true }), 63 | scss: generateLoaders('sass'), 64 | stylus: generateLoaders('stylus'), 65 | styl: generateLoaders('stylus') 66 | } 67 | } 68 | 69 | // Generate loaders for standalone style files (outside of .vue) 70 | exports.styleLoaders = function (options) { 71 | const output = [] 72 | const loaders = exports.cssLoaders(options) 73 | 74 | for (const extension in loaders) { 75 | const loader = loaders[extension] 76 | output.push({ 77 | test: new RegExp('\\.' + extension + '$'), 78 | use: loader 79 | }) 80 | } 81 | 82 | return output 83 | } 84 | 85 | exports.createNotifierCallback = () => { 86 | const notifier = require('node-notifier') 87 | 88 | return (severity, errors) => { 89 | if (severity !== 'error') return 90 | 91 | const error = errors[0] 92 | const filename = error.file && error.file.split('!').pop() 93 | 94 | notifier.notify({ 95 | title: packageConfig.name, 96 | message: severity + ': ' + error.name, 97 | subtitle: filename || '', 98 | icon: path.join(__dirname, 'logo.png') 99 | }) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /spring-fee/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-fee/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | const createLintingRule = () => ({ 12 | test: /\.(js|vue)$/, 13 | loader: 'eslint-loader', 14 | enforce: 'pre', 15 | include: [resolve('src'), resolve('test')], 16 | options: { 17 | formatter: require('eslint-friendly-formatter'), 18 | emitWarning: !config.dev.showEslintErrorsInOverlay 19 | } 20 | }) 21 | 22 | module.exports = { 23 | context: path.resolve(__dirname, '../'), 24 | entry: { 25 | app: './src/main.js' 26 | }, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: '[name].js', 30 | publicPath: process.env.NODE_ENV === 'production' 31 | ? config.build.assetsPublicPath 32 | : config.dev.assetsPublicPath 33 | }, 34 | resolve: { 35 | extensions: ['.js', '.vue', '.json'], 36 | alias: { 37 | 'vue$': 'vue/dist/vue.esm.js', 38 | '@': resolve('src'), 39 | } 40 | }, 41 | module: { 42 | rules: [ 43 | ...(config.dev.useEslint ? [createLintingRule()] : []), 44 | { 45 | test: /\.vue$/, 46 | loader: 'vue-loader', 47 | options: vueLoaderConfig 48 | }, 49 | { 50 | test: /\.js$/, 51 | loader: 'babel-loader', 52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 53 | }, 54 | { 55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 56 | loader: 'url-loader', 57 | options: { 58 | limit: 10000, 59 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 60 | } 61 | }, 62 | { 63 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 64 | loader: 'url-loader', 65 | options: { 66 | limit: 10000, 67 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 68 | } 69 | }, 70 | { 71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 72 | loader: 'url-loader', 73 | options: { 74 | limit: 10000, 75 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 76 | } 77 | } 78 | ] 79 | }, 80 | node: { 81 | // prevent webpack from injecting useless setImmediate polyfill because Vue 82 | // source contains it (although only uses it if it's native). 83 | setImmediate: false, 84 | // prevent webpack from injecting mocks to Node native modules 85 | // that does not make sense for the client 86 | dgram: 'empty', 87 | fs: 'empty', 88 | net: 'empty', 89 | tls: 'empty', 90 | child_process: 'empty' 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /spring-fee/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /spring-fee/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /spring-fee/config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '', 13 | proxyTable: {}, 14 | 15 | // Various Dev Server settings 16 | host: 'localhost', // can be overwritten by process.env.HOST 17 | port: 7070, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: false, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | // Use Eslint Loader? 24 | // If true, your code will be linted during bundling and 25 | // linting errors and warnings will be shown in the console. 26 | useEslint: true, 27 | // If true, eslint errors and warnings will also be shown in the error overlay 28 | // in the browser. 29 | showEslintErrorsInOverlay: false, 30 | 31 | /** 32 | * Source Maps 33 | */ 34 | 35 | // https://webpack.js.org/configuration/devtool/#development 36 | devtool: 'cheap-module-eval-source-map', 37 | 38 | // If you have problems debugging vue-files in devtools, 39 | // set this to false - it *may* help 40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 41 | cacheBusting: true, 42 | 43 | cssSourceMap: true 44 | }, 45 | 46 | build: { 47 | // Template for index.html 48 | index: path.resolve(__dirname, '../dist/index.html'), 49 | 50 | // Paths 51 | assetsRoot: path.resolve(__dirname, '../dist'), 52 | assetsSubDirectory: 'static', 53 | assetsPublicPath: '/', 54 | 55 | /** 56 | * Source Maps 57 | */ 58 | 59 | productionSourceMap: true, 60 | // https://webpack.js.org/configuration/devtool/#production 61 | devtool: '#source-map', 62 | 63 | // Gzip off by default as many popular static hosts such as 64 | // Surge or Netlify already gzip all static assets for you. 65 | // Before setting to `true`, make sure to: 66 | // npm install --save-dev compression-webpack-plugin 67 | productionGzip: false, 68 | productionGzipExtensions: ['js', 'css'], 69 | 70 | // Run the build command with an extra argument to 71 | // View the bundle analyzer report after build finishes: 72 | // `npm run build --report` 73 | // Set to `true` or `false` to always turn it on or off 74 | bundleAnalyzerReport: process.env.npm_config_report 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /spring-fee/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /spring-fee/config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const devEnv = require('./dev.env') 4 | 5 | module.exports = merge(devEnv, { 6 | NODE_ENV: '"testing"' 7 | }) 8 | -------------------------------------------------------------------------------- /spring-fee/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 个人信息管理系统 21 | 22 | 23 |
24 |
25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /spring-fee/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spring-fee", 3 | "version": "1.0.0", 4 | "description": "wanna spring front end", 5 | "author": "pantao ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "unit": "jest --config test/unit/jest.conf.js --coverage", 11 | "e2e": "node test/e2e/runner.js", 12 | "test": "npm run unit && npm run e2e", 13 | "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs", 14 | "build": "node build/build.js" 15 | }, 16 | "dependencies": { 17 | "axios": "^0.18.0", 18 | "crypto-js": "^3.1.9-1", 19 | "dayjs": "^1.7.7", 20 | "echarts": "^4.2.0-rc.2", 21 | "element-ui": "^2.4.10", 22 | "jquery": "^3.3.1", 23 | "js-base64": "^2.4.9", 24 | "js-cookie": "^2.2.0", 25 | "jsencrypt": "^3.0.0-rc.1", 26 | "lodash": "^4.17.11", 27 | "v-charts": "^1.19.0", 28 | "vue": "^2.5.2", 29 | "vue-router": "^3.0.1" 30 | }, 31 | "devDependencies": { 32 | "autoprefixer": "^7.1.2", 33 | "babel-core": "^6.22.1", 34 | "babel-eslint": "^8.2.1", 35 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 36 | "babel-jest": "^21.0.2", 37 | "babel-loader": "^7.1.1", 38 | "babel-plugin-dynamic-import-node": "^1.2.0", 39 | "babel-plugin-syntax-jsx": "^6.18.0", 40 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", 41 | "babel-plugin-transform-runtime": "^6.22.0", 42 | "babel-plugin-transform-vue-jsx": "^3.5.0", 43 | "babel-preset-env": "^1.3.2", 44 | "babel-preset-stage-2": "^6.22.0", 45 | "babel-register": "^6.22.0", 46 | "chalk": "^2.0.1", 47 | "chromedriver": "^2.27.2", 48 | "copy-webpack-plugin": "^4.0.1", 49 | "cross-spawn": "^5.0.1", 50 | "css-loader": "^0.28.0", 51 | "eslint": "^4.15.0", 52 | "eslint-config-standard": "^10.2.1", 53 | "eslint-friendly-formatter": "^3.0.0", 54 | "eslint-loader": "^1.7.1", 55 | "eslint-plugin-import": "^2.7.0", 56 | "eslint-plugin-node": "^5.2.0", 57 | "eslint-plugin-promise": "^3.4.0", 58 | "eslint-plugin-standard": "^3.0.1", 59 | "eslint-plugin-vue": "^4.0.0", 60 | "extract-text-webpack-plugin": "^3.0.0", 61 | "file-loader": "^1.1.4", 62 | "friendly-errors-webpack-plugin": "^1.6.1", 63 | "html-webpack-plugin": "^2.30.1", 64 | "jest": "^22.0.4", 65 | "jest-serializer-vue": "^0.3.0", 66 | "nightwatch": "^0.9.12", 67 | "node-notifier": "^5.1.2", 68 | "optimize-css-assets-webpack-plugin": "^3.2.0", 69 | "ora": "^1.2.0", 70 | "portfinder": "^1.0.13", 71 | "postcss-import": "^11.0.0", 72 | "postcss-loader": "^2.0.8", 73 | "postcss-url": "^7.2.1", 74 | "rimraf": "^2.6.0", 75 | "selenium-server": "^3.0.1", 76 | "semver": "^5.3.0", 77 | "shelljs": "^0.7.6", 78 | "uglifyjs-webpack-plugin": "^1.1.1", 79 | "url-loader": "^0.5.8", 80 | "vue-jest": "^1.0.2", 81 | "vue-loader": "^13.3.0", 82 | "vue-style-loader": "^3.0.1", 83 | "vue-template-compiler": "^2.5.2", 84 | "webpack": "^3.6.0", 85 | "webpack-bundle-analyzer": "^2.9.0", 86 | "webpack-dev-server": "^2.9.1", 87 | "webpack-merge": "^4.1.0" 88 | }, 89 | "engines": { 90 | "node": ">= 6.0.0", 91 | "npm": ">= 3.0.0" 92 | }, 93 | "browserslist": [ 94 | "> 1%", 95 | "last 2 versions", 96 | "not ie <= 8" 97 | ] 98 | } 99 | -------------------------------------------------------------------------------- /spring-fee/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 28 | 29 | 39 | -------------------------------------------------------------------------------- /spring-fee/src/assets/css/style.css: -------------------------------------------------------------------------------- 1 | .h5-v-middle { 2 | padding-top: 10px; 3 | } 4 | 5 | .br-space { 6 | height: 10px; 7 | } 8 | -------------------------------------------------------------------------------- /spring-fee/src/assets/js/utils.js: -------------------------------------------------------------------------------- 1 | export default { 2 | showWarning: function (self, msg) { 3 | self.$message({showClose: true, message: msg, type: 'warning'}) 4 | }, 5 | showError: function (self, msg) { 6 | self.$message({showClose: true, message: msg, type: 'error'}) 7 | }, 8 | showSuccess: function (self, msg) { 9 | self.$message({showClose: true, message: msg, type: 'success'}) 10 | }, 11 | clone: function (object) { 12 | return JSON.parse(JSON.stringify(object)) 13 | }, 14 | isNotNull: function (e) { 15 | return !this.isNull(e) 16 | }, 17 | isNull: function (e) { 18 | return e === null || e === undefined 19 | }, 20 | formatInteger: function (value, length) { 21 | let str = value === null || value === undefined ? '' : value.toString() 22 | while (str.length < length) { 23 | str = '0' + str 24 | } 25 | return str 26 | }, 27 | isMobile: function () { 28 | let userAgent = navigator.userAgent.toLowerCase() 29 | let isPad = userAgent.indexOf('ipad') > -1 30 | let isIpone = userAgent.indexOf('iphone') > -1 31 | let isMidp = userAgent.indexOf('midp') > -1 32 | let isUc = userAgent.indexOf('rv:1.2.3.4') > -1 || userAgent.indexOf('ucweb') > -1 33 | let isAndroid = userAgent.indexOf('android') > -1 34 | let isCe = userAgent.indexOf('windows ce') > -1 35 | let isWm = userAgent.indexOf('windows mobile') > -1 36 | return isPad || isIpone || isMidp || isUc || isAndroid || isCe || isWm || userAgent.indexOf('mobile') > -1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /spring-fee/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/src/assets/logo.png -------------------------------------------------------------------------------- /spring-fee/src/components/DaysLeft.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 47 | 48 | 51 | -------------------------------------------------------------------------------- /spring-fee/src/components/Index.vue: -------------------------------------------------------------------------------- 1 | 2 | 29 | 30 | 102 | 103 | 104 | 107 | -------------------------------------------------------------------------------- /spring-fee/src/components/Login.vue: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 68 | 69 | 72 | -------------------------------------------------------------------------------- /spring-fee/src/components/PasswordReset.vue: -------------------------------------------------------------------------------- 1 | 2 | 40 | 41 | 112 | 113 | 116 | -------------------------------------------------------------------------------- /spring-fee/src/components/container/SigninContainer.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 28 | 29 | 32 | -------------------------------------------------------------------------------- /spring-fee/src/components/index/job/JobLog.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 86 | 87 | 90 | -------------------------------------------------------------------------------- /spring-fee/src/components/index/todo/TodoItem.vue: -------------------------------------------------------------------------------- 1 | 2 | 23 | 24 | 102 | 103 | 116 | -------------------------------------------------------------------------------- /spring-fee/src/components/modal/DailyModal.vue: -------------------------------------------------------------------------------- 1 | 2 | 46 | 47 | 95 | 96 | 99 | -------------------------------------------------------------------------------- /spring-fee/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import ElementUI from 'element-ui' 6 | import VCharts from 'v-charts' 7 | import 'element-ui/lib/theme-chalk/index.css' 8 | import router from './router' 9 | 10 | Vue.config.productionTip = false 11 | 12 | Vue.use(ElementUI) 13 | Vue.use(VCharts) 14 | 15 | /* eslint-disable no-new */ 16 | new Vue({ 17 | el: '#app', 18 | router, 19 | components: {App}, 20 | template: '', 21 | render: h => h(App) 22 | }) 23 | -------------------------------------------------------------------------------- /spring-fee/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Index from '../components/Index' 4 | import SigninContainer from '../components/container/SigninContainer' 5 | import Login from '../components/Login' 6 | import Register from '../components/Register' 7 | import PasswordReset from '../components/PasswordReset' 8 | import Income from '../components/index/Income' 9 | import ScheduleContainer from '../components/container/ScheduleContainer' 10 | import Daily from '../components/index/Daily' 11 | import Todo from '../components/index/Todo' 12 | import Job from '../components/index/Job' 13 | 14 | // noinspection JSUnresolvedFunction 15 | Vue.use(Router) 16 | 17 | export default new Router({ 18 | routes: [ 19 | { 20 | path: '/', 21 | component: Index, 22 | children: [{ 23 | path: '/income', 24 | name: 'Income', 25 | component: Income 26 | }, { 27 | path: '', 28 | name: 'ScheduleContainer', 29 | component: ScheduleContainer, 30 | children: [{ 31 | path: '/daily', 32 | name: 'Daily', 33 | component: Daily 34 | }, { 35 | path: '/todo', 36 | name: 'Todo', 37 | component: Todo 38 | }] 39 | }, { 40 | path: '/job', 41 | name: 'Job', 42 | component: Job 43 | }] 44 | }, { 45 | path: '', 46 | name: 'SigninContainer', 47 | component: SigninContainer, 48 | children: [{ 49 | path: '/login', 50 | name: 'Login', 51 | component: Login 52 | }, { 53 | path: '/register', 54 | name: 'Register', 55 | component: Register 56 | }, { 57 | path: '/password/reset', 58 | name: 'PasswordReset', 59 | component: PasswordReset 60 | }] 61 | } 62 | ] 63 | }) 64 | -------------------------------------------------------------------------------- /spring-fee/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/.gitkeep -------------------------------------------------------------------------------- /spring-fee/static/font/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/font/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /spring-fee/static/font/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/font/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /spring-fee/static/font/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/font/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /spring-fee/static/font/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/font/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /spring-fee/static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/img/logo.png -------------------------------------------------------------------------------- /spring-fee/static/js/mobile/layer.js: -------------------------------------------------------------------------------- 1 | /*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ 2 | ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'

'+(e?n.title[0]:n.title)+"

":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e=''+n.btn[0]+"",2===t&&(e=''+n.btn[1]+""+e),'
'+e+"
"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='

'+(n.content||"")+"

"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"
':"")+'
"+l+'
'+n.content+"
"+c+"
",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;odiv{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} -------------------------------------------------------------------------------- /spring-fee/static/js/theme/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/js/theme/default/icon-ext.png -------------------------------------------------------------------------------- /spring-fee/static/js/theme/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/js/theme/default/icon.png -------------------------------------------------------------------------------- /spring-fee/static/js/theme/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/js/theme/default/loading-0.gif -------------------------------------------------------------------------------- /spring-fee/static/js/theme/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/js/theme/default/loading-1.gif -------------------------------------------------------------------------------- /spring-fee/static/js/theme/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code4everything/wanna-spring/b8b406e171ae517c9a3a87ae420ee65dd4ac0c4f/spring-fee/static/js/theme/default/loading-2.gif -------------------------------------------------------------------------------- /spring-fee/test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // The assertion name is the filename. 3 | // Example usage: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // For more information on custom assertions see: 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | 10 | exports.assertion = function (selector, count) { 11 | this.message = 'Testing if element <' + selector + '> has count: ' + count 12 | this.expected = count 13 | this.pass = function (val) { 14 | return val === this.expected 15 | } 16 | this.value = function (res) { 17 | return res.value 18 | } 19 | this.command = function (cb) { 20 | var self = this 21 | return this.api.execute(function (selector) { 22 | return document.querySelectorAll(selector).length 23 | }, [selector], function (res) { 24 | cb.call(self, res) 25 | }) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-fee/test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/gettingstarted#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: require('selenium-server').path, 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /spring-fee/test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | 4 | const webpack = require('webpack') 5 | const DevServer = require('webpack-dev-server') 6 | 7 | const webpackConfig = require('../../build/webpack.prod.conf') 8 | const devConfigPromise = require('../../build/webpack.dev.conf') 9 | 10 | let server 11 | 12 | devConfigPromise.then(devConfig => { 13 | const devServerOptions = devConfig.devServer 14 | const compiler = webpack(webpackConfig) 15 | server = new DevServer(compiler, devServerOptions) 16 | const port = devServerOptions.port 17 | const host = devServerOptions.host 18 | return server.listen(port, host) 19 | }) 20 | .then(() => { 21 | // 2. run the nightwatch test suite against it 22 | // to run in additional browsers: 23 | // 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings" 24 | // 2. add it to the --env flag below 25 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 26 | // For more information on Nightwatch's config file, see 27 | // http://nightwatchjs.org/guide#settings-file 28 | let opts = process.argv.slice(2) 29 | if (opts.indexOf('--config') === -1) { 30 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 31 | } 32 | if (opts.indexOf('--env') === -1) { 33 | opts = opts.concat(['--env', 'chrome']) 34 | } 35 | 36 | const spawn = require('cross-spawn') 37 | const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 38 | 39 | runner.on('exit', function (code) { 40 | server.close() 41 | process.exit(code) 42 | }) 43 | 44 | runner.on('error', function (err) { 45 | server.close() 46 | throw err 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /spring-fee/test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-fee/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spring-fee/test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue' 9 | ], 10 | moduleNameMapper: { 11 | '^@/(.*)$': '/src/$1' 12 | }, 13 | transform: { 14 | '^.+\\.js$': '/node_modules/babel-jest', 15 | '.*\\.(vue)$': '/node_modules/vue-jest' 16 | }, 17 | testPathIgnorePatterns: [ 18 | '/test/e2e' 19 | ], 20 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 21 | setupFiles: ['/test/unit/setup'], 22 | mapCoverage: true, 23 | coverageDirectory: '/test/unit/coverage', 24 | collectCoverageFrom: [ 25 | 'src/**/*.{js,vue}', 26 | '!src/main.js', 27 | '!src/router/index.js', 28 | '!**/node_modules/**' 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /spring-fee/test/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | -------------------------------------------------------------------------------- /spring-fee/test/unit/specs/HelloWorld.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Index from '@/components/Index' 3 | 4 | describe('Index.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(Index) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .toEqual('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | --------------------------------------------------------------------------------