深圳做网站推广公司哪家好搜索引擎大全网址

张小明 2025/12/31 2:52:21
深圳做网站推广公司哪家好,搜索引擎大全网址,安装wordpress数据库错误,在建工程查询网站一 功能总览与关键点 模板下载#xff1a;从 classpath 读取固定模板文件#xff0c;通过 HttpServletResponse 输出为附件#xff0c;设置正确的 Content-Type 与 Content-Disposition#xff0c;兼容中文文件名。批量导入#xff1a;接收 MultipartFile#xff0c;校验…一 功能总览与关键点模板下载从classpath读取固定模板文件通过HttpServletResponse输出为附件设置正确的Content-Type与Content-Disposition兼容中文文件名。批量导入接收MultipartFile校验后缀使用Apache POI WorkbookFactory解析.xls/.xlsx按行读取并映射为领域对象落库返回成功条数与失败原因。数据导出按查询条件或ids查询数据转换为VO使用自研或第三方工具写出到HttpServletResponse支持大数据量分 Sheet 写入。关键关注点模板路径与资源加载建议使用ClassPathResource。导入时单元格取值的“空值/类型”安全处理。关联字典如应用领域需做“名称→ID”的容错查询。导出时中文文件名编码与多浏览器兼容建议RFC 2231方式。资源关闭与异常兜底避免连接/句柄泄漏。二 后端实现要点与代码模板下载 ControllerOperation(summary数据导入)GetMapping(/downloadApplicationStandardBatchTemplate)publicvoiddownloadApplicationStandardBatchTemplate(HttpServletResponseresponse){BufferedInputStreambisnull;BufferedOutputStreambosnull;try{response.reset();response.setContentType(application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charsetutf-8);StringfileNameapplication_standard_batch.xlsx;// 兼容中文文件名RFC 2231StringencodedFilenameURLEncoder.encode(fileName,StandardCharsets.UTF_8).replaceAll(\\,%20);response.setHeader(Content-Disposition,attachment; filename\encodedFilename\; filename*UTF-8encodedFilename);response.setHeader(Access-Control-Expose-Headers,Content-Disposition);ResourceresourcenewClassPathResource(/applicationStandard/fileName);try(InputStreaminresource.getInputStream();ServletOutputStreamoutresponse.getOutputStream()){bisnewBufferedInputStream(in);bosnewBufferedOutputStream(out);byte[]buffnewbyte[2048];intbytesRead;while((bytesReadbis.read(buff))!-1){bos.write(buff,0,bytesRead);}bos.flush();}}catch(Exceptione){// 建议统一异常处理全局异常处理器便于监控与告警log.error(下载模板失败,e);response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);}finally{// try-with-resources 已关闭流这里兜底IOUtils.closeQuietly(bis);IOUtils.closeQuietly(bos);}}批量导入 Controller含字典映射与校验Operation(summary标准数据模板批量导入-v1.0)PostMapping(/import)publicCommonResultimportCase(RequestParam(uploadFile)MultipartFilefile){LoginUserloginUserSecurityFrameworkUtils.getLoginUser();if(loginUsernull){returnCommonResult.error(BAD_REQUEST.getCode(),非法操作);}if(filenull||file.isEmpty()){returnCommonResult.error(BAD_REQUEST.getCode(),批量导入的Excel文件不能为空);}StringfileNamefile.getOriginalFilename();if(!ImageUtils.checkExcel(fileName)){returnCommonResult.error(BAD_REQUEST.getCode(),上传Excel后缀不符合要求);}try(InputStreamisfile.getInputStream()){WorkbookworkbookWorkbookFactory.create(is);Sheetsheetworkbook.getSheetAt(0);introwCountsheet.getPhysicalNumberOfRows();if(rowCount1){returnCommonResult.error(BAD_REQUEST.getCode(),模板无数据);}intsuccessNum0;for(inti1;irowCount;i){// 第0行为表头Rowrowsheet.getRow(i);if(rownull)continue;SesApplicationStandardContententitynewSesApplicationStandardContent();Stringv0getCellString(row.getCell(0));if(StringUtils.hasText(v0))entity.setStandardName(v0);Stringv1getCellString(row.getCell(1));if(StringUtils.hasText(v1))entity.setStandardVersion(v1);Stringv2getCellString(row.getCell(2));if(StringUtils.hasText(v2))entity.setTestItem(v2);Stringv3getCellString(row.getCell(3));if(StringUtils.hasText(v3))entity.setTestPort(v3);Stringv4getCellString(row.getCell(4));if(StringUtils.hasText(v4))entity.setTestLevel(v4);StringenvNamegetCellString(row.getCell(5));if(StringUtils.hasText(envName)){SesApplicationEnvironmentenvnewSesApplicationEnvironment();env.setEnvironmentName(envName);ListSesApplicationEnvironmentlistsesApplicationEnvironmentService.findSelect(env);if(CollectionUtils.isNotEmpty(list)){entity.setSesApplicationEnvironmentId(list.get(0).getId());}else{// 可选记录“未匹配到应用领域”的错误信息便于导入回执}}Stringv6getCellString(row.getCell(6));if(StringUtils.hasText(v6))entity.setBaseStandard(v6);Stringc1getCellString(row.getCell(10));if(StringUtils.hasText(c1))entity.setProductClassOne(c1);Stringc2getCellString(row.getCell(11));if(StringUtils.hasText(c2))entity.setProductClassTwo(c2);Stringc3getCellString(row.getCell(12));if(StringUtils.hasText(c3))entity.setProductClassThree(c3);Stringv13getCellString(row.getCell(13));if(StringUtils.hasText(v13))entity.setTestPortFeature(v13);Stringv14getCellString(row.getCell(14));if(StringUtils.hasText(v14))entity.setMaintenanceResponsiblePerson(v14);sesApplicationStandardContentService.insertSesApplicationStandardContent(entity);successNum;}returnCommonResult.success(导入成功共 successNum 条);}catch(EncryptedDocumentExceptione){log.error(导入Excel文件加密或格式异常,e);returnCommonResult.error(BAD_REQUEST.getCode(),Excel文件无法解析可能加密);}catch(IOExceptione){log.error(导入Excel文件IO异常,e);returnCommonResult.error(BAD_REQUEST.getCode(),Excel文件读取失败);}}// 安全读取单元格为字符串容错空/数字/日期等privateStringgetCellString(Cellcell){if(cellnull)returnnull;returnnewDataFormatter().formatCellValue(cell).trim();}数据导出 ControllerOperation(summaryEMC应用标准测试内容-导出-v1.0)GetMapping(/export)publicvoidexport(SesApplicationStandardContentcondition,RequestParam(requiredfalse)Stringids,HttpServletResponseresponse)throwsIOException{ListSesApplicationStandardContentlist;if(StringUtils.hasText(ids)){ListLongidListArrays.stream(Convert.toStrArray(,,ids)).filter(StringUtils::hasText).map(Long::valueOf).toList();listsesApplicationStandardContentService.selectSesApplicationStandardContentByIds(idList);}else{listsesApplicationStandardContentService.selectSesApplicationStandardContentList(condition);}ListSesApplicationStandardContentVOvoListlist.stream().map(src-{SesApplicationStandardContentVOvonewSesApplicationStandardContentVO();BeanUtils.copyProperties(src,vo);if(src.getSesApplicationEnvironmentId()!null){SesApplicationEnvironmentenvsesApplicationEnvironmentService.getById(src.getSesApplicationEnvironmentId());vo.setEnvironmentName(env!null?env.getEnvironmentName():null);}returnvo;}).toList();ExcelUtilSesApplicationStandardContentVOutilnewExcelUtil(SesApplicationStandardContentVO.class);util.exportExcelToResponse(voList,EMC应用标准测试内容数据,response);}导出到响应的通用工具方法支持大数据量分 SheetpublicTvoidexportExcelToResponse(ListTlist,StringsheetName,HttpServletResponseresponse)throwsIOException{if(CollectionUtils.isEmpty(list)){response.setStatus(HttpServletResponse.SC_NO_CONTENT);return;}// 初始化创建 Workbook、设置字段、分页/分 Sheet 参数sheetSize 自定义this.init(list,sheetName,Excel.Type.EXPORT);doublesheetNoMath.ceil((double)list.size()/sheetSize);for(inti0;isheetNo;i){createSheet(sheetNo,i);Rowheadersheet.createRow(0);intcol0;for(Object[]os:fields){Excelexcel(Excel)os[1];createCell(excel,header,col);}if(Excel.Type.EXPORT.equals(type)){fillExcelData(index,header);addStatisticsRow();}}// 文件名编码与响应头StringencodedFilenameURLEncoder.encode(sheetName,StandardCharsets.UTF_8).replaceAll(\\,%20).xlsx;response.setContentType(application/vnd.openxmlformats-officedocument.spreadsheetml.sheet);response.setHeader(Content-Disposition,attachment; filename\encodedFilename\; filename*UTF-8encodedFilename);response.setHeader(Access-Control-Expose-Headers,Content-Disposition);try(ServletOutputStreamoutresponse.getOutputStream()){wb.write(out);}finally{if(wb!null)wb.close();}}三 前端实现要点与代码导出按钮支持按选中 ID 或全量条件handleExport(){constqueryParamsaddSESDateRange(this.queryParams,this.dateRange,this.updateDateRange)if(this.idsthis.ids.length0){queryParams.idsthis.ids.join(,)}else{// 导出全部时移除分页参数Object.keys(queryParams).forEach(key{if([pageNum,pageSize].includes(key))deletequeryParams[key]})}constmsgthis.ids?.length?确认导出选中的${this.ids.length}条数据项?:确认导出所有符合条件的数据项?ElMessageBox.confirm(msg,警告,{type:warning}).then(()exportSesApplicationStandardContent(queryParams)).then(res{if(resres.size0){download.excel(res,应用标准测试内容.xlsx)ElMessage.success(导出成功)}else{ElMessage.error(导出失败返回数据为空)}}).catch(err{console.error(err)ElMessage.error(导出失败请检查网络或联系管理员)})}批量导入弹窗示例handleUpload(){this.uploadDialog.visibletrue}四 常见问题与优化建议模板下载中文文件名乱码使用URLEncoder.encode(…)filenameUTF-8’* 的RFC 2231方式兼容主流浏览器避免使用ISO-8859-1转码。导入时单元格取值异常使用DataFormatter统一将单元格格式化为字符串避免数字/日期类型导致的取值问题对null单元格做兜底。导入性能与内存大数据量时建议采用SAX/事件模式或EasyExcel进行流式读取分批入库避免OOM。关联字典容错对“应用领域”等字典字段名称→ID 查询无结果时记录错误明细支持导入回执与失败重试。导出大数据量采用分Sheet写入、分页查询、流式输出避免一次性将全部数据装入内存。安全性校验文件类型/大小、限制上传并发、校验登录态与权限对导入模板做版本管理避免结构变化导致解析失败。可观测性完善导入/导出日志与失败明细接入告警提供导入结果统计成功/失败/原因下载。五 依赖与配置建议核心依赖示例!-- Apache POI --dependencygroupIdorg.apache.poi/groupIdartifactIdpoi/artifactIdversion5.2.5/version/dependencydependencygroupIdorg.apache.poi/groupIdartifactIdpoi-ooxml/artifactIdversion5.2.5/version/dependency!-- 可选EasyExcel大数据量导入导出更省内存 --dependencygroupIdcom.alibaba/groupIdartifactIdeasyexcel/artifactIdversion3.3.3/version/dependency配置建议上传大小限制spring.servlet.multipart.max-file-size / max-request-size静态资源与模板将模板放入src/main/resources/applicationStandard/确保打包后位于classpath统一异常处理使用ControllerAdvice捕获 Excel 解析/IO 异常返回标准错误码与提示以上文档覆盖了从模板下载、批量导入到数据导出的完整链路并给出了关键代码示例与优化方向。后续可结合 EasyExcel 或自研模板引擎进一步提升可维护性与性能。
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

