提交修改
This commit is contained in:
parent
f0089f6f31
commit
e1c86fe309
@ -1,13 +1,14 @@
|
||||
package com.heyu.api.baidu.handle.traffic;
|
||||
|
||||
|
||||
import com.heyu.api.data.annotation.CustomPath;
|
||||
import com.heyu.api.baidu.BaiduBaseHandle;
|
||||
import com.heyu.api.baidu.request.traffic.BRoadTransportCertificateRequest;
|
||||
import com.heyu.api.baidu.response.traffic.BRoadTransportCertificateResp;
|
||||
import com.heyu.api.data.annotation.CustomPath;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* https://console.bce.baidu.com/support/?_=1740411162437×tamp=1740413029871#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E4%BA%A4%E9%80%9A%E5%9C%BA%E6%99%AFOCR&api=rest%2F2.0%2Focr%2Fv1%2Froad_transport_certificate&method=post
|
||||
@ -18,7 +19,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@Slf4j
|
||||
@CustomPath("roadTransportCertificate")
|
||||
public class BRoadTransportCertificateHandle extends BaiduBaseHandle<BRoadTransportCertificateRequest, BRoadTransportCertificateResp> {
|
||||
public class BRoadTransportCertificateHandle extends BaiduBaseHandle<BRoadTransportCertificateRequest, Map> {
|
||||
|
||||
@Override
|
||||
public String getUri() {
|
||||
|
||||
@ -71,6 +71,11 @@ public class BLicensePlateResp extends BBaseResp {
|
||||
private String number;
|
||||
@JsonProperty("probability")
|
||||
private List<Double> probability;
|
||||
@JsonProperty("cover_info")
|
||||
private String coverInfo;
|
||||
@JsonProperty("edit_tool")
|
||||
private String editTool;
|
||||
|
||||
@JsonProperty("vertexes_location")
|
||||
private List<VertexesLocationDTO> vertexesLocation;
|
||||
|
||||
|
||||
@ -25,6 +25,17 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* 驾驶证识别能力可以识别驾驶证首页和副页关键字段内容,包括:档案编号、姓名、有效期时长、性别、发证日期、驾驶证号、驾驶证准驾车型、有效期开始时间、地址,共 9 个关键字段信息。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* https://console.bce.baidu.com/support/?_=1740219852952×tamp=1740325062124#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E4%BA%A4%E9%80%9A%E5%9C%BA%E6%99%AFOCR&api=rest%2F2.0%2Focr%2Fv1%2Fdriving_license&method=post
|
||||
*
|
||||
*
|
||||
* 驾驶证识别
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -37,6 +48,10 @@ public class RecognizeDriverLicenseController extends BaseController {
|
||||
private ARecognizeDriverLicenseHandle aRecognizeDriverLicenseHandle;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
public R recognize(ARecognizeDriverLicenseRequest request) {
|
||||
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
package com.heyu.api.controller.traffic;
|
||||
|
||||
import com.heyu.api.baidu.handle.traffic.BLicensePlateHandle;
|
||||
import com.heyu.api.baidu.request.traffic.BLicensePlateRequest;
|
||||
import com.heyu.api.baidu.response.traffic.BLicensePlateResp;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.traffic.LicensePlateResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* https://console.bce.baidu.com/support/?_=1740219852952×tamp=1740325926517#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E4%BA%A4%E9%80%9A%E5%9C%BA%E6%99%AFOCR&api=rest%2F2.0%2Focr%2Fv1%2Flicense_plate&method=post
|
||||
* <p>
|
||||
* 车牌识别
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持识别中国大陆机动车蓝牌、黄牌(单双行)、绿牌、大型新能源(黄绿)、领使馆车牌、警牌、武警牌(单双行)、军牌(单双行)、港澳出入境车牌、
|
||||
* 农用车牌、民航车牌、非机动车车牌(北京地区)的地域编号和车牌号,并能同时识别图像中的多张车牌。
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/license/plate")
|
||||
@NotIntercept
|
||||
public class LicensePlateController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BLicensePlateHandle bLicensePlateHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BLicensePlateRequest request) {
|
||||
|
||||
List<LicensePlateResp> respList = new ArrayList<>();
|
||||
|
||||
|
||||
ApiR<BLicensePlateResp> bR = bLicensePlateHandle.handle(request);
|
||||
if (bR.isSuccess()) {
|
||||
BLicensePlateResp bLicensePlateResp = bR.getData();
|
||||
List<BLicensePlateResp.WordsResultDTO> wordsResultDTOS = bLicensePlateResp.getWordsResult();
|
||||
for (BLicensePlateResp.WordsResultDTO wordsResultDTO : wordsResultDTOS) {
|
||||
LicensePlateResp licensePlateResp = new LicensePlateResp();
|
||||
|
||||
licensePlateResp.setColor(wordsResultDTO.getColor());
|
||||
licensePlateResp.setProbability(wordsResultDTO.getProbability());
|
||||
licensePlateResp.setCoverInfo(wordsResultDTO.getCoverInfo());
|
||||
licensePlateResp.setNumber(wordsResultDTO.getNumber());
|
||||
licensePlateResp.setEditTool(wordsResultDTO.getEditTool());
|
||||
|
||||
|
||||
List<BLicensePlateResp.WordsResultDTO.VertexesLocationDTO> vertexesLocationDTOS = wordsResultDTO.getVertexesLocation();
|
||||
if (CollectionUtils.isNotEmpty(vertexesLocationDTOS)) {
|
||||
List<LicensePlateResp.VertexesLocationDTO> vertexesLocationDTOS1 = new ArrayList<>();
|
||||
for (BLicensePlateResp.WordsResultDTO.VertexesLocationDTO vertexesLocationDTO : vertexesLocationDTOS) {
|
||||
LicensePlateResp.VertexesLocationDTO locationDTO = new LicensePlateResp.VertexesLocationDTO();
|
||||
locationDTO.setX(vertexesLocationDTO.getX());
|
||||
locationDTO.setY(vertexesLocationDTO.getY());
|
||||
vertexesLocationDTOS1.add(locationDTO);
|
||||
|
||||
}
|
||||
licensePlateResp.setVertexesLocation(vertexesLocationDTOS1);
|
||||
}
|
||||
|
||||
respList.add(licensePlateResp);
|
||||
}
|
||||
|
||||
return R.ok().setData(respList);
|
||||
|
||||
}
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.heyu.api.controller.traffic;
|
||||
|
||||
import com.heyu.api.baidu.handle.traffic.BRoadTransportCertificateHandle;
|
||||
import com.heyu.api.baidu.request.traffic.BRoadTransportCertificateRequest;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.MapUtils;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.resp.traffic.RoadTransportCertificateResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* https://console.bce.baidu.com/support/?_=1740411162437×tamp=1740413029871#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E4%BA%A4%E9%80%9A%E5%9C%BA%E6%99%AFOCR&api=rest%2F2.0%2Focr%2Fv1%2Froad_transport_certificate&method=post
|
||||
* <p>
|
||||
* <p>
|
||||
* 道路运输证识别
|
||||
*
|
||||
*接口描述
|
||||
* 结构化识别道路运输证的业户名称、地址、车辆号牌、经营许可证、经济类型、车辆类型、吨座位、车辆规格、经营范围、初领日期、备注、发证日期、道路运输证号等15个关键字段,支持识别横版及竖版两种道路运输证
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/road/transport")
|
||||
@NotIntercept
|
||||
public class RoadTransportCertificateController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BRoadTransportCertificateHandle bRoadTransportCertificateHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BRoadTransportCertificateRequest request) {
|
||||
|
||||
RoadTransportCertificateResp resp = new RoadTransportCertificateResp();
|
||||
|
||||
ApiR<Map> bR = bRoadTransportCertificateHandle.handle(request);
|
||||
|
||||
if (bR.isSuccess()) {
|
||||
Map<String, Object> data = bR.getData();
|
||||
|
||||
resp.setRoadTransportLicenseNumber(MapUtils.getByExpr(data, "words_result.道路运输证号.[0].word")); // 道路运输证号
|
||||
resp.setVehicleLicensePlate(MapUtils.getByExpr(data, "words_result.车辆号牌.[0].word")); // 车辆号牌
|
||||
resp.setEconomicType(MapUtils.getByExpr(data, "words_result.经济类型.[0].word")); //经济类型
|
||||
resp.setBusinessScope(MapUtils.getByExpr(data, "words_result.经营范围.[0].word")); // 经营范围
|
||||
resp.setVehicleType(MapUtils.getByExpr(data, "words_result.车辆类型.[0].word")); //车辆类型
|
||||
resp.setTonsOfSeats(MapUtils.getByExpr(data, "words_result.吨座位.[0].word")); // 吨座位
|
||||
resp.setRemark(MapUtils.getByExpr(data, "words_result.备注.[0].word"));//备注
|
||||
resp.setBusinessLicense(MapUtils.getByExpr(data, "words_result.经营许可证.[0].word")); // 经营许可证
|
||||
resp.setVehicleMMH(MapUtils.getByExpr(data, "words_result.车辆毫米_高.[0].word")); // 车辆毫米_高
|
||||
resp.setVehicleMMWidth(MapUtils.getByExpr(data, "words_result.车辆毫米_宽.[0].word"));//车辆毫米_宽
|
||||
resp.setCertificateIssuanceDate(MapUtils.getByExpr(data, "words_result.发证日期.[0].word")); // 发证日期
|
||||
resp.setAddress(MapUtils.getByExpr(data, "words_result.地址.[0].word"));//地址
|
||||
resp.setVehicleMMLength(MapUtils.getByExpr(data, "words_result.车辆毫米_长.[0].word"));// 车辆毫米_长
|
||||
resp.setBusinessAccountName(MapUtils.getByExpr(data, "words_result.业户名称.[0].word")); // 业户名称
|
||||
resp.setFirstDate(MapUtils.getByExpr(data, "words_result.初领日期.[0].word")); // 初领日期
|
||||
|
||||
return R.ok().setData(resp);
|
||||
|
||||
}
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.heyu.api.resp.traffic;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class LicensePlateResp extends BaseResp {
|
||||
|
||||
|
||||
|
||||
private String color; // 车牌颜色:支持blue、green、yellow、white、black、yellow_green(新能源大型汽车黄绿车牌)、unknow(未知颜色)、penyin(大货车喷印车牌)
|
||||
private String number; // 车牌号码
|
||||
private List<Double> probability; //7个数字分别为车牌中每个字符的置信度(从左往右),区间为0-1,如需平均置信度,将全部数值相加,计算平均值即可
|
||||
private List<VertexesLocationDTO> vertexesLocation;
|
||||
/***
|
||||
* 判断车牌有没有被遮挡,当 detect_complete=true 时生效;
|
||||
* - incomplete:没有被遮挡;
|
||||
* - complete:被遮挡
|
||||
*/
|
||||
private String coverInfo;
|
||||
/***
|
||||
* 判断车牌有没有被遮挡,当 detect_risk=true 时生效;如果检测车牌被编辑过,该字段指定编辑软件名称,如:Adobe Photoshop CC 2014 (Macintosh),如果没有被编辑过则返回值为空
|
||||
*/
|
||||
private String editTool;
|
||||
|
||||
@Data
|
||||
public static class VertexesLocationDTO {
|
||||
private Integer x; // 水平坐标(坐标0点为左上角)
|
||||
private Integer y; //垂直坐标(坐标0点为左上角)
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.heyu.api.resp.traffic;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoadTransportCertificateResp extends BaseResp {
|
||||
|
||||
|
||||
private String roadTransportLicenseNumber; // 道路运输证号
|
||||
private String vehicleLicensePlate; // 车辆号牌
|
||||
private String economicType; //经济类型
|
||||
private String businessScope; // 经营范围
|
||||
private String vehicleType; //车辆类型
|
||||
private String tonsOfSeats; // 吨座位
|
||||
private String remark;//备注
|
||||
private String businessLicense; // 经营许可证
|
||||
private String vehicleMMH; // 车辆毫米_高
|
||||
private String vehicleMMWidth;//车辆毫米_宽
|
||||
private String certificateIssuanceDate; // 发证日期
|
||||
private String address;//地址
|
||||
private String vehicleMMLength;// 车辆毫米_长
|
||||
private String businessAccountName; // 业户名称
|
||||
private String firstDate; // 初领日期
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user