package com.yeechart.dotMatrix.signage;

import com.aliyuncs.utils.StringUtils;
import com.yeechart.dotMatrix.canvas.DotMatrixCanvasUtil;
import com.yeechart.dotMatrix.canvas.DotMatrixDrawShapeUtil;
import com.yeechart.dotMatrix.canvas.DotMatrixDrawtextUtil;
import com.yeechart.dotMatrix.canvas.DotMatrixImageUtil;
import com.yeechart.dotMatrix.font.XZPFontLoaderUtil;
import com.yeechart.dotMatrix.signage.bean.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Component
public class SignageDrawRightUtil {
    @Autowired
    private XZPFontLoaderUtil xzpFontLoaderUtil;
    @Autowired
    private DotMatrixDrawtextUtil dotMatrixDrawtextUtil;
    protected Logger logger = LoggerFactory.getLogger(SignageDrawRightUtil.class);
    @Value("${wb.enable}")
    private Boolean wbEnable;
    @Value("${wb.device_ids}")
    private String[] wbDeviceIds;

    /*********** 右屏 默认的 点阵数据的形成  ********************/

    /**
     * 绘制右屏 已配网 终端名称
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasRightOFFNetworkBitmapArraysTerName(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo, boolean isClean) {
        //终端名称
        String text = ter020201InfoVo.getTerName();

        int startColumnA;
        int startRowA = SignageDrawUtil.height / 40 * 11;
        int[][] fontBinaryArray;
        if (isClean) {
            fontBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSizeHeight)][10 * SignageDrawUtil.textFontSize];//最多支持的字数
            startColumnA = SignageDrawUtil.width / 2 + SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;

            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowA, startColumnA);
        }

        if (StringUtils.isEmpty(text)) {
            text = "终端名称";
        }

        fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize);
        startColumnA = SignageDrawUtil.width / 2 + SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;

        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowA, startColumnA);
    }

    /**
     * 绘制右屏 已配网 终端编号
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasRightOFFNetworkBitmapArraysTerWorkCode(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo, boolean isClean) {
        //终端编号
        String text = ter020201InfoVo.getTerWorkCode();


        int[][] fontBinaryArray;
        int startColumnB;
        int startRowB = SignageDrawUtil.height / 40 * 13;

        if (isClean) {
            fontBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSizeHeight)][10 * SignageDrawUtil.textFontSize];//最多支持的字数
            startColumnB = SignageDrawUtil.width / 2 + SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;
            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowB, startColumnB);
        }

        fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize);
        startColumnB = SignageDrawUtil.width / 2 + SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;

        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowB, startColumnB);
    }


    /**
     * 绘制右屏 关机界面的 未配网 点阵图
     * @return 二进制数据
     */

    /**
     * 绘制新版右屏 引导图的 背景图
     *
     * @return
     */
    public  int[][] canvasRightOFFNotNetworkBitmapArrays(String dId) {
        String resourcePath = "image/device/020201/init_right_default_20240601.jpg";
        //特殊处理 电信白牌
        for(String id: wbDeviceIds) {
            if(id.equals(dId)) {
                resourcePath = "classpath:image/device/020201/init_right_default_20250217.jpg";
                break;
            }
        }
        if(wbEnable && "default".equals(dId)){
            logger.info("强制白牌");
            //电信
            resourcePath = "classpath:image/device/020201/init_right_default_20250217.jpg";
        }
        logger.info("设备ID {}, 默认图: {}", dId, resourcePath);
//        int[][] canvasBitmapArrays =  XZPImageUtil.twoToCanvasBitmapArrays(XZPImageUtil.canvasImageBitmapArrays(resourcePath,width,height,140),width,height);
//        String text = "未绑定设备";
//        int[][] fontBinaryArray = XZPDrawtextUtil.drawingText(text,textFontSizeCheck,noChineseFontSizeCheck);
//        int startRowA =  height/40;
//        int startColumnA  = width/2  - fontBinaryArray[0].length/2;
//        XZPCanvasUtil.mergeDotMatrices(canvasBitmapArrays,fontBinaryArray,startRowA,startColumnA);
        return DotMatrixImageUtil.twoToCanvasBitmapArrays(DotMatrixImageUtil.canvasImageBitmapArrays(resourcePath, SignageDrawUtil.width, SignageDrawUtil.height, 140), SignageDrawUtil.width, SignageDrawUtil.height);


    }

