Package org.jeecgframework.core.common.model.common

Examples of org.jeecgframework.core.common.model.common.UploadFile


    String fileid =oConvertUtils.getString(request.getParameter("fileid"));
    String subclassname = oConvertUtils.getString(request.getParameter("subclassname"), "com.jeecg.base.pojo.TSAttachment");
    Class fileClass = MyClassLoader.getClassByScn(subclassname);// 附件的实际类
    Object fileobj = systemService.getEntity(fileClass, fileid);
    ReflectHelper reflectHelper = new ReflectHelper(fileobj);
    UploadFile uploadFile = new UploadFile(request, response);
    String contentfield = oConvertUtils.getString(request.getParameter("contentfield"), uploadFile.getByteField());
    byte[] content = (byte[]) reflectHelper.getMethodValue(contentfield);
    String path = oConvertUtils.getString(reflectHelper.getMethodValue("realpath"));
    String extend = oConvertUtils.getString(reflectHelper.getMethodValue("extend"));
    String attachmenttitle = oConvertUtils.getString(reflectHelper.getMethodValue("attachmenttitle"));
    uploadFile.setExtend(extend);
    uploadFile.setTitleField(attachmenttitle);
    uploadFile.setRealPath(path);
    uploadFile.setContent(content);
    //uploadFile.setView(true);
    systemService.viewOrDownloadFile(uploadFile);
  }
View Full Code Here


  @RequestMapping(params = "parserXml")
  @ResponseBody
  public AjaxJson parserXml(HttpServletRequest request, HttpServletResponse response) {
    AjaxJson json = new AjaxJson();
    String fileName = null;
    UploadFile uploadFile = new UploadFile(request);
    String ctxPath = request.getSession().getServletContext().getRealPath("");
    File file = new File(ctxPath);
    if (!file.exists()) {
      file.mkdir();// 创建文件根目录
    }
    MultipartHttpServletRequest multipartRequest = uploadFile.getMultipartRequest();
    Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
    for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
      MultipartFile mf = entity.getValue();// 获取上传文件对象
      fileName = mf.getOriginalFilename();// 获取文件名
      String savePath = file.getPath() + "/" + fileName;
View Full Code Here

    LogUtil.info("-------------------------step.2-------------------------------------");
    cgformFtl.setCgformId(cgformId);
    cgformFtl.setCgformName(cgformName);
    cgformFtl.setFtlStatus(ftlStatus);

    UploadFile uploadFile = new UploadFile(request, cgformFtl);
    uploadFile.setCusPath("forms");
    message = null;
    try {

      uploadFile.getMultipartRequest().setCharacterEncoding("UTF-8");
      MultipartHttpServletRequest multipartRequest = uploadFile
          .getMultipartRequest();

      String uploadbasepath = uploadFile.getBasePath();// 文件上传根目录
      if (uploadbasepath == null) {
        uploadbasepath = ResourceUtil.getConfigByName("uploadpath");
      }
      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
      // 文件数据库保存路径
      String path = uploadbasepath + "\\";// 文件保存在硬盘的相对路径
      String realPath = uploadFile.getMultipartRequest().getSession()
          .getServletContext().getRealPath("\\")
          + path;// 文件的硬盘真实路径
      File file = new File(realPath);
      if (!file.exists()) {
        file.mkdir();// 创建根目录
      }
      if (uploadFile.getCusPath() != null) {
        realPath += uploadFile.getCusPath() + "\\";
        path += uploadFile.getCusPath() + "\\";
        file = new File(realPath);
        if (!file.exists()) {
          file.mkdir();// 创建文件自定义子目录
        }
      } else {
        realPath += DataUtils.getDataString(DataUtils.yyyyMMdd) + "\\";
        path += DataUtils.getDataString(DataUtils.yyyyMMdd) + "\\";
        file = new File(realPath);
        if (!file.exists()) {
          file.mkdir();// 创建文件时间子目录
        }
      }
      LogUtil.info("-------------------------step.3-------------------------------------");
      String fileName = "";
      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
        MultipartFile mf = entity.getValue();// 获取上传文件对象
        fileName = mf.getOriginalFilename();// 获取文件名
        String extend = FileUtils.getExtend(fileName);// 获取文件扩展名
        String myfilename = "";
        String myhtmlfilename = "";
        String noextfilename = "";// 不带扩展名
        if (uploadFile.isRename()) {

          noextfilename = DataUtils
              .getDataString(DataUtils.yyyymmddhhmmss)
              + StringUtil.random(8);// 自定义文件名称
          myfilename = noextfilename + "." + extend;// 自定义文件名称
View Full Code Here

      financeFile = systemService.getEntity(TFinanceFilesEntity.class, fileKey);

    }
    TFinanceEntity finance = systemService.getEntity(TFinanceEntity.class, financeId);
    financeFile.setFinance(finance);
    UploadFile uploadFile = new UploadFile(request, financeFile);
    uploadFile.setCusPath("files");
    uploadFile.setSwfpath("swfpath");
    uploadFile.setByteField(null);//不存二进制内容
    financeFile = systemService.uploadFile(uploadFile);
    attributes.put("fileKey", financeFile.getId());
    attributes.put("viewhref", "commonController.do?objfileList&fileKey=" + financeFile.getId());
    attributes.put("delurl", "commonController.do?delObjFile&fileKey=" + financeFile.getId());
    j.setMsg("文件添加成功");
View Full Code Here

    }
    if (StringUtil.isNotEmpty(fileKey)) {
      cgUploadEntity.setId(fileKey);
      cgUploadEntity = systemService.getEntity(CgUploadEntity.class, fileKey);
    }
    UploadFile uploadFile = new UploadFile(request, cgUploadEntity);
    uploadFile.setCusPath("files");
    uploadFile.setSwfpath("swfpath");
    uploadFile.setByteField(null);//不存二进制内容
    cgUploadEntity = systemService.uploadFile(uploadFile);
    cgUploadService.writeBack(id, tableName, cgField, fileKey, cgUploadEntity.getRealpath());
    attributes.put("fileKey", cgUploadEntity.getId());
    attributes.put("viewhref", "commonController.do?objfileList&fileKey=" + cgUploadEntity.getId());
    attributes.put("delurl", "commonController.do?delObjFile&fileKey=" + cgUploadEntity.getId());
View Full Code Here

  @ResponseBody
  public AjaxJson doMigrateIn(HttpServletRequest request,
      HttpServletResponse response) {
    AjaxJson j = new AjaxJson();
    String ls_file = "";
    UploadFile uploadFile = new UploadFile(request, ls_file);
    uploadFile.setCusPath("");
    uploadFile.setSwfpath("");
    String uploadbasepath = uploadFile.getBasePath();// 文件上传根目录
    if (uploadbasepath == null) {
      uploadbasepath = ResourceUtil.getConfigByName("uploadpath");
    }
    String path = uploadbasepath + "\\";// 文件保存在硬盘的相对路径
    String realPath = uploadFile.getMultipartRequest().getSession()
        .getServletContext().getRealPath("\\")
        + path;// 文件的硬盘真实路径
    message = null;
    try {
      File file = new File(realPath);
      if (!file.exists()) {
        file.mkdir();// 若目录不存在,创建根目录
      }
      uploadFile.getMultipartRequest().setCharacterEncoding("UTF-8");
      MultipartHttpServletRequest multipartRequest = uploadFile
          .getMultipartRequest();
      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
      String fileName = "";
      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
        MultipartFile mf = entity.getValue();// 获取上传文件对象
View Full Code Here

  @ResponseBody
  @RequestMapping(params = "doMigrateIn")
  public AjaxJson doMigrateIn(HttpServletRequest request,HttpServletResponse response){
    AjaxJson j = new AjaxJson();
    String ls_file = "";
    UploadFile uploadFile = new UploadFile(request, ls_file);
    uploadFile.setCusPath("");
    uploadFile.setSwfpath("");
    String uploadbasepath = uploadFile.getBasePath();// 文件上传根目录
    if (uploadbasepath == null) {
      uploadbasepath = ResourceUtil.getConfigByName("uploadpath");
    }
    String path = uploadbasepath + "\\";// 文件保存在硬盘的相对路径
    String realPath = uploadFile.getMultipartRequest().getSession()
        .getServletContext().getRealPath("\\")
        + path;// 文件的硬盘真实路径
    message = null;
    try {
      File file = new File(realPath);
      if (!file.exists()) {
        file.mkdir();// 若目录不存在,创建根目录
      }
      uploadFile.getMultipartRequest().setCharacterEncoding("UTF-8");
      MultipartHttpServletRequest multipartRequest = uploadFile
          .getMultipartRequest();
      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
      String fileName = "";
      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
        MultipartFile mf = entity.getValue();// 获取上传文件对象
View Full Code Here

    String id = request.getParameter("id");
    icon.setId(id);
    icon.setIconName(iconName);
    icon.setIconType(iconType);
    // uploadFile.setBasePath("images/accordion");
    UploadFile uploadFile = new UploadFile(request, icon);
    uploadFile.setCusPath("plug-in/accordion/images");
    uploadFile.setExtend("extend");
    uploadFile.setTitleField("iconclas");
    uploadFile.setRealPath("iconPath");
    uploadFile.setObject(icon);
    uploadFile.setByteField("iconContent");
    uploadFile.setRename(false);
    systemService.uploadFile(uploadFile);
    // 图标的css样式
    String css = "." + icon.getIconClas() + "{background:url('../images/" + icon.getIconClas() + "." + icon.getExtend() + "') no-repeat}";
    write(request, css);
    message = "上传成功";
View Full Code Here

   */

  @RequestMapping(params = "savesign", method = RequestMethod.POST)
  @ResponseBody
  public AjaxJson savesign(HttpServletRequest req) {
    UploadFile uploadFile = new UploadFile(req);
    String id = uploadFile.get("id");
    TSUser user = systemService.getEntity(TSUser.class, id);
    uploadFile.setRealPath("signatureFile");
    uploadFile.setCusPath("signature");
    uploadFile.setByteField("signature");
    uploadFile.setBasePath("resources");
    uploadFile.setRename(false);
    uploadFile.setObject(user);
    AjaxJson j = new AjaxJson();
    message = user.getUserName() + "设置签名成功";
    systemService.uploadFile(uploadFile);
    systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
    j.setMsg(message);
View Full Code Here

    }
    document.setSubclassname(MyClassLoader.getPackPath(document));
    document.setCreatedate(DataUtils.gettimestamp());
    document.setTSType(tsType);
    UploadFile uploadFile = new UploadFile(request, document);
    uploadFile.setCusPath("files");
    uploadFile.setSwfpath("swfpath");
    document = systemService.uploadFile(uploadFile);
    attributes.put("url", document.getRealpath());
    attributes.put("fileKey", document.getId());
    attributes.put("name", document.getAttachmenttitle());
    attributes.put("viewhref", "commonController.do?objfileList&fileKey=" + document.getId());
View Full Code Here

TOP

Related Classes of org.jeecgframework.core.common.model.common.UploadFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.