package com.ho.business.util.region;

import com.alibaba.fastjson.JSONArray;
import com.ho.business.entity.IndustrialElecPrice;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Region48 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<>();

//        String capacityPrice=array.getJSONObject(9).getString("words");
//        String demandPrice=array.getJSONObject(10).getString("words");

//        String capacityPrice2=array.getJSONObject(101).getString("words");
//        String demandPrice2=array.getJSONObject(102).getString("words");
        int a=0;
        for (int i = 0; i <10 ; i++) {
            IndustrialElecPrice industrialElecPrice1 = new IndustrialElecPrice();
            if(i<2){
                industrialElecPrice1.setVoltageLevel(5);
            }else if(i>1&&i<4){
                industrialElecPrice1.setVoltageLevel(6);
            }else if(i>3&&i<6){
                industrialElecPrice1.setVoltageLevel(7);
            }else if(i>5&&i<8){
                industrialElecPrice1.setVoltageLevel(12);
            }else{
                industrialElecPrice1.setVoltageLevel(16);
            }

            if(i%2==0){
                industrialElecPrice1.setElectricityType(5);
            }else{
                industrialElecPrice1.setElectricityType(6);
            }
            industrialElecPrice1.setCustomerType(3);
            industrialElecPrice1.setSpikePriceInterval(spikePriceInterval);
            industrialElecPrice1.setPeakPriceInterval(peakPriceInterval);
            industrialElecPrice1.setRegularPriceInterval(regularPriceInterval);
            industrialElecPrice1.setLowValleyPriceInterval(lowValleyPriceInterval);
            industrialElecPrice1.setDeepValleyPriceInterval(deepValleyPriceInterval);
            industrialElecPrice1.setExecutionTime(executionTime);
            industrialElecPrice1.setNonTimePrice(new BigDecimal(array.getJSONObject(0+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setProxyPrice(new BigDecimal(array.getJSONObject(1+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setTransmissionPrice(new BigDecimal(array.getJSONObject(2+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setRunningPrice(new BigDecimal(array.getJSONObject(3+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setAddPrice(new BigDecimal(array.getJSONObject(4+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setSpikePrice(new BigDecimal(array.getJSONObject(5+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setPeakPrice(new BigDecimal(array.getJSONObject(6+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setRegularPrice(new BigDecimal(array.getJSONObject(7+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setLowValleyPrice(new BigDecimal(array.getJSONObject(8+a).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice1.setCapacityPrice(new BigDecimal(48));
            industrialElecPrice1.setDemandPrice(new BigDecimal(32));
            industrialElecPrice1.setCreateTime(new Date());
            industrialElecPrice1.setRegionId(regionId);
            a=a+9;
            list.add(industrialElecPrice1);
        }


        int b=0;
        for (int i = 0; i <10 ; i++) {
            IndustrialElecPrice industrialElecPrice2 = new IndustrialElecPrice();
            if(i<2){
                industrialElecPrice2.setVoltageLevel(5);
            }else if(i>1&&i<4){
                industrialElecPrice2.setVoltageLevel(6);
            }else if(i>3&&i<6){
                industrialElecPrice2.setVoltageLevel(7);
            }else if(i>5&&i<8){
                industrialElecPrice2.setVoltageLevel(12);
            }else{
                industrialElecPrice2.setVoltageLevel(16);
            }
            if(i%2==0){
                industrialElecPrice2.setElectricityType(7);
            }else{
                industrialElecPrice2.setElectricityType(8);
            }
            industrialElecPrice2.setCustomerType(4);
            industrialElecPrice2.setSpikePriceInterval(spikePriceInterval);
            industrialElecPrice2.setPeakPriceInterval(peakPriceInterval);
            industrialElecPrice2.setRegularPriceInterval(regularPriceInterval);
            industrialElecPrice2.setLowValleyPriceInterval(lowValleyPriceInterval);
            industrialElecPrice2.setDeepValleyPriceInterval(deepValleyPriceInterval);
            industrialElecPrice2.setExecutionTime(executionTime);
            industrialElecPrice2.setNonTimePrice(new BigDecimal(array.getJSONObject(90+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setProxyPrice(new BigDecimal(array.getJSONObject(91+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setTransmissionPrice(new BigDecimal(array.getJSONObject(92+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setRunningPrice(new BigDecimal(array.getJSONObject(93+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setAddPrice(new BigDecimal(array.getJSONObject(94+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setSpikePrice(new BigDecimal(array.getJSONObject(95+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setPeakPrice(new BigDecimal(array.getJSONObject(96+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setRegularPrice(new BigDecimal(array.getJSONObject(97+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setLowValleyPrice(new BigDecimal(array.getJSONObject(98+b).getString("words")).divide(new BigDecimal(100)));
            industrialElecPrice2.setCapacityPrice(new BigDecimal(42));
            industrialElecPrice2.setDemandPrice(new BigDecimal(32));
            industrialElecPrice2.setCreateTime(new Date());
            industrialElecPrice2.setRegionId(regionId);
            b=b+9;
            list.add(industrialElecPrice2);
        }

        IndustrialElecPrice industrialElecPrice3 = new IndustrialElecPrice();
        industrialElecPrice3.setElectricityType(1);
        industrialElecPrice3.setCustomerType(5);
        industrialElecPrice3.setNonTimePrice(new BigDecimal(array.getJSONObject(180).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setProxyPrice(new BigDecimal(array.getJSONObject(181).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setTransmissionPrice(new BigDecimal(array.getJSONObject(182).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setRunningPrice(new BigDecimal(array.getJSONObject(183).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setAddPrice(new BigDecimal(array.getJSONObject(184).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setSpikePrice(new BigDecimal(array.getJSONObject(185).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setPeakPrice(new BigDecimal(array.getJSONObject(186).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setRegularPrice(new BigDecimal(array.getJSONObject(187).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setLowValleyPrice(new BigDecimal(array.getJSONObject(188).getString("words")).divide(new BigDecimal(100)));
        industrialElecPrice3.setCreateTime(new Date());
        industrialElecPrice3.setRegionId(regionId);
        industrialElecPrice3.setSpikePriceInterval(spikePriceInterval);
        industrialElecPrice3.setPeakPriceInterval(peakPriceInterval);
        industrialElecPrice3.setRegularPriceInterval(regularPriceInterval);
        industrialElecPrice3.setLowValleyPriceInterval(lowValleyPriceInterval);
        industrialElecPrice3.setDeepValleyPriceInterval(deepValleyPriceInterval);
        industrialElecPrice3.setExecutionTime(executionTime);
        list.add(industrialElecPrice3);
       return list;
    }
}