    /**
     * 绘制新版右屏 引导图的 未绑定工站 文字
     *
     * @param canvasBitmapArrays
     */
    public  void canvasRightOFFNetworkBitmapArraysText(int[][] canvasBitmapArrays) {
        String text = "未绑定工站";
        int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSizeCheck, SignageDrawUtil.noChineseFontSizeCheck);
        int startRowA = SignageDrawUtil.height / 40;
        int startColumnA = SignageDrawUtil.width / 2 - fontBinaryArray[0].length / 2;
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowA, startColumnA);

    }

    /**
     * 绘制右屏 已配网 工站名称
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasRightOFFNetworkBitmapArraysWsName(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo, boolean isClean) {
        String text = ter020201InfoVo.getWsName();

        int startColumnA;
        int startRowA = SignageDrawUtil.height / 40 * 11;
        int[][] fontBinaryArray;
        if (isClean) {
            fontBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSizeHeight)][10 * SignageDrawUtil.textFontSize];//最多支持的字数
            startColumnA = SignageDrawUtil.width / 2 - SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;

            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowA, startColumnA);
        }

        fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize);
        startColumnA = SignageDrawUtil.width / 2 - SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;


        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowA, startColumnA);

    }

    /**
     * 绘制右屏 已配网 工站编号
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasRightOFFNetworkBitmapArraysWsWorkCode(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo, boolean isClean) {

        //工站编号
        String text = ter020201InfoVo.getWsWorkCode();

        int startColumnB;
        int startRowB = SignageDrawUtil.height / 40 * 13;
        int[][] fontBinaryArray;
        if (isClean) {
            fontBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSizeHeight)][10 * SignageDrawUtil.textFontSize];//最多支持的字数
            startColumnB = SignageDrawUtil.width / 2 - SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;

            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowB, startColumnB);
        }

        fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize);
        startColumnB = SignageDrawUtil.width / 2 - SignageDrawUtil.width / 8 - fontBinaryArray[0].length / 2;


        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowB, startColumnB);

    }


    /*********** 绘制 右屏 业务图  ********************/

    /**
     * 绘制 右屏 终端名称
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightTerName(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startRowA = SignageDrawUtil.height / 40;
        //int startColumnB = width/2 - textFontSize*10/2;
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSize2Height)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowA, 0);//直接整行

        String text = ter020201InfoVo.getTerName();

        if (StringUtils.isEmpty(text)) {
            text = "终端名称";
        }

        int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize2);

        int startColumnA = SignageDrawUtil.width / 2 - fontBinaryArray[0].length / 2;


        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowA, startColumnA, new int[]{1, 1, 1, 1});
    }

    /**
     * 绘制 右屏 终端编号
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightTerWorkCode(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startRowB = SignageDrawUtil.height / 20 + SignageDrawUtil.noChineseFontSize * 3;
//        int startColumnA = width/2 - textFontSize*10/2;
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowB, 0);//直接整行

        String text = ter020201InfoVo.getTerWorkCode();
        if (StringUtils.isEmpty(text)) {
            text = "00000001";
        }

        int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize);

        int startColumnB = SignageDrawUtil.width / 2 - fontBinaryArray[0].length / 2;


        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowB, startColumnB, new int[]{1, 1, 1, 1});
    }


    /**
     * 绘制 右屏 工站名称
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightWsName(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startRowA = SignageDrawUtil.height / 40;
        //int startColumnB = width/2 - textFontSize*10/2;
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSize2Height)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowA, 0);

        String text = ter020201InfoVo.getWsName();

        if (StringUtils.isEmpty(text)) {
            text = "工站名称";
        }

        int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize2);

        int startColumnA = SignageDrawUtil.width / 2 - fontBinaryArray[0].length / 2;
//        int startRowA = height/40;

        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowA, startColumnA, new int[]{1, 1, 1, 1});
    }

    /**
     * 绘制 右屏 工站编号
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightWsWorkCode(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startRowB = SignageDrawUtil.height / 20 + SignageDrawUtil.noChineseFontSize * 3;
        // int startColumnA = width/2 - textFontSize*10/2;
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSizeHeight, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowB, 0);

        String text = ter020201InfoVo.getWsWorkCode();
        if (StringUtils.isEmpty(text)) {
            text = "00000001";
        }
        int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize, SignageDrawUtil.noChineseFontSize);

        int startColumnB = SignageDrawUtil.width / 2 - fontBinaryArray[0].length / 2;
//        int startRowB = height/20 + noChineseFontSize*3;


        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, fontBinaryArray, startRowB, startColumnB, new int[]{1, 1, 1, 1});
    }


    /**
     * 绘制 右屏 操作员 相关内容
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightOperator(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnB = SignageDrawUtil.rightMargins;
        int startRowB = SignageDrawUtil.height / 20 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.height / 40;

        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowB, startColumnB);

        TiOnusBean tiOnusBean = ter020201InfoVo.getTiOnusBean();
        if (tiOnusBean == null) {
            tiOnusBean = new TiOnusBean();
        }
        //绘制操作员
        if (tiOnusBean.getIsOperate() == null || tiOnusBean.getIsOperate() == 0) {
            String text = tiOnusBean.getOAlias();
            if (StringUtils.isEmpty(text)) {
                text = "操作人员";
            }
            text = text + ": ";

            if (!StringUtils.isEmpty(ter020201InfoVo.getOperator())) {
                text = text + ter020201InfoVo.getOperator();
            }
            text = dotMatrixDrawtextUtil.changeTextOneLine(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize, SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2);
            dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, text, startRowB, startColumnB, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

        }
    }


    /**
     * 绘制 右屏 生产责任人 相关内容
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightProduce(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnA = SignageDrawUtil.rightMargins;
        int startRowA = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2;


        //先清除整行
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowA, startColumnA);


        TiOnusBean tiOnusBean = ter020201InfoVo.getTiOnusBean();
        if (tiOnusBean == null) {
            tiOnusBean = new TiOnusBean();
        }
        //绘制 生产责任人
        if (tiOnusBean.getIsProduce() == null || tiOnusBean.getIsProduce() == 0) {
            String text = tiOnusBean.getPAlias();
            if (StringUtils.isEmpty(text)) {
                text = "生产责任人";
            }
            text = text + ": ";

            if (!StringUtils.isEmpty(ter020201InfoVo.getProduce())) {
                text = text + ter020201InfoVo.getProduce();
            }

            text = dotMatrixDrawtextUtil.changeTextOneLine(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize, SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2);

            dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, text, startRowA, startColumnA, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

        }
    }


    /**
     * 绘制 右屏 维修责任人 相关内容
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightMaintain(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnB = SignageDrawUtil.rightMargins;
        int startRowB = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 2 + SignageDrawUtil.height / 40;


        //先清除整行
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowB, startColumnB);

        TiOnusBean tiOnusBean = ter020201InfoVo.getTiOnusBean();
        if (tiOnusBean == null) {
            tiOnusBean = new TiOnusBean();
        }
        //绘制 维修责任人
        if (tiOnusBean.getIsMaintain() == null || tiOnusBean.getIsMaintain() == 0) {
            String text = tiOnusBean.getMAlias();
            if (StringUtils.isEmpty(text)) {
                text = "维修责任人";
            }
            text = text + ": ";

            if (!StringUtils.isEmpty(ter020201InfoVo.getMaintain())) {
                text = text + ter020201InfoVo.getMaintain();
            }

            text = dotMatrixDrawtextUtil.changeTextOneLine(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize, SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2);

            dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, text, startRowB, startColumnB, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

        }
    }


    /**
     * 绘制 右屏 巡检责任人 相关内容
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightInspection(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnB = SignageDrawUtil.rightMargins;
        int startRowB = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 4 + SignageDrawUtil.height / 40;

        //先清除整行
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowB, startColumnB);

        TiOnusBean tiOnusBean = ter020201InfoVo.getTiOnusBean();
        if (tiOnusBean == null) {
            tiOnusBean = new TiOnusBean();
        }
        //绘制 巡检责任人
        if (tiOnusBean.getIsInspect() == null || tiOnusBean.getIsInspect() == 0) {
            String text = tiOnusBean.getIAlias();
            if (StringUtils.isEmpty(text)) {
                text = "巡检责任人";
            }
            text = text + ": ";

            if (!StringUtils.isEmpty(ter020201InfoVo.getInspection())) {
                text = text + ter020201InfoVo.getInspection();
            }
            text = dotMatrixDrawtextUtil.changeTextOneLine(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize, SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2);

            dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, text, startRowB, startColumnB, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

        }
    }

    /**
     * 绘制 右屏 保养责任人 相关内容
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightUpkeep(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnA = SignageDrawUtil.rightMargins;
        int startRowA = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 5 + SignageDrawUtil.height / 20;

        //先清除整行
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowA, startColumnA);

        TiOnusBean tiOnusBean = ter020201InfoVo.getTiOnusBean();
        if (tiOnusBean == null) {
            tiOnusBean = new TiOnusBean();
        }
        //绘制 保养责任人
        if (tiOnusBean.getIsUpkeep() == null || tiOnusBean.getIsUpkeep() == 0) {
            String text = tiOnusBean.getUAlias();
            if (StringUtils.isEmpty(text)) {
                text = "保养责任人";
            }
            text = text + ": ";

            if (!StringUtils.isEmpty(ter020201InfoVo.getUpkeep())) {
                text = text + ter020201InfoVo.getUpkeep();
            }
            text = dotMatrixDrawtextUtil.changeTextOneLine(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize, SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2);

            dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, text, startRowA, startColumnA, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

        }
    }


    /**
     * 绘制 当前在岗 标题
     */
    public  void canvasBitmapRightCheckTitle(int[][] canvasBitmapArrays) {
        String text = "当前在岗:";


        int textBitmapSumB = text.length() * SignageDrawUtil.textFontSize2;

        int startColumnB = SignageDrawUtil.rightMargins;
        int startRowB = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 8 + SignageDrawUtil.height / 20;
        dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, text, startRowB, startColumnB, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

    }


    /**
     * 绘制 当前在岗打卡  生产
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightCheckProduce(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnA = SignageDrawUtil.rightMargins + ((SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2) / 4) / 2;
        int startRowA = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 8 + SignageDrawUtil.height / 20;

        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.textFontSize2 * 5 + SignageDrawUtil.noChineseFontSize * 2];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                cleanBinaryArray,
                startRowA,
                startColumnA - cleanBinaryArray[0].length / 2);

        TiClockBean tiClock = ter020201InfoVo.getTiClock();
        if (tiClock == null) {
            tiClock = new TiClockBean();
        }
        //生产
        if (tiClock.getProduce() == null || tiClock.getProduce() == 0) {
            String text = tiClock.getPAlias();
            if (StringUtils.isEmpty(text)) {
                text = "生产";
            }

            if (ter020201InfoVo.getCheckProduce() != null) {
                text = text + ter020201InfoVo.getCheckProduce() + "人";
            } else {
                text = text + "0人";
            }

            int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                    fontBinaryArray,
                    startRowA,
                    startColumnA - fontBinaryArray[0].length / 2);//,new int[]{1,1,1,1}

        }
    }


    /**
     * 绘制 当前在岗打卡  维修
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightCheckMaintain(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        //            int textBitmapSumB  = text.length() * textFontSize2;

        int startColumnB = SignageDrawUtil.rightMargins + ((SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2) / 4) / 2 * 3;
        int startRowB = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 8 + SignageDrawUtil.height / 20;
        //清除
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.textFontSize2 * 5 + SignageDrawUtil.noChineseFontSize * 2];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                cleanBinaryArray,
                startRowB,
                startColumnB - cleanBinaryArray[0].length / 2);


        TiClockBean tiClock = ter020201InfoVo.getTiClock();
        if (tiClock == null) {
            tiClock = new TiClockBean();
        }
        //维修
        if (tiClock.getMaintain() == null || tiClock.getMaintain() == 0) {
            String text = tiClock.getMAlias();
            if (StringUtils.isEmpty(text)) {
                text = "维修";
            }

            if (ter020201InfoVo.getCheckMaintain() != null) {
                text = text + ter020201InfoVo.getCheckMaintain() + "人";
            } else {
                text = text + "0人";
            }

            int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);


            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                    fontBinaryArray,
                    startRowB,
                    startColumnB - fontBinaryArray[0].length / 2);//,new int[]{1,1,1,1}


//            XZPDrawtextUtil.drawingText(canvasBitmapArrays,text,startRowB,startColumnB,textFontSize2,noChineseFontSize);

        }

    }


    /**
     * 绘制 当前在岗打卡  巡检
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightCheckInspect(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnB = SignageDrawUtil.rightMargins + ((SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2) / 4) / 2 * 5;
        int startRowB = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 8 + SignageDrawUtil.height / 20;

        //清除
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.textFontSize2 * 5 + SignageDrawUtil.noChineseFontSize * 2];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                cleanBinaryArray,
                startRowB,
                startColumnB - cleanBinaryArray[0].length / 2);

        TiClockBean tiClock = ter020201InfoVo.getTiClock();
        if (tiClock == null) {
            tiClock = new TiClockBean();
        }

        //巡检
        if (tiClock.getInspect() == null || tiClock.getInspect() == 0) {
            String text = tiClock.getIAlias();
            if (StringUtils.isEmpty(text)) {
                text = "巡检";
            }

            if (ter020201InfoVo.getCheckInspect() != null) {
                text = text + ter020201InfoVo.getCheckInspect() + "人";
            } else {
                text = text + "0人";
            }

            int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

//            int textBitmapSumB  = text.length() * textFontSize2;


            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                    fontBinaryArray,
                    startRowB,
                    startColumnB - fontBinaryArray[0].length / 2);//,new int[]{1,1,1,1}

//            XZPDrawtextUtil.drawingText(canvasBitmapArrays,text,startRowB,startColumnB,textFontSize2,noChineseFontSize);
        }

    }


    /**
     * 绘制 当前在岗打卡  保养
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightCheckUpkeep(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        int startColumnA = SignageDrawUtil.rightMargins + ((SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2) / 4) / 2 * 7;
        int startRowA = SignageDrawUtil.height / 10 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 8 + SignageDrawUtil.height / 20;

        //清除
        int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.textFontSize2 * 5 + SignageDrawUtil.noChineseFontSize * 2];
        DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                cleanBinaryArray,
                startRowA,
                startColumnA - cleanBinaryArray[0].length / 2);


        TiClockBean tiClock = ter020201InfoVo.getTiClock();
        if (tiClock == null) {
            tiClock = new TiClockBean();
        }
        //保养
        if (tiClock.getUpkeep() == null || tiClock.getUpkeep() == 0) {
            String text = tiClock.getUAlias();
            if (StringUtils.isEmpty(text)) {
                text = "保养";
            }

            if (ter020201InfoVo.getCheckUpkeep() != null) {
                text = text + ter020201InfoVo.getCheckUpkeep() + "人";
            } else {
                text = text + "0人";
            }

            int[][] fontBinaryArray = dotMatrixDrawtextUtil.drawingText(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

//            int textBitmapSumA  = text.length() * textFontSize2;


            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays,
                    fontBinaryArray,
                    startRowA,
                    startColumnA - fontBinaryArray[0].length / 2);//,new int[]{1,1,1,1}


//            XZPDrawtextUtil.drawingText(canvasBitmapArrays,text,startRowA,startColumnA,textFontSize2,noChineseFontSize);

        }

    }


    /**
     * 绘制 右屏 产能报表图
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightCapacityChart(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {
        //产能图

        //时间
        List<String> timeData = new ArrayList<>();
        //产能
        List<BigDecimal> capacityData = new ArrayList<>();//柱状图
        //良品率
        List<String> yieldData = new ArrayList<>();//实线折线
        //稼动率
        List<String> utilizationRateData = new ArrayList<>(); //虚线折线

        List<SheetPVo> sheetVos = ter020201InfoVo.getSheetVos();
        if (sheetVos == null || sheetVos.isEmpty()) {
            sheetVos = new ArrayList<>();

            sheetVos.add(new SheetPVo());
            sheetVos.add(new SheetPVo());
            sheetVos.add(new SheetPVo());
            sheetVos.add(new SheetPVo());
            sheetVos.add(new SheetPVo());
            sheetVos.add(new SheetPVo());
            sheetVos.add(new SheetPVo());
            sheetVos.add(new SheetPVo());
        }
        sheetVos.forEach(sheetPVo -> {

            boolean isAdd = false;

            //时间使用结束时间
            String time = sheetPVo.getTimeEnd();
            if (time != null) {
                Pattern pattern = Pattern.compile("\\d{2}:\\d{2}");
                Matcher matcher = pattern.matcher(time);
                if (matcher.find()) {
                    timeData.add(matcher.group());
                    isAdd = true;
                }
            }

            if (!isAdd) {
                //展示时间
                timeData.add(sheetPVo.getTime());
            }

            //2024/07/01 将产能柱状数据改为良品柱状数据
            //capacityData.add(Long.valueOf(sheetPVo.getProduction()));

            capacityData.add(BigDecimal.valueOf(sheetPVo.getGood()).setScale(2, RoundingMode.DOWN));
            yieldData.add(String.valueOf(sheetPVo.getGoodRate()));
            utilizationRateData.add(String.valueOf(sheetPVo.getUtilizationRate()));
        });

        int startColumnB = SignageDrawUtil.rightMargins;
        int startRowB = SignageDrawUtil.height / 5 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 8;

        drawRight1Chart(canvasBitmapArrays,
                timeData, capacityData, yieldData, utilizationRateData, ter020201InfoVo.getStandardNum(),
                startRowB, startColumnB);

    }


    /**
     * 绘制 右屏 工时图
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightWorkingTimeChart(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {
        //工时图

        //时间
        List<String> timeData = new ArrayList<>();
        //工时
        List<Long> workData = new ArrayList<>();//柱状图

        //人数
        List<Long> peopleNumData = new ArrayList<>();//实线折线


        List<SheetCheckVo> sheetCheckVoList = ter020201InfoVo.getSheetCheckVos();
        if (sheetCheckVoList == null || sheetCheckVoList.isEmpty()) {
            sheetCheckVoList = new ArrayList<>();
            sheetCheckVoList.add(new SheetCheckVo());
            sheetCheckVoList.add(new SheetCheckVo());
            sheetCheckVoList.add(new SheetCheckVo());
            sheetCheckVoList.add(new SheetCheckVo());
            sheetCheckVoList.add(new SheetCheckVo());
            sheetCheckVoList.add(new SheetCheckVo());
            sheetCheckVoList.add(new SheetCheckVo());
            sheetCheckVoList.add(new SheetCheckVo());
        }
        sheetCheckVoList.forEach(sheetCheckVo -> {
            boolean isAdd = false;

            //时间使用结束时间
            String time = sheetCheckVo.getTimeEnd();
            if (time != null) {
                Pattern pattern = Pattern.compile("\\d{2}:\\d{2}");
                Matcher matcher = pattern.matcher(time);
                if (matcher.find()) {
                    timeData.add(matcher.group());
                    isAdd = true;
                }
            }

            if (!isAdd) {
                // 展示时间
                timeData.add(sheetCheckVo.getTime());
            }

            workData.add(Long.valueOf(sheetCheckVo.getWork()));
            peopleNumData.add(Long.valueOf(sheetCheckVo.getPeopleNum()));

        });

        int startColumnB = SignageDrawUtil.rightMargins;
        int startRowB = SignageDrawUtil.height / 5 + SignageDrawUtil.noChineseFontSize * 7 + SignageDrawUtil.textFontSize2 * 8;

        drawRight2Chart(canvasBitmapArrays, timeData, workData, peopleNumData, startRowB, startColumnB);

    }


    /**
     * 绘制 右屏 工站公告
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightWsNotice(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {
        //绘制 公告1
        String text = "公告: ";

        if (!StringUtils.isEmpty(ter020201InfoVo.getWsNotice())) {
            text = text + ter020201InfoVo.getWsNotice();
        }
        List<String> textMoreLine = dotMatrixDrawtextUtil.changeTextMoreLine(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize, SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2, 3);

        for (int i = 0; i < 3; i++) {

            int startColumnB = SignageDrawUtil.rightMargins;
            int startRowB = SignageDrawUtil.height / 5 * 2 + SignageDrawUtil.noChineseFontSize * 11 + SignageDrawUtil.textFontSize2 * (8 + i) + SignageDrawUtil.height / 20 + SignageDrawUtil.height / 80 * i;

            //先清除整行
            int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowB, startColumnB);

            if (i < textMoreLine.size()) {
                String dataStr = textMoreLine.get(i);
                //            int[][] fontBinaryArray = XZPDrawtextUtil.drawingText(dataStr,textFontSize2,noChineseFontSize);
//            int textBitmapSumB  = dataStr.length() * textFontSize2;
//            XZPCanvasUtil.mergeDotMatrices(canvasBitmapArrays,fontBinaryArray,startRowB,startColumnB,new int[]{0,0,0,1});

                dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, dataStr, startRowB, startColumnB, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);
            }


        }
    }


    /**
     * 绘制 右屏 系统公告 or 版本公告
     *
     * @param canvasBitmapArrays
     * @param ter020201InfoVo
     */
    public  void canvasBitmapRightSysNotice(int[][] canvasBitmapArrays, Ter020201InfoVo ter020201InfoVo) {

        String text = null;
        //优先判断版本公告
        if (!StringUtils.isEmpty(ter020201InfoVo.getVerNotice())) {
            text = "版本通知: " + ter020201InfoVo.getVerNotice();
        } else if (!StringUtils.isEmpty(ter020201InfoVo.getSysNotice())) {
            text = "系统通知: " + ter020201InfoVo.getSysNotice();
        }

        if (StringUtils.isEmpty(text)) {
            //没有公告时直接不显示
            return;
        }

//        text = "系统通知: " + text;

        List<String> textMoreLine = dotMatrixDrawtextUtil.changeTextMoreLine(text, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize, SignageDrawUtil.width - SignageDrawUtil.rightMargins * 2, 1);

        for (int i = 0; i < 1; i++) {

            int startColumnA = SignageDrawUtil.rightMargins;
            int startRowA = SignageDrawUtil.height / 5 * 2 + SignageDrawUtil.noChineseFontSize * (11 + 1) + SignageDrawUtil.textFontSize2 * (3 + 8 + i) + SignageDrawUtil.height / 20 + SignageDrawUtil.height / 80 * (3 + i);

            //先清除整行
            int[][] cleanBinaryArray = new int[Math.max(SignageDrawUtil.textFontSize2Height, SignageDrawUtil.noChineseFontSizeHeight)][SignageDrawUtil.width];
            DotMatrixCanvasUtil.mergeDotMatrices(canvasBitmapArrays, cleanBinaryArray, startRowA, startColumnA);

            if (i < textMoreLine.size()) {
                String dataStr = textMoreLine.get(i);
                //            int[][] fontBinaryArray = XZPDrawtextUtil.drawingText(dataStr,textFontSize2,noChineseFontSize);

//            int textBitmapSumA  = dataStr.length() * textFontSize2;

//            XZPCanvasUtil.mergeDotMatrices(canvasBitmapArrays,fontBinaryArray,startRowA,startColumnA,new int[]{0,0,0,1});

                dotMatrixDrawtextUtil.drawingText(canvasBitmapArrays, dataStr, startRowA, startColumnA, SignageDrawUtil.textFontSize2, SignageDrawUtil.noChineseFontSize);

            }


        }
    }


    /**
     * 绘制 右屏 底部按键 引导图
     *
     * @param canvasBitmapArrays
     */
    public  void canvasBitmapRightBottomGuide(int[][] canvasBitmapArrays) {

        int iconWidth = 24;
        int iconHeight = 30;


        int[][] bottomGuide = new int[35][280];

        //绘制间隔实线
        DotMatrixDrawShapeUtil.drawLine(bottomGuide, 1, 0, 0,
                bottomGuide.length - iconWidth / 2,
                0,
                bottomGuide[0].length);

        //开关机图表
        String resourcePath = "image/device/020201/开关.png";

        byte[] bitmapByte = DotMatrixImageUtil.canvasImageBitmapArrays(resourcePath, iconWidth, iconWidth, 150);//140
        int[][] canvas1 = DotMatrixImageUtil.twoToCanvasBitmapArrays(bitmapByte, iconWidth, iconWidth);
        //画布
        int[][] canvas1final = new int[iconHeight][iconHeight + iconWidth];
        DotMatrixCanvasUtil.mergeDotMatricesConfuse(
                canvas1final,
                canvas1,
                canvas1final.length / 2 - canvas1.length / 2,
                canvas1final[0].length / 2 - canvas1[0].length / 2,
                0
        );

        DotMatrixCanvasUtil.mergeDotMatrices(
                bottomGuide,
                canvas1final,
                bottomGuide.length - canvas1final.length,
                bottomGuide[0].length / 4 - canvas1final[0].length / 2);


        //配网图标
        resourcePath = "image/device/020201/Wi-Fi配网.png";
        bitmapByte = DotMatrixImageUtil.canvasImageBitmapArrays(resourcePath, iconHeight, iconWidth, 150);//140
        int[][] canvas2 = DotMatrixImageUtil.twoToCanvasBitmapArrays(bitmapByte, iconHeight, iconWidth);

        //扩大画布
        int[][] canvas2final = new int[iconHeight][iconHeight + iconWidth];
        DotMatrixCanvasUtil.mergeDotMatricesConfuse(
                canvas2final,
                canvas2,
                canvas2final.length / 2 - canvas2.length / 2,
                canvas2final[0].length / 2 - canvas2[0].length / 2,
                0
        );


        DotMatrixCanvasUtil.mergeDotMatrices(
                bottomGuide,
                canvas2final,
                bottomGuide.length - canvas2final.length,
                bottomGuide[0].length / 4 * 3 - canvas2final[0].length / 2);


        //绘制竖线 1
        DotMatrixDrawShapeUtil.drawVerticalLine(bottomGuide,
                1,
                0,
                0,
                bottomGuide.length - canvas1.length / 2,
                0,
                bottomGuide.length);

        //绘制竖线 2
        DotMatrixDrawShapeUtil.drawVerticalLine(bottomGuide,
                1,
                0,
                0,
                bottomGuide.length - canvas1.length / 2,
                bottomGuide[0].length / 2,
                bottomGuide.length);

        //绘制竖线 3
        DotMatrixDrawShapeUtil.drawVerticalLine(bottomGuide,
                1,
                0,
                0,
                bottomGuide.length - canvas1.length / 2,
                bottomGuide[0].length - 1,
                bottomGuide.length);


        //合并画布
        DotMatrixCanvasUtil.mergeDotMatricesConfuse(
                canvasBitmapArrays,
                bottomGuide,
                SignageDrawUtil.height - bottomGuide.length,
                SignageDrawUtil.width / 2 - bottomGuide[0].length / 2,
                0
        );

    }


    /**
     * 绘制 右屏第一图表
     *
     * @param largeMatrix         画布数组
     * @param timeData            时间数据
     * @param capacityData        产能数据
     * @param yieldData           良品率数据
     * @param utilizationRateData 稼动率数据
     * @param startRow            内容左上角的横坐标 （列）
     * @param startColumn         内容左上角的横坐标 （列）
     */
    public  void drawRight1Chart(int[][] largeMatrix,
                                       List<String> timeData,
                                       List<BigDecimal> capacityData,
                                       List<String> yieldData,
                                       List<String> utilizationRateData,
                                       Integer standardNum,
                                       int startRow,
                                       int startColumn
    ) {


        int xNumberSize = 5;//X轴的数字大小
        int xNumberHigh = 7;//X轴的数字高度


        int barChartWidth = 20;//柱状图的宽度
        int barChartInterval = 10;//柱状图间隔

        int yAxisDataPart = 5;//Y坐标轴数据段
        //绘制左侧Y轴
        int yLeftNumberSize = 5;//左侧数据每个数字的字体大小
        int yLeftNumberHigh = 7;//左侧数据每个数字的字体高度
        int yLeftNumberInterval = 25;//左侧数据每个数字的间隔 23

        int chartHeight = 135;//纯的柱状图的大小

        //左侧Y轴的数据大小
        BigDecimal maxNumber = new BigDecimal(0);
        if (standardNum != null) {
            maxNumber = new BigDecimal(standardNum);
        }
        BigDecimal minNumber = new BigDecimal(0);

        int maxLength = 1;

        for (BigDecimal numB : capacityData) {

            if (numB.compareTo(maxNumber) > 0) {
                maxNumber = numB;
            }
            if (numB.compareTo(minNumber) < 0) {
                minNumber = numB;
            }
        }

        if (BigDecimal.valueOf(0).compareTo(maxNumber) != 0) {

            maxNumber = maxNumber.add(new BigDecimal(yAxisDataPart - (maxNumber.subtract(minNumber).doubleValue()) % yAxisDataPart));
        }

        List<String> dataArrays = new ArrayList<>();

        for (int i = yAxisDataPart - 1; i >= 0; i--) {
            BigDecimal result = (maxNumber.multiply(new BigDecimal(i))).divide(new BigDecimal(yAxisDataPart - 1), 0, RoundingMode.DOWN);

//            int scale = result.stripTrailingZeros().scale();
//
//            if(scale > 2){
//                result = result.setScale(2, RoundingMode.UP);
//            }
//            result = result.stripTrailingZeros();

            String str = result.toString();//2
            if (maxLength < str.length()) {
                maxLength = str.length();
            }
            dataArrays.add(str); //从0 开始

        }


        //清除画布
        int[][] cleanChartBitmapArrays = new int[chartHeight + yLeftNumberHigh + xNumberHigh + yLeftNumberSize + barChartInterval]
                [largeMatrix[0].length];

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, cleanChartBitmapArrays,
                startRow - yLeftNumberHigh / 2,
                startColumn);

        //左侧 Y轴

        int[][] yLeftAxisCanvasBitmapArrays = new int[chartHeight + yLeftNumberHigh][maxLength * yLeftNumberSize];

        for (int i = 0; i < dataArrays.size(); i++) {

            String yData = dataArrays.get(i);

            int startRowY = i * chartHeight / 4;
            int startColumnY = maxLength * yLeftNumberSize - yData.length() * yLeftNumberSize;

            dotMatrixDrawtextUtil.drawingText(yLeftAxisCanvasBitmapArrays, yData, startRowY, startColumnY, yLeftNumberSize);
        }

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, yLeftAxisCanvasBitmapArrays, startRow - yLeftNumberHigh / 2, startColumn);


        //绘制柱状图
        int dataPart = capacityData.size();//柱状图数据段

        //得出图像点阵的大小
        int chartHigh = chartHeight;
        int chartWidth = dataPart * barChartWidth + barChartInterval * dataPart;


        int[][] barChartBitmapArrays = new int[chartHigh][chartWidth];

        if (BigDecimal.valueOf(0).compareTo(maxNumber) != 0) {
            for (int i = 0; i < capacityData.size(); i++) {


                long number = capacityData.get(i).multiply(new BigDecimal(chartHigh)).divide(maxNumber, 2, RoundingMode.DOWN).longValue();

                if (number <= 0) {
                    if (BigDecimal.valueOf(0).compareTo(capacityData.get(i)) != 0) {
                        number = 1;
                    } else {
                        number = 0;
                    }

                }

                for (int j = 0; j < barChartBitmapArrays.length; j++) {

                    if (j >= barChartBitmapArrays.length - number) {

                        for (int k = 0; k < barChartBitmapArrays[0].length; k++) {

                            int leftInterval = barChartInterval / 2 + i * (barChartWidth + barChartInterval);
                            int rightInterval = barChartWidth + barChartInterval / 2 + i * (barChartWidth + barChartInterval);

                            if (k >= leftInterval
                                    && k <= rightInterval) {
                                barChartBitmapArrays[j][k] = 1;
                            }

                        }

                    }

                }
            }

        }


        //实线折线图
        int[][] solidPolylineBitmapArrays = new int[chartHigh][chartWidth];

        List<int[]> yieldDataArrays = new ArrayList<>();

        for (int i = 0; i < yieldData.size(); i++) {

            String yield = yieldData.get(i);


            //折线原点的位置

            int row = (int) (Double.parseDouble(yield) * (chartHigh - 1) / 100);//行
            int column = barChartInterval / 2 + barChartWidth / 2 + i * (barChartWidth + barChartInterval);//列

            yieldDataArrays.add(new int[]{chartHigh - 1 - row, column});


        }


        yieldDataArrays = DotMatrixDrawShapeUtil.computeBezierCurve(yieldDataArrays);

        for (int i = 0; i < yieldDataArrays.size(); i = i + 1) {

            int[] yieldArray = yieldDataArrays.get(i);

            if (yieldArray[0] >= 0 && yieldArray[0] < solidPolylineBitmapArrays.length &&
                    yieldArray[1] >= 0 && yieldArray[1] < solidPolylineBitmapArrays[0].length) {

                solidPolylineBitmapArrays[yieldArray[0]]
                        [yieldArray[1]] = 1;
            }

        }


        //虚线折线图

        int[][] dottedLineBitmapArrays = new int[chartHigh][chartWidth];

        List<int[]> utilizationRateDataArrays = new ArrayList<>();


        for (int i = 0; i < utilizationRateData.size(); i++) {

            String utilizationRate = utilizationRateData.get(i);


            //折线原点的位置
            int row = (int) (Double.parseDouble(utilizationRate) * (chartHigh - 1) / 100);// ;//行
            int column = barChartInterval / 2 + barChartWidth / 2 + i * (barChartWidth + barChartInterval);//列

            utilizationRateDataArrays.add(new int[]{chartHigh - 1 - row, column});  //-1

        }


        utilizationRateDataArrays = DotMatrixDrawShapeUtil.computeBezierCurve(utilizationRateDataArrays);


        boolean isUse = true;
        for (int i = 0; i < utilizationRateDataArrays.size(); i = i + 1) {

            int[] utilizationRateData1 = utilizationRateDataArrays.get(i);

            if (utilizationRateData1[0] >= 0 && utilizationRateData1[0] < dottedLineBitmapArrays.length &&
                    utilizationRateData1[1] >= 0 && utilizationRateData1[1] < dottedLineBitmapArrays[0].length) {

                if (i == 0) {
                    isUse = true;
                } else {

                    if (i < utilizationRateDataArrays.size() - 1) {
                        int[] utilizationRateData2 = utilizationRateDataArrays.get(i + 1);
                        //判断是否是相邻的
                        if (Math.abs(utilizationRateData1[0] - utilizationRateData2[0]) <= 1 ||
                                Math.abs(utilizationRateData1[1] - utilizationRateData2[1]) <= 1
                        ) {
                            if (isUse) {
                                //周围的点被使用
                                isUse = false;
                            } else {
                                isUse = true;
                            }
                        } else {

                            isUse = true;
                        }
                    }

                }

                if (isUse) {
                    dottedLineBitmapArrays[utilizationRateData1[0]]
                            [utilizationRateData1[1]] = 1;
                }

            }


        }


        //产能达标线
        int[][] standardNumBitmapArrays = new int[chartHeight][chartWidth];
        if (standardNum != null) {
            BigDecimal standardNumBigDecimal = new BigDecimal(standardNum);
            long number = 0;
            if (BigDecimal.valueOf(0).compareTo(maxNumber) != 0) {
                number = standardNumBigDecimal.multiply(new BigDecimal(chartHigh)).divide(maxNumber, 2, RoundingMode.DOWN).longValue();
            }


            if (number <= 0) {
                if (BigDecimal.valueOf(0).compareTo(standardNumBigDecimal) != 0) {
                    number = 1;
                } else {
                    number = 0;
                }

            }
            DotMatrixDrawShapeUtil.drawLine(standardNumBitmapArrays, 1, 1, 1,
                    (int) (chartHigh - number),
                    5, chartWidth - 5);
        }


        for (int i = 0; i < chartHigh; i++) {
            for (int j = 0; j < chartWidth; j++) {
                int k = 0;
                if (barChartBitmapArrays[i][j] == 1) {
                    k++;
                }
                if (standardNum != null) {
                    if (standardNumBitmapArrays[i][j] == 1) {
                        k++;
                    }
                }

                if (k == 1) {
                    barChartBitmapArrays[i][j] = 1;
                } else {
                    barChartBitmapArrays[i][j] = 0;
                }
            }
        }


        //合并图像数组
        int[][] chartBitmapArrays = new int[chartHigh][chartWidth];

        for (int i = 0; i < chartHigh; i++) {
            for (int j = 0; j < chartWidth; j++) {

                int k = 0;

                if (barChartBitmapArrays[i][j] == 1) {
                    k++;
                }

                if (solidPolylineBitmapArrays[i][j] == 1) {
                    k++;
                }

                if (dottedLineBitmapArrays[i][j] == 1) {
                    k++;
                }

                if (k == 1) {
                    chartBitmapArrays[i][j] = 1;
                }

            }
        }


        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, chartBitmapArrays,
                startRow,
                startColumn + (maxLength * yLeftNumberSize));//+ barChartInterval


        //绘制X轴
        int[][] xAxisCanvasBitmapArrays = new int[xNumberHigh + barChartInterval]
                [barChartWidth * dataPart + barChartInterval * dataPart];

        for (int i = 0; i < timeData.size(); i++) {
            String xData = timeData.get(i);
            if (xData == null || xData.isEmpty()) {
                xData = "00:00";
            }
            int startColumnX = i * (barChartWidth + barChartInterval) + barChartInterval / 2 + barChartWidth / 2 - (xData.length() * xNumberSize) / 2;//(i+1)*(dataPart/2 + barChartWidth/2) - (xData.length() * xNumberSize)/2;

            if (startColumnX <= 0) {
                startColumnX = 0;
            }

            dotMatrixDrawtextUtil.drawingText(xAxisCanvasBitmapArrays, xData, 0, startColumnX, xNumberSize);

        }

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, xAxisCanvasBitmapArrays,
                startRow + yLeftAxisCanvasBitmapArrays.length + yLeftNumberSize,
                startColumn + (maxLength * yLeftNumberSize));//+ barChartInterval


        //绘制右侧Y轴

        int yRightNumberSize = 5;//右侧数据每个数字的字体大小
        int yRightNumberHigh = 7;//右侧数据每个数字的字体高度 7
        int yRightNumberInterval = 25;//右侧数据每个数字的间隔 20

        dataArrays = new ArrayList<>();

        dataArrays.add("100.0%");
        dataArrays.add("75.0%");
        dataArrays.add("50.0%");
        dataArrays.add("25.0%");
        dataArrays.add("0.0%");

        int[][] yRightAxisCanvasBitmapArrays = new int[chartHeight + yRightNumberHigh]
                ["100.0%".length() * yRightNumberSize];

        for (int i = 0; i < dataArrays.size(); i++) {
            String yData = dataArrays.get(i);
            int startRowY = i * chartHeight / 4;

            dotMatrixDrawtextUtil.drawingText(yRightAxisCanvasBitmapArrays, yData, startRowY, 0, yRightNumberSize);

        }

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, yRightAxisCanvasBitmapArrays,
                startRow - yRightNumberHigh / 2,
                startColumn + ((maxLength * yLeftNumberSize) + // + barChartInterval)
                        dataPart * barChartWidth + barChartInterval * dataPart));//+ barChartInterval


        int chartStartColumn = startColumn + ((maxLength * yLeftNumberSize))//+ barChartInterval
                + dataPart * barChartWidth + barChartInterval * dataPart//+ barChartInterval
                + "100.0%".length() * yRightNumberSize;

        int widthC = SignageDrawUtil.width - SignageDrawUtil.rightMargins - chartStartColumn;
        int startColumnC = chartStartColumn + widthC / 2;


        //绘制最新的数据

        //最新产能

        BigDecimal result = capacityData.get(capacityData.size() - 1);

        int scale = result.stripTrailingZeros().scale();

        if (scale > 2) {
            result = result.setScale(2, RoundingMode.UP);
        }

        String newStr;
        if (result.scale() > 0 && result.stripTrailingZeros().scale() <= 0) {
            // 如果小数点后有零，但是去掉尾部零后，小数位数为0，则返回整数格式
            newStr = new DecimalFormat("#").format(result);
        } else {
            // 否则，保留原样
            newStr = result.toPlainString();
        }

        int textFontSize = 12;
        int textBitmapSum = newStr.length() * textFontSize;

        startColumn = chartStartColumn + widthC / 2 - textBitmapSum / 2;
        startRow = startRow + yLeftNumberHigh + barChartInterval;

        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);


        int startRowC = startRow + textFontSize + SignageDrawUtil.height / 20;

        //最新良品率
        newStr = yieldData.get(yieldData.size() - 1);
        try {
            if (Double.parseDouble(newStr) >= 100) {
                newStr = "100";
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        newStr = newStr + "%";

        textFontSize = 8;
        int textBitmapSum2 = newStr.length() * textFontSize;

        startColumn = startColumnC - widthC / 4 - textBitmapSum2 / 2;
        startRow = startRowC;
        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);


        newStr = "良品率";//良品率
        textFontSize = 16;
        textBitmapSum = newStr.length() * textFontSize;
        startColumn = startColumnC - widthC / 4 - textBitmapSum / 2;
        startRow = startRowC + SignageDrawUtil.height / 40;
        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);

        //绘制间隔实线
        startRow = startRowC + SignageDrawUtil.height / 40 + textFontSize + 2;
        DotMatrixDrawShapeUtil.drawLine(largeMatrix, 1, 0, 0, startRow, startColumn, startColumn + textBitmapSum);


        //最新稼动率
        newStr = utilizationRateData.get(utilizationRateData.size() - 1);
        try {
            if (Double.parseDouble(newStr) >= 100) {
                newStr = "100.0";
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        newStr = newStr + "%";


        textFontSize = 8;
        textBitmapSum2 = newStr.length() * textFontSize;

        startColumn = startColumnC + widthC / 4 - textBitmapSum2 / 2;
        startRow = startRowC;
        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);


        newStr = "稼动率";//稼动率
        textFontSize = 16;
        textBitmapSum = newStr.length() * textFontSize;
        startColumn = startColumnC + widthC / 4 - textBitmapSum / 2;
        startRow = startRowC + SignageDrawUtil.height / 40;
        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);

        //绘制间隔实线
        startRow = startRowC + SignageDrawUtil.height / 40 + textFontSize + 2;
        DotMatrixDrawShapeUtil.drawLine(largeMatrix, 1, 1, 1, startRow, startColumn, startColumn + textBitmapSum);


    }


    /**
     * 绘制 右屏第二图表
     *
     * @param largeMatrix   画布数组
     * @param timeData      时间数据
     * @param workData      工时数据
     * @param peopleNumData 人数数据
     * @param startRow      内容左上角的横坐标 （列）
     * @param startColumn   内容左上角的横坐标 （列）
     */
    public  void drawRight2Chart(int[][] largeMatrix,
                                       List<String> timeData,
                                       List<Long> workData,
                                       List<Long> peopleNumData,
                                       int startRow,
                                       int startColumn
    ) {

        int xNumberSize = 5;//X轴的数字大小
        int xNumberHigh = 7;//X轴的数字高度

        int dataPart = workData.size();//柱状图数据段
        int barChartWidth = 20;//柱状图的宽度
        int barChartInterval = 10;//柱状图间隔


        int yAxisDataPart = 5;//Y坐标轴数据段


        //绘制左侧Y轴

        int yLeftNumberSize = 5;//左侧数据每个数字的字体大小
        int yLeftNumberHigh = 7;//左侧数据每个数字的字体高度   7
        int yLeftNumberInterval = 20;//左侧数据每个数字的间隔 20

        int chartHeight = 135;//纯的柱状图的大小

        //左侧Y轴的数据大小
        long maxNumber = Collections.max(workData);
        ;
        long minNumber = Collections.min(workData);
        ;

        if (maxNumber != 0) {
            maxNumber = maxNumber + (yAxisDataPart - (maxNumber - minNumber) % yAxisDataPart);
        }


        String maxLeftDataStr = String.valueOf(maxNumber);

        List<String> dataArrays = new ArrayList<>();
//        long data = maxNumber / yAxisDataPart;//(maxNumber - minNumber)/yAxisDataPart;
//        for(int i = yAxisDataPart ; i > 0 ; i--){
//            dataArrays.add( String.valueOf( minNumber + data * i));
//        }
//        dataArrays.add(0,"0");//直接添加0

        for (int i = yAxisDataPart - 1; i >= 0; i--) {
            dataArrays.add(String.valueOf(i * maxNumber / (yAxisDataPart - 1))); //从0 开始
        }


        //清除画布
        int[][] cleanChartBitmapArrays = new int[chartHeight + yLeftNumberHigh + xNumberHigh + yLeftNumberSize + barChartInterval]
                [largeMatrix[0].length];

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, cleanChartBitmapArrays,
                startRow - yLeftNumberHigh / 2,
                startColumn);


