package com.njcn.prepare.executor;

import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.service.mysql.area.IRMpMonitorAlarmCountMService;
import com.njcn.prepare.harmonic.service.mysql.area.RMpDevEvaluateDetailPOService;
import com.njcn.prepare.harmonic.service.mysql.area.RMpTargetWarnDService;
import com.njcn.prepare.harmonic.service.mysql.device.RStatDevSignalDPOService;
import com.njcn.prepare.harmonic.service.mysql.line.DayDataService;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailDService;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailService;
import com.njcn.prepare.harmonic.service.mysql.line.RMpMonitorEvaluateDService;
import com.njcn.prepare.harmonic.service.mysql.line.*;
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.IRMpBenchmarkLevelDService;
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.IRMpBenchmarkLevelMService;
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.IRMpBenchmarkLevelQService;
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.IRMpBenchmarkLevelYService;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;
import java.util.Objects;


/**
 * @author hongawen
 * @version 1.0.0
 * @date 2023年11月06日 15:59
 */
@Slf4j
@LiteflowComponent
@RequiredArgsConstructor
public class MeasurementExecutor extends BaseExecutor {

    private final RMpMonitorEvaluateDService rMpMonitorEvaluateDService;
    private final RMpEventDetailService rMpEventDetailService;
    private final RMpEventDetailDService rMpEventDetailDService;
    private final RMpEventDetailQService rMpEventDetailQService;
    private final RMpEventDetailYService rMpEventDetailYService;

    private final DayDataService dayDataService;
    private final RStatAbnormalDService rStatAbnormalDService;
    private final ROperatingMonitorService rOperatingMonitorService;
    private final ROperatingMonitorMService rOperatingMonitorMService;
    private final IntegrityService integrityService;
    private final RMpPassRateDService rMpPassRateDService;
    private final LimitRateService limitRateService;
    private final LimitTargetService limitTargetService;

    private final IRMpPartHarmonicDetailDService mpPartHarmonicDetailDService;
    private final IRMpSurplusHarmonicDetailDService mpSurplusHarmonicDetailDService;
    private final IRMpPartHarmonicDetailMService mpPartHarmonicDetailMService;
    private final IRMpSurplusHarmonicDetailMService mpSurplusHarmonicDetailMService;
    private final IRMpVThdService mpVThdService;
    private final AlarmDetailService alarmDetailService;
    private final RMpTargetWarnDService rMpTargetWarnDService;
    private final IRMpMonitorAlarmCountMService rMpMonitorAlarmCountMService;

