Antiloveg 8 years ago
parent
commit
f0493743c9

+ 6 - 6
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -66,9 +66,9 @@ public class PublicController extends BaseController {
 
 	@Autowired
 	private DistrictGlossoryService	districtGlossoryService;
-	
+
 	@Value(value = "${patentTemplate}")
-	private String				patentTemplate	= null;
+	private String					patentTemplate		= null;
 
 	/**
 	 * 获取验证码
@@ -123,7 +123,7 @@ public class PublicController extends BaseController {
 			}
 			if (!VerifyCodeUtils.verifyCode(verificationCode)) {
 				res.getError().add(buildError(ErrorConstants.VCODE_ERROR, "", "验证码"));
-				
+
 				return res;
 			}
 		}
@@ -177,7 +177,7 @@ public class PublicController extends BaseController {
 	@RequestMapping(value = "/downLoadPicture", method = RequestMethod.GET)
 	public Result downLoadPicture(HttpServletResponse response, String path, HttpServletRequest request) {
 		Result res = new Result();
-		if (path == "" || path == null) {
+		if (StringUtils.isBlank(path)) {
 			res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
 			return res;
 		}
@@ -204,17 +204,18 @@ public class PublicController extends BaseController {
 		} catch (IOException e) {
 			LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
 			res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
-			return res;
 		} finally {
 			try {
 				in.close();
 			} catch (IOException e) {
 				LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
+				res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
 			}
 			try {
 				out.close();
 			} catch (IOException e) {
 				LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
+				res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
 			}
 		}
 		return res;
@@ -363,5 +364,4 @@ public class PublicController extends BaseController {
 		return new Result().data(districtGlossoryService.list(pid));
 	}
 
-
 }