diff --git a/src/main/java/com/cetc32/dh/controller/rest/CityInfoController.java b/src/main/java/com/cetc32/dh/controller/rest/CityInfoController.java index d56dda3a099decd36ac08582bc9b5ac0832e5d85..900d28e4fb37ba782b52e631f376c4d0757a28f8 100644 --- a/src/main/java/com/cetc32/dh/controller/rest/CityInfoController.java +++ b/src/main/java/com/cetc32/dh/controller/rest/CityInfoController.java @@ -75,7 +75,10 @@ public class CityInfoController { } @PostMapping("/remove") - public ResponseData removeCityInfos(String cityCode){ + public ResponseData removeCityInfos(@RequestBody CityInfo cityInfo){ + if(null ==cityInfo) + return ResponseData.error("无效的参数"); + String cityCode = cityInfo.getCityCode(); if(StringUtils.isBlank(cityCode)){ return ResponseData.error("无效的城市编码"); } diff --git a/src/main/java/com/cetc32/dh/controller/rest/DemanSubmitController.java b/src/main/java/com/cetc32/dh/controller/rest/DemanSubmitController.java index 1f1e0b053df13d187c2afb9fefd2da7634d9f670..fa0c27a326f9b5f558a315b51d0460f51c0c50ee 100644 --- a/src/main/java/com/cetc32/dh/controller/rest/DemanSubmitController.java +++ b/src/main/java/com/cetc32/dh/controller/rest/DemanSubmitController.java @@ -1,6 +1,8 @@ package com.cetc32.dh.controller.rest; +import com.alibaba.fastjson.JSONObject; import com.cetc32.dh.common.response.PageDataResult; +import com.cetc32.dh.common.response.ResponseData; import com.cetc32.dh.common.response.ResponseResult; import com.cetc32.dh.common.utils.DateUtils; import com.cetc32.dh.dto.DemandDTO; @@ -487,11 +489,17 @@ public class DemanSubmitController { // String filename = file.getName(); // // 取得文件的后缀名。 // String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase(); - String zipPath = FileUtil.downloadAllAttachment(path,request,response); - String filename = zipPath.substring(zipPath.lastIndexOf(File.separator)+1,zipPath.length()); - FileUtil.downloadFile(response,filename,zipPath); - FileUtil.deleteDir(zipPath); - return filename; + try{ + String zipPath = FileUtil.downloadAllAttachment(path,request,response); + String filename = zipPath.substring(zipPath.lastIndexOf(File.separator)+1,zipPath.length()); + FileUtil.downloadFile(response,filename,zipPath); + FileUtil.deleteDir(zipPath); + return filename; + }catch (Exception e){ + e.printStackTrace(); + return JSONObject.toJSONString(ResponseData.error("下载文件异常,文件可能已被删除!")); + } + }