?? taskmanagerimpl.java
字號:
package gov.gdlt.ssgly.taxcore.taxblh.gzda;
import gov.gdlt.ssgly.taxcore.taxblh.gzda.service.GZDAcurrencySaveBLH;
import gov.gdlt.ssgly.taxcore.taxblh.gzda.service.OracleBlobParseBLH;
import gov.gdlt.ssgly.taxcore.taxevent.gzda.persistence.entity.GZDAfileAbstrVO;
import java.io.*;
import java.util.*;
import java.util.zip.ZipOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class TaskManagerImpl extends GZDAcurrencySaveBLH{
public String currencySaveFile(String type,String id,String cname,String author,String operid,String tpayerid,String title,
String doc,String abstr,String describe, byte[] filedocbyte){
int ret = 0;
double leve =0.00d;
double leven =0.00d;
String no = "";
daoManager.startTransaction();
id=id.toUpperCase();
type=type.toLowerCase();
String c=getCode(id);
if(c.trim().equalsIgnoreCase("")){
throw new RuntimeException("分類大類還沒有建立,請維護ID!");
}
leve=getLeve(id);
//leven=getLeve(id+"X");
//System.out.println("ooooooooooooo="+leven);
//if(leven>leve){
// leve=leve+leven/2;
//}
HashMap m=new HashMap();
m.put("LEVE",new Double(leve));
no=getTranno();
GZDAfileAbstrVO gzdavo=new GZDAfileAbstrVO();
gzdavo.setABSTR(abstr);
gzdavo.setAUTHOR(author);
gzdavo.setCODE(id+"X");
gzdavo.setDESCTIBE(describe);
gzdavo.setDOC(doc);
gzdavo.setFILESTATUE("0"); //0---自己
gzdavo.setFILETYPE("1"); //1---是否葉子?
gzdavo.setLEVE(leve);
gzdavo.setNAME(cname);
gzdavo.setOPERID(operid);
gzdavo.setTITLE(title);
gzdavo.setTPAYERID(tpayerid);
gzdavo.setTRANNO(no);
gzdavo.setTYPE(type);
gzdavo.setURL(no);
java.util.Date dat=new java.util.Date();
gzdavo.setCREATEDATE(dat);
try{
int st=updatePopular("updatefdnext",m);
st=insertFileAbstrt("insertfileabstri",gzdavo);
OracleBlobParseBLH oc=new OracleBlobParseBLH();
InputStream filedoc=null;
ByteArrayInputStream bins=new ByteArrayInputStream(filedocbyte);
filedoc=(InputStream)bins ;
oc.saveblob(no,filedoc);
daoManager.commitTransaction();
}catch(Exception e){
System.out.println(e.toString());
daoManager.endTransaction();
no="";
}
return no;
}
public InputStream getFile(String id){
InputStream ins=null;
OracleBlobParseBLH oc=new OracleBlobParseBLH();
ins=oc.getblob(id);
return ins;
}
public OutputStream getFileOut(String id){
OutputStream ous=null;
OracleBlobParseBLH oc=new OracleBlobParseBLH();
ous=oc.getblobout(id);
return ous;
}
public byte[] getFileByte(String id){
byte[] byteout=null;
OracleBlobParseBLH oc=new OracleBlobParseBLH();
byteout=oc.selectblob(id);
return byteout;
}
//將ZIP壓縮流解壓縮
public byte[] getZipStream(InputStream stream){
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(stream));
ZipEntry entry=null;
DataInputStream dns=null;
try {
entry = zis.getNextEntry();
} catch (IOException ex2) {
}
if (entry!= null) {
System.out.println("entry name=" + entry.getName());
dns=new DataInputStream(zis);
}
ByteArrayOutputStream outb=new ByteArrayOutputStream();
int l=0;
byte[] b=new byte[1024];
try{
while ((l = dns.read(b)) != -1) {
outb.write(b, 0, l);
}
}catch(IOException ie){
}
return outb.toByteArray();
}
//將文件流造型成ZIP壓縮流
public byte[] createZipStream(InputStream stream){
//中轉,作為壓縮文件輸出流
ByteArrayOutputStream btyout=new ByteArrayOutputStream();
ZipOutputStream out = null;
out=new ZipOutputStream(new BufferedOutputStream(btyout));
out.setMethod(ZipOutputStream.DEFLATED);
try {
out.putNextEntry(new ZipEntry("zip"));
} catch (IOException ex1) {
}
int l=0;
byte[] b=new byte[1024];
try {
while ((l = stream.read(b)) != -1) {
out.write(b, 0, l);
}
} catch (IOException ex2) {
}finally{
try {
out.close();
btyout.close();
} catch (IOException ex) {
}
}
return btyout.toByteArray();
}
public static void main(String[] args) {
FileInputStream filed=null;
try {
filed = new FileInputStream("c:\\aa.doc");
} catch (FileNotFoundException ex) {
System.out.println(ex.toString());
}
byte[] fb={'a','b'};
TaskManagerImpl taskmanagerimpl = new TaskManagerImpl();
System.out.println(taskmanagerimpl.currencySaveFile("DOC","FG","過程文檔","賀歐","12345678912","tpayerid","title","doc","abstr","describe",fb));
//System.out.println(taskmanagerimpl.getFileOut("6013"));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -