From df7f233ab3828a91a1b73de973d632b56e859c53 Mon Sep 17 00:00:00 2001 From: zhijie <1003392067@qq.com> Date: 星期六, 18 十一月 2023 01:15:27 +0800 Subject: [PATCH] perfomance为空情况处理 --- src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java b/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java index 4ff2859..f5c1cb2 100644 --- a/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java +++ b/src/main/java/com/ots/project/tool/report/LAQ/chart/LAQChart.java @@ -48,7 +48,7 @@ public static void main(String[] args) throws Exception { - /*String dataPath = "D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ琛ㄥご鏁版嵁鏂囦欢.xlsx"; + String dataPath = "D:\\娴嬭瘎绯荤粺\\闇�姹俓\LAQ\\report\\LAQ琛ㄥご鏁版嵁鏂囦欢.xlsx"; // 鑾峰彇瀵煎叆鏁版嵁 File file = new File(dataPath); InputStream in = new FileInputStream(file); @@ -74,7 +74,7 @@ textMap.put("extra","48"); textMap.put("agree","90"); textMap.put("emosta","23"); - textMap.put("perfomance","80"); +// textMap.put("perfomance","0"); LAQReport report = new LAQReport(); @@ -93,7 +93,7 @@ log.info("鍒犻櫎鐨勬枃浠跺悕:{}", JSON.toJSONString(deleteStrList)); WordUtil.deleteFileByStr(deleteStrList); - }*/ + } } /** @@ -124,7 +124,13 @@ Double extra = Double.valueOf((String)textMap.get("extra")); Double agree = Double.valueOf((String)textMap.get("agree")); Double emosta = Double.valueOf((String)textMap.get("emosta")); - Double perfomance = Double.valueOf((String)textMap.get("perfomance")); + Double perfomance; + if(textMap.get("perfomance") != null){ + perfomance = Double.valueOf((String)textMap.get("perfomance")); + }else{ + perfomance = -1D; + } + // 鍥捐〃1 List<SeriesData> seriesDatas = Arrays.asList( @@ -283,7 +289,7 @@ // 鍥捐〃11 seriesDatas = Arrays.asList( new SeriesData("X 鍊�", Arrays.asList( - new RowData("X 鍊�", olas.doubleValue()) + new RowData("X 鍊�", perfomance.doubleValue() == -1 ? perfomance.doubleValue() : olas.doubleValue()) )), new SeriesData("Y 鍊�", Arrays.asList( new RowData("Y 鍊�", perfomance.doubleValue()) @@ -446,7 +452,11 @@ if(StringUtils.isNotEmpty(cellValu.valueStr)){ cell.setCellValue(cellValu.valueStr); }else{ - cell.setCellValue(cellValu.value); + if(cellValu.value != -1){ + cell.setCellValue(cellValu.value); + }else{ + cell.setCellValue((String) null); + } } } @@ -491,7 +501,11 @@ CTNumVal val = xNumCnt > i ? xDataSource.getNumRef().getNumCache().getPtArray(i) : xDataSource.getNumRef().getNumCache().addNewPt(); val.setIdx(i); - val.setV(String.format("%.0f", cellValu.value)); + if(cellValu.value == -1){ + val.setV(null); + }else { + val.setV(String.format("%.0f", cellValu.value)); + } } //鏇存柊Y鍧愭爣缂撳瓨 @@ -500,7 +514,11 @@ CTNumVal val = yNumCnt > i ? yDataSource.getNumRef().getNumCache().getPtArray(i) : yDataSource.getNumRef().getNumCache().addNewPt(); val.setIdx(i); - val.setV(String.format("%.0f", cellValu.value)); + if(cellValu.value == -1){ + val.setV(null); + }else { + val.setV(String.format("%.0f", cellValu.value)); + } } // 鏇存柊瀵瑰簲excel鐨勮寖鍥� -- Gitblit v1.9.1