|  |  | 
 |  |  | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/public") | 
 |  |  | @Slf4j | 
 |  |  | public class PublicCloudController extends BaseController { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SystemDictDataBiz systemDictDataBiz; | 
 |  |  |  | 
 |  |  | 
 |  |  |     @ResponseBody | 
 |  |  |     public void upload(HttpServletRequest request, HttpServletResponse response, String folder) throws Exception { | 
 |  |  | //        folder = systemDictDataBiz.queryByCode(Constants.FTP,folder).getCode(); | 
 |  |  |         Date d1 = new Date(); | 
 |  |  |         log.error("总得上传文件成功=============开始========="+DateUtil.getPlusTime2(d1)); | 
 |  |  |         folder =StringUtils.defaultString(folder).replace("/", ""); | 
 |  |  |         String prefixPath = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode(); | 
 |  |  |         InputStream is = null; | 
 |  |  | 
 |  |  |         Map<String, Object> context = new HashMap<>(); | 
 |  |  |         try { | 
 |  |  |             if(ftp == null){ | 
 |  |  |                 log.error("初始化Ftp上传文件成功=============开始========="+DateUtil.getPlusTime2(new Date())); | 
 |  |  |                 ftp = new FtpUtil(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_HOST).getCode(), | 
 |  |  |                         Integer.parseInt(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PORT).getCode()), | 
 |  |  |                         systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_USERNAME).getCode(), | 
 |  |  |                         systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PWD).getCode()); | 
 |  |  |                 log.error("初始化Ftp上传文件成功=============结束========="+DateUtil.getPlusTime2(new Date())); | 
 |  |  |             }else{ | 
 |  |  |                 log.error("重连ftp上传文件成功=============开始========="+DateUtil.getPlusTime2(new Date())); | 
 |  |  |                 ftp.connect(); | 
 |  |  |                 log.error("重连ftp上传文件成功=============结束========="+DateUtil.getPlusTime2(new Date())); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver(); | 
 |  |  | 
 |  |  |                         context.put("data",fileJSON); | 
 |  |  |                         context.put("message","请求成功"); | 
 |  |  |                         writerJson(response, context); | 
 |  |  |                         Date d2= new Date(); | 
 |  |  |                         log.error("总的上传文件成功=============结束========="+DateUtil.getPlusTime2(d2) +"耗时秒:"+( (d2.getTime()-d1.getTime()) /1000)); | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception { | 
 |  |  |         response.setCharacterEncoding("UTF-8"); |