⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guidocform.java

📁 OA典型例子
💻 JAVA
字号:
/*
 * GuiDocForm.java
 * Generated using xgen and texen from bean.vm
 * Sun Mar 14 17:30:27 CST 2004
 */

package com.sure.oa.archive;
import org.apache.xerces.utils.Base64;
import java.util.*;
import java.io.*;
import com.sure.util.*;
import com.sure.oa.gdfile.*;
import com.sure.dataabstraction.*;
import com.sure.businesslogic.NotFoundException;
import java.sql.*;
import com.sure.oa.orgnization.*;

/**
 * 存取收发文归档主信息的属性
 * @author datonghuiren@sohu.com
 */
public class GuiDocForm extends GuiDocFormBase {
  public String getDocNo(){
    return docNoPre+"["+yearNo+"]"+waterNo+"号";
  }

  public String getDocKindAsString(){
    String retValue ="正式公文";
    try{
      if(docKind.equals("1")){retValue="其它";}
    }catch(Exception e){
      e.printStackTrace();
    }
    return retValue;
  }

  public String getSignPersonName(){
    String retValue = "";
    UsersManager UMG = new UsersManager();
    try{
      retValue = UMG.getUsersByAccount(signPerson).getUserName();
    }catch(Exception e){
      e.printStackTrace();
    }finally{
      return retValue;
    }
  }

  /**
   * @Author  mengzy 2004-04-13
   * @return  XML包
   */
  public StringBuffer  toXML()  throws IOException{
      StringBuffer retValue = new StringBuffer("<电子公文>\n");
      try {
        String sendUnitName=UnitManager.getUnit(Integer.parseInt(getCreateUnitId())).getUnitName();
        retValue.append(strToXML("发文机关",sendUnitName,"办理类别","主办"));
        retValue.append("<公文体>\n");
         retValue.append("<眉首>\n");
           retValue.append(strToXML("秘密等级", getSecret()));
           retValue.append(strToXML("保密期限", getSaveTime()));
           retValue.append(strToXML("紧急程度", getEmergency()));
           retValue.append(strToXML("发文机关代字", getDocNoPre()));
           retValue.append(strToXML("发文年号", getYearNo()));
           retValue.append(strToXML("发文序号", getWaterNo()));
           retValue.append(strToXML("签发人", getPublishPerson()));
           retValue.append(strToXML("扩展要素", DateWrapper.getLongTime(getPublishDate()),"要素名称","发文时间"));
           retValue.append(strToXML("扩展要素", DateWrapper.getLongTime(getReceiveDate()),"要素名称","收文时间"));
         retValue.append("</眉首>\n");
         retValue.append("<主体>\n");
           retValue.append(strToXML("标题", getDocTitle()));
           retValue.append(strToXML("主送机关", getSendTo()));
           Vector v=getAttachment("0");
           retValue.append(((gdFile)v.firstElement()).toXML("0")).append("\n");;
           v=getAttachment("1");
           for(int i=0;i<v.size();i++){
             retValue.append(((gdFile)v.get(i)).toXML("1")).append("\n");;
           }
           retValue.append(strToXML("扩展要素","要素名称","文件类型","GD"));
           retValue.append(strToXML("扩展要素","要素名称","附件数",getAttachmentPages().toString()));
         retValue.append("</主体>\n");
         retValue.append("<版记>\n");
           retValue.append("<主题词>\n");
              retValue.append(strToXML("词目", getSubject()));
           retValue.append("</主题词>\n");
           retValue.append(strToXML("抄送机关", getCc(),"抄送类别","抄送"));
           retValue.append(strToXML("抄送机关", getReportTo(),"抄送类别","抄报"));
           retValue.append("<印发版记>\n");
             retValue.append(strToXML("印发机关", getPrintUnit()));
             retValue.append(strToXML("印发日期", getPrintDate().toString()));
             retValue.append(strToXML("印发份数", getPrintnumber().toString()));
           retValue.append("</印发版记>\n");
           retValue.append(strToXML("扩展要素", getCheckPerson(),"要素名称","校对人"));
           retValue.append(strToXML("扩展要素", getCreator(),"要素名称","录入人"));
           retValue.append(strToXML("扩展要素", getSealPerson(),"要素名称","盖章人"));
           retValue.append(strToXML("扩展要素", getSealTime().toString(),"要素名称","盖章时间"));
         retValue.append("</版记>\n");
         retValue.append("<定制信息>\n");
           retValue.append(strToXML("收文登记人",getSignPerson()));
           if (getReceiveType().equals("办公厅收文")){
               retValue.append(strToXML("收文部门分类","OU=01办公厅,OU=01海关总署,DC=oa-app,DC=hgzs,DC=ain,DC=cn"));
           }
           else {
               retValue.append(strToXML("收文部门分类","OU=01海关总署,DC=oa-app,DC=hgzs,DC=ain,DC=cn"));
           }
           retValue.append(strToXML("来文备注", getMemo()));
         retValue.append("</定制信息>\n");
      } catch(Exception e) {
        e.printStackTrace();
      }
      retValue.append("</公文体>\n");
      retValue.append("</电子公文>");
      //Writer writer = new FileWriter("E:\\hgxm\\document.xml");
      //writer.write(retValue.toString());
      //writer.close();
      return  retValue;
 }

  /**
   * 根据标签名和标签值返回一个xml标签
   * @Author mengzy 2004-4-12
   */
  private String strToXML(String tagName, String tagValue){
      StringBuffer strReturn = new StringBuffer();
      strReturn.append("<" + tagName + ">");
      strReturn.append(tagValue);
      strReturn.append("</" + tagName + ">\n");
      return strReturn.toString();
  }

  /**
  * 根据标签名和标签值,属性名和属性值返回一个xml标签
  * @Author mengzy 2004-4-29
  */
 private String strToXML(String tagName, String tagValue,String attrName,String attrValue){
   StringBuffer strReturn = new StringBuffer();
   strReturn.append("<" + tagName +"  "+ attrName+"=\""+attrValue+"\">");
   strReturn.append(tagValue);
   strReturn.append("</" + tagName + ">\n");
   return strReturn.toString();
 }

 /**
   * 根据标签名和标签值返回一个xml标签(BASE64编码)
   * @Author mengzy 2004-4-12
   */
  private String strToXMLBase64(String tagName, String tagValue){
    StringBuffer strReturn = new StringBuffer();
    strReturn.append("<" + tagName + ">");
    strReturn.append(new String(Base64.encode(tagValue.getBytes())));
    strReturn.append("</" + tagName + ">\n");
    return strReturn.toString();
  }

 /**
  * type:0:正文 1:附件
  */
 public Vector getAttachment(String type) throws NotFoundException,SQLException,DBPoolException{
     Vector v=gdFileManager.getListVector(getDocId().toString(),type);
    return v;
 }
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -