From d8e2c95a1d96d61469364bf11156f036c9555baf Mon Sep 17 00:00:00 2001 From: jikan1221 <9837972+jikan1221@user.noreply.gitee.com> Date: Fri, 25 Aug 2023 08:17:31 +0000 Subject: [PATCH 1/4] update report-core/src/main/resources/mapper/ReportExcelMapper.xml. Signed-off-by: jikan1221 <9837972+jikan1221@user.noreply.gitee.com> --- report-core/src/main/resources/mapper/ReportExcelMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/report-core/src/main/resources/mapper/ReportExcelMapper.xml b/report-core/src/main/resources/mapper/ReportExcelMapper.xml index a5a50b07..d8e18afc 100644 --- a/report-core/src/main/resources/mapper/ReportExcelMapper.xml +++ b/report-core/src/main/resources/mapper/ReportExcelMapper.xml @@ -1,5 +1,5 @@ - + -- Gitee From 7324a0c5bbf83dedf7e456a8e4c4c2ac5af76721 Mon Sep 17 00:00:00 2001 From: tanjunjun Date: Tue, 14 May 2024 18:29:15 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=20excel=E5=8F=8Apdf=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=B6=85=E8=BF=875000=E6=9D=A1=20excel=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B6=85=E5=87=BAexcel=E9=99=90=E5=88=B6=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8Cpdf=E5=AF=BC=E5=87=BA=20excel=E8=BD=ACpdf=20zipbom?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reportexcel/service/impl/ReportExcelServiceImpl.java | 3 +++ .../business/modules/reportexcel/util/XlsSheetUtil.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java index 1551f51d..02d262ac 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java @@ -32,6 +32,7 @@ import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.openxml4j.util.ZipSecureFile; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; @@ -215,6 +216,8 @@ public class ReportExcelServiceImpl implements ReportExcelService { // 将Excel文件转换为PDF public File convertExcelToPdf(String excelFilePath, String pdfFilePath, List> reportExcelStyleList) { try { + // 解决excel转换为pdf zipboom问题 + ZipSecureFile.setMinInflateRatio(0); // 读取Excel文件 Workbook workbook = new XSSFWorkbook(excelFilePath); Sheet sheet = workbook.getSheetAt(0); diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/util/XlsSheetUtil.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/util/XlsSheetUtil.java index a436002a..2c902dfd 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/util/XlsSheetUtil.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/util/XlsSheetUtil.java @@ -48,11 +48,13 @@ public class XlsSheetUtil { List cells_json = (List) dbObject.get("celldata"); Map> cellMap = cellGroup(cells_json); //循环每一行 + // 样式创建放到循环外层,防止样式过多,超出excel最大样式限制 + CellStyle style = wb.createCellStyle(); for (Integer r : cellMap.keySet()) { Row row = sheet.createRow(r); //循环每一列 for (JSONObject col : cellMap.get(r)) { - createCell(wb, sheet, row, col); + createCell(wb, sheet, row, col,style); } } } @@ -73,7 +75,7 @@ public class XlsSheetUtil { * @param row * @param dbObject */ - private static void createCell(Workbook wb, Sheet sheet, Row row, JSONObject dbObject) { + private static void createCell(Workbook wb, Sheet sheet, Row row, JSONObject dbObject, CellStyle style) { if (dbObject.containsKey("c")) { Integer c = getStrToInt(dbObject.get("c")); if (c != null) { @@ -97,7 +99,6 @@ public class XlsSheetUtil { //转换v为对象(v是一个对象) JSONObject v_json = (JSONObject) obj; //样式 - CellStyle style = wb.createCellStyle(); cell.setCellStyle(style); -- Gitee From fb558c6bdcc77c8e49d05b5d8b15f07bcd2a6e05 Mon Sep 17 00:00:00 2001 From: wangbin Date: Fri, 14 Jun 2024 12:33:32 +0800 Subject: [PATCH 3/4] =?UTF-8?q?ScriptEngine=E5=88=9B=E5=BB=BA=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DataSetParamServiceImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasetparam/service/impl/DataSetParamServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasetparam/service/impl/DataSetParamServiceImpl.java index ca4303c1..dcd02497 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasetparam/service/impl/DataSetParamServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/datasetparam/service/impl/DataSetParamServiceImpl.java @@ -33,11 +33,13 @@ import java.util.Set; @Slf4j public class DataSetParamServiceImpl implements DataSetParamService { static final Set blackList = Sets.newHashSet("java.lang.ProcessBuilder", "java.lang.Runtime", "java.lang.ProcessImpl"); - - private ScriptEngine engine; - { + private static final ThreadLocal engineHolder = ThreadLocal.withInitial(() -> { NashornScriptEngineFactory factory = new NashornScriptEngineFactory(); - engine = factory.getScriptEngine(clz -> !blackList.contains(clz)); + ScriptEngine engine = factory.getScriptEngine(clz -> !blackList.contains(clz)); + return engine; + }); + public static ScriptEngine getEngine() { + return engineHolder.get(); } @Autowired @@ -96,10 +98,10 @@ public class DataSetParamServiceImpl implements DataSetParamService { */ @Override public Object verification(DataSetParamDto dataSetParamDto) { - String validationRules = dataSetParamDto.getValidationRules(); if (StringUtils.isNotBlank(validationRules)) { try { + ScriptEngine engine = getEngine(); engine.eval(validationRules); if(engine instanceof Invocable){ Invocable invocable = (Invocable) engine; -- Gitee From f5f9a23ce0fdd763bd6e60f2eec76acfdccde938 Mon Sep 17 00:00:00 2001 From: joey Date: Fri, 21 Jun 2024 10:39:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/bigscreenDesigner/viewer/index.vue | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/report-ui/src/views/bigscreenDesigner/viewer/index.vue b/report-ui/src/views/bigscreenDesigner/viewer/index.vue index ae0eb32a..4292aebb 100644 --- a/report-ui/src/views/bigscreenDesigner/viewer/index.vue +++ b/report-ui/src/views/bigscreenDesigner/viewer/index.vue @@ -30,17 +30,20 @@ export default { data() { return { bigScreenStyle: {}, + dashboard:{}, widgets: [] }; }, mounted() { this.getData(); + window.onresize=this.Debounce(this.setScale,500); }, methods: { async getData() { const reportCode = this.$route.query.reportCode; const { code, data } = await detailDashboard(reportCode); if (code != 200) return; + this.dashboard=data.dashboard||{}; const equipment = document.body.clientWidth; const ratioEquipment = equipment / data.dashboard.width; this.bigScreenStyle = { @@ -74,7 +77,32 @@ export default { if(data.dashboard.refreshSeconds>0) { setTimeout(function(){ window.location.reload(); }, data.dashboard.refreshSeconds*1000); } - } + }, + Debounce:(fn,t)=>{ + const delay=t||500; + let timer=null; + return(...args)=>{ + if(timer){ + clearTimeout(timer); + } + const context=this + timer=setTimeout(()=>{ + fn.apply(context,args); + },delay); + } + }, + setScale(){ + const scale=this.getScale(); + this.bigScreenStyle.transform='scale('+scale.scalex+','+scale.scaley+')' + }, + getScale(){ + let width=this.dashboard.width; + let height=this.dashboard.height; + return{ + scalex:(window.innerWidth)/width, + scaley:(window.innerHeight)/height, + } + }, } }; -- Gitee