//        int[][] yLeftAxisCanvasBitmapArrays = new int[yLeftNumberHigh * yAxisDataPart +  yLeftNumberInterval * (yAxisDataPart - 1)][maxLeftDataStr.length() * yLeftNumberSize];

        int[][] yLeftAxisCanvasBitmapArrays = new int[chartHeight + yLeftNumberHigh][maxLeftDataStr.length() * yLeftNumberSize];

        for (int i = 0; i < dataArrays.size(); i++) {
            String yData = dataArrays.get(i);
//            int startRowY = i*(yLeftNumberSize +  yLeftNumberInterval);
            int startRowY = i * chartHeight / 4;
            int startColumnY = String.valueOf(maxNumber).length() * yLeftNumberSize - yData.length() * yLeftNumberSize;

            dotMatrixDrawtextUtil.drawingText(yLeftAxisCanvasBitmapArrays, yData, startRowY, startColumnY, yLeftNumberSize);
        }

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, yLeftAxisCanvasBitmapArrays, startRow - yLeftNumberHigh / 2, startColumn);


        //得出图像点阵的大小
        int chartHigh = chartHeight;//yLeftAxisCanvasBitmapArrays.length;
        int chartWidth = dataPart * barChartWidth + barChartInterval * dataPart;


        //绘制柱状图
        int[][] barChartBitmapArrays = new int[chartHigh][chartWidth];

        if (maxNumber != 0) {
            for (int i = 0; i < workData.size(); i++) {

                long number = workData.get(i) * chartHigh / maxNumber;//(maxNumber - minNumber);

                if (number <= 0) {
                    number = 0;
                }

                for (int j = 0; j < barChartBitmapArrays.length; j++) {

                    if (j >= barChartBitmapArrays.length - number) {

                        for (int k = 0; k < barChartBitmapArrays[0].length; k++) {

                            int leftInterval = barChartInterval / 2 + i * (barChartWidth + barChartInterval);
                            int rightInterval = barChartWidth + barChartInterval / 2 + i * (barChartWidth + barChartInterval);

                            if (k >= leftInterval
                                    && k <= rightInterval) {
                                barChartBitmapArrays[j][k] = 1;
                            }

                        }

                    }

                }
            }

        }


