| | |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mashape.unirest.http.HttpResponse; |
| | | import com.mashape.unirest.http.Unirest; |
| | | import com.mashape.unirest.http.exceptions.UnirestException; |
| | | import com.ruoyi.aibrain.domain.AiAlarmInfo; |
| | | import com.ruoyi.aibrain.domain.AiCamera; |
| | | import com.ruoyi.aibrain.service.IAiAlarmInfoService; |
| | | import com.ruoyi.aibrain.service.IAiCameraService; |
| | | import com.ruoyi.camera.domain.CameraShipingsb; |
| | | import com.ruoyi.camera.service.ICameraShipingsbService; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | |
| | | private static IAiCameraService aiCameraService; |
| | | private static ICameraShipingsbService cameraShipingsbService; |
| | | private static ITbDataSendRecordsService tbDataSendRecordsService; |
| | | private static IAiAlarmInfoService aiAlarmInfoService; |
| | | private static RedisCache redisCache; |
| | | |
| | | private static String SJURL="https://192.168.100.89:4200/spjr000/api/open/v1"; //省级请求地址 |
| | |
| | | aiCameraService = SpringUtils.getBean(IAiCameraService.class); |
| | | cameraShipingsbService = SpringUtils.getBean(ICameraShipingsbService.class); |
| | | tbDataSendRecordsService = SpringUtils.getBean(ITbDataSendRecordsService.class); |
| | | aiAlarmInfoService = SpringUtils.getBean(IAiAlarmInfoService.class); |
| | | redisCache = SpringUtils.getBean(RedisCache.class); |
| | | } |
| | | |
| | |
| | | //6.马头门罐笼摇台状态识别信息 |
| | | //7.摄像头遮挡、挪动角度识别信息 |
| | | public static void cameraAiError() throws ParseException { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | //查询出所以未传输的报警 |
| | | Collection<String> keys = redisCache.keys("video_*"); |
| | | for (String key : keys) { |
| | |
| | | cameraShipingsb.setFileUrl(errObj.getString("recordFileName"));//识别视频存储地址 |
| | | cameraShipingsb.setShuJuSJ(warningTime);//数据时间 |
| | | cameraShipingsbService.insertCameraShipingsb(cameraShipingsb); |
| | | |
| | | |
| | | //生成报警信息 |
| | | AiAlarmInfo aiAlarmInfo=new AiAlarmInfo(); |
| | | aiAlarmInfo.setCameraId(aiCamera.getId());//报警设备id |
| | | aiAlarmInfo.setCameraName(aiCamera.getName());//报警设备 |
| | | aiAlarmInfo.setRegion(aiCamera.getRegion());//报警区域 |
| | | aiAlarmInfo.setRegionName(aiCamera.getRegionName());//区域名称 |
| | | aiAlarmInfo.setRuleId(1L);//算法 |
| | | aiAlarmInfo.setRegionName(shiBieLXMC+"-AI智能分析");//算法名称 |
| | | aiAlarmInfo.setContent(shiBieLXMC);//报警内容 |
| | | aiAlarmInfo.setSmallClass("1");//报警类型 |
| | | aiAlarmInfo.setVideo(errObj.getString("recordFileName").replaceAll("D:/AI/aibrain/","/profile/"));//报警视频 |
| | | aiAlarmInfo.setPicture(errObj.getString("recordImgFileName").replaceAll("D:/AI/aibrain/","/profile/"));//报警图片 |
| | | aiAlarmInfo.setAlarmTime(warningTime);//报警时间 |
| | | aiAlarmInfo.setDealWith("0");//是否处理(0未处理,1已处理) |
| | | aiAlarmInfoService.insertAiAlarmInfo(aiAlarmInfo); |
| | | |
| | | |
| | | JSONObject objCS=new JSONObject(); |
| | | objCS.put("type","AI分析"); |
| | |
| | | .sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]) |
| | | .hostnameVerifier((hostname, session) -> true) // 信任所有主机名 |
| | | .build(); |
| | | String fileUrl=paramJson.getString("file"); |
| | | String fileUrlQ=paramJson.getString("file"); |
| | | String fileUrl=fileUrlQ.replaceAll("/","\\\\"); |
| | | File file = new File(fileUrl); |
| | | //fileUrl.split("\\"); |
| | | |
| | | //fileUrl.split("\\");SSS |
| | | String[] fileName=fileUrl.split("\\\\"); |
| | | |
| | | String fileNameQ=fileName[fileName.length-1]; |
| | | |
| | | RequestBody body = new MultipartBody.Builder() |
| | | .setType(MultipartBody.FORM) |
| | |
| | | .addFormDataPart("pdt", params.get("pdt")) |
| | | .addFormDataPart("data", params.get("data")) |
| | | |
| | | .addFormDataPart("file", fileName[fileName.length-1], |
| | | .addFormDataPart("file", fileNameQ, |
| | | RequestBody.create(MediaType.parse("application/octet-stream"), |
| | | file)) |
| | | .build(); |