|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "上传", notes = "上传", httpMethod = "POST", position = 6) | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
|---|
|  |  |  | @ApiImplicitParam(name = "file", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data") | 
|---|
|  |  |  | public void uploadLocal(HttpServletRequest request, HttpServletResponse response) throws Exception { | 
|---|
|  |  |  | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | 
|---|
|  |  |  | uploadFileLocal(multipartRequest, response, | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.IMG_DIR).getCode() , | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation(value = "上传OBS", notes = "上传OBS", httpMethod = "POST", position = 6) | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(value = "/upload", headers = "content-type=multipart/form-data") | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | public void upload(HttpServletRequest request, HttpServletResponse response, String folder) throws Exception { | 
|---|
|  |  |  | public void upload(HttpServletRequest request, HttpServletResponse response, String folder,String flag) throws Exception { | 
|---|
|  |  |  | Date d1 = new Date(); | 
|---|
|  |  |  | log.error("总得上传文件成功=============开始========="+DateUtil.getPlusTime2(d1)); | 
|---|
|  |  |  | SystemDictData folderData =  systemDictDataBiz.queryByCode(Constants.FTP,folder); | 
|---|
|  |  |  | if(Objects.isNull(folderData)||StringUtils.isBlank(folderData.getCode())){ | 
|---|
|  |  |  | if(Objects.isNull(folder)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"目标文件夹错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | folder =folderData.getCode().replace("/", ""); | 
|---|
|  |  |  | String prefixPath = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode(); | 
|---|
|  |  |  | String prefixPath = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RESOURCE_PATH).getCode(); | 
|---|
|  |  |  | InputStream is = null; | 
|---|
|  |  |  | response.setCharacterEncoding("UTF-8"); | 
|---|
|  |  |  | response.setContentType("text/html;charset=UTF-8"); | 
|---|
|  |  |  | 
|---|
|  |  |  | fileJSON.put("imgaddr", fName); | 
|---|
|  |  |  | fileJSON.put("imgname", fileName); | 
|---|
|  |  |  | fileJSON.put("originname", originname); | 
|---|
|  |  |  | fileJSON.put("flag", flag); | 
|---|
|  |  |  | context.put("data",fileJSON); | 
|---|
|  |  |  | context.put("message","请求成功"); | 
|---|
|  |  |  | writerJson(response, context); | 
|---|