21 changed files with 688 additions and 12 deletions
			
			
		@ -0,0 +1,15 @@ | 
				
			|||
package com.visual.open.anpr.server.bootstrap; | 
				
			|||
 | 
				
			|||
import org.springframework.boot.SpringApplication; | 
				
			|||
import org.springframework.boot.autoconfigure.SpringBootApplication; | 
				
			|||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | 
				
			|||
import org.springframework.scheduling.annotation.EnableScheduling; | 
				
			|||
 | 
				
			|||
@SpringBootApplication | 
				
			|||
public class OpenAnprApplication { | 
				
			|||
 | 
				
			|||
	public static void main(String[] args) { | 
				
			|||
		SpringApplication.run(OpenAnprApplication.class, args); | 
				
			|||
	} | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,39 @@ | 
				
			|||
package com.visual.open.anpr.server.bootstrap.conf; | 
				
			|||
 | 
				
			|||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; | 
				
			|||
import org.springframework.beans.factory.annotation.Value; | 
				
			|||
import org.springframework.context.annotation.Bean; | 
				
			|||
import org.springframework.context.annotation.Configuration; | 
				
			|||
import springfox.documentation.builders.ApiInfoBuilder; | 
				
			|||
import springfox.documentation.builders.PathSelectors; | 
				
			|||
import springfox.documentation.builders.RequestHandlerSelectors; | 
				
			|||
import springfox.documentation.oas.annotations.EnableOpenApi; | 
				
			|||
import springfox.documentation.spi.DocumentationType; | 
				
			|||
import springfox.documentation.spring.web.plugins.Docket; | 
				
			|||
 | 
				
			|||
@Configuration | 
				
			|||
@EnableOpenApi | 
				
			|||
@EnableKnife4j | 
				
			|||
public class Knife4jConfig { | 
				
			|||
 | 
				
			|||
    @Value("${visual.swagger.enable:true}") | 
				
			|||
    private Boolean enable; | 
				
			|||
 | 
				
			|||
    @Bean | 
				
