package com.ruoyi.project.production.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.poi.POIConstants;
import com.ruoyi.common.utils.poi.PoiWordTools;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlCursor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.production.mapper.TMonthplanMapper;
import com.ruoyi.project.production.domain.TMonthplan;
import com.ruoyi.project.production.service.ITMonthplanService;

import javax.annotation.Resource;

/**
 * 生产计划及月报Service业务层处理
 *
 * @author ruoyi
 * @date 2020-11-26
 */
@Service
public class TMonthplanServiceImpl implements ITMonthplanService
{
    @Resource
    private TMonthplanMapper tMonthplanMapper;

    /**
     * 查询生产计划及月报
     *
     * @param id 生产计划及月报ID
     * @return 生产计划及月报
     */
    @Override
    public TMonthplan selectTMonthplanById(Long id)
    {
        return tMonthplanMapper.selectTMonthplanById(id);
    }

    /**
     * 查询生产计划及月报列表
     *
     * @param tMonthplan 生产计划及月报
     * @return 生产计划及月报
     */
    @Override
    public List<TMonthplan> selectTMonthplanList(TMonthplan tMonthplan)
    {
        return tMonthplanMapper.selectTMonthplanList(tMonthplan);
    }

    /**
     * 新增生产计划及月报
     *
     * @param tMonthplan 生产计划及月报
     * @return 结果
     */
    @Override
    public int insertTMonthplan(TMonthplan tMonthplan)
    {
        return tMonthplanMapper.insertTMonthplan(tMonthplan);
    }

    /**
     * 修改生产计划及月报
     *
     * @param tMonthplan 生产计划及月报
     * @return 结果
     */
    @Override
    public int updateTMonthplan(TMonthplan tMonthplan)
    {
        return tMonthplanMapper.updateTMonthplan(tMonthplan);
    }

    /**
     * 批量删除生产计划及月报
     *
     * @param ids 需要删除的生产计划及月报ID
     * @return 结果
     */
    @Override
    public int deleteTMonthplanByIds(Long[] ids)
    {
        return tMonthplanMapper.deleteTMonthplanByIds(ids);
    }

    /**
     * 删除生产计划及月报信息
     *
     * @param id 生产计划及月报ID
     * @return 结果
     */
    @Override
    public int deleteTMonthplanById(Long id)
    {
        return tMonthplanMapper.deleteTMonthplanById(id);
    }