//        XZPCanvasUtil.mergeDotMatrices(largeMatrix,barChartBitmapArrays,
//                startRow,
//                startColumn+ (String.valueOf(maxNumber).length() * yLeftNumberSize) );//+ barChartInterval


        //绘制右侧Y轴

        int yRightNumberSize = 5;//右侧数据每个数字的字体大小
        int yRightNumberHigh = 7;//右侧数据每个数字的字体高度 7
        int yRightNumberInterval = 23;//右侧数据每个数字的间隔 20

        dataArrays = new ArrayList<>();
        long maxNumber2 = Collections.max(peopleNumData);
        ;
        long minNumber2 = Collections.min(peopleNumData);
        ;

        if (maxNumber2 != 0) {
            maxNumber2 = maxNumber2 + (yAxisDataPart - (maxNumber2 - minNumber2) % yAxisDataPart);

        }

        maxLeftDataStr = String.valueOf(maxNumber2);

        dataArrays = new ArrayList<>();

//       data = maxNumber / yAxisDataPart;//(maxNumber - minNumber)/yAxisDataPart;
//
//
//        for(int i = yAxisDataPart ; i > 0 ; i--){
//            dataArrays.add( String.valueOf( minNumber + data * i));
//        }

        for (int i = yAxisDataPart - 1; i >= 0; i--) {
            dataArrays.add(String.valueOf(i * maxNumber2 / (yAxisDataPart - 1))); //从0 开始
        }


