yaoyu před 3 roky
rodič
revize
4acde02512

+ 6 - 0
zjcmp_cd/.idea/misc.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/classes" />
+  </component>
+</project>

+ 6 - 0
zjcmp_cd/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
+  </component>
+</project>

+ 7 - 7
zjcmp_cd/.idea/workspace.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ChangeListManager">
-    <list default="true" id="d4b583bb-75e1-48fb-b0e0-64af9d216c2a" name="变更" comment="" />
+    <list default="true" id="d75f3882-bf57-40e5-a8f5-2c0107767372" name="变更" comment="" />
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -10,7 +10,7 @@
   <component name="Git.Settings">
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
   </component>
-  <component name="ProjectId" id="272iVynbKiT61ZWVNVt5Vuk59BR" />
+  <component name="ProjectId" id="276DSiQvVcwhmjGUCJ46QGNDpee" />
   <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
   <component name="ProjectViewState">
     <option name="hideEmptyMiddlePackages" value="true" />
@@ -20,17 +20,17 @@
     <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
     <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/.." />
   </component>
   <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
   <component name="TaskManager">
     <task active="true" id="Default" summary="默认任务">
-      <changelist id="d4b583bb-75e1-48fb-b0e0-64af9d216c2a" name="变更" comment="" />
-      <created>1648524609044</created>
+      <changelist id="d75f3882-bf57-40e5-a8f5-2c0107767372" name="变更" comment="" />
+      <created>1648631647842</created>
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
-      <updated>1648524609044</updated>
-      <workItem from="1648524610821" duration="224000" />
+      <updated>1648631647842</updated>
+      <workItem from="1648631652332" duration="289000" />
+      <workItem from="1648635371661" duration="633000" />
     </task>
     <servers />
   </component>

+ 3455 - 0
zjcmp_cd/cmp/src/private/nc/bs/gl/contrastpub/QueryDMO.java

