package com.njcn.prepare.harmonic.service.mysql.Impl;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.pojo.po.RStatEventVoltageDPO;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import com.njcn.prepare.harmonic.pojo.po.RDimStationTargetDPO;
import com.njcn.prepare.harmonic.mapper.mysql.area.RDimStationTargetDPOMapper;
import com.njcn.prepare.harmonic.service.mysql.RDimStationTargetDPOService;

import java.text.DecimalFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 
 * Description:
 * Date: 2023/11/20  9:49【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Service
@RequiredArgsConstructor
public class RDimStationTargetDPOServiceImpl extends MppServiceImpl<RDimStationTargetDPOMapper, RDimStationTargetDPO> implements RDimStationTargetDPOService{
    private final DicDataFeignClient dicDataFeignClient;

    @Override
    public void handleDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
        List<RStatEventVoltageDPO> rStatEventVoltageDPOS = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("0.00");
        LocalDate localDate = LocalDateTimeUtil.parseDate(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);


        /*获取暂态统计指标*/
        List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();

        /*获取数据类型*/
        List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
        Map<String, DictData> dataTypeMap = dataTypeList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));

        /*获取监测点类型类型*/
        List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
        Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getCode, dictData -> dictData));

        /*获取监测点电压等级*/
        List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
        Map<String, DictData> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getValue, dictData -> dictData));


    }
}
