Sfoglia il codice sorgente

1、运力导出接口调整;

zk 2 anni fa
parent
commit
a2743e7d3f

+ 5 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java

@@ -9,6 +9,7 @@ import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.core.web.response.ResponseUtil;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.fleet.model.dto.*;
 import com.sckw.fleet.model.vo.*;
@@ -20,6 +21,8 @@ import org.springframework.http.MediaType;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -125,15 +128,14 @@ public class KwfDriverController {
      * @date 2023/07/11
      **/
     @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult export(@RequestBody Map<String, Object> params, HttpServletResponse response) {
+    public void export(@RequestBody Map<String, Object> params, HttpServletResponse response) throws IOException {
         /**分页数据**/
         List<KwfDriverVo> drivers = driverService.findPage(params);
 
         if (!CollectionUtils.isEmpty(drivers)) {
             ExcelUtil.downData(response, KwfDriverVo.class, drivers);
-            return HttpResult.ok();
         }
-        return HttpResult.error("无数据!");
+        ResponseUtil.writer(response, HttpResult.error("没有您想导出的数据!"));
     }
 
     /**

+ 5 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfFleetController.java

@@ -8,6 +8,7 @@ import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.core.web.response.ResponseUtil;
 import com.sckw.excel.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.fleet.model.dto.KwfFleetDto;
@@ -19,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
@@ -80,16 +83,15 @@ public class KwfFleetController {
      * @date 2023/07/11
      **/
     @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult export(@RequestBody Map<String, Object> params, HttpServletResponse response) {
+    public void export(@RequestBody Map<String, Object> params, HttpServletResponse response) throws IOException {
         params.put("entId", LoginUserHolder.getEntId());
         /**查询分页数据**/
         List<KwfFleetVo> fleets = fleetService.findPage(params);
 
         if (!CollectionUtils.isEmpty(fleets)) {
             ExcelUtil.downData(response, KwfFleetVo.class, fleets);
-            return HttpResult.ok();
         }
-        return HttpResult.error("无数据!");
+        ResponseUtil.writer(response, HttpResult.error("没有您想导出的数据!"));
     }
 
     /**

+ 3 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -14,6 +14,7 @@ import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.core.web.response.ResponseUtil;
 import com.sckw.excel.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.fleet.model.dto.GpsByTruckNoDto;
@@ -138,15 +139,14 @@ public class KwfTruckController {
      * @date 2023/07/11
      **/
     @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult export(@RequestBody Map<String, Object> params, HttpServletResponse response) {
+    public void export(@RequestBody Map<String, Object> params, HttpServletResponse response) throws IOException {
         /**查询数据**/
         List<KwfTruckVo> trucks = truckService.findPage(params);
 
         if (!CollectionUtils.isEmpty(trucks)) {
             ExcelUtil.downData(response, KwfTruckVo.class, trucks);
-            return HttpResult.ok();
         }
-        return HttpResult.error("无数据!");
+        ResponseUtil.writer(response, HttpResult.error("没有您想导出的数据!"));
     }
 
     /**

+ 6 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckReportController.java

@@ -6,8 +6,10 @@ import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.enums.SystemTypeEnum;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
+import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.core.web.response.ResponseUtil;
 import com.sckw.excel.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.fleet.model.KwfTruckReport;
@@ -22,6 +24,8 @@ import org.springframework.http.MediaType;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
@@ -73,16 +77,15 @@ public class KwfTruckReportController {
      * @date 2023/07/18
      **/
     @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
-    public HttpResult export(@RequestBody Map<String, Object> params, HttpServletResponse response) {
+    public void export(@RequestBody Map<String, Object> params, HttpServletResponse response) throws IOException {
         params.put("entId", LoginUserHolder.getEntId());
         /**查询数据**/
         List<KwfTruckReportVo> trucks = reportService.findPage(params);
 
         if (!CollectionUtils.isEmpty(trucks)) {
             ExcelUtil.downData(response, KwfTruckReportVo.class, trucks);
-            return HttpResult.ok();
         }
-        return HttpResult.error("无数据!");
+        ResponseUtil.writer(response, HttpResult.error("没有您想导出的数据!"));
     }
 
     /**