Package org.jeecgframework.web.demo.entity.test

Examples of org.jeecgframework.web.demo.entity.test.WebOfficeEntity


  @ResponseBody
  public AjaxJson save(WebOfficeEntity webOffice, HttpServletRequest request) {
    AjaxJson j = new AjaxJson();
    if (StringUtil.isNotEmpty(webOffice.getId())) {
      message = "更新成功";
      WebOfficeEntity t = webOfficeService.get(WebOfficeEntity.class, webOffice.getId());
      try {
        MyBeanUtils.copyBeanNotNull2Bean(webOffice, t);
        webOfficeService.saveOrUpdate(t);
        systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
      } catch (Exception e) {
View Full Code Here


//  }
 
  @RequestMapping(params = "getDoc")
  public void getDoc(HttpServletRequest request, Integer fileId, HttpServletResponse response) {
    // 从数据库取得数据
    WebOfficeEntity obj = systemService.getEntity(WebOfficeEntity.class, fileId);
      try {     
        Blob attachment = obj.getDoccontent();
      response.setContentType("application/x-msdownload;");
      response.setHeader("Content-disposition", "attachment; filename="
          + new String((obj.getDoctitle()+"."+obj.getDoctype()).getBytes("GBK"), "ISO8859-1"));
          //从数据库中读取出来    , 输出给下载用
          InputStream bis = attachment.getBinaryStream();     
          BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
      byte[] buff = new byte[2048];
      int bytesRead;
View Full Code Here

@Service("webOfficeService")
@Transactional
public class WebOfficeServiceImpl extends CommonServiceImpl implements WebOfficeServiceI {
 
  public void saveObj(WebOfficeEntity docObj, MultipartFile file) {
    WebOfficeEntity obj = null;
    if (StringUtil.isNotEmpty(docObj.getId())) {
      obj = commonDao.getEntity(WebOfficeEntity.class, docObj.getId());
      if (obj == null) {
        return;//fail
      }
    } else {
      obj = new WebOfficeEntity();
      BeanUtils.copyProperties(docObj, obj);
      String sFileName = file.getOriginalFilename();
      int iPos = sFileName.lastIndexOf('.');
      if (iPos >= 0) {
        obj.setDoctype(sFileName.substring(iPos+1));
      }
    }
    obj.setDocdate(new Date());
    LobHelper lobHelper = commonDao.getSession().getLobHelper();
    Blob data;
    try {
      data = lobHelper.createBlob(file.getInputStream(), 0);
      obj.setDoccontent(data);
    } catch (IOException e) {
      e.printStackTrace();
    }
    super.save(obj);
  }
View Full Code Here

TOP

Related Classes of org.jeecgframework.web.demo.entity.test.WebOfficeEntity

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.