From e1008dbb1fa76874a28c06913b95c16d18acdfa7 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期五, 11 十一月 2022 17:54:52 +0800
Subject: [PATCH] 短信模块 消息列表

---
 ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java |   49 ++++++++++++++++++-------------------------------
 1 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java b/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java
index 21ba024..5cd81d7 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java
@@ -11,6 +11,7 @@
 import com.ycl.entity.equipment.EquipmentBayonet;
 import com.ycl.service.dict.IDataDictionaryService;
 import com.ycl.service.equipment.IEquipmentBayonetService;
+import com.ycl.utils.EasyExcelUtils;
 import com.ycl.vo.equipment.EquipmentBayonetVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -21,8 +22,8 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
-import java.net.URLEncoder;
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.stream.Collectors;
 
 /**
@@ -68,14 +69,14 @@
 
     @PostMapping("/addition")
     @ApiOperation("娣诲姞")
-    @LogSave(operationType = "鍗″彛绠$悊",contain = "娣诲姞鍗″彛")
+    @LogSave(operationType = "鍗″彛绠$悊", contain = "娣诲姞鍗″彛")
     public CommonResult add(@RequestBody EquipmentBayonet equipmentBayonet) {
         return CommonResult.success(iEquipmentBayonetService.save(equipmentBayonet));
     }
 
     @PutMapping("/modification")
     @ApiOperation("淇敼")
-    @LogSave(operationType = "鍗″彛绠$悊",contain = "淇敼鍗″彛")
+    @LogSave(operationType = "鍗″彛绠$悊", contain = "淇敼鍗″彛")
     public CommonResult modify(@RequestBody EquipmentBayonet equipmentBayonet) {
         return CommonResult.success(iEquipmentBayonetService.updateById(equipmentBayonet));
     }
@@ -83,7 +84,7 @@
     @GetMapping("/export")
     @ApiOperation("瀵煎嚭")
     @SneakyThrows
-    @LogSave(operationType = "鍗″彛绠$悊",contain = "鍒犻櫎鍗″彛")
+    @LogSave(operationType = "鍗″彛绠$悊", contain = "瀵煎嚭鍗″彛")
     public void export(HttpServletResponse response,
                        @RequestParam(required = false) Integer size,
                        @RequestParam(required = false) Integer current,
@@ -91,31 +92,17 @@
         Page<EquipmentBayonet> equipmentBayonetPage = new Page<>();
         equipmentBayonetPage.setCurrent(current);
         equipmentBayonetPage.setSize(size);
-        StringBuilder fileName = new StringBuilder();
-        fileName.append(LocalDateTime.now().getYear())
-                .append("-")
-                .append(LocalDateTime.now().getMonthValue())
-                .append("-")
-                .append(LocalDateTime.now().getDayOfMonth())
-                .append("鍗″彛鏁版嵁");
-        response.setContentType("application/vnd.ms-excel");
-        response.setCharacterEncoding("utf-8");
-        String file = URLEncoder.encode(fileName.toString(), "UTF-8").replaceAll("\\+", "%20");
-        response.setHeader("Content-disposition", "attachment;filename=" + file + ".xlsx");
-        EasyExcel.write(response.getOutputStream(), EquipmentBayonetVO.class)
-                .sheet("鏁版嵁")
-                .doWrite(iEquipmentBayonetService
-                        .page(equipmentBayonetPage, new LambdaQueryWrapper<EquipmentBayonet>()
-                                .like(StringUtils.isNotBlank(bayonetName), EquipmentBayonet::getBayonetName, bayonetName))
-                        .getRecords()
-                        .stream()
-                        .map(item -> {
-                            EquipmentBayonetVO equipmentBayonetVO = new EquipmentBayonetVO();
-                            BeanUtils.copyProperties(item, equipmentBayonetVO);
-                            equipmentBayonetVO.setFrontEndType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getFrontEndType())).getName());
-                            equipmentBayonetVO.setInOutCityType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getInOutCityType())).getName());
-                            return equipmentBayonetVO;
-                        }).collect(Collectors.toList()));
+        EasyExcelUtils.export(response,"鏁版嵁",EquipmentBayonetVO.class,iEquipmentBayonetService
+                .page(equipmentBayonetPage, new LambdaQueryWrapper<EquipmentBayonet>()
+                        .like(StringUtils.isNotBlank(bayonetName), EquipmentBayonet::getBayonetName, bayonetName))
+                .getRecords()
+                .stream()
+                .map(item -> {
+                    EquipmentBayonetVO equipmentBayonetVO = new EquipmentBayonetVO();
+                    BeanUtils.copyProperties(item, equipmentBayonetVO);
+                    equipmentBayonetVO.setFrontEndType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getFrontEndType())).getName());
+                    equipmentBayonetVO.setInOutCityType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getInOutCityType())).getName());
+                    return equipmentBayonetVO;
+                }).collect(Collectors.toList()));
     }
-
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0