1,环境
jdk1.8
IDEA
2,目标
企业内部开发经常遇到的一个问题是,bug追踪问题,一些公司使用excel表格追踪问题,虽然可以,但是随着业务的增加,变的难以维护。为了有效地管理bug,我们需要要一个强大的错误跟踪解决方案,比如现代化的缺陷跟踪管理软件,它们可以跟踪每个项目阶段的bug,从开发过程到软件测试和发布阶段。
3,规划
系统中应包含一下几个方面。
1,项目创建。
2,项目的人员分配。
3,系统维护
4,发布bug
5,bug当前状态
4,实施方案
项目管理员发布项目,并分配成员。
由此可以提出两类用户,项目管理与成员。那么是由谁分配用户呢?当然是root了,呵呵。项目组成员可以在具体分一下,可以分为前端开发人员,后台开发人员,测试人员和项目管理员。如果做过外包,还应该包括甲方测试人员,这部分要认真思考一下,从以往的经验来看,甲方的问题还是由项目管理员一个人负责比较好,以免出现不必要的纠纷。。。。。
公司内部使用的系统还是比较好折腾的,下面咱们就开始搭建开发环境。还是使用springboot吧,简单实用,成型快。
第一步,表设计。后面会详细说明
- t_user
- t_role
- t_res
- t_menu
- t_member
- t_project
- t_bug
- t_bug_file
第二步,创建springboot工程
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.dguo.web</groupId>
<artifactId>buglistv2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>buglistv2</name>
<description>buglistv2</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
<build>
<finalName>buglistv2</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
application.properties
server.servlet.context-path=/
server.port=9090
server.undertow.max-http-post-size=-1
server.undertow.max-headers=409600
server.max-http-header-size=409600
spring.http.multipart.location=~/tmpfile
server.error.path=/error
#spring.devtools.restart.enabled=true
#spring.devtools.restart.additional-paths=src/main/java
#spring.datasource.url=jdbc:h2:mem:test
spring.datasource.url=jdbc:h2:file:./db/h2
spring.datasource.username=root
spring.datasource.password=12345678
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.schema=classpath:db/schema.sql
spring.datasource.data=classpath:db/data.sql
spring.h2.console.enabled=true
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=5
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.locale=zh_CN
spring.jackson.time-zone=GMT+8
spring.jackson.default-property-inclusion=always
spring.servlet.multipart.enabled=true
spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=50MB
mybatis.config-location=classpath:mybatis-config.xml
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.dguo.web.domain
spring.freemarker.allow-request-override=false
spring.freemarker.allow-session-override=false
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-location=true
# Content-Type value.
spring.freemarker.content-type=text/html
spring.freemarker.enabled=true
spring.freemarker.expose-request-attributes=false
spring.freemarker.expose-session-attributes=false
spring.freemarker.expose-spring-macro-helpers=true
spring.freemarker.prefer-file-system-access=true
spring.freemarker.suffix=.ftl
spring.freemarker.template-loader-path=classpath:/templates/
spring.freemarker.settings.template_update_delay=0
spring.freemarker.settings.default_encoding=UTF-8
spring.freemarker.settings.classic_compatible=true
spring.freemarker.settings.datetime_format=yyyy-MM-dd HH:mm:ss
spring.freemarker.settings.date_format=yyyy-MM-dd
spring.freemarker.settings.time_format=HH:mm:ss
spring.freemarker.settings.number_format=#
user.file.path=/eight/
user.file.url=/img/
logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="logPath" value="logs" />
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>DENY</onMatch>
<onMismatch>ACCEPT</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${logPath}/info.%d{yyyy-MM-dd}.part_%i.log</FileNamePattern>
<maxHistory>90</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>Error</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${logPath}/error.%d{yyyy-MM-dd}.part_%i.log</FileNamePattern>
<maxHistory>90</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="info">
<appender-ref ref="CONSOLE"/>
<!--<appender-ref ref="FILE_INFO"/>-->
<!--<appender-ref ref="FILE_ERROR"/>-->
</root>
<logger name="com.dguo.web.mapper" level="trace"/>
</configuration>
mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
<typeAliases>
<typeAlias alias="Integer" type="java.lang.Integer"/>
<typeAlias alias="Long" type="java.lang.Long"/>
<typeAlias alias="HashMap" type="java.util.HashMap"/>
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap"/>
<typeAlias alias="ArrayList" type="java.util.ArrayList"/>
<typeAlias alias="LinkedList" type="java.util.LinkedList"/>
</typeAliases>
</configuration>
EightApplication.java
package com.dguo.web;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan(basePackages = "com.dguo.web.mapper")
public class EightApplication {
public static void main(String[] args) {
SpringApplication.run(EightApplication.class, args);
}
}
MVCConfiguration.java
package com.dguo.web;
import com.dguo.web.base.interceptor.AuthInterceptor;
import com.dguo.web.service.impl.UpdateSqlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.io.File;
/**
* dguo,2021/9/2
*/
@Configuration
public class MVCConfiguration implements WebMvcConfigurer, CommandLineRunner {
@Value("${user.file.path}")
private String imageFilePath;
@Value("${user.file.url}")
private String imageFileUrl;
@Autowired
private AuthInterceptor authInterceptor;
@Autowired
private UpdateSqlService updateSqlService;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
String os = System.getProperty("os.name");
String root = System.getProperty("user.dir");
File dest = new File(root+imageFilePath);
if(!dest.exists()){
dest.mkdir();
}
registry.addResourceHandler(imageFileUrl + "**")
.addResourceLocations("file:" + dest.getPath()+File.separator);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authInterceptor).addPathPatterns("/**");
}
@Override
public void run(String... args) throws Exception {
System.out.println("CommandLineRunner-....");
updateSqlService.doExecuteSql();
System.out.println("CommandLineRunner-end");
}
}
今天先到这里,明天继续
明天分析设计表结构。
拜拜小伙伴!