    @Override
    public void dealMonthplan(XWPFDocument doc, XWPFParagraph paragraph, XWPFRun run, List<TMonthplan> list,int item) {
        List<TMonthplan> itemList = getItemDatas(list, item);
        if(CollectionUtils.isNotEmpty(itemList)){
            run.setText("", 0);
            XmlCursor cursor = paragraph.getCTP().newCursor();
            XWPFTable tableOne = doc.insertNewTbl(cursor);// ---这个是关键
            // 设置表格宽度，第一行宽度就可以了，这个值的单位，目前我也还不清楚，还没来得及研究
            tableOne.setWidth(8500);
            // 表格第一行，对于每个列，必须使用createCell()，而不是getCell()，因为第一行嘛，肯定是属于创建的，没有create哪里来的get呢
            XWPFTableRow tableOneRowOne = tableOne.getRow(0);// 行
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.getCell(0), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL,POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "序号");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "年度");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Jan");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Feb");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Mar");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Apr");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "May");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Jun");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Jul");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Aug");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Sep");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Oct");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Nov");
            PoiWordTools.setWordCellSelfStyle(tableOneRowOne.createCell(), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_TITLE_COLOR, POIConstants.CELL_WIDTH, "Dec");
            if (CollectionUtils.isNotEmpty(itemList)) {
                for (int i = 0; i < itemList.size(); i++) {
                    // 表格第二行
                    XWPFTableRow tableOneRowTwo = tableOne.createRow();// 行
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(0), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(i + 1));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(1), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getYear()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(2), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getJan()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(3), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getFeb()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(4), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getMar()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(5), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getApr()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(6), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getMay()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(7), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getJun()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(8), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getJul()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(9), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getAug()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(10), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getSep()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(11), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getOct()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(12), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getNov()));
                    PoiWordTools.setWordCellSelfStyle(tableOneRowTwo.getCell(13), POIConstants.FONT_NAME, POIConstants.FONT_SIAZE, POIConstants.FONT_BOLD, POIConstants.ALIGNMENT,POIConstants.VERTICAL, POIConstants.FONT_COLOR, POIConstants.BG_COLOR, POIConstants.CELL_WIDTH, String.valueOf(itemList.get(i).getDec()));
                }
            }
        }
    }

    @Override
    public void doChartsYX(Map<String, POIXMLDocumentPart> chartsMap, List<TMonthplan> monList,int item) {
        List<String> fldNameArr = getFourFieldNameArr();
        // 数据集合
        List<TMonthplan> itemList = getItemDatas(monList, item);
        List<String> titleArr = new ArrayList<String>(){{
            add("title");
            add(itemList.get(0).getEthylene());
            add(itemList.get(1).getEthylene());
            add(itemList.get(2).getEthylene());
        }};
        if(CollectionUtils.isNotEmpty(itemList)){
            List<Map<String, String>> listItemsByType = getListThreeItems(itemList);
            // 折线图+柱状图
            POIXMLDocumentPart poixmlDocumentPart1 = chartsMap.get("/word/charts/chart1.xml");
            PoiWordTools.replaceCombinationCharts(poixmlDocumentPart1,titleArr, fldNameArr, listItemsByType,1,3);
        }
    }

    @Override
    public void doChartsFT(Map<String, POIXMLDocumentPart> chartsMap,List<TMonthplan> monList,int item) {
        List<String> fldNameArr = getFourFieldNameArr();
        // 数据集合
        List<TMonthplan> itemList = getItemDatas(monList, item);
        List<String> titleArr = new ArrayList<String>(){{
            add("title");
            add(itemList.get(0).getBtx());
            add(itemList.get(1).getBtx());
            add(itemList.get(2).getBtx());
        }};
        if(CollectionUtils.isNotEmpty(itemList)){
            List<Map<String, String>> listItemsByType = getListThreeItems(itemList);
            // 折线图+柱状图
            POIXMLDocumentPart poixmlDocumentPart2 = chartsMap.get("/word/charts/chart2.xml");
            PoiWordTools.replaceCombinationCharts(poixmlDocumentPart2,titleArr, fldNameArr, listItemsByType,1,3);
        }
    }

    @SuppressWarnings("serial")
    @Override
    public void doChartsCN(Map<String, POIXMLDocumentPart> chartsMap, List<TMonthplan> monList,int item) {
        List<String> fldNameArr = getThreeFieldNameArr();
        // 数据集合
        List<TMonthplan> itemList = getItemDatas(monList, item);
        List<String> titleArr = new ArrayList<String>(){{
            add("title");
            add(itemList.get(0).getKpi());
            add(itemList.get(1).getKpi());
        }};
        if(CollectionUtils.isNotEmpty(itemList)){
            List<Map<String, String>> listItemsByType = getListTwoItems(itemList);
            // 折线图+柱状图
            POIXMLDocumentPart poixmlDocumentPart3 = chartsMap.get("/word/charts/chart3.xml");
            PoiWordTools.replaceCombinationCharts(poixmlDocumentPart3,titleArr, fldNameArr, listItemsByType,1,2);
        }
    }

    @SuppressWarnings("serial")
    @Override
    public void doChartsNYXH(Map<String, POIXMLDocumentPart> chartsMap, List<TMonthplan> monList,int item) {
        List<String> fldNameArr = getThreeFieldNameArr();
        // 数据集合
        List<TMonthplan> itemList = getItemDatas(monList, item);
        List<String> titleArr = new ArrayList<String>(){{
            add("title");
            add(itemList.get(0).getKpi());
            add(itemList.get(1).getKpi());
        }};
        if(CollectionUtils.isNotEmpty(itemList)){
            List<Map<String, String>> listItemsByType = getListTwoItems(itemList);
            // 折线图+柱状图
            POIXMLDocumentPart poixmlDocumentPart4 = chartsMap.get("/word/charts/chart4.xml");
            PoiWordTools.replaceCombinationCharts(poixmlDocumentPart4,titleArr, fldNameArr, listItemsByType,1,2);
        }
    }

    @SuppressWarnings("serial")
    @Override
    public void doChartsCOD(Map<String, POIXMLDocumentPart> chartsMap,List<TMonthplan> monList,int item) {
        List<String> fldNameArr = getTwoFieldNameArr();
        // 数据集合
        List<TMonthplan> itemList = getItemDatas(monList, item);
        List<String> titleArr = new ArrayList<String>(){{
            add("title");
            add(itemList.get(0).getKpi());
        }};
        if(CollectionUtils.isNotEmpty(itemList)){
            List<Map<String, String>> listItemsByType = getListOneItems(itemList);
            POIXMLDocumentPart poixmlDocumentPart5 = chartsMap.get("/word/charts/chart5.xml");
            //PoiWordTools.replaceCombinationCharts(poixmlDocumentPart5,titleArr, fldNameArr, listItemsByType,1,2);
            //柱状图
            PoiWordTools.replaceBarCharts(poixmlDocumentPart5, titleArr, fldNameArr, listItemsByType);
        }
    }

    /**
     * 根据item获取分类数据
     * @param list
     * @param item
     * @return
     */
    private List<TMonthplan> getItemDatas(List<TMonthplan> list,int item){
        return new ArrayList<TMonthplan>(){{
            if(CollectionUtils.isNotEmpty(list)){
                for (int i = 0; i < list.size(); i++) {
                    if(list.get(i).getItem() == item){
                        if (list.get(i).getJan() == null) {
                            list.get(i).setJan(0.0);
                        }
                        if (list.get(i).getApr() == null) {
                            list.get(i).setApr(0.0);
                        }
                        if (list.get(i).getAug() == null) {
                            list.get(i).setAug(0.0);
                        }
                        if (list.get(i).getDec() == null) {
                            list.get(i).setDec(0.0);
                        }
                        if (list.get(i).getFeb() == null) {
                            list.get(i).setFeb(0.0);
                        }
                        if (list.get(i).getJul() == null) {
                            list.get(i).setJul(0.0);
                        }
                        if (list.get(i).getJun() == null) {
                            list.get(i).setJun(0.0);
                        }
                        if (list.get(i).getMar() == null) {
                            list.get(i).setMar(0.0);
                        }
                        if (list.get(i).getMay() == null) {
                            list.get(i).setMay(0.0);
                        }
                        if (list.get(i).getNov() == null) {
                            list.get(i).setNov(0.0);
                        }
                        if (list.get(i).getOct() == null) {
                            list.get(i).setOct(0.0);
                        }
                        if (list.get(i).getSep() == null) {
                            list.get(i).setSep(0.0);
                        }
                        add(list.get(i));
                    }
                }
            }
        }};
    }
    /**
     * 组装每项字段-4
     * @return
     */
    private  List<String> getFourFieldNameArr(){
        return new ArrayList<String>(){
            private static final long serialVersionUID = 12624944569060932L;
            {
                add("item1");
                add("item2");
                add("item3");
                add("item4");
            }};
    }

    /**
     * 组装每项字段-3
     * @return
     */
    private  List<String> getThreeFieldNameArr(){
        return new ArrayList<String>(){
            private static final long serialVersionUID = 12624944569560932L;
            {
                add("item1");
                add("item2");
                add("item3");
            }};
    }

    /**
     * 组装每项字段-2
     * @return
     */
    private  List<String> getTwoFieldNameArr(){
        return new ArrayList<String>(){
            private static final long serialVersionUID = 12624944569560932L;
            {
                add("item1");
                add("item2");
            }};
    }

    /**
     * 组装组合图表数据--3项
     * @param list
     * @return
     */
    @SuppressWarnings("serial")
    private List<Map<String, String>> getListThreeItems(List<TMonthplan> list){
        return new ArrayList<Map<String, String>>(){{
            // 第一行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jan");
                put("item2", list.get(0).getJan() + "");
                put("item3", list.get(1).getJan() + "");
                put("item4", list.get(2).getJan() + "");
            }});
            // 第二行数据
            add(new HashMap<String, String>(){{
                put("item1", "Feb");
                put("item2", list.get(0).getFeb() + "");
                put("item3", list.get(1).getFeb() + "");
                put("item4", list.get(2).getFeb() + "");
            }});
            // 第三行数据
            add(new HashMap<String, String>(){{
                put("item1", "Mar");
                put("item2", list.get(0).getMar() + "");
                put("item3", list.get(1).getMar() + "");
                put("item4", list.get(2).getMar() + "");
            }});
            // 第四行数据
            add(new HashMap<String, String>(){{
                put("item1", "Apr");
                put("item2", list.get(0).getApr() + "");
                put("item3", list.get(1).getApr() + "");
                put("item4", list.get(2).getApr() + "");
            }});
            // 第五行数据
            add(new HashMap<String, String>(){{
                put("item1", "May");
                put("item2", list.get(0).getMay() + "");
                put("item3", list.get(1).getMay() + "");
                put("item4", list.get(2).getMay() + "");
            }});
            // 第六行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jun");
                put("item2", list.get(0).getJun() + "");
                put("item3", list.get(1).getJun() + "");
                put("item4", list.get(2).getJun() + "");
            }});
            // 第七行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jul");
                put("item2", list.get(0).getJul() + "");
                put("item3", list.get(1).getJul() + "");
                put("item4", list.get(2).getJul() + "");
            }});
            // 第八行数据
            add(new HashMap<String, String>(){{
                put("item1", "Aug");
                put("item2", list.get(0).getAug() + "");
                put("item3", list.get(1).getAug() + "");
                put("item4", list.get(2).getAug() + "");
            }});
            // 第九行数据
            add(new HashMap<String, String>(){{
                put("item1", "Sep");
                put("item2", list.get(0).getSep() + "");
                put("item3", list.get(1).getSep() + "");
                put("item4", list.get(2).getSep() + "");
            }});
            // 第十行数据
            add(new HashMap<String, String>(){{
                put("item1", "Oct");
                put("item2", list.get(0).getOct() + "");
                put("item3", list.get(1).getOct() + "");
                put("item4", list.get(2).getOct() + "");
            }});
            // 第十一行数据
            add(new HashMap<String, String>(){{
                put("item1", "Nov");
                put("item2", list.get(0).getNov() + "");
                put("item3", list.get(1).getNov() + "");
                put("item4", list.get(2).getNov() + "");
            }});
            // 第十二行数据
            add(new HashMap<String, String>(){{
                put("item1", "Dec");
                put("item2", list.get(0).getDec() + "");
                put("item3", list.get(1).getDec()+ "");
                put("item4", list.get(2).getDec() + "");
            }});
        }};
    }

    /**
     * 组装组合图表数据
     * @param list
     * @return
     */
    @SuppressWarnings("serial")
    private List<Map<String, String>> getListOneItems(List<TMonthplan> list){
        return new ArrayList<Map<String, String>>(){{
            // 第一行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jan");
                put("item2", list.get(0).getJan() + "");
            }});
            // 第二行数据
            add(new HashMap<String, String>(){{
                put("item1", "Feb");
                put("item2", list.get(0).getFeb() + "");
            }});
            // 第三行数据
            add(new HashMap<String, String>(){{
                put("item1", "Mar");
                put("item2", list.get(0).getMar() + "");
            }});
            // 第四行数据
            add(new HashMap<String, String>(){{
                put("item1", "Apr");
                put("item2", list.get(0).getApr() + "");
            }});
            // 第五行数据
            add(new HashMap<String, String>(){{
                put("item1", "May");
                put("item2", list.get(0).getMay() + "");
            }});
            // 第六行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jun");
                put("item2", list.get(0).getJun() + "");
            }});
            // 第七行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jul");
                put("item2", list.get(0).getJul() + "");
            }});
            // 第八行数据
            add(new HashMap<String, String>(){{
                put("item1", "Aug");
                put("item2", list.get(0).getAug() + "");
            }});
            // 第九行数据
            add(new HashMap<String, String>(){{
                put("item1", "Sep");
                put("item2", list.get(0).getSep() + "");
            }});
            // 第十行数据
            add(new HashMap<String, String>(){{
                put("item1", "Oct");
                put("item2", list.get(0).getOct() + "");
            }});
            // 第十一行数据
            add(new HashMap<String, String>(){{
                put("item1", "Nov");
                put("item2", list.get(0).getNov() + "");
            }});
            // 第十二行数据
            add(new HashMap<String, String>(){{
                put("item1", "Dec");
                put("item2", list.get(0).getDec() + "");
            }});
        }};
    }


    /**
     * 组装组合图表数据
     * @param list
     * @return
     */
    @SuppressWarnings("serial")
    private List<Map<String, String>> getListTwoItems(List<TMonthplan> list){
        return new ArrayList<Map<String, String>>(){{
            // 第一行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jan");
                put("item2", list.get(0).getJan() + "");
                put("item3", list.get(1).getJan() + "");
            }});
            // 第二行数据
            add(new HashMap<String, String>(){{
                put("item1", "Feb");
                put("item2", list.get(0).getFeb() + "");
                put("item3", list.get(1).getFeb() + "");
            }});
            // 第三行数据
            add(new HashMap<String, String>(){{
                put("item1", "Mar");
                put("item2", list.get(0).getMar() + "");
                put("item3", list.get(1).getMar() + "");
            }});
            // 第四行数据
            add(new HashMap<String, String>(){{
                put("item1", "Apr");
                put("item2", list.get(0).getApr() + "");
                put("item3", list.get(1).getApr() + "");
            }});
            // 第五行数据
            add(new HashMap<String, String>(){{
                put("item1", "May");
                put("item2", list.get(0).getMay() + "");
                put("item3", list.get(1).getMay() + "");
            }});
            // 第六行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jun");
                put("item2", list.get(0).getJun() + "");
                put("item3", list.get(1).getJun() + "");
            }});
            // 第七行数据
            add(new HashMap<String, String>(){{
                put("item1", "Jul");
                put("item2", list.get(0).getJul() + "");
                put("item3", list.get(1).getJul() + "");
            }});
            // 第八行数据
            add(new HashMap<String, String>(){{
                put("item1", "Aug");
                put("item2", list.get(0).getAug() + "");
                put("item3", list.get(1).getAug() + "");
            }});
            // 第九行数据
            add(new HashMap<String, String>(){{
                put("item1", "Sep");
                put("item2", list.get(0).getSep() + "");
                put("item3", list.get(1).getSep() + "");
            }});
            // 第十行数据
            add(new HashMap<String, String>(){{
                put("item1", "Oct");
                put("item2", list.get(0).getOct() + "");
                put("item3", list.get(1).getOct() + "");
            }});
            // 第十一行数据
            add(new HashMap<String, String>(){{
                put("item1", "Nov");
                put("item2", list.get(0).getNov() + "");
                put("item3", list.get(1).getNov() + "");
            }});
            // 第十二行数据
            add(new HashMap<String, String>(){{
                put("item1", "Dec");
                put("item2", list.get(0).getDec() + "");
                put("item3", list.get(1).getDec()+ "");
            }});
        }};
    }
}
