java动态生成excel并且需要合并单元格

java动态生成excel并且需要合并单元格

先上图看一下预期效果

请添加图片描述

集成poi

<dependency><groupId>cn.afterturn</groupId><artifactId>easypoi-base</artifactId><version>4.0.0</version>
</dependency>
<dependency><groupId>cn.afterturn</groupId><artifactId>easypoi-web</artifactId><version>4.0.0</version>
</dependency>
<dependency><groupId>cn.afterturn</groupId><artifactId>easypoi-annotation</artifactId><version>4.0.0</version>
</dependency>
<dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>2.2.6</version>
</dependency>
<dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>4.1.2</version>
</dependency>
<dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>4.1.2</version>
</dependency>
<dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml-schemas</artifactId><version>4.1.2</version>
</dependency>
<dependency><groupId>org.apache.poi</groupId><artifactId>ooxml-schemas</artifactId><version>1.4</version>
</dependency>

通过poi手动制作excel

Workbook workbook = exportMoreSheetByTemplate(request, overviewId);
if (Func.isEmpty(workbook)) {return R.fail("生成清册报告失败");
}
Sheet sheet = workbook.createSheet();
//sheet.setRandomAccessWindowSize(SpreadsheetVersion.EXCEL2007.getMaxRows());
workbook.setSheetName(2, "表3排放量汇总");
sheet.setDefaultRowHeight((short) 380);
//sheet.trackAllColumnsForAutoSizing();
// 手动创建sheet页相关内容
//样式
Font font = workbook.createFont();
font.setBold(true);
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFont(font);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//创建第一行
createRow1(workbook, sheet, cellStyle);
// 保存年限 10年 企业名称    测试企业    盘查时间	填表日期	2023-07-06 09:56:28
createRow2(request, workbook, sheet, cellStyle);
createRow3(workbook, sheet, cellStyle);
createMergeRow(workbook, sheet, cellStyle);List<ConfigSourceDetailDTO> excelInfos = accountingConfigMapper.getExcelInfosByOverviewId(overviewId);
for (ConfigSourceDetailDTO excelInfo : excelInfos) {excelInfo.setGroupKey(excelInfo.getGroupKey(excelInfo.getNameDisplay(), excelInfo.getSourceName(), excelInfo.getFormula()));
}
List<ExcelDataDTO> excelDataDtoS = new ArrayList<>();
Map<String, List<ConfigSourceDetailDTO>> excelInfoMap = excelInfos.stream().collect(Collectors.groupingBy(ConfigSourceDetailDTO::getGroupKey));
Set<Map.Entry<String, List<ConfigSourceDetailDTO>>> excelInfoEntrySets = excelInfoMap.entrySet();for (Map.Entry<String, List<ConfigSourceDetailDTO>> excelInfoEntrySet : excelInfoEntrySets) {String key = excelInfoEntrySet.getKey();List<String> keyList = Splitter.on(",").splitToList(key);List<ConfigSourceDetailDTO> excelInfoEntrySetValues = excelInfoEntrySet.getValue();ExcelDataDTO excelDataDTO = new ExcelDataDTO();excelDataDTO.setNameDisplay(keyList.get(0));excelDataDTO.setSourceName(keyList.get(1));excelDataDTO.setFormula(keyList.get(2));List<String> emissionCodes = new ArrayList<>();List<String> emissionNames = new ArrayList<>();List<String> emissionCodeTypes = new ArrayList<>();List<String> emissionUnits = new ArrayList<>();List<String> dataSources = new ArrayList<>();List<String> datas = new ArrayList<>();List<String> factoryDatas = new ArrayList<>();// todo 风险因子数据取值for (ConfigSourceDetailDTO excelInfoEntrySetValue : excelInfoEntrySetValues) {var emissionCode = excelInfoEntrySetValue.getEmissionCode();var obtainingMethod = excelInfoEntrySetValue.getObtainingMethod();var sourceId = excelInfoEntrySetValue.getSourceId();if ("计算值".equals(obtainingMethod)) {//SELECT * FROM g_Inventory_details d WHERE d.is_deleted =0 AND d.obtaining_method = '计算值' and source_id = 1681199756105396225;List<InventoryDetails> inventoryDetails = inventoryDetailsMapper.selectList(new LambdaQueryWrapper<>(InventoryDetails.class).eq(InventoryDetails::getIsDeleted, 0).eq(InventoryDetails::getObtainingMethod, obtainingMethod).eq(InventoryDetails::getSourceId, sourceId));for (InventoryDetails inventoryDetail : inventoryDetails) {// 计算年月或者季度总和datas.add(Func.toStr(BigDecimalUtils.add(Func.isEmpty(inventoryDetail.getJanuary()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getJanuary()), Func.isEmpty(inventoryDetail.getFebruary()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getFebruary())).add(Func.isEmpty(inventoryDetail.getMarch()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getMarch())).add(Func.isEmpty(inventoryDetail.getApril()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getApril())).add(Func.isEmpty(inventoryDetail.getMay()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getMay())).add(Func.isEmpty(inventoryDetail.getJune()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getJune())).add(Func.isEmpty(inventoryDetail.getJuly()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getJuly())).add(Func.isEmpty(inventoryDetail.getAugust()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getAugust())).add(Func.isEmpty(inventoryDetail.getSeptember()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getSeptember())).add(Func.isEmpty(inventoryDetail.getOctober()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getOctober())).add(Func.isEmpty(inventoryDetail.getNovember()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getNovember())).add(Func.isEmpty(inventoryDetail.getDecember()) ? new BigDecimal(0) : new BigDecimal(inventoryDetail.getDecember()))));}}var formula = excelDataDTO.getFormula();if (Func.isNotEmpty(formula)) {String[] splits = formula.split("=");if (Func.isNotEmpty(emissionCode)) {if (emissionCode.equals(splits[0].replace(" ", ""))) {continue;}}}emissionCodes.add(emissionCode);emissionNames.add(excelInfoEntrySetValue.getEmissionName());emissionCodeTypes.add(excelInfoEntrySetValue.getEmissionCodeType());emissionUnits.add(excelInfoEntrySetValue.getEmissionUnit());dataSources.add(excelInfoEntrySetValue.getDataSource());var factorId = excelInfoEntrySetValue.getFactorId();// 获取公式对应的数据,通过查询风险因子表的JSON字段getFactorDatas(factoryDatas, emissionCode, sourceId, factorId, overviewId);}excelDataDTO.setEmissionCode(emissionCodes);excelDataDTO.setEmissionName(emissionNames);excelDataDTO.setDataSource(dataSources);excelDataDTO.setData(factoryDatas);excelDataDTO.setEmissionUnit(emissionUnits);excelDataDTO.setEmissionCodeType(emissionCodeTypes);excelDataDTO.setTotalData(datas.stream().reduce((d, d1) -> Func.toStr(BigDecimalUtils.add(new BigDecimal(d), new BigDecimal(d)))).orElse("0"));excelDataDtoS.add(excelDataDTO);
}InventoryOverview queryEntity = new InventoryOverview();
queryEntity.setEnterpriseId(Func.toStr(request.getBusinessParam().get("unitId")));
String[] reportYears = Func.toStr(request.getBusinessParam().get("unitReportYear")).split("年");
if (Func.isNotEmpty(reportYears[0])) {queryEntity.setTimeInventory(reportYears[0]);if (reportYears.length > 1) {queryEntity.setTimeUnit(reportYears[1]);}
}
InventoryOverview detail = null;
try {detail = inventoryOverviewMapper.selectById(overviewId);
} catch (Exception e) {log.error("根据inventoryOverviewMapper.selectById查询信息失败" + e);
}
log.info("需要动态生成 excel 的组合对象是:{},传入的参数是:{}", JSONObject.toJSONString(excelDataDtoS), overviewId);
// 动态生成sheet
int tempRow = daynamicCreateRow(workbook, sheet, excelDataDtoS);
Row row7 = this.buildRow(sheet, tempRow, workbook, 12);
CellRangeAddress region7 = new CellRangeAddress(tempRow, tempRow, 0, 9);
sheet.addMergedRegion(region7);
row7.getCell(0).setCellValue("总排放量");
Row row8 = this.buildRow(sheet, tempRow + 1, workbook, 12);
CellRangeAddress region8 = new CellRangeAddress(tempRow + 1, tempRow + 1, 0, 9);
sheet.addMergedRegion(region8);
row8.getCell(0).setCellValue("直接排放量");
CellRangeAddress region9 = new CellRangeAddress(tempRow + 2, tempRow + 2, 0, 9);
sheet.addMergedRegion(region9);
Row row9 = this.buildRow(sheet, tempRow + 2, workbook, 12);
row9.getCell(0).setCellValue("间接排放量");
if (Func.isNotEmpty(detail)) {row7.getCell(10).setCellValue(Func.toStr(detail.getInventoryTotal()));row7.getCell(11).setCellValue(Func.toStr(detail.getInventoryTotal()));row8.getCell(10).setCellValue(Func.toStr(detail.getInventoryFirst()));row8.getCell(11).setCellValue(Func.toStr(detail.getInventoryFirst()));row9.getCell(10).setCellValue(Func.toStr(detail.getInventorySecond()));row9.getCell(11).setCellValue(Func.toStr(detail.getInventorySecond()));
} else {row7.getCell(10).setCellValue(0);row7.getCell(11).setCellValue(0);row8.getCell(10).setCellValue(0);row8.getCell(11).setCellValue(0);row9.getCell(10).setCellValue(0);row9.getCell(11).setCellValue(0);
}
//将sheet写入文件
//将文件保存到指定的位置
try (FileOutputStream outputStream = new FileOutputStream(file)) {workbook.write(outputStream);
}
//上传文件
MultipartFile multipartFile = FileUtil.fileToMultipartFile(file);
GoldNetFileVO goldNetFileVO = fileService.uploadFile(multipartFile);
file.delete();
if (Objects.nonNull(goldNetFileVO)) {log.info("生产文件ID:{},toLink:{}", goldNetFileVO.getFileId(), goldNetFileVO.getFileLink());return R.data(goldNetFileVO.getFileId());
}
/*** 4和5合并单元格** @param workbook* @param sheet* @param cellStyle*/
private void createMergeRow(Workbook workbook, Sheet sheet, CellStyle cellStyle) {Row row4 = this.buildRow(sheet, 3, workbook, 12);Row row5 = this.buildRow(sheet, 4, workbook, 12);CellRangeAddress region4_1 = new CellRangeAddress(3, 4, 0, 0);sheet.addMergedRegion(region4_1);CellRangeAddress region4_2 = new CellRangeAddress(3, 4, 1, 1);sheet.addMergedRegion(region4_2);CellRangeAddress region4_3 = new CellRangeAddress(3, 4, 2, 2);sheet.addMergedRegion(region4_3);// 编号	对应活动/设施	排放源row4.getCell(0).setCellValue("编号");row4.getCell(0).setCellStyle(cellStyle);row4.getCell(1).setCellValue("对应活动/设施");row4.getCell(1).setCellStyle(cellStyle);row4.getCell(2).setCellValue("排放源");row4.getCell(2).setCellStyle(cellStyle);CellRangeAddress region4_4 = new CellRangeAddress(3, 3, 3, 11);sheet.addMergedRegion(region4_4);row4.getCell(3).setCellValue("CO2");row4.getCell(3).setCellStyle(cellStyle);// 计算公式	参数	类别	名称	数值	单位	来源	年排放量	年CO2当量row5.getCell(3).setCellValue("计算公式");row5.getCell(3).setCellStyle(cellStyle);row5.getCell(4).setCellValue("参数");row5.getCell(4).setCellStyle(cellStyle);row5.getCell(5).setCellValue("类别");row5.getCell(5).setCellStyle(cellStyle);row5.getCell(6).setCellValue("名称");row5.getCell(6).setCellStyle(cellStyle);row5.getCell(7).setCellValue("数值");row5.getCell(7).setCellStyle(cellStyle);row5.getCell(8).setCellValue("单位");row5.getCell(8).setCellStyle(cellStyle);row5.getCell(9).setCellValue("来源");row5.getCell(9).setCellStyle(cellStyle);row5.getCell(10).setCellValue("年排放量");row5.getCell(10).setCellStyle(cellStyle);row5.getCell(11).setCellValue("年CO2当量");row5.getCell(11).setCellStyle(cellStyle);
}/*** 创建第三行** @param workbook* @param sheet* @param cellStyle*/
private void createRow3(Workbook workbook, Sheet sheet, CellStyle cellStyle) {Row row3 = this.buildRow(sheet, 2, workbook, 12);CellRangeAddress region3_1 = new CellRangeAddress(2, 2, 0, 2);sheet.addMergedRegion(region3_1);row3.getCell(0).setCellValue("基本数据");row3.getCell(0).setCellStyle(cellStyle);
}/*** 创建第二行** @param request* @param workbook* @param sheet* @param cellStyle*/
private void createRow2(CreateStatementRequest request, Workbook workbook, Sheet sheet, CellStyle cellStyle) {Row row2 = this.buildRow(sheet, 1, workbook, 12);CellRangeAddress region2_1 = new CellRangeAddress(1, 1, 0, 1);sheet.addMergedRegion(region2_1);CellRangeAddress region2_2 = new CellRangeAddress(1, 1, 4, 5);sheet.addMergedRegion(region2_2);CellRangeAddress region2_3 = new CellRangeAddress(1, 1, 6, 7);sheet.addMergedRegion(region2_3);CellRangeAddress region2_4 = new CellRangeAddress(1, 1, 9, 10);sheet.addMergedRegion(region2_4);row2.getCell(0).setCellValue("保存年限");row2.getCell(0).setCellStyle(cellStyle);row2.getCell(2).setCellValue("10年");row2.getCell(2).setCellStyle(cellStyle);row2.getCell(3).setCellValue("企业名称");row2.getCell(3).setCellStyle(cellStyle);row2.getCell(4).setCellValue(Func.toStr(request.getBusinessParam().get("unitName")));row2.getCell(4).setCellStyle(cellStyle);row2.getCell(6).setCellValue("盘查时间");row2.getCell(6).setCellStyle(cellStyle);row2.getCell(8).setCellValue(Func.toStr(request.getBusinessParam().get("timeInventoryText")));row2.getCell(8).setCellStyle(cellStyle);row2.getCell(9).setCellValue("填表日期");row2.getCell(9).setCellStyle(cellStyle);row2.getCell(11).setCellValue(DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME));row2.getCell(11).setCellStyle(cellStyle);
}/*** 动态生成row和col** @param workbook* @param sheet* @param excelDataDTOS*/
private int daynamicCreateRow(Workbook workbook, Sheet sheet, List<ExcelDataDTO> excelDataDTOS) {int temp = 4;// 代表从第几行开始合并int rowTemp = 5;// tempNum 代表序号int tempNum = 1;for (int i = 0; i < excelDataDTOS.size(); i++) {ExcelDataDTO excelDataDTO = excelDataDTOS.get(i);List<String> emissionCodes = excelDataDTO.getEmissionCode();List<String> emissionCodeTypes = excelDataDTO.getEmissionCodeType();List<String> emissionNames = excelDataDTO.getEmissionName();List<String> dataList = excelDataDTO.getData();List<String> emissionUnits = excelDataDTO.getEmissionUnit();List<String> dataSources = excelDataDTO.getDataSource();for (int j = 0; j < emissionCodes.size(); j++) {Row row6 = null;// temp + j + 1 代表从第几行开始创建rowrow6 = this.buildRow(sheet, temp + j + 1, workbook, 12);row6.getCell(0).setCellValue(tempNum + j);row6.getCell(1).setCellValue(excelDataDTO.getNameDisplay());row6.getCell(2).setCellValue(excelDataDTO.getSourceName());String formula = excelDataDTO.getFormula();if (Func.isNotEmpty(formula)) {formula = ExpressParseUtil.parseInLatexExpression(formula);formula = formula.replaceAll("\\{/}", "/");}row6.getCell(3).setCellValue(formula);row6.getCell(4).setCellValue(emissionCodes.get(j));row6.getCell(5).setCellValue(emissionCodeTypes.get(j));row6.getCell(6).setCellValue(emissionNames.get(j));// 这个地方放入 g_emission_factor 的 json 中 的data_content 中的 dataif (j < dataList.size()) {row6.getCell(7).setCellValue(dataList.get(j));} else {row6.getCell(7).setCellValue("0");}row6.getCell(8).setCellValue(emissionUnits.get(j));row6.getCell(9).setCellValue(dataSources.get(j));row6.getCell(10).setCellValue(excelDataDTO.getTotalData());row6.getCell(11).setCellValue(excelDataDTO.getTotalData());}tempNum += 1;temp += emissionCodes.size();if (emissionCodes.size() > 1) {CellRangeAddress region0 = new CellRangeAddress(rowTemp, rowTemp + emissionCodes.size() - 1, 0, 0);CellRangeAddress region1 = new CellRangeAddress(rowTemp, rowTemp + emissionCodes.size() - 1, 1, 1);CellRangeAddress region2 = new CellRangeAddress(rowTemp, rowTemp + emissionCodes.size() - 1, 2, 2);CellRangeAddress region3 = new CellRangeAddress(rowTemp, rowTemp + emissionCodes.size() - 1, 3, 3);CellRangeAddress region10 = new CellRangeAddress(rowTemp, rowTemp + emissionCodes.size() - 1, 10, 10);CellRangeAddress region11 = new CellRangeAddress(rowTemp, rowTemp + emissionCodes.size() - 1, 11, 11);sheet.addMergedRegion(region0);sheet.addMergedRegion(region1);sheet.addMergedRegion(region2);sheet.addMergedRegion(region3);sheet.addMergedRegion(region10);sheet.addMergedRegion(region11);}rowTemp += emissionCodes.size();}return rowTemp;
}/*** 创建第一行** @param workbook* @param sheet* @param cellStyle*/
private void createRow1(Workbook workbook, Sheet sheet, CellStyle cellStyle) {Row row1 = this.buildRow(sheet, 0, workbook, 12);CellRangeAddress region1 = new CellRangeAddress(0, 0, 0, 11);sheet.addMergedRegion(region1);row1.getCell(0).setCellStyle(cellStyle);row1.getCell(0).setCellValue("排放量汇总");
}// 创建行
private Row buildRow(Sheet sheet, int row, Workbook workbook, int rowLength) {CellStyle cellStyle = workbook.createCellStyle();cellStyle.setBorderLeft(BorderStyle.THIN);cellStyle.setBorderRight(BorderStyle.THIN);cellStyle.setBorderBottom(BorderStyle.THIN);cellStyle.setBorderTop(BorderStyle.THIN);Row row4 = sheet.createRow(row);for (int i = 0; i < rowLength; i++) {row4.createCell(i).setCellStyle(cellStyle);sheet.setColumnWidth(i, 12 * 256);}return row4;
}// 根据模版生成sheet
public Workbook exportMoreSheetByTemplate(CreateStatementRequest request, Long overviewId) throws IOException {// 用这个map填充数据 sheet1 sheet2 sheet3 都会使用这个map进行传递Map<String, Object> map = doEnterpriseInfo(request);List<InventoryReportDTO> inventoryReportDTOList = new ArrayList<>(doInventoryInfo(overviewId));map.put("inventoryReports", inventoryReportDTOList);// 设置导出配置// 获取导出excel指定模版String fileCode = "inventoryTemplateDownload";var vo = new ConfTemplateFileVO();vo.setTenantCode("000000");vo.setTemplateCode(fileCode);var confTemplateFileRet = confTemplateFileClient.getConfTemplateFile(vo);String filePath = "";if (confTemplateFileRet.isSuccess()) {filePath = confTemplateFileRet.getData().getTemplateFileLink();} else {throw new RuntimeException("查询清册模版信息失败");}TemplateExportParams templatePath = new TemplateExportParams(filePath, true);log.info("templatePath" + templatePath + ",map:" + JSONObject.toJSONString(map));// 导出exceltry {return ExcelExportUtil.exportExcel(templatePath, map);} catch (Exception e) {log.error("ExcelExportUtil.exportExcel", e);}return null;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/58422.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

docker部署jenkins且jenkins中使用docker去部署项目

docker部署jenkins且jenkins中使用docker去部署项目 1、确定版本 2.346.1是最后一个支持jdk8的 2、编写docker-compose.yml并执行 在这个目录中新增data文件夹&#xff0c;注意data是用来跟docker中的文件进行映射的 docker-compose.yml version: "3.1" service…

leetcode 746. 使用最小花费爬楼梯

2023.8.8 昨天爽玩一天&#xff0c;在家就是舒服。 今天继续刷动态规划题。 动态规划题最重要的就是搞清楚dp[i] 的定义&#xff0c;本题dp[i] 的含义是&#xff1a;到达第i层&#xff0c;所需的最小花费。 那么由于起始台阶可以是0或者1&#xff0c;那么dp[0]和dp[1]都初始化…

QT笔记——QT自定义事件

我们有时候想发送自定义事件 1&#xff1a;创建自定义事件&#xff0c;首先我们需要知道它的条件 1&#xff1a;自定义事件需要继承QEvent 2&#xff1a;事件的类型需要在 QEvent::User 和 QEvent::MaxUser 范围之间&#xff0c;在QEvent::User之前 是预留给系统的事件 3&#…

一零六七、JVM梳理

JVM&#xff1f; Java虚拟机&#xff0c;可以理解为Java程序的运行环境&#xff0c;可以执行Java字节码&#xff08;Java bytecode&#xff09;并提供了内存管理、垃圾回收、线程管理等功能 java内存区域划分?每块内存中都对应什么? 方法区&#xff1a;类的结构信息、常量池、…

享元模式(C++)

定义 运用共享技术有效地支持大量细粒度的对象。 使用场景 在软件系统采用纯粹对象方案的问题在于大量细粒度的对象会很快充斥在系统中&#xff0c;从而带来很高的运行时代价——主要指内存需求方面的代价。如何在避免大量细粒度对象问题的同时&#xff0c;让外部客户程序仍…

【C++】多态的底层原理(虚函数表)

文章目录 前言一、虚函数表二、派生类中虚函数表1.原理2.例子&#xff1a; 三、虚函数的存放位置四 、单继承中的虚函数表五、多继承中的虚函数表六、问答题 前言 一、虚函数表 通过观察测试我们发现b对象是8bytes&#xff0c;除了_b成员&#xff0c;还多一个__vfptr放在对象的…

常量池-JVM(十九)

上篇文章说gc日志以及arthas。 Arthas & GC日志-JVM&#xff08;十八&#xff09; 一、常量池 常量池主要放两大类&#xff1a;字面量和符号引用。 字面量就是由字母、数字等构成的字符串或者数值常量。 符号引用主要包含三类常量。 类和接口的全限定名。字段的名称和…

wm8960没有声音

最近在imx6ull上调试这个声卡&#xff0c;用官方的镜像是能发声的&#xff0c;换到自己做的镜像上&#xff0c;就没有声音。 记录一下过程&#xff1a; 内核和设备树。只要有下面的显示&#xff0c;就说明加载成功。 再看一下aplay的显示 到此&#xff0c;驱动都是正常的。但…

Jmeter组件作用域及执行顺序

目录 一、Jmeter八大可执行元件 二、组件执行顺序 三、组件作用域 四、特殊说明 一、Jmeter八大可执行元件 配置元件---Config Element 用于初始化默认值和变量&#xff0c;以便后续采样器使用。配置元件大其作用域的初始阶段处理&#xff0c;配置元件仅对其所在的测试树分…

SpringMVC的架构有什么优势?——控制器(三)

前言 「作者主页」&#xff1a;雪碧有白泡泡 「个人网站」&#xff1a;雪碧的个人网站 「推荐专栏」&#xff1a; ★java一站式服务 ★ ★ React从入门到精通★ ★前端炫酷代码分享 ★ ★ 从0到英雄&#xff0c;vue成神之路★ ★ uniapp-从构建到提升★ ★ 从0到英雄&#xff…

设计模式行为型——观察者模式

目录 什么是观察者模式 观察者模式的实现 观察者模式角色 观察者模式类图 观察者模式举例 观察者模式代码实现 观察者模式的特点 优点 缺点 使用场景 注意事项 实际应用 什么是观察者模式 观察者模式&#xff08;Observer Pattern&#xff09;是一种行为型设计模式…

hive修改表或者删除表时卡死问题的解决(2023-08-08)

背景&#xff1a;前阶段在做hive表的改表名时&#xff0c;总是超时&#xff0c;表是内部表&#xff0c;数据量特别大&#xff0c;无论你是修改表名还是删除表都是卡死的状态&#xff0c;怎么破&#xff1f; 终于&#xff1a;尝试出来一个新的方法 将内部表转化成外部表&#…