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

📄 recvpermissionmanager.java~1~

📁 OA典型例子
💻 JAVA~1~
字号:
 package com.sure.oa.recvdoc;

 import com.sure.businessmodel.Page;
 import com.sure.businessmodel.UpdateException;
 import com.sure.businesslogic.AlreadyExistsException;
 import com.sure.businesslogic.NotFoundException;
 import com.sure.dataabstraction.DBManager;
 import com.sure.dataabstraction.DBPoolException;
 import com.sure.util.StringUtils;
 import com.sure.oa.attachment.*;
 import com.sure.oa.orgnization.*;
 import com.sure.oa.senddoc.*;
 import com.sure.util.*;
 import java.sql.SQLException;
 import java.sql.Connection;
 import java.util.*;
 import java.io.*;
 /**
  * <p>Title: OA</p>
  * <p>Description: 国办项目</p>
  * <p>Copyright: Copyright (c) 2004</p>
  * <p>Company: sure</p>
  * @author mengzy
  * @version 1.0
  * 收文状态status:0:未签收 2:已签收  4:已退回  6:已归档 8:已删除(未起用)
  */

 public class RecvPermissionManager {

   public RecvPermissionManager() {
   }
   /**
   * 获得某一条收文日志
   * 返回:日志信息(RecvDocLog)
   */
  public static  RecvPermission getPer(String perId){
     RecvPermission v=new RecvPermission();
     return v;
  }

  /**
   * 本接口主要为了纸质识别时调用:根据发文ID和变形ID序列返回泄密单位ID序列
   * @param docId:发文ID
   * @param transId: 变形ID序列
   * @return: 单位ID序列
   * @throws SQLException
   * @throws NotFoundException
   * @throws DBPoolException
   * @Author:mengzy
   * @Date:2004-11-17
   */
  public static  String getUnitIdListByTransId(String docId, String transId) throws DBPoolException,SQLException{
  String retValue = "",danUnitId="";
  Vector v = new Vector();
  String where = "";
  int i = 0, j = 0, k = 0;
  boolean canEnter = false;
  Connection cn=DBManager.getConnection();
  try {
    String strValue[] = StringUtils.split(transId, ",");
    for (i = 0; i < strValue.length; i++) {
      danUnitId="";
      where = "where senddocId=" + docId;
      v = RecvDocFormPersistent.load(cn, where);
      for (j = 0; j < v.size(); j++) {
          RecvDocForm rdf = (RecvDocForm) v.get(j);
          where = "where docID='" + rdf.getDocId().intValue() +
              "' and (transId like '%," + strValue[i] + ",%' or transId like '" + strValue[i] + ",%' or transId like '%," + strValue[i] + "' or transId like '" + strValue[i] + "') ";
          //System.out.println("where = "+where);
          Vector v1 = RecvPermissionPersistent.load(cn, where);
          if (v1.size()>0) {
            int unitId =Integer.parseInt(((RecvPermission)v1.get(0)).getUnitId());
             danUnitId=Integer.toString(unitId)+",";
             j=v.size();
          }
      }
      //如果找到变形ID所对应的收文单位ID
      if (danUnitId.length()>0){
         retValue=retValue+danUnitId+",";
      }else{//否则
         retValue=retValue+"0,";
      }
    }
    if(retValue.length()>0) retValue=retValue.substring(0,retValue.length()-1);
  }
  catch(Exception e){
    //e.printStackTrace();
  }
  finally {
    cn.close();
    return  retValue;
  }
 }

   /**
    * 根据docId得到最大的变型ID
    * @param docId
    * @param transId
    * @return
    * @throws DBPoolException
    * @throws SQLException
    */
   public static  String getMaxTransIdByDocId(String docId) throws DBPoolException,SQLException{
    String retValue = "0";
    Vector v = new Vector();
    String where = "";
    Connection cn=DBManager.getConnection();
    try {
      //得到该文最后一个收文单位的变形Id
      where = "where senddocId=" + docId;
      Vector v1 = RecvDocFormPersistent.load(cn,where);
      String temp = "";
      for(int k = 0;k<v1.size();k++){
        if(temp.equals("")){
          temp = "'" + ((RecvDocForm)v1.get(k)).getDocId().toString() + "'";
        }else{
          temp = temp + ",'" + ((RecvDocForm)v1.get(k)).getDocId().toString() + "'";
        }
      }
      //得到现有最大的变形Id
      where =
          "where docId in (" +
          temp + ") order by permissionId desc";
      v = RecvPermissionPersistent.load(cn, where);

      if (v != null && v.size() > 0) {
        RecvPermission rp = (RecvPermission) v.firstElement();
        temp = rp.getTransId();
        String strSplit[] = StringUtils.split(temp, ",");
        retValue = strSplit[strSplit.length - 1];
      }
    }
    catch(Exception e){
      //e.printStackTrace();
    }
    finally {
      cn.close();
      //System.out.println("retValue = " + retValue);
      return  retValue;
    }
   }

  /**
   * 获得某个收文权限(在打印保存时调用)
   */
  public static  RecvPermission getRecvPermission(String docId,String unitId) throws SQLException,DBPoolException,NotFoundException{
    String where="where docId='"+docId+"' and unitId='"+unitId+"'";
    Connection cn=DBManager.getConnection();
    try{
      Vector v=RecvPermissionPersistent.load(cn,where);
      return  (RecvPermission)v.firstElement();
    }
    finally{
      cn.close();
    }
  }
  /**
   * 获得单位待签收文件个数
   */
  public static int  getUnSignNumber(int unitId) throws SQLException, NotFoundException,DBPoolException {
    Connection cn = DBManager.getConnection();
    int retValue =0;
    try{
        String where = "where unitID='" + unitId + "' and status in ('0')";
        Vector v = RecvPermissionPersistent.load(cn,where);
        retValue=v.size();
        return retValue;
   }finally {
         cn.close();
   }
 }
//取出状态为0,2,4的记示
 public Page getstatusList(int start, String unitId,String cxtj) throws SQLException,NotFoundException,DBPoolException {
             Connection cn = DBManager.getConnection();
             try{
                 String where = ",recvdocform  where  status in ('0','2','4') and unitId='"+unitId+"' and convert(varchar(10),recvdocform.docId)=recvpermission.docId  "+cxtj+"  order by sendTime desc";
                 //System.out.println(where);
                 Page p = RecvPermissionPersistent.load(cn, start, 10, where);
                 return p;
             }finally {
                 cn.close();
             }
         }

//取出状态为2,4的记示//2004-08-05雷敏增加
 public Page getstatusList2(int start, String unitId,String cxtj) throws SQLException,NotFoundException,DBPoolException {
            Connection cn = DBManager.getConnection();
            try{
                String where = ",recvdocform  where  status in ('2','4') and unitId='"+unitId+"' and recvdocform.docId=recvpermission.docId  "+cxtj+"  order by sendTime desc";
                Page p = RecvPermissionPersistent.load(cn, start, 10, where);
               return p;
                }finally {
                 cn.close();
              }
          }

 /**
 * 产生单位的变形Id
 */
 public static String generateTransID(Connection cn, String docId,int printNum) throws SQLException,NotFoundException, DBPoolException {
  String retValue = "", strTemp = "";
  int i = 0, maxTrans = 0;
  try {
    //得到该文最后一个收文单位的变形Id
    String where1 = "where senddocId=" + docId;
    Vector v1 = RecvDocFormPersistent.load(cn,where1);
    String temp = "";
    for(int k = 0;k<v1.size();k++){
      if(temp.equals("")){
        temp = "'" + ((RecvDocForm)v1.get(k)).getDocId().toString() + "'";
      }else{
        temp = temp + ",'" + ((RecvDocForm)v1.get(k)).getDocId().toString() + "'";
      }
    }
    //得到现有最大的变形Id
    String where =
        "where docId in (" +
        temp + ") order by permissionId desc";
    //System.out.println(where);
    Vector v = RecvPermissionPersistent.load(cn, where);

    if (v != null && v.size() > 0) {
      RecvPermission rp = (RecvPermission) v.firstElement();
      strTemp = rp.getTransId();
      String strSplit[] = StringUtils.split(strTemp, ",");
      maxTrans = new Integer(strSplit[strSplit.length - 1]).intValue();
    }
    //产生变形id
    for (i = 1; i <= printNum; i++) {
      retValue = retValue + (i + maxTrans) + ",";
    }
    retValue = retValue.substring(0, retValue.length() - 1);
  }
  catch (Exception e) {
    e.printStackTrace();
  }
  finally {
    return retValue;
  }
 }


  /**
   * 保存权限信息
   */
  public static  void  savePermission(RecvPermission per){
  }

  /**
   * 删除权限信息
   */
  public static  void  delPermission(RecvPermission per){
  }

  /**
   * 得到从sendDocUnit发文到recvUnitId单位的所有收文权限列表(且在一定状态的status的)
   */
  public static  Vector getRevPerList(String recvUnitId,String sendDocUnit,String statuses,String cxtj) throws SQLException,NotFoundException,DBPoolException {
      Connection cn = DBManager.getConnection();
       try{
         String where = "where unitId in ('" + recvUnitId + "') and docId in ('select docId from RecvDocForm where sendUnitId in '" + sendDocUnit + "' ') and status in ('"+statuses+"' ) ";
           //System.out.println(where);
           Vector v = RecvPermissionPersistent.load(cn,where);
           return  v;
       }finally {
           cn.close();
       }
 }

 }

⌨️ 快捷键说明

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