@Transactional public String saveImportPermitZt(String path,SysUser user,String hvalue){ int index = 0; String datamsg=""; SysFile sysfilee = null; String patch = path; //截取file/之后的内容 indexs+5-------indexs+0为截取file/的内容(包含file/) int indexs = patch.indexOf("file/"); String newStr = patch.substring(indexs + 5); String patchs = path; int indess = patchs.indexOf("/upload"); String ing = patchs.substring(indess + 0); SysFileMap sysfile = new SysFileMap(); List<SysFile> errorPermitList = new ArrayList<SysFile>(); JsonRootBean JsonRootBean = new JsonRootBean(); try { // 创建输入流 InputStream stream = new FileInputStream(path); sysfilee = new SysFile(); List<Map<String, Object>> list = this.sysDepartmentManager.getEntityDao().findListObjectBySql("sqlY语句",hvalue); String sts = String.valueOf(list.get(0).get("hkey")); sysfilee.setCretime(new Date()); sysfilee.setCreusername(user.getUsername()); sysfilee.setCreuserid(user.getDepid()); sysfilee.setFilename(newStr); sysfilee.setFilepath(newStr); sysfilee.setPicpath(ing); sysFileDao.save(sysfilee); sysfile.setFileid(sysfilee.getFileid()); sysfile.setTabletype(sts); sysFileMapDao.save(sysfile); index++; } catch (Exception e) { e.printStackTrace(); JsonRootBean.setTipmsg("读取文件失败"); return JSONUtil.beanToJson(JsonRootBean); } return JSONUtil.beanToJson(JsonRootBean); }