    private final PollutionService pollutionService;
    private final RStatDevSignalDPOService rStatDevSignalDPOService;
    private final RMpDevEvaluateDetailPOService rMpDevEvaluateDetailPOService;
    private final IRMpBenchmarkLevelDService irMpBenchmarkLevelDService;
    private final IRMpBenchmarkLevelMService irMpBenchmarkLevelMService;
    private final IRMpBenchmarkLevelQService irmBenchmarkLevelQService;
    private final IRMpBenchmarkLevelYService irMpBenchmarkLevelYService;
    private final HarmonicGeneralService harmonicGeneralService;
    private final HarmonicMetricService harmonicMetricService;
    /**
     * 算法名: 3.3.1.1-----监测点评价
     *
     * @author hongawen
     * @date 2023年11月01日 11:08
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpMonitorEvaluate", nodeType = NodeTypeEnum.COMMON)
    public boolean processRMpMonitorEvaluateAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpMonitorEvaluate", nodeType = NodeTypeEnum.COMMON)
    public void processRMpMonitorEvaluateProcess(NodeComponent bindCmp) {
        rMpMonitorEvaluateDService.handleDay(bindCmp.getRequestData());
    }


    /**
     * 算法名: 3.4.1.8-----监测点暂态指标明细
     *
     * @author hongawen
     * @date 2023年11月01日 11:08
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpEventDetail", nodeType = NodeTypeEnum.COMMON)
    public boolean processRMpEventDetailAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpEventDetail", nodeType = NodeTypeEnum.COMMON)
    public void processRMpEventDetailProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
        if (tag.equalsIgnoreCase("r_mp_event_detail_d")) {
            //日表
            rMpEventDetailService.handleDay(calculatedParam);
        } else if (tag.equalsIgnoreCase("r_mp_event_detail_m")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //月表
                rMpEventDetailDService.handleMonth(calculatedParam);
            }
        } else if (tag.equalsIgnoreCase("r_mp_event_detail_q")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //季表
                rMpEventDetailQService.handleQuarter(calculatedParam);
            }
        } else if (tag.equalsIgnoreCase("r_mp_event_detail_y")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //年表
                rMpEventDetailYService.handleYear(calculatedParam);
            }
        }
    }

    /**
     * 3.3.1.2.	监测点数据异常_日表
     * @param bindCmp
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rStatAbnormalD", nodeType = NodeTypeEnum.COMMON)
    public boolean processRStatAbnormalDAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rStatAbnormalD", nodeType = NodeTypeEnum.COMMON)
    public void processRStatAbnormalDProcess(NodeComponent bindCmp) {
        CalculatedParam calculatedParam = bindCmp.getRequestData();

        rStatAbnormalDService.handlerMonitorAbnormal(calculatedParam);
    }

    /**
     *3.3.1.3.	监测点指标数据质量_日表 3.3.1.4.	监测点指标数据质量_月表
     */

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rOperatingMonitor", nodeType = NodeTypeEnum.COMMON)
    public boolean processOperatingMonitorAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rOperatingMonitor", nodeType = NodeTypeEnum.COMMON)
    public void processOperatingMonitorProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
        if (tag.equalsIgnoreCase("r_operating_monitor_d")) {
            //日表
            rOperatingMonitorService.handleDay(calculatedParam);
        } else if (tag.equalsIgnoreCase("r_operating_monitor_m")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //月表
                rOperatingMonitorMService.handleMonth(calculatedParam);
            }
        }
    }
    /***
     *3.4.1.5.	监测点稳态指标合格率
     *
     *
    */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpPassRate", nodeType = NodeTypeEnum.COMMON)
    public boolean processRMpPassRateAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpPassRate", nodeType = NodeTypeEnum.COMMON)
    public void processRMpPassRateProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
        if (tag.equalsIgnoreCase("r_mp_pass_rate_d")) {
            //日表
            rMpPassRateDService.handleDay(calculatedParam);
        } else if (tag.equalsIgnoreCase("r_mp_pass_rate_m")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //月表
                rMpPassRateDService.handleMonth(calculatedParam);
            }
        }else if (tag.equalsIgnoreCase("r_mp_pass_rate_q")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //季表
                rMpPassRateDService.handleQtr(calculatedParam);
            }
        }else if (tag.equalsIgnoreCase("r_mp_pass_rate_y")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //年表
                rMpPassRateDService.handleYear(calculatedParam);
            }
        }
    }

    /*
    * 3.4.1.12.	监测点污区图（新增）
    *
    * */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpPollutionD", nodeType = NodeTypeEnum.COMMON)
    public boolean processRMpPollutionDEvaluateAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpPollutionD", nodeType = NodeTypeEnum.COMMON)
    public void processRMpPollutionDEvaluateProcess(NodeComponent bindCmp) {
        CalculatedParam calculatedParam = bindCmp.getRequestData();

        pollutionService.handleDay(calculatedParam);
    }



    /********************************************算法负责人:xy***********************************************************/
    /**
     * 算法名: 3.4.1.1-----监测点报表_日表(r_stat_data_*_d)
     *
     * @author xuyang
     * @date 2023年11月09日 10:08
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataToDay", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataToDay", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess(NodeComponent bindCmp) {
        dayDataService.dataToDayHandler(bindCmp.getRequestData());
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataV", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess1(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataV", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess1(NodeComponent bindCmp) {
        dayDataService.dataVHardler(bindCmp.getRequestData());
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataI", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess2(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataI", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess2(NodeComponent bindCmp) {dayDataService.dataIHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataFlicker", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess3(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataFlicker", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess3(NodeComponent bindCmp) {dayDataService.dataFlickerHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataFluc", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess4(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataFluc", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess4(NodeComponent bindCmp) {dayDataService.dataFlucHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmPhasicI", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess5(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmPhasicI", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess5(NodeComponent bindCmp) {dayDataService.dataHarmPhasicIHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmPhasicV", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess6(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmPhasicV", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess6(NodeComponent bindCmp) {dayDataService.dataHarmPhasicVHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmPowerP", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess7(NodeComponent bindCmp) {return isAccess(bindCmp);}
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmPowerP", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess7(NodeComponent bindCmp) {dayDataService.dataHarmPowerPHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmPowerQ", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess8(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmPowerQ", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess8(NodeComponent bindCmp) {dayDataService.dataHarmPowerQHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmPowerS", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess9(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmPowerS", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess9(NodeComponent bindCmp) {dayDataService.dataHarmPowerSHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmRateI", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess10(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmRateI", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess10(NodeComponent bindCmp) {dayDataService.dataHarmRateIHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmRateV", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess11(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmRateV", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess11(NodeComponent bindCmp) {dayDataService.dataHarmRateVHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataInHarmI", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess12(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataInHarmI", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess12(NodeComponent bindCmp) {dayDataService.dataInHarmIHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataInHarmV", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess13(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataInHarmV", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess13(NodeComponent bindCmp) {dayDataService.dataInHarmVHardler(bindCmp.getRequestData());}

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataPlt", nodeType = NodeTypeEnum.COMMON)
    public boolean dataToDayAccess14(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataPlt", nodeType = NodeTypeEnum.COMMON)
    public void dataToDayProcess14(NodeComponent bindCmp) {dayDataService.dataPltHardler(bindCmp.getRequestData());}

    /**
     * 算法名: 暂无-----监测点数据完整性_日表(r_stat_integrity_d)
     *
     * @author xuyang
     * @date 2023年11月09日 10:08
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "measurementIntegrity", nodeType = NodeTypeEnum.COMMON)
    public boolean measurementIntegrityAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "measurementIntegrity", nodeType = NodeTypeEnum.COMMON)
    public void measurementIntegrityProcess(NodeComponent bindCmp) {
        integrityService.dataIntegrity(bindCmp.getRequestData());
    }

    /**
     * 算法名: 3.4.1.1-----监测点稳态指标越限次数_日表(r_stat_limit_rate_d)
     * 河北表数据较大，这边先将数据拆分计算
     * @author xuyang
     * @date 2023年11月13日 10:16
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "limitRate", nodeType = NodeTypeEnum.COMMON)
    public boolean limitRateAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "limitRate", nodeType = NodeTypeEnum.COMMON)
    public void limitRateProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
        if (Objects.equals(tag,"limitRate1")){
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 1开始执行=======》");
            //执行0点-3点
            limitRateService.limitRate(bindCmp.getRequestData(),1);
        } else if (Objects.equals(tag,"limitRate2")) {
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 2开始执行=======》");
            //执行3点-6点
            limitRateService.limitRate(bindCmp.getRequestData(),2);
        } else if (Objects.equals(tag,"limitRate3")) {
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 3开始执行=======》");
            //执行6点-9点
            limitRateService.limitRate(bindCmp.getRequestData(),3);
        } else if (Objects.equals(tag,"limitRate4")) {
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 4开始执行=======》");
            //执行9点-12点
            limitRateService.limitRate(bindCmp.getRequestData(),4);
        } else if (Objects.equals(tag,"limitRate5")) {
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 5开始执行=======》");
            //执行12点-15点
            limitRateService.limitRate(bindCmp.getRequestData(),5);
        } else if (Objects.equals(tag,"limitRate6")) {
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 6开始执行=======》");
            //执行15点-18点
            limitRateService.limitRate(bindCmp.getRequestData(),6);
        } else if (Objects.equals(tag,"limitRate7")) {
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 7开始执行=======》");
            //执行18点-21点
            limitRateService.limitRate(bindCmp.getRequestData(),7);
        } else if (Objects.equals(tag,"limitRate8")) {
            log.info(LocalDateTime.now()+"r_stat_limit_rate_d 8开始执行=======》");
            //执行21点-24点
            limitRateService.limitRate(bindCmp.getRequestData(),8);
        }
    }

    /**
     * 算法名: 暂无-----合格率统计日表(是否越限)(r_stat_limit_target_d)
     *
     * @author xuyang
     * @date 2023年11月13日 13:38
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "limitTarget", nodeType = NodeTypeEnum.COMMON)
    public boolean limitTargetAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "limitTarget", nodeType = NodeTypeEnum.COMMON)
    public void limitTargetProcess(NodeComponent bindCmp) {
        limitTargetService.limitTargetData(bindCmp.getRequestData());
    }

    /**
     * 算法名: 3.4.1.3.1-----监测点稳态指标超标明细日表1(r_mp_part_harmonic_detail_d)
     *        3.4.1.4.1-----监测点稳态指标超标明细日表1(r_mp_part_harmonic_detail_m)
     * @author xuyang
     * @date 2023年11月13日 16:18
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "partHarmonicDetail", nodeType = NodeTypeEnum.COMMON)
    public boolean partHarmonicDetailAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "partHarmonicDetail", nodeType = NodeTypeEnum.COMMON)
    public void partHarmonicDetailProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
        if (Objects.equals(tag,"r_mp_part_harmonic_detail_d")){
            //日表
            mpPartHarmonicDetailDService.insertHarmonicDetailDayOne(calculatedParam);
        } else if (Objects.equals(tag,"r_mp_part_harmonic_detail_m")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //月表
                mpPartHarmonicDetailMService.insertHarmonicDetailMonthOne(calculatedParam);
            }
        }
    }

    /**
     * 算法名: 3.4.1.3.2-----监测点稳态指标超标明细日表2(r_mp_surplus_harmonic_detail_d)
     *        3.4.1.4.2-----监测点稳态指标超标明细日表2(r_mp_surplus_harmonic_detail_m)
     *
     * @author xuyang
     * @date 2023年11月13日 16:18
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "surplusHarmonicDetail", nodeType = NodeTypeEnum.COMMON)
    public boolean surplusHarmonicDetailAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "surplusHarmonicDetail", nodeType = NodeTypeEnum.COMMON)
    public void surplusHarmonicDetailProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
        if (Objects.equals(tag,"r_mp_surplus_harmonic_detail_d")){
            //日表
            mpSurplusHarmonicDetailDService.insertHarmonicDetailDayTwo(calculatedParam);
        } else if (Objects.equals(tag,"r_mp_surplus_harmonic_detail_m")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //月表
                mpSurplusHarmonicDetailMService.insertHarmonicDetailMonthTwo(calculatedParam);
            }
        }
    }

    /**
     * 算法名: 3.4.1.6.1-----监测点谐波畸变率_日表(r_mp_v_thd)
     *
     * @author xuyang
     * @date 2023年11月13日 19:34
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpVThd", nodeType = NodeTypeEnum.COMMON)
    public boolean rMpVThdAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpVThd", nodeType = NodeTypeEnum.COMMON)
    public void rMpVThdProcess(NodeComponent bindCmp) {
        mpVThdService.insertHarmonicVThdDay(bindCmp.getRequestData());
    }

    /**
     * 算法名: 3.4.1.7.1-----监测点稳态指标差值日统计(r_mp_target_diff_d)
     *
     * @author xuyang
     * @date 2023年11月13日 19:34
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpTargetDiff", nodeType = NodeTypeEnum.COMMON)
    public boolean rMpTargetDiffAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpTargetDiff", nodeType = NodeTypeEnum.COMMON)
    public void rMpTargetDiffProcess(NodeComponent bindCmp) {
        alarmDetailService.targetDiff(bindCmp.getRequestData());
    }

    /**
     * 算法名: 3.4.1.7.2-----监测点指标告警日统计(r_mp_target_warn_d)
     * 算法名: 3.4.1.7.3-----监测点指标告警月统计(r_mp_monitor_alarm_count_m)
     * fixme r_mp_target_warn_d-----根据国网谐波平台算法文档中需进行告警的电能质量指标不包括电压暂升,但数据库有此字段,暂未统计
     * @author xuyang
     * @date 2023年11月14日 08:54
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpTargetWarn", nodeType = NodeTypeEnum.COMMON)
    public boolean rMpTargetWarnAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpTargetWarn", nodeType = NodeTypeEnum.COMMON)
    public void rMpTargetWarnProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
        if (Objects.equals(tag,"r_mp_target_warn_d")){
            //日表
            rMpTargetWarnDService.alarmDay(calculatedParam);
        } else if (Objects.equals(tag,"r_mp_target_warn_m")) {
            //数据补招不执行非日表算法
            if (!calculatedParam.isRepair()) {
                //月表
                rMpMonitorAlarmCountMService.alarmMonth(calculatedParam);
            }
        }
    }

    /**
     * 算法名: 3.3.3.1-----终端通信管理_日统计(r_stat_dev_signal_d)
     *
     * @author xuyang
     * @date 2023年11月14日 13:51
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rStatDevSignal", nodeType = NodeTypeEnum.COMMON)
    public boolean rStatDevSignalAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rStatDevSignal", nodeType = NodeTypeEnum.COMMON)
    public void rStatDevSignalProcess(NodeComponent bindCmp) {
        rStatDevSignalDPOService.devSignalD(bindCmp.getRequestData());
    }

    /**
     * 算法名: 3.3.3.2-----终端数据评价_日统计(r_mp_dev_evaluate_detail)
     *
     * @author xuyang
     * @date 2023年11月14日 16:06
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpDevEvaluateDetail", nodeType = NodeTypeEnum.COMMON)
    public boolean rMpDevEvaluateDetailAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpDevEvaluateDetail", nodeType = NodeTypeEnum.COMMON)
    public void rMpDevEvaluateDetailProcess(NodeComponent bindCmp) {
        rMpDevEvaluateDetailPOService.devEvaluateDetail(bindCmp.getRequestData());
    }

    /**
     * 算法名: 3.4.1.9.1-----监测点基准水平评估_日、月、季、年统计
     * (r_mp_benchmark_level_d、r_mp_benchmark_level_m、r_mp_benchmark_level_q、r_mp_benchmark_level_y)
     *
     * @author xuyang
     * @date 2023年11月21日 14:40
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpBenchmarkLevel", nodeType = NodeTypeEnum.COMMON)
    public boolean rMpBenchmarkLevelAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpBenchmarkLevel", nodeType = NodeTypeEnum.COMMON)
    public void rMpBenchmarkLevelProcess(NodeComponent bindCmp) {
        String tag = bindCmp.getTag();
        CalculatedParam calculatedParam = bindCmp.getRequestData();
            if (Objects.equals(tag,"r_mp_benchmark_level_d")){
            //日表
            irMpBenchmarkLevelDService.benchmarkLevelD(calculatedParam);
        } else if (Objects.equals(tag,"r_mp_benchmark_level_m")){
            if (!calculatedParam.isRepair()) {
                //月表
                irMpBenchmarkLevelMService.benchmarkLevelM(calculatedParam);
            }
        } else if (Objects.equals(tag,"r_mp_benchmark_level_q")) {
            if (!calculatedParam.isRepair()) {
                //季表
                irmBenchmarkLevelQService.benchmarkLevelQ(calculatedParam);
            }
        } else if (Objects.equals(tag,"r_mp_benchmark_level_y")) {
            if (!calculatedParam.isRepair()) {
                //年表
                irMpBenchmarkLevelYService.benchmarkLevelY(calculatedParam);
            }
        }
    }

    /**
     * 数据中心算法
     * 算法名: 暂无-----电能质量综合评估-日表
     * r_stat_comasses_d
     *
     * @author xuyang
     * @date 2023年12月06日 10:43
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rStatComasses", nodeType = NodeTypeEnum.COMMON)
    public boolean rStatComassesAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rStatComasses", nodeType = NodeTypeEnum.COMMON)
    public void rStatComassesProcess(NodeComponent bindCmp) {
        harmonicGeneralService.newGeneralData(bindCmp.getRequestData());
    }

    /**
     * 数据中心算法
     * 算法名: 暂无-----电能质量评估指标-日表
     * r_stat_asses_d
     *
     * @author xuyang
     * @date 2023年12月06日 10:49
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rStatAsses", nodeType = NodeTypeEnum.COMMON)
    public boolean rStatAssesAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rStatAsses", nodeType = NodeTypeEnum.COMMON)
    public void rStatAssesProcess(NodeComponent bindCmp) {
        harmonicMetricService.newMetricData(bindCmp.getRequestData());
    }

    /**
     * 算法名: 监测点统计表
     * r_mp_surplus_abnormal_d
     *
     * @author xuyang
     * @date 2024年10月22日 8:50
     */
    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpSurplusAbnormalD", nodeType = NodeTypeEnum.COMMON)
    public boolean rMpSurplusAbnormalDAccess(NodeComponent bindCmp) {
        return isAccess(bindCmp);
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpSurplusAbnormalD", nodeType = NodeTypeEnum.COMMON)
    public void rMpSurplusAbnormalDProcess(NodeComponent bindCmp) {
        harmonicMetricService.rMpSurplusAbnormalD(bindCmp.getRequestData());
    }

    /********************************************算法负责人:xy结束***********************************************************/
}
