Procházet zdrojové kódy

凭证同步给泛微

pancy před 1 rokem
revize
8acf49340d

+ 7 - 0
gl/META-INF/module.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding='gb2312'?>
+	<module name="gl">
+		<public>
+		</public>
+		<private>
+		</private>
+	</module>

+ 31 - 0
gl/gl.iml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="NCCModule" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/gl/src/client" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/gl/src/private" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/gl/src/public" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="DB_Drive_Library" level="project" />
+    <orderEntry type="library" name="Ant_Library" level="project" />
+    <orderEntry type="library" name="Product_Common_Library" level="project" />
+    <orderEntry type="library" name="Middleware_Library" level="project" />
+    <orderEntry type="library" name="Framework_Library" level="project" />
+    <orderEntry type="library" name="Extension_Public_Library" level="project" />
+    <orderEntry type="library" name="Hyext_Public_Library" level="project" />
+    <orderEntry type="library" name="Module_Public_Library" level="project" />
+    <orderEntry type="library" name="Extension_Client_Library" level="project" />
+    <orderEntry type="library" name="Hyext_Client_Library" level="project" />
+    <orderEntry type="library" name="Module_Client_Library" level="project" />
+    <orderEntry type="library" name="Extension_Private_Library" level="project" />
+    <orderEntry type="library" name="Hyext_Private_Library" level="project" />
+    <orderEntry type="library" name="Module_Private_Library" level="project" />
+    <orderEntry type="library" name="Module_Lang_Library" level="project" />
+    <orderEntry type="library" name="Generated_EJB" level="project" />
+    <orderEntry type="library" name="NCCloud_Library" level="project" />
+    <orderEntry type="library" name="resources" level="project" />
+  </component>
+</module>

+ 5 - 0
gl/gl/component.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding='gb2312'?>
+	<module displayname="gl" name="gl">
+		<dependencies>
+		</dependencies>
+	</module>

+ 114 - 0
gl/gl/src/private/nc/bs/gl/pfxx/GetBaseDAOUtil.java

@@ -0,0 +1,114 @@
+package nc.bs.gl.pfxx;
+import nc.bs.dao.BaseDAO;
+import nc.jdbc.framework.processor.ColumnProcessor;
+
+public class GetBaseDAOUtil {
+    private static BaseDAO baseDAO = new BaseDAO();
+
+    // 用户编码
+    public static String getUserCode(String cuserid) throws Exception {
+        String sql = "select user_code from sm_user where cuserid ='"+cuserid+"' and nvl(dr,0)=0";
+        String user_code = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (user_code == null) {
+            return "";
+        }
+        return user_code;
+    }
+
+    //用户名称
+    public static String getUserName(String cuserid) throws Exception {
+        String sql = "select user_name from sm_user where cuserid ='"+cuserid+"' and nvl(dr,0)=0";
+        String user_name = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (user_name == null) {
+            return "";
+        }
+        return user_name;
+    }
+
+    //凭证类别编码
+    public static String getVoucherTypeCode(String pk_vouchertype) throws Exception {
+        String sql = "select code from bd_vouchertype where pk_vouchertype ='"+pk_vouchertype+"' and nvl(dr,0)=0";
+        String vouchertypecode = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (vouchertypecode == null) {
+            return "";
+        }
+        return vouchertypecode;
+    }
+
+    //凭证类别名称
+    public static String getVoucherTypeName(String pk_vouchertype) throws Exception {
+        String sql = "select name from bd_vouchertype where pk_vouchertype ='"+pk_vouchertype+"' and nvl(dr,0)=0";
+        String vouchertypename = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (vouchertypename == null) {
+            return "";
+        }
+        return vouchertypename;
+    }
+
+    //财务组织编码
+    public static String getOrgCode(String pk_org) throws Exception {
+        String sql = "select code from org_financeorg where pk_financeorg ='"+pk_org+"' and nvl(dr,0)=0";
+        String code = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (code == null) {
+            return "";
+        }
+        return code;
+    }
+
+    //财务组织名称
+    public static String getOrgName(String pk_org) throws Exception {
+        String sql = "select name from org_financeorg where pk_financeorg ='"+pk_org+"' and nvl(dr,0)=0";
+        String name = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (name == null) {
+            return "";
+        }
+        return name;
+    }
+
+    //账簿编码
+    public static String getAccountBookCode(String pk_accountingbook) throws Exception {
+        String sql = "select code from org_accountingbook where pk_accountingbook ='"+pk_accountingbook+"' and nvl(dr,0)=0";
+        String code = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (code == null) {
+            return "";
+        }
+        return code;
+    }
+
+    //账簿名称
+    public static String getAccountBookName(String pk_accountingbook) throws Exception {
+        String sql = "select name from org_accountingbook where pk_accountingbook ='"+pk_accountingbook+"' and nvl(dr,0)=0";
+        String name = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
+        if (name == null) {
+            return "";
+        }
+        return name;
+    }
+
+
+    //币种
+    public static String getCurrencyName(String pk_currtype) throws Exception{
+        StringBuffer str = new StringBuffer();
+        str.append("select a.name from bd_currtype a ");
+        str.append("where a.pk_currtype = '"+pk_currtype+"' and nvl(a.dr,0)=0 ");
+        String name = (String) baseDAO.executeQuery(str.toString(), new ColumnProcessor());
+        if (name == null) {
+            return "";
+        }
+        return name;
+    }
+
+    //会计科目名称
+    public static String getAccountName(String pk_accasoa) throws Exception{
+        StringBuffer str = new StringBuffer();
+        str.append("select c.name from gl_detail a ");
+        str.append("left join bd_accasoa b on a.pk_accasoa = b.pk_accasoa ");
+        str.append("left join bd_account c on b.pk_account = c.pk_account ");
+        str.append("where a.pk_accasoa = '"+pk_accasoa+"' and nvl(a.dr,0)=0 and nvl(b.dr,0)=0 and nvl(c.dr,0)=0");
+        String name = (String) baseDAO.executeQuery(str.toString(), new ColumnProcessor());
+        if (name == null) {
+            return "";
+        }
+        return name;
+    }
+}

+ 49 - 0
gl/gl/src/private/nc/bs/gl/pfxx/MoneyToUpper.java

@@ -0,0 +1,49 @@
+package nc.bs.gl.pfxx;
+
+import java.math.BigDecimal;
+
+public class MoneyToUpper {
+    public static String moneyToUpper(double n) {
+        String fraction[] = {"角", "分"};
+        String digit[] = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
+        String unit[][] = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
+
+        String head = n < 0 ? "负" : "";
+        // 如果是负数取绝对值
+        n = Math.abs(n);
+        String s = "";
+        BigDecimal bigDecimal = new BigDecimal(Double.valueOf(n).toString());
+        String nStr = bigDecimal.toString();
+        // 小数部分
+        String[] split = nStr.split("\\.");
+        if (split.length > 1) {
+            // 小数点为特殊符号,在分割时需进行转义
+            String decimalStr = split[1];
+            if (decimalStr.length() > 2) {
+                decimalStr = decimalStr.substring(0, 2);
+            }
+            // 将小数部分转换为整数
+            Integer integer = Integer.valueOf(decimalStr);
+            String p = "";
+            for (int i = 0; i < decimalStr.length() && i < fraction.length; i++) {
+                p = digit[integer % 10] + fraction[decimalStr.length() - i - 1] + p;
+                integer = integer / 10;
+            }
+            s = p.replaceAll("(零.)+", "") + s;
+        }
+        if (s.length() < 1) {
+            s = "整";
+        }
+        int integerPart = (int)Math.floor(n);
+        // 整数部分
+        for (int i = 0; i < unit[0].length && integerPart > 0; i++) {
+            String p = "";
+            for (int j = 0; j < unit[1].length && n > 0; j++) {
+                p = digit[integerPart % 10] + unit[1][j] + p;
+                integerPart = integerPart / 10;
+            }
+            s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s;
+        }
+        return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整");
+    }
+}

