|
@@ -7,6 +7,7 @@ import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.util.RandomUtil;
|
|
import cn.hutool.core.util.RandomUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
|
+import com.gzlh.bus.ChannelCacheManager;
|
|
import com.gzlh.bus.SysConfig;
|
|
import com.gzlh.bus.SysConfig;
|
|
import com.gzlh.config.SystemObject;
|
|
import com.gzlh.config.SystemObject;
|
|
import com.gzlh.config.dto.ChannelSetting;
|
|
import com.gzlh.config.dto.ChannelSetting;
|
|
@@ -36,25 +37,22 @@ import java.util.Date;
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
public class AlarmParseService {
|
|
public class AlarmParseService {
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
- @Lazy
|
|
|
|
- private HkUtils hkUtils;
|
|
|
|
- @Resource
|
|
|
|
- @Lazy
|
|
|
|
- private HCNetSDK hcNetSDK;
|
|
|
|
- @Resource
|
|
|
|
- @Lazy
|
|
|
|
- private FilePropertiesConfig filePropertiesConfig;
|
|
|
|
- @Resource
|
|
|
|
TaskService taskService;
|
|
TaskService taskService;
|
|
|
|
|
|
|
|
+ public static final TimedCache<String, Integer> CACHE_MAP = CacheUtil.newTimedCache(2000);
|
|
|
|
+
|
|
|
|
|
|
- public static final TimedCache<String, Integer> CACHE_MAP = CacheUtil.newTimedCache(5000);
|
|
|
|
|
|
|
|
public void alarmDataHandle(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
|
|
public void alarmDataHandle(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
|
|
//lCommand是传的报警类型
|
|
//lCommand是传的报警类型
|
|
String separator=File.separator;
|
|
String separator=File.separator;
|
|
if (lCommand == HCNetSDK.COMM_ITS_PLATE_RESULT) {//交通抓拍结果(新报警信息)
|
|
if (lCommand == HCNetSDK.COMM_ITS_PLATE_RESULT) {//交通抓拍结果(新报警信息)
|
|
|
|
+ if (!ChannelCacheManager.stateEnable(SysConfig.channelSetting.getChannelCode())){
|
|
|
|
+ log.error("通道已停用=======");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
HCNetSDK.NET_ITS_PLATE_RESULT strItsPlateResult = new HCNetSDK.NET_ITS_PLATE_RESULT();
|
|
HCNetSDK.NET_ITS_PLATE_RESULT strItsPlateResult = new HCNetSDK.NET_ITS_PLATE_RESULT();
|
|
strItsPlateResult.write();
|
|
strItsPlateResult.write();
|
|
Pointer pItsPlateInfo = strItsPlateResult.getPointer();
|
|
Pointer pItsPlateInfo = strItsPlateResult.getPointer();
|
|
@@ -63,22 +61,28 @@ public class AlarmParseService {
|
|
String sLicense;
|
|
String sLicense;
|
|
try {
|
|
try {
|
|
sLicense = new String(strItsPlateResult.struPlateInfo.sLicense, "GBK");
|
|
sLicense = new String(strItsPlateResult.struPlateInfo.sLicense, "GBK");
|
|
|
|
+ if (StrUtil.isEmpty(sLicense)){
|
|
|
|
+ log.error("上传车牌为空--------------------");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (CACHE_MAP.get(sLicense)!=null){
|
|
|
|
+ log.error("重复识别--------------------:{}",sLicense);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ CACHE_MAP.put(sLicense,1);
|
|
} catch (UnsupportedEncodingException e) {
|
|
} catch (UnsupportedEncodingException e) {
|
|
log.error("上传车牌为空:{}", e.getMessage());
|
|
log.error("上传车牌为空:{}", e.getMessage());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// int color = strItsPlateResult.struPlateInfo.byColor;
|
|
// int color = strItsPlateResult.struPlateInfo.byColor;
|
|
// byte VehicleType = strItsPlateResult.byVehicleType; //0-其他车辆,1-小型车,2-大型车,3- 行人触发,4- 二轮车触发,5- 三轮车触发,6- 机动车触发
|
|
// byte VehicleType = strItsPlateResult.byVehicleType; //0-其他车辆,1-小型车,2-大型车,3- 行人触发,4- 二轮车触发,5- 三轮车触发,6- 机动车触发
|
|
-// log.info("车牌号:{} ;车辆类型:{}", sLicense, VehicleType);
|
|
|
|
|
|
+ log.info("车牌号:{}", sLicense);
|
|
sLicense = StrUtil.trim(StrUtil.sub(sLicense, 1, -1));
|
|
sLicense = StrUtil.trim(StrUtil.sub(sLicense, 1, -1));
|
|
if (StrUtil.isEmpty(sLicense)||StrUtil.equals("车牌",sLicense)){
|
|
if (StrUtil.isEmpty(sLicense)||StrUtil.equals("车牌",sLicense)){
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (CACHE_MAP.get(sLicense) != null) {
|
|
|
|
-// log.error("重复上传:{}", sLicense);
|
|
|
|
- return;
|
|
|
|
|
|
+ // return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
// hkUtils.handlerUp(hcNetSDK, pAlarmer.lUserID);
|
|
// hkUtils.handlerUp(hcNetSDK, pAlarmer.lUserID);
|
|
Date nowTime=new Date();
|
|
Date nowTime=new Date();
|
|
/**
|
|
/**
|
|
@@ -116,7 +120,7 @@ public class AlarmParseService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- CACHE_MAP.put(sLicense, 1);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|