
10 changed files with 167 additions and 3 deletions
@ -0,0 +1,19 @@ |
|||
package com.visual.open.anpr.server.controller.server.api; |
|||
|
|||
import com.visual.open.anpr.server.domain.common.ResponseInfo; |
|||
import com.visual.open.anpr.server.domain.request.PlateInfoReqVo; |
|||
import com.visual.open.anpr.server.domain.response.PlateInfoRepVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
public interface PlateControllerApi { |
|||
|
|||
/** |
|||
* 识别车牌信息 |
|||
* @param plateInfoReq |
|||
* @return |
|||
*/ |
|||
public ResponseInfo<List<PlateInfoRepVo>> recognition(PlateInfoReqVo plateInfoReq); |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.visual.open.anpr.server.controller.server.impl; |
|||
|
|||
import com.visual.open.anpr.server.controller.base.BaseController; |
|||
import com.visual.open.anpr.server.controller.server.api.PlateControllerApi; |
|||
import com.visual.open.anpr.server.domain.common.ResponseInfo; |
|||
import com.visual.open.anpr.server.domain.request.PlateInfoReqVo; |
|||
import com.visual.open.anpr.server.domain.response.PlateInfoRepVo; |
|||
import com.visual.open.anpr.server.service.api.PlateService; |
|||
import com.visual.open.anpr.server.utils.ResponseBuilder; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
|
|||
import java.util.List; |
|||
|
|||
public class PlateControllerImpl extends BaseController implements PlateControllerApi { |
|||
|
|||
@Autowired |
|||
private PlateService plateService; |
|||
|
|||
@Override |
|||
public ResponseInfo<List<PlateInfoRepVo>> recognition(PlateInfoReqVo plateInfoReq) { |
|||
try { |
|||
return ResponseBuilder.success(plateService.recognition(plateInfoReq)); |
|||
}catch (Exception e){ |
|||
logger.error("plate recognition exception:", e); |
|||
return ResponseBuilder.exception(e.getMessage(), null); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1 @@ |
|||
package com.visual.open.anpr.server.controller.server; |
@ -0,0 +1,26 @@ |
|||
package com.visual.open.anpr.server.controller.server.restful; |
|||
|
|||
import com.visual.open.anpr.server.controller.server.impl.PlateControllerImpl; |
|||
import com.visual.open.anpr.server.domain.common.ResponseInfo; |
|||
import com.visual.open.anpr.server.domain.request.PlateInfoReqVo; |
|||
import com.visual.open.anpr.server.domain.response.PlateInfoRepVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
@Api(tags="01、车牌识别服务") |
|||
@RestController("visualPlateController") |
|||
@RequestMapping("/visual/plate") |
|||
public class PlateController extends PlateControllerImpl { |
|||
|
|||
@ApiOperation(value="1、车牌识别", position = 1) |
|||
@Override |
|||
@ResponseBody |
|||
@RequestMapping(value = "/recognition", method = RequestMethod.POST) |
|||
public ResponseInfo<List<PlateInfoRepVo>> recognition(@RequestBody @Valid PlateInfoReqVo plateInfoReq) { |
|||
return super.recognition(plateInfoReq); |
|||
} |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.visual.open.anpr.server.domain.request; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import org.hibernate.validator.constraints.Range; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
@ApiModel(value = "PlateInfoReqVo", description="车牌识别参数") |
|||
public class PlateInfoReqVo implements Serializable { |
|||
|
|||
/**图像Base64编码值**/ |
|||
@NotNull(message = "image cannot be empty") |
|||
@ApiModelProperty(value="图像Base64编码值", position = 1,required = true) |
|||
private String image; |
|||
|
|||
/**搜索条数:默认5**/ |
|||
@Min(value = 0, message = "limit must greater than or equal to 0") |
|||
@ApiModelProperty(value="最大搜索条数:默认5", position = 3, required = false) |
|||
private Integer limit = 5; |
|||
|
|||
public String getImage() { |
|||
return image; |
|||
} |
|||
|
|||
public void setImage(String image) { |
|||
this.image = image; |
|||
} |
|||
|
|||
public Integer getLimit() { |
|||
return limit; |
|||
} |
|||
|
|||
public void setLimit(Integer limit) { |
|||
this.limit = limit; |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
package com.visual.open.anpr.server.domain.response; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
public class PlateInfoRepVo implements Serializable { |
|||
|
|||
|
|||
} |
@ -1,5 +1,17 @@ |
|||
package com.visual.open.anpr.server.service.api; |
|||
|
|||
import com.visual.open.anpr.server.domain.request.PlateInfoReqVo; |
|||
import com.visual.open.anpr.server.domain.response.PlateInfoRepVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface PlateService { |
|||
|
|||
/** |
|||
* 识别车牌信息 |
|||
* @param plateInfoReq |
|||
* @return |
|||
*/ |
|||
public List<PlateInfoRepVo> recognition(PlateInfoReqVo plateInfoReq); |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue