| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.annotation.EncryptionReq; |
| | | import com.doumee.config.annotation.EncryptionResp; |
| | | import com.doumee.core.annotation.trace.Trace; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | Map<String, Object> context = new HashMap<>(); |
| | | try { |
| | | if(ftp == null){ |
| | | 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()); |
| | | }else{ |
| | | ftp.connect(); |
| | | } |
| | | |
| | | initUploadTool(); |
| | | context.put("success", true); |
| | | context.put("code", 200); |
| | | context.put("errno",0); |
| | |
| | | String date = DateUtil.getNowShortDate(); |
| | | String fName = date + "/" + UUID.randomUUID() + endType; |
| | | String fileName = folder + fName; |
| | | boolean r = ftp.uploadInputstreamBatch(is, fileName, Constants.equalsInteger(index ,fileList.length),index); |
| | | boolean r =false; |
| | | if(StringUtils.equals(Constants.uploadType.blob,uploadType)){ |
| | | r = azureBlobUtil.uploadFileWithResponse( fileName,is);//上传 |
| | | }else{ |
| | | r = ftp.uploadInputstreamBatch(is, fileName, Constants.equalsInteger(index ,fileList.length),index); |
| | | } |
| | | if (r) { |
| | | JSONObject fileJSON = new JSONObject(); |
| | | fileJSON.put("url", prefixPath + fileName); |
| | |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | Map<String, Object> context = new HashMap<>(); |
| | | try { |
| | | if(ftp == null){ |
| | | 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()); |
| | | }else{ |
| | | ftp.connect(); |
| | | } |
| | | initUploadTool(); |
| | | |
| | | CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver(); |
| | | if (multipartResovler.isMultipart(request)) { |
| | |
| | | String date = DateUtil.getNowShortDate(); |
| | | String fName = date+"/"+ UUID.randomUUID()+endType; |
| | | String fileName = folder+"/"+fName; |
| | | boolean r = ftp.uploadInputstream(is,fileName); |
| | | boolean r =false; |
| | | if(StringUtils.equals(Constants.uploadType.blob,uploadType)){ |
| | | r = azureBlobUtil.uploadFileWithResponse( fileName,is);//上传 |
| | | }else{ |
| | | r = ftp.uploadInputstream(is,fileName); |
| | | } |
| | | if(r){ |
| | | context.put("success", true); |
| | | context.put("code", 200); |