如何做app 的模板下载网站网页打包成apk

博主介绍 💗博主介绍:✌全栈领域优质创作者,专注于Java、小程序、Python技术领域和计算机毕业项目实战✌💗 👇🏻 精彩专栏 推荐订阅👇🏻 2025-2026年最新1000个热门Java毕业设计选题…

张小明 2025/12/28 21:09:41 网站建设

网站营销的流程宁夏建设厅网站首页

先问个扎心的问题:你们公司是不是也这样? 财务需要看成本数据,但不该看到客户隐私一个Excel表传来传去,版本混乱,错误百出想上SaaS系统,又担心数据安全,还嫌费用太高 这正是一款国产多维表格工具…

张小明 2025/12/28 21:55:40 网站建设

在线购物网站的设计与实现江西省上饶市网站建设公司

在复杂系统研究中,「网络」几乎无处不在——从基因调控网络、微生物群落,到人类社会中的传播网络与交通网络。然而,如何真正理解这些高维网络背后的动力学规律,始终是该领域最棘手的问题之一。 一方面, 传感器、测序技…

张小明 2025/12/28 22:12:37 网站建设

centos6.3 网站开发专业网站开发软件

第一章:Open-AutoGLM web地址Open-AutoGLM 是一个基于开源大语言模型的自动化代码生成平台,致力于为开发者提供高效的代码辅助与智能推理能力。该平台通过集成先进的自然语言处理技术,支持多种编程语言的上下文感知生成,极大提升了…

张小明 2025/12/28 22:14:22 网站建设

请写出网站建设前期需要做的准备网页美工设计期末作业成品

文章讲述了智能问答系统从纯RAG技术到结合Agent技术的优化过程。针对三个子场景中结构化和非结构化数据混合查询的问题,作者最初按场景建立三个知识库,但遇到召回率低、场景判断不准的困境。后改为从数据类型维度建立两个知识库(结构化和非结…

张小明 2025/12/28 23:05:29 网站建设

做网站注意哪方面管理系统入口admin

永磁电机RBP神经自适应PID控制(送配套资料 MATLAB仿真模型 永磁电机转速3000转,2s时,负载转矩由10到15 电流环采用PID,转速环采用RBP神经元自适应PID控制 送配套资料 包括原理讲解和代码讲解在电机控制领域,永磁电机凭…

张小明 2025/12/28 23:49:21 网站建设