			|||
    public Docket createRestApi() { | 
				
			|||
        return new Docket(DocumentationType.OAS_30) | 
				
			|||
                .enable(enable) | 
				
			|||
                .apiInfo(new ApiInfoBuilder() | 
				
			|||
                    .title("车牌识别服务API") | 
				
			|||
                    .description("车牌识别服务API") | 
				
			|||
                    .version("1.0.0") | 
				
			|||
                    .build()) | 
				
			|||
                .groupName("1.0.0") | 
				
			|||
                .select() | 
				
			|||
                .apis(RequestHandlerSelectors.basePackage("com.visual.open.anpr.server.controller.server")) | 
				
			|||
                .paths(PathSelectors.any()) | 
				
			|||
                .build(); | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
 | 
				
			|||
@ -0,0 +1,96 @@ | 
				
			|||
package com.visual.open.anpr.server.bootstrap.conf; | 
				
			|||
 | 
				
			|||
import com.visual.open.anpr.core.base.PlateDetection; | 
				
			|||
import com.visual.open.anpr.core.base.PlateRecognition; | 
				
			|||
import com.visual.open.anpr.core.extract.PlateExtractor; | 
				
			|||
import com.visual.open.anpr.core.extract.PlateExtractorImpl; | 
				
			|||
import com.visual.open.anpr.core.models.TorchPlateDetection; | 
				
			|||
import com.visual.open.anpr.core.models.TorchPlateRecognition; | 
				
			|||
import org.springframework.beans.factory.annotation.Qualifier; | 
				
			|||
import org.springframework.beans.factory.annotation.Value; | 
				
			|||
import org.springframework.context.annotation.Bean; | 
				
			|||
import org.springframework.context.annotation.Configuration; | 
				
			|||
 | 
				
			|||
@Configuration("visualModelConfig") | 
				
			|||
public class ModelConfig { | 
				
			|||
 | 
				
			|||
    @Value("${spring.profiles.active}") | 
				
			|||
    private String profile; | 
				
			|||
 | 
				
			|||
    @Value("${visual.model.plateDetection.name:TorchPlateDetection}") | 
				
			|||
    private String plateDetectionName; | 
				
			|||
    @Value("${visual.model.plateDetection.modelPath}") | 
				
			|||
    private String[] plateDetectionModel; | 
				
			|||
    @Value("${visual.model.plateDetection.thread:4}") | 
				
			|||
    private Integer plateDetectionThread; | 
				
			|||
 | 
				
			|||
    @Value("${visual.model.plateRecognition.name:TorchPlateRecognition}") | 
				
			|||
    private String plateRecognitionName; | 
				
			|||
    @Value("${visual.model.plateRecognition.modelPath}") | 
				
			|||
    private String[] plateRecognitionNameModel; | 
				
			|||
    @Value("${visual.model.plateRecognition.thread:4}") | 
				
			|||
    private Integer plateRecognitionNameThread; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 获取车牌检查模型 | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    @Bean(name = "visualPlateDetection") | 
				
			|||
    public PlateDetection getPlateDetection(){ | 
				
			|||
        if(plateDetectionName.equalsIgnoreCase("TorchPlateDetection")){ | 
				
			|||
            return new TorchPlateDetection(getModelPath(plateDetectionName, plateDetectionModel)[0], plateDetectionThread); | 
				
			|||
        }else{ | 
				
			|||
            return new TorchPlateDetection(getModelPath(plateDetectionName, plateDetectionModel)[0], plateDetectionThread); | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 人脸特征提取服务 | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    @Bean(name = "visualPlateRecognition") | 
				
			|||
    public PlateRecognition getPlateRecognition(){ | 
				
			|||
        if(plateRecognitionName.equalsIgnoreCase("TorchPlateRecognition")){ | 
				
			|||
            return new TorchPlateRecognition(getModelPath(plateRecognitionName, plateRecognitionNameModel)[0], plateRecognitionNameThread); | 
				
			|||
        }else{ | 
				
			|||
            return new TorchPlateRecognition(getModelPath(plateRecognitionName, plateRecognitionNameModel)[0], plateRecognitionNameThread); | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 构建特征提取器 | 
				
			|||
     * @param plateDetection     车牌检测模型 | 
				
			|||
     * @param plateRecognition   车牌识别模型 | 
				
			|||
     */ | 
				
			|||
    @Bean(name = "visualPlateExtractor") | 
				
			|||
    public PlateExtractor getPlateExtractor( | 
				
			|||
            @Qualifier("visualPlateDetection")PlateDetection plateDetection, | 
				
			|||
            @Qualifier("visualPlateRecognition")PlateRecognition plateRecognition | 
				
			|||
    ){ | 
				
			|||
            return new PlateExtractorImpl(plateDetection, plateRecognition); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 获取模型路径 | 
				
			|||
     * @param modelName 模型名称 | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    private String[] getModelPath(String modelName, String modelPath[]){ | 
				
			|||
 | 
				
			|||
        String basePath = "open-anpr-core/src/main/resources/"; | 
				
			|||
        if("docker".equalsIgnoreCase(profile)){ | 
				
			|||
            basePath = "/app/open-anpr/"; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if((null == modelPath || modelPath.length != 1) && "TorchPlateDetection".equalsIgnoreCase(modelName)){ | 
				
			|||
            return new String[]{basePath + "models/plate_detect.onnx"}; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if((null == modelPath || modelPath.length != 1) && "TorchPlateRecognition".equalsIgnoreCase(modelName)){ | 
				
			|||
            return new String[]{basePath + "models/plate_rec_color.onnx"}; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        return modelPath; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,28 @@ | 
				
			|||
package com.visual.open.anpr.server.bootstrap.conf; | 
				
			|||
 | 
				
			|||
import org.springframework.context.annotation.ComponentScan; | 
				
			|||
import org.springframework.context.annotation.Configuration; | 
				
			|||
 | 
				
			|||
@Configuration("visualServerConfig") | 
				
			|||
public class ServerConfig { | 
				
			|||
 | 
				
			|||
    @Configuration | 
				
			|||
    @ComponentScan("com.visual.open.anpr.server.utils") | 
				
			|||
    public static class SearchUtils {} | 
				
			|||
 | 
				
			|||
    @Configuration | 
				
			|||
    @ComponentScan("com.visual.open.anpr.server.config") | 
				
			|||
    public static class SearchConfig {} | 
				
			|||
 | 
				
			|||
    @Configuration | 
				
			|||
    @ComponentScan({"com.visual.open.anpr.server.service"}) | 
				
			|||
    public static class ServiceConfig {} | 
				
			|||
 | 
				
			|||
    @Configuration | 
				
			|||
    @ComponentScan({"com.visual.open.anpr.server.controller"}) | 
				
			|||
    public static class ControllerConfig {} | 
				
			|||
 | 
				
			|||
    @Configuration | 
				
			|||
    @ComponentScan({"com.visual.open.anpr.server.scheduler"}) | 
				
			|||
    public static class SchedulerConfig {} | 
				
			|||
} | 
				
			|||
@ -0,0 +1,10 @@ | 
				
			|||
package com.visual.open.anpr.server.controller.base; | 
				
			|||
 | 
				
			|||
import org.slf4j.Logger; | 
				
			|||
import org.slf4j.LoggerFactory; | 
				
			|||
 | 
				
			|||
public abstract class BaseController { | 
				
			|||
 | 
				
			|||
    public Logger logger = LoggerFactory.getLogger(getClass()); | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,17 @@ | 
				
			|||
package com.visual.open.anpr.server.controller.base; | 
				
			|||
 | 
				
			|||
import com.visual.open.anpr.server.domain.common.ResponseInfo; | 
				
			|||
import com.visual.open.anpr.server.utils.ResponseBuilder; | 
				
			|||
import org.springframework.web.bind.MethodArgumentNotValidException; | 
				
			|||
import org.springframework.web.bind.annotation.ExceptionHandler; | 
				
			|||
import org.springframework.web.bind.annotation.RestControllerAdvice; | 
				
			|||
 | 
				
			|||
@RestControllerAdvice | 
				
			|||
public class GlobalExceptionHandler { | 
				
			|||
 | 
				
			|||
    @ExceptionHandler(MethodArgumentNotValidException.class) | 
				
			|||
    public ResponseInfo<String> handleValidationExceptions(MethodArgumentNotValidException ex) { | 
				
			|||
        return ResponseBuilder.error(ex.getBindingResult().getFieldError().getDefaultMessage()); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,25 @@ | 
				
			|||
package com.visual.open.anpr.server.controller.health; | 
				
			|||
 | 
				
			|||
import com.visual.open.anpr.server.domain.common.ResponseInfo; | 
				
			|||
import com.visual.open.anpr.server.utils.ResponseBuilder; | 
				
			|||
import io.swagger.annotations.Api; | 
				
			|||
import io.swagger.annotations.ApiOperation; | 
				
			|||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RequestMethod; | 
				
			|||
import org.springframework.web.bind.annotation.ResponseBody; | 
				
			|||
import org.springframework.web.bind.annotation.RestController; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
@Api(tags="02、公共服务-健康检测") | 
				
			|||
@RestController("healthController") | 
				
			|||
@RequestMapping("/common/health") | 
				
			|||
public class HealthController { | 
				
			|||
 | 
				
			|||
    @ApiOperation(value="公共-服务健康检测") | 
				
			|||
    @ResponseBody | 
				
			|||
    @RequestMapping(value = "/check", method = RequestMethod.GET) | 
				
			|||
    public ResponseInfo<String> check(){ | 
				
			|||
        return ResponseBuilder.success("health check is ok"); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1 @@ | 
				
			|||
package com.visual.open.anpr.server.controller; | 
				
			|||
@ -0,0 +1,48 @@ | 
				
			|||
package com.visual.open.anpr.server.domain.common; | 
				
			|||
 | 
				
			|||
import com.fasterxml.jackson.annotation.JsonFormat; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Date; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * Entity基类 | 
				
			|||
 *  | 
				
			|||
 * @author diven | 
				
			|||
 */ | 
				
			|||
public class BaseEntity implements Serializable | 
				
			|||
{ | 
				
			|||
    private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** 创建时间 */ | 
				
			|||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 
				
			|||
    private Date createTime; | 
				
			|||
 | 
				
			|||
    /** 更新时间 */ | 
				
			|||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 
				
			|||
    private Date updateTime; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    public Date getCreateTime() | 
				
			|||
    { | 
				
			|||
        return createTime; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public void setCreateTime(Date createTime) | 
				
			|||
    { | 
				
			|||
        this.createTime = createTime; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    public Date getUpdateTime() | 
				
			|||
    { | 
				
			|||
        return updateTime; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public void setUpdateTime(Date updateTime) | 
				
			|||
    { | 
				
			|||
        this.updateTime = updateTime; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,54 @@ | 
				
			|||
package com.visual.open.anpr.server.domain.common; | 
				
			|||
 | 
				
			|||
import io.swagger.annotations.ApiModelProperty; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * des:接口返回对象 | 
				
			|||
 * @author diven | 
				
			|||
 * @date 上午9:34 2018/7/12 | 
				
			|||
 */ | 
				
			|||
public class ResponseInfo<T> implements Serializable{ | 
				
			|||
	 | 
				
			|||
	private static final long serialVersionUID = -6919611972884058300L; | 
				
			|||
 | 
				
			|||
    @ApiModelProperty(value="返回代码",name="code",required = true, position = 0) | 
				
			|||
	private Integer code; | 
				
			|||
    @ApiModelProperty(value="返回信息",name="message",required = false, position = 1) | 
				
			|||
    private String  message; | 
				
			|||
    @ApiModelProperty(value="数据信息",name="data",required = false, position = 2) | 
				
			|||
    private T 	    data; | 
				
			|||
 | 
				
			|||
    public ResponseInfo(){} | 
				
			|||
 | 
				
			|||
    public ResponseInfo(Integer code, String message, T data) { | 
				
			|||
        this.code = code; | 
				
			|||
        this.message = message; | 
				
			|||
        this.data = data; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public Integer getCode() { | 
				
			|||
        return code; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public void setCode(Integer code) { | 
				
			|||
        this.code = code; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public String getMessage() { | 
				
			|||
        return message; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public void setMessage(String message) { | 
				
			|||
        this.message = message; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public T getData() { | 
				
			|||
        return data; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public void setData(T data) { | 
				
			|||
        this.data = data; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1 @@ | 
				
			|||
package com.visual.open.anpr.server.domain; | 
				
			|||
@ -0,0 +1 @@ | 
				
			|||
package com.visual.open.anpr.server; | 
				
			|||
@ -0,0 +1,61 @@ | 
				
			|||
package com.visual.open.anpr.server.utils; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
import com.visual.open.anpr.server.domain.common.ResponseInfo; | 
				
			|||
 | 
				
			|||
public class ResponseBuilder { | 
				
			|||
 | 
				
			|||
	public static final Integer COMMON_SUCCESS_CODE = 0; | 
				
			|||
	public static final String COMMON_SUCCESS_INFO = "success"; | 
				
			|||
 | 
				
			|||
    public static final Integer COMMON_EXCEPTION_CODE = 1; | 
				
			|||
    public static final String COMMON_EXCEPTION_INFO = "exception"; | 
				
			|||
 | 
				
			|||
    public static final Integer COMMON_ERROR_CODE = 2; | 
				
			|||
    public static final String COMMON_ERROR_INFO = "error"; | 
				
			|||
     | 
				
			|||
	public static <T> ResponseInfo<T> success(){ | 
				
			|||
		return new ResponseInfo<>(COMMON_SUCCESS_CODE,COMMON_SUCCESS_INFO, null); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> success(T data){ | 
				
			|||
		return new ResponseInfo<>(COMMON_SUCCESS_CODE,COMMON_SUCCESS_INFO, data); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> error(){ | 
				
			|||
		return new ResponseInfo<>(COMMON_ERROR_CODE,COMMON_ERROR_INFO, null); | 
				
			|||
	} | 
				
			|||
 | 
				
			|||
	public static <T> ResponseInfo<T> error(String errorInfo){ | 
				
			|||
		return new ResponseInfo<>(COMMON_ERROR_CODE,errorInfo, null); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> error(T data){ | 
				
			|||
		return new ResponseInfo<>(COMMON_ERROR_CODE,COMMON_ERROR_INFO, data); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> error(T data, String errorInfo){ | 
				
			|||
		return new ResponseInfo<>(COMMON_ERROR_CODE,errorInfo, data); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> exception(){ | 
				
			|||
		return new ResponseInfo<>(COMMON_EXCEPTION_CODE, COMMON_EXCEPTION_INFO, null); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> exception(T data){ | 
				
			|||
		return new ResponseInfo<>(COMMON_EXCEPTION_CODE, COMMON_EXCEPTION_INFO, data); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> exception(Exception e){ | 
				
			|||
		return new ResponseInfo<>(COMMON_EXCEPTION_CODE, e.getMessage(), null); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> exception(Exception e, T data){ | 
				
			|||
		return new ResponseInfo<>(COMMON_EXCEPTION_CODE, e.getMessage(), data); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
	public static <T> ResponseInfo<T> exception(String info, T data){ | 
				
			|||
		return new ResponseInfo<>(COMMON_EXCEPTION_CODE, info, data); | 
				
			|||
	} | 
				
			|||
	 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,47 @@ | 
				
			|||
# 开发环境配置 | 
				
			|||
server: | 
				
			|||
  # 服务器的HTTP端口,默认为80 | 
				
			|||
  port: 8080 | 
				
			|||
  servlet: | 
				
			|||
    # 应用的访问路径 | 
				
			|||
    context-path: / | 
				
			|||
  tomcat: | 
				
			|||
    # tomcat的URI编码 | 
				
			|||
    uri-encoding: UTF-8 | 
				
			|||
    # tomcat最大线程数,默认为200 | 
				
			|||
    max-threads: 10 | 
				
			|||
    # Tomcat启动初始化的线程数,默认值25 | 
				
			|||
    min-spare-threads: 5 | 
				
			|||
  | 
				
			|||
# 日志配置 | 
				
			|||
logging: | 
				
			|||
  level: | 
				
			|||
    com.visual.open.anpr: info | 
				
			|||
    org.springframework: warn | 
				
			|||
 | 
				
			|||
# 模型配置 | 
				
			|||
visual: | 
				
			|||
  model: | 
				
			|||
    plateDetection: | 
				
			|||
      name: TorchPlateDetection | 
				
			|||
      modelPath: | 
				
			|||
      thread: 1 | 
				
			|||
    plateRecognition: | 
				
			|||
      name: TorchPlateRecognition | 
				
			|||
      modelPath: | 
				
			|||
      thread: 1 | 
				
			|||
  swagger: | 
				
			|||
    enable: true | 
				
			|||
 | 
				
			|||
# Spring配置 | 
				
			|||
spring: | 
				
			|||
  jackson: | 
				
			|||
    time-zone: GMT+8 | 
				
			|||
    date-format: yyyy-MM-dd HH:mm:ss | 
				
			|||
  # 文件上传 | 
				
			|||
  servlet: | 
				
			|||
     multipart: | 
				
			|||
       # 单个文件大小 | 
				
			|||
       max-file-size:  10MB | 
				
			|||
       # 设置总上传的文件大小 | 
				
			|||
       max-request-size:  20MB | 
				
			|||
@ -0,0 +1,47 @@ | 
				
			|||
# 开发环境配置 | 
				
			|||
server: | 
				
			|||
  # 服务器的HTTP端口,默认为80 | 
				
			|||
  port: 8080 | 
				
			|||
  servlet: | 
				
			|||
    # 应用的访问路径 | 
				
			|||
    context-path: / | 
				
			|||
  tomcat: | 
				
			|||
    # tomcat的URI编码 | 
				
			|||
    uri-encoding: UTF-8 | 
				
			|||
    # tomcat最大线程数,默认为200 | 
				
			|||
    max-threads: 80 | 
				
			|||
    # Tomcat启动初始化的线程数,默认值25 | 
				
			|||
    min-spare-threads: 30 | 
				
			|||
  | 
				
			|||
# 日志配置 | 
				
			|||
logging: | 
				
			|||
  level: | 
				
			|||
    com.visual.face.search: info | 
				
			|||
    org.springframework: warn | 
				
			|||
 | 
				
			|||
# 模型配置 | 
				
			|||
visual: | 
				
			|||
  model: | 
				
			|||
    plateDetection: | 
				
			|||
      name: ${VISUAL_MODEL_PLATE_DETECTION_NAME:TorchPlateDetection} | 
				
			|||
      modelPath: ${VISUAL_MODEL_PLATE_DETECTION_PATH:} | 
				
			|||
      thread: ${VISUAL_MODEL_PLATE_DETECTION_THREAD:4} | 
				
			|||
    plateRecognition: | 
				
			|||
      name: ${VISUAL_MODEL_PLATE_RECOGNITION_NAME:TorchPlateRecognition} | 
				
			|||
      modelPath: ${VISUAL_MODEL_PLATE_RECOGNITION_PATH:} | 
				
			|||
      thread: ${VISUAL_MODEL_PLATE_RECOGNITION_THREAD:4} | 
				
			|||
  swagger: | 
				
			|||
    enable: ${VISUAL_SWAGGER_ENABLE:true} | 
				
			|||
 | 
				
			|||
# Spring配置 | 
				
			|||
spring: | 
				
			|||
  jackson: | 
				
			|||
    time-zone: GMT+8 | 
				
			|||
    date-format: yyyy-MM-dd HH:mm:ss | 
				
			|||
  # 文件上传 | 
				
			|||
  servlet: | 
				
			|||
     multipart: | 
				
			|||
       # 单个文件大小 | 
				
			|||
       max-file-size:  10MB | 
				
			|||
       # 设置总上传的文件大小 | 
				
			|||
       max-request-size:  20MB | 
				
			|||
@ -0,0 +1,47 @@ | 
				
			|||
# 开发环境配置 | 
				
			|||
server: | 
				
			|||
  # 服务器的HTTP端口,默认为80 | 
				
			|||
  port: 8080 | 
				
			|||
  servlet: | 
				
			|||
    # 应用的访问路径 | 
				
			|||
    context-path: / | 
				
			|||
  tomcat: | 
				
			|||
    # tomcat的URI编码 | 
				
			|||
    uri-encoding: UTF-8 | 
				
			|||
    # tomcat最大线程数,默认为200 | 
				
			|||
    max-threads: 10 | 
				
			|||
    # Tomcat启动初始化的线程数,默认值25 | 
				
			|||
    min-spare-threads: 5 | 
				
			|||
 | 
				
			|||
# 日志配置 | 
				
			|||
logging: | 
				
			|||
  level: | 
				
			|||
    com.visual.open.anpr: info | 
				
			|||
    org.springframework: warn | 
				
			|||
 | 
				
			|||
# 模型配置 | 
				
			|||
visual: | 
				
			|||
  model: | 
				
			|||
    plateDetection: | 
				
			|||
      name: TorchPlateDetection | 
				
			|||
      modelPath: | 
				
			|||
      thread: 1 | 
				
			|||
    plateRecognition: | 
				
			|||
      name: TorchPlateRecognition | 
				
			|||
      modelPath: | 
				
			|||
      thread: 1 | 
				
			|||
  swagger: | 
				
			|||
    enable: true | 
				
			|||
 | 
				
			|||
# Spring配置 | 
				
			|||
spring: | 
				
			|||
  jackson: | 
				
			|||
    time-zone: GMT+8 | 
				
			|||
    date-format: yyyy-MM-dd HH:mm:ss | 
				
			|||
  # 文件上传 | 
				
			|||
  servlet: | 
				
			|||
    multipart: | 
				
			|||
      # 单个文件大小 | 
				
			|||
      max-file-size:  10MB | 
				
			|||
      # 设置总上传的文件大小 | 
				
			|||
      max-request-size:  20MB | 
				
			|||
@ -0,0 +1,8 @@ | 
				
			|||
spring: | 
				
			|||
  application: | 
				
			|||
    name: open-anpr | 
				
			|||
  mvc: | 
				
			|||
    pathmatch: | 
				
			|||
      matching-strategy: ant_path_matcher | 
				
			|||
  profiles: | 
				
			|||
    active: local | 
				
			|||
@ -0,0 +1,72 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8" ?> | 
				
			|||
<configuration> | 
				
			|||
    <!-- 控制台打印日志的相关配置 --> | 
				
			|||
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | 
				
			|||
        <!-- 日志格式 --> | 
				
			|||
        <encoder> | 
				
			|||
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%level] - %m%n</pattern> | 
				
			|||
        </encoder> | 
				
			|||
    </appender> | 
				
			|||
    <!-- 文件保存日志的相关配置 --> | 
				
			|||
    <appender name="INFO-OUT" class="ch.qos.logback.core.rolling.RollingFileAppender"> | 
				
			|||
        <!-- 保存日志文件的路径 --> | 
				
			|||
        <file>./logs/open-anpr-info.log</file> | 
				
			|||
        <!-- 日志格式 --> | 
				
			|||
        <encoder> | 
				
			|||
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%class:%line] - %m%n</pattern> | 
				
			|||
        </encoder> | 
				
			|||
 | 
				
			|||
        <!-- 循环政策:基于时间创建日志文件 --> | 
				
			|||
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | 
				
			|||
            <!-- 日志文件名格式 --> | 
				
			|||
            <fileNamePattern>./logs/open-anpr-info.%d{yyyy-MM-dd}.log</fileNamePattern> | 
				
			|||
            <!-- 最大保存时间:10天--> | 
				
			|||
            <maxHistory>7</maxHistory> | 
				
			|||
        </rollingPolicy> | 
				
			|||
    </appender> | 
				
			|||
 | 
				
			|||
    <appender name="ERROR-OUT" class="ch.qos.logback.core.rolling.RollingFileAppender"> | 
				
			|||
        <!-- 保存日志文件的路径 --> | 
				
			|||
        <file>./logs/open-anpr-error.log</file> | 
				
			|||
        <!-- 日志格式 --> | 
				
			|||
        <encoder> | 
				
			|||
            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%class:%line] - %m%n</pattern> | 
				
			|||
        </encoder> | 
				
			|||
        <!-- 日志级别过滤器 --> | 
				
			|||
        <filter class="ch.qos.logback.classic.filter.LevelFilter"> | 
				
			|||
            <!-- 过滤的级别 --> | 
				
			|||
            <level>ERROR</level> | 
				
			|||
            <!-- 匹配时的操作:接收(记录) --> | 
				
			|||
            <onMatch>ACCEPT</onMatch> | 
				
			|||
            <!-- 不匹配时的操作:拒绝(不记录) --> | 
				
			|||
            <onMismatch>DENY</onMismatch> | 
				
			|||
        </filter> | 
				
			|||
        <!-- 循环政策:基于时间创建日志文件 --> | 
				
			|||
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | 
				
			|||
            <!-- 日志文件名格式 --> | 
				
			|||
            <fileNamePattern>./logs/open-anpr-error.%d{yyyy-MM-dd}.log</fileNamePattern> | 
				
			|||
            <!-- 最大保存时间:10天--> | 
				
			|||
            <maxHistory>7</maxHistory> | 
				
			|||
        </rollingPolicy> | 
				
			|||
    </appender> | 
				
			|||
    <root level="INFO"> | 
				
			|||
        <appender-ref ref="STDOUT"/> | 
				
			|||
        <appender-ref ref="INFO-OUT"/> | 
				
			|||
        <appender-ref ref="ERROR-OUT" /> | 
				
			|||
    </root> | 
				
			|||
    <!-- 彩色日志 --> | 
				
			|||
    <!-- 彩色日志依赖的渲染类 --> | 
				
			|||
    <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> | 
				
			|||
    <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> | 
				
			|||
    <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> | 
				
			|||
    <!-- 彩色日志格式 --> | 
				
			|||
    <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" /> | 
				
			|||
    <!-- Console 输出设置 --> | 
				
			|||
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | 
				
			|||
        <encoder> | 
				
			|||
            <pattern>${CONSOLE_LOG_PATTERN}</pattern> | 
				
			|||
            <charset>utf8</charset> | 
				
			|||
        </encoder> | 
				
			|||
    </appender> | 
				
			|||
 | 
				
			|||
</configuration> | 
				
			|||
					Loading…
					
					
				
		Reference in new issue