apzl_leasing/src_app_fresh/com/base/util/DocumenetUpload.java
liujiaji 6397d906b5 src_app 移除
src_app_fresh 添加
2018-06-11 13:40:56 +08:00

144 lines
6.2 KiB
Java
Raw Blame History

//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 jbo.com.tenwa.entity.comm.officetempalte.BF_TEMPLATE;
//
//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.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 DocumenetUpload {
// private final static String COMPANY_TYPE = RestfullConstant.baseProperty
// .get("CUSTOMER_TYPE_COMPANY").toString(); // 01
// private final static String PERSON_TYPE = RestfullConstant.baseProperty
// .get("CUSTOMER_TYPE_PERSON").toString(); // 03
//
// public static Map<String, Object> businessDocumentUpload(
// Map<String, Object> testMap, List<Map<String, Object>> fileList,
// Transaction sqlca, JBOTransaction tx, String sObjectType,
// String sUserId, ReturnMapUtil ReturnMapUtil) throws Exception {
//
// String sDocLibraryId = testMap.get("library_id") == null ? "" : testMap
// .get("library_id").toString();
// String sCustomerType = testMap.get("customertype") == null ? ""
// : testMap.get("customertype").toString();
//
//// String TEMPLATE_NO_COMPANTY = RestfullConstant.download
//// .get("TEMPLATE_NO_COMPANTY") == null ? ""
//// : RestfullConstant.download
//// .get("TEMPLATE_NO_COMPANTY").toString();
////
//// String TEMPLATE_NO_PERSON = RestfullConstant.download
//// .get("TEMPLATE_NO_PERSON") == null ? ""
//// : RestfullConstant.download
//// .get("TEMPLATE_NO_PERSON").toString();
//
// String sTemplateNo = "";
//// sTemplateNo = sCustomerType.equals(COMPANY_TYPE) ? TEMPLATE_NO_COMPANTY// <20><><EFBFBD>˺<EFBFBD>ͬģ<CDAC><C4A3>
//// : sCustomerType.equals(PERSON_TYPE) ? TEMPLATE_NO_PERSON // <20><>Ȼ<EFBFBD>˺<EFBFBD>ͬģ<CDAC><C4A3>
//// : ""; // <20><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>ͬģ<CDAC><C4A3>
// sTemplateNo = ""; // <20><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>ͬģ<CDAC><C4A3>
//
// BizObjectManager tempalteManger = JBOFactory
// .getBizObjectManager(BF_TEMPLATE.CLASS_NAME);
// BizObjectQuery tempalteMangerQuery = tempalteManger
// .createQuery("id=:id ");
// tempalteMangerQuery.setParameter("id", sTemplateNo);
// BizObject tempalte = tempalteMangerQuery.getSingleResult(false);
// String sDocType = tempalte.getAttribute("DOCTYPE").toString();
// String sDocClassItemno = tempalte.getAttribute("DOC_CLASS_ITEMNO")
// .toString();
// String sConfigId = tempalte.getAttribute("CONFIG_ID").toString();
// String sRemark = testMap.get("remark") == null ? "" : testMap.get(
// "remark").toString();
// ASUser curUser = new ASUser(sUserId, sqlca);
// String sCurDate = DateUtil.getSystemTimeByFormat(new Date(),
// "yyyy/MM/dd HH:mm:ss");
// for (Map<String, Object> map : fileList) {
// String sFileName, sFileSize, sFileContentType;
// sFileName = map.get("fileName") == null ? "" : map.get("fileName")
// .toString();
// sFileContentType = map.get("fileContentType") == null ? "" : map
// .get("fileContentType").toString();
// sFileSize = map.get("fileSize") == null ? "" : map.get("fileSize")
// .toString();
// // <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");
// InputStream file = (InputStream) map.get("file");
// // <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, "");
//
// 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();
//
// BizObjectManager libBm = JBOFactory
// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY");
// BizObjectManager attrBm = JBOFactory
// .getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE");
// BizObject lib = libBm.createQuery("id=:id")
// .setParameter("id", sDocLibraryId).getSingleResult(true);
// lib = lib == null ? libBm.newObject() : lib;
// lib.setAttributeValue("Remark", sRemark);
// lib.setAttributeValue("CONFIG_ID", sConfigId);
// lib.setAttributeValue("DOC_CLASS_ITEMNO", sDocClassItemno);
// lib.setAttributeValue("DOC_TYPE", sDocType);
// lib.setAttributeValue("One_Classify", sDocClassItemno);
// lib.setAttributeValue("DOC_NAME", sConfigId);
// libBm.saveObject(lib);
// BizObject attr = attrBm.newObject();
// attr.setAttributeValue("Library_Id", sDocLibraryId);
// attr.setAttributeValue("FileName", sFileName);
// attr.setAttributeValue("InputUserId", curUser.getUserID());
// attr.setAttributeValue("InputOrgId", curUser.getOrgID());
// attr.setAttributeValue("InputTime", sCurDate);
// attr.setAttributeValue("objectType", sObjectType);
// attr.setAttributeValue("FilePath", sFilePath);
// attr.setAttributeValue("FullPath", sFullPath);
// attr.setAttributeValue("Content_Type", sFileContentType);
// attr.setAttributeValue("FileSize", sFileSize);
//
// attrBm.saveObject(attr);
// }
// tx.commit();
// ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty
// .get("SUCCESS") == null ? "SUCCESS"
// : RestfullConstant.baseProperty.get("SUCCESS").toString(),
// "<22>ϴ<EFBFBD><CFB4>ɹ<EFBFBD>!");
// return ReturnMapUtil.getReturnMap();
// }
//}