Commit e80ee508 by zhangxk

修改车牌未识别时,设置为11111111

1 parent 366d81b8
......@@ -6,6 +6,7 @@ import com.viontech.model.BaseModel;
import com.viontech.model.BehaviorModel;
import com.viontech.utils.DateUtil;
import com.viontech.utils.IntUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
......@@ -119,11 +120,12 @@ public class BehaviorProcess implements Process {
JSONObject body = vehicle.getJSONObject("body");
if (plate != null) {
String text = plate.getString("text");
if (text != null && !"".equals(text)) {
if(StringUtils.isBlank(text) || StringUtils.equals(text,"无牌")){
text = "11111111";
}
byte[] bytes = text.getBytes(Charset.forName("GBK"));
System.arraycopy(bytes, 0, model.getLicensePlateText(), 0, Math.min(bytes.length, model.getLicensePlateText().length));
}
}
if (body != null) {
JSONObject type = body.getJSONObject("type");
JSONObject color = body.getJSONObject("color");
......
......@@ -7,6 +7,7 @@ import com.viontech.model.BaseModel;
import com.viontech.model.TrafficModel;
import com.viontech.utils.DateUtil;
import com.viontech.utils.IntUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
......@@ -146,7 +147,11 @@ public class TrafficProcess implements Process {
JSONObject plate = vehicle.getJSONObject("plate");
// ----------------- 车牌 ------------------
if (plate != null) {
byte[] text = plate.getString("text").getBytes(Charset.forName("GBK"));
String palteNum = plate.getString("text");
if(StringUtils.isBlank(palteNum) || StringUtils.equals(palteNum,"无牌")){
palteNum = "11111111";
}
byte[] text = palteNum.getBytes(Charset.forName("GBK"));
System.arraycopy(text, 0, model.getPlateText(), 0, Math.min(text.length, 16));
// todo 车牌类型待实现
model.setPlateType(1);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!