Browse Source

分期导入调整

LAPTOP-FO2T5SIU\35838 7 months ago
parent
commit
65356de035

+ 1 - 1
pro-base/pom.xml

@@ -51,7 +51,7 @@
         <dependency>
             <groupId>com.alibaba</groupId>
             <artifactId>easyexcel</artifactId>
-            <version>2.1.3</version>
+            <version>3.3.4</version>
         </dependency>
         <!-- 工具包 -->
         <dependency>

+ 18 - 0
pro-base/src/main/java/com/idea/buildManage/controller/ParkFloorDiscController.java

@@ -26,8 +26,11 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.File;
+import java.io.IOException;
 import java.util.Date;
+import java.util.List;
 
 /**
  * Created by pengyq on 2020.
@@ -120,6 +123,8 @@ public class ParkFloorDiscController extends BaseController {
             }
             EasyExcel.read(excel, ParkFloorDiscExcel.class, listener).headRowNumber(1).sheet().doRead();
             excel.delete();
+//            List<ParkFloorDiscExcel> errorList = (List<ParkFloorDiscExcel>) jsonObject.get("errorList");
+//            modelService.errorListExport(errorList,response);
         } catch (Exception e) {
             e.printStackTrace();
             return AjaxResult.error(e.getMessage());
@@ -127,6 +132,19 @@ public class ParkFloorDiscController extends BaseController {
         return AjaxResult.success(jsonObject);
     }
 
+    /**
+     * 导出
+     * @param list
+     * @param response
+     * @throws IOException
+     */
+    @PostMapping(value = "errorListExport")
+    @ResponseBody
+    public void errorListExport(@RequestBody List<ParkFloorDiscExcel> list, HttpServletResponse response) throws IOException {
+        modelService.errorListExport(list,response);
+    }
+
+
     @ApiOperation(value = "分期删除")
     @PostMapping(value = "delete",produces = {"application/json;charset=UTF-8"})
     @ResponseBody

+ 3 - 3
pro-base/src/main/java/com/idea/buildManage/excel/ParkFloorDiscExcel.java

@@ -28,10 +28,10 @@ public class ParkFloorDiscExcel {
     @ExcelProperty(value = "共持比例")
     private String proportion;
 
-    @ExcelProperty(value = "支付方式")
-    private String paymentMethods;
+//    @ExcelProperty(value = "支付方式")
+//    private String paymentMethods;
 
-    @ExcelIgnore
+    @ExcelProperty(value = "异常原因")
     private String reason;
 
 }

+ 70 - 33
pro-base/src/main/java/com/idea/buildManage/excel/ParkFloorDiscListener.java

@@ -37,7 +37,7 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
     private SysDictService sysDictService;
 
 
