|  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public static FtpUtil ftp  = null; | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "上传", notes = "上传", httpMethod = "POST", position = 6) | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |         @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
 |  |  |             @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
 |  |  |     }) | 
 |  |  |     @PostMapping(value = "/upload", headers = "content-type=multipart/form-data") | 
 |  |  |     public void uploadMobile(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
 |  |  |         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | 
 |  |  |         upload(multipartRequest, response, folder + "/", | 
 |  |  |             systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.BUCKETNAME).getCode(), | 
 |  |  |             systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.ACCESS_ID).getCode(), | 
 |  |  |             systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.ACCESS_KEY).getCode(), | 
 |  |  |             systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.RESOURCE_PATH).getCode(), | 
 |  |  |             systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.ENDPOINT).getCode()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "上传图片", notes = "上传图片", httpMethod = "POST", position = 6) | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
 |  |  |     }) | 
 |  |  |     @PostMapping(value = "/uploadPicture", headers = "content-type=multipart/form-data") | 
 |  |  |     public void uploadPicture(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
 |  |  |         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | 
 |  |  |         Iterator<String> fileNames = multipartRequest.getFileNames(); | 
 |  |  |         Map<String, Object> context = new HashMap<>(); | 
 |  |  |         while (fileNames.hasNext()){ | 
 |  |  |             MultipartFile file = multipartRequest.getFile(fileNames.next()); | 
 |  |  |             String fileName = file.getOriginalFilename(); | 
 |  |  |             String suffix = fileName.substring(fileName.lastIndexOf(".")); | 
 |  |  |             if ( !StringUtils.equalsIgnoreCase(suffix, ".jpg") || !StringUtils.equalsIgnoreCase(suffix, ".png")) { | 
 |  |  |                 context.put("code", 0); | 
 |  |  |                 context.put("message", "对不起,文件格式上传有误!"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         upload(multipartRequest, response, folder + "/", | 
 |  |  |                 systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.BUCKETNAME).getCode(), | 
 |  |  |                 systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.ACCESS_ID).getCode(), | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public static  FtpUtil ftp  = null; | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "上传文件到FTP") | 
 |  |  |     @RequestMapping(method= RequestMethod.POST,value="api/uploadFtp.do",headers = "content-type=multipart/form-data") | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public void upload(HttpServletRequest request, HttpServletResponse response, String folder, String bucketName, | 
 |  |  |         String access_id, String access_key, String resourcePath, String endpoint) throws Exception { | 
 |  |  |                        String access_id, String access_key, String resourcePath, String endpoint) throws Exception { | 
 |  |  |         response.setCharacterEncoding("UTF-8"); | 
 |  |  |         response.setContentType("text/html;charset=UTF-8"); | 
 |  |  |         Map<String, Object> context = new HashMap<>(); | 
 |  |  | 
 |  |  |                     if (StringUtils.equalsIgnoreCase(nfix, ".dll")) { | 
 |  |  |                         context.put("code", 4000); | 
 |  |  |                         context.put("message", "对不起,文件格式\".dll\"上传有误!"); | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                     if (StringUtils.equalsIgnoreCase(nfix, ".so")) { | 
 |  |  |                         context.put("code", 4000); | 
 |  |  |                         context.put("message", "对不起,文件格式\".so\"上传有误!"); | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                     String nowDate = DateUtil.getNowShortDate();// 当前时间(年月日) | 
 |  |  | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |