package com.zhgd.xmgl.task;

import com.alibaba.fastjson.JSONArray;
import com.zhgd.xmgl.modules.basicdata.api.image_ai.ImageApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @description: AI监控预警定时任务
 **/
@Slf4j
@Component
public class ImageAiTask {


    /**
     * ，每一个小时检查预警异常信息
     */
//    @Scheduled(cron = "0 0 * * * ?")
    private void safetyHelmet() {
        log.error("=========AI识别预警任务执行开始========");
        JSONArray jsonArray = ImageApi.safetyHelmet("rtsp://admin:jxj12345@10.0.77.104:554/Streaming/Channels/101");
        for (int i = 0; i < jsonArray.size(); i++) {
            String className = jsonArray.getJSONObject(i).getString("className");
            // TODO 出现问题进行AI报警数据上报
            if (className.contains("unsafe")) {

            }
        }
        log.error("=========AI识别预警任务执行结束========");
    }
}