@@ -0,0 +1,3455 @@
+package nc.bs.gl.contrastpub;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import nc.bs.dao.BaseDAO;
+import nc.bs.dao.DAOException;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.framework.core.util.ObjectCreator;
+import nc.bs.gl.contrast.ContrastaccountDMO;
+import nc.bs.gl.contrast.ContrastclassDMO;
+import nc.bs.logging.Logger;
+import nc.bs.pub.DataManageObject;
+import nc.bs.sec.esapi.NCESAPI;
+import nc.cmp.tools.ContrastQueryModuleUtil;
+import nc.cmp.tools.ContrastTools;
+import nc.cmp.tools.StringUtil;
+import nc.impl.gl.contrast.ImpCMPDataAccess;
+import nc.itf.cm.prv.CmpConst;
+import nc.itf.fi.pub.Currency;
+import nc.pubitf.accperiod.AccountCalendar;
+import nc.pubitf.fbm.register.IRegisterPubQueryService;
+import nc.pubitf.uapbd.IBalaTypePubService;
+import nc.vo.bd.balatype.BalaTypeVO;
+import nc.vo.bd.pub.sqlutil.BDSqlInUtil;
+import nc.vo.cmp.bankaccbook.BankAccDetailVO;
+import nc.vo.cmp.bankaccbook.constant.UseFlagEnum;
+import nc.vo.cmp.cb.AccountlinkVO;
+import nc.vo.cmp.cb.BankKeyTool;
+import nc.vo.cmp.cb.BankReceiptVO;
+import nc.vo.cmp.cb.CBalanceKeyTool;
+import nc.vo.cmp.cb.CBalanceVO;
+import nc.vo.cmp.cb.CConditionVO;
+import nc.vo.cmp.cb.CCorpReceiptKey;
+import nc.vo.cmp.cb.CCorpReceiptVO;
+import nc.vo.cmp.cb.CQueryVO;
+import nc.vo.cmp.cb.CTransferVO;
+import nc.vo.cmp.cb.ContrastAccountVO;
+import nc.vo.cmp.cb.ContrastClassVO;
+import nc.vo.cmp.cb.ContrastVO;
+import nc.vo.cmp.cb.CorpReceiptVO;
+import nc.vo.cmp.cb.DefaultKeyTool;
+import nc.vo.cmp.cb.IKey;
+import nc.vo.cmp.cb.UnitKeyTool;
+import nc.vo.fbm.register.RegisterVO;
+import nc.vo.gateway60.accountbook.AccountBookUtil;
+import nc.vo.logging.Debug;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pub.lang.UFLiteralDate;
+import nc.vo.pubapp.AppContext;
+import nc.vo.tmpub.util.VOUtil;
+
+
+public class QueryDMO extends DataManageObject {
+	HashMap<Object, String> hashCheckName = new HashMap<Object, String>();
+	//private IBankAccQueryService queryService;
+	private BaseDAO baseDAO = null;
+	private IRegisterPubQueryService fbmQueryService;
+	private IBalaTypePubService balaQry;
+
+	public BaseDAO getBaseDAO() {
+		if (baseDAO == null)
+			baseDAO = new BaseDAO();
+		return baseDAO;
+	}
+
+	/**
+	 * QueryDMO 构造子注解。
+	 *
+	 * @exception javax.naming.NamingException
+	 *                异常说明。
+	 * @exception nc.bs.pub.SystemException
+	 *                异常说明。
+	 */
+	public QueryDMO() throws javax.naming.NamingException,
+			nc.bs.pub.SystemException {
+		super();
+	}
+
+	/**
+	 * QueryDMO 构造子注解。
+	 *
+	 * @param dbName
+	 *            java.lang.String
+	 * @exception javax.naming.NamingException
+	 *                异常说明。
+	 * @exception nc.bs.pub.SystemException
+	 *                异常说明。
+	 */
+	public QueryDMO(String dbName) throws javax.naming.NamingException,
+			nc.bs.pub.SystemException {
+		super(dbName);
+	}
+
+	/**
+	 * 得到帐户 创建日期:(2002-3-21 20:09:48)
+	 */
+	private ContrastAccountVO getAccount(String strPk_Account) throws Exception {
+		ContrastaccountDMO dmo = new ContrastaccountDMO();
+		ContrastAccountVO vo = dmo.findByPrimaryKey(strPk_Account);
+		return vo;
+	}
+
+	/**********************************************************************************************************
+	 * 功能:得到银行到截止日期时(前)的余额 参数:CQueryVO query 查询条件 返回:CBalanceVO[] modifier by
+	 * zhaozh on 2009-2-20 下午02:39:36 加入精度,以免不平
+	 **********************************************************************************************************/
+	public CTransferVO[] getBankBalance(CQueryVO query) throws SQLException {
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getBankMoney",
+				new Object[] { query });
+		/*************************************************************/
+		// getBankBalanceSpread(query);
+		int digit = 2;
+		String[] pk_account = query.getPk_Account();
+		try {
+			digit = Currency.getCurrDigit(getAccount(pk_account[0])
+					.getPk_currtype());
+		} catch (Exception e) {
+			Logger.error(e.getMessage() + "获取币种精度异常", e);
+			throw new SQLException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0","03607con-0504")/*@res "获取币种精度异常"*/
+					+ e.getMessage());
+		}
+		String strTemp = "";
+		for (int i = 0; i < pk_account.length; i++) {
+			strTemp = strTemp + "'" + pk_account[i] + "',";
+		}
+		if (strTemp.length() > 0) {
+			strTemp = strTemp.substring(0, strTemp.length() - 1);
+		}
+		StringBuffer strSql = new StringBuffer(
+				" select accountstart.pk_contrastaccount,"
+						+ "round(debitamount,"
+						+ digit
+						+ ") as debitamount,"
+						+ "round(creditamount,"
+						+ digit
+						+ ") as creditamount,contrastaspect from gl_accountstart accountstart,gl_contrastaccount account ");
+		strSql
+				.append(" where accountstart.pk_contrastaccount = account.pk_contrastaccount ");
+		// modified by zhufeng 2013-2-19 查询余额时,不需要设置组织,只需要账户即可,组织前台可能传过来的是账簿,查询结果为空 start 
+//		if (query.getPk_Corp() != null && query.getPk_Corp().length() > 0)
+//			strSql
+//					.append(" and account.pk_org = '" + query.getPk_Corp()
+//							+ "' ");
+		// modified by zhufeng 2013-2-19 end
+		if (pk_account != null && pk_account.length > 0)
+			strSql.append(" and accountstart.pk_contrastaccount in (" + strTemp
+					+ ")");
+		if (query.getYear() != null)
+			strSql.append(" and years = '" + query.getYear() + "' ");
+
+		if (query.isInitRange() == null || !query.isInitRange().booleanValue()) {
+			strSql.append(" union all ");
+			strSql
+					.append(" select receipt.pk_contrastaccount,"
+							+ "round(debitamount,"
+							+ digit
+							+ ") as debitamount,"
+							+ "round(creditamount,"
+							+ digit
+							+ ") as creditamount,contrastaspect from gl_bankreceipt receipt,gl_contrastaccount account ");
+			strSql
+					.append(" where receipt.pk_contrastaccount = account.pk_contrastaccount ");
+			if (query.getPk_Corp() != null && query.getPk_Corp().length() > 0)
+				strSql.append(" and account.pk_org = '" + query.getPk_Corp()
+						+ "' ");
+			AccountCalendar calendar = ContrastTools.getBusiDateAccCalendar(query.getPk_Corp());
+			UFDate lastDate = calendar.getYearVO().getEnddate();
+			UFDate fristDate = calendar.getYearVO().getBegindate();
+			if(query.getBankEndDate()!=null&&!query.getBankEndDate().after(lastDate))
+			{
+				if (query.isIncludeLast().booleanValue())
+					strSql.append(" and checkdate <= '" + query.getBankEndDate() + "' ");
+				else
+					strSql.append(" and checkdate < '" + query.getBankEndDate() + "' ");
+			}
+			else
+			{
+				if (query.isIncludeLast().booleanValue())
+					strSql.append(" and checkdate <= '" + lastDate + "' ");
+				else
+					strSql.append(" and checkdate < '" + lastDate + "' ");
+			}
+			/** 将异常的银行对账单排除掉 modified by zhaozh on2008-12-27 **/
+			strSql.append(" and (styleflag='A' or isnull(styleflag,'~')='~')");
+			strSql.append(" and years = '" + query.getYear()
+					+ "' and (period <> '00' or isnull(period,'~')='~'  ");
+			strSql.append(" or (period = '00' and checkdate >= ( select startdate from gl_accountstart where gl_accountstart.PK_CONTRASTACCOUNT = receipt.PK_CONTRASTACCOUNT and gl_accountstart.years = receipt.years)))");
+			if (query.getPk_Corp() != null && query.getPk_Corp().length() > 0)
+				strSql.append(" and account.pk_org = '" + query.getPk_Corp()
+						+ "' ");
+			if (pk_account != null && pk_account.length > 0)
+				strSql.append(" and receipt.pk_contrastaccount in(" + strTemp
+						+ ")");
+		}
+		String sql = " select pk_contrastaccount,contrastaspect,sum(debitamount),sum(creditamount) from ("
+				+ strSql + ") temp_table ";
+		sql = sql + " group by pk_contrastaccount,contrastaspect ";
+
+		// 读取查询结果
+		java.sql.Connection con = null;
+		java.sql.Statement stmt = null;
+		java.sql.ResultSet rs = null;
+		java.util.Vector<CBalanceVO> vecResult = new java.util.Vector<CBalanceVO>();
+		try {
+			con = getConnection();
+			stmt = con.createStatement();
+			rs = stmt.executeQuery(sql);
+			CBalanceVO returnValue;
+			BigDecimal debitamount;
+			BigDecimal creditamount;
+			while (rs.next()) {
+				returnValue = new CBalanceVO();
+				returnValue.setPk_account(rs.getString(1));
+				int t = rs.getInt(2);
+				debitamount = rs.getBigDecimal(3);
+				creditamount = rs.getBigDecimal(4);
+				if (t == 0) {
+					returnValue.setDebitamount(new UFDouble(debitamount.subtract(creditamount)/* ,digitMap.get(rs.getString(1)) */));
+					returnValue.setCreditamount(UFDouble.ZERO_DBL);
+				} else {
+					returnValue.setDebitamount(UFDouble.ZERO_DBL);
+					returnValue.setCreditamount(new UFDouble(creditamount.subtract(debitamount)/* ,digitMap.get(rs.getString(1)) */));
+				}
+
+				vecResult.addElement(returnValue);
+			}
+		} finally {
+			try {
+				if (rs != null)
+					rs.close();
+			} catch (Exception e) {
+			}
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+		CTransferVO[] balances = new CTransferVO[vecResult.size()];
+		CBalanceKeyTool keyTool = new CBalanceKeyTool();
+		CBalanceVO balance;
+		for (int j = 0; j < vecResult.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			balance = vecResult.elementAt(j);
+			votemp.setVo(balance);
+			votemp.setKeyTool(keyTool); // 要查数据库
+			votemp.setInit(new Boolean(true));
+			votemp.setPk_account(balance.getPk_account());
+			balances[j] = votemp;
+		}
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrast.ContrastDMO", "getBankMoney",
+				new Object[] { pk_account });
+		/*************************************************************/
+		return balances;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 得到银行到截止日期时(前)的余额 多单位展开 参数: CQueryVO query 查询条件 返回: CBalanceVO[]
+	 **********************************************************************************************************/
+	public CTransferVO[] getBankBalanceSpread(CQueryVO query)
+			throws SQLException {
+
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getBankMoney",
+				new Object[] { query });
+		/*************************************************************/
+		int digit = 2;
+		String[] pk_account = query.getPk_Account();
+		try {
+			digit = Currency.getCurrDigit(getAccount(pk_account[0])
+					.getPk_currtype());
+		} catch (Exception e) {
+			Logger.error(e.getMessage() + "获取币种精度异常", e);
+			throw new SQLException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0","03607con-0504")/*@res "获取币种精度异常"*/
+					+ e.getMessage());
+		}
+		String strTemp = "";
+		for (int i = 0; i < pk_account.length; i++) {
+			strTemp = strTemp + "'" + pk_account[i] + "',";
+		}
+		if (strTemp.length() > 0) {
+			strTemp = strTemp.substring(0, strTemp.length() - 1);
+		}
+
+		StringBuffer strSql = new StringBuffer("");
+		strSql
+				.append(" (select pk_accountlink,accountstart.pk_contrastaccount,contrastaspect,case when isnull(link.debitamount,0)=0  then 0 else link.debitamount end as debitamount,");
+		strSql
+				.append(" case when isnull(link.creditamount,0)=0 then 0 else link.creditamount end as creditamount");
+		strSql
+				.append(" ,link.pk_org,link.pk_subject,link.bankaccount pk_bank,link.pk_ass");
+		strSql
+				.append(" from gl_accountstart accountstart,gl_contrastaccount account,gl_accountlink link");
+		strSql
+				.append(" where accountstart.pk_contrastaccount = account.pk_contrastaccount ");
+		strSql
+				.append(" and link.pk_contrastaccount = account.pk_contrastaccount ");
+		if (query.getPk_Corp() != null && query.getPk_Corp().length() > 0)
+			strSql
+					.append(" and account.pk_org = '" + query.getPk_Corp()
+							+ "' ");
+		if (pk_account != null && pk_account.length > 0)
+			strSql.append(" and accountstart.pk_contrastaccount in (" + strTemp
+					+ ")");
+		if (query.getYear() != null) {
+			strSql.append(" and accountstart.years = '" + query.getYear()
+					+ "' ");
+			strSql.append(" and (link.years = '" + query.getYear()
+					+ "' or isnull(link.years,'~')='~') ");
+		}
+		strSql.append(") links");
+		if (query.isInitRange() == null || !query.isInitRange().booleanValue()) {
+
+			strSql.append(" left outer join  ");
+			strSql
+					.append(" (select bank.pk_contrastaccount,"
+							+ "sum(round(case when isnull(debitamount,0)=0 then 0 else debitamount end,"
+							+ digit + ")) debitamount,");
+			strSql
+					.append(" sum(round(case when isnull(creditamount,0)=0 then 0 else creditamount end,"
+							+ digit + ")) creditamount");
+			strSql.append(" ,bank.memo");
+			strSql
+					.append(" FROM gl_bankreceipt bank, gl_contrastaccount account ");
+			strSql
+					.append(" where bank.pk_contrastaccount = account.pk_contrastaccount ");
+			if (query.getPk_Corp() != null && query.getPk_Corp().length() > 0)
+				strSql.append(" and account.pk_org = '" + query.getPk_Corp()
+						+ "' ");
+			if (query.isIncludeLast().booleanValue())
+				strSql.append(" and checkdate <= '" + query.getBankEndDate() + "' ");
+			else
+				strSql.append(" and checkdate < '" + query.getBankEndDate() + "' ");
+			/** 将异常的银行对账单排除掉 modified by zhaozh on2008-12-27 **/
+			strSql.append(" and (styleflag='A' or isnull(styleflag,'~')='~')");
+			strSql.append(" and years = '" + query.getYear()
+					+ "' and (period <> '00' or isnull(period,'~')='~' ) ");
+			if (query.getPk_Corp() != null && query.getPk_Corp().length() > 0) {
+				strSql.append(" and account.pk_org = '" + query.getPk_Corp()
+						+ "' ");
+			}
+			if (pk_account != null && pk_account.length > 0) {
+				strSql.append(" and bank.pk_contrastaccount in(" + strTemp
+						+ ")");
+			}
+			strSql.append(" GROUP BY bank.pk_contrastaccount,bank.memo) banks");
+			strSql.append(" on links.pk_accountlink = banks.memo");
+		}
+		String sql = " select links.pk_contrastaccount,contrastaspect,";
+		sql += " links.debitamount ";
+		if (query.isInitRange() == null || !query.isInitRange().booleanValue()) {
+			sql += " +case when isnull(banks.debitamount,0)=0 then 0 else banks.debitamount end,";
+		} else {
+			sql += ",";
+		}
+		sql += " links.creditamount ";
+		if (query.isInitRange() == null || !query.isInitRange().booleanValue()) {
+			sql += " +case when isnull(banks.creditamount,0)=0 then 0 else banks.creditamount end,";
+		} else {
+			sql += ",";
+		}
+		sql += " links.pk_accountlink,links.pk_org,links.pk_subject,links.pk_bank,links.pk_ass ";
+		sql += " from " + strSql + " ";
+
+		// 读取查询结果
+		java.sql.Connection con = null;
+		java.sql.Statement stmt = null;
+		java.sql.ResultSet rs = null;
+		java.util.Vector<CBalanceVO> vecResult = new java.util.Vector<CBalanceVO>();
+		try {
+			con = getConnection();
+			stmt = con.createStatement();
+			rs = stmt.executeQuery(sql);
+			CBalanceVO returnValue;
+			double debitamount;
+			double creditamount;
+			while (rs.next()) {
+				returnValue = new CBalanceVO();
+				returnValue.setPk_account(rs.getString(1));
+				int t = rs.getInt(2);
+				debitamount = rs.getDouble(3);
+				creditamount = rs.getDouble(4);
+				if (t == 0) {
+					returnValue.setDebitamount(new UFDouble(debitamount
+							- creditamount));
+					returnValue.setCreditamount(new UFDouble(0));
+				} else {
+					returnValue.setDebitamount(new UFDouble(0));
+					returnValue.setCreditamount(new UFDouble(creditamount
+							- debitamount));
+				}
+				returnValue.setM_pk_link(rs.getString(5));
+				returnValue.setM_pk_corp(rs.getString(6));
+				returnValue.setM_pk_subject(rs.getString(7));
+				returnValue.setM_pk_bank(rs.getString(8));
+				returnValue.setM_pk_ass(rs.getString(9));
+				vecResult.addElement(returnValue);
+			}
+		} finally {
+			try {
+				if (rs != null)
+					rs.close();
+			} catch (Exception e) {
+			}
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+		CTransferVO[] balances = new CTransferVO[vecResult.size()];
+		CBalanceKeyTool keyTool = new CBalanceKeyTool();
+		CBalanceVO balance;
+		for (int j = 0; j < vecResult.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			balance = vecResult.elementAt(j);
+			votemp.setVo(balance);
+			votemp.setKeyTool(keyTool); // 要查数据库
+			votemp.setInit(new Boolean(true));
+			votemp.setPk_account(balance.getPk_account());
+			votemp.setM_pk_link(balance.getM_pk_link());
+			votemp.setM_pk_corp(balance.getM_pk_corp());
+			votemp.setM_pk_subject(balance.getM_pk_subject());
+			votemp.setM_pk_bank(balance.getM_pk_bank());
+			votemp.setM_pk_ass(balance.getM_pk_ass());
+			balances[j] = votemp;
+		}
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrast.ContrastDMO", "getBankMoney",
+				new Object[] { pk_account });
+		/*************************************************************/
+		return balances;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 查询银行对账单 参数: CQueryVO query 查询条件 返回: BankReceiptVO[] 修改:@author zhaozh
+	 * 2008-6-12 上午10:15:47 增加批次号batchnumber查询 增加停用日期过滤
+	 **********************************************************************************************************/
+	public CTransferVO[] getBankReceipt(CQueryVO query) throws Exception {
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getBankReceipt",
+				new Object[] { query });
+		/*************************************************************/
+		int digit = 2;
+		String[] pk_account = query.getPk_Account();
+		try {
+			digit = Currency.getCurrDigit(getAccount(pk_account[0])
+					.getPk_currtype());
+		} catch (Exception e) {
+			Logger.error(e.getMessage() + "获取币种精度异常", e);
+			throw new SQLException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0","03607con-0504")/*@res "获取币种精度异常"*/
+					+ e.getMessage());
+		}
+		// 0为正常 1为勾对 2为核销
+		StringBuffer strSql = new StringBuffer("");
+		strSql.append("select gl_bankreceipt.pk_bankreceipt, gl_bankreceipt.pk_contrastaccount, explanation, checkstyle, pk_check, checkdate, "
+						+ "round(gl_bankreceipt.debitamount,"
+						+ digit
+						+ "),round(gl_bankreceipt.creditamount,"
+						+ digit
+						+ "),gl_bankreceipt.years, gl_bankreceipt.period ,");
+		strSql.append(" case when isnull(gl_contrast.cavdate,'~')='~' and isnull(gl_contrast.contrastdate,'~')='~' then 0 else  case when isnull(gl_contrast.cavdate,'~')='~' then 1 else 2 end end");
+		strSql.append(" ,gl_bankreceipt.memo,gl_bankreceipt.pk_org,gl_bankreceipt.pk_subject,gl_bankreceipt.pk_bank,gl_bankreceipt.pk_ass,gl_contrast.batchnumber,gl_bankreceipt.netbanknumber,gl_bankreceipt.styleflag,gl_bankreceipt.pk_org,gl_bankreceipt.pk_group,gl_bankreceipt.oppunitname,gl_bankreceipt.nusage,gl_bankreceipt.transerial");
+		strSql.append(" from gl_bankreceipt left outer join gl_contrast gl_contrast on gl_bankreceipt.pk_bankreceipt = gl_contrast.pk_bankreceipt ");
+		String strTemp = "";
+		for (int i = 0; i < pk_account.length; i++) {
+			strTemp = strTemp + "'" + pk_account[i] + "',";
+		}
+		if (strTemp.length() > 0) {
+			strTemp = strTemp.substring(0, strTemp.length() - 1);
+		}
+		if (pk_account != null && pk_account.length > 0) {
+			// strSql.append(" and gl_contrast.pk_contrastaccount in (" +
+			// strTemp + ")");
+		}
+		// if (query.getDate() != null){
+		// //strWhere.append(" and gl_bankreceipt.checkdate >= '" +
+		// query.getDate().toString() + "'");
+		// strSql.append(" and gl_contrast.corpdate >= '" +
+		// query.getDate().toString() + "'");
+		// }
+		// if (query.getEndDate() != null){
+		// //strWhere.append(" and gl_bankreceipt.checkdate <= '" +
+		// query.getEndDate().toString() + "'");
+		// strSql.append(" and gl_contrast.corpdate <= '" +
+		// query.getEndDate().toString() + "'");
+		// }
+
+		// ///////////
+		StringBuffer strWhere = new StringBuffer("");
+		if (query.isM_cavDetai()) {
+			// 核销明细
+			strWhere.append(" and  gl_contrast.cavdate = '" + query.getM_cavDate() + "' ");
+			if (query.getM_cavMan() == null) {
+				strWhere.append(" and isnull(gl_contrast.cavman,'~')='~' ");
+			} else {
+				strWhere.append(" and  gl_contrast.cavman = '" + query.getM_cavMan() + "' ");
+			}
+		}
+		//余额调节表查询未对账数据 + 对账日期大于截止日期的数据
+		if (query.getNodecode() == 20040115 && query.isM_bflag()
+				&& null != query.getBankEndDate()) {
+			strWhere.append(" and gl_contrast.contrastdate >'").append(query.getBankEndDate().toString()).append("' ");
+		}
+		if (pk_account != null && pk_account.length > 0) {
+			strWhere.append(" and gl_bankreceipt.pk_contrastaccount in (" + strTemp + ")");
+		}
+		if (query.isChecked() != null) {
+			if (query.isChecked().booleanValue())
+				strWhere.append(" and isnull(gl_contrast.contrastdate,'~') <> '~' ");
+			else
+				strWhere.append(" and isnull(gl_contrast.contrastdate,'~')='~' ");
+		}
+		if (query.isVerified() != null) {
+			if (query.isVerified().booleanValue())
+				strWhere.append(" and isnull(gl_contrast.cavdate,'~') <> '~' ");
+			else
+				strWhere.append(" and isnull(gl_contrast.cavdate,'~')='~' ");
+		}
+		if (query.getPk_link() != null && !query.isMerge())
+			strWhere.append(" and gl_bankreceipt.memo = '" + query.getPk_link()
+					+ "' ");
+
+		if (query.getYear() != null)
+			strWhere.append(" and gl_bankreceipt.years = '" + query.getYear()
+					+ "' ");
+		if (query.isInitRange() != null) {
+			if (query.isInitRange().booleanValue())
+			{
+				strWhere.append(" and gl_bankreceipt.period = '00' ");
+				strWhere.append(" AND gl_bankreceipt.checkdate <( select startdate from gl_accountstart where gl_accountstart.PK_CONTRASTACCOUNT = gl_bankreceipt.PK_CONTRASTACCOUNT and gl_accountstart.years = gl_bankreceipt.years) ");
+			}
+			else
+			{
+				strWhere.append(" and (gl_bankreceipt.period <> '00' ");
+				strWhere.append(" AND gl_bankreceipt.checkdate <( select startdate from gl_accountstart where gl_accountstart.PK_CONTRASTACCOUNT = gl_bankreceipt.PK_CONTRASTACCOUNT and gl_accountstart.years = gl_bankreceipt.years) ");
+				
+			}
+		}
+		
+		
+		/**
+		 * 
+		 * 增加对方单位查询条件
+		 * 2022/03/31
+		 * @author YY
+		 * 
+		 */
+		if(query.getOppunitname() != null) {
+			strWhere.append(" and gl_bankreceipt.oppunitname like '%"+query.getOppunitname()+"%' ");
+		}
+		//查询勾兑情况---包括余额调节表查询勾兑,按勾兑日期查询
+		if(query.getNodecode()==20040120 && query.isChecked() != null && query.isChecked()){
+			if (query.getBankBegDate() != null) {
+				strWhere.append(" and gl_contrast.contrastdate >= '"
+						+ query.getBankBegDate() + "'");
+			}
+			if (query.getBankEndDate() != null) {
+				strWhere.append(" and gl_contrast.contrastdate <= '"
+						+ query.getBankEndDate() + "'");
+			}
+		}else{
+			if (query.getBankBegDate() != null) {
+				strWhere.append(" and gl_bankreceipt.checkdate >= '"
+						+ query.getBankBegDate() + "'");
+			}
+			if (query.getBankEndDate() != null) {
+				strWhere.append(" and gl_bankreceipt.checkdate <= '"
+						+ query.getBankEndDate() + "'");
+			}
+			if (query.getM_stopDate() != null)
+				strWhere.append(" and gl_bankreceipt.checkdate < '"
+						+ query.getM_stopDate() + "'");
+		}
+		/* zhaozh 2008-5-30 下午01:45:24 增加银行对帐单票据日期查询条件 */
+		if (query.getN_pjdate1() != null) {
+			strWhere.append(" and gl_bankreceipt.checkdate >= '"
+					+ query.getN_pjdate1() + "'");
+		}
+		if (query.getN_pjdate2() != null) {
+			strWhere.append(" and gl_bankreceipt.checkdate <= '"
+					+ query.getN_pjdate2() + "'");
+		}
+		// 结算方式(增加不等于情况)
+		if (query.getCheckStyle() != null && query.getCheckStyle().length() > 0 ){
+			if(query.getIsEqualCheckStyle()== null || query.getIsEqualCheckStyle().booleanValue()){ 
+				strWhere.append(" and gl_bankreceipt.checkstyle = '"
+						+ query.getCheckStyle() + "'");
+			}else{
+				strWhere.append(" and gl_bankreceipt.checkstyle <> '"
+						+ query.getCheckStyle() + "'");
+			}
+		}
+		// 结算号
+		if (query.getCheckNO() != null && query.getCheckNO().length() > 0)
+			strWhere.append(" and gl_bankreceipt.pk_check = '"
+					+ query.getCheckNO().replaceAll("'", "''") + "'");
+
+		// 只查异常记录
+		if (query.getOnlyWrongRec() != null
+				&& query.getOnlyWrongRec().booleanValue()) {
+			strWhere.append(" and gl_bankreceipt.styleflag='B' ");
+		} else {
+			strWhere.append(" and (gl_bankreceipt.styleflag='A' or isnull(gl_bankreceipt.styleflag,'~')='~') ");
+		}
+		// 按批次号查询 @author zhaozh 2008-6-16 下午01:45:33
+		if (query.getBatchNumber() != null
+				&& !query.getBatchNumber().equals(""))
+			strWhere.append(" and gl_contrast.batchnumber='"
+					+ NCESAPI.sqlEncode(query.getBatchNumber()) + "'");
+		strSql.append(" where  " + strWhere.substring(4));
+
+		strSql.append(" order by checkdate,gl_bankreceipt.memo,gl_bankreceipt.pk_bankreceipt");
+		Vector<BankReceiptVO> vecResult = new Vector<BankReceiptVO>();
+		Connection con = null;
+		PreparedStatement stmt = null;
+
+		java.util.HashSet<String> checkSet = new java.util.HashSet<String>();
+		java.util.HashMap checkMap = new java.util.HashMap();
+		Object[] checktemp = null;
+
+		try {
+			con = getConnection();
+			stmt = con.prepareStatement(strSql.toString());
+			Logger.debug(" 开始银行查询"
+					+ new nc.vo.pub.lang.UFDateTime(new java.util.Date()));
+			ResultSet rs = stmt.executeQuery();
+			Logger.debug(" 开始银行查询"
+					+ new nc.vo.pub.lang.UFDateTime(new java.util.Date()));
+			//
+			while (rs.next()) {
+				BankReceiptVO bankreceipt = new BankReceiptVO();
+				bankreceipt.setPk_bankreceipt(rs.getString(1));
+				bankreceipt.setPk_contrastaccount(rs.getString(2));
+				bankreceipt.setExplanation(rs.getString(3));
+
+				strTemp = rs.getString(4);
+				bankreceipt.setCheckstyle(strTemp == null ? strTemp : strTemp
+						.trim());
+
+				if (bankreceipt.getCheckstyle() != null) {
+					checkSet.add(bankreceipt.getCheckstyle());
+				}
+				strTemp = rs.getString(5);
+				bankreceipt.setPk_check(strTemp == null ? strTemp : strTemp
+						.trim());
+				// checkdate :
+				String checkdate = rs.getString(6);
+				bankreceipt.setCheckdate(checkdate == null ? null : new UFDate(
+						checkdate.trim()));
+				Object t1 = rs.getObject(7);
+				Object t2 = rs.getObject(8);
+				// 2004-05-12
+				if (t1 != null) {
+					bankreceipt.setDebitamount(new UFDouble(t1.toString()));
+				} else {
+					bankreceipt.setDebitamount(new UFDouble(0.0));
+				}
+				if (t2 != null) {
+					bankreceipt.setCreditamount(new UFDouble(t2.toString()));
+				} else {
+					bankreceipt.setCreditamount(new UFDouble(0.0));
+				}
+
+				bankreceipt.setYears(rs.getString(9));
+				bankreceipt.setPeriod(rs.getString(10));
+				// flag 勾对标记 :
+				int flags = rs.getInt(11);
+				bankreceipt.setflag(Integer.valueOf(flags));
+
+				bankreceipt.setMemo(rs.getString(12));
+				bankreceipt.setPk_corp(rs.getString(13));
+				bankreceipt.setPk_subject(rs.getString(14));
+				bankreceipt.setPk_bank(rs.getString(15));
+				bankreceipt.setPk_ass(rs.getString(16));
+				// add by zhaozh 增加批次号
+				bankreceipt.setBatchNumber(rs.getString(17));
+				bankreceipt.setNetbanknumber(rs.getString(18));
+				bankreceipt.setStyleflag(rs.getString(19));
+				bankreceipt.setPk_corp(rs.getString(20));
+				bankreceipt.setPk_group(rs.getString(21));
+				bankreceipt.setOppunitname(rs.getString(22));
+				bankreceipt.setNusage(rs.getString(23));
+				bankreceipt.setTranserial(rs.getString(24));
+				vecResult.addElement(bankreceipt);
+			}
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+		// ////////////////////////////////////////////////
+		checktemp = checkSet.toArray();
+		nc.bs.gl.bookinterface.VoucherDetailDMO dmos = new nc.bs.gl.bookinterface.VoucherDetailDMO();
+		checkMap = dmos.getCheckNamesByPKs(checktemp);
+		if (checkMap == null) {
+			checkMap = new java.util.HashMap();
+		}
+		// ///////////////////////////////////////////////
+
+		Object checkpk = null;
+		// 转化为CTransferVO
+		BankKeyTool keyTool = new BankKeyTool();
+		CTransferVO[] corpreceipts = new CTransferVO[vecResult.size()];
+		for (int j = 0; j < vecResult.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			BankReceiptVO bankreceipt = vecResult.elementAt(j);
+			checkpk = checkMap.get(bankreceipt.getCheckstyle());
+			if (checkpk != null) {
+				bankreceipt.setCheckstyle(checkpk.toString());
+			}
+			// bankreceipt.setCheckstyle(getCheckStyleName(bankreceipt.getCheckstyle()));
+			votemp.setVo(bankreceipt);
+			votemp.setKeyTool(keyTool);
+			votemp.setPk_account(bankreceipt.getPk_contrastaccount());
+			// ncm heyl 对于已经核销的记录也计入调节的范围。(参照单位方的设置方式)
+			votemp.setCaved(bankreceipt.getflag().intValue() > 0 ? Boolean.TRUE
+					: Boolean.FALSE);
+			votemp.setM_pk_link(bankreceipt.getMemo());
+			votemp.setM_pk_corp(bankreceipt.getPk_corp());
+			votemp.setM_pk_subject(bankreceipt.getPk_subject());
+			votemp.setM_pk_bank(bankreceipt.getPk_bank());
+			votemp.setM_pk_ass(bankreceipt.getPk_ass());
+			// 设置返回结果批次号
+			votemp.setBatchNumber(bankreceipt.getBatchNumber());
+			votemp.setNetbanknumber(bankreceipt.getNetbanknumber());
+			votemp.setStyleflag(bankreceipt.getStyleflag());
+			votemp.setPk_group(bankreceipt.getPk_group());
+			votemp.setOppunitname(bankreceipt.getOppunitname());
+			votemp.setNusage(bankreceipt.getNusage());
+			votemp.setTranserial(bankreceipt.getTranserial());
+			corpreceipts[j] = votemp;
+		}
+
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getBankReceipt",
+				new Object[] { query });
+		/*************************************************************/
+
+		return corpreceipts;
+	}
+
+	/**
+	 * 得到结算类型
+	 * 
+	 */
+	private String getCheckStyleName(String pk_balatype,Map<String,String> checkStyleNames) throws Exception {
+		if(!checkStyleNames.containsKey(pk_balatype)){
+			BalaTypeVO btvo = getBalaQry().findBalaTypeVOByPK(pk_balatype);
+			if(null != btvo){
+				
+				String name = VOUtil.getMultiLangText(btvo, BalaTypeVO.NAME);
+				checkStyleNames.put(pk_balatype, name);
+				return name;
+			}
+		}
+		
+		return checkStyleNames.get(pk_balatype);
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 根据Key值生成相应的数据访问类 参数: CQueryVO query 查询条件 返回: CBalanceVO[]
+	 **********************************************************************************************************/
+	public Object getClassName(Integer intSourceID, String strType)
+			throws Exception {
+		Object cName = null;
+		ContrastclassDMO dmo = new ContrastclassDMO();
+		ContrastClassVO queryvo = new ContrastClassVO();
+		queryvo.setSourceid(intSourceID.toString());
+		queryvo.setClasstype(strType);
+		ContrastClassVO[] result = dmo.queryByVO(queryvo, new Boolean(true));
+		if (result != null && result.length != 0) {
+			String str = result[0].getClassname();
+			if (intSourceID.intValue() == 1) {
+				Class className = java.lang.Class.forName(str.trim());
+				cName = className.newInstance();
+			} else {
+				cName = ObjectCreator.newInstance(result[0].getM_module(),
+						str);
+			}
+
+		}
+		return cName;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 查询符合日期范围内的对账情况 参数: CQueryVO query 查询条件 返回:
+	 **********************************************************************************************************/
+	public int getContrasts(CQueryVO query, String key, String accountKey)
+			throws SQLException {
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", ".getContrasts()",
+				new Object[] { query });
+		/*************************************************************/
+
+		int result = 0;
+		String sql = "select count(pk_contrast) from  gl_contrast ";
+		sql += " where contrastcode = ";
+		sql += "(select distinct contrastcode from gl_contrast where ";
+		if (query.isBank().booleanValue()) {
+			sql += " pk_bankreceipt ='" + key + "'";
+		} else {
+			sql += " fk_detail ='" + key + "'";
+		}
+		sql += " and pk_contrastaccount = '" + accountKey + "')";
+		if (query.getDate() != null) {
+			sql += " and corpdate > '" + query.getDate().toString() + "'";
+		}
+		if (query.getEndDate() != null) {
+			sql += " and corpdate > '" + query.getEndDate().toString() + "'";
+		}
+		sql += "";
+		Connection con = null;
+		PreparedStatement stmt = null;
+		try {
+			con = getConnection();
+			stmt = con.prepareStatement(sql);
+			ResultSet rs = stmt.executeQuery();
+			while (rs.next()) {
+				Object temp = rs.getObject(1);
+				if (temp != null && temp.toString().length() > 0) {
+					result = Integer.parseInt(temp.toString());
+				}
+			}
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", ".getContrasts()",
+				new Object[] { query });
+		/*************************************************************/
+		return result;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 得到单位到截止日期时(前)的余额 参数: CQueryVO query 查询条件 返回: CBalanceVO[]
+	 **********************************************************************************************************/
+	public CTransferVO[] getCorpBalance(CQueryVO query) throws Exception {
+
+		Vector<CTransferVO> vecResult = new Vector<CTransferVO>();
+		nc.vo.glpub.IVoAccess[] result = null;
+
+		IDataAccess dataAccess = null;
+		IKey keyTool = null;
+
+		// 设置部分单位账查询条件
+		CConditionVO corpCondition = new CConditionVO();
+		corpCondition.setDate(query.getDate());
+		corpCondition.setEndDate(query.getEndDate());
+		corpCondition.setIncludeLast(query.isIncludeLast());
+
+		if (query.getPk_Account() == null || query.getPk_Account().length == 0)
+			throw new Exception(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0","03607con-0505")/*@res "未指定要是用的对账对象!"*/);
+
+		CBalanceKeyTool banlanKeyTool = new CBalanceKeyTool();
+		for (int i = 0; i < query.getPk_Account().length; i++) {
+			ContrastAccountVO accountVO = getAccount(query.getPk_Account()[i]);
+			Integer intSourceID = accountVO.getSource();
+
+			corpCondition.setPk_currtype(accountVO.getPk_currtype());
+			corpCondition.setM_isConTally(accountVO.getM_isConTally());
+			if (query.isInitRange() != null
+					&& query.isInitRange().booleanValue()) {
+				corpCondition.setDate(getStartDate(accountVO
+						.getPk_contrastaccount(), query.getYear()));
+			}
+			// 得到反射类
+			if (intSourceID != 1) {// 从资金帐查询数据
+				corpCondition.setDate(getStartDate(accountVO
+						.getPk_contrastaccount(), query.getYear()));
+				corpCondition.setEndDate(query.getEndDate());
+				dataAccess = new ImpCMPDataAccess();
+				keyTool = new DefaultKeyTool();
+			} else {
+				dataAccess = (IDataAccess) getClassName(intSourceID, "class");
+				keyTool = (IKey) getClassName(intSourceID, "balance");
+				if (query.getDate() != null)
+					corpCondition.setDate(query.getDate());
+				else {
+					corpCondition.setDate(getStartDate(accountVO
+							.getPk_contrastaccount(), query.getYear()));
+					corpCondition.setEndDate(query.getEndDate());
+				}
+			}
+			AccountlinkVO[] links = getLink(query.getPk_Account()[i], query
+					.getYear());
+			CBalanceVO balanceValue = new CBalanceVO();
+			balanceValue.setPk_account(query.getPk_Account()[i]);
+			UFDouble dblDebit = UFDouble.ZERO_DBL;
+			UFDouble dblCredit = UFDouble.ZERO_DBL;
+			Object objTemp;
+			if (links != null && links.length > 0) {
+				for (int iLink = 0; iLink < links.length; iLink++) {
+					corpCondition.setBankAccount(new String[] { links[iLink]
+							.getBankaccount() });
+					corpCondition.setPk_corp(links[iLink].getPk_corp());
+					corpCondition.setPk_accsubj(new String[] { links[iLink]
+							.getPk_subject() });
+					corpCondition.setAssID(links[iLink].getPk_ass());
+					corpCondition.setPk_contrastAccount(links[iLink]
+							.getPk_contrastaccount());
+					corpCondition.setYears(links[iLink].getYears());
+					corpCondition.setMonths(links[iLink].getPeriod());
+					corpCondition.setPk_accountlink(links[iLink]
+							.getPk_accountlink());
+					// 得到单位期初余额
+					if (dataAccess == null)
+						return null;
+					result = dataAccess.queryBalance(corpCondition);
+
+					// 转化为CTransferVO
+					for (int j = 0; result != null && j < result.length; j++) {
+						objTemp = result[j].getValue(keyTool
+								.getBusinessKey(CCorpReceiptKey.DEBITAMOUNT));
+						dblDebit = dblDebit
+								.add(new UFDouble(objTemp.toString()));
+						objTemp = result[j].getValue(keyTool
+								.getBusinessKey(CCorpReceiptKey.CREDITAMOUNT));
+						dblCredit = dblCredit
+								.add(null == objTemp ? new UFDouble(0)
+										: new UFDouble(objTemp.toString()));
+					}
+				}
+				balanceValue.setDebitamount(dblDebit.sub(dblCredit));
+				balanceValue.setCreditamount(new UFDouble(0));
+				CTransferVO transvo = new CTransferVO();
+				transvo.setVo(balanceValue);
+				transvo.setKeyTool(banlanKeyTool);
+				transvo.setPk_account(query.getPk_Account()[i]);
+				vecResult.addElement(transvo);
+			}
+		}
+
+		CTransferVO[] resultVos = new CTransferVO[vecResult.size()];
+		vecResult.copyInto(resultVos);
+		return resultVos;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 得到银行到截止日期时(前)的余额 参数: CQueryVO query 查询条件 返回: CBalanceVO[]
+	 *
+	 * @author zhaozh 创建日期:(2008-8-5 下午03:45:06) 修改:资金帐多单位取余额
+	 **********************************************************************************************************/
+	public CTransferVO[] getCorpBalanceSpread(CQueryVO query) throws Exception {
+
+		Vector<CTransferVO> vecResult = new Vector<CTransferVO>();
+		nc.vo.glpub.IVoAccess[] result = null;
+
+		IDataAccess dataAccess = null;
+		IKey keyTool = null;
+
+		// 设置部分单位账查询条件
+		CConditionVO corpCondition = new CConditionVO();
+		corpCondition.setDate(query.getDate());
+		corpCondition.setEndDate(query.getEndDate());
+		corpCondition.setIncludeLast(query.isIncludeLast());
+		if (query.getPk_Account() == null || query.getPk_Account().length == 0)
+			throw new Exception(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0","03607con-0505")/*@res "未指定要是用的对账对象!"*/);
+
+		CBalanceKeyTool banlanKeyTool = new CBalanceKeyTool();
+		for (int i = 0; i < query.getPk_Account().length; i++) {
+			ContrastAccountVO accountVO = getAccount(query.getPk_Account()[i]);
+			Integer intSourceID = accountVO.getSource();
+			// 取反射类
+			if (intSourceID != 1) {// 从资金帐查询数据
+				corpCondition.setDate(getStartDate(accountVO
+						.getPk_contrastaccount(), query.getYear()));
+				corpCondition.setEndDate(query.getDate());
+				dataAccess = new ImpCMPDataAccess();
+				keyTool = new DefaultKeyTool();
+			} else {
+				dataAccess = (IDataAccess) getClassName(intSourceID, "class");
+				keyTool = (IKey) getClassName(intSourceID, "balance");
+				if (query.getDate() != null)
+					corpCondition.setDate(query.getDate());
+				else
+					corpCondition.setDate(getStartDate(accountVO
+							.getPk_contrastaccount(), query.getYear()));
+				corpCondition.setEndDate(query.getEndDate());
+			}
+			corpCondition.setPk_currtype(accountVO.getPk_currtype());
+			if (query.isInitRange() != null
+					&& query.isInitRange().booleanValue()) {
+				corpCondition.setDate(getStartDate(accountVO
+						.getPk_contrastaccount(), query.getYear()));
+			}
+			// add by v5
+			corpCondition.setM_isConTally(accountVO.getM_isConTally());
+			// add bt zhaozh加入帐户启动日期
+			corpCondition.setAccountStartDate(getStartDate(accountVO
+					.getPk_contrastaccount(), query.getYear()));
+			// 得到反射类
+			// dataAccess = (IDataAccess) getClassName(intSourceID, "class");
+			// keyTool = (IKey) getClassName(intSourceID, "balance");
+			// if(dataAccess == null){
+			// dataAccess = new ImpCMPDataAccess();
+			// keyTool = new DefaultKeyTool();
+			// }
+			AccountlinkVO[] links = getLink(query.getPk_Account()[i], query
+					.getYear());
+			UFDouble dblDebit = new UFDouble(0);
+			UFDouble dblCredit = new UFDouble(0);
+			Object objTemp;
+			if (links != null && links.length > 0) {
+				for (int iLink = 0; iLink < links.length; iLink++) {
+					corpCondition.setBankAccount(new String[] { links[iLink]
+							.getBankaccount() });
+					corpCondition.setPk_corp(links[iLink].getPk_corp());
+					corpCondition.setPk_accsubj(new String[] { links[iLink]
+							.getPk_subject() });
+					corpCondition.setAssID(links[iLink].getPk_ass());
+					corpCondition.setPk_accountlink(links[iLink]
+							.getPk_accountlink());
+					corpCondition.setPk_contrastAccount(links[iLink]
+							.getPk_contrastaccount());
+					// 得到单位期初余额
+					result = dataAccess.queryBalance(corpCondition);
+					CBalanceVO balanceValue = new CBalanceVO();
+					balanceValue.setPk_account(query.getPk_Account()[i]);
+					// 转化为CTransferVO
+					dblDebit = new UFDouble(0);
+					dblCredit = new UFDouble(0);
+					for (int j = 0; result != null && j < result.length; j++) {
+						objTemp = result[j].getValue(keyTool
+								.getBusinessKey(CCorpReceiptKey.DEBITAMOUNT));
+						dblDebit = dblDebit.add(null == objTemp ? new UFDouble(
+								0) : new UFDouble(objTemp.toString()));
+						objTemp = result[j].getValue(keyTool
+								.getBusinessKey(CCorpReceiptKey.CREDITAMOUNT));
+						dblCredit = dblCredit
+								.add(null == objTemp ? new UFDouble(0)
+										: new UFDouble(objTemp.toString()));
+					}
+					balanceValue.setDebitamount(dblDebit.sub(dblCredit));
+					balanceValue.setCreditamount(new UFDouble(0));
+					balanceValue.setM_pk_link(links[iLink].getPk_accountlink());
+					balanceValue.setM_pk_corp(links[iLink].getPk_corp());
+					balanceValue.setM_pk_subject(links[iLink].getPk_subject());
+					balanceValue.setM_pk_bank(links[iLink].getBankaccount());
+					balanceValue.setM_pk_ass(links[iLink].getPk_ass());
+					CTransferVO transvo = new CTransferVO();
+					transvo.setVo(balanceValue);
+					transvo.setKeyTool(banlanKeyTool);
+					transvo.setPk_account(query.getPk_Account()[i]);
+					transvo.setM_pk_link(links[iLink].getPk_accountlink());
+					transvo.setM_pk_corp(links[iLink].getPk_corp());
+					transvo.setM_pk_subject(links[iLink].getPk_subject());
+					transvo.setM_pk_bank(links[iLink].getBankaccount());
+					transvo.setM_pk_ass(links[iLink].getPk_ass());
+					vecResult.addElement(transvo);
+				}
+
+			}
+		}
+
+		CTransferVO[] resultVos = new CTransferVO[vecResult.size()];
+		vecResult.copyInto(resultVos);
+		return resultVos;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 查询单位日记账(所有) 参数: CQueryVO query 查询条件 返回: BankReceiptVO[]
+	 **********************************************************************************************************/
+	public CTransferVO[] getCorpReceipt(CQueryVO query) throws Exception {
+		// 得到单位期初数据,不用通过接口
+		CTransferVO[] result1 = getCorpReceiptInit(query);
+		CTransferVO[] result2 = null;
+		// if (query.isInitRange() == null ||
+		// !query.isInitRange().booleanValue()) {
+		// 通过接口得到单位数据
+		result2 = getCorpReceiptOccur(query);
+		// }
+		int count1 = result1 == null ? 0 : result1.length;
+		int count2 = result2 == null ? 0 : result2.length;
+		// 连接两种数据
+		CTransferVO[] corpreceipts = new CTransferVO[count1 + count2];
+		for (int i = 0; i < count1; i++) {
+			corpreceipts[i] = result1[i];
+		}
+		for (int i = 0; i < count2; i++) {
+			corpreceipts[count1 + i] = result2[i];
+		}
+
+		return corpreceipts;
+	}
+
+	/**********************************************************************************************************
+	 * 功能:查询单位期初日记账 参数:CQueryVO query 查询条件 返回:BankReceiptVO[] 修改:@author zhaozh
+	 * 2008-6-12 上午10:34:54 增加单位期初 批次号查询:batchnumber
+	 **********************************************************************************************************/
+	private CTransferVO[] getCorpReceiptInit(CQueryVO query) throws Exception {
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getCorpReceiptInit",
+				new Object[] { query });
+		/*************************************************************/
+		String[] pk_account = query.getPk_Account();
+		String strTemp = "";
+		for (int i = 0; i < pk_account.length; i++) {
+			strTemp = strTemp + "'" + pk_account[i] + "',";
+		}
+		if (strTemp.length() > 0) {
+			strTemp = strTemp.substring(0, strTemp.length() - 1);
+		}
+
+		// modified by zhufeng 2013-1-31 start
+		StringBuilder sqlBuilder = new StringBuilder();
+		sqlBuilder.append(" select pk_corpreceipt,gl_corpreceipt.pk_contrastaccount,pk_vouchertype,vouchno,prepareddate,explanation,gl_corpreceipt.debitamount,gl_corpreceipt.creditamount ,checkstyle,checkno ,checkdate,gl_corpreceipt.years, ");
+		sqlBuilder.append(" case when isnull(gl_contrast.cavdate,'~')='~' and isnull(gl_contrast.contrastdate,'~')='~' then 0 else  case when isnull(gl_contrast.cavdate,'~')='~' then 1 else 2 end end ");
+		sqlBuilder.append(" ,gl_corpreceipt.memo,gl_corpreceipt.pk_corp,gl_corpreceipt.pk_subject,gl_corpreceipt.pk_bank,gl_corpreceipt.pk_ass,gl_contrast.batchnumber,gl_corpreceipt.netbanknumber,gl_corpreceipt.pk_org,gl_corpreceipt.pk_group,gl_corpreceipt.pk_accountlink,gl_corpreceipt.transerial");
+		sqlBuilder.append(" from gl_corpreceipt left outer join gl_contrast  on gl_corpreceipt.pk_corpreceipt = gl_contrast.fk_detail ");
+		//查询勾兑情况---包括余额调节表查询勾兑,按勾兑日期查询
+		if(query.getNodecode()==20040120 && query.isChecked() != null && query.isChecked()){
+			if (query.getDate() != null) {
+				sqlBuilder.append( " and gl_contrast.contrastdate >= '"
+						+ query.getDate().toString() + "'");
+			}
+			if (query.getEndDate() != null) {
+				sqlBuilder.append(" and gl_contrast.contrastdate <= '"
+						+ query.getEndDate().toString() + "'");
+			}
+		}else{
+			if (query.getDate() != null) {
+				sqlBuilder.append(" and gl_contrast.corpdate >= '"
+						+ query.getDate().toString() + "'");
+			}
+			if (query.getEndDate() != null) {
+				sqlBuilder.append(" and gl_contrast.corpdate <= '"
+						+ query.getEndDate().toString() + "'");
+			}
+		}
+		StringBuffer strWhere = new StringBuffer("");
+		if (query.isM_cavDetai()) {
+			// 核销明细
+			strWhere.append(" and  gl_contrast.cavdate = '"
+					+ query.getM_cavDate() + "' ");
+			if (query.getM_cavMan() == null) {
+				strWhere.append(" and isnull(gl_contrast.cavman,'~')='~'");
+			} else {
+				strWhere.append(" and  gl_contrast.cavman = '"
+						+ query.getM_cavMan() + "' ");
+			}
+		}
+		if (query.isChecked() != null) {
+			if (query.isChecked().booleanValue())
+				strWhere.append(" and isnull(gl_contrast.contrastdate,'~') <> '~' ");
+			else
+				strWhere.append(" and isnull(gl_contrast.contrastdate,'~')='~' ");
+		}
+		//余额调节表,查询已勾兑数据,对账日期大于当前截止日期
+		if (query.getNodecode() == 20040115 && query.isM_bflag()
+				&& null != query.getEndDate() && !"".equals(query.getEndDate())) {
+			strWhere.append(" and gl_contrast.contrastdate >'").append(query.getEndDate().toString()).append("' ");
+		}
+		if (query.isVerified() != null) {
+			if (query.isVerified().booleanValue())
+				strWhere.append(" and isnull(gl_contrast.cavdate,'~') <> '~' ");
+			else
+				strWhere.append(" and isnull(gl_contrast.cavdate,'~')='~' ");
+		}
+		if (query.getYear() != null)
+			strWhere.append(" and gl_corpreceipt.years = '" + query.getYear()
+					+ "' ");
+		if (query.getPk_link() != null)
+			strWhere.append(" and gl_corpreceipt.memo = '" + query.getPk_link()
+					+ "' ");
+		// added by zhufeng 2013-1-31  start
+		if(query.getNodecode()==20040120 && query.isChecked() != null && query.isChecked()){
+			
+		} else {
+			if (query.getDate() != null) {
+				// added by zhufeng 2013-1-31  start
+				strWhere.append("and gl_corpreceipt.prepareddate>= '" +
+						query.getDate().toString()+"' ");
+				// added by zhufeng 2013-1-31  end
+			}
+			if (query.getEndDate() != null) {
+				// added by zhufeng 2013-1-31  start
+				strWhere.append("and gl_corpreceipt.prepareddate<= '" +
+						query.getEndDate().toString()+"' ");
+				// added by zhufeng 2013-1-31  end
+			}
+		}
+		// added by zhufeng 2013-1-31  end
+		//查询勾兑情况---包括余额调节表查询勾兑,按勾兑日期查询
+		if(query.getNodecode()!=20040120 && query.isChecked() != null && !query.isChecked()){
+			if (query.getDate() != null)
+				strWhere.append(" and gl_corpreceipt.prepareddate >= '"
+						+ query.getDate().toString() + "'");
+			if (query.getEndDate() != null)
+				strWhere.append(" and gl_corpreceipt.prepareddate <= '"
+						+ query.getEndDate().toString() + "'");
+		}
+		// 结算号
+		if (query.getCheckNO() != null && query.getCheckNO().length() > 0)
+			strWhere.append(" and gl_corpreceipt.checkno = '"
+					+ query.getCheckNO().replaceAll("'", "''") + "'");
+		// 结算方式
+		if (query.getCheckStyle() != null && query.getCheckStyle().length() > 0) {
+			if(query.getIsEqualCheckStyle() == null || query.getIsEqualCheckStyle().booleanValue()){
+				strWhere.append(" and gl_corpreceipt.checkstyle = '"
+						+ query.getCheckStyle() + "'");
+			}
+			else{
+				strWhere.append(" and gl_corpreceipt.checkstyle <> '"
+						+ query.getCheckStyle() + "'");
+			}
+		
+		}
+		if (strTemp.length() > 0)
+			strWhere.append(" and gl_corpreceipt.pk_contrastaccount in ( "
+					+ strTemp + ") ");
+		// 按批次号查询 @author zhaozh 2008-6-16 下午01:45:33
+		if (query.getBatchNumber() != null
+				&& !query.getBatchNumber().equals(""))
+			strWhere.append(" and gl_contrast.batchnumber='"
+					+ NCESAPI.sqlEncode(query.getBatchNumber()) + "'");
+		Vector<CorpReceiptVO> vecResult = new Vector<CorpReceiptVO>();
+		Connection con = null;
+		PreparedStatement stmt = null;
+		java.util.HashSet<String> checkSet = new java.util.HashSet<String>();
+		java.util.HashMap checkMap = new java.util.HashMap();
+		Object[] checktemp = null;
+		Map<String,String> subjectMap  = new HashMap<String, String>();
+		nc.bs.gl.bookinterface.VoucherDetailDMO dmos = new nc.bs.gl.bookinterface.VoucherDetailDMO();
+		try {
+			sqlBuilder.append(" where " + strWhere.toString().substring(4)
+					+ " order by prepareddate,pk_vouchertype,vouchno ");
+			con = getConnection();
+			stmt = con.prepareStatement(sqlBuilder.toString());
+			Logger.debug(" 开始期初单位查询:" + sqlBuilder.toString());
+			// modified by zhufeng 2013-1-31 end
+			ResultSet rs = stmt.executeQuery();
+			while (rs.next()) {
+				CorpReceiptVO corpreceipt = new CorpReceiptVO();
+				corpreceipt.setPk_corpreceipt(rs.getString(1));
+				corpreceipt.setPk_contrastaccount(rs.getString(2));
+
+				corpreceipt.setPk_accountlink(rs.getString("pk_accountlink"));
+
+				corpreceipt.setPk_vouchertype(rs.getString(3));
+				strTemp = rs.getString(4);
+				corpreceipt.setVouchno(strTemp == null ? strTemp : strTemp
+						.trim());
+				corpreceipt.setPrepareddate(new UFDate(rs.getString(5)));
+				corpreceipt.setExplanation(rs.getString(6));
+				Object t1 = rs.getObject(7);
+				Object t2 = rs.getObject(8);
+				if (t1 != null) {
+					corpreceipt.setDebitamount(new UFDouble(t1.toString()));
+				}
+				if (t2 != null) {
+					corpreceipt.setCreditamount(new UFDouble(t2.toString()));
+				}
+				corpreceipt.setCheckstyle(rs.getString(9));
+				corpreceipt.setM_pk_checkstyle(rs.getString(9));
+				if (corpreceipt.getCheckstyle() != null) {
+					checkSet.add(corpreceipt.getCheckstyle());
+				}
+				strTemp = rs.getString(10);
+				corpreceipt.setCheckno(strTemp == null ? strTemp : strTemp
+						.trim());
+				// explanation :
+				String checkdate = rs.getString(11);
+				corpreceipt.setCheckdate(checkdate == null ? null : new UFDate(
+						checkdate));
+				corpreceipt.setYears(rs.getString(12));
+				corpreceipt.setflag(Integer.valueOf(rs.getInt(13)));
+				corpreceipt.setMemo(rs.getString(14));
+				corpreceipt.setPk_corp(rs.getString(15));
+				corpreceipt.setPk_subject(rs.getString(16));
+				subjectMap.put(rs.getString(16), null);
+				corpreceipt.setPk_bank(rs.getString(17));
+				corpreceipt.setPk_ass(rs.getString(18));
+				corpreceipt.setBatchNumber(rs.getString(19));
+				corpreceipt.setNetbanknumber(rs.getString(20));
+				corpreceipt.setPk_org(rs.getString(21));
+				corpreceipt.setPk_corp(rs.getString(21));
+				corpreceipt.setPk_group(rs.getString(22));
+				corpreceipt.setPk_accountlink(rs.getString(23));
+				corpreceipt.setTranserial(rs.getString(24));
+				vecResult.addElement(corpreceipt);
+			}
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+				Logger.error(e.getMessage(), e);
+				throw new BusinessException(e.getMessage(), e);
+			}
+		}
+		// 转化为CTransferVO
+		CTransferVO[] corpreceipts = new CTransferVO[vecResult.size()];
+		UnitKeyTool keyTool = new UnitKeyTool();
+		CorpReceiptVO corpReceipt = null;
+		// ////////////////////////////////////////////////
+		checktemp = checkSet.toArray();
+		checkMap = dmos.getCheckNamesByPKs(checktemp);
+		if (checkMap == null) {
+			checkMap = new java.util.HashMap();
+		}
+		
+		//期初未达的日记账日数和凭证数据处理不一直导致BUG NCdp205539898
+//		subjectMap = dmos.getSubNamesByPKs(subjectMap.keySet().toArray(new String[0]));
+		// ///////////////////////////////////////////////
+		Object checkpk = null;
+		for (int j = 0; j < vecResult.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			corpReceipt = vecResult.elementAt(j);
+
+			checkpk = checkMap.get(corpReceipt.getCheckstyle());
+			if (checkpk != null) {
+				corpReceipt.setCheckstyle(checkpk.toString());
+			}
+			String subjectName = subjectMap.get(corpReceipt.getPk_subject());
+			if (subjectName!=null) {
+				corpReceipt.setPk_subject(subjectName);
+			}
+			votemp.setVo(corpReceipt);
+			votemp.setKeyTool(keyTool);
+			votemp.setCaved(new Boolean(corpReceipt.flag.intValue() > 0));
+			votemp.setPk_account(corpReceipt.getPk_contrastaccount());
+			votemp.setPk_accountlink(corpReceipt.getPk_accountlink());
+			votemp.setM_pk_link(corpReceipt.getMemo());
+			votemp.setM_pk_corp(corpReceipt.getPk_corp());
+			votemp.setM_pk_subject(corpReceipt.getPk_subject());
+			votemp.setM_pk_bank(corpReceipt.getPk_bank());
+			votemp.setM_pk_ass(corpReceipt.getPk_ass());
+			votemp.setBatchNumber(corpReceipt.getBatchNumber());
+			votemp.setNetbanknumber(corpReceipt.getNetbanknumber());
+			votemp.setTranserial(corpReceipt.getTranserial());
+			votemp.setPk_group(corpReceipt.getPk_group());
+			votemp.setInit(new Boolean(true));
+			corpreceipts[j] = votemp;
+		}
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getCorpReceiptInit",
+				new Object[] { query });
+		/*************************************************************/
+		return corpreceipts;
+	}
+
+	/**********************************************************************************************************
+	 * 功能:查询单位日记账(非期初) 通过接口查询 参数:CQueryVO query 查询条件 返回:BankReceiptVO[]
+	 **********************************************************************************************************/
+	private CTransferVO[] getCorpReceiptOccur(CQueryVO query) throws Exception {
+		Vector<CTransferVO> vecResult = new Vector<CTransferVO>();
+		nc.vo.glpub.IVoAccess[] result = null;
+		IDataAccess dataAccess = null;
+		IKey keyTool = null;
+		// 设置部分单位账查询条件
+		CConditionVO corpCondition = new CConditionVO();
+		corpCondition.setDate(query.getDate());
+		corpCondition.setEndDate(query.getEndDate());
+		corpCondition.setIncludeLast(query.isIncludeLast());
+		corpCondition.setM_isConTally(query.getM_isConTally());
+		// songwb 添加结算号和结算方式
+		corpCondition.setM_strCheckNO(query.getCheckNO());
+		corpCondition.setM_strCheckStyle(query.getCheckStyle());
+		if (query.getIsEqualCheckStyle() == null)
+			corpCondition.setM_ischeckstyle(Boolean.TRUE);
+		else
+			corpCondition.setM_ischeckstyle(new Boolean(query
+					.getIsEqualCheckStyle().booleanValue()));
+		// ArrayList<CTransferVO> cmpVos = new ArrayList<CTransferVO>();
+		for (int i = 0; i < query.getPk_Account().length; i++) {
+			ContrastAccountVO accountVO = getAccount(query.getPk_Account()[i]);
+			Integer intSourceID = accountVO.getSource();
+			nc.vo.pub.lang.UFDate startdate = getStartDate(query
+					.getPk_Account()[i], query.getYear());
+			if (startdate != null
+					&& (query.getDate() == null || startdate.compareTo(query
+							.getDate()) > 0))
+				corpCondition.setDate(startdate);
+			// 若是取期初余额时,时间范围为账户启用时间
+			if (query != null && query.isInitRange() != null
+					&& query.isInitRange()) {
+				corpCondition.setEndDate(startdate);
+			}
+			corpCondition.setPk_currtype(accountVO.getPk_currtype());
+			// 是否包含未记账,作用于余额调节表。前面setM_isConTally(query.getM_isConTally());的设置有漏洞。
+			// by jh
+			corpCondition.setM_isConTally(accountVO.getM_isConTally());
+			// 得到反射类
+			if (intSourceID == 1) {
+				dataAccess = (IDataAccess) getClassName(intSourceID, "class");
+				keyTool = (IKey) getClassName(intSourceID, "key");
+			} else {
+				keyTool = new DefaultKeyTool();
+			}
+			AccountlinkVO[] links = getLink(query.getPk_Account()[i], query
+					.getYear());
+			for (int iLink = 0; iLink < links.length; iLink++) {
+
+				corpCondition.setBankAccount(new String[] { links[iLink]
+						.getBankaccount() });
+				corpCondition.setPk_corp(links[iLink].getPk_corp());
+				corpCondition.setPk_accsubj(new String[] { links[iLink]
+						.getPk_subject() });
+				corpCondition.setIncludeLast(query.isIncludeLast());
+				corpCondition.setAssID(links[iLink].getPk_ass()); // 辅助核算
+				String joinStr = " left outer join gl_contrast on ";
+				//余额调节表查询勾兑,按勾兑日期查询
+				if(query.getNodecode()==20040120 && query.isChecked() != null && query.isChecked()){
+					if (query.getDate() != null) {
+						joinStr += " gl_contrast.contrastdate >= '" + query.getDate() + "' and ";
+					}
+					if (query.getEndDate() != null) {
+						joinStr += " gl_contrast.contrastdate <= '"	+ query.getEndDate() + "' and ";
+					}
+					//设置起始查询日期为启用日期
+					corpCondition.setDate(startdate);
+				}
+				joinStr += " gl_contrast.fk_detail = ";
+				corpCondition.setSqlJoin(joinStr);
+				String str = "";
+				if (query.getVerified() != null) {
+					if (!query.getVerified().booleanValue()
+							&& !query.isM_cavDetai()) {
+						// 不要核销数据
+						str += " and isnull(gl_contrast.cavdate,'~')='~' ";
+					} else {
+						str += " and isnull(gl_contrast.cavdate,'~') <> '~' ";
+					}
+				}
+				if (query.getChecked() != null) {
+					if (!query.getChecked().booleanValue()) {
+						// 没有对帐数据
+						str += " and isnull(gl_contrast.contrastdate,'~')='~' ";
+					} else {
+						// 对帐数据
+						str += " and isnull(gl_contrast.contrastdate,'~') <> '~' ";
+					}
+				}
+				if (query.isM_cavDetai()) {
+					// 核销明细
+					str += " and  gl_contrast.cavdate = '"
+							+ query.getM_cavDate() + "' ";
+					if (query.getM_cavMan() != null) {
+						str += " and  gl_contrast.cavman = '"
+								+ query.getM_cavMan() + "' ";
+					} else {
+						str += " and isnull(gl_contrast.cavman,'~')='~' ";
+					}
+				}
+				// 按批次号查询 @author zhaozh 2008-6-16 下午01:54:30
+				if (query.getBatchNumber() != null
+						&& !query.getBatchNumber().equals("")) {
+					str += " and gl_contrast.batchnumber='"
+							+ NCESAPI.sqlEncode(query.getBatchNumber()) + "' ";
+				}
+				if (query.getNodecode() == 20040115 && query.isM_bflag()
+						&& null != query.getEndDate() ) {
+					str += " and gl_contrast.contrastdate >'"+query.getEndDate().toString()+"' ";
+				}
+				if (intSourceID == 1) {// 凭证查询
+					corpCondition.setPk_accountlink(links[iLink].getPk_accountlink());
+					// modified by zhufeng 2013-7-20 默认条件:暂存的凭证不参与对账 start
+					str += " and gl_detail.tempsaveflag <> 'Y' ";
+					// modified by zhufeng 2013-7-20 end
+					corpCondition.setSqlWhere(str);
+					if (dataAccess == null) {
+						throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0","03607con-0506")/*@res "对账接口类nc.bs.gl.bookinterface.BookInterface未注册!"*/);
+					}
+					result = dataAccess.queryByConditionVO(corpCondition);
+				} else if (intSourceID == 2) {// 资金帐查询
+					StringBuilder sb = buildBankSql(query, links, iLink, str);
+					// sb.append(" and pk_contrastaccount='" +
+					// links[iLink].getPk_contrastaccount() + "' ");
+					corpCondition.setSqlWhere(sb.toString());
+					// 设置assid字段为pk_account
+					if (query.getPk_link() != null
+							&& query.getPk_Account().length > 0) {
+						corpCondition.setAssID(query.getPk_Account()[0]);
+					}
+					corpCondition.setAssID(links[iLink].getPk_contrastaccount());
+
+					/** 为多单位合并对账修改 */
+//					if (query.getPk_Corp() != null) {
+//						corpCondition.setM_pk_glorgbook(query.getPk_Corp());
+//					} else {
+//						corpCondition.setM_pk_glorgbook(links[iLink]
+//								.getPk_corp());
+//					}
+					corpCondition.setM_pk_glorgbook(links[iLink].getPk_corp());
+
+					// CTransferVO[] vos =
+					// findCmpDetailByCondition(corpCondition);
+					CTransferVO[] vos = findCmpDetail(corpCondition, query);
+					if (vos != null && vos.length > 0) {
+						result = new CTransferVO[vos.length];
+						for (int idx = 0; idx < vos.length; idx++) {
+							result[idx] = vos[idx];
+						}
+					} else {
+						result = null;
+					}
+				}
+				// 转化为CTransferVO
+				for (int j = 0; result != null && j < result.length; j++) {
+					CTransferVO votemp = new CTransferVO();
+					votemp.setVo(result[j]);
+					if (result[j].getValue(keyTool
+							.getBusinessKey(CCorpReceiptKey.CONTRASTDATE)) == null) {
+						votemp.setCaved(UFBoolean.FALSE.booleanValue());
+					} else {
+						votemp.setCaved(UFBoolean.TRUE.booleanValue());
+					}
+					votemp.setPk_account(query.getPk_Account()[i]);
+					votemp.setInit(UFBoolean.FALSE.booleanValue());
+					votemp.setKeyTool(keyTool); // 要查数据库
+					votemp.setM_pk_link(links[iLink].getPk_accountlink());
+					// added by zhufeng 2013-4-10 凭证对账时,需要将CorpReceiptVO的pk_org值为账簿的值,需要转换为对应核算归属组织的pk start 
+					if (intSourceID == 1) {
+							String pk_book = links[iLink].getPk_corp();
+						votemp.setM_pk_corp(AccountBookUtil.getPk_orgByAccountBookPk(pk_book));
+						// added by zhufeng 2013-4-10  end
+					} else {
+						votemp.setM_pk_corp(links[iLink].getPk_corp());
+					}
+					votemp.setM_pk_subject(links[iLink].getPk_subject());
+					votemp.setM_pk_bank(links[iLink].getBankaccount());
+					votemp.setM_pk_ass(links[iLink].getPk_ass());
+					/** @author zhaozh 2008-7-8 下午02:25:40 修改收付款单时批次号问题 **/
+					if (result[j].getValue(keyTool
+							.getBusinessKey(CCorpReceiptKey.BATCHNUMBER)) != null)
+						votemp.setBatchNumber(result[j]
+										.getValue(keyTool.getBusinessKey(CCorpReceiptKey.BATCHNUMBER))
+										.toString());
+					votemp.setNetbanknumber(result[j]
+									.getValue(CCorpReceiptKey.NETBANKNUMBER) == null ? ""
+									: result[j].getValue(CCorpReceiptKey.NETBANKNUMBER).toString());
+					if (intSourceID != 1) {
+					votemp.setTranserial(result[j]
+									.getValue(CCorpReceiptKey.TRANSERIAL) == null ? ""
+									: result[j].getValue(CCorpReceiptKey.TRANSERIAL).toString());
+					}
+					vecResult.addElement(votemp);
+				}
+			}// link loop end
+
+		}
+		// if(cmpVos != null && cmpVos.size() != 0){
+		// return cmpVos.toArray(new CTransferVO[cmpVos.size()]);
+		// }
+		// if(vecResult != null) vecResult.trimToSize();
+		// if(cmpVos != null) cmpVos.trimToSize();
+		CTransferVO[] resultVos = new CTransferVO[vecResult.size()];
+		vecResult.copyInto(resultVos);
+		// resultVos = (CTransferVO[]) ArrayUtils.addAll(vecResult.toArray(new
+		// CTransferVO[vecResult.size()]),
+		// cmpVos.toArray(new CTransferVO[cmpVos.size()]));
+		return resultVos;
+	}
+
+	/**
+	 * 银行账sql
+	 * @param query
+	 * @param links
+	 * @param iLink
+	 * @param str
+	 * @return
+	 */
+	private StringBuilder buildBankSql(CQueryVO query, AccountlinkVO[] links, int iLink, String str) {
+		StringBuilder sb = new StringBuilder(str);
+		// 结算方式(增加不等于情况)
+		//61 适配新银行帐记录表:将cmp_detail 改为 cmp_bankaccdetail 
+		if (query.getCheckStyle() != null) {
+			if (query.getIsEqualCheckStyle() == null
+					|| query.getIsEqualCheckStyle().booleanValue()) {
+				sb.append(" and pk_balancetype = '"
+						+ query.getCheckStyle() + "' ");
+			}else{
+				sb.append(" and pk_balancetype <> '"
+						+ query.getCheckStyle() + "' ");
+			}
+		}
+		//V61 取消结算号查询条件
+		// 结算号
+		/*if (query.getCheckNO() != null) {
+			sb.append(" and paybillcode = '"
+					+ query.getCheckNO() + "' ");
+		}*/
+		// 金额范围(借 ---- 资金帐付款)
+		if (query.getMoneyAspect() == 0) {
+			sb.append(" and direction = 0 ")
+					.append(query.getMoneyArea1() == null ? ""
+									: " and recmoney >= "
+											+ query.getMoneyArea1())
+					.append(query.getMoneyArea2() == null ? ""
+									: " and recmoney <= "
+											+ query.getMoneyArea2());
+		}
+		// 金额范围(贷 ---- 资金帐收款)
+		if (query.getMoneyAspect() == 1) {
+			sb.append(" and direction = 1 ")
+					.append(query.getMoneyArea1() == null ? " "
+									: " and paymoney >= "
+											+ query.getMoneyArea1())
+					.append(query.getMoneyArea2() == null ? " "
+									: " and paymoney <= "
+											+ query.getMoneyArea2());
+		}
+		// 金额范围(借贷)
+		if (query.getMoneyAspect() == -1) {
+			if (query.getMoneyArea1() != null
+					&& query.getMoneyArea2() != null) {
+				sb.append(" and ((recmoney >= "
+								+ query.getMoneyArea1()
+								+ " and recmoney <="
+								+ query.getMoneyArea2() + ")")
+						.append(" or ( paymoney >= "
+										+ query.getMoneyArea1()
+										+ " and paymoney <="
+										+ query.getMoneyArea2()
+										+ "))");
+			} else if (query.getMoneyArea1() != null) {
+				sb.append(" and (recmoney >= "
+								+ query.getMoneyArea1()).append(
+						" or paymoney >= "
+								+ query.getMoneyArea1() + ") ");
+			} else if (query.getMoneyArea2() != null) {
+				sb.append(" and (recmoney <= "
+								+ query.getMoneyArea2()).append(
+						" or paymoney <= "
+								+ query.getMoneyArea2() + ") ");
+			}
+		}
+		// 票据日期/记账日期
+		if (query.getN_pjdate1() != null) {
+			sb.append(" and checkdate >= '"
+					+ query.getN_pjdate1() + "' ");
+		}
+		if (query.getN_pjdate2() != null) {
+			sb.append(" and checkdate <= '"
+					+ query.getN_pjdate2() + "' ");
+		}
+		// 单据类型
+		if (!StringUtil.isEmptyWithTrim(query.getN_voucherType())) {
+			sb.append(" and pk_billtype = '"
+					+ query.getN_voucherType() + "' ");
+		}
+		// 单据号
+		if (query.getN_voucherCode1() != null) {
+			sb.append(" and vbillno = '"
+					+ query.getN_voucherCode1() + "' ");
+		}
+
+		if (links[iLink] != null) {
+			sb.append(" and gl_accountlink.pk_accountlink = '"
+					+ links[iLink].getPk_accountlink() + "' ");
+		}
+
+		sb.append(" and gl_contrastaccount.pk_contrastaccount=gl_accountlink.pk_contrastaccount ");
+		return sb;
+	}
+
+	/*private IBankAccQueryService getBankAccQueryService() {
+		if (null == queryService) {
+			queryService = NCLocator.getInstance().lookup(
+					IBankAccQueryService.class);
+		}
+		return queryService;
+	}*/
+
+	@SuppressWarnings("unchecked")
+	private CTransferVO[] findCmpDetail(CConditionVO conVo, CQueryVO query)
+			throws BusinessException {
+		if (query.getNodecode() == 20040115 && query.isM_bflag()) {
+			return findCmpDetailAdjust(conVo, query);
+		}
+		ArrayList<CCorpReceiptVO> list = new ArrayList<CCorpReceiptVO>();
+		//增加对账标志:是对账账面账,不取预占账
+		StringBuilder builder = new StringBuilder("( isnull(tallydate,'~') <> '~') and useflag ="+UseFlagEnum.USE.getOperateTypeValue());
+		builder.append(" and pk_org = '" + conVo.getPk_corp() + "' ");
+		// 币种
+		if (conVo.getPk_currtype() != null) {
+			builder.append(" and pk_curr = '"
+					+ conVo.getPk_currtype() + "' ");
+		}
+		// 银行帐户
+		if (conVo.getbankAccount().length > 0) {
+			builder.append(" and pk_account = '"
+					+ conVo.getbankAccount()[0] + "' ");
+		}
+		
+		//查询勾兑情况---包括余额调节表查询勾兑,按勾兑日期查询 ,其它除外
+		if(query.getNodecode()!= 20040120 || null == query.isChecked()){
+			// 接上传过来的条件  orgbusidate
+			if (conVo.isIncludeLast().booleanValue()) {
+				if (conVo.getDate() != null)
+					builder.append(" and tallydate >= '"
+							+ new UFLiteralDate(conVo.getDate().toString()).toString() + "'");
+				if (conVo.getEndDate() != null)
+					builder.append(" and tallydate <= '"
+							+ conVo.getEndDate().toStdString() + "'");
+			} else {
+				if (conVo.getDate() != null)
+					builder.append(" and tallydate > '"
+							+ new UFLiteralDate(conVo.getDate().toString()).toString() + "'");
+				if (conVo.getEndDate() != null)
+					builder.append(" and tallydate < '"
+							+ conVo.getEndDate().toStdString() + "'");
+			}
+		}
+		if (query.getM_stopDate() != null) {
+			builder.append(" and tallydate < '"
+					+ query.getM_stopDate().toStdString() + "'");
+		}
+		// V61 取消
+		// 60增加票据账的单据过滤条件
+		//builder.append(" and dr =0 and (fundformcode in (0,1) or (fundformcode in (2,3) and isbillrecord = 'Y'))");
+		// 结算号就是票据号
+		// modified by zhufeng 2013-7-13 start
+		if (query.getCheckNO() != null)  {
+			// 
+			String notenumber = query.getCheckNO();
+			// 查询票据号主键
+			if(ContrastQueryModuleUtil.isEnableByGroup(AppContext.getInstance().getPkGroup(), ContrastQueryModuleUtil.TM_FBM_FUNCODE)){
+				Collection<RegisterVO> regVOCol = getBaseDAO().retrieveByClause(
+						RegisterVO.class,
+						RegisterVO.FBMBILLNO + " = '" + NCESAPI.sqlEncode(notenumber) + "'");
+				if(regVOCol != null && regVOCol.size() > 0){
+					notenumber = regVOCol.iterator().next().getPrimaryKey();
+				}
+			}
+
+			builder.append(" and oribillno = '"
+					+ NCESAPI.sqlEncode(notenumber) + "' ");
+		}
+		// 结算方式
+		if (query.getCheckStyle() != null) {
+			if(query.getIsEqualCheckStyle() == null || query.getIsEqualCheckStyle().booleanValue()){
+				builder.append(" and pk_balancetype = '"
+						+ query.getCheckStyle() + "' ");
+			}
+			else{
+				builder.append(" and pk_balancetype <> '"
+						+ query.getCheckStyle() + "' ");
+			}
+			
+		}
+
+		// builder.append(" and pk_detail not in (select fk_detail from gl_contrast)");
+		// 其他查询条件
+		Collection<BankAccDetailVO> coll = getBaseDAO().retrieveByClause(
+				BankAccDetailVO.class, builder.toString());
+		List<BankAccDetailVO> detailList = new ArrayList<BankAccDetailVO>();
+		detailList.addAll(coll);
+		if(detailList!=null&&detailList.size()>0)
+		{
+			
+			try {
+				int count = 0;// 计数器
+				boolean flag = conVo.getLimit() != null && conVo.getLimit() > 0;
+				// modified by zhufeng 2013-4-26 sonar检查:循环中调用数据库查询 start
+				Set<String> accdetailSet = new HashSet<String>();
+				for (BankAccDetailVO bankAccDetailVO : detailList) {
+					accdetailSet.add(bankAccDetailVO.getPk_bankaccdetail());
+				}
+//				StringBuffer con = new StringBuffer("fk_detail in '" + detail.getPk_bankaccdetail() + "' ");
+				StringBuffer con = new StringBuffer("1=1");
+				con.append(new StringBuffer(BDSqlInUtil.formInSQL("fk_detail", accdetailSet.toArray(new String[0]), false)));
+				// 查询核销
+				// _TASK for zhufeng 使用功能号作为条件,财务的银行对账肯定会出问题. 2013-3-18
+				if (query.getModuleCode() != null
+						&& (query.getModuleCode().equals("3607CVCR") || query.getModuleCode().equals("20026507"))) {
+					if (!StringUtil.isEmptyWithTrim(query.getM_cavDate())) {
+						con.append(" and cavdate= '" + query.getM_cavDate()
+								+ "' ");
+					}
+					if (!StringUtil.isEmptyWithTrim(query.getM_cavMan())) {
+						con.append(" and cavman = '" + query.getM_cavMan()
+								+ "' ");
+					}
+				}
+				//查询勾兑情况---包括余额调节表查询勾兑,按勾兑日期查询
+				if(query.getNodecode()==20040120 && query.isChecked() != null && query.isChecked()){
+					if (query.getDate() != null) {
+						con.append(" and contrastdate >= '"
+								+ query.getDate() + "'");
+					}
+					if (query.getEndDate() != null) {
+						con.append(" and contrastdate <= '"
+								+ query.getEndDate() + "'");
+					}
+				}
+				
+				HashMap<String, ContrastVO> detailContrastMap = getDetailContrastMap(query, con.toString());
+				Map<String,String> checkStyleNames = new HashMap<>();
+				for (int i = 0; detailList != null && i < detailList.size(); i++) {
+					BankAccDetailVO detail = detailList.get(i);
+					ContrastVO cstvo = detailContrastMap.get(detail.getPk_bankaccdetail());
+					if (cstvo!=null) {
+						if (query.isChecked() != null) {
+							if (query.isChecked().booleanValue()) {
+								if (cstvo.getContrastdate() == null)
+									continue;
+							} else if (cstvo.getContrastdate() != null)
+								continue;
+						}
+						// modified by zhufeng 2013-4-26 end
+						//查询勾兑情况---包括余额调节表查询勾兑,按勾兑日期查询
+					}else if(query.getNodecode()==20040120 && query.isChecked() != null && query.isChecked()){
+						continue;
+					}
+					if (flag) {
+						count++;
+						if (count > conVo.getLimit())
+							break;
+					}
+					CCorpReceiptVO corp = new CCorpReceiptVO();
+					corp.setPk_corp(conVo.getPk_corp()); // 公司pk
+					corp.setPk_detail(detail.getPk_bankaccdetail()); // 明细主键
+					corp.setExplanation(detail.getNote()); // 备注
+					corp.setPk_checkstyle(detail.getPk_balancetype()); // 结算方式主键
+					corp.setCheckstylename(getCheckStyleName(detail
+							.getPk_balancetype(),checkStyleNames));// 结算方式名称
+					if (detail.getOribillno() != null) { // 结算号//票据号
+						String notenumnber = detail.getOribillno().trim();
+						if(notenumnber.length() == 20){
+							RegisterVO vo = getFBMQueryService().getBaseInfoByPk(notenumnber);
+							if(vo != null){
+								notenumnber = vo.getFbmbillno();
+							}
+						}
+						corp.setCheckno(notenumnber);
+					}
+					Object t7 = detail.getRecmoney(); // 借方金额
+					if (t7 != null) {
+						corp.setDebitamount(new UFDouble(t7.toString()));
+					}else{
+						corp.setDebitamount(UFDouble.ZERO_DBL);
+					}
+					Object t8 = detail.getPaymoney(); // 贷方金额
+					if (t8 != null) {
+						corp.setCreditamount(new UFDouble(t8.toString()));
+					}else{
+						corp.setCreditamount(UFDouble.ZERO_DBL);
+					}
+					if (t7 != null && t8 != null) {
+						if (corp.getDebitamount().doubleValue() == 0.0d
+								&& corp.getCreditamount().doubleValue() == 0.0d) {
+							continue;
+						}
+					}
+					//取原单据日期
+					UFDate t9 = new UFDate(detail.getTallydate().toString());
+					if (t9 != null) {
+						corp.setCheckdate(t9); // 票据日期
+						corp.setPrepareddate(t9);//制单日期与票据日期相同
+					}
+					corp.setPk_vouchertype(detail.getPk_billtype()); // 来源单据类型
+					corp.setPk_sub(String.valueOf(detail.getDirection())); // 方向
+					corp.setVouchno(detail.getVbillno()); // 单据号
+					corp.setDateFlag(detail.getTs().toString()); // 时间戳
+					corp.setM_Pk_bank(detail.getPk_account()); // 本方银行主键
+					if (cstvo != null && cstvo.getContrastdate() != null)
+						corp.setM_contrastdate(cstvo.getContrastdate().toString()); // 对账日期
+					// 3607CVCR 只查核销
+					if (query.getModuleCode() != null
+							&& (query.getModuleCode().equals("3607CVCR") || query.getModuleCode().equals("20026507"))) {
+						if (cstvo != null && cstvo.getCavdate() != null)
+							corp.setM_cavdate(cstvo.getCavdate().toString()); // 核销日期
+						else
+							continue;
+					} else {
+						if (cstvo != null && cstvo.getCavdate() != null)
+							continue;
+					}
+					if (cstvo != null)
+						corp.setBatchNumber(cstvo.getBatchNumber()); // 批次号
+					corp.setNetbanknumber(detail.getBankrelated_code());//对账标识码
+					//yangxds start 增加交易流水号
+					corp.setTranserial(detail.getTranserial());
+					//yangxds end 增加交易流水号
+					corp.setPk_contrastaccount(conVo.getPk_contrastAccount());// 对账帐户
+					corp.setPk_link(conVo.getPk_accountlink());// 对账帐户关联表
+					corp.setPk_group(detail.getPk_group());
+					corp.setTradername(detail.getOppunit());//对方单位
+					list.add(corp);
+				}
+			} catch (Exception e) {
+				Debug.error(e.getMessage(), e);
+				throw new BusinessException(e.getMessage());
+			}
+		}
+		// 转化为CTransferVO
+		CTransferVO[] corpreceipts = new CTransferVO[list.size()];
+		CCorpReceiptVO corpReceipt = null;
+		for (int j = 0; j < list.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			corpReceipt = list.get(j);
+			votemp.setVo(corpReceipt);
+			votemp.setCaved(corpReceipt.getBatchNumber() != null
+					&& corpReceipt.getBatchNumber().trim().length() > 0);
+			votemp.setPk_account(corpReceipt.getPk_contrastaccount());
+			votemp.setM_pk_link(corpReceipt.getPk_link());
+			votemp.setM_pk_corp(corpReceipt.getPk_corp());
+			// votemp.setM_pk_subject(corpReceipt.getPk_subject());
+			votemp.setM_pk_bank(corpReceipt.getM_Pk_bank());
+			// votemp.setM_pk_ass(corpReceipt.getPk_ass());
+			votemp.setBatchNumber(corpReceipt.getBatchNumber());
+			//yangxds 增加交易流水号  start 
+			votemp.setNetbanknumber(corpReceipt.getNetbanknumber());
+			//yangxds 增加交易流水号  end 
+			votemp.setTranserial(corpReceipt.getTranserial());
+			votemp.setPk_group(corpReceipt.getPk_group());
+			votemp.setInit(new Boolean(true));
+			votemp.setKeyTool(new DefaultKeyTool());
+			corpreceipts[j] = votemp;
+		}
+		if (null != corpreceipts && corpreceipts.length > 0) {
+			return corpreceipts;
+		} else
+			return null;
+	}
+
+	/**
+	 * 获取key:fk_detail value:ContrastVO Map,避免在循环中调用查询
+	 * @param query
+	 * @param detailList
+	 * @return
+	 * @throws DAOException
+	 */
+	private HashMap<String, ContrastVO> getDetailContrastMap(CQueryVO query, String contrastSql)
+			throws DAOException {
+		HashMap<String, ContrastVO> detailContrastMap = new HashMap<String, ContrastVO>();
+		
+		Collection<nc.vo.cmp.cb.ContrastVO> cc = getBaseDAO().retrieveByClause(nc.vo.cmp.cb.ContrastVO.class,contrastSql);
+		for (ContrastVO contrastVO : cc) {
+			detailContrastMap.put(contrastVO.getFk_detail(), contrastVO);
+		}
+		return detailContrastMap;
+	}
+
+	@SuppressWarnings("unchecked")
+	/*
+	 * modifier by zhaozh 余额调节表资金帐户专用查询
+	 * 查询后续期间已勾兑数据包含在当前余额调节表期间中的数据
+	 */
+	private CTransferVO[] findCmpDetailAdjust(CConditionVO conVo, CQueryVO query)
+			throws BusinessException {
+		ArrayList<CCorpReceiptVO> list = new ArrayList<CCorpReceiptVO>();
+		//增加对账标志:是对账账面账,不取预占账
+		StringBuilder builder = new StringBuilder("( isnull(tallydate,'~') <> '~') and useflag ="+UseFlagEnum.USE.getOperateTypeValue());
+		builder.append(" and pk_org = '" + conVo.getPk_corp() + "' ");
+		// 币种
+		if (conVo.getPk_currtype() != null) {
+			builder.append(" and pk_curr = '"+ conVo.getPk_currtype() + "' ");
+		}
+		// 银行帐户
+		if (conVo.getbankAccount().length > 0) {
+			builder.append(" and pk_account = '" + conVo.getbankAccount()[0] + "' ");
+		}
+		// 接上传过来的条件  orgbusidate
+		if (conVo.isIncludeLast().booleanValue()) {
+			if (conVo.getDate() != null)
+				builder.append(" and tallydate >= '" + new UFLiteralDate(conVo.getDate().toString()).toString() + "'");
+			if (conVo.getEndDate() != null)
+				builder.append(" and tallydate <= '"+ conVo.getEndDate().toStdString() + "'");
+		} else {
+			if (conVo.getDate() != null)
+				builder.append(" and tallydate > '"
+						+ new UFLiteralDate(conVo.getDate().toString()).toString() + "'");
+			if (conVo.getEndDate() != null)
+				builder.append(" and tallydate < '" + conVo.getEndDate().toStdString() + "'");
+		}
+		//builder.append(" and dr = 0 and (fundformcode in (0,1) or (fundformcode in (2,3) and isbillrecord = 'Y'))");
+		// 其他查询条件
+		/*ISettlementPubQueryService settleService = getSettleQueryService();
+		Collection<SettlementBodyVO> coll = getBaseDAO().retrieveByClause(
+				SettlementBodyVO.class, builder.toString());
+		List<SettlementBodyVO> settList = new ArrayList<SettlementBodyVO>();
+		settList.addAll(coll);
+		settList = settleService.dealOneToMany(settList);*/
+		
+		Collection<BankAccDetailVO> coll = getBaseDAO().retrieveByClause(
+				BankAccDetailVO.class, builder.toString());
+		List<BankAccDetailVO> detailList = new ArrayList<BankAccDetailVO>();
+		detailList.addAll(coll);
+		if(detailList!=null&&detailList.size()>0)
+		{
+			// modified by zhufeng 2013-4-26 sonar检查 start
+			Set<String> accdetailSet = new HashSet<String>();
+			for (BankAccDetailVO bankAccDetailVO : detailList) {
+				accdetailSet.add(bankAccDetailVO.getPk_bankaccdetail());
+			}
+			StringBuffer con = new StringBuffer("1=1 ");
+			con.append(BDSqlInUtil.formInSQL("fk_detail", accdetailSet.toArray(new String[0]), false));
+			// 查询核销
+			if (query.getModuleCode() != null
+					&& (query.getModuleCode().equals("3607CVCR") || query.getModuleCode().equals("20026507"))) {
+				if (!StringUtil.isEmptyWithTrim(query.getM_cavDate())) {
+					con.append(" and cavdate= '" + query.getM_cavDate()
+							+ "' ");
+				}
+				if (!StringUtil.isEmptyWithTrim(query.getM_cavMan())) {
+					con.append(" and cavman = '" + query.getM_cavMan()
+							+ "' ");
+				}
+			}
+			// 余额调剂表查询
+			//已勾兑数据,对账日期大于当前截止日期
+			if (query.getNodecode() == 20040115 && query.isM_bflag()) {
+				if(null != query.getEndDate()){
+					con.append(" and gl_contrast.contrastdate > '" + query.getEndDate().toString() + "' ");
+				}
+				con.append(" and isnull(gl_contrast.contrastdate,'~') <> '~' ");
+			}
+			HashMap<String, ContrastVO> detailContrastMap = getDetailContrastMap(query, con.toString());
+			// modified by zhufeng 2013-4-26 end
+			
+			try {
+				int count = 0;// 计数器
+				boolean flag = conVo.getLimit() != null && conVo.getLimit() > 0;
+				Map<String,String> checkStyleNames = new HashMap<>();
+				
+				for (int i = 0; detailList != null && i < detailList.size(); i++) {
+					BankAccDetailVO detail = detailList.get(i);
+					ContrastVO cstvo = detailContrastMap.get(detail.getPk_bankaccdetail());
+					
+					if (cstvo != null ) {
+						if (cstvo == null /* || cstvo.getCavdate() != null */)
+							continue;
+					} else{
+						continue;
+					}
+					if (flag) {
+						count++;
+						if (count > conVo.getLimit())
+							break;
+					}
+					CCorpReceiptVO corp = new CCorpReceiptVO();
+					corp.setPk_corp(conVo.getPk_corp()); // 公司pk
+					corp.setPk_detail(detail.getPk_bankaccdetail()); // 结算明细主键
+					corp.setExplanation(detail.getNote()); // 备注
+					corp.setPk_checkstyle(detail.getPk_balancetype()); // 结算方式主键
+					corp.setCheckstylename(getCheckStyleName(detail
+							.getPk_balancetype(),checkStyleNames));// 结算方式名称
+					if (detail.getOribillno() != null) { // 结算号
+						corp.setCheckno(detail.getOribillno().trim());
+					}
+					Object t7 = detail.getRecmoney(); // 借方金额
+					if (t7 != null) {
+						corp.setDebitamount(new UFDouble(t7.toString()));
+					}
+					Object t8 = detail.getPaymoney(); // 贷方金额
+					if (t8 != null) {
+						corp.setCreditamount(new UFDouble(t8.toString()));
+					}
+					if (t7 != null && t8 != null) {
+						if (corp.getDebitamount().doubleValue() == 0.0d
+								&& corp.getCreditamount().doubleValue() == 0.0d) {
+							continue;
+						}
+					}
+					UFDate t9 = new UFDate(detail.getTallydate().toString());
+					if (t9 != null) {
+						corp.setCheckdate(t9); // 票据日期
+						corp.setPrepareddate(t9);// 制单日期
+					}
+					corp.setPk_vouchertype(detail.getPk_billtype()); // 来源单据类型
+					corp.setPk_sub(String.valueOf(detail.getDirection())); // 方向
+					corp.setVouchno(detail.getVbillno()); // 单据号
+					corp.setDateFlag(detail.getTs().toString()); // 单据号
+					corp.setM_Pk_bank(detail.getPk_account()); // 本方银行主键
+					if (cstvo != null && cstvo.getContrastdate() != null)
+						corp.setM_contrastdate(cstvo.getContrastdate().toString()); // 对账日期
+					// 20040630 只查核销
+					// if(query.getModuleCode() != null &&
+					// query.getModuleCode().equals("20040630")){
+					// if(cstvo != null && cstvo.getCavdate() != null)
+					// corp.setM_cavdate(cstvo.getCavdate().toString()); //核销日期
+					// else continue;
+					// }else{
+					// if(cstvo != null && cstvo.getCavdate() != null)
+					// continue;
+					// }
+					if (cstvo != null)
+						corp.setBatchNumber(cstvo.getBatchNumber()); // 批次号
+					corp.setPk_contrastaccount(conVo.getPk_contrastAccount());// 对账帐户
+					corp.setPk_link(conVo.getPk_accountlink());// 对账帐户关联表
+					list.add(corp);
+				}
+			} catch (Exception e) {
+				Debug.error(e.getMessage(), e);
+				throw new BusinessException(e.getMessage());
+			}
+		}
+		// 转化为CTransferVO
+		CTransferVO[] corpreceipts = new CTransferVO[list.size()];
+		CCorpReceiptVO corpReceipt = null;
+		for (int j = 0; j < list.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			corpReceipt = list.get(j);
+			votemp.setVo(corpReceipt);
+			votemp.setCaved(corpReceipt.getBatchNumber() != null
+					&& corpReceipt.getBatchNumber().trim().length() > 0);
+			votemp.setPk_account(corpReceipt.getPk_contrastaccount());
+			votemp.setM_pk_link(corpReceipt.getPk_link());
+			votemp.setM_pk_corp(corpReceipt.getPk_corp());
+			// votemp.setM_pk_subject(corpReceipt.getPk_subject());
+			votemp.setM_pk_bank(corpReceipt.getM_Pk_bank());
+			// votemp.setM_pk_ass(corpReceipt.getPk_ass());
+			votemp.setBatchNumber(corpReceipt.getBatchNumber());
+			votemp.setInit(new Boolean(true));
+			votemp.setKeyTool(new DefaultKeyTool());
+			corpreceipts[j] = votemp;
+		}
+		if (null != corpreceipts && corpreceipts.length > 0) {
+			return corpreceipts;
+		} else
+			return null;
+	}
+
+	/**
+	 * 创建日期:2008-7-18 上午09:08:05 modifier by zhaozh on 2008-12-31 不取删除的单据dr=1
+	 *
+	 * @param query
+	 * @param condition
+	 * @return CTransferVO数组
+	 * @throws Exception
+	 *             由查询条件查找所需结算信息明细数据
+	 */
+	@SuppressWarnings("unchecked")
+	private CTransferVO[] findCmpDetailByCondition(CConditionVO conVo,
+			CQueryVO query) throws BusinessException {
+		
+		//修改格式化日期为前10位,避免sqlserver或 oracle查询结果不一致
+		//截取yyyy-mm-dd格式
+		String startDate = conVo.getDate().toStdString();
+		
+		ArrayList<CCorpReceiptVO> list = new ArrayList<CCorpReceiptVO>();
+		StringBuilder builder = new StringBuilder("( isnull(tallydate,'~') <> '~') ");
+		builder.append(" and pk_org = '" + conVo.getPk_corp() + "' ");
+		// 币种
+		if (conVo.getPk_currtype() != null) {
+			builder.append(" and pk_curr = '"
+					+ conVo.getPk_currtype() + "' ");
+		}
+		// 银行帐户
+		if (conVo.getbankAccount().length > 0) {
+			builder.append(" and pk_account = '"
+					+ conVo.getbankAccount()[0] + "' ");
+		}
+		// 接上传过来的条件orgbusidate
+		if (conVo.isIncludeLast().booleanValue()) {
+			builder.append(" and tallydate >= '" + startDate + "'");
+			builder.append(" and tallydate <= '" + conVo.getEndDate() + "'");
+		} else {
+			builder.append(" and tallydate > '" + startDate + "'");
+			builder.append(" and tallydate < '" + conVo.getEndDate() + "'");
+		}
+		if (query.getM_stopDate() != null) {
+			builder.append(" and tallydate < '" + query.getM_stopDate() + "'");
+		}
+		//builder.append(" and dr = 0 and (fundformcode in (0,1) or (fundformcode in (2,3) and isbillrecord = 'Y'))");
+		// 结算号就是票据号
+		if (query.getCheckNO() != null) {
+			builder.append(" and oribillno = '" + query.getCheckNO() + "' ");
+		}
+		// 结算方式
+		if (query.getCheckStyle() != null) {
+			if(query.getIsEqualCheckStyle() == null || query.getIsEqualCheckStyle().booleanValue()){
+				builder.append(" and pk_balancetype = '" + query.getCheckStyle() + "' ");
+			}
+			else{
+				builder.append(" and pk_balancetype <> '" + query.getCheckStyle() + "' ");
+			}
+		
+		}
+		// 其他查询条件
+		/*ISettlementPubQueryService settleService = getSettleQueryService();
+		Collection<SettlementBodyVO> coll = getBaseDAO().retrieveByClause(
+				SettlementBodyVO.class, builder.toString());
+		List<SettlementBodyVO> settList = new ArrayList<SettlementBodyVO>();
+		settList.addAll(coll);
+		settList = settleService.dealOneToMany(settList);*/
+		Collection<BankAccDetailVO> coll = getBaseDAO().retrieveByClause(
+				BankAccDetailVO.class, builder.toString());
+		List<BankAccDetailVO> detailList = new ArrayList<BankAccDetailVO>();
+		detailList.addAll(coll);
+		// modified by zhufeng 2013-4-26 sonar检查 start
+		Set<String> accdetailSet = new HashSet<String>();
+		for (BankAccDetailVO bankAccDetailVO : detailList) {
+			accdetailSet.add(bankAccDetailVO.getPk_bankaccdetail());
+		}
+		StringBuffer con = new StringBuffer(BDSqlInUtil.formInSQLWithoutAnd("fk_detail", accdetailSet.toArray(new String[0]), false));
+		// 查询核销
+		if (query.getModuleCode() != null
+				&& (query.getModuleCode().equals("3607CVCR") || query.getModuleCode().equals("20026507"))) {
+			if (!StringUtil.isEmptyWithTrim(query.getM_cavDate())) {
+				con.append(" and cavdate= '" + query.getM_cavDate() + "' ");
+			}
+			if (!StringUtil.isEmptyWithTrim(query.getM_cavMan())) {
+				con.append(" and cavman = '" + query.getM_cavMan() + "' ");
+			}
+		}
+		HashMap<String, ContrastVO> detailContrastMap = getDetailContrastMap(query, con.toString());
+		Map<String,String> checkStyleNames = new HashMap<>();
+		// modified by zhufeng 2013-4-26 end
+		try {
+			int count = 0;// 计数器
+			boolean flag = conVo.getLimit() != null && conVo.getLimit() > 0;
+			for (int i = 0; detailList != null && i < detailList.size(); i++) {
+				BankAccDetailVO detail = detailList.get(i);
+				ContrastVO cstvo = detailContrastMap.get(detail.getPk_bankaccdetail());
+				if (cstvo != null) {
+					if (query.isChecked() != null) {
+						if (query.isChecked().booleanValue()) {
+							if (cstvo.getContrastdate() == null)
+								continue;
+						} else if (cstvo.getContrastdate() != null)
+							continue;
+					}
+				}
+				if (flag) {
+					count++;
+					if (count > conVo.getLimit())
+						break;
+				}
+				CCorpReceiptVO corp = new CCorpReceiptVO();
+				corp.setPk_corp(conVo.getPk_corp()); // 公司pk
+				corp.setPk_detail(detail.getPk_bankaccdetail()); // 明细主键
+				// 制单日期 取登账日期
+				UFDate t3 = new UFDate(detail.getTallydate().toString());
+				if (t3 != null) {
+					corp.setPrepareddate(t3);//票据日期
+					corp.setCheckdate(t3);//制单日期
+				}
+				corp.setExplanation(detail.getNote()); // 摘要
+				corp.setPk_checkstyle(detail.getPk_balancetype()); // 结算方式主键
+				corp.setCheckstylename(getCheckStyleName(detail
+						.getPk_balancetype(),checkStyleNames));// 结算方式名称
+				if (detail.getOribillno() != null) { // 结算号
+					corp.setCheckno(detail.getOribillno().trim());
+				}
+				Object t7 = detail.getRecmoney(); // 借方金额
+				if (t7 != null) {
+					corp.setDebitamount(new UFDouble(t7.toString()));
+				} else {
+					corp.setDebitamount(UFDouble.ZERO_DBL);
+				}
+				Object t8 = detail.getPaymoney(); // 贷方金额
+				if (t8 != null) {
+					corp.setCreditamount(new UFDouble(t8.toString()));
+				} else {
+					corp.setCreditamount(UFDouble.ZERO_DBL);
+				}
+				if (t7 != null && t8 != null) {
+					if (corp.getDebitamount().doubleValue() == 0.0d
+							&& corp.getCreditamount().doubleValue() == 0.0d) {
+						continue;
+					}
+				}
+				// String t9 = detail.getTallydate().toString();
+				// if(t9 != null && t9.trim().length()>0){
+				// corp.setCheckdate(new UFDate(t9)); //票据日期
+				// }
+				corp.setPk_vouchertype(detail.getPk_billtype()); // 来源单据类型
+				corp.setPk_sub(String.valueOf(detail.getDirection())); // 方向
+				corp.setVouchno(detail.getVbillno()); // 单据号
+				corp.setDateFlag(detail.getTs().toString()); // 单据号
+				corp.setM_Pk_bank(detail.getPk_account()); // 本方银行主键
+				if (cstvo != null && cstvo.getContrastdate() != null)
+					continue; // 只查未对账数据
+				// 20040630 只查核销
+				if (query.getModuleCode() != null
+						&& (query.getModuleCode().equals("3607CVCR") || query.getModuleCode().equals("20026507"))) {
+					if (cstvo != null && cstvo.getCavdate() != null)
+						corp.setM_cavdate(cstvo.getCavdate().toString()); // 核销日期
+					else
+						continue;
+				} else {
+					if (cstvo != null && cstvo.getCavdate() != null)
+						continue;
+				}
+				if (cstvo != null)
+					corp.setBatchNumber(cstvo.getBatchNumber()); // 批次号
+				corp.setPk_contrastaccount(conVo.getPk_contrastAccount());// 对账帐户
+				corp.setPk_link(conVo.getPk_accountlink());// 对账帐户关联表
+				list.add(corp);
+			}
+		} catch (Exception e) {
+			Debug.error(e.getMessage(), e);
+			throw new BusinessException(e.getMessage());
+		}
+		// 转化为CTransferVO
+		CTransferVO[] corpreceipts = new CTransferVO[list.size()];
+		CCorpReceiptVO corpReceipt = null;
+		for (int j = 0; j < list.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			corpReceipt = list.get(j);
+			votemp.setVo(corpReceipt);
+			votemp.setCaved(corpReceipt.getBatchNumber() != null
+					&& corpReceipt.getBatchNumber().trim().length() > 0);
+			votemp.setPk_account(corpReceipt.getPk_contrastaccount());
+			votemp.setM_pk_link(corpReceipt.getPk_link());
+			votemp.setM_pk_corp(corpReceipt.getPk_corp());
+			// votemp.setM_pk_subject(corpReceipt.getPk_subject());
+			votemp.setM_pk_bank(corpReceipt.getM_Pk_bank());
+			// votemp.setM_pk_ass(corpReceipt.getPk_ass());
+			votemp.setBatchNumber(corpReceipt.getBatchNumber());
+			votemp.setInit(new Boolean(true));
+			votemp.setKeyTool(new DefaultKeyTool());
+			corpreceipts[j] = votemp;
+		}
+		if (null != corpreceipts && corpreceipts.length > 0) {
+			return corpreceipts;
+		} else
+			return null;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 查询符合对账情况的单据主键 参数: CQueryVO query 查询条件 返回: BankReceiptVO[]
+	 **********************************************************************************************************/
+	@SuppressWarnings( { "unused"})
+	private HashMap<Object, String> getCorpReceiptPrimaryKey(CQueryVO query)
+			throws SQLException {
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO",
+				".getCorpReceiptPrimaryKey()", new Object[] { query });
+		/*************************************************************/
+
+		String[] pk_account = query.getPk_Account();
+		String strTemp = "";
+		for (int i = 0; i < pk_account.length; i++) {
+			strTemp += "'" + pk_account[i] + "',";
+		}
+		if (strTemp.length() > 0) {
+			strTemp = strTemp.substring(0, strTemp.length() - 1);
+		}
+
+		String sql = " select fk_detail ,cavdate from gl_contrast where isnull(fk_detail,'~') <> '~'  ";
+		if (strTemp.length() > 0) {
+			sql += " and pk_contrastaccount in (" + strTemp + ")";
+		}
+		if (query.getDate() != null)
+			sql += "  and corpdate >= '" + query.getDate() + "'";
+		if (query.getEndDate() != null) {
+			if (query.isIncludeLast().booleanValue())
+				sql += "  and corpdate <= '" + query.getEndDate() + "'";
+			else
+				sql += "  and corpdate < '" + query.getEndDate() + "'";
+		}
+
+		sql += " group by fk_detail,cavdate order by fk_detail,cavdate ";
+
+		HashMap<Object, String> hasResult = new HashMap<Object, String>();
+
+		Connection con = null;
+		PreparedStatement stmt = null;
+		try {
+			con = getConnection();
+			stmt = con.prepareStatement(sql);
+			ResultSet rs = stmt.executeQuery();
+			//
+			while (rs.next()) {
+				Object pks = rs.getString(1);
+				Object cavdate = rs.getObject(2);
+				if (pks != null) {
+					if (cavdate == null
+							|| cavdate.toString().trim().length() < 1) {
+						hasResult.put(pks, "1"); // 对帐标记
+					} else {
+						hasResult.put(pks, "2"); // 核销数据标记
+					}
+				}
+			}
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO",
+				".getCorpReceiptPrimaryKey()", new Object[] { query });
+		/*************************************************************/
+
+		return hasResult;
+	}
+
+	/**************************************************
+	 * 作者: 王建华 创建时间: 2001.9.28 功能: Object,返回其对应的double值
+	 **************************************************/
+	public double getDoubleValue(Object objValue) {
+		double dblTemp = 0.00;
+		if (objValue instanceof Double)
+			dblTemp = ((Double) objValue).doubleValue();
+		else if (objValue instanceof Integer)
+			dblTemp = ((Integer) objValue).intValue();
+		else if (objValue instanceof Long)
+			dblTemp = ((Long) objValue).longValue();
+		else if (objValue instanceof UFDouble)
+			dblTemp = ((UFDouble) objValue).doubleValue();
+		else if (objValue instanceof String) {
+			try {
+				dblTemp = (Double.valueOf(String.valueOf(objValue)))
+						.doubleValue();
+			} catch (NumberFormatException e) {
+				dblTemp = 0.0;
+			}
+		}
+		return roundDouble(dblTemp);
+	}
+
+	/**
+	 * 得到关联公司 创建日期:(2002-3-21 20:09:48)
+	 */
+	private AccountlinkVO[] getLink(String strPk_Account, String years)
+			throws Exception {
+		nc.bs.gl.contrast.ContrastBO bo = new nc.bs.gl.contrast.ContrastBO();
+		AccountlinkVO[] vos = bo.queryAccountLink(strPk_Account, years);
+		return vos;
+	}
+
+	/**
+	 * 得到帐户开始日期。 创建日期:(2002-3-21 20:09:48)
+	 */
+	private UFDate getStartDate(String strPk_account, String strYear)
+			throws Exception {
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getStartDate",
+				new Object[] { strPk_account });
+		/*************************************************************/
+		String strSql = "select startdate from gl_accountstart where pk_contrastaccount = '"
+				+ strPk_account + "' and years = '" + strYear + "'";
+		Connection con = null;
+		PreparedStatement stmt = null;
+		try {
+			con = getConnection();
+			stmt = con.prepareStatement(strSql);
+			ResultSet rs = stmt.executeQuery();
+			if (rs.next()) {
+				String strTemp = rs.getString(1);
+				if (strTemp != null)
+					return new UFDate(strTemp.substring(0, 10) + " 00:00:00");
+				else
+					return null;
+			}
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getStartDate",
+				new Object[] { strPk_account });
+		/*************************************************************/
+		return null;
+	}
+
+	/**************************************************
+	 * 作者: 王建华 创建时间: 2000.3.5 功能: 对于一个double型的计算结果进行校正 参数: d:要进行校正的double型数字
+	 * 返回值: 调整后的double型转为String字符串
+	 **************************************************/
+
+	private double roundDouble(double d) {
+		double dblNew = Math.abs(d);
+
+		long lngTemp = (long) dblNew;
+		double dblTemp = dblNew - lngTemp;
+
+		double convertFactor;
+		int scale = 8;
+		convertFactor = 0.5;
+
+		dblNew = lngTemp
+				+ (((long) (dblTemp * Math.pow(10, scale) + convertFactor)) / Math
+						.pow(10, scale));
+
+		if (d < 0)
+			d = dblNew * (-1);
+		else
+			d = dblNew;
+
+		return d;
+	}
+
+	/**********************************************************************************************************
+	 * 功能: 余额调节表2.3升级 参数: CQueryVO query 查询条件 返回:
+	 **********************************************************************************************************/
+	public boolean updateBalance() throws Exception {
+
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "updateBalance",
+				new Object[] {});
+		/*************************************************************/
+
+		ContrastVO[] contrasts = null;
+		String strSql = " select contrastcode,max(corpdate),pk_contrastaccount from gl_contrast group by contrastcode, pk_contrastaccount ";
+		//
+		Vector<ContrastVO> v = new Vector<ContrastVO>();
+		Connection con = null;
+		PreparedStatement stmt = null;
+		try {
+			con = getConnection();
+			stmt = con.prepareStatement(strSql);
+			ResultSet rs = stmt.executeQuery();
+			String contrastcode = "";
+			String maxdate = "";
+			String account = "";
+			while (rs.next()) {
+				ContrastVO contrast = new ContrastVO();
+				//
+				contrastcode = rs.getString(1);
+				contrast.setContrastcode(contrastcode == null ? null
+						: contrastcode.trim());
+				maxdate = rs.getString(2);
+				contrast.setMax_contrastdate(maxdate == null ? null
+						: new UFDate(maxdate.trim()));
+				account = rs.getString(3);
+				contrast.setPk_contrastaccount(account == null ? null : account
+						.trim());
+				v.addElement(contrast);
+			}
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+		contrasts = new ContrastVO[v.size()];
+		if (v.size() > 0) {
+			v.copyInto(contrasts);
+		}
+		if (contrasts != null) {
+			for (int i = 0; i < contrasts.length; i++) {
+				updateContrast(contrasts[i]);
+			}
+		}
+		updateCav();
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", "updateBalance",
+				new Object[] {});
+		/*************************************************************/
+
+		return true;
+	}
+
+	/**
+	 * 用一个VO对象的属性更新数据库中的值。
+	 *
+	 * 创建日期:(2003-9-9)
+	 *
+	 * @param contrast
+	 *            nc.vo.gl.contrast.ContrastVO
+	 * @exception java.sql.SQLException
+	 *                异常说明。
+	 */
+	public void updateCav() throws java.sql.SQLException {
+
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "updateCav",
+				new Object[] { null });
+		/*************************************************************/
+
+		/*
+		 * String sql = "update gl_contrast set cavdate = null"; Connection con
+		 * = null; PreparedStatement stmt = null; try { con=getConnection();
+		 * stmt = con.prepareStatement(sql);
+		 *
+		 * stmt.executeUpdate(); } finally { try { if (stmt != null) {
+		 * stmt.close(); } }catch (Exception e) {} try { if (con != null) {
+		 * con.close(); } }catch (Exception e) {} }
+		 *
+		 * /
+		 */
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", "updateCav",
+				new Object[] { null });
+		/*************************************************************/
+	}
+
+	/**
+	 * 用一个VO对象的属性更新数据库中的值。
+	 *
+	 * 创建日期:(2003-9-9)
+	 *
+	 * @param contrast
+	 *            nc.vo.gl.contrast.ContrastVO
+	 * @exception java.sql.SQLException
+	 *                异常说明。
+	 */
+	public void updateContrast(ContrastVO contrast)
+			throws java.sql.SQLException {
+
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "updateContrast",
+				new Object[] { contrast });
+		/*************************************************************/
+
+		String sql = "update gl_contrast set memo1 = '"
+				+ contrast.getMax_contrastdate() + "'";
+		sql += " where contrastcode = '" + contrast.getContrastcode() + "'";
+		sql += " and pk_contrastaccount = '" + contrast.getPk_contrastaccount()
+				+ "'";
+		Connection con = null;
+		PreparedStatement stmt = null;
+		try {
+			con = getConnection();
+			stmt = con.prepareStatement(sql);
+
+			stmt.executeUpdate();
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", "updateContrast",
+				new Object[] { contrast });
+		/*************************************************************/
+	}
+
+	/**
+	 * @author zhaozh 2008-6-10 上午10:42:10 查找未对账的银行日记账,以10000条记录为一个单位进行对账
+	 * @param query
+	 * @return
+	 * @throws Exception
+	 */
+	public CTransferVO[] getUnContrastBankReceipt(CQueryVO query)
+			throws Exception {
+		if (getDatabaseType() == 1) {
+			/*************************************************************/
+			// 保留的系统管理接口:
+			beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO",
+					"getUnContrastBankReceipt", new Object[] { query });
+			/*************************************************************/
+			// 0为正常 1为勾对 2为核销
+			StringBuffer strSql = new StringBuffer("");
+			strSql.append("select gl_bankreceipt.pk_bankreceipt, gl_bankreceipt.pk_contrastaccount, explanation, checkstyle, pk_check, checkdate, gl_bankreceipt.debitamount, gl_bankreceipt.creditamount, gl_bankreceipt.years, gl_bankreceipt.period ,");
+			strSql.append(" case when isnull(gl_contrast.cavdate,'~')='~' and isnull(gl_contrast.contrastdate,'~')='~' then 0 else  case when isnull(gl_contrast.cavdate,'~')='~' then 1 else 2 end end");
+			strSql.append(" ,gl_bankreceipt.memo,gl_bankreceipt.pk_corp,gl_bankreceipt.pk_subject,gl_bankreceipt.pk_bank,gl_bankreceipt.pk_ass");
+			strSql.append(" from gl_bankreceipt left outer join gl_contrast gl_contrast on gl_bankreceipt.pk_bankreceipt = gl_contrast.pk_bankreceipt ");
+			int counter = 0;
+			int limit = query.getNumber();
+			String[] pk_account = query.getPk_Account();
+			String strTemp = "";
+			for (int i = 0; i < pk_account.length; i++) {
+				strTemp = strTemp + "'" + pk_account[i] + "',";
+			}
+			if (strTemp.length() > 0) {
+				strTemp = strTemp.substring(0, strTemp.length() - 1);
+			}
+			// ///////////
+			StringBuffer strWhere = new StringBuffer("");
+			if (query.getNodecode() == 20040115 && query.isM_bflag()) {
+				String str = " and gl_contrast.memo1 > '" + query.getEndDate() + "'";
+				strWhere.append(str);
+			}
+			if (pk_account != null && pk_account.length > 0) {
+				strWhere.append(" and gl_bankreceipt.pk_contrastaccount in (" + strTemp + ")");
+			}
+			// 过滤未对账数据
+			strWhere.append(" and isnull(gl_contrast.contrastdate,'~')='~' ");
+			if (query.getPk_link() != null && !query.isMerge())
+				strWhere.append(" and gl_bankreceipt.memo = '" + query.getPk_link() + "' ");
+
+			if (query.getYear() != null)
+				strWhere.append(" and gl_bankreceipt.years = '" + query.getYear() + "' ");
+			if (query.isInitRange() != null) {
+				if (query.isInitRange().booleanValue())
+					strWhere.append(" and gl_bankreceipt.period = '00' ");
+				else
+					strWhere.append(" and gl_bankreceipt.period <> '00' ");
+			}
+			if (query.getDate() != null) {
+				strWhere.append(" and gl_bankreceipt.checkdate >= '" + query.getDate() + "'");
+			}
+			if (query.getEndDate() != null) {
+				strWhere.append(" and gl_bankreceipt.checkdate <= '" + query.getEndDate() + "'");
+			}
+			/* zhaozh 2008-5-30 下午01:45:24 增加银行对帐单票据日期查询条件 */
+			if (query.getN_pjdate1() != null) {
+				strWhere.append(" and gl_bankreceipt.checkdate >= '" + query.getN_pjdate1() + "'");
+			}
+			if (query.getN_pjdate2() != null) {
+				strWhere.append(" and gl_bankreceipt.checkdate <= '" + query.getN_pjdate2() + "'");
+			}
+			// 结算方式
+			if (query.getCheckStyle() != null
+					&& query.getCheckStyle().length() > 0){
+				if(query.getIsEqualCheckStyle() == null || query.getIsEqualCheckStyle().booleanValue()){
+					strWhere.append(" and gl_bankreceipt.checkstyle=  '" + query.getCheckStyle() + "'");
+				}
+				else{
+					strWhere.append(" and gl_bankreceipt.checkstyle<>  '" + query.getCheckStyle() + "'");
+				}
+			}
+				
+			// 结算号
+			if (query.getCheckNO() != null && query.getCheckNO().length() > 0)
+				strWhere.append(" and gl_bankreceipt.pk_check = '" + query.getCheckNO() + "'");
+			// 不查异常记录
+			strWhere.append(" and (gl_bankreceipt.styleflag ='A' or isnull(gl_bankreceipt.styleflag,'~')='~') ");
+			strSql.append(" where  " + strWhere.substring(4));
+			strSql.append(" order by checkdate ,gl_bankreceipt.debitamount, gl_bankreceipt.creditamount");
+			Vector<BankReceiptVO> vecResult = new Vector<BankReceiptVO>();
+			Connection con = null;
+			PreparedStatement stmt = null;
+			java.util.HashSet<String> checkSet = new java.util.HashSet<String>();
+			java.util.HashMap checkMap = new java.util.HashMap();
+			Object[] checktemp = null;
+			try {
+				con = getConnection();
+				stmt = con.prepareStatement(strSql.toString());
+				Logger.debug(" 开始银行查询:" + strSql.toString());
+				ResultSet rs = stmt.executeQuery();
+				while (rs.next()) {
+					counter++;
+					if (counter > limit)
+						break;
+					BankReceiptVO bankreceipt = new BankReceiptVO();
+					bankreceipt.setPk_bankreceipt(rs.getString(1));
+					bankreceipt.setPk_contrastaccount(rs.getString(2));
+					bankreceipt.setExplanation(rs.getString(3));
+					strTemp = rs.getString(4);
+					bankreceipt.setCheckstyle(strTemp == null ? strTemp
+							: strTemp.trim());
+					if (bankreceipt.getCheckstyle() != null) {
+						checkSet.add(bankreceipt.getCheckstyle());
+					}
+					strTemp = rs.getString(5);
+					bankreceipt.setPk_check(strTemp == null ? strTemp : strTemp
+							.trim());
+					String checkdate = rs.getString(6);
+					bankreceipt.setCheckdate(checkdate == null ? null
+							: new UFDate(checkdate.trim()));
+					Object t1 = rs.getObject(7);
+					Object t2 = rs.getObject(8);
+					if (t1 != null) {
+						bankreceipt.setDebitamount(new UFDouble(t1.toString()));
+					} else {
+						bankreceipt.setDebitamount(new UFDouble(0.0));
+					}
+					if (t2 != null) {
+						bankreceipt.setCreditamount(new UFDouble(t2.toString()));
+					} else {
+						bankreceipt.setCreditamount(new UFDouble(0.0));
+					}
+
+					bankreceipt.setYears(rs.getString(9));
+					bankreceipt.setPeriod(rs.getString(10));
+					// flag 勾对标记 :
+					int flags = rs.getInt(11);
+					bankreceipt.setflag(Integer.valueOf(flags));
+					bankreceipt.setMemo(rs.getString(12));
+					bankreceipt.setPk_corp(rs.getString(13));
+					bankreceipt.setPk_subject(rs.getString(14));
+					bankreceipt.setPk_bank(rs.getString(15));
+					bankreceipt.setPk_ass(rs.getString(16));
+					vecResult.addElement(bankreceipt);
+				}
+			} finally {
+				try {
+					if (stmt != null) {
+						stmt.close();
+					}
+				} catch (Exception e) {
+				}
+				try {
+					if (con != null) {
+						con.close();
+					}
+				} catch (Exception e) {
+				}
+			}
+			// ////////////////////////////////////////////////
+			checktemp = checkSet.toArray();
+			nc.bs.gl.bookinterface.VoucherDetailDMO dmos = new nc.bs.gl.bookinterface.VoucherDetailDMO();
+			checkMap = dmos.getCheckNamesByPKs(checktemp);
+			if (checkMap == null) {
+				checkMap = new java.util.HashMap();
+			}
+			// ///////////////////////////////////////////////
+			Object checkpk = null;
+			// 转化为CTransferVO
+			BankKeyTool keyTool = new BankKeyTool();
+			CTransferVO[] corpreceipts = new CTransferVO[vecResult.size()];
+			for (int j = 0; j < vecResult.size(); j++) {
+				CTransferVO votemp = new CTransferVO();
+				BankReceiptVO bankreceipt = vecResult.elementAt(j);
+				checkpk = checkMap.get(bankreceipt.getCheckstyle());
+				if (checkpk != null) {
+					bankreceipt.setCheckstyle(checkpk.toString());
+				}
+				votemp.setVo(bankreceipt);
+				votemp.setKeyTool(keyTool);
+				votemp.setPk_account(bankreceipt.getPk_contrastaccount());
+				votemp.setCaved(bankreceipt.getflag().intValue() == 1 ? Boolean.TRUE : Boolean.FALSE);
+				votemp.setM_pk_link(bankreceipt.getMemo());
+				votemp.setM_pk_corp(bankreceipt.getPk_corp());
+				votemp.setM_pk_subject(bankreceipt.getPk_subject());
+				votemp.setM_pk_bank(bankreceipt.getPk_bank());
+				votemp.setM_pk_ass(bankreceipt.getPk_ass());
+				corpreceipts[j] = votemp;
+			}
+			/*************************************************************/
+			// 保留的系统管理接口:
+			afterCallMethod("nc.bs.gl.contrastpub.QueryDMO",
+					"getUnContrastBankReceipt", new Object[] { query });
+			/*************************************************************/
+			return corpreceipts;
+		} else
+			return getBankReceipt(query);
+	}
+
+	/**
+	 * @author zhaozh 2008-6-10 上午10:55:52 获得单位日记账未对账数据
+	 * @param query
+	 * @return
+	 * @throws Exception
+	 */
+	public CTransferVO[] getUnContrastCorpReceipt(CQueryVO query)
+			throws Exception {
+		CTransferVO[] corpreceipts = null;
+		// 得到单位期初数据
+		query.setNumber(CmpConst.LIMIT);
+		CTransferVO[] result1 = getUnContrastCorpReceiptInit(query);
+		query.setNumber(query.getNumber() - result1.length);
+		CTransferVO[] result2 = null;
+		if (query.isInitRange() == null || !query.isInitRange().booleanValue()) {
+			// 通过接口得到单位数据
+			result2 = getUnContrastCorpReceiptOccur(query);
+		}
+		query.setNumber(query.getNumber() + result1.length);
+		int count1 = result1 == null ? 0 : result1.length;
+		int count2 = result2 == null ? 0 : result2.length;
+		// 连接两种数据
+		corpreceipts = new CTransferVO[count1 + count2];
+		for (int i = 0; i < count1; i++) {
+			corpreceipts[i] = result1[i];
+		}
+		for (int i = 0; i < count2; i++) {
+			corpreceipts[count1 + i] = result2[i];
+		}
+		return corpreceipts;
+	}
+
+	/**
+	 * @author zhaozh 2008-6-10 下午01:10:46 获取单位日记账发生额 未对账数据,增加数据量限制
+	 * @param query
+	 * @return
+	 */
+	private CTransferVO[] getUnContrastCorpReceiptOccur(CQueryVO query)
+			throws Exception {
+		Vector<CTransferVO> vecResult = new Vector<CTransferVO>();
+		nc.vo.glpub.IVoAccess[] result = null;
+
+		IDataAccess dataAccess = null;
+		IKey keyTool = null;
+
+		// 设置部分单位账查询条件
+		CConditionVO corpCondition = new CConditionVO();
+		if (query.getNumber() != null && query.getNumber() > 0)
+			corpCondition.setLimit(query.getNumber());
+		corpCondition.setDate(query.getDate());
+		corpCondition.setEndDate(query.getEndDate());
+		corpCondition.setIncludeLast(query.isIncludeLast());
+		corpCondition.setM_isConTally(query.getM_isConTally());
+		// ArrayList<CTransferVO> cmpVos = new ArrayList<CTransferVO>();
+		for (int i = 0; i < query.getPk_Account().length; i++) {
+			ContrastAccountVO accountVO = getAccount(query.getPk_Account()[i]);
+			Integer intSourceID = accountVO.getSource();
+			nc.vo.pub.lang.UFDate startdate = getStartDate(query
+					.getPk_Account()[i], query.getYear());
+			if (query.getDate() == null
+					|| startdate.compareTo(query.getDate()) > 0)
+				corpCondition.setDate(startdate);
+			corpCondition.setPk_currtype(accountVO.getPk_currtype());
+			// 是否包含未记账,作用于余额调节表。前面setM_isConTally(query.getM_isConTally());的设置有漏洞。
+			// by jh
+			corpCondition.setM_isConTally(accountVO.getM_isConTally());
+			// 得到反射类
+			if (intSourceID == 1) {
+				dataAccess = (IDataAccess) getClassName(intSourceID, "class");
+				keyTool = (IKey) getClassName(intSourceID, "key");
+			} else {
+				keyTool = new DefaultKeyTool();
+			}
+			AccountlinkVO[] links = getLink(query.getPk_Account()[i], query
+					.getYear());
+			for (int iLink = 0; iLink < links.length; iLink++) {
+				if (query.getPk_link() != null
+						&& query.getPk_link().length() > 0) {
+					if (query.getPk_link().equals(
+							links[iLink].getPk_accountlink())) {
+					} else {
+						continue;
+					}
+				}
+				corpCondition.setBankAccount(new String[] { links[iLink]
+						.getBankaccount() });
+				corpCondition.setPk_corp(links[iLink].getPk_corp());
+				corpCondition.setPk_accsubj(new String[] { links[iLink]
+						.getPk_subject() });
+				corpCondition.setIncludeLast(query.isIncludeLast());
+				corpCondition.setAssID(links[iLink].getPk_ass()); // 辅助核算
+				String joinStr = " left outer join gl_contrast on ";
+				joinStr += " gl_contrast.fk_detail = ";
+				corpCondition.setSqlJoin(joinStr);
+				String str = "";
+				if (query.getVerified() != null) {
+					if (!query.getVerified().booleanValue()
+							&& !query.isM_cavDetai()) {
+						// 不要核销数据
+						str += " and isnull(gl_contrast.cavdate,'~')='~' ";
+						corpCondition.setSqlWhere(str);
+					} else {
+						str += " and isnull(gl_contrast.cavdate,'~') <> '~' ";
+						corpCondition.setSqlWhere(str);
+					}
+				}
+				// 查询未对账数据
+				str += " and isnull(gl_contrast.contrastdate,'~')='~' ";
+				corpCondition.setSqlWhere(str);
+				// if(query.getChecked() != null){
+				// if(!query.getChecked().booleanValue()){
+				// //没有对帐数据
+				// corpCondition.setSqlWhere(str);
+				// }else{
+				// //对帐数据
+				// corpCondition.setSqlWhere(str);
+				// }
+				// }
+				if (query.isM_cavDetai()) {
+					// 核销明细
+					str += " and  gl_contrast.cavdate = '"
+							+ query.getM_cavDate() + "' ";
+					if (query.getM_cavMan() != null) {
+						str += " and  gl_contrast.cavman = '"
+								+ query.getM_cavMan() + "' ";
+					} else {
+						str += " and isnull(gl_contrast.cavman,'~')='~' ";
+					}
+					corpCondition.setSqlWhere(str);
+				}
+				/* zhaozh 2008-6-10 下午01:21:21 当数据量大时,分批次对账。增加对账数目限制 */
+				// if(query.getNumber()>0){
+				// str += " and rownum<= " + query.getNumber();
+				// corpCondition.setSqlWhere(str);
+				// }
+				if (query.getNodecode() == 20040115 && query.isM_bflag()) {
+					str += " and gl_contrast.memo1 > '" + query.getEndDate()
+							+ "'";
+					corpCondition.setSqlWhere(str);
+				}
+				// result = dataAccess.queryByConditionVO(corpCondition);
+				if (intSourceID == 1) {// 凭证查询
+					corpCondition.setSqlWhere(str);
+					result = dataAccess.queryByConditionVO(corpCondition);
+				} else if (intSourceID == 2) {// 资金帐查询
+					StringBuilder sb = new StringBuilder(str);
+					// 结算方式
+					if (query.getCheckStyle() != null) {
+						if(query.getIsEqualCheckStyle() == null || query.getIsEqualCheckStyle().booleanValue()){
+							sb.append(" and pk_balancetype = '"
+									+ query.getCheckStyle() + "' ");
+						}
+						else{
+							sb.append(" and pk_balancetype <> '"
+									+ query.getCheckStyle() + "' ");
+						}
+						
+					}
+					// 结算号
+					/*if (query.getCheckNO() != null) {
+						sb.append(" and paybillcode = '"
+								+ query.getCheckNO() + "' ");
+					}*/
+					// 金额范围(借 ---- 资金帐付款)
+					if (query.getMoneyAspect() == 0) {
+						sb.append(" and direction = 0 ")
+								.append(query.getMoneyArea1() == null ? ""
+												: " and recmoney >= "
+														+ query.getMoneyArea1())
+								.append(query.getMoneyArea2() == null ? ""
+												: " and recmoney <= "
+														+ query.getMoneyArea2());
+					}
+					// 金额范围(贷 ---- 资金帐收款)
+					if (query.getMoneyAspect() == 1) {
+						sb.append(" and direction = 1 ")
+								.append(query.getMoneyArea1() == null ? " "
+												: " and paymoney >= "
+														+ query.getMoneyArea1())
+								.append(query.getMoneyArea2() == null ? " "
+												: " and paymoney <= "
+														+ query.getMoneyArea2());
+					}
+					// 金额范围(借贷)
+					if (query.getMoneyAspect() == -1) {
+						if (query.getMoneyArea1() != null
+								&& query.getMoneyArea2() != null) {
+							sb.append(" and ((recmoney >= "
+											+ query.getMoneyArea1()
+											+ " and recmoney <="
+											+ query.getMoneyArea2() + ")")
+									.append(" or ( paymoney >= "
+													+ query.getMoneyArea1()
+													+ " and paymoney <="
+													+ query.getMoneyArea2()
+													+ "))");
+						} else if (query.getMoneyArea1() != null) {
+							sb.append(" and (recmoney >= "
+											+ query.getMoneyArea1()).append(
+									" or paymoney >= " + query.getMoneyArea1() + ") ");
+						} else if (query.getMoneyArea2() != null) {
+							sb.append(" and (recmoney <= "
+											+ query.getMoneyArea2()).append(
+									" or paymoney <= " + query.getMoneyArea2() + ") ");
+						}
+					}
+					// 票据日期/记账日期
+					if (query.getN_pjdate1() != null) {
+						sb.append(" and checkdate >= '" + query.getN_pjdate1() + "' ");
+					}
+					if (query.getN_pjdate2() != null) {
+						sb.append(" and checkdate <= '" + query.getN_pjdate2() + "' ");
+					}
+					// 单据类型
+					if (!StringUtil.isEmptyWithTrim(query.getN_voucherType())) {
+						sb.append(" and pk_billtype = '" + query.getN_voucherType() + "' ");
+					}
+					// 单据号
+					if (!StringUtil.isEmptyWithTrim(query.getN_voucherCode1())) {
+						sb.append(" and vbillno = '" + query.getN_voucherCode1() + "' ");
+					}
+
+					if (links[iLink] != null) {
+						sb.append(" and gl_accountlink.pk_accountlink = '" + links[iLink].getPk_accountlink() + "' ");
+					}
+
+					sb.append(" and gl_contrastaccount.pk_contrastaccount=gl_accountlink.pk_contrastaccount ");
+					corpCondition.setSqlWhere(sb.toString());
+					// 设置assid字段为pk_account
+					if (query.getPk_link() != null
+							&& query.getPk_Account().length > 0) {
+						corpCondition.setAssID(query.getPk_Account()[0]);
+					}
+					// if(StringUtil.isEmptyWithTrim(corpCondition.getAssID()))
+					// corpCondition.setAssID(query.getPk_Account()[0]);
+					if (query.getPk_Corp() != null) {
+						corpCondition.setM_pk_glorgbook(query.getPk_Corp());
+					}
+					CTransferVO[] vos = findCmpDetailByCondition(corpCondition, query);
+					if (vos != null && vos.length > 0) {
+						result = new CTransferVO[vos.length];
+						for (int idx = 0; idx < vos.length; idx++) {
+							result[idx] = vos[idx];
+						}
+					}
+					// if(vos != null && vos.length>0)
+					// for(CTransferVO vo:vos){
+					// cmpVos.add(vo);
+					// }
+				}
+
+				// 转化为CTransferVO
+				for (int j = 0; result != null && j < result.length; j++) {
+					CTransferVO votemp = new CTransferVO();
+					votemp.setVo(result[j]);
+					// if(intSourceID.intValue() == 1){
+					// 来源凭证
+					if (result[j].getValue(keyTool
+							.getBusinessKey(CCorpReceiptKey.CONTRASTDATE)) == null) {
+						votemp.setCaved(Boolean.FALSE);
+					} else {
+						votemp.setCaved(Boolean.TRUE);
+					}
+					// }
+					// else{
+					// if(result[j].getValue(keyTool.getBusinessKey(CCorpReceiptKey.CONTRASTDATE))
+					// == null){
+					// votemp.setCaved(Boolean.FALSE);
+					// }else{
+					// votemp.setCaved(Boolean.TRUE);
+					// }
+					// }
+					votemp.setPk_account(query.getPk_Account()[i]);
+					votemp.setInit(new Boolean(false));
+					votemp.setKeyTool(keyTool); // 要查数据库
+					votemp.setM_pk_link(links[iLink].getPk_accountlink());
+					votemp.setM_pk_corp(links[iLink].getPk_corp());
+					votemp.setM_pk_subject(links[iLink].getPk_subject());
+					votemp.setM_pk_bank(links[iLink].getBankaccount());
+					votemp.setM_pk_ass(links[iLink].getPk_ass());
+					vecResult.addElement(votemp);
+				}
+			}
+			// if(cmpVos != null && cmpVos.size() != 0){
+			// return cmpVos.toArray(new CTransferVO[cmpVos.size()]);
+			// }
+		}
+		CTransferVO[] resultVos = new CTransferVO[vecResult.size()];
+		vecResult.copyInto(resultVos);
+		return resultVos;
+	}
+
+	/**
+	 * @author zhaozh 2008-6-10 下午01:09:30 获取期初单位日记账 加入对账数目的限制
+	 * @param query
+	 * @return
+	 * @throws Exception
+	 */
+	private CTransferVO[] getUnContrastCorpReceiptInit(CQueryVO query)
+			throws Exception {
+		/*************************************************************/
+		// 保留的系统管理接口:
+		beforeCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getCorpReceiptInit",
+				new Object[] { query });
+		/*************************************************************/
+
+		String[] pk_account = query.getPk_Account();
+		int number = 0;
+		int limit = query.getNumber();
+		String strTemp = "";
+		for (int i = 0; i < pk_account.length; i++) {
+			strTemp = strTemp + "'" + pk_account[i] + "',";
+		}
+		if (strTemp.length() > 0) {
+			strTemp = strTemp.substring(0, strTemp.length() - 1);
+		}
+
+		String sql = "";
+		sql = " select pk_corpreceipt,gl_corpreceipt.pk_contrastaccount,pk_vouchertype,vouchno,prepareddate,explanation,gl_corpreceipt.debitamount,gl_corpreceipt.creditamount ,checkstyle,checkno ,checkdate,gl_corpreceipt.years, ";
+		sql += " case when isnull(gl_contrast.cavdate ,'~')='~' and isnull(gl_contrast.contrastdate,'~')='~' then 0 else  case when isnull(gl_contrast.cavdate,'~')='~' then 1 else 2 end end ";
+		sql += " ,gl_corpreceipt.memo,gl_corpreceipt.pk_corp,gl_corpreceipt.pk_subject,gl_corpreceipt.pk_bank,gl_corpreceipt.pk_ass,gl_corpreceipt.pk_group ";
+		sql += " from gl_corpreceipt left outer join gl_contrast  on gl_corpreceipt.pk_corpreceipt = gl_contrast.fk_detail ";
+		// ///////////////
+		if (pk_account != null && pk_account.length > 0) {
+			// sql += " and gl_contrast.pk_contrastaccount in (" + strTemp +
+			// ")";
+		}
+		if (query.getDate() != null) {
+			// strWhere.append(" and gl_bankreceipt.checkdate >= '" +
+			// query.getDate().toString() + "'");
+			sql += " and gl_contrast.corpdate >= '"
+					+ query.getDate().toString() + "'";
+		}
+		if (query.getEndDate() != null) {
+			// strWhere.append(" and gl_bankreceipt.checkdate <= '" +
+			// query.getEndDate().toString() + "'");
+			sql += " and gl_contrast.corpdate <= '"
+					+ query.getEndDate().toString() + "'";
+		}
+
+		// ///////////////
+
+		StringBuffer strWhere = new StringBuffer("");
+
+		if (query.isM_cavDetai()) {
+			// 核销明细
+			strWhere.append(" and  gl_contrast.cavdate = '"
+					+ query.getM_cavDate() + "' ");
+
+			if (query.getM_cavMan() == null) {
+				strWhere.append(" and isnull(gl_contrast.cavman,'~')='~'");
+			} else {
+				strWhere.append(" and  gl_contrast.cavman = '"
+						+ query.getM_cavMan() + "' ");
+			}
+		}
+		if (query.isChecked() != null) {
+			if (query.isChecked().booleanValue())
+				strWhere.append(" and isnull(gl_contrast.contrastdate,'~') <> '~' ");
+			else
+				strWhere.append(" and isnull(gl_contrast.contrastdate,'~')='~' ");
+		}
+
+		if (query.getNodecode() == 20040115 && query.isM_bflag()) {
+			String str = " and gl_contrast.memo1 >  '" + query.getEndDate()
+					+ "'";
+			strWhere.append(str);
+		}
+		if (query.isVerified() != null) {
+			if (query.isVerified().booleanValue())
+				strWhere.append(" and isnull(gl_contrast.cavdate,'~') <> '~' ");
+			else
+				strWhere.append(" and isnull(gl_contrast.cavdate,'~')='~' ");
+		}
+		if (query.getYear() != null)
+			strWhere.append(" and gl_corpreceipt.years = '" + query.getYear()
+					+ "' ");
+		if (query.getPk_link() != null)
+			strWhere.append(" and gl_corpreceipt.memo = '" + query.getPk_link()
+					+ "' ");
+
+		if (query.getDate() != null)
+			strWhere.append(" and gl_corpreceipt.prepareddate >= '"
+					+ query.getDate().toString() + "'");
+		if (query.getEndDate() != null)
+			strWhere.append(" and gl_corpreceipt.prepareddate <= '"
+					+ query.getEndDate().toString() + "'");
+
+		if (query.getCheckNO() != null && query.getCheckNO().length() > 0)
+			strWhere.append(" and gl_corpreceipt.checkno = '"
+					+ query.getCheckNO() + "'");
+
+		if (strTemp.length() > 0)
+			strWhere.append(" and gl_corpreceipt.pk_contrastaccount in ( "
+					+ strTemp + ") ");
+		/* zhaozh 2008-6-10 下午12:43:28 当数据量大时,分批次对账。增加对账数目限制 */
+		// if(query.getNumber()>0){
+		// strWhere.append(" and rownum <"+query.getNumber());
+		// }
+		Vector<CorpReceiptVO> vecResult = new Vector<CorpReceiptVO>();
+		Connection con = null;
+		PreparedStatement stmt = null;
+
+		java.util.HashSet<String> checkSet = new java.util.HashSet<String>();
+		java.util.HashMap checkMap = new java.util.HashMap();
+		Object[] checktemp = null;
+		nc.bs.gl.bookinterface.VoucherDetailDMO dmos = new nc.bs.gl.bookinterface.VoucherDetailDMO();
+		try {
+			sql += " where " + strWhere.toString().substring(4)
+					+ " order by prepareddate,pk_vouchertype,vouchno ";
+			con = getConnection();
+			stmt = con.prepareStatement(sql);
+			ResultSet rs = stmt.executeQuery();
+			while (rs.next()) {
+				number++;
+				if (number > limit)
+					break;
+				CorpReceiptVO corpreceipt = new CorpReceiptVO();
+				corpreceipt.setPk_corpreceipt(rs.getString(1));
+				corpreceipt.setPk_contrastaccount(rs.getString(2));
+				corpreceipt.setPk_vouchertype(rs.getString(3));
+
+				strTemp = rs.getString(4);
+				corpreceipt.setVouchno(strTemp == null ? strTemp : strTemp
+						.trim());
+				corpreceipt.setPrepareddate(new UFDate(rs.getString(5)));
+				corpreceipt.setExplanation(rs.getString(6));
+				Object t1 = rs.getObject(7);
+				Object t2 = rs.getObject(8);
+				if (t1 != null) {
+					corpreceipt.setDebitamount(new UFDouble(t1.toString()));
+				} else {
+					corpreceipt.setDebitamount(UFDouble.ZERO_DBL);
+				}
+				if (t2 != null) {
+					corpreceipt.setCreditamount(new UFDouble(t2.toString()));
+				} else {
+					corpreceipt.setCreditamount(UFDouble.ZERO_DBL);
+				}
+				corpreceipt.setCheckstyle(rs.getString(9));
+				if (corpreceipt.getCheckstyle() != null) {
+					checkSet.add(corpreceipt.getCheckstyle());
+				}
+				strTemp = rs.getString(10);
+				corpreceipt.setCheckno(strTemp == null ? strTemp : strTemp
+						.trim());
+				// explanation :
+				String checkdate = rs.getString(11);
+				corpreceipt.setCheckdate(checkdate == null ? null : new UFDate(
+						checkdate));
+				corpreceipt.setYears(rs.getString(12));
+				corpreceipt.setflag(Integer.valueOf(rs.getInt(13)));
+				corpreceipt.setMemo(rs.getString(14));
+				corpreceipt.setPk_corp(rs.getString(15));
+				corpreceipt.setPk_subject(rs.getString(16));
+				corpreceipt.setPk_bank(rs.getString(17));
+				corpreceipt.setPk_ass(rs.getString(18));
+				corpreceipt.setPk_group(rs.getString(19));
+				vecResult.addElement(corpreceipt);
+			}
+		} finally {
+			try {
+				if (stmt != null) {
+					stmt.close();
+				}
+			} catch (Exception e) {
+			}
+			try {
+				if (con != null) {
+					con.close();
+				}
+			} catch (Exception e) {
+			}
+		}
+
+		// 转化为CTransferVO
+		CTransferVO[] corpreceipts = new CTransferVO[vecResult.size()];
+		UnitKeyTool keyTool = new UnitKeyTool();
+		CorpReceiptVO corpReceipt = null;
+		// ////////////////////////////////////////////////
+		checktemp = checkSet.toArray();
+		checkMap = dmos.getCheckNamesByPKs(checktemp);
+		if (checkMap == null) {
+			checkMap = new java.util.HashMap();
+		}
+		// ///////////////////////////////////////////////
+		Object checkpk = null;
+		for (int j = 0; j < vecResult.size(); j++) {
+			CTransferVO votemp = new CTransferVO();
+			corpReceipt = vecResult.elementAt(j);
+
+			checkpk = checkMap.get(corpReceipt.getCheckstyle());
+			if (checkpk != null) {
+				corpReceipt.setCheckstyle(checkpk.toString());
+			}
+
+			votemp.setVo(corpReceipt);
+			votemp.setKeyTool(keyTool);
+			votemp.setCaved(new Boolean(corpReceipt.flag.intValue() > 0));
+			votemp.setPk_account(corpReceipt.getPk_contrastaccount());
+
+			votemp.setM_pk_link(corpReceipt.getMemo());
+			votemp.setM_pk_corp(corpReceipt.getPk_corp());
+			votemp.setM_pk_subject(corpReceipt.getPk_subject());
+			votemp.setM_pk_bank(corpReceipt.getPk_bank());
+			votemp.setM_pk_ass(corpReceipt.getPk_ass());
+			votemp.setInit(new Boolean(true));
+			corpreceipts[j] = votemp;
+		}
+		/*************************************************************/
+		// 保留的系统管理接口:
+		afterCallMethod("nc.bs.gl.contrastpub.QueryDMO", "getCorpReceiptInit",
+				new Object[] { query });
+		/*************************************************************/
+		return corpreceipts;
+	}
+
+	private IRegisterPubQueryService getFBMQueryService() {
+		if (fbmQueryService == null) {
+			fbmQueryService = NCLocator.getInstance().lookup(
+					IRegisterPubQueryService.class);
+		}
+		return fbmQueryService;
+	}
+	
+	public IBalaTypePubService getBalaQry() {
+		if(balaQry == null) {
+			balaQry = NCLocator.getInstance().lookup(IBalaTypePubService.class);
+		}
+		return balaQry;
+	}
+}

