Skip to content

Commit

Permalink
发布 v0.0.1 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
juzi214032 authored Jul 19, 2020
2 parents f7430ba + 434fdd4 commit 7021ea3
Show file tree
Hide file tree
Showing 107 changed files with 4,054 additions and 99 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
50 changes: 50 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on: push

jobs:
build:
name: 编译
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [8, 11]
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
- name: Build with Maven
run: mvn -B package --file pom.xml
deploy:
name: 部署
runs-on: ubuntu-latest
steps:
- name: 拉取代码
uses: actions/checkout@v2
- name: 安装 JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: 编译
run: mvn -B package --file pom.xml
- name: 上传 jar 包
uses: easingthemes/[email protected]
env:
ARGS: "-rltgoDzvO"
SOURCE: "target/"
REMOTE_HOST: ${{ secrets.HOST }}
REMOTE_USER: ${{ secrets.USER }}
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
TARGET: ${{ secrets.REMOTE_TARGET }}
- name: 启动程序
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: sh /www/wwwroot/oerp.juzibiji.top/springboot/restart.sh
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
target/

#代码生成文件夹
ge/
### IntelliJ IDEA ###
.idea
*.iws
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Juzi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<p align="center">
<a href="" target="_blank">
<img width="200" src="https://img.juzibiji.top/20200715191757.png" alt="logo">
</a>
</p>

<p align="center">
<a href="https://github.com/juzi214032/oerp/actions">
<img src="https://github.com/juzi214032/oerp/workflows/Java%20CI%20with%20Maven/badge.svg" alt="Github Action">
</a>
<a href="https://spring.io/">
<img src="https://img.shields.io/badge/Spring%20Boot-2.3.1.RELEASE-brightgreen" alt="Spring Boot">
</a>
<a href="https://mp.baomidou.com/">
<img src="https://img.shields.io/badge/MyBatis%20Plus-3.3.2-blue" alt="MyBatis Plus">
</a>
<a href="https://en.wikipedia.org/wiki/MIT_License">
<img src="https://img.shields.io/badge/license-MIT-lightgrey.svg" alt="LISENCE" >
</a>
</p>

## 介绍

OERP 是 Online Examination Registration Platform 的缩写,中文名称为:**在线考试报名平台**

该仓库是 OERP 服务端代码仓库,使用 SpringBoot + Mybatis Plus + MySQL 实现。

## 开发环境

- Java 8 及以上
- IDEA 2020.1
- **IDEA 需要安装插件 [Lombok](https://plugins.jetbrains.com/plugin/index?xmlId=Lombook%20Plugin)**

## 快速开始

- 在你的数据库中新建一个名为`oerp`的数据库

- 导入仓库目录`/src/main/resources/oerp.sql`的 SQL 文件

- 修改`/src/main/resources/application.yml`中的`spring.datasource`配置为你自己的数据库信息

-**IDEA** 或 Eclipse 中启动项目

- 访问网址 [http://localhost:8080/api/v1](http://localhost:8080/api/v1),看到如下文字代表系统启动成功:

![启动成功截图](https://img.juzibiji.top/20200716111640.png)

## 目录结构

```
|-- src
|-- main
|-- java
| |-- com.juzi.oerp
| |-- OerpApplication.java -> SpringBoot 启动类
| |-- common -> 项目通用类
| | |-- constant -> 常量
| | |-- exception -> 自定义异常
| | |-- interceptor -> 拦截器(身份认证、权限拦截)
| | |-- jackson -> Jackson 相关
| | |-- store -> 存储型对象(存储当前登录用户的信息)
| |-- configuration -> 系统配置
| |-- controller -> 系统 API 接口
| |-- dao -> 自定义 DAO 层接口(主要做多表查询)
| |-- mapper -> MyBatis Plus Generator 生成的 DAO 接口(主要做单表 CRUD)
| |-- model -> Java POJO
| | |-- dto -> 数据传输对象(主要用在 Controller 与 Service 层之间)
| | | |-- param -> 用于 Controller 层接收参数的对象
| | |-- po -> 持久层对象(和数据库表一一对应,用在 DAO 层)
| | |-- vo -> 视图层对象(作为 Controller 的返回值)
| |-- service -> 服务层
| |-- util -> 通用工具类(JWT Token 生成等)
|-- resources
|-- application.yml -> Spring Boot 配置文件
|-- banner.txt
|-- oerp.sql -> 数据库 SQL 文件(数据库名为 oerp)
|-- mybatis
|-- xml
|-- dao -> 自定义 Mybatis Xml
|-- mapper -> MyBatis Plus Generator 生成的 MyBatis Xml
```
94 changes: 46 additions & 48 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@
<version>0.0.1-SNAPSHOT</version>
<name>oerp</name>
<description>在线考试报名平台</description>


<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/>
</parent>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot-admin.version>2.2.3</spring-boot-admin.version>
<spring-boot.version>2.3.0.RELEASE</spring-boot.version>
<spring-boot.version>2.3.1.RELEASE</spring-boot.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
Expand All @@ -29,14 +32,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -66,66 +61,69 @@
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.2</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.3.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
<version>5.3.9</version>
</dependency>

<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.10.3</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-captcha</artifactId>
<version>5.3.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-dependencies</artifactId>
<version>${spring-boot-admin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/com/juzi/oerp/OerpApplication.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
package com.juzi.oerp;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
* @author Juzi
*/
@EnableCaching
@RestController
@SpringBootApplication
@MapperScan("com.juzi.oerp.dao")
@EnableTransactionManagement
@MapperScan({"com.juzi.oerp.dao","com.juzi.oerp.mapper"})
@ConfigurationPropertiesScan("com.juzi.oerp.configuration.properties")
public class OerpApplication {

public static void main(String[] args) {
SpringApplication.run(OerpApplication.class, args);
}

@GetMapping(produces = "text/html;charset=utf-8")
public String index() {
return "<style type=\"text/css\">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor:" +
"pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family:" +
"\"Century Gothic\",\"Microsoft yahei\"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal;" +
"margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style=\"padding: 24px 48px;\"><p align='center'>" +
"<span style=\"font-size:30px\">OERP 在线考试报名系统</span></p></div> ";
}
}
16 changes: 16 additions & 0 deletions src/main/java/com/juzi/oerp/common/constant/CacheConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.juzi.oerp.common.constant;

/**
* 缓存常量
*
* @author Juzi
* @date 2020/7/17 11:56
*/
public class CacheConstants {

/**
* 验证码已经被验证
*/
public static final String CAPTCHA_CHECKED = "OK";

}
14 changes: 14 additions & 0 deletions src/main/java/com/juzi/oerp/common/constant/JWTConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.juzi.oerp.common.constant;

/**
* JWT 常量
*
* @author Juzi
* @date 2020/7/14 15:47
*/
public class JWTConstants {
/**
* JWT 签名密钥
*/
public static final String JWT_SECRET = "OERP is good!";
}
Loading

0 comments on commit 7021ea3

Please sign in to comment.