//        int[][] yRightAxisCanvasBitmapArrays = new int[yRightNumberHigh * yAxisDataPart +  yRightNumberInterval * (yAxisDataPart - 1)]
//                [maxLeftDataStr.length() * yRightNumberSize];

        int[][] yRightAxisCanvasBitmapArrays = new int[chartHeight + yRightNumberHigh]
                [maxLeftDataStr.length() * yRightNumberSize];

        for (int i = 0; i < dataArrays.size(); i++) {
            String yData = dataArrays.get(i);
//            int startRowY = i*(yRightNumberSize +  yRightNumberInterval);
            int startRowY = i * chartHeight / 4;

            dotMatrixDrawtextUtil.drawingText(yRightAxisCanvasBitmapArrays, yData, startRowY, 0, yRightNumberSize);

        }
        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, yRightAxisCanvasBitmapArrays,
                startRow - yRightNumberHigh / 2,
                startColumn + ((String.valueOf(maxNumber).length() * yLeftNumberSize) + // + barChartInterval)
                        dataPart * barChartWidth + barChartInterval * dataPart));//+ barChartInterval


        //实线折线图
        int[][] solidPolylineBitmapArrays = new int[chartHigh][chartWidth];

        List<int[]> yieldDataArrays = new ArrayList<>();

        for (int i = 0; i < peopleNumData.size(); i++) {

            //折线原点的位置
            int row = 0;
            if (maxNumber2 > 0) {
                row = (int) (peopleNumData.get(i) * (chartHigh - 1) / maxNumber2);
            }

            int column = barChartInterval / 2 + barChartWidth / 2 + i * (barChartWidth + barChartInterval);//列


            yieldDataArrays.add(new int[]{chartHigh - 1 - row, column});

        }


        yieldDataArrays = DotMatrixDrawShapeUtil.computeBezierCurve(yieldDataArrays);

        for (int i = 0; i < yieldDataArrays.size(); i++) {

            int[] yieldArray = yieldDataArrays.get(i);

            if (yieldArray[0] >= 0 && yieldArray[0] < solidPolylineBitmapArrays.length &&
                    yieldArray[1] >= 0 && yieldArray[1] < solidPolylineBitmapArrays[0].length) {

                solidPolylineBitmapArrays[yieldArray[0]]//solidPolylineBitmapArrays.length - 1 -
                        [yieldArray[1]] = 1;//solidPolylineBitmapArrays[0].length - 1 -
            }
        }

