Commit a4f32ce4 authored by wangjinjing's avatar wangjinjing

发布版本

parent dcfe46f1
package com.snapshot.task.Service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.snapshot.task.bean.GoalStructureParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.Map;
@Service
public class TaskRecog {
private static final Logger logger = LoggerFactory.getLogger(TaskRecog.class);
@Value("${file.recogurl}")
String recogurl;
@Autowired
RestTemplate restTemplate;
public void getRecog(GoalStructureParam param){
String maprecogdata = restTemplate.postForObject(recogurl, param, String.class);
try {
List<Map> resultList = new ObjectMapper().readValue(maprecogdata, List.class);
//遍历所有返回结果
for(Map result:resultList) {
// if (null != result.get("ret") && result.get("ret").equals("200")) {
// //变成为已分析
// transferRecord.setProcessstatus("-1");
// traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord);
// String recordtype = taskinfo.getRecordtype();
// JobTjParam jobTjParam = new JobTjParam();
// jobTjParam.setDeviceId(devicecode);
// jobTjParam.setDetectType(recordtype);
// String imageurl = transferRecord.getImg1path();
// List<Map> points = new ArrayList<>();
// //分析结果数据
// List<Map> objectresult = (List<Map>) result.get("ObjectList");
// if (objectresult.size() < 1) {
// logger.info(" objectresult is empty");
// continue;
// }
// //获得点位
// logger.info("获得点位");
// TraffpictureParam traffpictureParamresult = new TraffpictureParam();
// traffpictureParamresult = eventWriteService.getResult(traffpictureParamresult, Integer.parseInt(taskinfo.getMetatype())
// , roiarray, imageurl, objectresult, jobTjParam, points);
// if (null == traffpictureParamresult) {
// logger.info("人群密度未超或目标未出现");
// continue;
// }
// eventWriteService.setTraffpictureParam(recordtype, devicecode,
// transferRecord.getCreatetime(),
// traffpictureParamresult);
// //图片划线并上传
// logger.info("图片划线并上传");
// String basepath = DateUtils.formatCurrDayYM() +
// File.separator + DateUtils.formatCurrDayDD() + File.separator +
// devicecode;
// String filename = devicecode + "_" + DateUtils.parseDateToStrNoSign(transferRecord.getRecordtime()) + "_" + recordtype + "_result.jpg";
// eventWriteService.uploadPicture(traffpictureParamresult, transferRecord.getImg1urlfrom(), points, basepath, filename);
// String filenameurl = File.separator + outpath + File.separator + basepath + File.separator + filename;
// jobTjParam.setImageUrl(weburl + filenameurl);
// logger.info("file path:{}", filenameurl);
// traffpictureParamresult.setImagedata(filenameurl);
// traffpictureParamresult.setProcessstatus("-1");
// traffPictureService.updateTraffpicture(traffpictureParamresult);
//
// //回调
// logger.info("send to dianxin data:{}", jobTjParam.toString());
// eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("") ? callbackurl : taskinfo.getUrl());
//
// if (unionId.contains(devicecode)) {
// VoiceData voicedata = new VoiceData();
// voicedata.setAppKey(appKey);
// voicedata.setCorpId(corpId);
// Voice voice = new Voice();
// voice.setEventId(eventId);
// voice.setUnionId(unionId);
// voicedata.setRequestData(voice);
// // logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata));
// eventWriteService.sendVoice(voicedata);
// }
// //推送告警到前端
// webSocket.GroupSending(new ObjectMapper().writeValueAsString(traffpictureParamresult));
// }
}
} catch (Exception ex) {
logger.error(ex.toString());
}
//其他数据如表
//getMetaData( objectresult );
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment