package com.ho.business.util.region;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ho.business.entity.IndustrialElecPrice;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Region27 implements  Region{

    public  List<IndustrialElecPrice> getList(JSONArray array,Integer regionId, String spikePriceInterval,
                                              String peakPriceInterval, String regularPriceInterval, String lowValleyPriceInterval,
                                              String deepValleyPriceInterval,String executionTime) {
        /**
         * 湖北省的电价是按公式计算出来的
         */
        List<IndustrialElecPrice> list = new ArrayList<>();
        JSONObject jsonObject = array.getJSONObject(array.size() - 1);
        Integer rowStart = jsonObject.getInteger("row_start");
        //IndustrialElecPrice industrialElecPrice = new IndustrialElecPrice();

        //枯水期  220/380  10千伏  35千伏 110千伏及以上
        if ("01".equals(executionTime.split("-")[1])||"02".equals(executionTime.split("-")[1])||"03".equals(executionTime.split("-")[1])||"04".equals(executionTime.split("-")[1])||"11".equals(executionTime.split("-")[1])||"12".equals(executionTime.split("-")[1])){
            IndustrialElecPrice industrialElecPrice = new IndustrialElecPrice();
            industrialElecPrice.setVoltageLevel(19);
            industrialElecPrice.setCustomerType(1);
            industrialElecPrice.setElectricityType(4);
            industrialElecPrice.setRegularPrice(new BigDecimal(array.getJSONObject(68).getString("words")));

//            industrialElecPrice1.setSpikePriceInterval(spikePriceInterval);
//            industrialElecPrice1.setPeakPriceInterval(peakPriceInterval);
//            industrialElecPrice1.setRegularPriceInterval(regularPriceInterval);
//            industrialElecPrice1.setLowValleyPriceInterval(lowValleyPriceInterval);
//            industrialElecPrice1.setDeepValleyPriceInterval(deepValleyPriceInterval);
//            industrialElecPrice1.setExecutionTime(executionTime);
//            industrialElecPrice1.setCreateTime(new Date());
//
            list.add(industrialElecPrice);

            IndustrialElecPrice industrialElecPrice8 = new IndustrialElecPrice();
            industrialElecPrice8.setVoltageLevel(4);
            industrialElecPrice8.setCustomerType(2);
            industrialElecPrice8.setElectricityType(4);
            industrialElecPrice8.setRegularPrice(new BigDecimal(array.getJSONObject(69).getString("words")));
            list.add(industrialElecPrice8);

            IndustrialElecPrice industrialElecPrice2 = new IndustrialElecPrice();
            industrialElecPrice2.setVoltageLevel(4);
            industrialElecPrice2.setPeakPrice(new BigDecimal(array.getJSONObject(18).getString("words")));
            industrialElecPrice2.setSpikePrice(new BigDecimal(array.getJSONObject(20).getString("words")));
            industrialElecPrice2.setCustomerType(2);
            industrialElecPrice2.setElectricityType(4);
            industrialElecPrice2.setRegularPrice(new BigDecimal(array.getJSONObject(16).getString("words")));
            list.add(industrialElecPrice2);


            IndustrialElecPrice industrialElecPrice3 = new IndustrialElecPrice();
            industrialElecPrice3.setVoltageLevel(8);
            industrialElecPrice3.setPeakPrice(new BigDecimal(array.getJSONObject(23).getString("words")));
            industrialElecPrice3.setSpikePrice(new BigDecimal(array.getJSONObject(25).getString("words")));
            industrialElecPrice3.setCustomerType(2);
            industrialElecPrice3.setElectricityType(4);
            industrialElecPrice3.setRegularPrice(new BigDecimal(array.getJSONObject(21).getString("words")));
            list.add(industrialElecPrice3);


            IndustrialElecPrice industrialElecPrice4 = new IndustrialElecPrice();
            industrialElecPrice4.setVoltageLevel(14);
            industrialElecPrice4.setPeakPrice(new BigDecimal(array.getJSONObject(28).getString("words")));
            industrialElecPrice4.setSpikePrice(new BigDecimal(array.getJSONObject(30).getString("words")));
            industrialElecPrice4.setCustomerType(2);
            industrialElecPrice4.setElectricityType(4);
            industrialElecPrice4.setRegularPrice(new BigDecimal(array.getJSONObject(26).getString("words")));
            list.add(industrialElecPrice4);

            IndustrialElecPrice industrialElecPrice5 = new IndustrialElecPrice();
            industrialElecPrice5.setVoltageLevel(4);
            industrialElecPrice5.setPeakPrice(new BigDecimal(array.getJSONObject(48).getString("words")));
            industrialElecPrice5.setSpikePrice(new BigDecimal(array.getJSONObject(50).getString("words")));
            industrialElecPrice5.setCustomerType(2);
            industrialElecPrice5.setElectricityType(4);
            industrialElecPrice5.setRegularPrice(new BigDecimal(array.getJSONObject(46).getString("words")));
            list.add(industrialElecPrice5);


            IndustrialElecPrice industrialElecPrice6 = new IndustrialElecPrice();
            industrialElecPrice3.setVoltageLevel(8);
            industrialElecPrice3.setPeakPrice(new BigDecimal(array.getJSONObject(53).getString("words")));
            industrialElecPrice3.setSpikePrice(new BigDecimal(array.getJSONObject(55).getString("words")));
            industrialElecPrice3.setCustomerType(2);
            industrialElecPrice3.setElectricityType(4);
            industrialElecPrice3.setRegularPrice(new BigDecimal(array.getJSONObject(51).getString("words")));
            list.add(industrialElecPrice6);


            IndustrialElecPrice industrialElecPrice7 = new IndustrialElecPrice();
            industrialElecPrice4.setVoltageLevel(14);
            industrialElecPrice4.setPeakPrice(new BigDecimal(array.getJSONObject(58).getString("words")));
            industrialElecPrice4.setSpikePrice(new BigDecimal(array.getJSONObject(60).getString("words")));
            industrialElecPrice4.setCustomerType(2);
            industrialElecPrice4.setElectricityType(4);
            industrialElecPrice4.setRegularPrice(new BigDecimal(array.getJSONObject(56).getString("words")));
            list.add(industrialElecPrice7);
        }


        return list;
    }
}
