|
@@ -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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|