//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 businessDocumentUpload( // Map testMap, List> 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// 法人合同模板 //// : sCustomerType.equals(PERSON_TYPE) ? TEMPLATE_NO_PERSON // 自然人合同模板 //// : ""; // 担保人合同模板 // sTemplateNo = ""; // 担保人合同模板 // // 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 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(); // // 得到不带路径的文件名 // sFileName = StringFunction.getFileName(sFileName); // sFileName = URLDecoder.decode( // URLDecoder.decode(sFileName, "UTF-8"), "UTF-8"); // InputStream file = (InputStream) map.get("file"); // // 定义数据库操作变量 // // 获取配置文件的参数 // @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); // 将文件数据存盘 // 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(), // "上传成功!"); // return ReturnMapUtil.getReturnMap(); // } //}