158 lines
6.6 KiB
Java
158 lines
6.6 KiB
Java
//package com.base.util;
|
||
//
|
||
//import java.io.DataOutputStream;
|
||
//import java.io.File;
|
||
//import java.io.FileOutputStream;
|
||
//import java.io.InputStream;
|
||
//import java.net.URLDecoder;
|
||
//import java.util.Date;
|
||
//import java.util.List;
|
||
//import java.util.Map;
|
||
//
|
||
//import com.amarsoft.are.jbo.BizObject;
|
||
//import com.amarsoft.are.jbo.BizObjectManager;
|
||
//import com.amarsoft.are.jbo.BizObjectQuery;
|
||
//import com.amarsoft.are.jbo.JBOFactory;
|
||
//import com.amarsoft.are.jbo.JBOTransaction;
|
||
//import com.amarsoft.are.util.SpecialTools;
|
||
//import com.amarsoft.are.util.StringFunction;
|
||
//import com.amarsoft.awe.Configure;
|
||
//import com.amarsoft.awe.util.Transaction;
|
||
//import com.amarsoft.context.ASUser;
|
||
//import com.base.constant.RestfullConstant;
|
||
//import com.tenwa.officetempalte.util.FileOperatorUtil;
|
||
//
|
||
//public class LBAdjustDocumentUploadUtil {
|
||
// public static Map<String, Object> LBAdjustDocumentUpload(
|
||
// Map<String, Object> fieldMap, List<Map<String, Object>> fileList,
|
||
// Transaction sqlca, JBOTransaction tx, String sObjectType,
|
||
// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception {
|
||
// ASUser oCurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserId),
|
||
// sqlca);
|
||
// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(),
|
||
// "yyyy/MM/dd HH:mm:ss");
|
||
//
|
||
// String sContractId = fieldMap.get("contract_id") == null ? ""
|
||
// : fieldMap.get("contract_id").toString();
|
||
//
|
||
// String sApplyId = fieldMap.get("APPLY_ID") == null ? "" : fieldMap.get(
|
||
// "APPLY_ID").toString();
|
||
//
|
||
// String sLibraryId = "";
|
||
// for (Map<String, Object> map : fileList) {
|
||
// BizObjectManager relaBm = JBOFactory
|
||
// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE");
|
||
// BizObjectManager libBm = JBOFactory
|
||
// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY");
|
||
// BizObjectManager attrBm = JBOFactory
|
||
// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE");
|
||
//
|
||
// BizObject lib = null;
|
||
//
|
||
// String sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on O.Relative_Id=rela.id where rela.contract_id=:contract_id and rela.objecttype=:objecttype and rela.flow_unid=:flow_unid";
|
||
//
|
||
// BizObjectQuery query = libBm.createQuery(sql);
|
||
// query.setParameter("contract_id", sContractId);
|
||
// query.setParameter("objecttype", sObjectType);
|
||
// query.setParameter("flow_unid", sApplyId);
|
||
// lib = query.getSingleResult(true);
|
||
//
|
||
// if (lib != null) {
|
||
// libBm.saveObject(lib);
|
||
// sLibraryId = lib.getAttribute("id").getString();
|
||
// } else {
|
||
// sql = "select * from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on O.id=lib.Relative_Id where O.contract_id=:contract_id and O.objecttype=:objecttype and O.flow_unid=:flow_unid";
|
||
// query = relaBm.createQuery(sql);
|
||
// query.setParameter("contract_id", sContractId);
|
||
// query.setParameter("objecttype", sObjectType);
|
||
// query.setParameter("flow_unid", sApplyId);
|
||
// BizObject rela = query.getSingleResult(true);
|
||
// String relativeid = "";
|
||
// if (rela == null) {
|
||
// // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// rela = relaBm.newObject();
|
||
// rela.setAttributeValue("ObjectType", sObjectType);
|
||
// rela.setAttributeValue("contract_id", sContractId);
|
||
// rela.setAttributeValue("flow_unid", sApplyId);
|
||
// relaBm.saveObject(rela);
|
||
// relativeid = rela.getAttribute("id").getString();
|
||
// } else {
|
||
// relativeid = rela.getAttribute("id").getString();
|
||
// }
|
||
// // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// lib = libBm.newObject();
|
||
// lib.setAttributeValue("Relative_Id", relativeid);
|
||
// libBm.saveObject(lib);
|
||
// sLibraryId = lib.getAttribute("id").getString();
|
||
// }
|
||
// String sFileName, sFileContentType, sFileSize;
|
||
// sFileName = map.get("fileName") == null ? "" : map.get("fileName")
|
||
// .toString();
|
||
// InputStream file = (InputStream) map.get("file");
|
||
// sFileContentType = map.get("fileContentType") == null ? "" : map
|
||
// .get("fileContentType").toString();
|
||
// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize")
|
||
// .toString();
|
||
//
|
||
// BizObject attr = attrBm.newObject();
|
||
// attr.setAttributeValue("Library_Id", sLibraryId);
|
||
// attr.setAttributeValue("FileName", sFileName);
|
||
// attr.setAttributeValue("InputUserId", oCurUser.getUserID());
|
||
// attr.setAttributeValue("InputOrgId", oCurUser.getOrgID());
|
||
// attr.setAttributeValue("InputTime", sCurDate);
|
||
// attr.setAttributeValue("ObjectType", sObjectType);
|
||
//
|
||
// // <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||
// sFileName = StringFunction.getFileName(sFileName);
|
||
// sFileName = URLDecoder.decode(
|
||
// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8");
|
||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// // SqlObject so = null;
|
||
// // String sNewSql = "";
|
||
// // String sFileSaveMode = CurConfig.getConfigure("FileSaveMode");
|
||
// // String sFileSavePath = CurConfig.getConfigure("FileSavePath");
|
||
// // String sFileNameType = CurConfig.getConfigure("FileNameType");
|
||
// // String trueTable = ((BizObjectTableMapper) attrBm).getTable(); //
|
||
// // ȡ<><C8A1><EFBFBD><EFBFBD>ʵ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
||
// // String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable, "Id");
|
||
//
|
||
// // <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||
// sFileName = StringFunction.getFileName(sFileName);
|
||
// sFileName = URLDecoder.decode(
|
||
// URLDecoder.decode(sFileName, "UTF-8"), "UTF-8");
|
||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>IJ<EFBFBD><C4B2><EFBFBD>
|
||
// @SuppressWarnings("deprecation")
|
||
// Configure CurConfig = Configure.getInstance();
|
||
// String sFileSavePath = CurConfig.getConfigure("FileSavePath");
|
||
//
|
||
// String uuid = java.util.UUID.randomUUID().toString()
|
||
// .replaceAll("-", "");
|
||
// String sFullPath = FileOperatorUtil.getuploadFileDir(sFileSavePath)
|
||
// + uuid + "_" + sFileName;
|
||
//
|
||
// String sFilePath = sFullPath.replace(sFileSavePath, "");
|
||
// attr.setAttributeValue("FilePath", sFilePath);
|
||
// attr.setAttributeValue("FullPath", sFullPath);
|
||
// attr.setAttributeValue("Content_Type", sFileContentType);
|
||
// attr.setAttributeValue("FileSize", sFileSize);
|
||
// attrBm.saveObject(attr);
|
||
// File f = new File(sFullPath);
|
||
// DataOutputStream fileout = new DataOutputStream(
|
||
// new FileOutputStream(f));
|
||
// byte b[] = new byte[Integer.valueOf(sFileSize)];
|
||
// @SuppressWarnings("unused")
|
||
// int i = file.read(b, 0, Integer.valueOf(sFileSize) - 1);
|
||
// fileout.write(b, 0, b.length); // <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>
|
||
// fileout.close();
|
||
// }
|
||
//
|
||
// tx.commit();
|
||
// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty
|
||
// .get("SUCCESS") == null ? "SUCCESS"
|
||
// : RestfullConstant.baseProperty.get("SUCCESS").toString(),
|
||
// "<22>ϴ<EFBFBD><CFB4>ɹ<EFBFBD>!");
|
||
// return ReturnMapUtil.getReturnMap();
|
||
// }
|
||
//}
|