diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp index 08a486b03..d1acc4a33 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp @@ -102,15 +102,22 @@ if(sparam.length>0){sparam+=",";} sparam+=key+"="+param[key]; } - var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam); - if(result == "success"){ - var attributeID = AsControl.RunJsp("/Tenwa/Lease/Flow/Rent/BatchIncome/GetLBDocAttributeID.jsp", - "FLOW_UNID="+tempParam["FLOW_UNID"]+"&OBJECTTYPE="+tempParam["OBJECTTYPE"]); - downloadFile(attributeID); - }else{ - alert("导出失败!"); - } - + //打开遮罩 + openDWDialog("正在下载中..........."); + $("#DWOverLayoutSubDiv").find('#sp_datawindow_overdiv_top').css('display','none'); + setTimeout(function(){ + var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam); + //隐藏遮罩 + $("#DWOverLayoutDiv").hide(); + $("#DWOverLayoutSubDiv").hide(); + if(result == "success"){ + var attributeID = AsControl.RunJsp("/Tenwa/Lease/Flow/Rent/BatchIncome/GetLBDocAttributeID.jsp", + "FLOW_UNID="+tempParam["FLOW_UNID"]+"&OBJECTTYPE="+tempParam["OBJECTTYPE"]); + downloadFile(attributeID); + }else{ + alert("导出失败!"); + } + },200) } diff --git a/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelCallBackServiceImpl.java b/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelCallBackServiceImpl.java index 7a3c72d56..d1efca63c 100644 --- a/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelCallBackServiceImpl.java +++ b/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelCallBackServiceImpl.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import com.amarsoft.app.accounting.trans.script.invoice.output.CalcTaxAmountExecutor; import jbo.sys.CODE_LIBRARY; import org.apache.poi.ss.usermodel.Workbook; @@ -110,15 +111,7 @@ public class BaseExcelCallBackServiceImpl extends CreateOfficeCallBackService{ throw new BusinessException("加载excel时出错"+e.getMessage()); } try { - ReadExcel ReadExcel=null; - try { - ReadExcel = new ReadExcel(tempfile); - } catch (Exception e) { - // TODO Auto-generated catch block - throw new BusinessException("加载ReadExcel时出"); - } - - + ReadExcel ReadExcel= new ReadExcel(wb); Map operMap=new HashMap(); operMap.put("default", excelSer); @@ -127,9 +120,6 @@ public class BaseExcelCallBackServiceImpl extends CreateOfficeCallBackService{ for(BizObject config:exportConfig){ configData=lableSer.getLableDataByConfig(config, model); Class oper=null; - Method replaceString=null; - Method replaceList=null; - Method replaceTable=null; String operator_class=config.getAttribute("operatorclass").getString(); if(operator_class.length()==0||operator_class.equals("excel_default_class")){ oper=operMap.get("default").getClass(); @@ -141,37 +131,24 @@ public class BaseExcelCallBackServiceImpl extends CreateOfficeCallBackService{ oper=Class.forName(code.getAttribute("itemattribute").getString()); operMap.put(operator_class, oper); } - replaceString=oper.getMethod("replaceStringLable",Workbook.class,ReadExcel.class,BizObject.class,Map.class); - replaceList=oper.getMethod("replaceListLable",Workbook.class,ReadExcel.class,BizObject.class,Map.class); - replaceTable=oper.getMethod("replaceTableLable",Workbook.class,ReadExcel.class,BizObject.class,Map.class); - if(config.getAttribute("tagtype").getString().equals("tag_type1")){//字符串 - try { - replaceString.invoke(oper.newInstance(),wb,ReadExcel,config,configData); - } catch (Exception e) { - e.printStackTrace(); - InvocationTargetException targetEx = (InvocationTargetException) e; - Throwable t = targetEx.getTargetException(); - throw new BusinessException(t.getMessage()); - } - }else if(config.getAttribute("tagtype").getString().equals("tag_type2")){//数组 - try { - replaceList.invoke(oper.newInstance(),wb,ReadExcel,config,configData); - } catch (Exception e) { - e.printStackTrace(); - InvocationTargetException targetEx = (InvocationTargetException) e; - Throwable t = targetEx.getTargetException(); - throw new BusinessException(t.getMessage()); - } - }else if(config.getAttribute("tagtype").getString().equals("tag_type3")){//表格 - try { - replaceTable.invoke(oper.newInstance(),wb,ReadExcel,config,configData); - } catch (Exception e) { - e.printStackTrace(); - InvocationTargetException targetEx = (InvocationTargetException) e; - Throwable t = targetEx.getTargetException(); - throw new BusinessException(t.getMessage()); - } - } + try { + if(config.getAttribute("tagtype").getString().equals("tag_type1")){//字符串 + Method replaceString=oper.getMethod("replaceStringLable",Workbook.class,ReadExcel.class,BizObject.class,Map.class); + replaceString.invoke(oper.newInstance(),wb,ReadExcel,config,configData); + + }else if(config.getAttribute("tagtype").getString().equals("tag_type2")){//数组 + Method replaceList =oper.getMethod("replaceListLable",Workbook.class,ReadExcel.class,BizObject.class,Map.class); + replaceList.invoke(oper.newInstance(),wb,ReadExcel,config,configData); + + }else if(config.getAttribute("tagtype").getString().equals("tag_type3")){//表格 + Method replaceTable=oper.getMethod("replaceTableLable",Workbook.class,ReadExcel.class,BizObject.class,Map.class); + replaceTable.invoke(oper.newInstance(),wb,ReadExcel,config,configData); + } + } catch (Exception e){ + InvocationTargetException targetEx = (InvocationTargetException) e; + Throwable t = targetEx.getTargetException(); + throw new BusinessException(t.getMessage()); + } } OutputStream osServer = new FileOutputStream(targetFile); wb.write(osServer); diff --git a/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelLableReplaceServiceImp.java b/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelLableReplaceServiceImp.java index 6a4d953f1..4be264cb3 100644 --- a/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelLableReplaceServiceImp.java +++ b/src_core/com/tenwa/officetempalte/serviceImp/BaseExcelLableReplaceServiceImp.java @@ -1,6 +1,7 @@ package com.tenwa.officetempalte.serviceImp; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Map; @@ -88,6 +89,18 @@ public class BaseExcelLableReplaceServiceImp implements BaseExcelLableReplaceSer int row_index = ReadExcel.getCellRowNum(tagName); List lableData = new ArrayList(); lableData = FileOperatorUtil.getJsonToList((JSONObject) model.get(tagName), valueField, isshowindex); + + List bos = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME).createQuery("codeno='SetNumberType' and bankno=:bankno") + .setParameter("bankno", tagName).getResultList(false); + + HashSet sets = new HashSet<>(); + for (int i = 0; i < bos.size() ; i++) { + BizObject bizObject = bos.get(i); + if(bizObject.getAttribute("itemdescribe").isNull()){ + continue; + } + sets.add(bizObject.getAttribute("itemdescribe").getInt()); + } if (col_index >= 0 && row_index >= 0) { List columnIndex = new ArrayList(); columnIndex = PoiExcelUtil.getMergedRegionIndex(templateSheet,row_index - 1); @@ -102,16 +115,13 @@ public class BaseExcelLableReplaceServiceImp implements BaseExcelLableReplaceSer for (int j = 0; j < tempvalue.size(); j++) { cell = PoiExcelUtil.getCell(templateRow,Integer.valueOf(columnIndex.get(col_index + j).toString())); //查询标签中是否有需要转为数字类型的列 - BizObject cl = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME).createQuery( - "codeno='SetNumberType' and bankno=:bankno and itemdescribe=:itemdescribe ").setParameter("bankno", tagName).setParameter("itemdescribe", j).getSingleResult(false); - if (cl != null) { + if(sets.size()>0 && sets.contains(j)){ String amount = tempvalue.get(j).toString().replace(",", ""); Double b = Double.parseDouble(amount); cell.setCellValue(b); } else { cell.setCellValue(tempvalue.get(j).toString()); } - } } } diff --git a/src_core/com/tenwa/officetempalte/util/ReadExcel.java b/src_core/com/tenwa/officetempalte/util/ReadExcel.java index 49d7744ff..53c3cee16 100644 --- a/src_core/com/tenwa/officetempalte/util/ReadExcel.java +++ b/src_core/com/tenwa/officetempalte/util/ReadExcel.java @@ -42,8 +42,16 @@ public class ReadExcel { this.bookNames=bookName; this.bookSheet=bookSheets; } - - public void bookNamesMove(int startRow, int endRow, int num,String sheetName) { + + public ReadExcel(Workbook book) { + this.book = book; + for (int i = 0; i < book.getNumberOfNames(); i++) { + bookNames.put(book.getNameAt(i).getNameName(), book.getNameAt(i).getRefersToFormula()); + bookSheet.put(book.getNameAt(i).getNameName(),book.getNameAt(i).getSheetName()); + } + } + + public void bookNamesMove(int startRow, int endRow, int num, String sheetName) { //System.out.println(bookNames); if (bookNames.size() > 0) { for (String title_name : bookNames.keySet()) {