コード例 #1
0
  /**
   * 功能描述:期刊目次修改 <br>
   * 输入:修改信息 <br>
   * 输出:列表 <br>
   * 创建日期:Jun 27, 2008
   */
  public String JourEdit() throws IOException {
    Journal journal = getJournal();

    journal.setName(CharacterTrans.transGB2312ToTo8859_1(getJournal().getName()));
    journal.setIssueTime(CharacterTrans.transGB2312ToTo8859_1(getJournal().getIssueTime()));
    journal.setRoll(CharacterTrans.transGB2312ToTo8859_1(getJournal().getRoll()));
    journal.setIssue(CharacterTrans.transGB2312ToTo8859_1(getJournal().getIssue()));
    // *******************
    System.out.println(context.getRealPath(getSavePath()));
    com.sun.jmx.snmp.Timestamp tm = new com.sun.jmx.snmp.Timestamp();
    String newName;
    if (getUploadFileName().lastIndexOf(".") == (-1)) {
      newName = tm.getDateTime() + "";
    } else {
      newName =
          tm.getDateTime() + getUploadFileName().substring(getUploadFileName().lastIndexOf("."));
    }
    FileOutputStream fos =
        new FileOutputStream(context.getRealPath(getSavePath()) + "\\" + newName);

    FileInputStream fis = new FileInputStream(getUpload());
    byte[] buffer = new byte[1024];
    int len = 0;
    while ((len = fis.read(buffer)) > 0) {
      fos.write(buffer, 0, len);
    }

    // ***********
    journal.setImage(context.getRealPath(getSavePath()) + "\\" + newName);

    journal.setAuditTime(CharacterTrans.transGB2312ToTo8859_1(getJournal().getAuditTime()));
    journal.setDisauditTime(CharacterTrans.transGB2312ToTo8859_1(getJournal().getDisauditTime()));
    journal.setEditor(CharacterTrans.transGB2312ToTo8859_1(getJournal().getEditor()));
    Timestamp tp = new Timestamp(System.currentTimeMillis());
    journal.setEditTime(DoFormatTime(tp));
    journal.setAuditor(CharacterTrans.transGB2312ToTo8859_1(getJournal().getAuditor()));
    journal.setSequence(getJournal().getSequence());
    journal.setWebState(getJournal().getWebState());

    jourServ.save(journal);
    return SUCCESS;
  }
コード例 #2
0
  @Override
  public String execute() throws Exception {
    // 验证用户是否登录
    if (!this.isUserLogin()) return NOLOGIN;
    if (!this.valideUserPrivilege("期刊管理")) return NOTPRIVILEGE;

    Journal journal = jourServ.get(getId());
    journal.setName(CharacterTrans.trans8859_1ToGBK(journal.getName()));
    journal.setIssueTime(CharacterTrans.trans8859_1ToGBK(journal.getIssueTime()));
    journal.setRoll(CharacterTrans.trans8859_1ToGBK(journal.getRoll()));
    journal.setIssue(CharacterTrans.trans8859_1ToGBK(journal.getIssue()));
    journal.setImage(CharacterTrans.trans8859_1ToGBK(journal.getImage()));
    journal.setAuditTime(CharacterTrans.trans8859_1ToGBK(journal.getAuditTime()));
    journal.setDisauditTime(CharacterTrans.trans8859_1ToGBK(journal.getDisauditTime()));
    journal.setEditor(CharacterTrans.trans8859_1ToGBK(journal.getEditor()));
    journal.setEditTime(CharacterTrans.trans8859_1ToGBK(journal.getEditTime()));
    journal.setAuditor(CharacterTrans.trans8859_1ToGBK(journal.getAuditor()));
    journal.setSequence(journal.getSequence());
    journal.setWebState(journal.getWebState());
    this.setJournal(journal);
    return super.execute();
  }