企业人力外包网站_四川省招标网官网_宁波网站设计定制_跨境独立站的名词解释

中国湖州

深圳宝安玩野设计、常德2021年上小学什么时候报名、永久使用、不限域名、怎么查房地产开发商资质

项目管理小程序?

企业人力外包网站_四川省招标网官网_宁波网站设计定制_跨境独立站的名词解释

public class FileController{@Autowiredprivate ConfigService configService;/*** 上传文件*/@RequestMapping("/upload")public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {if (file.isEmpty()) {throw new EIException("上传文件不能为空");}String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);File path = new File(ResourceUtils.getURL("classpath:static").getPath());if(!path.exists()) {path = new File("");}File upload = new File(path.getAbsolutePath(),"/upload/");if(!upload.exists()) {upload.mkdirs();}String fileName = new Date().getTime()+"."+fileExt;File dest = new File(upload.getAbsolutePath()+"/"+fileName);file.transferTo(dest);FileUtils.copyFile(dest, new File("C:\Users\Desktop\jiadian\springbootl7own\src\main\resources\static\upload"+"/"+fileName));if(StringUtils.isNotBlank(type) && type.equals("1")) {ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));if(configEntity==null) {configEntity = new ConfigEntity();configEntity.setName("faceFile");configEntity.setValue(fileName);} else {configEntity.setValue(fileName);}configService.insertOrUpdate(configEntity);}return R.ok().put("file", fileName);}/*** 下载文件*/@IgnoreAuth@RequestMapping("/download")public ResponseEntity<byte[]> download(@RequestParam String fileName) {try {File path = new File(ResourceUtils.getURL("classpath:static").getPath());if(!path.exists()) {path = new File("");}File upload = new File(path.getAbsolutePath(),"/upload/");if(!upload.exists()) {upload.mkdirs();}File file = new File(upload.getAbsolutePath()+"/"+fileName);if(file.exists()){/*if(!fileService.canRead(file, SessionManager.getSessionUser())){getResponse().sendError(403);}*/HttpHeaders headers = new HttpHeaders();headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); headers.setContentDispositionFormData("attachment", fileName); return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);}} catch (IOException e) {e.printStackTrace();}return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);}} 家乐福超市网上商城企业品牌推广的目的重庆如何优化搜索引擎建设网络文明请你对青少年发出自己的倡议企业信息系统备份管理制度模板今日新闻山西太原乐山建模培训中国到菲律宾海运货运价格深圳室内装修设计培训合肥网站备案公司有哪些郑州优化代理佛山优化公司就找23火星食品新产品网络营销方案贸易网二手设备php代码怎么嵌入html代码站长工具推荐高清江门鹤山古劳镇黄骅港调车队seo从入门到精通200讲第51讲微信开放平台登录官网中天建设集团拖欠工资电子商务平台开发web山东省德州疫情最新消息接单派单软件h5网站制作收费微信公众号登录失败10005甘肃省建设厅官网证件下载永康市跨海网络科技有限公司站酷网素材图库免费幼儿园布置宁波房地产信息网黄骅市滕庄子乡土地出让结果公告

猜你喜欢

  • 友情链接:
  • 电子商务网站建设图片 中金公司大全 龙口黄城 东莞南城房价多少钱一平方 网络营销的服务策略 广州最新疫情报告