+ 451 - 0
gl/gl/src/private/nc/bs/gl/pfxx/VoucherToOA.java

@@ -0,0 +1,451 @@
+package nc.bs.gl.pfxx;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import nc.bs.dao.BaseDAO;
+import nc.bs.dao.DAOException;
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.pub.pa.PreAlertObject;
+import nc.bs.pub.pa.PreAlertReturnType;
+import nc.bs.pub.taskcenter.BgWorkingContext;
+import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
+import nc.jdbc.framework.processor.ColumnListProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.jdbc.framework.processor.MapListProcessor;
+import nc.log.NcLog;
+import nc.vo.pub.BusinessException;
+import nccloud.api.gl.output.PrintPdfOutputServlet;
+//import net.sf.json.JSONArray;
+//import net.sf.json.JSONObject;
+import org.jeecg.common.util.HttpHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+public class VoucherToOA implements IBackgroundWorkPlugin{
+
+    BaseDAO dao = new BaseDAO();
+    String VoucherUrl = "";
+    String cuserid = InvocationInfoProxy.getInstance().getUserId();
+    String pk_group = InvocationInfoProxy.getInstance().getGroupId();
+    String ctemplateId = getPrintTemplate();
+    PrintPdfOutputServlet printPdfService = new PrintPdfOutputServlet();
+
+    @Override
+    public PreAlertObject executeTask(BgWorkingContext context)
+            throws BusinessException {
+        // TODO 自动生成的方法存根
+        VoucherUrl = qryUrl();
+        List<Map<String, String>> mhlist = new ArrayList<Map<String, String>>();
+        String pk_org = context.getPk_orgs()[0];
+        Map<String,Object> paramap = context.getKeyMap();
+
+        String year = (String) paramap.get("year");
+        String month = (String) paramap.get("month");
+        String qryCount = "select count(*) from gl_voucher where nvl(dr,0)=0 and year = '"+year+"' and period = '"+month+"' and pk_org = '"+pk_org+"'";
+        List<Object> listCount = (List<Object>) dao.executeQuery(qryCount, new ColumnListProcessor());
+        int count = (Integer) listCount.get(0);//总条数
+        double fenzi = count;
+        double fenmu = 1;
+        int yeshu = (int) Math.ceil(fenzi/fenmu);//页数
+        for(int i = 1;i <= yeshu;i++ ){
+            int startIndex = (i-1)*1+1;
+            int endIndex;
+            if(i != yeshu){
+                endIndex = i*1;
+            }
+            else{
+                endIndex = count;
+            }
+            JSONObject returnjson = new JSONObject();
+            JSONArray dataArrays = new JSONArray();
+            StringBuffer qryVoucher = new StringBuffer();
+            qryVoucher.append("select * from (");
+            qryVoucher.append("select a.pk_voucher,a.pk_accountingbook,substr(a.prepareddate,0,10) as prepareddate,");
+            qryVoucher.append("substr(a.tallydate,0,10) as tallydate,a.year,a.period,a.pk_vouchertype,a.num,a.attachment,");
+            qryVoucher.append("a.isdifflag,a.pk_prepared,a.pk_checked,a.pk_manager,");
+//			qryVoucher.append("a.quantityflag,a.freevalue1,a.pk_casher,");
+            qryVoucher.append("a.pk_casher,");
+            qryVoucher.append("a.pk_system,a.totaldebit,a.totalcredit,a.pk_org,rownum as rm from gl_voucher a ");
+            qryVoucher.append("where nvl(a.dr,0)=0 and a.num != 0 ");
+            qryVoucher.append("and a.year = '"+year+"' ");
+            qryVoucher.append("and a.period = '"+month+"' ");
+            qryVoucher.append("and a.pk_org = '"+pk_org+"' ");
+            qryVoucher.append("and rownum <= "+endIndex+") ");
+            qryVoucher.append("where rm >= "+startIndex+"");
+            mhlist = (List<Map<String, String>>) dao.executeQuery(qryVoucher.toString(),  new MapListProcessor());
+            if (null != mhlist && mhlist.size() > 0) try {
+                {
+                    for (int j = 0; j < mhlist.size(); j++) {
+                        Map<String, String> maph = mhlist.get(j);
+                        String pk_voucher = maph.get("pk_voucher");//凭证主键
+                        String filename = printPdfService.getExportPdfInputStream(cuserid,pk_group,pk_voucher,ctemplateId);
+                        //封装表头JSONObject
+                        JSONObject dataJsonObj = new JSONObject();
+                        //arc
+                        JSONObject arcJsonObj = new JSONObject();
+                        arcJsonObj.put("uniqueK","");
+                        arcJsonObj.put("uniqueV","");
+                        try {
+                            arcJsonObj.put("fondsCode",GetBaseDAOUtil.getOrgCode(maph.get("pk_org")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        arcJsonObj.put("categoryCode","PZ");
+                        //elements
+                        JSONArray elementArrays = new JSONArray();
+                        //凭证类型
+                        JSONObject elementobj1 = new JSONObject();
+                        elementobj1.put("name","pzlx");
+                        elementobj1.put("title","凭证类型");
+                        try {
+                            elementobj1.put("content",GetBaseDAOUtil.getVoucherTypeName(maph.get("pk_vouchertype")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        elementArrays.add(elementobj1);
+                        //凭证号
+                        JSONObject elementobj2 = new JSONObject();
+                        elementobj2.put("name","pzh");
+                        elementobj2.put("title","凭证号");
+                        elementobj2.put("content",maph.get("num")==null?"0":maph.get("num"));
+                        elementArrays.add(elementobj2);
+                        //附件张数
+                        JSONObject elementobj3 = new JSONObject();
+                        elementobj3.put("name","fjzs");
+                        elementobj3.put("title","附件张数");
+                        elementobj3.put("content",maph.get("attachment")==null?"0":maph.get("attachment"));
+                        elementArrays.add(elementobj3);
+                        //年度
+                        JSONObject elementobj4 = new JSONObject();
+                        elementobj4.put("name","nd");
+                        elementobj4.put("title","年度");
+                        elementobj4.put("content",maph.get("year")==null?"":maph.get("year"));
+                        elementArrays.add(elementobj4);
+                        //月
+                        JSONObject elementobj5 = new JSONObject();
+                        elementobj5.put("name","y");
+                        elementobj5.put("title","月");
+                        elementobj5.put("content",maph.get("period")==null?"":maph.get("period"));
+                        elementArrays.add(elementobj5);
+                        //制单日期
+                        JSONObject elementobj6 = new JSONObject();
+                        elementobj6.put("name","zdrq");
+                        elementobj6.put("title","制单日期");
+                        elementobj6.put("content",maph.get("prepareddate")==null?"":maph.get("prepareddate"));
+                        elementArrays.add(elementobj6);
+                        //制单人
+                        JSONObject elementobj7 = new JSONObject();
+                        elementobj7.put("name","zdr");
+                        elementobj7.put("title","制单人");
+                        try {
+                            elementobj7.put("content",GetBaseDAOUtil.getUserName(maph.get("pk_prepared")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        elementArrays.add(elementobj7);
+                        //合计金额
+                        JSONObject elementobj8 = new JSONObject();
+                        elementobj8.put("name","hjje");
+                        elementobj8.put("title","合计金额");
+                        elementobj8.put("content",maph.get("totaldebit")==null?maph.get("totalcredit"):maph.get("totaldebit"));
+                        elementArrays.add(elementobj8);
+                        //银行流水号
+                        JSONObject elementobj9 = new JSONObject();
+                        elementobj9.put("name","yhlsh");
+                        elementobj9.put("title","银行流水号");
+//                        elementobj9.put("content",maph.get("freevalue1")==null?"":maph.get("freevalue1"));
+                        elementobj9.put("content","");
+                        elementArrays.add(elementobj9);
+                        //题名
+                        JSONObject elementobj10 = new JSONObject();
+                        elementobj10.put("name","folder_title");
+                        elementobj10.put("title","题名");
+                        elementobj10.put("content","用友测试凭证1");
+                        elementArrays.add(elementobj10);
+                        //公司名称
+                        JSONObject elementobj11 = new JSONObject();
+                        elementobj11.put("name","qzmc");
+                        elementobj11.put("title","公司名称");
+                        try {
+                            elementobj11.put("content",GetBaseDAOUtil.getOrgName(maph.get("pk_org")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        elementArrays.add(elementobj11);
+                        arcJsonObj.put("element",elementArrays);
+                        dataJsonObj.put("arc",arcJsonObj);
+                        //files
+                        JSONArray filesJsonArray = new JSONArray();
+                        JSONObject fileJsonObj = new JSONObject();
+                        //document,如果有附件的话,往里面加
+                        JSONArray docArrays = new JSONArray();
+                        JSONObject docJsonObj1 = new JSONObject();
+                        docJsonObj1.put("needdownload","true");
+                        docJsonObj1.put("ftpname","YYPZFTP");
+                        //param
+                        JSONArray paramArrays = new JSONArray();
+                        JSONObject paramobj1 =new JSONObject();
+                        paramobj1.put("name","path");
+                        paramobj1.put("title","附件地址");
+                        paramobj1.put("content","ftp://"+pk_voucher+".pdf");
+                        paramArrays.add(paramobj1);
+                        JSONObject paramobj2 =new JSONObject();
+                        paramobj2.put("name","arc_document_name");
+                        paramobj2.put("title","附件名称");
+                        paramobj2.put("content",pk_voucher+".pdf");
+                        paramArrays.add(paramobj2);
+                        docJsonObj1.put("param",paramArrays);
+                        docArrays.add(docJsonObj1);
+                        fileJsonObj.put("document",docArrays);
+                        //metadata
+                        JSONObject metaJsonObj = new JSONObject();
+                        metaJsonObj.put("type","1");
+                        JSONArray fieldArrays = new JSONArray();
+                        //核算账薄
+                        JSONObject fieldObj1 = new JSONObject();
+                        fieldObj1.put("name","hszb");
+                        fieldObj1.put("title","核算账薄");
+                        try {
+                            fieldObj1.put("content",GetBaseDAOUtil.getAccountBookName(maph.get("pk_accountingbook")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        fieldArrays.add(fieldObj1);
+                        //制单日期
+                        JSONObject fieldObj2 = new JSONObject();
+                        fieldObj2.put("name","zdrq");
+                        fieldObj2.put("title","制单日期");
+                        fieldObj2.put("content",maph.get("prepareddate")==null?"":maph.get("prepareddate"));
+                        fieldArrays.add(fieldObj2);
+                        //会计期间
+                        JSONObject fieldObj3 = new JSONObject();
+                        fieldObj3.put("name","hjqj");
+                        fieldObj3.put("title","会计期间");
+                        fieldObj3.put("content",maph.get("period")==null?"":maph.get("period"));
+                        fieldArrays.add(fieldObj3);
+                        //凭证类别
+                        JSONObject fieldObj4 = new JSONObject();
+                        fieldObj4.put("name","pzlb");
+                        fieldObj4.put("title","凭证类别");
+                        try {
+                            fieldObj4.put("content",GetBaseDAOUtil.getVoucherTypeName(maph.get("pk_vouchertype")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        fieldArrays.add(fieldObj4);
+                        //凭证号
+                        JSONObject fieldObj5 = new JSONObject();
+                        fieldObj5.put("name","pzh");
+                        fieldObj5.put("title","凭证号");
+                        fieldObj5.put("content",maph.get("num")==null?"0":maph.get("num"));
+                        fieldArrays.add(fieldObj5);
+                        //附单据数
+                        JSONObject fieldObj6 = new JSONObject();
+                        fieldObj6.put("name","fdjs");
+                        fieldObj6.put("title","附单据数");
+                        fieldObj6.put("content",maph.get("attachment")==null?"0":maph.get("attachment"));
+                        fieldArrays.add(fieldObj6);
+                        //数量调整
+                        JSONObject fieldObj7 = new JSONObject();
+                        fieldObj7.put("name","sldz");
+                        fieldObj7.put("title","数量调整");
+//                        fieldObj7.put("content",maph.get("quantityflag")==null?"N":maph.get("quantityflag"));
+                        fieldObj7.put("content","N");
+                        fieldArrays.add(fieldObj7);
+                        //差异凭证
+                        JSONObject fieldObj8 = new JSONObject();
+                        fieldObj8.put("name","cypz");
+                        fieldObj8.put("title","差异凭证");
+                        fieldObj8.put("content",maph.get("isdifflag")==null?"N":maph.get("isdifflag"));
+                        fieldArrays.add(fieldObj8);
+                        //银行回单流水
+                        JSONObject fieldObj9 = new JSONObject();
+                        fieldObj9.put("name","yhhdls");
+                        fieldObj9.put("title","银行回单流水");
+//                        fieldObj9.put("content",maph.get("freevalue1")==null?"":maph.get("freevalue1"));
+                        fieldObj9.put("content","");
+                        fieldArrays.add(fieldObj9);
+                        //制单人
+                        JSONObject fieldObj10 = new JSONObject();
+                        fieldObj10.put("name","zdr");
+                        fieldObj10.put("title","制单人");
+                        try {
+                            fieldObj10.put("content",GetBaseDAOUtil.getUserName(maph.get("pk_prepared")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        fieldArrays.add(fieldObj10);
+                        //签字人
+                        JSONObject fieldObj11 = new JSONObject();
+                        fieldObj11.put("name","qzr");
+                        fieldObj11.put("title","签字人");
+                        try {
+                            fieldObj11.put("content",GetBaseDAOUtil.getUserName(maph.get("pk_casher")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        fieldArrays.add(fieldObj11);
+                        //审核人
+                        JSONObject fieldObj12 = new JSONObject();
+                        fieldObj12.put("name","shr");
+                        fieldObj12.put("title","审核人");
+                        try {
+                            fieldObj12.put("content",GetBaseDAOUtil.getUserName(maph.get("pk_checked")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        fieldArrays.add(fieldObj12);
+                        //记账人
+                        JSONObject fieldObj13 = new JSONObject();
+                        fieldObj13.put("name","jzr");
+                        fieldObj13.put("title","记账人");
+                        try {
+                            fieldObj13.put("content",GetBaseDAOUtil.getUserName(maph.get("pk_manager")));
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                        fieldArrays.add(fieldObj13);
+                        //来源系统
+                        JSONObject fieldObj14 = new JSONObject();
+                        fieldObj14.put("name","lyxt");
+                        fieldObj14.put("title","来源系统");
+                        fieldObj14.put("content",maph.get("pk_system"));
+                        fieldArrays.add(fieldObj14);
+                        //组织借方合计
+                        JSONObject fieldObj15 = new JSONObject();
+                        fieldObj15.put("name","zzjfhj");
+                        fieldObj15.put("title","组织借方合计");
+                        fieldObj15.put("content",maph.get("totaldebit")==null?0:maph.get("totaldebit"));
+                        fieldArrays.add(fieldObj15);
+                        //组织贷方合计
+                        JSONObject fieldObj16 = new JSONObject();
+                        fieldObj16.put("name","zzdfhj");
+                        fieldObj16.put("title","组织贷方合计");
+                        fieldObj16.put("content",maph.get("totalcredit")==null?0:maph.get("totalcredit"));
+                        fieldArrays.add(fieldObj16);
+                        metaJsonObj.put("field",fieldArrays);
+                        //details,如果凭证有多行表体要加多个JSONObject
+                        JSONArray detailArrays = new JSONArray();
+                        StringBuffer qryDetail = new StringBuffer();
+                        qryDetail.append("select a.pk_org,a.explanation,a.pk_accasoa,c.code as accountcode,c.name as accountname,a.assid,");
+                        qryDetail.append("e.code as accassitemcode,e.name as accassitemname,f.code as currtypecode,f.name as currtypename,");
+                        qryDetail.append("a.excrate2,a.debitamount,a.creditamount  from gl_detail a ");
+                        qryDetail.append("left join bd_accasoa b on a.pk_accasoa = b.pk_accasoa ");
+                        qryDetail.append("left join bd_account c on b.pk_account = c.pk_account ");
+                        qryDetail.append("left join gl_freevalue d on a.assid = d.freevalueid ");
+                        qryDetail.append("left join bd_accassitem e on substr(d.typevalue2,1,20) = e.pk_accassitem ");
+                        qryDetail.append("left join bd_currtype f on a.pk_currtype = f.pk_currtype ");
+                        qryDetail.append("where nvl(a.dr,0)=0 and nvl(b.dr,0)=0 and nvl(c.dr,0)=0 and nvl(d.dr,0)=0 and nvl(e.dr,0)=0 and nvl(f.dr,0)=0 ");
+                        qryDetail.append("and a.pk_voucher = '"+maph.get("pk_voucher")+"'");
+                        List<Map<String, String>> pl = (List<Map<String, String>>) dao.executeQuery(qryDetail.toString(), new MapListProcessor());
+                        if (null != pl && pl.size() > 0) {
+                            for (int k = 0; k < pl.size(); k++) {
+                                Map<String, String> map = pl.get(k);
+                                JSONObject detailobj1 = new JSONObject();
+                                detailobj1.put("type","dt1");
+                                //column
+                                JSONArray columnArrays = new JSONArray();
+                                //摘要
+                                JSONObject columnobj1 = new JSONObject();
+                                columnobj1.put("name","zy");
+                                columnobj1.put("title","摘要");
+                                columnobj1.put("content",map.get("explanation")==null?"":map.get("explanation"));
+                                columnArrays.add(columnobj1);
+                                //会计科目
+                                JSONObject columnobj2 = new JSONObject();
+                                columnobj2.put("name","hjkm");
+                                columnobj2.put("title","会计科目");
+                                columnobj2.put("content",map.get("accountname")==null?"":map.get("accountname"));
+                                columnArrays.add(columnobj2);
+                                //科目编码
+                                JSONObject columnobj3 = new JSONObject();
+                                columnobj3.put("name","kmbm");
+                                columnobj3.put("title","科目编码");
+                                columnobj3.put("content",map.get("accountcode")==null?"":map.get("accountcode"));
+                                columnArrays.add(columnobj3);
+                                //辅助核算项
+                                JSONObject columnobj4 = new JSONObject();
+                                columnobj4.put("name","fzhsx");
+                                columnobj4.put("title","辅助核算项");
+                                columnobj4.put("content",map.get("accassitemname")==null?"":map.get("accassitemname"));
+                                columnArrays.add(columnobj4);
+                                //辅助核算编码
+                                JSONObject columnobj5 = new JSONObject();
+                                columnobj5.put("name","fzhsbm");
+                                columnobj5.put("title","辅助核算编码");
+                                columnobj5.put("content",map.get("accassitemcode")==null?"":map.get("accassitemcode"));
+                                columnArrays.add(columnobj5);
+                                //币种
+                                JSONObject columnobj6 = new JSONObject();
+                                columnobj6.put("name","bz");
+                                columnobj6.put("title","币种");
+                                columnobj6.put("content",map.get("currtypecode")==null?"":map.get("currtypecode"));
+                                columnArrays.add(columnobj6);
+                                detailobj1.put("column",columnArrays);
+                                detailArrays.add(detailobj1);
+                            }
+                        }
+                        metaJsonObj.put("details",detailArrays);
+                        fileJsonObj.put("metadata",metaJsonObj);
+                        filesJsonArray.add(fileJsonObj);
+                        dataJsonObj.put("files",filesJsonArray);
+//                        NcLog.info(dataJsonObj.toJSONString());
+                        dataArrays.add(dataJsonObj);
+                    }
+                    //拿jsonarray去调oa的接口
+                    returnjson.put("datas",dataArrays);
+                    NcLog.info("第"+i+"页json为"+returnjson.toJSONString());
+                    String res = HttpHelper.doPost(VoucherUrl,returnjson.toString());
+                    NcLog.info("第"+i+"页接口返回值为"+returnjson.toString());
+                }
+            } catch (RuntimeException e) {
+                NcLog.info(e.getMessage());
+                throw new RuntimeException(e);
+            } catch (DAOException e) {
+                NcLog.info(e.getMessage());
+                throw new RuntimeException(e);
+            }
+        }
+        PreAlertObject obj = new PreAlertObject();
+        obj.setReturnType(PreAlertReturnType.RETURNMESSAGE);
+        obj.setReturnObj("success");
+        obj.setMsgTitle("msg");
+        return obj;
+    }
+
+    private String qryUrl(){
+        String sql = "select value from pub_sysinit where nvl(dr,0)=0  and initcode='VoucherUrl' and nvl(dr,0)=0";
+        Object object;
+        try {
+            object = dao.executeQuery(sql,new ColumnProcessor());
+            if (object==null) {
+                throw new Exception("未查询到凭证接口地址!");
+            }
+            return object.toString();
+        } catch (DAOException e) {
+            throw new RuntimeException(e);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    //获取凭证模板
+    private String getPrintTemplate(){
+        String qryStr = "select ctemplateId from pub_print_template where nvl(dr,0)=0 and vtemplatename = '总账_凭证_原币式_cloud'";
+        Object obj;
+        try {
+            obj = dao.executeQuery(qryStr,new ColumnProcessor());
+            if(obj == null){
+                throw new Exception("未查询到输出模板!");
+            }
+            return obj.toString();
+        } catch (DAOException e) {
+            throw new RuntimeException(e);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
+}

+ 54 - 0
gl/gl/src/private/nccloud/api/gl/output/PrintPdfOutputServlet.java

@@ -0,0 +1,54 @@
+package nccloud.api.gl.output;
+
+import nc.bs.dao.BaseDAO;
+import nc.bs.dao.DAOException;
+import nc.bs.framework.common.RuntimeEnv;
+import nc.gl.pub.print.utils.GlConvertPdfUtils;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.MapListProcessor;
+import nc.jdbc.framework.processor.MapProcessor;
+import nc.vo.gl.pubvoucher.VoucherVO;
+import nccloud.api.gl.utils.BillPdfDataSource;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+public  class PrintPdfOutputServlet {
+    public Class<VoucherVO> getAggVOClz() {
+        return VoucherVO.class;
+    }
+
+    public PrintPdfOutputServlet() {
+    }
+
+    String homepath = RuntimeEnv.getInstance().getNCHome();
+    BaseDAO dao = new BaseDAO();
+
+    public PrintPdfOutputServlet(String homepath) {
+        this.homepath = homepath;
+    }
+    public String getExportPdfInputStream(String cuserid, String pk_group, String billId, String ctemplateId) throws DAOException {
+        InputStream in = null;
+        String qrysql = "select * from gl_voucher where nvl(dr,0)=0 and pk_voucher = '"+billId+"'";
+        VoucherVO vo = (VoucherVO) dao.executeQuery(qrysql,new BeanProcessor(VoucherVO.class));
+        String qrydetail = "select * from gl_detail where nvl(dr,0)=0 and pk_voucher = '"+billId+"'";
+        List<Map<String, String>> map = (List<Map<String, String>>) dao.executeQuery(qrydetail,new MapListProcessor());
+
+        BillPdfDataSource printDS = new BillPdfDataSource(vo,map);
+        String filepath = homepath+ File.separator+"exportPDF";
+        File folder = new File(filepath);
+        if(!folder.exists() && !folder.isDirectory()){
+            folder.mkdirs();
+        }
+        String FileName = filepath + File.separator + billId + ".pdf";
+
+        try {
+            GlConvertPdfUtils.pdfExport(ctemplateId,FileName,printDS);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return FileName;
+    }
+}

+ 348 - 0
gl/gl/src/private/nccloud/api/gl/utils/BillPdfDataSource.java

@@ -0,0 +1,348 @@
+package nccloud.api.gl.utils;
+
+import nc.bs.dao.BaseDAO;
+import nc.bs.dao.DAOException;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.gl.pfxx.GetBaseDAOUtil;
+import nc.bs.gl.pfxx.MoneyToUpper;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.md.persist.framework.IMDPersistenceQueryService;
+import nc.ui.pub.print.IDataSource;
+import nc.ui.pub.print.IMetaDataDataSource;
+import nc.vo.gl.pubvoucher.VoucherVO;
+import nc.vo.pub.lang.UFDouble;
+
+import java.util.List;
+import java.util.Map;
+
+
+public class BillPdfDataSource implements IDataSource {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 6613147708180615957L;
+	BaseDAO dao = new BaseDAO();
+
+	private VoucherVO vouchervo = null;
+	private List<Map<String,String>> datas;
+
+	public BillPdfDataSource(VoucherVO vouchervo,List<Map<String,String>> datas) {
+		this.vouchervo = vouchervo;
+		this.datas = datas;
+	}
+
+	@Override
+	public String[] getItemValuesByExpress(String express) {
+		String[] str ;
+		if(express.equals("voucher56")){
+			str = new String[datas.size()];
+			for(int i = 0;i < datas.size();i++){
+				str[i] = datas.get(i).get("explanation");
+			}
+		} else if (express.equals("voucher79")) {
+			str = new String[datas.size()];
+			for(int i = 0;i < datas.size();i++){
+				try {
+					str[i] = GetBaseDAOUtil.getAccountName(datas.get(i).get("pk_accasoa"));
+				} catch (Exception e) {
+					throw new RuntimeException(e);
+				}
+			}
+		} else if (express.equals("voucher76")) {
+			str = new String[datas.size()];
+			for(int i = 0;i < datas.size();i++){
+				str[i] = null;
+			}
+		} else if (express.equals("voucher304")) {
+			str = new String[datas.size()];
+			for(int i = 0;i < datas.size();i++){
+				try {
+					str[i] = GetBaseDAOUtil.getCurrencyName(datas.get(i).get("pk_currtype"));
+				} catch (Exception e) {
+					throw new RuntimeException(e);
+				}
+			}
+		} else if (express.equals("voucher75")) {
+			str = new String[datas.size()];
+			for(int i = 0;i < datas.size();i++){
+//				str[i] = datas.get(i).get("debitamount").toString().equals("0.00000000")?new UFDouble(datas.get(i).get("creditamount").toString()).toString():new UFDouble(datas.get(i).get("debitamount").toString()).toString();
+				Object debitamount = datas.get(i).get("debitamount");
+				Object creditamount = datas.get(i).get("creditamount");
+				str[i] = new UFDouble(debitamount.toString()).equals(UFDouble.ZERO_DBL)?creditamount.toString():debitamount.toString();
+			}
+		} else if (express.equals("voucher65")) {
+			str = new String[datas.size()];
+			for(int i = 0;i < datas.size();i++){
+				Object localdebitamount = datas.get(i).get("localdebitamount");
+				str[i] = localdebitamount.toString();
+			}
+		} else if (express.equals("voucher69")) {
+			str = new String[datas.size()];
+			for(int i = 0;i < datas.size();i++){
+				Object localcreditamount = datas.get(i).get("localcreditamount");
+				str[i] = localcreditamount.toString();
+			}
+		} else if (express.equals("voucher36")) {
+			str = new String[1];
+			try {
+				str[0] = GetBaseDAOUtil.getVoucherTypeName(this.vouchervo.getPk_vouchertype()) + "凭证";
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		} else if (express.equals("voucher43")) {
+			str = new String[1];
+			str[0] = null;
+		} else if (express.equals("voucher16")) {
+			str = new String[1];
+			str[0] = this.vouchervo.getCreationtime().toString().substring(0,10);
+		} else if (express.equals("voucher34")) {
+			str = new String[1];
+			str[0] = "总账";
+		} else if (express.equals("voucher55")) {
+			str = new String[1];
+			try {
+				str[0] = "核算账簿:"+GetBaseDAOUtil.getAccountBookName(this.vouchervo.getPk_accountingbook());
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		} else if (express.equals("voucher91")) {
+			str = new String[1];
+			str[0] = null;
+		} else if (express.equals("voucher15")) {
+			str = new String[1];
+			String qrynum = "select num from gl_voucher where pk_voucher = '"+this.vouchervo.getPk_voucher()+"'";
+			try {
+				Object num = dao.executeQuery(qrynum,new ColumnProcessor());
+				str[0] = num.toString();
+			} catch (DAOException e) {
+				throw new RuntimeException(e);
+			}
+		} else if (express.equals("voucher92")) {
+			str = new String[1];
+			str[0] = "1";
+		} else if (express.equals("voucher18")) {
+			str = new String[1];
+			str[0] = this.vouchervo.getAttachment().toString();
+		} else if (express.equals("voucher42")) {
+			str = new String[1];
+			str[0] = this.vouchervo.getTotalcredit()== UFDouble.ZERO_DBL ?MoneyToUpper.moneyToUpper(this.vouchervo.getTotaldebit().toDouble()):MoneyToUpper.moneyToUpper(this.vouchervo.getTotaldebit().toDouble());
+		} else if (express.equals("voucher31")) {
+			str = new String[1];
+			str[0] = this.vouchervo.getTotaldebit().toString();
+		} else if (express.equals("voucher32")) {
+			str = new String[1];
+			str[0] = this.vouchervo.getTotalcredit().toString();
+		} else if (express.equals("voucher39")) {
+			str = new String[1];
+			try {
+				str[0] = GetBaseDAOUtil.getUserName(this.vouchervo.getPk_prepared());
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		} else if (express.equals("voucher38")) {
+			str = new String[1];
+			try {
+				str[0] = GetBaseDAOUtil.getUserName(this.vouchervo.getPk_checked());
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		} else if (express.equals("voucher37")) {
+			str = new String[1];
+			try {
+				str[0] = GetBaseDAOUtil.getUserName(this.vouchervo.getPk_casher());
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		} else if (express.equals("voucher40")) {
+			str = new String[1];
+			try {
+				str[0] = GetBaseDAOUtil.getUserName(this.vouchervo.getPk_manager());
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		} else {
+			str = new String[1];
+			str[0] = null;
+		}
+		return str;
+	}
+
+	@Override
+	public boolean isNumber(String s) {
+		return false;
+	}
+
+	@Override
+	public String[] getDependentItemExpressByExpress(String s) {
+		return null;
+	}
+
+	@Override
+	public String[] getAllDataItemExpress() {
+		String[] dataItemExpress = new String[71];
+		dataItemExpress[0] = "ADDCLASS";
+		dataItemExpress[1] = "ADJUSTPERIOD";
+		dataItemExpress[2] = "APPROVER";
+		dataItemExpress[3] = "ATTACHMENT";
+		dataItemExpress[4] = "BILLMAKER";
+		dataItemExpress[5] = "CHECKEDDATE";
+		dataItemExpress[6] = "CONTRASTFLAG";
+		dataItemExpress[7] = "CONVERTFLAG";
+		dataItemExpress[8] = "CREATIONTIME";
+		dataItemExpress[9] = "CREATOR";
+		dataItemExpress[10] = "DELETECLASS";
+		dataItemExpress[11] = "DETAILMODFLAG";
+		dataItemExpress[12] = "DISCARDFLAG";
+		dataItemExpress[13] = "DR";
+		dataItemExpress[14] = "ERRMESSAGE";
+		dataItemExpress[15] = "ERRMESSAGEH";
+		dataItemExpress[16] = "EXPLANATION";
+		dataItemExpress[17] = "EXRATEDATE2";
+		dataItemExpress[18] = "FREE1";
+		dataItemExpress[19] = "FREE10";
+		dataItemExpress[20] = "FREE2";
+		dataItemExpress[21] = "FREE3";
+		dataItemExpress[22] = "FREE4";
+		dataItemExpress[23] = "FREE5";
+		dataItemExpress[24] = "FREE6";
+		dataItemExpress[25] = "FREE7";
+		dataItemExpress[26] = "FREE8";
+		dataItemExpress[27] = "FREE9";
+		dataItemExpress[28] = "ISDIFFLAG";
+		dataItemExpress[29] = "MODIFIEDTIME";
+		dataItemExpress[30] = "MODIFIER";
+		dataItemExpress[31] = "MODIFYCLASS";
+		dataItemExpress[32] = "MODIFYFLAG";
+		dataItemExpress[33] = "NUM";
+		dataItemExpress[34] = "OFFERVOUCHER";
+		dataItemExpress[35] = "PERIOD";
+		dataItemExpress[36] = "PK_ACCOUNTINGBOOK";
+		dataItemExpress[37] = "PK_CASHER";
+		dataItemExpress[38] = "PK_CHECKED";
+		dataItemExpress[39] = "PK_EXRATESCHEME2";
+		dataItemExpress[40] = "PK_GROUP";
+		dataItemExpress[41] = "PK_MANAGER";
+		dataItemExpress[42] = "PK_ORG";
+		dataItemExpress[43] = "PK_ORG_V";
+		dataItemExpress[44] = "PK_PREPARED";
+		dataItemExpress[45] = "PK_SETOFBOOK";
+		dataItemExpress[46] = "PK_SOURCEPK";
+		dataItemExpress[47] = "PK_SYSTEM";
+		dataItemExpress[48] = "PK_VOUCHER";
+		dataItemExpress[49] = "PK_VOUCHERTYPE";
+		dataItemExpress[50] = "PREACCOUNTFLAG";
+		dataItemExpress[51] = "PREPAREDDATE";
+		dataItemExpress[52] = "SAGA_BTXID";
+		dataItemExpress[53] = "SAGA_FROZEN";
+		dataItemExpress[54] = "SAGA_GTXID";
+		dataItemExpress[55] = "SAGA_STATUS";
+		dataItemExpress[56] = "SIGNDATE";
+		dataItemExpress[57] = "SIGNFLAG";
+		dataItemExpress[58] = "TALLYDATE";
+		dataItemExpress[59] = "TEMPSAVEFLAG";
+		dataItemExpress[60] = "TOTALCREDIT";
+		dataItemExpress[61] = "TOTALCREDITGLOBAL";
+		dataItemExpress[62] = "TOTALCREDITGROUP";
+		dataItemExpress[63] = "TOTALCREDITSETOFBOOK";
+		dataItemExpress[64] = "TOTALDEBIT";
+		dataItemExpress[65] = "TOTALDEBITGLOBAL";
+		dataItemExpress[66] = "TOTALDEBITGROUP";
+		dataItemExpress[67] = "TOTALDEBITSETOFBOOK";
+		dataItemExpress[68] = "TS";
+		dataItemExpress[69] = "VOUCHERKIND";
+		dataItemExpress[70] = "YEAR";
+		return dataItemExpress;
+	}
+
+	@Override
+	public String[] getAllDataItemNames() {
+		String[] dataItemNames = new String[71];
+		dataItemNames[0] = "增加接口类";
+		dataItemNames[1] = "调整期间";
+		dataItemNames[2] = "审批人";
+		dataItemNames[3] = "附单据数";
+		dataItemNames[4] = "制单人";
+		dataItemNames[5] = "审核日期";
+		dataItemNames[6] = "对比标识";
+		dataItemNames[7] = "折算凭证";
+		dataItemNames[8] = "创建时间";
+		dataItemNames[9] = "创建人";
+		dataItemNames[10] = "删除接口类";
+		dataItemNames[11] = "分录增删标志";
+		dataItemNames[12] = "作废标志";
+		dataItemNames[13] = "删除标识";
+		dataItemNames[14] = "错误信息";
+		dataItemNames[15] = "历史错误信息";
+		dataItemNames[16] = "摘要";
+		dataItemNames[17] = "记账日期2";
+		dataItemNames[18] = "预留字段1";
+		dataItemNames[19] = "预留字段10";
+		dataItemNames[20] = "预留字段2";
+		dataItemNames[21] = "预留字段3";
+		dataItemNames[22] = "预留字段4";
+		dataItemNames[23] = "预留字段5";
+		dataItemNames[24] = "预留字段6";
+		dataItemNames[25] = "预留字段7";
+		dataItemNames[26] = "预留字段8";
+		dataItemNames[27] = "预留字段9";
+		dataItemNames[28] = "差异凭证";
+		dataItemNames[29] = "修改时间";
+		dataItemNames[30] = "修改人";
+		dataItemNames[31] = "修改接口类";
+		dataItemNames[32] = "修改标志";
+		dataItemNames[33] = "凭证号";
+		dataItemNames[34] = "冲销凭证";
+		dataItemNames[35] = "会计期间";
+		dataItemNames[36] = "核算账簿";
+		dataItemNames[37] = "出纳";
+		dataItemNames[38] = "审核人";
+		dataItemNames[39] = "记账规则";
+		dataItemNames[40] = "集团";
+		dataItemNames[41] = "记账人";
+		dataItemNames[42] = "组织";
+		dataItemNames[43] = "组织多版本";
+		dataItemNames[44] = "制单人";
+		dataItemNames[45] = "账簿类型";
+		dataItemNames[46] = "折算来源凭证";
+		dataItemNames[47] = "制单系统";
+		dataItemNames[48] = "凭证主键";
+		dataItemNames[49] = "凭证类别";
+		dataItemNames[50] = "提前关账科目";
+		dataItemNames[51] = "制单日期";
+		dataItemNames[52] = "子事务";
+		dataItemNames[53] = "冻结状态";
+		dataItemNames[54] = "全局事务";
+		dataItemNames[55] = "事务状态";
+		dataItemNames[56] = "签字日期";
+		dataItemNames[57] = "签字标志";
+		dataItemNames[58] = "记账日期";
+		dataItemNames[59] = "暂存标志";
+		dataItemNames[60] = "贷方合计";
+		dataItemNames[61] = "全局贷方合计";
+		dataItemNames[62] = "集团贷方合计";
+		dataItemNames[63] = "账簿贷方合计";
+		dataItemNames[64] = "借方合计";
+		dataItemNames[65] = "全局借方合计";
+		dataItemNames[66] = "集团借方合计";
+		dataItemNames[67] = "账簿借方合计";
+		dataItemNames[68] = "时间戳";
+		dataItemNames[69] = "凭证类型";
+		dataItemNames[70] = "会计年度";
+		return dataItemNames;
+	}
+
+	@Override
+	public String getModuleName() {
+		return "20020PREPA";
+	}
+
+	public VoucherVO getVouchervo(){
+		return vouchervo;
+	}
+
+	public void setVouchervo(VoucherVO vouchervo){
+		this.vouchervo = vouchervo;
+	}
+}

+ 220 - 0
gl/gl/src/public/nc/gl/pub/print/utils/GlConvertPdfUtils.java

@@ -0,0 +1,220 @@
+package nc.gl.pub.print.utils;
+
+import java.awt.Graphics2D;
+import java.io.File;
+import java.io.FileOutputStream;
+
+import nc.ui.pub.print.IDataSource;
+import nc.ui.pub.print.output.DefaultDataSourceOrganizer;
+import nc.ui.pub.print.output.DefaultTemplateDataAccessor;
+import nc.ui.pub.print.page.DocGroupUtil;
+import nc.ui.pub.print.version55.print.merge.CopyConfig;
+import nc.ui.pub.print.version55.print.merge.MergedPage;
+import nc.ui.pub.print.version55.print.merge.MergedResult;
+import nc.ui.pub.print.version55.print.output.OutputDocument;
+import nc.ui.pub.print.version55.print.output.OutputDocumentUtil;
+import nc.ui.pub.print.version55.print.output.paint.OutputContext;
+import nc.ui.pub.print.version55.print.output.paint.PageFactory;
+import nc.ui.pub.print.version55.print.pagesplit.core.atomsplit.SplitContext;
+import nc.ui.pub.print.version55.print.template.Paper;
+import nc.ui.pub.print.version55.print.template.Template;
+import nc.ui.pub.print.version55.print.template.TemplateAdapter;
+import nc.vo.pub.print.MergeConfig;
+
+import com.lowagie.text.Document;
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.PdfContentByte;
+import com.lowagie.text.pdf.PdfWriter;
+
+public class GlConvertPdfUtils {
+
+	/**
+	 * 总账报表导出PDF
+	 *
+	 * @param pk_group
+	 *            集团
+	 * @param pk_user
+	 *            用户
+	 * @param nodeKey
+	 *            打印模板标识
+	 * @param filePath
+	 *            //保存文件路径
+	 * @return 文件暂存路径
+	 * @throws Exception
+	 */
+	public static String pdfExport(String pk_group, String pk_user,
+			String nodeCode, String nodeKey, String filePath,
+			IDataSource... singleObj) throws Exception {
+		DefaultTemplateDataAccessor m_printDataAccessor = new DefaultTemplateDataAccessor();
+		DefaultDataSourceOrganizer m_dsOrganizer = new DefaultDataSourceOrganizer();
+		for (IDataSource iDataSource : singleObj) {
+			m_dsOrganizer.addDataSource(iDataSource);
+		}
+		m_printDataAccessor.setTemplateID(pk_group, null, nodeCode, pk_user,
+				null, nodeKey, null);
+		Template t = TemplateAdapter
+				.translate((DefaultTemplateDataAccessor) m_printDataAccessor);
+		OutputDocument docs = DocGroupUtil.orgOutputDocument(
+				(DefaultTemplateDataAccessor) m_printDataAccessor,
+				m_dsOrganizer);
+		Paper pageSize = null;
+		// Paper pageSize =
+		// PrintCache.getInstance().loadPaper(PrintCache.getTemplateKey(docs));
+		if (pageSize == null)
+			pageSize = t.getOutPageSize();
+		MergeConfig mc = null;
+		// MergeConfig mc =
+		// PrintCache.getInstance().loadMergeConfig(PrintCache.getTemplateKey(docs));
+		if (mc == null)
+			mc = TemplateAdapter
+					.translateMergeConfig((DefaultTemplateDataAccessor) m_printDataAccessor);
+
+		CopyConfig cc = TemplateAdapter
+				.translateCopyConfig((DefaultTemplateDataAccessor) m_printDataAccessor);
+
+		OutputContext context = new OutputContext();
+		// 格式化导出数据
+		OutputDocumentUtil.formatDs(docs);
+		PageFactory pages = new PageFactory(docs);
+		// pages.setPageSize(paper);
+
+		pages.setPageSize(pageSize);
+		pages.setMergeConfig(mc);
+		pages.setCopyConfig(cc);
+		pages.getSplitContext().setOperation(SplitContext.OPERATION_PDF);
+		// 分页上下文
+		context.setSplitContext(pages.getSplitContext());
+		int lenght = 1;
+
+		pages.doSplit();
+
+		int toPage = pages.getResult().getPages().size();
+		if (lenght > 10) {
+			toPage = toPage + (lenght - 1) / 10;
+		}
+		createFile(filePath, 0, toPage, context, pages.getResult(),
+				pages.getPageSize());
+
+		return filePath;
+	}
+	
+	/**
+	 * 总账报表导出PDF
+	 * @param templateId 模板id
+	 * @param filePath 存储路径
+	 * @param singleObj 数据源
+	 * @return
+	 * @throws Exception
+	 */
+	public static String pdfExport(String templateId, String filePath,
+			IDataSource... singleObj) throws Exception {
+		DefaultTemplateDataAccessor m_printDataAccessor = new DefaultTemplateDataAccessor();
+		DefaultDataSourceOrganizer m_dsOrganizer = new DefaultDataSourceOrganizer();
+		for (IDataSource iDataSource : singleObj) {
+			m_dsOrganizer.addDataSource(iDataSource);
+		}
+		m_printDataAccessor.setTemplateID(templateId,false);
+		Template t = TemplateAdapter
+				.translate((DefaultTemplateDataAccessor) m_printDataAccessor);
+		OutputDocument docs = DocGroupUtil.orgOutputDocument(
+				(DefaultTemplateDataAccessor) m_printDataAccessor,
+				m_dsOrganizer);
+		Paper pageSize = null;
+		// Paper pageSize =
+		// PrintCache.getInstance().loadPaper(PrintCache.getTemplateKey(docs));
+		if (pageSize == null)
+			pageSize = t.getOutPageSize();
+		MergeConfig mc = null;
+		// MergeConfig mc =
+		// PrintCache.getInstance().loadMergeConfig(PrintCache.getTemplateKey(docs));
+		if (mc == null)
+			mc = TemplateAdapter
+					.translateMergeConfig((DefaultTemplateDataAccessor) m_printDataAccessor);
+
+		CopyConfig cc = TemplateAdapter
+				.translateCopyConfig((DefaultTemplateDataAccessor) m_printDataAccessor);
+
+		OutputContext context = new OutputContext();
+		// 格式化导出数据
+		OutputDocumentUtil.formatDs(docs);
+		PageFactory pages = new PageFactory(docs);
+		// pages.setPageSize(paper);
+
+		pages.setPageSize(pageSize);
+		pages.setMergeConfig(mc);
+		pages.setCopyConfig(cc);
+		pages.getSplitContext().setOperation(SplitContext.OPERATION_PDF);
+		// 分页上下文
+		context.setSplitContext(pages.getSplitContext());
+		int lenght = 1;
+
+		pages.doSplit();
+
+		int toPage = pages.getResult().getPages().size();
+		if (lenght > 10) {
+			toPage = toPage + (lenght - 1) / 10;
+		}
+		createFile(filePath, 0, toPage, context, pages.getResult(),
+				pages.getPageSize());
+
+		return filePath;
+	}
+
+	/**
+	 * 保存PDF
+	 * 
+	 * @param path
+	 * @param fromPage
+	 * @param toPage
+	 * @param context
+	 * @param pages
+	 * @param paper
+	 * @throws Exception
+	 */
+	private static void createFile(String path, int fromPage, int toPage,
+			OutputContext context, MergedResult pages, Paper paper)
+			throws Exception {
+		File file = new File(path);
+
+		File fileParent = file.getParentFile();
+		if (!fileParent.exists()) {// 判断路径是否存在
+			fileParent.mkdirs();
+		}
+		if (file.exists()) {// 判断文件是否存在
+			file.delete();
+			file.createNewFile();
+		}
+		double pageWidth = paper.getSize().getWidth().getPt();
+		double pageHeight = paper.getSize().getHeight().getPt();
+
+		Rectangle rect = new Rectangle((float) pageWidth, (float) pageHeight);
+		if (!paper.isDirection())
+			rect.rotate();
+
+		Document document = new Document(rect);
+		PdfWriter pw = null;
+		pw = PdfWriter.getInstance(document, new FileOutputStream(path));
+
+		document.open();
+		// ProgressMonitor monitor = new ProgressMonitor();
+		PdfContentByte cb = pw.getDirectContent();
+		Graphics2D g2 = cb.createGraphicsShapes(rect.getWidth(),
+				rect.getHeight());
+
+		// monitor.setTotal(1);
+		MergedPage page = null;
+		for (int i = fromPage; i < toPage; i++) {
+			page = pages.getPages().get(i);
+
+			context.setCurMergePage(page);
+			page.paint(g2, context);
+
+			// monitor.setValue(monitor.getValue() + 1);
+
+			if (i != toPage)
+				document.newPage();
+		}
+
+		document.close();
+	}
+}

+ 80 - 0
gl/gl/src/public/nc/log/NcLog.java

@@ -0,0 +1,80 @@
+package nc.log;
+
+import nc.bs.framework.common.RuntimeEnv;
+import org.apache.log4j.Logger;
+
+import java.io.IOException;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+/**
+ * nclog
+ * @author YY
+ * @datetime 2021-9-29 
+ */
+public class NcLog
+{
+  private static final Logger logger = Logger.getLogger(NcLog.class);
+  private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+  private static SimpleDateFormat format$ = new SimpleDateFormat("yyyy-MM-dd");
+
+  public static void info(String str)
+  {
+    String logFilePath = getLogFile();
+    File file = new File(logFilePath);
+    BufferedWriter fos = null;
+    try
+    {
+      fos = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
+      str = format.format(new Date()) + " " + str + "\r\n";
+      
+      fos.write(str + "\r\n");
+      fos.flush();
+    }
+    catch (Exception localException)
+    {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException)
+        {
+        }
+    }
+    finally {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException2)
+        {
+        }
+    }
+  }
+
+  private static String getLogFile() {
+    String destFileFolder = RuntimeEnv.getInstance().getNCHome() + File.separator + "mancLog" + File.separator + format$.format(new Date());
+    String destFilePath = destFileFolder + File.separator + "org.log";
+    File destFolder = new File(destFileFolder);
+    if (!destFolder.exists()) {
+      destFolder.mkdirs();
+    }
+    File destFile = new File(destFilePath);
+    if (!destFile.exists()) {
+      try
+      {
+        destFile.createNewFile();
+      }
+      catch (Exception e)
+      {
+        logger.info(e);
+      }
+    }
+    return destFilePath;
+  }
+}

+ 121 - 0
gl/gl/src/public/org/jeecg/common/util/HttpHelper.java

@@ -0,0 +1,121 @@
+package org.jeecg.common.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+//import net.sf.json.JSONObject;
+import com.alibaba.fastjson.JSONObject;
+
+
+/**
+ * @author fenghaifu
+ * @version V1.0
+ * @Copyright: 上海萃颠信息科技有限公司. All rights reserved.
+ * @Title:HttpHelper
+ * @projectName data-exchange-platform
+ * @Description:通用http请求
+ * @date: 2020/1/11 15:16
+ * @updatehistory: 2020/1/11 15:16 新增
+ */
+public class HttpHelper {	
+	
+	 /**
+     * Http post请求
+     * @param httpUrl 连接
+     * @param param 参数
+     * @return
+     */
+    public static String doPost(String httpUrl,  String param) {
+        StringBuffer result = new StringBuffer();
+        //连接
+        HttpURLConnection connection = null;
+        OutputStream os = null;
+        InputStream is = null;
+        BufferedReader br = null;
+        try {
+            //创建连接对象
+            URL url = new URL(httpUrl);
+            //创建连接
+            connection = (HttpURLConnection) url.openConnection();
+            //设置请求方法
+            connection.setRequestMethod("POST");
+            //设置连接超时时间
+            connection.setConnectTimeout(30000);
+            //设置读取超时时间
+            connection.setReadTimeout(30000);
+            //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个
+            //设置是否可读取
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            //设置通用的请求属性
+            connection.setRequestProperty("Accept", "*/*");
+            connection.setRequestProperty("Connection", "Keep-Alive");
+            connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
+            connection.setRequestProperty("Content-Type", "application/json");
+//            connection.setRequestProperty("Cookie","ecology_JSessionid=aaaGsiv-h05w_c7bno5My; JSESSIONID=aaaGsiv-h05w_c7bno5My; loginidweaver=1; languageidweaver=7; loginuuids=1; __randcode__=0e2d7cfd-e28c-4728-8f4b-f971ea410488");
+
+            //拼装参数
+            if (null != param && !param.equals("")) {
+                //设置参数
+                os = connection.getOutputStream();
+                //拼装参数
+                os.write(param.getBytes("UTF-8"));
+            }
+            //设置权限
+            //设置请求头等
+            //开启连接
+            //connection.connect();
+            //读取响应
+            if (connection.getResponseCode() == 200) {
+                is = connection.getInputStream();
+                if (null != is) {
+                    br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+                    String temp = null;
+                    while (null != (temp = br.readLine())) {
+                        result.append(temp);
+                        result.append("\r\n");
+                    }
+                }
+            }
+
+        } catch (MalformedURLException e) {
+        	ExceptionUtils.wrappBusinessException(e.getMessage());
+        } catch (IOException e) {
+        	ExceptionUtils.wrappBusinessException(e.getMessage());
+        } finally {
+            //关闭连接
+            if(br!=null){
+                try {
+                    br.close();
+                } catch (IOException e) {
+                	ExceptionUtils.wrappBusinessException(e.getMessage());
+                }
+            }
+            if(os!=null){
+                try {
+                    os.close();
+                } catch (IOException e) {
+                	ExceptionUtils.wrappBusinessException(e.getMessage());
+                }
+            }
+            if(is!=null){
+                try {
+                    is.close();
+                } catch (IOException e) {
+                	ExceptionUtils.wrappBusinessException(e.getMessage());
+                }
+            }
+            //关闭连接
+            connection.disconnect();
+        }
+        return result.toString();
+    }
+}