Преглед изворни кода

导出数据为空提示优化

yzc пре 2 година
родитељ
комит
a0ef0fd21a

+ 3 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwoTransportDemandController.java

@@ -1,8 +1,9 @@
 package com.sckw.order.controller;
 
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.order.model.dto.TransportDemandExport;
@@ -117,7 +118,7 @@ public class KwoTransportDemandController {
     public void export(@RequestBody ExportTransportDemandParam param, HttpServletResponse response) {
         List<TransportDemandExport> list = kwoTransportDemandService.export(param);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, TransportDemandExport.class, list);
     }

+ 3 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java

@@ -1,8 +1,9 @@
 package com.sckw.order.controller;
 
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.order.model.dto.WantBuyExport;
@@ -165,7 +166,7 @@ public class KwpWantBuyController {
     public void export(@RequestBody WantBuySelectParam param, HttpServletResponse response) {
         List<WantBuyExport> list = kwpWantBuyService.export(param);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, WantBuyExport.class, list);
     }

+ 3 - 2
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java

@@ -1,8 +1,9 @@
 package com.sckw.product.controller;
 
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.product.model.GoodsListExport;
@@ -115,7 +116,7 @@ public class KwpGoodsController {
     public void export(@RequestBody ExportStatisticGoodsListParam params, HttpServletResponse response) {
         List<GoodsListExport> list = kwpGoodsService.export(params);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, GoodsListExport.class, list);
     }

+ 3 - 2
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/operation/GoodsManagerController.java

@@ -1,7 +1,8 @@
 package com.sckw.product.controller.operation;
 
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.product.model.OperationGoodsListExport;
@@ -77,7 +78,7 @@ public class GoodsManagerController {
     public void export(@RequestBody @Validated OperatorGoodsExportQueryVO params, HttpServletResponse response) {
         List<OperationGoodsListExport> list = goodsManagerService.export(params);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, OperationGoodsListExport.class, list);
     }

+ 3 - 2
sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwOrderController.java

@@ -1,7 +1,8 @@
 package com.sckw.report.controller;
 
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.report.service.KwOrderService;
@@ -85,7 +86,7 @@ public class KwOrderController {
     public void export(@RequestBody @Validated TradeOrderListExportParam params, HttpServletResponse response) {
         List<TradeOrderListExport> list = orderService.export(params);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, TradeOrderListExport.class, list);
     }

+ 2 - 2
sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/KwTransportController.java

@@ -1,6 +1,6 @@
 package com.sckw.report.controller;
 
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
@@ -278,7 +278,7 @@ public class KwTransportController {
     public void wayBillOrderExport(@RequestBody @Validated WaybillOrderQuery query, HttpServletResponse response) {
         List<WaybillOrderListExport> list = transportService.wayBillOrderExport(query);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, WaybillOrderListExport.class, list);
     }

+ 7 - 3
sckw-modules/sckw-report/src/main/java/com/sckw/report/controller/operator/TradeOrderManageController.java

@@ -1,7 +1,8 @@
 package com.sckw.report.controller.operator;
 
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.report.model.vo.OperatorTOrderContractParam;
@@ -14,7 +15,10 @@ import jakarta.servlet.http.HttpServletResponse;
 import lombok.AllArgsConstructor;
 import org.springframework.http.MediaType;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
@@ -67,7 +71,7 @@ public class TradeOrderManageController {
     public void listExport(@RequestBody @Validated OperatorTOrderExportQueryVO params, HttpServletResponse response) {
         List<TradeOrderListExport> list = tradeOrderManageService.export(params);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, TradeOrderListExport.class, list);
     }

+ 3 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/LogisticsConsignmentController.java

@@ -1,7 +1,7 @@
 package com.sckw.transport.controller;
 
 import com.alibaba.fastjson.JSONObject;
-import com.sckw.core.exception.BusinessException;
+import com.sckw.core.exception.CustomPromptException;
 import com.sckw.core.model.enums.OrderRuleEnum;
 import com.sckw.core.model.enums.RedisOrderGenerateEnum;
 import com.sckw.core.model.vo.BaseList;
@@ -312,7 +312,7 @@ public class LogisticsConsignmentController {
     public void logisticOrderByPurchaseOrderIdExport(@RequestParam("ids") @NotBlank(message = "单据id不能为空") String ids, HttpServletResponse response) {
         List<PurchaseLogisticOrderExcelVo> list = logisticsConsignmentService.logisticOrderByPurchaseOrderIdExport(ids);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, PurchaseLogisticOrderExcelVo.class, list);
     }
@@ -328,7 +328,7 @@ public class LogisticsConsignmentController {
     public void logisticOrderBySellOrderIdExport(@RequestParam("ids") @NotBlank(message = "单据id不能为空") String ids, HttpServletResponse response) {
         List<SellLogisticOrderExcelVo> list = logisticsConsignmentService.logisticOrderBySellOrderIdExport(ids);
         if (CollectionUtils.isEmpty(list)) {
-            throw new BusinessException("暂无数据,请确认");
+            throw new CustomPromptException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认");
         }
         ExcelUtil.downData(response, SellLogisticOrderExcelVo.class, list);
     }