//        XZPCanvasUtil.mergeDotMatrices(largeMatrix,solidPolylineBitmapArrays,
//                startRow,
//                startColumn+ (String.valueOf(maxNumber).length() * yLeftNumberSize) );//+ barChartInterval


        //合并图像数组
        int[][] chartBitmapArrays = new int[chartHigh][chartWidth];


        for (int i = 0; i < chartHigh; i++) {
            for (int j = 0; j < chartWidth; j++) {

                int k = 0;

                if (barChartBitmapArrays[i][j] == 1) {
                    k++;
                }

                if (solidPolylineBitmapArrays[i][j] == 1) {
                    k++;
                }

                if (k == 1) {
                    chartBitmapArrays[i][j] = 1;
                }

            }
        }

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, chartBitmapArrays,
                startRow,
                startColumn + (String.valueOf(maxNumber).length() * yLeftNumberSize));//+ barChartInterval


        //绘制X轴
        int[][] xAxisCanvasBitmapArrays = new int[xNumberHigh + barChartInterval]
                [barChartWidth * dataPart + barChartInterval * dataPart];

        for (int i = 0; i < timeData.size(); i++) {
            String xData = timeData.get(i);
            if (xData == null || xData.isEmpty()) {
                xData = "00:00";
            }
            int startColumnX = i * (barChartWidth + barChartInterval) + barChartInterval / 2 + barChartWidth / 2 - (xData.length() * xNumberSize) / 2;//(i+1)*(dataPart/2 + barChartWidth/2) - (xData.length() * xNumberSize)/2;

            if (startColumnX <= 0) {
                startColumnX = 0;
            }

            dotMatrixDrawtextUtil.drawingText(xAxisCanvasBitmapArrays, xData, 0, startColumnX, xNumberSize);

        }

        DotMatrixCanvasUtil.mergeDotMatrices(largeMatrix, xAxisCanvasBitmapArrays,
                startRow + yLeftAxisCanvasBitmapArrays.length + yLeftNumberSize,
                startColumn + (String.valueOf(maxNumber).length() * yLeftNumberSize));//+ barChartInterval


        int chartStartColumn = startColumn
                + ((String.valueOf(maxNumber).length() * yLeftNumberSize))//+ barChartInterval
                + dataPart * barChartWidth + barChartInterval * dataPart//+ barChartInterval
                + ((String.valueOf(maxNumber2).length() * yLeftNumberSize));

        int widthC = SignageDrawUtil.width - SignageDrawUtil.rightMargins - chartStartColumn;
        int startColumnC = chartStartColumn + widthC / 2;


        //绘制最新的数据

        //最新工时
        String newStr = String.valueOf(workData.get(workData.size() - 1));

        int textFontSize = 12;
        int textBitmapSum = newStr.length() * textFontSize;


        startColumn = startColumnC - textBitmapSum / 2;
        startRow = startRow + yLeftNumberHigh + barChartInterval;

        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);

        int startRowC = startRow + textFontSize + SignageDrawUtil.height / 20;

        //最新人数
        newStr = String.valueOf(peopleNumData.get(peopleNumData.size() - 1));
        textFontSize = 8;
        int textBitmapSum2 = newStr.length() * textFontSize;

        startColumn = startColumnC - textBitmapSum2 / 2;
        startRow = startRowC;
        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);


        newStr = "人数";
        textFontSize = 16;
        textBitmapSum = newStr.length() * textFontSize;
        startColumn = startColumnC - textBitmapSum / 2;
        startRow = startRowC + SignageDrawUtil.height / 40;
        dotMatrixDrawtextUtil.drawingText(largeMatrix, newStr, startRow, startColumn, textFontSize);

        //绘制间隔实线
        startRow = startRowC + SignageDrawUtil.height / 40 + textFontSize + 2;
        DotMatrixDrawShapeUtil.drawLine(largeMatrix, 1, 0, 0, startRow, startColumn, startColumn + textBitmapSum);


    }


}
