package cn.cecep.talroad.service.impl.analysis;

import cn.cecep.talroad.common.core.utils.DateUtils;
import cn.cecep.talroad.common.core.utils.StringUtils;
import cn.cecep.talroad.domain.*;
import cn.cecep.talroad.domain.analysis.SRaHandworkEmissionsGas;
import cn.cecep.talroad.domain.analysis.SRaOnlineEmissionsGas;
import cn.cecep.talroad.enums.ProblemTypeEnum;
import cn.cecep.talroad.enums.TimeTypeEnum;
import cn.cecep.talroad.mapper.*;
import cn.cecep.talroad.mapper.analysis.SRaHandworkEmissionsGasMapper;
import cn.cecep.talroad.mapper.analysis.SRaHandworkEmissionsWaterMapper;
import cn.cecep.talroad.mapper.analysis.SRaOnlineEmissionsGasMapper;
import cn.cecep.talroad.mapper.analysis.SRaOnlineEmissionsWaterMapper;
import cn.cecep.talroad.service.*;
import cn.cecep.talroad.service.analysis.IConcentrationMathService;
import cn.cecep.talroad.util.ConcentrationConstants;
import cn.cecep.talroad.util.EmissionsConstants;
import cn.cecep.talroad.util.EmissionsUtils;
import cn.cecep.talroad.vo.analysis.*;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.time.ZoneId;
import java.util.*;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;


/**
 * 浓度计算实现类
 */
@Service
@Slf4j
public class ConcentrationMathServiceImpl implements IConcentrationMathService {
    @Resource
    private PcFactoryMapper factoryMapper;
    @Resource
    private PcOutletMapper pcOutletMapper;
    @Resource
    private BMainPollDisGasMoutMapper mainPollDisGasMoutMapper;
    @Resource
    private BMainPollDisGasOoutMapper mainPollDisGasOoutMapper;
    @Resource
    private SRaOnlineEmissionsGasMapper sRaOnlineEmissionsGasMapper;
    @Resource
    private SEnvGasMonRealMapper sEnvGasMonRealMapper;
    @Resource
    private ISEnvGasMonHourService isEnvGasMonHourService;
    @Resource
    private ISEnvWaterMonDayService isEnvWaterMonDayService;
    @Resource
    private SRaHandworkEmissionsGasMapper handworkEmissionsGasMapper;
    @Resource
    private ISEnvWaterMonHourService isEnvWaterMonHourSerice;
    @Resource
    private IAmProblemFiService amProblemFiService;
    @Resource
    private BMainPollDisWaterMoutMapper mainPollDisWaterMoutMapper;
    @Resource
    private BMainPollDisWaterOoutMapper mainPollDisWaterOoutMapper;
    @Autowired
    private ISEnvGasRealService envGasRealService;
    @Autowired
    private IPcFactoryPollutantService pcFactoryPollutantService;
    @Autowired
    private IPcPollutantService pcPollutantService;
    @Autowired
    private IBMainProductionInorgGasService ibMainProductionInorgGasService;

    @Autowired
    private ConcentrationConstants concentrationConstants;

    @Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;


    @Autowired
            private IPcOutletService pcOutletService;
    /**
     * 全局的报警信息数据集合
     * 当一次排放量小时计算完毕后，就批量将该数组内的数据更新进去；
     * 分钟的浓度预警计算完毕后 也会使用该数组进行批量更新；
     */
    List<AmProblemFi> batchDataList = new CopyOnWriteArrayList();

    Map<String,PcOutlet> outletStatusMap = new ConcurrentHashMap<>();

