bug修复

This commit is contained in:
guo 2024-04-12 14:52:27 +08:00
parent b85aa415ee
commit e8a044b1de

View File

@ -219,22 +219,18 @@ public class HikvisionCall {
entity.setCarNumber(plateNo); entity.setCarNumber(plateNo);
entity.setType(getPassType(carCamera.getPassType())); entity.setType(getPassType(carCamera.getPassType()));
entity.setPassTime(time); entity.setPassTime(time);
Integer count = carPassRecordMapper.selectCount(new LambdaQueryWrapper<CarPassRecord>()
.eq(CarPassRecord::getCarNumber, plateNo)
.eq(CarPassRecord::getPassTime, time)
);
if (count != 0) {
continue;
}
try { try {
//车牌 //车牌
JSONObject picUrlJo = dataJo.getJSONObject("picUrl"); JSONObject picUrlJo = dataJo.getJSONObject("picUrl");
String svrIndex = dataJo.getString("svrIndex"); String svrIndex = dataJo.getString("svrIndex");
String vehiclePicUrl = picUrlJo.getString("vehiclePicUrl"); String vehiclePicUrl = picUrlJo.getString("vehiclePicUrl");
String platePicUrl = picUrlJo.getString("platePicUrl"); String platePicUrl = picUrlJo.getString("platePicUrl");
entity.setImageUrl(saveToLocal(getHikvisionEventsPicture(new HikvisionEventsPictureRq(svrIndex, platePicUrl), project.getArtemisConfigHost(), project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()))); if (StringUtils.isNotBlank(platePicUrl)) {
entity.setPanoramaUrl(saveToLocal(getHikvisionEventsPicture(new HikvisionEventsPictureRq(svrIndex, vehiclePicUrl), project.getArtemisConfigHost(), project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()))); entity.setImageUrl(saveToLocal(getHikvisionEventsPicture(new HikvisionEventsPictureRq(svrIndex, platePicUrl), project.getArtemisConfigHost(), project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret())));
}
if (StringUtils.isNotBlank(vehiclePicUrl)) {
entity.setPanoramaUrl(saveToLocal(getHikvisionEventsPicture(new HikvisionEventsPictureRq(svrIndex, vehiclePicUrl), project.getArtemisConfigHost(), project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret())));
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -254,7 +250,15 @@ public class HikvisionCall {
} else { } else {
entity.setIsOpen(0); entity.setIsOpen(0);
} }
carPassRecordMapper.insert(entity); LambdaQueryWrapper<CarPassRecord> queryWrapper = new LambdaQueryWrapper<CarPassRecord>()
.eq(CarPassRecord::getCarNumber, plateNo)
.eq(CarPassRecord::getPassTime, time);
Integer count = carPassRecordMapper.selectCount(queryWrapper);
if (count != 0) {
carPassRecordMapper.update(entity, queryWrapper);
} else {
carPassRecordMapper.insert(entity);
}
} }
} }
} }