package com.njcn.event.service.majornetwork.Impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.mapper.majornetwork.RStatEventOrgMMapper;
import com.njcn.event.mapper.majornetwork.RStatEventOrgQMapper;
import com.njcn.event.pojo.param.REventMParam;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventOrgY;
import com.njcn.event.mapper.majornetwork.RStatEventOrgYMapper;
import com.njcn.event.pojo.vo.DeptLevelVO;
import com.njcn.event.pojo.vo.RArrayVO;
import com.njcn.event.pojo.vo.RStatEventMVO;
import com.njcn.event.pojo.vo.RStatEventVO;
import com.njcn.event.service.majornetwork.RStatEventOrgYService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.event.utils.DeptUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author rui.wu
 * @since 2022-10-17
 */
@Service
@RequiredArgsConstructor
public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper, RStatEventOrgY> implements RStatEventOrgYService {

    private final DicDataFeignClient dicDataFeignClient;
    private final DeptFeignClient deptFeignClient;
    private final RStatEventOrgYMapper statEventOrgYMapper;
    private final RStatEventOrgQMapper statEventOrgQMapper;
    private final RStatEventOrgMMapper statEventOrgMMapper;

    @Override
    public List<RArrayVO> getRStatEventOrgYAll(StatisticsBizBaseParam param) {
        //对象主节点 获取所有得指标类型
        List<DictData> steadyData = dicDataFeignClient.getDicDataByTypeCode
                (DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
        List<String> steadyDataIds = steadyData.stream().map(DictData::getId).collect(Collectors.toList());
        Map<String, DictData> lineTypeMap = steadyData.stream()
                .collect(Collectors.toMap(DictData::getId, Function.identity()));

        //子节点 获取所有得各单位类型
        List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
        //获取子部门(按照code改变数据结构)
        List<DeptLevelVO> deptLevelVOList = DeptUtil.getDeptLevelVOList(deptDTOList, param.getId());
        Map<String, DeptLevelVO> deptMap = deptLevelVOList.stream().collect(Collectors.toMap(DeptLevelVO::getCode, Function.identity()));

        //获取主网id信息
        DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();

        StatSubstationBizBaseParam baseParam;
        //初始化指标类型（横向）
        List<RArrayVO> arrayVOList = new ArrayList<>();
        List<RStatEventVO> newList=new ArrayList<>();
        for (DeptLevelVO deptLevelVO : deptLevelVOList) {
            //数据库查询
            baseParam=BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
            //没有子部门说明就是最底层部门
            if(CollUtil.isNotEmpty(deptLevelVO.getDeptList())){
                List<String> deptCodeS = deptLevelVO.getDeptList().stream().map(DeptLevelVO::getCode).collect(Collectors.toList());
                baseParam.setIds(deptCodeS);
            }else{
                baseParam.setIds(Arrays.asList(deptLevelVO.getCode()));
            }
            //区分 年 季 月
            String string = param.getType().toString();
            List<RStatEventVO> list = new ArrayList<>();
            switch (string) {
                //查询各单位累计超标监测点数-年数据
                case BizParamConstant.STAT_BIZ_YEAR:
                    list = statEventOrgYMapper.selectInfoList(baseParam,steadyDataIds,mainnetData.getId());
                    break;
                //查询各单位累计超标监测点数-季数据
                case BizParamConstant.STAT_BIZ_QUARTER:
                    list = statEventOrgQMapper.selectInfoList(baseParam,steadyDataIds,mainnetData.getId());
                    break;
                //查询各单位累计超标监测点数-月数据
                case BizParamConstant.STAT_BIZ_MONTH:
                    list = statEventOrgMMapper.selectInfoList(baseParam,steadyDataIds,mainnetData.getId());
                    break;
                default:
                    break;
            }
            //获取数据库数据
            Map<String, RStatEventVO> orgMap = list.stream()
                    .collect(Collectors.toMap(RStatEventVO::getEventType, Function.identity()));

            List<DictData> notMeasurementList = steadyData.stream().filter(r -> !orgMap.containsKey(r.getId()))
                    .collect(Collectors.toList());
            for (RStatEventVO org : list) {
                org.setOrgNo(deptLevelVO.getCode());
            }
            RStatEventVO org;
            for (DictData notData : notMeasurementList) {
                org=new RStatEventVO();
                org.setOrgNo(deptLevelVO.getCode());
                org.setEventType(notData.getId());
                org.setEventMeasurementAverage(0);
                org.setEventMeasurementAccrued(0);
                org.setEventFreq(0.0F);
                org.setEventCount(0);
                org.setEventMeasurementRatioAverage(0.0F);
                org.setEventMeasurementRatioAccrued(0.0F);
                list.add(org);
            }
            newList.addAll(list);
        }

        Map<String, List<RStatEventVO>> harmonicMap =
                newList.stream().collect(Collectors.groupingBy(RStatEventVO::getEventType));

        //重新生成数据结构
        harmonicMap.forEach((key, value) -> {
            if(lineTypeMap.containsKey(key)){
                RArrayVO  arrayVO=new RArrayVO();
                DictData data = lineTypeMap.get(key);
                arrayVO.setRowName(data.getName());
                arrayVO.setSort(data.getSort());
                List<RStatEventMVO> b=new ArrayList<>();
                for (RStatEventVO orgY : value) {
                    RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
                    DeptLevelVO data1 = deptMap.get(orgY.getOrgNo());
                    if (ObjectUtil.isNotNull(data1)){
                        r.setEventName(data1.getName());
                        r.setSort(data1.getSort());
                        b.add(r);
                    }
                }
                b.sort(Comparator.comparing(rStatHarmonicMVO -> rStatHarmonicMVO.getSort()));
                arrayVO.setColumns(b);
                arrayVOList.add(arrayVO);
            }
        });
        arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
        return arrayVOList;
    }

    @Override
    public List<RStatEventMVO> getRStatHarmonicOrgYIcon(REventMParam param) {
        //各单位
        List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
        List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());


        Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
        //获取部门id集合
        List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
        //指标对象类型属性
        DictData eventData;
        //判断是是否传入检测点信息值（电压）
        if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
            //指标对象类型
            List<DictData> indicatorTypeData = dicDataFeignClient.getDicDataByTypeCode(
                    DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
            indicatorTypeData.sort(Comparator.comparing(data -> data.getSort()));
            eventData = indicatorTypeData.get(0);
        } else {
            //获取指标对象（频率偏差）
            eventData = dicDataFeignClient.getDicDataById(
                    param.getStasisID()).getData();
        }
        //反防止参数查询数据报错
        Assert.isTrue(
                CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
                , "各单位或者指标类型为空,请检查入参是否准确");
        //获取主网id信息
        DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();

        //初始化对象
        List<RStatEventMVO> arrayVOList = new ArrayList<>();
        List<RStatEventOrgY> rStatHarmonicVoltageMS = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
                .eq(RStatEventOrgY::getDataType, mainnetData.getId())
                .in(RStatEventOrgY::getOrgNo, deptIds)
                .eq(RStatEventOrgY::getEventType, eventData.getId())
                .ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgY::getDataDate, param.getStartTime())
                .le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgY::getDataDate, param.getEndTime())
        );
        //将数据转换为map进行便利
        Map<String, List<RStatEventOrgY>> voltageMMap = rStatHarmonicVoltageMS.stream()
                .collect(Collectors.groupingBy(RStatEventOrgY::getOrgNo));
        //对象
        if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
            voltageMMap.forEach((key, value) -> {
                if (deptMap.containsKey(key)) {
                    DeptDTO data = deptMap.get(key);
                    for (RStatEventOrgY orgY : value) {
                        RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
                        rStatEventMVO.setEventName(data.getName());
                        rStatEventMVO.setSort(data.getSort());
                        arrayVOList.add(rStatEventMVO);
                    }

                }
            });
        }
        //处理主节点不存在的集合
        List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
                .collect(Collectors.toList());
        for (DeptDTO notData : notMeasurementList) {
            RStatEventMVO iconVO = new RStatEventMVO();
            iconVO.setSort(notData.getSort());
            iconVO.setEventName(notData.getName());
            iconVO.setEventMeasurementAverage(0.0F);
            iconVO.setEventMeasurementAccrued(0);
            iconVO.setEventFreq(0.0F);
            iconVO.setEventCount(0);
            iconVO.setEventMeasurementRatioAverage(0.0F);
            iconVO.setEventMeasurementRatioAccrued(0.0F);
            arrayVOList.add(iconVO);
        }
        arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
        return arrayVOList;
    }

    @Override
    public List<RArrayVO> getPwRStatEventOrgYAll(StatisticsBizBaseParam param) {
        //对象主节点 获取所有得暂降类型
        List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
                DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
        Map<String, DictData> eventMap = eventData.stream()
                .collect(Collectors.toMap(DictData::getId, Function.identity()));

        //子节点 获取所有得各单位类型
        List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
        //获取部门id集合
        List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
        Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));

        //获取配网信息
        DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();

        //数据库查询
        List<RStatEventOrgY> list = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
                .eq(RStatEventOrgY::getDataType, distributionData.getId())
                .in(RStatEventOrgY::getOrgNo, deptIds)
                .ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgY::getDataDate, param.getStartTime())
                .le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgY::getDataDate, param.getEndTime()));

        //初始化指标类型（横向）
        List<RArrayVO> arrayVOList = new ArrayList<>();
        //根据检测点对象分组
        Map<String, List<RStatEventOrgY>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
        //判断对象是否为空
        if (CollUtil.isNotEmpty(list)) {
            //重新生成数据结构
            measurementTypeClassMap.forEach((key, value) -> {
                if (eventMap.containsKey(key)) {
                    List<RStatEventMVO> eventVO = new ArrayList<>();
                    RArrayVO arrayVO = new RArrayVO();
                    DictData data = eventMap.get(key);
                    arrayVO.setRowName(data.getName());
                    arrayVO.setSort(data.getSort());
                    for (RStatEventOrgY orgY : value) {
                        if (deptMap.containsKey(orgY.getOrgNo())) {
                            RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
                            DeptDTO deptDTO = deptMap.get(orgY.getOrgNo());
                            r.setEventName(deptDTO.getName());
                            r.setSort(deptDTO.getSort());
                            eventVO.add(r);
                        }

                    }
                    //根据监测点类别获取差集
                    Map<String, List<RStatEventOrgY>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
                    List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
                            .collect(Collectors.toList());
                    this.assignDept(notDeptList, eventVO, arrayVO);
                    eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
                    arrayVOList.add(arrayVO);
                }
            });
        }

        //处理主节点不存在的集合
        List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementTypeClassMap.containsKey(r.getId()))
                .collect(Collectors.toList());
        for (DictData notData : notMeasurementList) {
            List<RStatEventMVO> eventVO = new ArrayList<>();
            RArrayVO arrayVO = new RArrayVO();
            arrayVO.setRowName(notData.getName());
            arrayVO.setSort(notData.getSort());
            this.assignDept(deptDTOList, eventVO, arrayVO);
            eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
            arrayVOList.add(arrayVO);
        }
        arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
        return arrayVOList;
    }

    @Override
    public List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param) {
        //各单位
        List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
        List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());


        Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
        //获取部门id集合
        List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
        //指标对象类型属性
        DictData eventData;
        //判断是是否传入检测点信息值（电压）
        if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
            //指标对象类型
            List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
                    DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
            indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
            eventData = indicatorTypeDate.get(0);
        } else {
            //获取指标对象（频率偏差）
            eventData = dicDataFeignClient.getDicDataById(
                    param.getStasisID()).getData();
        }
        //反防止参数查询数据报错
        Assert.isTrue(
                CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
                , "各单位或者指标类型为空,请检查入参是否准确");
        //获取配网信息
        DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();

        //初始化对象
        List<RStatEventMVO> arrayVOList = new ArrayList<>();
        List<RStatEventOrgY> rStatHarmonicVoltageMS = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
                .eq(RStatEventOrgY::getDataType, distributionData.getId())
                .in(RStatEventOrgY::getOrgNo, deptIds)
                .eq(RStatEventOrgY::getEventType, eventData.getId())
                .ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgY::getDataDate, param.getStartTime())
                .le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgY::getDataDate, param.getEndTime())
        );
        //将数据转换为map进行便利
        Map<String, List<RStatEventOrgY>> voltageMMap = rStatHarmonicVoltageMS.stream()
                .collect(Collectors.groupingBy(RStatEventOrgY::getOrgNo));
        //对象
        if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
            voltageMMap.forEach((key, value) -> {
                if (deptMap.containsKey(key)) {
                    DeptDTO data = deptMap.get(key);
                    for (RStatEventOrgY orgY : value) {
                        RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
                        rStatEventMVO.setEventName(data.getName());
                        rStatEventMVO.setSort(data.getSort());
                        arrayVOList.add(rStatEventMVO);
                    }

                }
            });
        }
        //处理主节点不存在的集合
        List<DeptDTO> notMeasurementList = deptDTOList.stream().filter(r -> !voltageMMap.containsKey(r.getCode()))
                .collect(Collectors.toList());
        for (DeptDTO notData : notMeasurementList) {
            RStatEventMVO iconVO = new RStatEventMVO();
            iconVO.setSort(notData.getSort());
            iconVO.setEventName(notData.getName());
            iconVO.setEventMeasurementAverage(0.0F);
            iconVO.setEventMeasurementAccrued(0);
            iconVO.setEventFreq(0.0F);
            iconVO.setEventCount(0);
            iconVO.setEventMeasurementRatioAverage(0.0F);
            iconVO.setEventMeasurementRatioAccrued(0.0F);
            arrayVOList.add(iconVO);
        }
        arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
        return arrayVOList;

    }

    @Override
    public List<RArrayVO> getRStatEventOrgOldYAll(StatisticsBizBaseParam param, Integer type) {
        //对象主节点 获取所有得暂降类型
        List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
                DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
        Map<String, DictData> eventMap = eventData.stream()
                .collect(Collectors.toMap(DictData::getId, Function.identity()));

        //子节点 获取所有得各单位类型
        List<DeptDTO> deptList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
        List<DeptDTO> deptDTOList= DeptUtil.getDeptSubsetVOList(deptList,param.getId());

        //获取部门id集合
        List<String> deptIds = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
        Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));

        DictData dictData ;
        if(type==1){
            //获取主网信息
            dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
        }else{
            //获取配网信息
            dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
        }
        //数据库查询
        List<RStatEventOrgY> list = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
                .eq(RStatEventOrgY::getDataType, dictData.getId())
                .in(RStatEventOrgY::getOrgNo, deptIds)
                .ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgY::getDataDate, param.getStartTime())
                .le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgY::getDataDate, param.getEndTime()));

        //初始化指标类型（横向）
        List<RArrayVO> arrayVOList = new ArrayList<>();
        //根据检测点对象分组
        Map<String, List<RStatEventOrgY>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
        //判断对象是否为空
        if (CollUtil.isNotEmpty(list)) {
            //重新生成数据结构
            measurementTypeClassMap.forEach((key, value) -> {
                if (eventMap.containsKey(key)) {
                    List<RStatEventMVO> eventVO = new ArrayList<>();
                    RArrayVO arrayVO = new RArrayVO();
                    DictData data = eventMap.get(key);
                    arrayVO.setRowName(data.getName());
                    arrayVO.setSort(data.getSort());
                    for (RStatEventOrgY org : value) {
                        if(deptMap.containsKey(org.getOrgNo())){
                            RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
                            DeptDTO deptDTO = deptMap.get(org.getOrgNo());
                            r.setEventName(deptDTO.getName());
                            r.setSort(deptDTO.getSort());
                            eventVO.add(r);
                        }

                    }
                    //根据监测点类别获取差集
                    Map<String, List<RStatEventOrgY>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventOrgY::getOrgNo));
                    List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getCode()))
                            .collect(Collectors.toList());
                    this.assignDept(notDeptList, eventVO, arrayVO);
                    eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
                    arrayVOList.add(arrayVO);
                }
            });
        }

        //处理主节点不存在的集合
        List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementTypeClassMap.containsKey(r.getId()))
                .collect(Collectors.toList());
        for (DictData notData : notMeasurementList) {
            List<RStatEventMVO> eventVO = new ArrayList<>();
            RArrayVO arrayVO = new RArrayVO();
            arrayVO.setRowName(notData.getName());
            arrayVO.setSort(notData.getSort());
            this.assignDept(deptDTOList, eventVO, arrayVO);
            eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
            arrayVOList.add(arrayVO);
        }
        arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
        return arrayVOList;
    }

    /**
     * 便利赋值
     *
     * @param deptDTOList 部门集合
     * @param eventVO     暂态监测点
     * @param arrayVO     初始化对象
     */
    private void assignDept(List<DeptDTO> deptDTOList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
        for (DeptDTO dictData : deptDTOList) {
            RStatEventMVO notEventVO = new RStatEventMVO();
            notEventVO.setEventName(dictData.getName());
            notEventVO.setSort(dictData.getSort());
            notEventVO.setEventMeasurementAverage(0.0F);
            notEventVO.setEventMeasurementAccrued(0);
            notEventVO.setEventFreq(0.0F);
            notEventVO.setEventCount(0);
            notEventVO.setEventMeasurementRatioAverage(0.0F);
            notEventVO.setEventMeasurementRatioAccrued(0.0F);
            eventVO.add(notEventVO);
        }
        arrayVO.setColumns(eventVO);
    }
}
