From 4f3a98f19143865cdc1de4791e8a95d96bd40c65 Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期五, 01 八月 2025 13:27:59 +0800 Subject: [PATCH] yys 密码已重置 --- cnas-require/src/main/java/com/ruoyi/require/controller/FeLightningProtectionController.java | 80 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/cnas-require/src/main/java/com/ruoyi/require/controller/FeLightningProtectionController.java b/cnas-require/src/main/java/com/ruoyi/require/controller/FeLightningProtectionController.java new file mode 100644 index 0000000..761ac56 --- /dev/null +++ b/cnas-require/src/main/java/com/ruoyi/require/controller/FeLightningProtectionController.java @@ -0,0 +1,80 @@ +package com.ruoyi.require.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.Result; +import com.ruoyi.common.utils.FileSaveUtil; +import com.ruoyi.require.excel.FeLightningProtectionExcel; +import com.ruoyi.require.pojo.FeLightningProtection; +import com.ruoyi.require.service.FeLightningProtectionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * <p> + * 璁炬柦鍜岀幆澧冩潯浠�-璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴� 鍓嶇鎺у埗鍣� + * </p> + * + * @author + * @since 2024-11-07 04:16:36 + */ +@Api(tags = "璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴�") +@RestController +@RequestMapping("/feLightningProtection") +public class FeLightningProtectionController { + + @Autowired + private FeLightningProtectionService feLightningProtectionService; + + @PostMapping("addLightningProtectionDetection") + @ApiOperation("璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬫柊澧�/淇敼") + public Result<?> addLightningProtectionDetection(FeLightningProtection feLightningProtection, + @RequestPart(value = "file", required = false) MultipartFile file) { + if (ObjectUtils.isNotEmpty(file)) { + String s = FileSaveUtil.uploadWordFile(file); + feLightningProtection.setSystemFileName(s); + feLightningProtection.setFileName(file.getOriginalFilename()); + } + feLightningProtectionService.saveOrUpdate(feLightningProtection); + return Result.success(); + } + + @DeleteMapping("deleteLightningProtectionDetection") + @ApiOperation("璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬪垹闄�") + public Result<?> deleteFeLightningProtection(@RequestParam("lightningProtectionId") Integer lightningProtectionId) { + feLightningProtectionService.removeById(lightningProtectionId); + return Result.success(); + } + + @GetMapping("getLightningProtectionDetection") + @ApiOperation("璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬫煡璇�") + public Result<IPage<FeLightningProtection>> getFeLightningProtection(Page page) { + IPage<FeLightningProtection> page1 = feLightningProtectionService.page(page); + return Result.success(page1); + } + + @ApiOperation(value = "璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬪鍑�") + @GetMapping("exportOfLightningProtectionDetection") + public void exportOfLightningProtectionDetection(HttpServletResponse response) throws Exception { + List<FeLightningProtectionExcel> ipage = feLightningProtectionService.exportOfLightningProtectionDetection(); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("requestType", "excel"); + response.setHeader("Access-Control-Expose-Headers", "requestType"); + // 璁剧疆鍗曞厓鏍兼牱寮� + // 淇濆瓨鍒扮涓�涓猻heet涓� + EasyExcel.write(response.getOutputStream()) + .head(FeLightningProtectionExcel.class) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 鑷�傚簲鍒楀 + .sheet("sheet") + .doWrite(ipage); + } +} -- Gitblit v1.9.3