    /**
     * 大气浓度超标
     */
    @Override
    @Deprecated
    public void doGasPollutantHourConcentration(String mathDate) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        //获取全部排污许可期限内的企业
        List<PermitEmissionsFactoryVO> permitEmissionsFactoryVOS;
        //查询所有排口信息
        Map<String ,List<PcOutlet>> pcOutletMap = new ConcurrentHashMap<>();
        //查询当前小时数据
        List<SEnvGasMonHour> gasRealList;
        //初始化排污许可企业数据，规定排口容器的长度
        permitEmissionsFactoryVOS= factoryMapper.selectPermitEmissionsFactoryList();
        if(permitEmissionsFactoryVOS == null && permitEmissionsFactoryVOS.size() == 0){
            log.info("没有查询到企业，终止任务");
        }
        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            pcOutletMap.put(permitEmissionsFactoryVO.getFactoryId(),new ArrayList<>());
        }
        List<PcOutlet> ListOutlet = pcOutletMapper.selectPermitOutletList("1","1");
        if(ListOutlet == null && ListOutlet.size() == 0){
            log.info("没有查询到排口，终止任务");
        }
        //只有排污许可企业下的排口才会被统计
        for (PcOutlet pcOutlet : ListOutlet) {
            if (pcOutletMap.containsKey(pcOutlet.getFactoryId())) {
                pcOutletMap.get(pcOutlet.getFactoryId()).add(pcOutlet);
            }
        }
        //查询最新小时数据
        LocalDateTime date = LocalDateTime.now().minus(1, ChronoUnit.HOURS);
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00:00");
        String dateStr = date.format(dateTimeFormatter);

        QueryWrapper<SEnvGasMonHour> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("monitoring_time",dateStr);
        queryWrapper.eq("data_type",TimeTypeEnum.HOUR.getCode());
        queryWrapper.and(wp->{
            wp.isNull("data_flag").or().notIn("data_flag",Arrays.asList("C","M","D","MD","K","P","Vgd","VGD","TD","ST","SD","B","STA","F","FA"));
        });
        gasRealList = isEnvGasMonHourService.list(queryWrapper);

        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            AmProblemFi amProblemFi = new AmProblemFi();
            amProblemFi.setFactoryId(permitEmissionsFactoryVO.getFactoryId());
            amProblemFi.setProblemSources("3");
            amProblemFi.setProblemType("005002");
            amProblemFi.setType(1);
            amProblemFi.setProblemStartTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
            amProblemFi.setCreateTime(new Date());
            String factoryId = permitEmissionsFactoryVO.getFactoryId();
            List<PcOutlet> pcOutletList = pcOutletMap.get(factoryId);
            if(pcOutletList != null && pcOutletList.size()>0){
                //排口逐一进行处理，检查排口状态，跟排口的状态进行获取不同的数据
                for (PcOutlet pcOutlet : pcOutletList) {
                    if (StringUtils.isNotBlank(pcOutlet.getMark())) {
                        //获取排口的排污许可排放量
                        if(pcOutlet.getMark().equalsIgnoreCase("N")){
                            SEnvGasMonHour sEnvGasMonRealIndex =null;
                            for (SEnvGasMonHour sEnvGasMonReal : gasRealList) {
                                if (sEnvGasMonReal.getOutletId().equalsIgnoreCase(pcOutlet.getId())
                                        &&sEnvGasMonReal.getFactoryId().equalsIgnoreCase(pcOutlet.getFactoryId())) {
                                    sEnvGasMonRealIndex = sEnvGasMonReal;
                                    break;
                                }
                            }
                            if(sEnvGasMonRealIndex != null){
                                List<PollDisPollutantGroupVO> pollDisPollutantGroupVOList=null;
                                //从主要排口表中获取浓度限值
                                if(pcOutlet.getOutletTypes().equalsIgnoreCase("1")){
                                    mainPollDisGasMoutMapper.selectGasOutletPermitPollutant();
                                    pollDisPollutantGroupVOList = mainPollDisGasMoutMapper.selectPollutantGroupList(permitEmissionsFactoryVO.getFactoryId(),permitEmissionsFactoryVO.getLicenseId(),pcOutlet.getOutletCode());
                                    //从一般排口获取浓度限值
                                }else if (pcOutlet.getOutletTypes().equalsIgnoreCase("2")){
                                    pollDisPollutantGroupVOList = mainPollDisGasOoutMapper.selectPollutantGroupList(permitEmissionsFactoryVO.getFactoryId(),permitEmissionsFactoryVO.getLicenseId(),pcOutlet.getOutletCode());
                                }
                                if(pollDisPollutantGroupVOList != null && pollDisPollutantGroupVOList.size()> 0){
                                    for (PollDisPollutantGroupVO pollDisPollutantGroupVO : pollDisPollutantGroupVOList) {
                                        String methodName = concentrationConstants.getGasPollutants().get(pollDisPollutantGroupVO.getPollutantType());
                                        if(StringUtils.isBlank(methodName)){
                                            continue;
                                        }
                                        Class<SEnvGasMonHour> sEnvGasMonRealClass = SEnvGasMonHour.class;
                                        Method methodGet = sEnvGasMonRealClass.getMethod("get" + methodName);
                                        String result = (String)methodGet.invoke(sEnvGasMonRealIndex);
                                        BigDecimal hourValue = new BigDecimal(pollDisPollutantGroupVO.getPollutantsMgHour());
                                        if(hourValue.compareTo(new BigDecimal(0)) <=0 || StringUtils.isBlank(result)){
                                            //监测值为空或者限值小于等于0，放弃计算
                                            continue;
                                        }
                                        if (new BigDecimal(result).compareTo(hourValue) >0) {
                                            amProblemFi.setProblemDetails(permitEmissionsFactoryVO.getFactoryName()+"的 "+pcOutlet.getOutletName()+" 排口(排口编号:"+pcOutlet.getOutletCode()+")  发生超标报警，报警因子："+methodName+","+"排口许可浓度为："+hourValue+",实际浓度为："+result);
                                            //amProblemFi.setProblemDetails(pcOutlet.getOutletName()+"于"+sEnvGasMonRealIndex.getMonitoringTime()+" "+methodName+" "+"浓度超标预警，目前累计均值超过标准值"+hourValue+"hg/m³ 90%， 可能引起"+methodName+"浓度超标");
                                            batchDataList.add(amProblemFi);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if(batchDataList.size()>0){
            amProblemFiService.saveBatch(batchDataList);
        }
    }

    /**
     * 废气/废水 浓度超标报警
     * @param pcOutlet
     * @param outletPermitPollutantVO
     * @param mathEmissions
     * @param alarmDate
     * @param outletType
     */
    @Override
    public void checkExceedingTheStandard(PcOutlet pcOutlet,
                                          OutletPermitPollutantVO outletPermitPollutantVO,
                                          BigDecimal mathEmissions,
                                          String alarmDate,
                                          String outletType,
                                          String problemCode
                                          ) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ParseException {
        checkExceedingTheStandard(pcOutlet,outletPermitPollutantVO,mathEmissions,alarmDate,outletType,problemCode,null);
    }

    /**
     * 废气/废水 浓度超标报警
     * @param pcOutlet
     * @param outletPermitPollutantVO
     * @param mathEmissions
     * @param alarmDate
     * @param outletType
     */
    @Override
    public void checkExceedingTheStandard(PcOutlet pcOutlet,
                                          OutletPermitPollutantVO outletPermitPollutantVO,
                                          BigDecimal mathEmissions,
                                          String alarmDate,
                                          String outletType,
                                          String problemCode,
                                          String message) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ParseException {
        Method method = OutletPermitPollutantVO.class.getMethod("get" + outletType);
        String result = (String)method.invoke(outletPermitPollutantVO);
        if(StringUtils.isBlank(result) || result.equalsIgnoreCase("/")){
            //忽略空值 0值与/值
            return;
        }
        AmProblemFi amProblemFi = new AmProblemFi();
        amProblemFi.setFactoryId(pcOutlet.getFactoryId());
        amProblemFi.setProblemSources("1");
        amProblemFi.setProblemType(problemCode);
        // 监测点/排口名称
        amProblemFi.setStationName(pcOutlet.getMonitoringPointName());
        amProblemFi.setParamName(outletPermitPollutantVO.getPollutantsType());
        amProblemFi.setType(1);
        amProblemFi.setStationId(pcOutlet.getId());
        amProblemFi.setAnalyseTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarmDate));
        if (mathEmissions.compareTo(new BigDecimal(result)) >0) {
            amProblemFi.setProblemDetails(outletPermitPollutantVO.getFactoryName()+" 的 "+(StringUtils.isBlank(pcOutlet.getOutletName())?"排口":pcOutlet.getOutletName())+"(排口编号:"+pcOutlet.getOutletCode()+"),"+(StringUtils.isBlank(pcOutlet.getMonitoringPointName())?"点位":pcOutlet.getMonitoringPointName())+" 发生超标报警，报警因子："+outletPermitPollutantVO.getPollutantsType()+","+"排口许可浓度为："+outletPermitPollutantVO.getPollutantsMgHour()+",实际浓度为："+mathEmissions);
            if(StringUtils.isNotBlank(message)){
                amProblemFi.setProblemDetails(message);
            }
            Map<String, Object> extra = new HashMap<>();
            extra.put("pollutantCode", outletPermitPollutantVO.getPollutantCode()); // 污染因子编码
            extra.put("allowableValue", result); // 限值
            amProblemFi.setExtra(JSON.toJSONString(extra));
            amProblemFi.setParamProperty(outletPermitPollutantVO.getPollutantCode());

            batchDataList.add(amProblemFi);
            PcOutlet pcOutletAlarm = new PcOutlet();
            BeanUtils.copyProperties(pcOutlet,pcOutletAlarm);
            pcOutletAlarm.setOutletStatus("报警");
            outletStatusMap.put(pcOutlet.getId(),pcOutletAlarm);
        }
    }

    /**
     * 大气数据浓度超标 AI检出异常数据复核计算
     * @param mathDate
     */
    @Override
    public void doGasPollutantHourConcentrationAIReview(String mathDate) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        //获取报警信息表中的AI复核数据
        LocalDateTime date = LocalDateTime.now().minus(1, ChronoUnit.HOURS);
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00:00");
        String dateStr = date.format(dateTimeFormatter);
        String dateStrEnd = date.plus(1, ChronoUnit.HOURS).format(dateTimeFormatter);
        if(StringUtils.isNotBlank(mathDate)){
            dateStr = mathDate;
            dateStrEnd = LocalDateTime.parse(mathDate,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).plus(1,ChronoUnit.HOURS).format(dateTimeFormatter);
        }
        List<AmProblemFi> list = amProblemFiService.getProblemByTypeAndTime("001006001",dateStr,dateStrEnd);
        //循环处理 获取接口与排污许可 传递给超标进行计算
        for (AmProblemFi amProblemFi : list) {
            String factoryId = amProblemFi.getFactoryId();
            PcFactory factory = factoryMapper.selectById(factoryId);
            if(factory == null ){
                continue;
            }
            String stationId = amProblemFi.getStationId();
            PcOutlet outlet = pcOutletMapper.getOutletByPoint(stationId);
            if(outlet == null ){
                continue;
            }
            List<BMainPollDisGasMout> bMainPollDisGasMouts = mainPollDisGasMoutMapper.selectList(new LambdaQueryWrapper<BMainPollDisGasMout>()
                    .eq(BMainPollDisGasMout::getFactoryId, factoryId)
                    .eq(BMainPollDisGasMout::getOutletCode, outlet.getOutletCode()));

            QueryWrapper<SEnvGasMonHour> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("factory_id",factoryId);
            queryWrapper.eq("outlet_id",stationId);
            queryWrapper.ge("monitoring_time",amProblemFi.getProblemStartTime());
            queryWrapper.lt("monitoring_time",amProblemFi.getProblemEndTime());
            queryWrapper.eq("data_type",TimeTypeEnum.HOUR.getCode());
            queryWrapper.and(wp->{
                wp.isNull("data_flag").or().notIn("data_flag",Arrays.asList("C","M","D","MD","K","P","Vgd","VGD","TD","ST","SD","B","STA","F","FA"));
            });

            //获取监测数据
            List<SEnvGasMonHour> realList = isEnvGasMonHourService.list(queryWrapper);
            //筛选监测数据是否有该排口数据
            for (SEnvGasMonHour sEnvGasMonReal : realList) {
                SEnvGasMonHour sEnvGasMonRealIndex = null;
                if (StringUtils.isNotBlank(sEnvGasMonReal.getOutletId())
                        && sEnvGasMonReal.getOutletId().equalsIgnoreCase(stationId)
                        && sEnvGasMonReal.getFactoryId().equalsIgnoreCase(factoryId)) {
                    sEnvGasMonRealIndex = sEnvGasMonReal;
                }
                if (sEnvGasMonRealIndex == null) {
                    //没有监测数据直接跳过，进行下一个排口检查
                    continue;
                }
                for (Map.Entry<String, String> stringStringEntry : concentrationConstants.getGasPollutants().entrySet()) {
                    //检查是否需要计算排放量，根据排污许可的污染因子比对
                    ThreadLocal<OutletPermitPollutantVO> threadLocal = new ThreadLocal<>();
                    for (BMainPollDisGasMout bMainPollDisGasMout : bMainPollDisGasMouts) {
                        if (stringStringEntry.getKey().equalsIgnoreCase(bMainPollDisGasMout.getPollutantCode())) {
                            OutletPermitPollutantVO outletPermitPollutantVO = new OutletPermitPollutantVO();
                            BeanUtils.copyProperties(bMainPollDisGasMout, outletPermitPollutantVO);
                            threadLocal.set(outletPermitPollutantVO);
                            break;
                        }
                    }
                    OutletPermitPollutantVO outletPermitPollutantVO = threadLocal.get();
                    if (outletPermitPollutantVO == null) {
                        //排污许可无该因子的限值，跳过
                        continue;
                    }
                    //获取因子浓度
                    Method methodConcentration = SEnvGasMonReal.class.getMethod("get" + stringStringEntry.getValue() + "Convert");
                    String concentrationValue = (String) methodConcentration.invoke(sEnvGasMonRealIndex);
                    final String monitoringTime = sEnvGasMonRealIndex.getMonitoringTime();
                    final String message = factory.getFactoryName()+"于"+amProblemFi.getProblemStartTime()+"-"+amProblemFi.getProblemEndTime()+"进行了停产标记，" +
                            "此阶段"+(StringUtils.isBlank(outlet.getOutletName())?"排口":outlet.getOutletName())+"的"+threadLocal.get().getPollutantsType()+"于"+
                            monitoringTime+"出现浓度超标(排口许可浓度值为"+threadLocal.get().getPollutantsMgHour()+",实际值:"+concentrationValue+")";
                    if (StringUtils.isNotBlank(concentrationValue)) {
                        //把数据给到超标计算器，检查是否超标(仅在线数据会被监测)
                        threadPoolTaskExecutor.execute(() -> {
                            try {
                                checkExceedingTheStandard(outlet, outletPermitPollutantVO, new BigDecimal(concentrationValue), monitoringTime, "PollutantsMgHour", "003006", message);
                            } catch (NoSuchMethodException e) {
                                throw new RuntimeException(e);
                            } catch (InvocationTargetException e) {
                                throw new RuntimeException(e);
                            } catch (IllegalAccessException e) {
                                throw new RuntimeException(e);
                            } catch (ParseException e) {
                                throw new RuntimeException(e);
                            }
                        });
                    }
                }
            }
        }
        insertBatch();
    }

    /**
     * 执行存储，执行完毕晴空缓存
     */
    @Override
    public synchronized void insertBatch(){
        if(batchDataList.size()>0){
            amProblemFiService.saveBatch(batchDataList);
            batchDataList.clear();
        }
        if(outletStatusMap.size() > 0){
            pcOutletService.updateBatchById(outletStatusMap.values());
            outletStatusMap.clear();
        }
    }

    /**
     * 水浓度超标
     */
    @Override
    @Deprecated
    public void doWaterPollutantDayConcentration(String mathDate) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        //获取全部排污许可期限内的企业
        List<PermitEmissionsFactoryVO> permitEmissionsFactoryVOS;
        //查询所有排口信息
        Map<String ,List<PcOutlet>> pcOutletMap = new ConcurrentHashMap<>();
        //查询当前小时数据
        List<SEnvWaterMonDay> waterRealList;
        //初始化排污许可企业数据，规定排口容器的长度
        permitEmissionsFactoryVOS= factoryMapper.selectPermitEmissionsFactoryList();
        if(permitEmissionsFactoryVOS == null && permitEmissionsFactoryVOS.size() == 0){
            log.info("没有查询到企业，终止任务");
        }
        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            pcOutletMap.put(permitEmissionsFactoryVO.getFactoryId(),new ArrayList<>());
        }
        List<PcOutlet> ListOutlet = pcOutletMapper.selectPermitOutletList("2","1");
        if(ListOutlet == null && ListOutlet.size() == 0){
            log.info("没有查询到排口，终止任务");
        }
        //只有排污许可企业下的排口才会被统计
        for (PcOutlet pcOutlet : ListOutlet) {
            if (pcOutletMap.containsKey(pcOutlet.getFactoryId())) {
                pcOutletMap.get(pcOutlet.getFactoryId()).add(pcOutlet);
            }
        }
        //查询最新日数据
        LocalDateTime date = LocalDateTime.now().minus(1, ChronoUnit.DAYS);
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00");
        String dateStr = date.format(dateTimeFormatter);

        QueryWrapper<SEnvWaterMonDay> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("monitoring_time",dateStr);
        queryWrapper.eq("data_type",TimeTypeEnum.DAY.getCode());
        queryWrapper.and(wp->{
            wp.isNull("data_flag").or().notIn("data_flag",Arrays.asList("C","M","D","MD","K","P","Vgd","VGD","TD","ST","SD","B","STA","F","FA"));
        });

        waterRealList = isEnvWaterMonDayService.list(queryWrapper);

        List<AmProblemFi> batchDataList = new CopyOnWriteArrayList();
        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            AmProblemFi amProblemFi = new AmProblemFi();
            amProblemFi.setFactoryId(permitEmissionsFactoryVO.getFactoryId());
            amProblemFi.setProblemSources("3");
            amProblemFi.setType(1);
            amProblemFi.setCreateTime(new Date());
            amProblemFi.setProblemType("005002");
            amProblemFi.setProblemStartTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
            String factoryId = permitEmissionsFactoryVO.getFactoryId();
            List<PcOutlet> pcOutletList = pcOutletMap.get(factoryId);
            if(pcOutletList != null && pcOutletList.size()>0){
                //排口逐一进行处理，检查排口状态，跟排口的状态进行获取不同的数据
                for (PcOutlet pcOutlet : pcOutletList) {
                    if (StringUtils.isNotBlank(pcOutlet.getMark())) {
                        //获取排口的排污许可排放量
                        if(pcOutlet.getMark().equalsIgnoreCase("N")){
                            SEnvWaterMonDay sEnvWaterMonRealIndex =null;
                            for (SEnvWaterMonDay sEnvWaterMonReal : waterRealList) {
                                if (sEnvWaterMonReal.getOutletId().equalsIgnoreCase(pcOutlet.getId())
                                        &&sEnvWaterMonReal.getFactoryId().equalsIgnoreCase(pcOutlet.getFactoryId())) {
                                    sEnvWaterMonRealIndex = sEnvWaterMonReal;
                                    break;
                                }
                            }
                            if(sEnvWaterMonRealIndex != null){
                                List<PollDisPollutantGroupVO> pollDisPollutantGroupVOList=null;
                                //从主要排口表中获取浓度限值
                                if(pcOutlet.getOutletTypes().equalsIgnoreCase("1")){
                                    pollDisPollutantGroupVOList = mainPollDisWaterMoutMapper.selectPollutantGroupList(permitEmissionsFactoryVO.getFactoryId(),permitEmissionsFactoryVO.getLicenseId(),pcOutlet.getOutletCode());
                                    //从一般排口获取浓度限值
                                }else if (pcOutlet.getOutletTypes().equalsIgnoreCase("2")){
                                    pollDisPollutantGroupVOList = mainPollDisWaterOoutMapper.selectPollutantGroupList(permitEmissionsFactoryVO.getFactoryId(),permitEmissionsFactoryVO.getLicenseId(),pcOutlet.getOutletCode());
                                }
                                if(pollDisPollutantGroupVOList != null && pollDisPollutantGroupVOList.size()> 0){
                                    for (PollDisPollutantGroupVO pollDisPollutantGroupVO : pollDisPollutantGroupVOList) {
                                        String methodName = concentrationConstants.getWaterPollutants().get(pollDisPollutantGroupVO.getPollutantType());
                                        if(StringUtils.isBlank(methodName)){
                                            continue;
                                        }
                                        Class<SEnvWaterMonDay> sEnvWaterMonRealClass = SEnvWaterMonDay.class;
                                        Method methodGet = sEnvWaterMonRealClass.getMethod("get" + methodName);
                                        String result = (String)methodGet.invoke(sEnvWaterMonRealIndex);
                                        BigDecimal mgRate = new BigDecimal(pollDisPollutantGroupVO.getPollutantsMgRate());
                                        if(mgRate.compareTo(new BigDecimal(0)) <=0 || StringUtils.isBlank(result)){
                                            //监测值为空或者限值小于等于0 跳过计算
                                            continue;
                                        }
                                        if (new BigDecimal(result).compareTo(mgRate) >0) {
                                            amProblemFi.setProblemDetails(permitEmissionsFactoryVO.getFactoryName()+"的 "+pcOutlet.getOutletName()+" 排口(排口编号:"+pcOutlet.getOutletCode()+")  发生超标报警，报警因子："+methodName+","+"排口许可浓度为："+mgRate+",实际浓度为："+result);
                                            batchDataList.add(amProblemFi);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if(batchDataList.size()>0){
            amProblemFiService.saveBatch(batchDataList);
        }
    }
    /**
     * 大气浓度预警
     */
    @Override
    public void doGasPollutantHourConcentrationAlarm(String mathDate) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ParseException {
        //获取全部排污许可期限内的企业
        List<PermitEmissionsFactoryVO> permitEmissionsFactoryVOS;
        //查询所有排口信息
        Map<String ,List<PcOutletPermitPollutantVO>> pcOutletMap = new ConcurrentHashMap<>();
        //查询当前小时数据
        List<SEnvGasMonReal> gasRealList;
        //初始化排污许可企业数据，规定排口容器的长度
        permitEmissionsFactoryVOS= factoryMapper.selectPermitEmissionsFactoryList();
        if(permitEmissionsFactoryVOS == null || permitEmissionsFactoryVOS.size() == 0){
            log.info("没有查询到企业，终止任务");
            return;
        }
        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            pcOutletMap.put(permitEmissionsFactoryVO.getFactoryId(),new ArrayList<>());
        }
        List<PcOutlet> ListOutlet = pcOutletMapper.selectPermitOutletList("1","1");
        List<PcOutlet> outletStatusList = new ArrayList<>();
        if(ListOutlet == null || ListOutlet.size() == 0){
            log.info("没有查询到排口，终止任务");
            return;
        }
        //只有排污许可企业下的排口监测点位才会被统计
        //从排口表中获取浓度限值
        List<OutletPermitPollutantVO> outletPermitPollutantVOS = mainPollDisGasMoutMapper.selectGasOutletPermitPollutant();
        for (PcOutlet pcOutlet : ListOutlet) {
            if (pcOutletMap.containsKey(pcOutlet.getFactoryId())) {
                //初始化排口污染因子复合实体
                PcOutletPermitPollutantVO pcOutletPermitPollutantVO = new PcOutletPermitPollutantVO(pcOutlet.getOutletCode(), pcOutlet.getFactoryId(), pcOutlet, new HashMap<>());
                for (OutletPermitPollutantVO outletPermitPollutantVO : outletPermitPollutantVOS) {
                    if (outletPermitPollutantVO.getFactoryId().equalsIgnoreCase(pcOutlet.getFactoryId())
                            && outletPermitPollutantVO.getOutletCode().equalsIgnoreCase(pcOutlet.getOutletCode())) {
                        pcOutletPermitPollutantVO.getOutletPermitPollutantVOMap().put(outletPermitPollutantVO.getPollutantCode(),outletPermitPollutantVO);
                    }
                }
                //装载实体
                pcOutletMap.get(pcOutlet.getFactoryId()).add(pcOutletPermitPollutantVO);
            }
        }
        //查询当前小时的所有分钟数据，做平均值后返回
        LocalDateTime date = LocalDateTime.now().minus(10,ChronoUnit.MINUTES);
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:00");
        String dateStr = date.format(dateTimeFormatter);
        String dateStrEnd = LocalDateTime.now().format(dateTimeFormatter);
        if(StringUtils.isNotBlank(mathDate)){
            dateStr = mathDate;
            dateStrEnd = LocalDateTime.parse(mathDate,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).plus(10,ChronoUnit.MINUTES).format(dateTimeFormatter);
        }
        gasRealList = sEnvGasMonRealMapper.selectAvgDataForHour(dateStr,dateStrEnd);
        List<AmProblemFi> batchDataList = new CopyOnWriteArrayList();
        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            String factoryId = permitEmissionsFactoryVO.getFactoryId();
            List<PcOutletPermitPollutantVO> pcOutletPermitPollutantVOS = pcOutletMap.get(factoryId);
            if(pcOutletPermitPollutantVOS != null && pcOutletPermitPollutantVOS.size()>0){
                //排口逐一进行处理，检查排口状态，跟排口的状态进行获取不同的数据
                for (PcOutletPermitPollutantVO pcOutletPermitPollutantVO : pcOutletPermitPollutantVOS) {
                    boolean isAlarm = false;
                    //获取排口的排污许可排放量
                    SEnvGasMonReal sEnvGasMonRealIndex =null;
                    for (SEnvGasMonReal sEnvGasMonReal : gasRealList) {
                        if (sEnvGasMonReal.getOutletId().equalsIgnoreCase(pcOutletPermitPollutantVO.getPcOutlet().getId())
                                &&sEnvGasMonReal.getFactoryId().equalsIgnoreCase(pcOutletPermitPollutantVO.getFactoryId())) {
                            sEnvGasMonRealIndex = sEnvGasMonReal;
                            break;
                        }
                    }
                    if(sEnvGasMonRealIndex != null){
                        for (Map.Entry<String, String> stringStringEntry : concentrationConstants.getGasPollutants().entrySet()) {
                            OutletPermitPollutantVO outletPermitPollutantVO = pcOutletPermitPollutantVO.getOutletPermitPollutantVOMap().get(stringStringEntry.getKey());
                            if(outletPermitPollutantVO == null){
                                continue;
                            }
                            if(StringUtils.isBlank(outletPermitPollutantVO.getPollutantsMgHour()) || outletPermitPollutantVO.getPollutantsMgHour().equalsIgnoreCase("/")){
                                continue;
                            }
                            Class<SEnvGasMonReal> sEnvGasMonRealClass = SEnvGasMonReal.class;
                            Method methodGet = sEnvGasMonRealClass.getMethod("get" + stringStringEntry.getValue()+"Convert");
                            String result = (String)methodGet.invoke(sEnvGasMonRealIndex);
                            //浓度限值
                            BigDecimal hourConvert = new BigDecimal(StringUtils.isBlank(result)?"0":result);
                            BigDecimal hourValue = new BigDecimal(StringUtils.isBlank(outletPermitPollutantVO.getPollutantsMgHour())?"0":outletPermitPollutantVO.getPollutantsMgHour());
                            if(hourConvert.compareTo(hourValue)>0){
                                //超标不计算
                                continue;
                            }
                            if(hourValue.compareTo(new BigDecimal(0)) <=0 || StringUtils.isBlank(result)){
                                //监测值为空或者限值小于等于0停止计算
                                continue;
                            }
                            if (hourConvert
                                    .divide(hourValue,2, RoundingMode.HALF_DOWN)
                                    .multiply(BigDecimal.valueOf(100)).compareTo(new BigDecimal(90)) >=0) {
                                AmProblemFi amProblemFi = new AmProblemFi();
                                amProblemFi.setFactoryId(permitEmissionsFactoryVO.getFactoryId());
                                amProblemFi.setProblemSources("1");
                                // 监测点/排口名称
                                amProblemFi.setStationName(pcOutletPermitPollutantVO.getPcOutlet().getStationName());
                                amProblemFi.setParamName(outletPermitPollutantVO.getPollutantsType());
                                amProblemFi.setProblemType("003003");
                                amProblemFi.setType(0);
                                amProblemFi.setCreateTime(new Date());
                                amProblemFi.setStationId(pcOutletPermitPollutantVO.getPcOutlet().getId());
                                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                                amProblemFi.setAnalyseTime(simpleDateFormat.parse(dateStr));
                                amProblemFi.setAnalyseTimeEnd(simpleDateFormat.parse(dateStrEnd));
                                amProblemFi.setProblemStartTime(dateStr);
                                amProblemFi.setProblemEndTime(dateStrEnd);
                                amProblemFi.setParamProperty(outletPermitPollutantVO.getPollutantCode());
                                //amProblemFi.setProblemDetails(permitEmissionsFactoryVO.getFactoryName()+"的 "+(StringUtils.isBlank(pcOutletPermitPollutantVO.getPcOutlet().getOutletName())?"":pcOutletPermitPollutantVO.getPcOutlet().getOutletName())+" 排口(排口编号:"+(StringUtils.isBlank(pcOutletPermitPollutantVO.getOutletCode())?"":pcOutletPermitPollutantVO.getOutletCode())+")  发生浓度预警，报警因子："+outletPermitPollutantVO.getPollutantsType()+","+"排口许可小时限值为："+hourValue+",当前小时平均浓度为："+result);
                                amProblemFi.setProblemDetails((StringUtils.isBlank(pcOutletPermitPollutantVO.getPcOutlet().getOutletName())?"":pcOutletPermitPollutantVO.getPcOutlet().getOutletName())+"于"+dateStr+" "+outletPermitPollutantVO.getPollutantsType()+" "+"浓度超标预警，目前累计均值超过标准值"+hourValue+"mg/m³ 90%， 可能引起"+outletPermitPollutantVO.getPollutantsType()+"浓度超标");
                                amProblemFi.setPollutantSourceAi("1");
                                Map<String, Object> extra = new HashMap<>();
                                extra.put("pollutantCode", outletPermitPollutantVO.getPollutantCode()); // 污染因子编码
                                extra.put("allowableValue", hourValue); // 限值
                                amProblemFi.setExtra(JSON.toJSONString(extra));

                                batchDataList.add(amProblemFi);
                                isAlarm = true;
                            }
                        }
                    }
                    //排口状态修改
                    if(isAlarm){
                        PcOutlet pcOutlet = new PcOutlet();
                        BeanUtils.copyProperties(pcOutletPermitPollutantVO.getPcOutlet(),pcOutlet);
                        pcOutlet.setOutletStatus("报警");
                        outletStatusList.add(pcOutlet);
                    }
                }
            }
        }
        if(batchDataList.size()>0){
            amProblemFiService.saveBatch(batchDataList);
        }
        if(outletStatusList.size() >0){
            pcOutletService.updateBatchById(outletStatusList);
        }
    }
    /**
     * 水浓度预警
     */
    @Override
    public void doWaterPollutantDayConcentrationAlarm(String mathDate) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        //获取全部排污许可期限内的企业
        List<PermitEmissionsFactoryVO> permitEmissionsFactoryVOS;
        //查询所有排口信息
        Map<String ,List<PcOutletPermitPollutantVO>> pcOutletMap = new ConcurrentHashMap<>();
        //查询当前小时数据
        List<SEnvWaterMonHour> gasRealList;
        //初始化排污许可企业数据，规定排口容器的长度
        permitEmissionsFactoryVOS= factoryMapper.selectPermitEmissionsFactoryList();
        if(permitEmissionsFactoryVOS == null && permitEmissionsFactoryVOS.size() == 0){
            log.info("没有查询到企业，终止任务");
        }
        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            pcOutletMap.put(permitEmissionsFactoryVO.getFactoryId(),new ArrayList<>());
        }
        List<PcOutlet> ListOutlet = pcOutletMapper.selectPermitOutletList("2","1");
        List<PcOutlet> outletStatusList = new ArrayList<>();
        List<OutletPermitPollutantVO> outletPermitPollutantVOS = mainPollDisWaterMoutMapper.selectWaterOutletPermitPollutant();
        if(outletPermitPollutantVOS == null && outletPermitPollutantVOS.size() == 0){
            log.info("没有查询到排口，终止任务");
        }
        //只有排污许可企业下的排口才会被统计
        for (PcOutlet pcOutlet : ListOutlet) {
            if (pcOutletMap.containsKey(pcOutlet.getFactoryId())) {
                //初始化排口污染因子复合实体
                PcOutletPermitPollutantVO pcOutletPermitPollutantVO = new PcOutletPermitPollutantVO(pcOutlet.getOutletCode(), pcOutlet.getFactoryId(), pcOutlet, new HashMap<>());
                for (OutletPermitPollutantVO outletPermitPollutantVO : outletPermitPollutantVOS) {
                    if (outletPermitPollutantVO.getFactoryId().equalsIgnoreCase(pcOutlet.getFactoryId())
                            && outletPermitPollutantVO.getOutletCode().equalsIgnoreCase(pcOutlet.getOutletCode())) {
                        pcOutletPermitPollutantVO.getOutletPermitPollutantVOMap().put(outletPermitPollutantVO.getPollutantCode(),outletPermitPollutantVO);
                    }
                }
                //装载实体
                pcOutletMap.get(pcOutlet.getFactoryId()).add(pcOutletPermitPollutantVO);
            }
        }
        //查询
        LocalDateTime date = LocalDateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00");
        String dateStr = date.format(dateTimeFormatter);
        gasRealList = isEnvWaterMonHourSerice.selectAvgDataForDay(dateStr);
        List<AmProblemFi> batchDataList = new CopyOnWriteArrayList();
        for (PermitEmissionsFactoryVO permitEmissionsFactoryVO : permitEmissionsFactoryVOS) {
            String factoryId = permitEmissionsFactoryVO.getFactoryId();
            List<PcOutletPermitPollutantVO> pcOutletPermitPollutantVOS = pcOutletMap.get(factoryId);
            if(pcOutletPermitPollutantVOS != null && pcOutletPermitPollutantVOS.size()>0) {
                //排口逐一进行处理，检查排口状态，跟排口的状态进行获取不同的数据
                for (PcOutletPermitPollutantVO pcOutletPermitPollutantVO : pcOutletPermitPollutantVOS) {
                    boolean isAlarm = false;
                    SEnvWaterMonHour sEnvWaterMonRealIndex =null;
                    for (SEnvWaterMonHour sEnvWaterMonReal : gasRealList) {
                        if (sEnvWaterMonReal.getOutletId().equalsIgnoreCase(pcOutletPermitPollutantVO.getPcOutlet().getId())
                                &&sEnvWaterMonReal.getFactoryId().equalsIgnoreCase(factoryId)) {
                            sEnvWaterMonRealIndex = sEnvWaterMonReal;
                            break;
                        }
                    }
                    if(sEnvWaterMonRealIndex != null){
                        //从主要排口表中获取浓度限值
                        for (Map.Entry<String, String> stringStringEntry : concentrationConstants.getWaterPollutants().entrySet()) {
                            OutletPermitPollutantVO outletPermitPollutantVO = pcOutletPermitPollutantVO.getOutletPermitPollutantVOMap().get(stringStringEntry.getKey());
                            if(outletPermitPollutantVO == null){
                                continue;
                            }
                            if(StringUtils.isBlank(outletPermitPollutantVO.getPollutantsMgHour()) || outletPermitPollutantVO.getPollutantsMgHour().equalsIgnoreCase("/")){
                                continue;
                            }
                            String methodName = stringStringEntry.getValue();
                            Class<SEnvWaterMonHour> sEnvWaterMonRealClass = SEnvWaterMonHour.class;
                            Method methodGet = sEnvWaterMonRealClass.getMethod("get" + methodName);
                            String result = (String)methodGet.invoke(sEnvWaterMonRealIndex);
                            //浓度限值
                            BigDecimal mgRate = new BigDecimal(outletPermitPollutantVO.getPollutantsMgRate() == null?"0":outletPermitPollutantVO.getPollutantsMgRate());
                            if(mgRate.compareTo(new BigDecimal(0)) <=0 || StringUtils.isBlank(result)){
                                //监测值为空或者限值小于等于0停止计算
                                continue;
                            }
                            if(new BigDecimal(result).compareTo(mgRate)>0){
                                //超标不计算
                                continue;
                            }
                            if (new BigDecimal(result)
                                    .divide(mgRate,2, RoundingMode.HALF_DOWN)
                                    .multiply(BigDecimal.valueOf(100)).compareTo(new BigDecimal(80)) >=0) {
                                AmProblemFi amProblemFi = new AmProblemFi();
                                amProblemFi.setFactoryId(permitEmissionsFactoryVO.getFactoryId());
                                amProblemFi.setProblemSources("1");
                                amProblemFi.setProblemType("003003");
                                amProblemFi.setCreateTime(new Date());
                                amProblemFi.setType(0);
                                amProblemFi.setAnalyseTime(Date.from(date.atZone(ZoneId.systemDefault()).toInstant()));
                                amProblemFi.setProblemStartTime(dateStr);
                                amProblemFi.setProblemEndTime(dateStr);
                                amProblemFi.setParamProperty(stringStringEntry.getKey());
                                amProblemFi.setPollutantSourceAi("2");
                                //amProblemFi.setProblemDetails(permitEmissionsFactoryVO.getFactoryName()+"的 "+pcOutletPermitPollutantVO.getPcOutlet().getOutletName()+" 排口(排口编号:"+pcOutletPermitPollutantVO.getOutletCode()+")  发生排放预警，报警因子："+methodName+","+"排口许可限值为："+mgRate+",当前小时平均速率为："+result);
                                amProblemFi.setProblemDetails((StringUtils.isBlank(pcOutletPermitPollutantVO.getPcOutlet().getOutletName())?"":pcOutletPermitPollutantVO.getPcOutlet().getOutletName())+"于"+dateStr+" "+outletPermitPollutantVO.getPollutantsType()+" "+"浓度超标预警，目前累计均值超过标准值"+mgRate+"mg/L 80%， 可能引起"+outletPermitPollutantVO.getPollutantsType()+"浓度超标");
                                amProblemFi.setStationId(pcOutletPermitPollutantVO.getPcOutlet().getId());
                                amProblemFi.setStationName(pcOutletPermitPollutantVO.getPcOutlet().getOutletName());
                                Map<String, Object> extra = new HashMap<>();
                                extra.put("pollutantCode", stringStringEntry.getKey()); // 污染因子编码
                                extra.put("allowableValue", mgRate); // 限值
                                amProblemFi.setExtra(JSON.toJSONString(extra));

                                batchDataList.add(amProblemFi);
                            }
                        }
                    }
                    //排口状态修改
                    if(isAlarm){
                        PcOutlet pcOutletAlarm = new PcOutlet();
                        BeanUtils.copyProperties(pcOutletPermitPollutantVO.getPcOutlet(),pcOutletAlarm);
                        pcOutletAlarm.setOutletStatus("报警");
                        outletStatusList.add(pcOutletAlarm);
                    }
                }
            }
        }
        if(batchDataList.size()>0){
            amProblemFiService.saveBatch(batchDataList);
        }
    }


    @Override
    public void doGasOverStandAlarmAndWarn(boolean flag) {
        // 查询的表及逻辑不对，暂不处理，后续开发
        // 查询所有无组织排放排口
        QueryWrapper<PcOutlet> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("pollutant_type","3");
        queryWrapper.eq("pollutant_outlet_type","3");
        List<PcOutlet> list = pcOutletMapper.selectList(queryWrapper);
        list.forEach(p ->{
            Date curr = new Date();
            Date lastHour = DateUtils.addHours(curr,-1);
            String lastHourBegin = DateUtils.parseDateToStr("yyyy-MM-dd HH:00:00",lastHour);
            QueryWrapper<SEnvGasReal> gasQueryWrapper = new QueryWrapper<>();
            gasQueryWrapper.eq("outlet_id",p.getId());
            gasQueryWrapper.eq("data_type",TimeTypeEnum.HOUR.getCode());
            gasQueryWrapper.eq("monitoring_time",lastHourBegin);
            SEnvGasReal hourData = envGasRealService.getOne(gasQueryWrapper);

            // 根据企业id,排口id查询，该排口企业污染物
            QueryWrapper<PcFactoryPollutant> pollutantQueryWrapper = new QueryWrapper<>();
            pollutantQueryWrapper.eq("factory_id",p.getFactoryId());
            pollutantQueryWrapper.eq("outlet_id",p.getId());
            List<PcFactoryPollutant> pList = pcFactoryPollutantService.list(pollutantQueryWrapper);
            pList.forEach(pollutant ->{
                PcPollutant pcPollutant = pcPollutantService.getById(pollutant.getPollutantId());
                if(flag){
                    doGasOverStandAlarm(pollutant.getFactoryId(),hourData,pcPollutant);
                }else{
                    doGasStandWarn(pollutant.getFactoryId(),hourData,pcPollutant);
                }
            });
        });
    }



    /**
     *
     * @param factoryId
     * @param hourData
     * @param pcPollutant
     */
    private void doGasOverStandAlarm(String factoryId,SEnvGasReal hourData, PcPollutant pcPollutant) {

        if(hourData!=null&& pcPollutant!=null){
            // 甲烷
            if("A05002".equalsIgnoreCase(pcPollutant.getPollCode())){
                //ch4
                if(Double.valueOf(hourData.getCh4())>Double.valueOf(pcPollutant.getExecutiveStandard())){
                    //甲烷超标，保存报警数据
                    AmProblemFi problemFi = new AmProblemFi();
                    problemFi.setFactoryId(factoryId);
                    problemFi.setStationId(hourData.getOutletId());
                    problemFi.setStationName(hourData.getStationName());
                    problemFi.setProblemSources("1");
                    problemFi.setProblemType(ProblemTypeEnum.OVER_STAND.getCode());
                    problemFi.setCreateTime(new Date());
                    amProblemFiService.save(problemFi);
                }
            }
            //A25003 甲苯
            if("A25003".equalsIgnoreCase(pcPollutant.getPollCode())){

            }
            //A25002  苯
            if("A25002".equalsIgnoreCase(pcPollutant.getPollCode())){

            }
            //总烃??
            if("A99918".equalsIgnoreCase(pcPollutant.getPollCode())){

            }
            //tsp  ??
            //NMHC ??
            //A34001 pm10  ??
            //A34002 pm2.5  ??

        }
    }

    public void doGasStandWarn(String factoryId,SEnvGasReal hourData, PcPollutant pcPollutant) {

    }
}
