Commit e80ee508 by zhangxk

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

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