+ 3 - 1
zjcmp_cd/zjcmp_cd/classes/.gitignore

@@ -1,3 +1,5 @@
+/BankContrastQueryAction.class
 /nccloud/
-/zjcmp_cd/
+/snippet/
 /nc/
+/BankContrastQueryComCode.class

+ 91 - 0
zjcmp_cd/zjcmp_cd/src/client/nccloud/web/cdmc/cdm/financepay/action/FinancepayDeleteAction.java

@@ -0,0 +1,91 @@
+package nccloud.web.cdmc.cdm.financepay.action;
+
+import java.util.ArrayList;
+import java.util.List;
+import nc.bs.logging.Logger;
+import nc.vo.cdmc.cdm.financepay.AggFinancepayVO;
+import nc.vo.cdmc.cdm.financepay.FinancepayVO;
+import nc.vo.cdmc.pub.adapter.FinancepaySagaInfoAdapter;
+import nc.vo.cdmc.pub.constants.CdmcPubConst;
+import nc.vo.ml.NCLangRes4VoTransl;
+import nc.vo.pub.BusinessException;
+import nccloud.framework.service.ServiceLocator;
+import nccloud.pubitf.tmpub.pub.ISagasBizService;
+import nccloud.web.cdmc.cdm.financepay.util.FinancepayQueryUtil;
+import nccloud.web.cdmc.common.action.CommonOperatorAction;
+
+public class FinancepayDeleteAction extends CommonOperatorAction<AggFinancepayVO> {
+	protected AggFinancepayVO[] queryBillsByPks(String[] operaPks) throws BusinessException {
+		return FinancepayQueryUtil.queryBillsByPks(operaPks);
+	}
+
+	protected AggFinancepayVO[] doBusinessProcess(AggFinancepayVO[] operaVOs, List<String> errList) {
+		if (operaVOs != null && operaVOs.length != 0) {
+			List<AggFinancepayVO> succVOs = new ArrayList();
+			AggFinancepayVO[] var4 = operaVOs;
+			int var5 = operaVOs.length;
+
+			for (int var6 = 0; var6 < var5; ++var6) {
+				AggFinancepayVO operaVO = var4[var6];
+				
+				
+				String Pk_srcbill = (String) operaVO.getParent().getAttributeValue("pk_srcbill");
+				if(Pk_srcbill != null) {
+					String str = "该单据是由上游单据生成,请在上游单据取消生单!";
+					errList.add(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().
+							getStrByID("cdmc_ncc003_0","0cdmc_ncc003-0000")/*@res 单据编号:*/ + 
+							operaVO.getParentVO().getVbillno()
+							+ str);
+					continue;
+				}
+				
+				
+				if (this.checkBefore(operaVO, errList)) {
+					try {
+						super.callActionScript(CdmcPubConst.CONST_ACTION_DELETE, CdmcPubConst.CONST_BILLTYPE_FINANCEPAY,
+								new AggFinancepayVO[]{operaVO});
+						succVOs.add(operaVO);
+					} catch (Exception var9) {
+						Logger.error(var9.getMessage(), var9);
+						errList.add(
+								NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0000")
+										+ operaVO.getParentVO().getVbillno() + NCLangRes4VoTransl.getNCLangRes()
+												.getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0001")
+										+ this.getExceptionMsg(var9));
+					}
+				}
+			}
+
+			return (AggFinancepayVO[]) succVOs.toArray(new AggFinancepayVO[0]);
+		} else {
+			return null;
+		}
+	}
+
+	private boolean checkBefore(AggFinancepayVO operaVO, List<String> errList) {
+		FinancepayVO head = operaVO.getParentVO();
+
+		try {
+			FinancepaySagaInfoAdapter adapter = new FinancepaySagaInfoAdapter();
+			ISagasBizService sagaService = (ISagasBizService) ServiceLocator.find(ISagasBizService.class);
+			sagaService.checkFrozen(adapter, head.getPrimaryKey());
+		} catch (Exception var6) {
+			errList.add(NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0000")
+					+ head.getVbillno() + this.getExceptionMsg(var6));
+			return false;
+		}
+
+		if (-1 != head.getVbillstatus()) {
+			errList.add(NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0000")
+					+ head.getVbillno()
+					+ NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0002"));
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	protected String getActionCode() {
+		return CdmcPubConst.CONST_ACTION_DELETE;
+	}
+}

+ 356 - 0
zjcmp_cd/zjcmp_cd/src/client/nccloud/web/cmp/bankcontrast/actions/BankContrastQueryAction.java

@@ -0,0 +1,356 @@
+package nccloud.web.cmp.bankcontrast.actions;
+
+import java.util.HashMap;
+import java.util.Map;
+import nc.bs.logging.Logger;
+import nc.itf.gl.contrast.IContrastAccountPrv;
+import nc.itf.gl.contrast.IContrastPrv;
+import nc.vo.cmp.cb.BalanceAdjustResultVO;
+import nc.vo.cmp.cb.BankReceiptVO;
+import nc.vo.cmp.cb.CQueryVO;
+import nc.vo.cmp.cb.CTransferVO;
+import nc.vo.cmp.cb.GlContrastVO;
+import nc.vo.ml.NCLangRes4VoTransl;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.formulaset.MoneyFormat;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+import nccloud.framework.core.exception.ExceptionUtils;
+import nccloud.framework.core.json.IJson;
+import nccloud.framework.service.ServiceLocator;
+import nccloud.framework.web.action.itf.ICommonAction;
+import nccloud.framework.web.container.IRequest;
+import nccloud.framework.web.container.SessionContext;
+import nccloud.framework.web.json.JsonFactory;
+import nccloud.pubitf.cmp.bankcontrast.IBankContrastSerivce;
+import nccloud.web.cmp.balanceadjust.actions.BalanceModelEffectNCC;
+import nccloud.web.cmp.bankcontrast.vo.BankContrastQueryJsonToVo;
+import nccloud.web.cmp.bankcontrast.vo.CTransferNCCSubVo;
+import nccloud.web.cmp.bankcontrast.vo.CTransferNCCVO;
+import nccloud.web.cmp.contrastcommon.actions.BankContrastQueryComCode;
+import nccloud.web.cmp.contrastcommon.actions.BankContrastUtils;
+
+public class BankContrastQueryAction implements ICommonAction {
+	private String errMsg = "";
+
+	public Object doAction(IRequest request) {
+		String read = request.read();
+		IJson iJon = JsonFactory.create();
+		BankContrastQueryJsonToVo JsonVo = (BankContrastQueryJsonToVo) iJon.fromJson(read,
+				BankContrastQueryJsonToVo.class);
+		int bankPageNum = JsonVo.getBankPageNum();
+		int bankPageSize = JsonVo.getBankPageSize();
+		int corpPageNum = JsonVo.getCorpPageNum();
+		int corpPageSize = JsonVo.getCorpPageSize();
+		CQueryVO cqueryVo = BankContrastQueryComCode.transQueryVo(JsonVo);
+		if (cqueryVo.getChecked() != null && cqueryVo.getChecked()) {
+			cqueryVo.setChecked((Boolean) null);
+		}
+
+		String pk_org = cqueryVo.getPk_Corp();
+		UFDate businessDate = new UFDate(SessionContext.getInstance().getClientInfo().getBizDateTime());
+		String year = BankContrastUtils.getAccountYear(pk_org, businessDate, (UFBoolean) null);
+		GlContrastVO[] glContrastArr = BankContrastUtils.queryContrastAcct(cqueryVo.getPk_Account(),
+				cqueryVo.getPk_Corp());
+		if (glContrastArr != null && glContrastArr.length != 0) {
+			cqueryVo.setYear(year);
+			if (cqueryVo.getBankBegDate() != null
+					&& cqueryVo.getBankBegDate().before(new UFDate(glContrastArr[0].getStartdate().toString()))) {
+				cqueryVo.setBankBegDate((UFDate) null);
+			}
+
+			if (cqueryVo.getDate() != null
+					&& cqueryVo.getDate().before(new UFDate(glContrastArr[0].getStartdate().toString()))) {
+				cqueryVo.setDate((UFDate) null);
+			}
+
+			if (cqueryVo.getBankEndDate() == null) {
+				cqueryVo.setBankEndDate((new UFDate()).asEnd());
+			}
+
+			if (cqueryVo.getEndDate() == null) {
+				cqueryVo.setEndDate((new UFDate()).asEnd());
+			}
+
+			this.errMsg = "";
+			this.validateContrastAcc(glContrastArr[0], cqueryVo);
+			CQueryVO bqvo = BankContrastUtils.getQueryBank(cqueryVo, 0, glContrastArr[0]);
+			CQueryVO cqvo = BankContrastUtils.getQueryCorp(cqueryVo, 0, glContrastArr[0]);
+			if (null != bqvo && null != cqvo) {
+				Map results = null;
+
+				try {
+					results = ((IContrastPrv) ServiceLocator.find(IContrastPrv.class)).getReceiptBoth(bqvo, cqvo);
+				} catch (BusinessException var24) {
+					var24.printStackTrace();
+				}
+
+				Map transMap = null;
+
+				try {
+					transMap = ((IBankContrastSerivce) ServiceLocator.find(IBankContrastSerivce.class))
+							.bankcontrastQueryTransfer(glContrastArr[0].getPk_contrastaccount());
+				} catch (BusinessException var23) {
+					var23.printStackTrace();
+				}
+
+				int digit = BankContrastUtils.getPrecision(glContrastArr[0].getPk_currtype());
+				Map<String, CTransferNCCVO[]> returnMap = new HashMap();
+				if (results.get("corp") != null && ((CTransferVO[]) results.get("corp")).length != 0) {
+					if (((CTransferVO[]) results.get("corp")).length < corpPageSize) {
+						corpPageSize = ((CTransferVO[]) results.get("corp")).length;
+					}
+				} else {
+					corpPageSize = 0;
+				}
+
+				if (results.get("bank") != null && ((CTransferVO[]) results.get("bank")).length != 0) {
+					if (((CTransferVO[]) results.get("bank")).length < bankPageSize) {
+						bankPageSize = ((CTransferVO[]) results.get("bank")).length;
+					}
+				} else {
+					bankPageSize = 0;
+				}
+
+				returnMap.put("corp", dealReturnCorpPage(results, digit, transMap, corpPageNum, corpPageSize));
+				returnMap.put("bank", dealReturnBankPage(results, digit, transMap, bankPageNum, bankPageSize));
+				CTransferNCCVO err = new CTransferNCCVO();
+				err.setM_memo(this.errMsg);
+				returnMap.put("errMsg", new CTransferNCCVO[]{err});
+				CTransferNCCVO bankCount = new CTransferNCCVO();
+				bankCount.setM_memo(String
+						.valueOf(results.get("bank") == null ? "0" : ((CTransferVO[]) results.get("bank")).length));
+				returnMap.put("bankCount", new CTransferNCCVO[]{bankCount});
+				CTransferNCCVO corpCount = new CTransferNCCVO();
+				corpCount.setM_memo(String
+						.valueOf(results.get("corp") == null ? "0" : ((CTransferVO[]) results.get("corp")).length));
+				returnMap.put("corpCount", new CTransferNCCVO[]{corpCount});
+				return returnMap;
+			} else {
+				return null;
+			}
+		} else {
+			ExceptionUtils.wrapBusinessException(
+					NCLangRes4VoTransl.getNCLangRes().getStrByID("3607nccloud_ncc_0", "03607nccloud_ncc-0048"));
+			return null;
+		}
+	}
+
+	private void validateContrastAcc(GlContrastVO glContrast, CQueryVO qvo) {
+		if (!this.isAccountStarted(glContrast)) {
+			ExceptionUtils
+					.wrapBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0", "03607con-0213"));
+		} else {
+			try {
+				Boolean isExcep = ((IContrastAccountPrv) ServiceLocator.find(IContrastAccountPrv.class))
+						.isExceptional(glContrast);
+				if (isExcep != null && isExcep) {
+					ExceptionUtils.wrapBusinessException(
+							NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0", "03607con-0201"));
+				}
+			} catch (BusinessException var4) {
+				var4.printStackTrace();
+				ExceptionUtils.wrapBusinessException(
+						NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0", "03607con-0201"));
+			}
+
+			if (!this.isInitBalance(glContrast, qvo)) {
+				ExceptionUtils.wrapBusinessException(this.errMsg);
+			}
+
+		}
+	}
+
+	private boolean isAccountStarted(GlContrastVO vo) {
+		return vo.getStartdate() != null;
+	}
+
+	private boolean isInitBalance(GlContrastVO account, CQueryVO qvo) {
+		boolean flag = false;
+		BalanceModelEffectNCC bm = new BalanceModelEffectNCC(account.getPk_org(), new GlContrastVO[]{account});
+		BalanceAdjustResultVO[] rs = null;
+
+		try {
+			bm.setIsSpread(false);
+			if (qvo != null) {
+				CQueryVO queryVO4Balance = BankContrastQueryComCode.resetQueryEndDate4CheckBalance(qvo);
+				bm.setQvo(queryVO4Balance);
+			}
+
+			bm.initData(account.getPk_org(), new String[]{account.getPk_contrastaccount()}, 20040110);
+			rs = bm.getResult();
+		} catch (Exception var12) {
+			Logger.error(var12.getMessage(), var12);
+			ExceptionUtils.wrapBusinessException(var12.getMessage());
+		}
+
+		if (rs != null && rs.length > 0) {
+			for (int i = 0; i < rs.length; ++i) {
+				String str = rs[i].getPk_account();
+				if (str.equals(account.getPk_contrastaccount())) {
+					UFDouble diff = BankContrastQueryComCode.getDiff(rs[i].getBillbalanceafter(),
+							rs[i].getBankbalanceafter());
+					if (diff.equals(UFDouble.ZERO_DBL)) {
+						flag = true;
+					} else {
+						Integer digit = null;
+
+						try {
+							digit = ((IContrastAccountPrv) ServiceLocator.find(IContrastAccountPrv.class))
+									.getCurrDigitByPk(account.getPk_contrastaccount());
+						} catch (BusinessException var11) {
+							var11.printStackTrace();
+						}
+
+						if (digit == null) {
+							digit = 2;
+						}
+
+						diff = diff.setScale(digit, 4);
+						this.errMsg = NCLangRes4VoTransl.getNCLangRes().getStrByID("3607con_0", "03607con-0194",
+								(String) null, new String[]{MoneyFormat.getDisplayFormat(diff.toString())});
+						flag = false;
+					}
+				}
+			}
+		}
+
+		return flag;
+	}
+
+	public static CTransferNCCVO[] dealReturnCorpPage(Map<String, CTransferVO[]> results, int digit,
+			Map<String, String> transMap, int corpPageNum, int corpPageSize) {
+		IBankContrastSerivce service = (IBankContrastSerivce) ServiceLocator.find(IBankContrastSerivce.class);
+		CTransferNCCVO[] corpArr = null;
+
+		try {
+			if (results.get("corp") != null && ((CTransferVO[]) results.get("corp")).length > 0) {
+				corpArr = new CTransferNCCVO[corpPageSize];
+				CTransferNCCVO corpVo = null;
+				CTransferNCCSubVo subVo = null;
+				int begIndex = (corpPageNum - 1) * corpPageSize;
+				int endIndex = corpPageNum * corpPageSize;
+				if (((CTransferVO[]) results.get("corp")).length > endIndex) {
+					corpArr = new CTransferNCCVO[corpPageSize];
+				} else {
+					corpArr = new CTransferNCCVO[((CTransferVO[]) results.get("corp")).length - begIndex];
+				}
+
+				endIndex = begIndex + corpArr.length;
+				int i = begIndex;
+
+				for (int j = 0; i < endIndex; ++j) {
+					CTransferVO cvo = ((CTransferVO[]) results.get("corp"))[i];
+					Map<String, String> org = service.getOrgName(cvo.getM_pk_corp());
+					corpVo = new CTransferNCCVO();
+					subVo = new CTransferNCCSubVo();
+					subVo.setM_pk_corp((String) org.get("orgName"));
+					subVo.setM_pk_glorgbook((String) transMap.get("accbookName"));
+					subVo.setM_pk_subject((String) transMap.get("subjectName"));
+					subVo.setM_pk_ass((String) transMap.get("assName"));
+					subVo.setM_prepareddate(cvo.getValue(1) == null ? "" : cvo.getValue(1).toString());
+					subVo.setM_vouchno(cvo.getValue(7) == null ? "" : cvo.getValue(7).toString());
+					subVo.setM_explanation(cvo.getValue(2) == null ? "" : cvo.getValue(2).toString());
+					subVo.setM_pk_checkstyle((String) transMap.get(cvo.getValue(13)));
+					subVo.setM_checkno(cvo.getValue(4) == null ? "" : cvo.getValue(4).toString());
+					subVo.setM_debitamount(
+							(new UFDouble(cvo.getValue(5) == null ? "0" : cvo.getValue(5).toString(), digit))
+									.toString());
+					subVo.setM_creditamount(
+							(new UFDouble(cvo.getValue(6) == null ? "0" : cvo.getValue(6).toString(), digit))
+									.toString());
+					subVo.setBatchNumber(cvo.getValue(130) == null ? "" : cvo.getValue(130).toString());
+					subVo.setNetbanknumber(cvo.getValue(140) == null ? "" : cvo.getValue(140).toString());
+					subVo.setTranserial(cvo.getValue(180) == null ? "" : cvo.getValue(180).toString());
+					subVo.setM_pk_corpreceipt(cvo.getValue(10) == null ? "" : cvo.getValue(10).toString());
+					subVo.setM_Pk_detail(cvo.getValue(10) == null ? "" : cvo.getValue(10).toString());
+					subVo.setM_checkdate(cvo.getValue(8) == null ? "" : cvo.getValue(8).toString());
+					subVo.setM_pk_contrastaccount(cvo.getValue(102) == null ? "" : cvo.getValue(102).toString());
+					subVo.setM_pk_vouchertype(cvo.getValue(19) == null ? "" : cvo.getValue(19).toString());
+					subVo.setNusage(cvo.getValue(142) == null ? "" : cvo.getValue(142).toString());
+					corpVo.setM_pk_corp((String) org.get("orgName"));
+					corpVo.setM_caved(new Boolean(cvo.getValue(104) == null ? null : cvo.getValue(104).toString()));
+					if (cvo.getValue(141) == null) {
+						if (cvo.getValue(143) == null) {
+							corpVo.setOppunitname("");
+						} else {
+							corpVo.setOppunitname(cvo.getValue(143).toString());
+						}
+					} else {
+						corpVo.setOppunitname(cvo.getValue(141).toString());
+					}
+
+					corpVo.setM_vo(subVo);
+					corpArr[j] = corpVo;
+					++i;
+				}
+			}
+		} catch (BusinessException var15) {
+			ExceptionUtils.wrapBusinessException(var15.getMessage());
+		} catch (Exception var16) {
+			ExceptionUtils.wrapBusinessException(var16.getMessage());
+		}
+
+		return corpArr;
+	}
+
+	public static CTransferNCCVO[] dealReturnBankPage(Map<String, CTransferVO[]> results, int digit,
+			Map<String, String> transMap, int bankPageNum, int bankPageSize) {
+		CTransferNCCVO[] bankArr = null;
+		IBankContrastSerivce service = (IBankContrastSerivce) ServiceLocator.find(IBankContrastSerivce.class);
+
+		try {
+			if (results.get("bank") != null && ((CTransferVO[]) results.get("bank")).length > 0) {
+				bankArr = new CTransferNCCVO[bankPageSize];
+				CTransferNCCVO bankVo = null;
+				CTransferNCCSubVo subVo = null;
+				int begIndex = (bankPageNum - 1) * bankPageSize;
+				int endIndex = bankPageNum * bankPageSize;
+				if (((CTransferVO[]) results.get("bank")).length > endIndex) {
+					bankArr = new CTransferNCCVO[bankPageSize];
+				} else {
+					bankArr = new CTransferNCCVO[((CTransferVO[]) results.get("bank")).length - begIndex];
+				}
+
+				endIndex = begIndex + bankArr.length;
+				int i = begIndex;
+
+				for (int j = 0; i < endIndex; ++j) {
+					CTransferVO cvo = ((CTransferVO[]) results.get("bank"))[i];
+					Map<String, String> org = service.getOrgName(cvo.getM_pk_corp());
+					bankVo = new CTransferNCCVO();
+					subVo = new CTransferNCCSubVo();
+					subVo.setM_checkdate(cvo.getValue(1) == null ? "" : cvo.getValue(1).toString());
+					subVo.setM_explanation(cvo.getValue(2) == null ? "" : cvo.getValue(2).toString());
+					subVo.setM_checkstyle(cvo.getValue(3) == null ? "" : cvo.getValue(3).toString());
+					subVo.setM_pk_check(cvo.getValue(4) == null ? "" : cvo.getValue(4).toString());
+					subVo.setM_debitamount(
+							(new UFDouble(cvo.getValue(5) == null ? "0" : cvo.getValue(5).toString(), digit))
+									.toString());
+					subVo.setM_creditamount(
+							(new UFDouble(cvo.getValue(6) == null ? "0" : cvo.getValue(6).toString(), digit))
+									.toString());
+					subVo.setBatchNumber(cvo.getValue(130) == null ? "" : cvo.getValue(130).toString());
+					subVo.setNetbanknumber(cvo.getValue(140) == null ? "" : cvo.getValue(140).toString());
+					subVo.setTranserial(cvo.getValue(180) == null ? "" : cvo.getValue(180).toString());
+					subVo.setM_pk_contrastaccount(cvo.getValue(102) == null ? "" : cvo.getValue(102).toString());
+					subVo.setM_pk_bankreceipt(cvo.getValue(10) == null ? "" : cvo.getValue(10).toString());
+					subVo.setNusage(((BankReceiptVO) cvo.getVo()).getNusage());
+					bankVo.setM_pk_corp((String) org.get("orgName"));
+					bankVo.setM_caved(new Boolean(cvo.getValue(104) == null ? null : cvo.getValue(104).toString()));
+					bankVo.setOppunitname(cvo.getValue(141) == null ? "" : cvo.getValue(141).toString());
+					bankVo.setM_vo(subVo);
+					bankArr[j] = bankVo;
+					++i;
+				}
+			}
+		} catch (BusinessException var15) {
+			ExceptionUtils.wrapBusinessException(var15.getMessage());
+		} catch (Exception var16) {
+			ExceptionUtils.wrapBusinessException(var16.getMessage());
+		}
+
+		return bankArr;
+	}
+}

+ 246 - 0
zjcmp_cd/zjcmp_cd/src/client/nccloud/web/cmp/bankcontrast/vo/BankContrastQueryJsonToVo.java

@@ -0,0 +1,246 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package nccloud.web.cmp.bankcontrast.vo;
+
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+
+public class BankContrastQueryJsonToVo {
+    private static final long serialVersionUID = 3835377111130034560L;
+    private int moneyAspect = -1;
+    private String onlyWrongRec;
+    private Boolean m_blnChecked;
+    private String isEqualCheckStyle;
+    private UFDate m_strDate;
+    private UFDate m_strEndDate;
+    private UFDate bankBegDate;
+    private UFDate bankEndDate;
+    private String[] m_Pk_Account;
+    private String m_Pk_Corp;
+    private String n_voucherType;
+    private String m_strCheckStyle;
+    private String m_strCheckNO;
+    private UFDouble moneyArea1;
+    private UFDouble moneyArea2;
+    private UFDate n_pjdate1;
+    private UFDate n_pjdate2;
+    private String oppunitname;
+	private String n_voucherCode1;
+    private String batchNumber;
+    private Boolean m_blnIncludeLast = new Boolean(true);
+    private int bankPageNum = 0;
+    private int bankPageSize = 0;
+    private int corpPageNum = 0;
+    private int corpPageSize = 0;
+
+    public BankContrastQueryJsonToVo() {
+    }
+
+    public int getBankPageNum() {
+        return this.bankPageNum;
+    }
+
+    public void setBankPageNum(int bankPageNum) {
+        this.bankPageNum = bankPageNum;
+    }
+
+    public int getBankPageSize() {
+        return this.bankPageSize;
+    }
+
+    public void setBankPageSize(int bankPageSize) {
+        this.bankPageSize = bankPageSize;
+    }
+
+    public int getCorpPageNum() {
+        return this.corpPageNum;
+    }
+
+    public void setCorpPageNum(int corpPageNum) {
+        this.corpPageNum = corpPageNum;
+    }
+
+    public int getCorpPageSize() {
+        return this.corpPageSize;
+    }
+
+    public void setCorpPageSize(int corpPageSize) {
+        this.corpPageSize = corpPageSize;
+    }
+
+    public int getMoneyAspect() {
+        return this.moneyAspect;
+    }
+
+    public void setMoneyAspect(int moneyAspect) {
+        this.moneyAspect = moneyAspect;
+    }
+
+    public String getOnlyWrongRec() {
+        return this.onlyWrongRec;
+    }
+
+    public void setOnlyWrongRec(String onlyWrongRec) {
+        this.onlyWrongRec = onlyWrongRec;
+    }
+
+    public Boolean getM_blnChecked() {
+        return this.m_blnChecked;
+    }
+
+    public void setM_blnChecked(Boolean m_blnChecked) {
+        this.m_blnChecked = m_blnChecked;
+    }
+
+    public String getIsEqualCheckStyle() {
+        return this.isEqualCheckStyle;
+    }
+
+    public void setIsEqualCheckStyle(String isEqualCheckStyle) {
+        this.isEqualCheckStyle = isEqualCheckStyle;
+    }
+
+    public UFDate getM_strDate() {
+        return this.m_strDate;
+    }
+
+    public void setM_strDate(UFDate m_strDate) {
+        this.m_strDate = m_strDate;
+    }
+
+    public UFDate getM_strEndDate() {
+        return this.m_strEndDate;
+    }
+
+    public void setM_strEndDate(UFDate m_strEndDate) {
+        this.m_strEndDate = m_strEndDate;
+    }
+
+    public UFDate getBankBegDate() {
+        return this.bankBegDate;
+    }
+
+    public void setBankBegDate(UFDate bankBegDate) {
+        this.bankBegDate = bankBegDate;
+    }
+
+    public UFDate getBankEndDate() {
+        return this.bankEndDate;
+    }
+
+    public void setBankEndDate(UFDate bankEndDate) {
+        this.bankEndDate = bankEndDate;
+    }
+
+    public String[] getM_Pk_Account() {
+        return this.m_Pk_Account;
+    }
+
+    public void setM_Pk_Account(String[] m_Pk_Account) {
+        this.m_Pk_Account = m_Pk_Account;
+    }
+
+    public String getM_Pk_Corp() {
+        return this.m_Pk_Corp;
+    }
+
+    public void setM_Pk_Corp(String m_Pk_Corp) {
+        this.m_Pk_Corp = m_Pk_Corp;
+    }
+
+    public String getN_voucherType() {
+        return this.n_voucherType;
+    }
+
+    public void setN_voucherType(String n_voucherType) {
+        this.n_voucherType = n_voucherType;
+    }
+
+    public String getM_strCheckStyle() {
+        return this.m_strCheckStyle;
+    }
+
+    public void setM_strCheckStyle(String m_strCheckStyle) {
+        this.m_strCheckStyle = m_strCheckStyle;
+    }
+
+    public String getM_strCheckNO() {
+        return this.m_strCheckNO;
+    }
+
+    public void setM_strCheckNO(String m_strCheckNO) {
+        this.m_strCheckNO = m_strCheckNO;
+    }
+
+    public UFDouble getMoneyArea1() {
+        return this.moneyArea1;
+    }
+
+    public void setMoneyArea1(UFDouble moneyArea1) {
+        this.moneyArea1 = moneyArea1;
+    }
+
+    public UFDouble getMoneyArea2() {
+        return this.moneyArea2;
+    }
+
+    public void setMoneyArea2(UFDouble moneyArea2) {
+        this.moneyArea2 = moneyArea2;
+    }
+
+    public UFDate getN_pjdate1() {
+        return this.n_pjdate1;
+    }
+
+    public void setN_pjdate1(UFDate n_pjdate1) {
+        this.n_pjdate1 = n_pjdate1;
+    }
+
+    public UFDate getN_pjdate2() {
+        return this.n_pjdate2;
+    }
+
+    public void setN_pjdate2(UFDate n_pjdate2) {
+        this.n_pjdate2 = n_pjdate2;
+    }
+
+    public String getN_voucherCode1() {
+        return this.n_voucherCode1;
+    }
+
+    public void setN_voucherCode1(String n_voucherCode1) {
+        this.n_voucherCode1 = n_voucherCode1;
+    }
+
+    public String getBatchNumber() {
+        return this.batchNumber;
+    }
+
+    public void setBatchNumber(String batchNumber) {
+        this.batchNumber = batchNumber;
+    }
+
+    public Boolean getM_blnIncludeLast() {
+        return this.m_blnIncludeLast;
+    }
+
+    public void setM_blnIncludeLast(Boolean m_blnIncludeLast) {
+        this.m_blnIncludeLast = m_blnIncludeLast;
+    }
+
+    public static long getSerialversionuid() {
+        return 3835377111130034560L;
+    }
+
+	public String getOppunitname() {
+		return oppunitname;
+	}
+
+	public void setOppunitname(String oppunitname) {
+		this.oppunitname = oppunitname;
+	}
+    
+}

+ 158 - 0
zjcmp_cd/zjcmp_cd/src/client/nccloud/web/cmp/contrastcommon/actions/BankContrastQueryComCode.java

@@ -0,0 +1,158 @@
+package nccloud.web.cmp.contrastcommon.actions;
+
+import java.util.Map;
+import nc.vo.cmp.cb.CQueryVO;
+import nc.vo.cmp.cb.CTransferVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+import nccloud.framework.core.exception.ExceptionUtils;
+import nccloud.web.cmp.bankcontrast.vo.BankContrastQueryJsonToVo;
+import nccloud.web.cmp.bankcontrast.vo.CTransferNCCSubVo;
+import nccloud.web.cmp.bankcontrast.vo.CTransferNCCVO;
+
+public class BankContrastQueryComCode {
+    public BankContrastQueryComCode() {
+    }
+
+    public static CQueryVO resetQueryEndDate4CheckBalance(CQueryVO qvo) {
+        CQueryVO qvo4Balance = (CQueryVO)qvo.clone();
+        UFDate bankEndDate = qvo.getBankEndDate();
+        UFDate unitEndDate = qvo.getEndDate();
+        if (bankEndDate.beforeDate(unitEndDate)) {
+            qvo4Balance.setEndDate(bankEndDate);
+        } else {
+            qvo4Balance.setBankEndDate(unitEndDate);
+        }
+
+        return qvo4Balance;
+    }
+
+    public static CTransferNCCVO[] dealReturnCorp(Map<String, CTransferVO[]> results, int digit, Map<String, String> transMap) {
+        CTransferNCCVO[] corpArr = null;
+
+        try {
+            if (results.get("corp") != null && ((CTransferVO[])results.get("corp")).length > 0) {
+                corpArr = new CTransferNCCVO[((CTransferVO[])results.get("corp")).length];
+                CTransferNCCVO corpVo = null;
+                CTransferNCCSubVo subVo = null;
+
+                for(int i = 0; i < ((CTransferVO[])results.get("corp")).length; ++i) {
+                    CTransferVO cvo = ((CTransferVO[])results.get("corp"))[i];
+                    corpVo = new CTransferNCCVO();
+                    subVo = new CTransferNCCSubVo();
+                    subVo.setM_pk_corp((String)transMap.get("orgName"));
+                    subVo.setM_pk_glorgbook((String)transMap.get("accbookName"));
+                    subVo.setM_pk_subject((String)transMap.get("subjectName"));
+                    subVo.setM_pk_ass((String)transMap.get("assName"));
+                    subVo.setM_prepareddate(cvo.getValue(1) == null ? "" : cvo.getValue(1).toString());
+                    subVo.setM_vouchno(cvo.getValue(7) == null ? "" : cvo.getValue(7).toString());
+                    subVo.setM_explanation(cvo.getValue(2) == null ? "" : cvo.getValue(2).toString());
+                    subVo.setM_pk_checkstyle((String)transMap.get(cvo.getValue(13)));
+                    subVo.setM_checkno(cvo.getValue(4) == null ? "" : cvo.getValue(4).toString());
+                    subVo.setM_debitamount((new UFDouble(cvo.getValue(5) == null ? "0" : cvo.getValue(5).toString(), digit)).toString());
+                    subVo.setM_creditamount((new UFDouble(cvo.getValue(6) == null ? "0" : cvo.getValue(6).toString(), digit)).toString());
+                    subVo.setBatchNumber(cvo.getValue(130) == null ? "" : cvo.getValue(130).toString());
+                    subVo.setNetbanknumber(cvo.getValue(140) == null ? "" : cvo.getValue(140).toString());
+                    subVo.setM_pk_corpreceipt(cvo.getValue(10) == null ? "" : cvo.getValue(10).toString());
+                    subVo.setM_Pk_detail(cvo.getValue(10) == null ? "" : cvo.getValue(10).toString());
+                    subVo.setM_checkdate(cvo.getValue(8) == null ? "" : cvo.getValue(8).toString());
+                    subVo.setM_pk_contrastaccount(cvo.getValue(102) == null ? "" : cvo.getValue(102).toString());
+                    subVo.setM_pk_vouchertype(cvo.getValue(19) == null ? "" : cvo.getValue(19).toString());
+                    subVo.setNusage(cvo.getValue(142) == null ? "" : cvo.getValue(142).toString());
+                    corpVo.setM_pk_corp((String)transMap.get("orgName"));
+                    corpVo.setM_caved(new Boolean(cvo.getValue(104) == null ? null : cvo.getValue(104).toString()));
+                    corpVo.setOppunitname(cvo.getValue(141) == null ? "" : cvo.getValue(141).toString());
+                    corpVo.setM_vo(subVo);
+                    corpArr[i] = corpVo;
+                }
+            }
+        } catch (BusinessException var8) {
+            ExceptionUtils.wrapBusinessException(var8.getMessage());
+        } catch (Exception var9) {
+            ExceptionUtils.wrapBusinessException(var9.getMessage());
+        }
+
+        return corpArr;
+    }
+
+    public static CTransferNCCVO[] dealReturnBank(Map<String, CTransferVO[]> results, int digit, Map<String, String> transMap) {
+        CTransferNCCVO[] bankArr = null;
+
+        try {
+            if (results.get("bank") != null && ((CTransferVO[])results.get("bank")).length > 0) {
+                bankArr = new CTransferNCCVO[((CTransferVO[])results.get("bank")).length];
+                CTransferNCCVO bankVo = null;
+                CTransferNCCSubVo subVo = null;
+
+                for(int i = 0; i < ((CTransferVO[])results.get("bank")).length; ++i) {
+                    CTransferVO cvo = ((CTransferVO[])results.get("bank"))[i];
+                    bankVo = new CTransferNCCVO();
+                    subVo = new CTransferNCCSubVo();
+                    subVo.setM_checkdate(cvo.getValue(1) == null ? "" : cvo.getValue(1).toString());
+                    subVo.setM_explanation(cvo.getValue(2) == null ? "" : cvo.getValue(2).toString());
+                    subVo.setM_checkstyle(cvo.getValue(3) == null ? "" : cvo.getValue(3).toString());
+                    subVo.setM_pk_check(cvo.getValue(4) == null ? "" : cvo.getValue(4).toString());
+                    subVo.setM_debitamount((new UFDouble(cvo.getValue(5) == null ? "0" : cvo.getValue(5).toString(), digit)).toString());
+                    subVo.setM_creditamount((new UFDouble(cvo.getValue(6) == null ? "0" : cvo.getValue(6).toString(), digit)).toString());
+                    subVo.setBatchNumber(cvo.getValue(130) == null ? "" : cvo.getValue(130).toString());
+                    subVo.setNetbanknumber(cvo.getValue(140) == null ? "" : cvo.getValue(140).toString());
+                    subVo.setM_pk_contrastaccount(cvo.getValue(102) == null ? "" : cvo.getValue(102).toString());
+                    subVo.setM_pk_bankreceipt(cvo.getValue(10) == null ? "" : cvo.getValue(10).toString());
+                    bankVo.setM_pk_corp((String)transMap.get("orgName"));
+                    bankVo.setM_caved(new Boolean(cvo.getValue(104) == null ? null : cvo.getValue(104).toString()));
+                    bankVo.setOppunitname(cvo.getValue(141) == null ? "" : cvo.getValue(141).toString());
+                    bankVo.setM_vo(subVo);
+                    bankArr[i] = bankVo;
+                }
+            }
+        } catch (BusinessException var8) {
+            ExceptionUtils.wrapBusinessException(var8.getMessage());
+        } catch (Exception var9) {
+            ExceptionUtils.wrapBusinessException(var9.getMessage());
+        }
+
+        return bankArr;
+    }
+
+    public static CQueryVO transQueryVo(BankContrastQueryJsonToVo jsonVo) {
+        CQueryVO cqueryVo = new CQueryVO();
+        cqueryVo.setMoneyAspect(jsonVo.getMoneyAspect());
+        if (jsonVo.getOnlyWrongRec() != null && jsonVo.getOnlyWrongRec().equals("Y")) {
+            cqueryVo.setOnlyWrongRec(UFBoolean.TRUE);
+        } else {
+            cqueryVo.setOnlyWrongRec(UFBoolean.FALSE);
+        }
+
+        cqueryVo.setChecked(jsonVo.getM_blnChecked());
+        if (jsonVo.getIsEqualCheckStyle() != null && jsonVo.getIsEqualCheckStyle().equals("Y")) {
+            cqueryVo.setIsEqualCheckStyle(UFBoolean.TRUE);
+        } else {
+            cqueryVo.setIsEqualCheckStyle(UFBoolean.FALSE);
+        }
+
+        cqueryVo.setDate(jsonVo.getM_strDate());
+        cqueryVo.setEndDate(jsonVo.getM_strEndDate());
+        cqueryVo.setBankBegDate(jsonVo.getBankBegDate());
+        cqueryVo.setBankEndDate(jsonVo.getBankEndDate());
+        cqueryVo.setPk_Account(jsonVo.getM_Pk_Account());
+        cqueryVo.setPk_Corp(jsonVo.getM_Pk_Corp());
+        cqueryVo.setN_voucherType(jsonVo.getN_voucherType());
+        cqueryVo.setCheckStyle(jsonVo.getM_strCheckStyle());
+        cqueryVo.setCheckNO(jsonVo.getM_strCheckNO());
+        cqueryVo.setMoneyArea1(jsonVo.getMoneyArea1());
+        cqueryVo.setMoneyArea2(jsonVo.getMoneyArea2());
+        cqueryVo.setN_pjdate1(jsonVo.getN_pjdate1());
+        cqueryVo.setN_pjdate2(jsonVo.getN_pjdate2());
+        cqueryVo.setN_voucherCode1(jsonVo.getN_voucherCode1());
+        cqueryVo.setBatchNumber(jsonVo.getBatchNumber());
+        cqueryVo.setOppunitname(jsonVo.getOppunitname());
+        return cqueryVo;
+    }
+
+    public static UFDouble getDiff(UFDouble billBalance, UFDouble bankBalance) {
+        UFDouble diff = billBalance.sub(bankBalance).abs();
+        return diff;
+    }
+}

+ 440 - 0
zjcmp_cd/zjcmp_cd/src/public/nc/vo/cmp/cb/CQueryVO.java

@@ -0,0 +1,440 @@
+package nc.vo.cmp.cb;
+
+import nc.vo.pub.ValidationException;
+import nc.vo.pub.ValueObject;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+
+public class CQueryVO extends ValueObject {
+	private static final long serialVersionUID = 3835377111130034560L;
+	private String m_Pk_Corp;
+	private String m_PK_glorgbook;
+	private String[] m_Pk_Account;
+	private Boolean m_blnInitRange;
+	private Boolean m_blnChecked;
+	private Boolean m_blnVerified;
+	private Boolean m_blnBank;
+	private Boolean m_blnIncludeLast = new Boolean(true);
+	private String m_strYear;
+	private UFDate m_strDate;
+	private UFDate m_strEndDate;
+	private UFDate bankBegDate;
+	private UFDate bankEndDate;
+	private String m_strCheckStyle;
+	private UFBoolean isEqualCheckStyle;
+	private String m_strCheckNO;
+	private int moneyAspect = -1;
+	private UFDouble moneyArea1;
+	private UFDouble moneyArea2;
+	private String oppunitname;
+	private String m_cavMan;
+	private String m_cavDate;
+	private String n_madeMan;
+	private String n_voucherType;
+	private String n_voucherCode1;
+	private String n_voucherCode2;
+	private UFDate n_pjdate1;
+	private UFDate n_pjdate2;
+	private int nodecode = 20040110;
+	private boolean m_bflag = true;
+	private String[] pk_corp;
+	private String[] pk_glorgbook;
+	private String pk_sub;
+	private String pk_bank;
+	private Integer number = 5000;
+	private boolean m_cavDetai = false;
+	private boolean m_spread = false;
+	private String pk_link;
+	private UFBoolean onlyWrongRec;
+	public UFBoolean m_isConTally;
+	private String batchNumber;
+	private boolean isMerge;
+	private String moduleCode = null;
+	private boolean isSpred;
+	private Integer Deadline;
+	private UFDate m_stopDate = null;
+
+	public UFDate getM_stopDate() {
+		return this.m_stopDate;
+	}
+
+	public void setM_stopDate(UFDate date) {
+		this.m_stopDate = date;
+	}
+
+	public boolean isMerge() {
+		return this.isMerge;
+	}
+
+	public void setMerge(boolean isMerge) {
+		this.isMerge = isMerge;
+	}
+
+	public Boolean getChecked() {
+		return this.m_blnChecked;
+	}
+
+	public String getCheckNO() {
+		return this.m_strCheckNO;
+	}
+
+	public String getCheckStyle() {
+		return this.m_strCheckStyle;
+	}
+
+	public UFDate getDate() {
+		return this.m_strDate;
+	}
+
+	public UFDate getEndDate() {
+		return this.m_strEndDate;
+	}
+
+	public String getEntityName() {
+		return null;
+	}
+
+	public String getM_cavDate() {
+		return this.m_cavDate;
+	}
+
+	public String getM_cavMan() {
+		return this.m_cavMan;
+	}
+
+	public UFDouble getMoneyArea1() {
+		return this.moneyArea1;
+	}
+
+	public UFDouble getMoneyArea2() {
+		return this.moneyArea2;
+	}
+
+	public int getMoneyAspect() {
+		return this.moneyAspect;
+	}
+
+	public String getN_madeMan() {
+		return this.n_madeMan;
+	}
+
+	public UFDate getN_pjdate1() {
+		return this.n_pjdate1;
+	}
+
+	public UFDate getN_pjdate2() {
+		return this.n_pjdate2;
+	}
+
+	public String getN_voucherCode1() {
+		return this.n_voucherCode1;
+	}
+
+	public String getN_voucherCode2() {
+		return this.n_voucherCode2;
+	}
+
+	public String getN_voucherType() {
+		return this.n_voucherType;
+	}
+
+	public int getNodecode() {
+		return this.nodecode;
+	}
+
+	public String[] getPk_Account() {
+		return this.m_Pk_Account;
+	}
+
+	public String getPk_bank() {
+		return this.pk_bank;
+	}
+
+	public String getPk_Corp() {
+		return this.m_Pk_Corp;
+	}
+
+	public String getPk_link() {
+		return this.pk_link;
+	}
+
+	public String[] getPk_M_corp() {
+		return this.pk_corp;
+	}
+
+	public String getPk_sub() {
+		return this.pk_sub;
+	}
+
+	public Boolean getVerified() {
+		return this.m_blnVerified;
+	}
+
+	public String getYear() {
+		return this.m_strYear;
+	}
+
+	public Boolean isBank() {
+		return this.m_blnBank;
+	}
+
+	public Boolean isChecked() {
+		return this.m_blnChecked;
+	}
+
+	public Boolean isIncludeLast() {
+		return this.m_blnIncludeLast;
+	}
+
+	public Boolean isInitRange() {
+		return this.m_blnInitRange;
+	}
+
+	public boolean isM_bflag() {
+		return this.m_bflag;
+	}
+
+	public boolean isM_cavDetai() {
+		return this.m_cavDetai;
+	}
+
+	public boolean isM_spread() {
+		return this.m_spread;
+	}
+
+	public Boolean isVerified() {
+		return this.m_blnVerified;
+	}
+
+	public void setBank(Boolean newM_blnBank) {
+		this.m_blnBank = newM_blnBank;
+	}
+
+	public void setChecked(Boolean newM_blnChecked) {
+		this.m_blnChecked = newM_blnChecked;
+	}
+
+	public void setCheckNO(String newM_strCheckNO) {
+		this.m_strCheckNO = newM_strCheckNO;
+	}
+
+	public void setCheckStyle(String newM_strCheckStyle) {
+		this.m_strCheckStyle = newM_strCheckStyle;
+	}
+
+	public void setDate(UFDate newM_strDate) {
+		this.m_strDate = newM_strDate;
+	}
+
+	public void setEndDate(UFDate newDate) {
+		this.m_strEndDate = newDate;
+	}
+
+	public void setIncludeLast(Boolean newM_blnIncludeLast) {
+		this.m_blnIncludeLast = newM_blnIncludeLast;
+	}
+
+	public void setInitRange(Boolean newM_blnInitRange) {
+		this.m_blnInitRange = newM_blnInitRange;
+	}
+
+	public void setM_bflag(boolean newM_bflag) {
+		this.m_bflag = newM_bflag;
+	}
+
+	public void setM_cavDate(String newM_cavDate) {
+		this.m_cavDate = newM_cavDate;
+	}
+
+	public void setM_cavDetai(boolean newM_cavDetai) {
+		this.m_cavDetai = newM_cavDetai;
+	}
+
+	public void setM_cavMan(String newM_cavMan) {
+		this.m_cavMan = newM_cavMan;
+	}
+
+	public void setM_spread(boolean newM_spread) {
+		this.m_spread = newM_spread;
+	}
+
+	public void setMoneyArea1(UFDouble newMoneyArea1) {
+		this.moneyArea1 = newMoneyArea1;
+	}
+
+	public void setMoneyArea2(UFDouble newMoneyArea2) {
+		this.moneyArea2 = newMoneyArea2;
+	}
+
+	public void setMoneyAspect(int newMoneyAspect) {
+		this.moneyAspect = newMoneyAspect;
+	}
+
+	public void setN_madeMan(String newN_madeMan) {
+		this.n_madeMan = newN_madeMan;
+	}
+
+	public void setN_pjdate1(UFDate newN_pjdate1) {
+		this.n_pjdate1 = newN_pjdate1;
+	}
+
+	public void setN_pjdate2(UFDate newN_pjdate2) {
+		this.n_pjdate2 = newN_pjdate2;
+	}
+
+	public void setN_voucherCode1(String newN_voucherCode1) {
+		this.n_voucherCode1 = newN_voucherCode1;
+	}
+
+	public void setN_voucherCode2(String newN_voucherCode2) {
+		this.n_voucherCode2 = newN_voucherCode2;
+	}
+
+	public void setN_voucherType(String newN_voucherType) {
+		this.n_voucherType = newN_voucherType;
+	}
+
+	public void setNodecode(int newNodecode) {
+		this.nodecode = newNodecode;
+	}
+
+	public void setPk_Account(String[] newM_Pk_Account) {
+		this.m_Pk_Account = newM_Pk_Account;
+	}
+
+	public void setPk_bank(String newPk_bank) {
+		this.pk_bank = newPk_bank;
+	}
+
+	public void setPk_Corp(String newM_pkCorp) {
+		this.m_Pk_Corp = newM_pkCorp;
+	}
+
+	public void setPk_link(String newPk_link) {
+		this.pk_link = newPk_link;
+	}
+
+	public void setPk_M_corp(String[] newPk_corp) {
+		this.pk_corp = newPk_corp;
+	}
+
+	public void setPk_sub(String newPk_sub) {
+		this.pk_sub = newPk_sub;
+	}
+
+	public void setVerified(Boolean newM_blnVerified) {
+		this.m_blnVerified = newM_blnVerified;
+	}
+
+	public void setYear(String newM_strYear) {
+		this.m_strYear = newM_strYear;
+	}
+
+	public void validate() throws ValidationException {
+	}
+
+	public String getM_PK_glorgbook() {
+		return this.m_PK_glorgbook;
+	}
+
+	public void setM_PK_glorgbook(String m_pk_glorgbook) {
+		this.m_PK_glorgbook = m_pk_glorgbook;
+	}
+
+	public String[] getPk_glorgbook() {
+		return this.pk_glorgbook;
+	}
+
+	public void setPk_glorgbook(String[] pk_glorgbook) {
+		this.pk_glorgbook = pk_glorgbook;
+	}
+
+	public UFBoolean getOnlyWrongRec() {
+		return this.onlyWrongRec;
+	}
+
+	public void setOnlyWrongRec(UFBoolean onlyWrongRec) {
+		this.onlyWrongRec = onlyWrongRec;
+	}
+
+	public UFBoolean getM_isConTally() {
+		return this.m_isConTally;
+	}
+
+	public void setM_isConTally(UFBoolean conTally) {
+		this.m_isConTally = conTally;
+	}
+
+	public Integer getNumber() {
+		return this.number;
+	}
+
+	public void setNumber(Integer number) {
+		this.number = number;
+	}
+
+	public String getBatchNumber() {
+		return this.batchNumber;
+	}
+
+	public void setBatchNumber(String batchNumber) {
+		this.batchNumber = batchNumber;
+	}
+
+	public String getModuleCode() {
+		return this.moduleCode;
+	}
+
+	public void setModuleCode(String moduleCode) {
+		this.moduleCode = moduleCode;
+	}
+
+	public boolean isSpred() {
+		return this.isSpred;
+	}
+
+	public void setSpred(boolean isSpred) {
+		this.isSpred = isSpred;
+	}
+
+	public UFBoolean getIsEqualCheckStyle() {
+		return this.isEqualCheckStyle;
+	}
+
+	public void setIsEqualCheckStyle(UFBoolean isEqualCheckStyle) {
+		this.isEqualCheckStyle = isEqualCheckStyle;
+	}
+
+	public UFDate getBankBegDate() {
+		return this.bankBegDate;
+	}
+
+	public void setBankBegDate(UFDate bankBegDate) {
+		this.bankBegDate = bankBegDate;
+	}
+
+	public UFDate getBankEndDate() {
+		return this.bankEndDate;
+	}
+
+	public void setBankEndDate(UFDate bankEndDate) {
+		this.bankEndDate = bankEndDate;
+	}
+
+	public Integer getDeadline() {
+		return this.Deadline;
+	}
+
+	public void setDeadline(Integer deadline) {
+		this.Deadline = deadline;
+	}
+
+	public String getOppunitname() {
+		return oppunitname;
+	}
+
+	public void setOppunitname(String oppunitname) {
+		this.oppunitname = oppunitname;
+	}
+}