-    public ParkFloorDiscListener(ParkFloorDiscService floorDiscService,ParkInfoService parkInfoService,
+    public ParkFloorDiscListener(ParkFloorDiscService floorDiscService, ParkInfoService parkInfoService,
                                  SysDictService sysDictService, JSONObject jsonObject) {
         this.floorDiscService = floorDiscService;
         this.parkInfoService = parkInfoService;
@@ -58,26 +58,45 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
         // 支付方式字典
         List<Map<String, String>> paymentMethods = sysDictService.selectDictList("PAYMENT_METHODS");
 
-        if(CollectionUtils.isNotEmpty(excelList)){
+        if (CollectionUtils.isNotEmpty(excelList)) {
             ParkFloorDisc data;
             ParkFloorDiscExcel excel = null;
             Map<String, String> discNameIdMap = floorDiscService.getNameIdMap();
             Map<String, String> parkNameIdMap = parkInfoService.getNameIdMap();
 
-            for(int i = 0; i < excelList.size(); i++){
+
+            for (int i = 0; i < excelList.size(); i++) {
                 try {
+
+                    Boolean groupNameFlag = true;
+                    Boolean discNameFlag = true;
+                    Boolean unitPriceFlag = true;
+                    Boolean propertyUnitPriceFlag = true;
+                    Boolean maintenanceFundsFlag = true;
+                    Boolean subscriptionFundsFlag = true;
+                    Boolean proportionFlag = true;
+                    Boolean paymentMethodsFlag = true;
+                    StringBuilder builder = new StringBuilder();
+
                     data = new ParkFloorDisc();
                     excel = excelList.get(i);
-                    if(StringUtils.isEmpty(excel.getGroupName())){
-                        throw new RuntimeException("楼盘/小区名称为空");
+                    if (StringUtils.isEmpty(excel.getGroupName())) {
+
+                        groupNameFlag = false;
+                        builder.append("楼盘/小区名称为空").append(",");
+                        excel.setGroupName("{" + excel.getGroupName() + "}");
                     }
-                    if(StringUtils.isEmpty(excel.getDiscName())){
-                        throw new RuntimeException("楼分期名称为空");
+                    if (StringUtils.isEmpty(excel.getDiscName())) {
+                        discNameFlag = false;
+                        builder.append("楼分期名称为空").append(",");
+                        excel.setDiscName("{" + excel.getDiscName() + "}");
                     }
                     data.setName(excel.getDiscName());
                     // 判断小区是否存在
-                    if(StringUtils.isEmpty(parkNameIdMap.get(excel.getGroupName()))){
-                        throw new RuntimeException("楼盘/小区不存在");
+                    if (StringUtils.isEmpty(parkNameIdMap.get(excel.getGroupName()))) {
+                        groupNameFlag = false;
+                        builder.append("楼盘/小区不存在").append(",");
+                        excel.setGroupName("{" + excel.getGroupName() + "}");
                     }
                     data.setGroupId(parkNameIdMap.get(excel.getGroupName()));
 
@@ -86,7 +105,9 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
                         try {
                             data.setUnitPrice(new BigDecimal(excel.getUnitPrice()));
                         } catch (NumberFormatException e) {
-                            throw new RuntimeException("房屋买卖单价(元/㎡)格式有误");
+                            unitPriceFlag = false;
+                            builder.append("房屋买卖单价(元/㎡)格式有误").append(",");
+                            excel.setUnitPrice("{" + excel.getUnitPrice() + "}");
                         }
                     }
 
@@ -95,7 +116,9 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
                         try {
                             data.setPropertyUnitPrice(new BigDecimal(excel.getPropertyUnitPrice()));
                         } catch (NumberFormatException e) {
-                            throw new RuntimeException("物业费单价(元/㎡)格式有误");
+                            propertyUnitPriceFlag = false;
+                            builder.append("物业费单价(元/㎡)格式有误").append(",");
+                            excel.setPropertyUnitPrice("{" + excel.getPropertyUnitPrice() + "}");
                         }
                     }
 
@@ -104,7 +127,9 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
                         try {
                             data.setMaintenanceFunds(new BigDecimal(excel.getMaintenanceFunds()));
                         } catch (NumberFormatException e) {
-                            throw new RuntimeException("住宅专项维修资金(元/㎡)格式有误");
+                            maintenanceFundsFlag = false;
+                            builder.append("住宅专项维修资金(元/㎡)格式有误").append(",");
+                            excel.setMaintenanceFunds("{" + excel.getMaintenanceFunds() + "}");
                         }
                     }
 
@@ -113,7 +138,9 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
                         try {
                             data.setSubscriptionFunds(new BigDecimal(excel.getSubscriptionFunds()));
                         } catch (NumberFormatException e) {
-                            throw new RuntimeException("认购金(元)格式有误");
+                            subscriptionFundsFlag = false;
+                            builder.append("认购金(元)格式有误").append(",");
+                            excel.setSubscriptionFunds("{" + excel.getSubscriptionFunds() + "}");
                         }
                     }
 
@@ -122,28 +149,38 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
                         try {
                             data.setProportion(Double.valueOf(excel.getProportion()));
                         } catch (NumberFormatException e) {
-                            throw new RuntimeException("共持比例格式有误");
+                            proportionFlag = false;
+                            builder.append("共持比例格式有误").append(",");
+                            excel.setProportion("{" + excel.getProportion() + "}");
                         }
                     }
 
-                    // 支付方式
-                    if (StringUtils.isNotEmpty(excel.getPaymentMethods())) {
-                        for (Map<String, String> stringStringMap : paymentMethods) {
-                            if (stringStringMap.get("label").equals(excel.getPaymentMethods())) {
-                                data.setPaymentMethods(Integer.valueOf(stringStringMap.get("value")));
-                            }
-                        }
-                        // 没匹配上的情况
-                        if(data.getPaymentMethods() == null){
-                            throw new RuntimeException("支付方式格式有误");
-                        }
+//                    // 支付方式
+//                    if (StringUtils.isNotEmpty(excel.getPaymentMethods())) {
+//                        for (Map<String, String> stringStringMap : paymentMethods) {
+//                            if (stringStringMap.get("label").equals(excel.getPaymentMethods())) {
+//                                data.setPaymentMethods(Integer.valueOf(stringStringMap.get("value")));
+//                            }
+//                        }
+//                        // 没匹配上的情况
+//                        if (data.getPaymentMethods() == null) {
+//                            paymentMethodsFlag = false;
+//                            builder.append("支付方式格式有误").append(",");
+////                            throw new RuntimeException("支付方式格式有误");
+//                        }
+//                    }
+
+                    if (groupNameFlag && discNameFlag && unitPriceFlag && propertyUnitPriceFlag && maintenanceFundsFlag
+                            && subscriptionFundsFlag && proportionFlag && paymentMethodsFlag
+                    ) {
+                        data.setId(IdUtil.simpleUUID());
+                        data.setCreatedId(ShiroUtils.getUserId());
+                        data.setCreatedAt(new Date());
+                        list.add(data);
+                    }else {
+                        throw new RuntimeException(builder.toString());
                     }
-                    data.setId(IdUtil.simpleUUID());
-                    data.setCreatedId(ShiroUtils.getUserId());
-                    data.setCreatedAt(new Date());
-                    list.add(data);
-
-                }catch (Exception e){
+                } catch (Exception e) {
                     e.printStackTrace();
                     String message = e.getMessage();
                     excel.setReason(message);
@@ -161,14 +198,14 @@ public class ParkFloorDiscListener extends AnalysisEventListener<ParkFloorDiscEx
             excelList.clear();
             list.clear();
 
-        }else {
+        } else {
             throw new RuntimeException("excel无数据");
         }
 
 
     }
 
-    private void saveData(){
+    private void saveData() {
         if (CollectionUtils.isNotEmpty(list)) {
             floorDiscService.insertBatch(list);
         }

+ 26 - 3
pro-base/src/main/java/com/idea/buildManage/excel/ParkInfoListener.java

@@ -67,16 +67,35 @@ public class ParkInfoListener extends AnalysisEventListener<ParkInfoExcel> {
             ParkInfoExcel excel = null;
 
             for(int i = 0; i < excelList.size(); i++){
+
+                Boolean groupNameFlag = true;
+                Boolean discNameFlag = true;
+                Boolean natureFlag = true;
+                Boolean preSalesLicenseNumberFlag = true;
+                Boolean companyNameFlag = true;
+                Boolean subscriptionFundsFlag = true;
+                Boolean proportionFlag = true;
+                Boolean paymentMethodsFlag = true;
+                StringBuilder builder = new StringBuilder();
+
+
+
+
                 try {
                     data = new ParkInfo();
                     excel = excelList.get(i);
 
                     if(StringUtils.isEmpty(excel.getGroupName())){
+                        groupNameFlag = false;
+                        builder.append("楼盘/小区名称为空").append(",");
+                        excel.setGroupName("{" + excel.getGroupName() + "}");
                         throw new RuntimeException("楼盘/小区名称为空");
                     }
                     data.setGroupName(excel.getGroupName());
                     if(StringUtils.isEmpty(excel.getNature())){
-                        throw new RuntimeException("性质为空");
+                        natureFlag = false;
+                        builder.append("性质为空").append(",");
+                        excel.setNature("{" + excel.getNature() + "}");
                     }
                     for (Map<String, String> stringStringMap : groupNature) {
                         if (stringStringMap.get("label").equals(excel.getNature())) {
@@ -85,11 +104,15 @@ public class ParkInfoListener extends AnalysisEventListener<ParkInfoExcel> {
                     }
                     // 没匹配上的情况
                     if(StringUtils.isEmpty(data.getNature())){
-                        throw new RuntimeException("性质格式有误");
+                        natureFlag = false;
+                        builder.append("性质格式有误").append(",");
+                        excel.setNature("{" + excel.getNature() + "}");
                     }
                     // 预销售许可证编号
                     if(StringUtils.isEmpty(excel.getPreSalesLicenseNumber())){
-                        throw new RuntimeException("预销售许可证编号为空");
+                        preSalesLicenseNumberFlag = false;
+                        builder.append("预销售许可证编号为空").append(",");
+                        excel.setPreSalesLicenseNumber("{" + excel.getPreSalesLicenseNumber() + "}");
                     }
                     data.setPreSalesLicenseNumber(excel.getPreSalesLicenseNumber());
                     // 开发公司

+ 81 - 0
pro-base/src/main/java/com/idea/buildManage/excel/WriteHandlerStrategy.java

@@ -0,0 +1,81 @@
+package com.idea.buildManage.excel;
+
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.excel.write.handler.CellWriteHandler;
+import com.alibaba.excel.write.handler.context.CellWriteHandlerContext;
+import com.rockstar.util.StringUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class WriteHandlerStrategy implements CellWriteHandler {
+
+
+    @Override
+    public void afterCellCreate(CellWriteHandlerContext context) {
+        CellWriteHandler.super.afterCellCreate(context);
+    }
+
+    @Override
+    public void afterCellDispose(CellWriteHandlerContext context) {
+        Cell cell = context.getCell();
+        // 拿到poi的workbook
+        Workbook workbook = context.getWriteWorkbookHolder().getWorkbook();
+        CellStyle baseCellStyle = getBaseCellStyle(workbook);
+        int rowIndex = cell.getRowIndex();
+        // 只处理非表头行
+        if (rowIndex == 0) {
+            return;
+        }
+        // 如果内容是字符串类型
+        if (cell.getCellType() == CellType.STRING) {
+            String stringValue = cell.getStringCellValue();
+            // 处理字符串
+            // 如果内容中有{},提取到内容 并且计算索引位置 对{}中的值进行颜色设置
+            List<String> result = new ArrayList<>();
+            Pattern BRACES = Pattern.compile("\\{.*?\\}");
+            Matcher matcher = BRACES.matcher(stringValue);
+            while (matcher.find()) {
+                String group = matcher.group(0);
+                // 既然是工具,就尽量不要依赖于外部的包,这里可以用StringUtils.isBlank
+                if (StringUtils.isNotEmpty(group)) {
+                    result.add(group);
+                }
+            }
+            // result 不为空 即为有需要改色的内容
+            if (CollUtil.isNotEmpty(result)) {
+                stringValue = stringValue.replaceAll("[{}]", "");
+                // 再设置回每个单元格里
+                cell.setCellValue(stringValue);
+                // 设置字体
+                Font font = workbook.createFont();
+                font.setColor(IndexedColors.RED.getIndex());
+                baseCellStyle.setFont(font);
+            }
+        }
+
+        cell.setCellStyle(baseCellStyle);
+        // 这里要把 WriteCellData的样式清空, 不然后面还有一个拦截器 FillStyleCellWriteHandler 默认会将 WriteCellStyle 设置到
+        // cell里面去 会导致自己设置的不一样(很关键)
+        context.getFirstCellData().setWriteCellStyle(null);
+
+
+    }
+
+    private CellStyle getBaseCellStyle(Workbook workbook) {
+        CellStyle style = workbook.createCellStyle();
+        // 设置表格内容垂直居中
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        // 设置表格内容水平居中
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setWrapText(true);
+        return style;
+    }
+
+
+
+}

+ 43 - 19
pro-base/src/main/java/com/idea/buildManage/service/ParkFloorDiscService.java

@@ -2,11 +2,13 @@ package com.idea.buildManage.service;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.IdUtil;
-import com.alibaba.fastjson.JSON;
+import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.idea.buildManage.dto.ParkFloorDiscDto;
+import com.idea.buildManage.excel.ParkFloorDiscExcel;
+import com.idea.buildManage.excel.WriteHandlerStrategy;
 import com.idea.buildManage.response.ParkFloorDiscRespson;
 import com.idea.buildManage.mapper.ParkFloorDiscExtendMapper;
 import com.idea.buildManage.mapper.ParkFloorDiscMapper;
@@ -18,10 +20,13 @@ import com.rockstar.shiro.util.ShiroUtils;
 import com.rockstar.util.SnowflakeIdWorker;
 import com.rockstar.util.StringUtils;
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.poi.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -63,7 +68,7 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
         ParkFloorDiscExample ex = new ParkFloorDiscExample();
         ex.setOrderByClause("created_at asc");
         ParkFloorDiscExample.Criteria criteria = ex.createCriteria();
-        if(StringUtils.isNotEmpty(model.getGroupIds())){
+        if (StringUtils.isNotEmpty(model.getGroupIds())) {
             List<String> groupIds = Arrays.asList(model.getGroupIds().split(","));
             criteria.andGroupIdIn(groupIds);
         }
@@ -95,7 +100,7 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
         MnpBuildingExample mnpBuildingExample = new MnpBuildingExample();
         mnpBuildingExample.createCriteria().andDiscIdEqualTo(record.getId());
         List<MnpBuilding> mnpBuildings = buildingService.selectByExample(mnpBuildingExample);
-        for(MnpBuilding build: mnpBuildings){
+        for (MnpBuilding build : mnpBuildings) {
             build.setDiscName(record.getName());
             buildingService.updateByPrimaryKey(build);
         }
@@ -159,15 +164,16 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
 
     /**
      * 新增分期
+     *
      * @param model
      * @return
      */
-    public int add(ParkFloorDiscRespson model){
+    public int add(ParkFloorDiscRespson model) {
         String houseTypeStr = model.getHouseTypeStr();
         String id = IdUtil.simpleUUID();
         model.setId(id);
         List<HouseType> houseTypes = JSONObject.parseArray(houseTypeStr, HouseType.class);
-        for(HouseType houseType : houseTypes){
+        for (HouseType houseType : houseTypes) {
             houseType.setId(IdUtil.simpleUUID());
             houseType.setDiscId(id);
             houseTypeService.insertSelective(houseType);
@@ -180,10 +186,11 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
 
     /**
      * 编辑分期
+     *
      * @param model
      * @return
      */
-    public int edit(ParkFloorDiscRespson model){
+    public int edit(ParkFloorDiscRespson model) {
 
         //先删除对应户型库
         HouseTypeExample houseTypeExample = new HouseTypeExample();
@@ -191,9 +198,9 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
         houseTypeService.deleteByExample(houseTypeExample);
         String houseTypeStr = model.getHouseTypeStr();
         List<HouseType> houseTypes = JSONObject.parseArray(houseTypeStr, HouseType.class);
-        for(HouseType houseType : houseTypes){
+        for (HouseType houseType : houseTypes) {
             // 没有id的情况
-            if(StringUtils.isEmpty(houseType.getId())){
+            if (StringUtils.isEmpty(houseType.getId())) {
                 houseType.setId(IdUtil.simpleUUID());
             }
             houseType.setDiscId(model.getId());
@@ -206,7 +213,7 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
     public ParkFloorDiscRespson getById(String id) {
         ParkFloorDisc parkFloorDisc = selectByPrimaryKey(id);
         ParkFloorDiscRespson parkFloorDiscRespson = new ParkFloorDiscRespson();
-        BeanUtil.copyProperties(parkFloorDisc,parkFloorDiscRespson);
+        BeanUtil.copyProperties(parkFloorDisc, parkFloorDiscRespson);
 //        HouseTypeExample houseTypeExample = new HouseTypeExample();
 //        houseTypeExample.createCriteria().andDiscIdEqualTo(id);
 //        List<HouseType> houseTypes = houseTypeService.selectByExampleWithBLOBs(houseTypeExample);
@@ -217,49 +224,66 @@ public class ParkFloorDiscService implements BaseService<ParkFloorDisc, ParkFloo
         return parkFloorDiscRespson;
     }
 
-    public Map<String,String> getNameIdMap() {
+    public Map<String, String> getNameIdMap() {
         Map<String, String> map = new HashMap<>();
         List<ParkFloorDisc> list = selectByExample(new ParkFloorDiscExample());
         if (CollectionUtils.isNotEmpty(list)) {
-            map = list.stream().collect(Collectors.toMap(ParkFloorDisc::getName, ParkFloorDisc::getId, (v1, v2) ->v1));
+            map = list.stream().collect(Collectors.toMap(ParkFloorDisc::getName, ParkFloorDisc::getId, (v1, v2) -> v1));
         }
         return map;
     }
 
-    public void insertBatch(List<ParkFloorDisc> list){
-            extendMapper.insertBatch(list);
+    public void insertBatch(List<ParkFloorDisc> list) {
+        extendMapper.insertBatch(list);
     }
 
     /**
      * 分期删除
+     *
      * @param id
      * @return
      */
-    public int delete(String id){
+    public int delete(String id) {
         MnpBuildingExample buildingExample = new MnpBuildingExample();
         buildingExample.createCriteria().andDiscIdEqualTo(id);
         List<MnpBuilding> mnpBuildings = buildingService.selectByExample(buildingExample);
-        if(CollectionUtils.isNotEmpty(mnpBuildings)){
+        if (CollectionUtils.isNotEmpty(mnpBuildings)) {
             throw new RuntimeException("该数据有子单元/楼栋存在,无法删除");
         }
         return deleteByPrimaryKey(id);
     }
 
 
-    public String getOrderNum(ParkFloorDisc floorDisc){
+    public String getOrderNum(ParkFloorDisc floorDisc) {
 
         ParkFloorDiscExample example = new ParkFloorDiscExample();
         example.createCriteria().andGroupIdEqualTo(floorDisc.getGroupId());
         Long count = countByExample(example);
         String number = "";
-        if(count.doubleValue() == 0){
+        if (count.doubleValue() == 0) {
             number = "01";
-        }else {
+        } else {
             count++;
             number = String.format("%02d", count);
         }
         return number;
     }
 
+    public void errorListExport(List<ParkFloorDiscExcel> list, HttpServletResponse response) throws IOException {
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String date = sdf.format(new Date());
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        String fileName = URLEncoder.encode("失败几率" + date, "UTF-8");
+        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+        EasyExcel.write(response.getOutputStream(), ParkFloorDiscExcel.class)
+                .inMemory(true)
+                .registerWriteHandler(new WriteHandlerStrategy())//自定义样式
+                .sheet().doWrite(list);
+
+    }
+
 
 }