From f7183c871dc5cb2e6bd8338eaa018c3f689c55f6 Mon Sep 17 00:00:00 2001 From: mzr <1562242162@qq.com> Date: Tue, 11 Mar 2025 10:55:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A0=B8=E9=94=801?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gl/lightgl/verify/GlVerifyWebModel.java | 2430 +++++++++++++++++ .../nc/vo/glrp/com/verify/MultiMatch.java | 661 +++++ 2 files changed, 3091 insertions(+) create mode 100644 gl/src/private/nccloud/pubimpl/gl/lightgl/verify/GlVerifyWebModel.java create mode 100644 gl/src/public/nc/vo/glrp/com/verify/MultiMatch.java diff --git a/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/GlVerifyWebModel.java b/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/GlVerifyWebModel.java new file mode 100644 index 0000000..54538b2 --- /dev/null +++ b/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/GlVerifyWebModel.java @@ -0,0 +1,2430 @@ +/*ENgVVTBL/QYrqzND3PB6ToRGmBxhcAFpb7WzTq5L+LQ=*/ +package nccloud.pubimpl.gl.lightgl.verify; + +import nc.bs.framework.common.InvocationInfoProxy; +import nc.bs.logging.Logger; +import nc.gl.utils.*; +import nc.itf.bd.pub.IBDMetaDataIDConst; +import nc.itf.glcom.para.GLParaAccessor; +import nc.itf.glcom.para.GLParaValueConst; +import nc.itf.org.IOrgMetaDataIDConst; +import nc.pub.gl.model.BUWithBookRefModel; +import nc.pubitf.bd.accessor.GeneralAccessorFactory; +import nc.pubitf.bd.accessor.IGeneralAccessor; +import nc.vo.bd.accessor.IBDData; +import nc.vo.bd.account.AccountVO; +import nc.vo.fipub.utils.AccountCalendarUtils; +import nc.vo.fipub.utils.StrTools; +import nc.vo.gateway60.itfs.AccountUtilGL; +import nc.vo.gateway60.itfs.Currency; +import nc.vo.gateway60.itfs.ICurrtypeConst; +import nc.vo.gateway60.pub.GlBusinessException; +import nc.vo.gl.pubvoucher.DetailVO; +import nc.vo.glcom.ass.AssVO; +import nc.vo.glcom.tools.GLPubProxy; +import nc.vo.glrp.com.verify.*; +import nc.vo.glrp.pub.ParaVO; +import nc.vo.glrp.pub.VerifyMsg; +import nc.vo.glrp.pub.VerifyTool; +import nc.vo.glrp.verify.*; +import nc.vo.glrp.verifyobj.ObjQryVO; +import nc.vo.glrp.verifyobj.VerifyObjHeaderVO; +import nc.vo.glrp.verifyobj.VerifyObjItemVO; +import nc.vo.glrp.verifyobj.VerifyObjVO; +import nc.vo.org.OrgVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; +import nccloud.dto.gl.lightgl.ValueObject; +import nccloud.dto.gl.lightgl.ValueObjectMap; +import nccloud.dto.gl.lightgl.displayformattool.ShowContentCenter; +import nccloud.dto.gl.verify.VerifyDetailWebVO; +import nccloud.dto.gl.verify.VerifyDisplogWebVO; + +import java.util.*; + +public class GlVerifyWebModel { + + private static final String REDBLUE = "GLRedBlueMatch"; + + private static final String VERIFY = "GLSingleMatch"; + + private static final String VERIFY_MULTI = "GLMultiMatch"; + + private static final String LOGNAME = "nc.vo.glrp.verify.VerifyLogVO"; + + private VerifyRuleVO m_rulevo; + + private String m_sDateName; + + private VerifyCom m_VerifyCom; + + /* 核销对象 */ + private VerifyObjVO m_verifyObj; + + /* 借方凭证数据 */ + private VerifyDetailVO[] m_DebitVerify; + + /* 贷方凭证数据 */ + private VerifyDetailVO[] m_CreditVerify; + + /* 核销标准 */ + private VerifyStandardVO m_Standardvo; + + /* 历史纪录状态 */ + private boolean m_bSum = true; + + private LogFilterCondVO m_historyCondvo; + + private GlVerifyDisplogVO[] m_sumLogs; + + private GlVerifyDisplogVO[] m_detailLogs; + + private Hashtable m_hashSelectedSumLogs = new Hashtable(); + + private GlVerifyDisplogVO[] m_selectedDetailLogs; + + /* 与总账凭证分录对应的核销凭证分录 */ + private VerifyDetailVO m_voDetail; + + /* 凭证过滤条件vo */ + private FilterCondVO m_voQry; + + /* 当前是否对照状态 */ + private boolean m_Fetch = false; + + /* 设置对照的主方向 */ + private int m_FetchDirect = 0;// 1为借,-1为贷 + + private String pk_accountingbook; + + private String[] pk_units; + + protected FormatVO format; + + /* 选中科目 */ + private String m_pk_accsubj; + + private ParaVO oEnv; + + /* 借方凭证显示数据 */ + private Map>[] m_DebitVerifyWeb; + + /* 贷方凭证显示数据 */ + private Map>[] m_CreditVerifyWeb; + + /* 核销历史汇总显示数据*/ + private VerifyDisplogWebVO[] m_sumLogsWeb; + + /* 核销历史明细显示数据*/ + private VerifyDisplogWebVO[] m_detailLogsWeb; + + /** + *

Title: GlVerifyWebModel

+ *

Description: 默认构造方法

+ */ + public GlVerifyWebModel() { + } + + /** + * @param @param voDetail + * @return void + * @throws BusinessException + * @throws Exception + * @throws + * @Title: appendDetailInfo + * @Description: TODO(添加核销分录中的信息, 主要是添加科目信息) + */ + @SuppressWarnings("unchecked") + public Map>[] appendDetailInfo(VerifyDetailVO[] voDetail) throws BusinessException { + if (voDetail == null || voDetail.length == 0) { + return null; + } + + List> verifyDetailList = new ArrayList>(); + Map accountMap = new HashMap(); + Map voucherTypeMap = new HashMap(); + Map unitMap = new HashMap(); + for (int i = 0; i < voDetail.length; i++) { + accountMap.put(voDetail[i].getPk_accsubj(), null); + voucherTypeMap.put(voDetail[i].getPk_vouchertype(), null); + unitMap.put(voDetail[i].getPk_unit_v(), null); + } + + AccountVO[] account = AccountUtilGL.queryByPks(accountMap.keySet().toArray(new String[0]), + AccountCalendarUtils.getStdDate()); + IGeneralAccessor accessor = GeneralAccessorFactory.getAccessor(IBDMetaDataIDConst.VOUCHERTYPE); + IBDData[] voucherTypeData = accessor.getDocbyPks(voucherTypeMap.keySet().toArray(new String[0])); + accessor = GeneralAccessorFactory.getAccessor(IOrgMetaDataIDConst.ORG); + IBDData[] unitData = accessor.getDocbyPks(unitMap.keySet().toArray(new String[0])); + accessor = GeneralAccessorFactory.getAccessor(IOrgMetaDataIDConst.ORG_V); + IBDData[] unitvData = accessor.getDocbyPks(unitMap.keySet().toArray(new String[0])); + + for (int i = 0; i < account.length; i++) { + if (account[i] != null) + accountMap.put(account[i].getPk_accasoa(), account[i]); + } + + for (int i = 0; i < voucherTypeData.length; i++) { + if (voucherTypeData[i] != null) + voucherTypeMap.put(voucherTypeData[i].getPk(), voucherTypeData[i]); + } + + for (int i = 0; i < unitData.length; i++) { + if (unitData[i] != null) + unitMap.put(unitData[i].getPk(), unitData[i]); + } + + for (int i = 0; i < unitvData.length; i++) { + if (unitvData[i] != null) + unitMap.put(unitvData[i].getPk(), unitvData[i]); + } + + GlCurrAmountFormat amountFormater = new GlCurrAmountFormat(); + String local_currtype = Currency.getLocalCurrPK(getPk_accountingbook()); + Integer local_currDigit = 2; + local_currDigit = Currency.getCurrDigit(local_currtype); + for (int i = 0; i < voDetail.length; i++) { + ValueObjectMap verifyDetail = tranferVerifyDetailMap(voDetail[i]); + Map assinfo = new HashMap(); + assinfo.put("value", ShowContentCenter.getShowAss( + voDetail[i].getPk_glorgbook(), (AssVO[]) voDetail[i].getAss())); + assinfo.put("display", ShowContentCenter.getShowAss( + voDetail[i].getPk_glorgbook(), (AssVO[]) voDetail[i].getAss())); + verifyDetail.getData().put("assinfo", assinfo); + + AccountVO accountvo = accountMap.get(voDetail[i].getPk_accsubj()); + IBDData vouchertype = voucherTypeMap.get(voDetail[i].getPk_vouchertype()); + IBDData unit = unitMap.get(voDetail[i].getPk_unit_v()); + if (accountvo != null) { + Map subjCodeMap = new HashMap(); + subjCodeMap.put("value", accountvo.getCode()); + subjCodeMap.put("display", accountvo.getCode()); + Map subjNameMap = new HashMap(); + subjNameMap.put("value", GLMultiLangUtil.getMultiDispName(accountvo)); + subjNameMap.put("display", GLMultiLangUtil.getMultiDispName(accountvo)); + verifyDetail.getData().put("m_sSubjCode", subjCodeMap); + verifyDetail.getData().put("m_sSubjName", subjNameMap); + } + if (vouchertype != null && voDetail[i].getDispVouchNO() != null) { + ((Map) verifyDetail.getData().get("m_VoucherNo")).put("display", vouchertype.getName().toString() + "_" + voDetail[i].getDispVouchNO()); + } + if (unit != null) { + ((Map) verifyDetail.getData().get("m_pk_unit_v")).put("display", unit.getName().toString()); + } + String currtype = voDetail[i].getCurrPk(); + Integer currDigit = 2; + currDigit = Currency.getCurrDigit(currtype); + if (currtype != null) { + try { + if (voDetail[i].getDebitamount() != null) { + ((Map) verifyDetail.getData().get("m_debitamount")).put("display", amountFormater.formatAmount(voDetail[i].getDebitamount(), currtype)); + } + ((Map) verifyDetail.getData().get("m_debitamount")).put("scale", currDigit); + } catch (Exception err) { + try { + if (voDetail[i].getDebitamount() != null) { + ((Map) verifyDetail.getData().get("m_debitamount")).put("display", amountFormater.formatAmount(voDetail[i].getDebitamount(), local_currtype)); + } + ((Map) verifyDetail.getData().get("m_debitamount")).put("scale", local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + try { + if (voDetail[i].getCreditamount() != null) { + ((Map) verifyDetail.getData().get("m_creditamount")).put("display", amountFormater.formatAmount(voDetail[i].getCreditamount(), currtype)); + } + ((Map) verifyDetail.getData().get("m_creditamount")).put("scale", currDigit); + } catch (Exception err) { + try { + if (voDetail[i].getCreditamount() != null) { + ((Map) verifyDetail.getData().get("m_creditamount")).put("display", amountFormater.formatAmount(voDetail[i].getCreditamount(), local_currtype)); + } + ((Map) verifyDetail.getData().get("m_creditamount")).put("scale", local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + try { + if (voDetail[i].getBalancedebitamount() != null) { + ((Map) verifyDetail.getData().get("m_Balancedebitamount")).put("display", amountFormater.formatAmount(voDetail[i].getBalancedebitamount(), currtype)); + } + ((Map) verifyDetail.getData().get("m_Balancedebitamount")).put("scale", currDigit); + } catch (Exception err) { + try { + if (voDetail[i].getBalancedebitamount() != null) { + ((Map) verifyDetail.getData().get("m_Balancedebitamount")).put("display", amountFormater.formatAmount(voDetail[i].getBalancedebitamount(), local_currtype)); + } + ((Map) verifyDetail.getData().get("m_Balancedebitamount")).put("scale", local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + try { + if (voDetail[i].getBalancecreditamount() != null) { + ((Map) verifyDetail.getData().get("m_Balancecreditamount")).put("display", amountFormater.formatAmount(voDetail[i].getBalancecreditamount(), currtype)); + } + ((Map) verifyDetail.getData().get("m_Balancecreditamount")).put("scale", currDigit); + } catch (Exception err) { + try { + if (voDetail[i].getBalancecreditamount() != null) { + ((Map) verifyDetail.getData().get("m_Balancecreditamount")).put("display", amountFormater.formatAmount(voDetail[i].getBalancecreditamount(), local_currtype)); + } + ((Map) verifyDetail.getData().get("m_Balancecreditamount")).put("scale", local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + try { + if (voDetail[i].getDebit_Money_Y() != null) { + ((Map) verifyDetail.getData().get("m_dDebit_Money_Y")).put("display", amountFormater.formatAmount(voDetail[i].getDebit_Money_Y(), currtype)); + } + ((Map) verifyDetail.getData().get("m_dDebit_Money_Y")).put("scale", currDigit); + } catch (Exception err) { + try { + if (voDetail[i].getDebit_Money_Y() != null) { + ((Map) verifyDetail.getData().get("m_dDebit_Money_Y")).put("display", amountFormater.formatAmount(voDetail[i].getDebit_Money_Y(), local_currtype)); + } + ((Map) verifyDetail.getData().get("m_dDebit_Money_Y")).put("scale", local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + try { + if (voDetail[i].getCredit_Money_Y() != null) { + ((Map) verifyDetail.getData().get("m_dCredit_Money_Y")).put("display", amountFormater.formatAmount(voDetail[i].getCredit_Money_Y(), currtype)); + } + ((Map) verifyDetail.getData().get("m_dCredit_Money_Y")).put("scale", currDigit); + } catch (Exception err) { + try { + if (voDetail[i].getCredit_Money_Y() != null) { + ((Map) verifyDetail.getData().get("m_dCredit_Money_Y")).put("display", amountFormater.formatAmount(voDetail[i].getCredit_Money_Y(), local_currtype)); + } + ((Map) verifyDetail.getData().get("m_dCredit_Money_Y")).put("scale", local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + } + if (local_currtype != null) { + try { + if (voDetail[i].getLocaldebitamount() != null) { + ((Map) verifyDetail.getData().get("m_localdebitamount")).put("display", + amountFormater.formatAmount(voDetail[i].getLocaldebitamount(), local_currtype)); + } + if (voDetail[i].getLocalcreditamount() != null) { + ((Map) verifyDetail.getData().get("m_localcreditamount")).put("display", + amountFormater.formatAmount(voDetail[i].getLocalcreditamount(), local_currtype)); + } + if (voDetail[i].getBalancelocaldebitamount() != null) { + ((Map) verifyDetail.getData().get("m_Balancelocaldebitamount")).put("display", + amountFormater.formatAmount(voDetail[i].getBalancelocaldebitamount(), local_currtype)); + } + if (voDetail[i].getBalancelocalcreditamount() != null) { + ((Map) verifyDetail.getData().get("m_Balancelocalcreditamount")).put("display", + amountFormater.formatAmount(voDetail[i].getBalancelocalcreditamount(), local_currtype)); + } + if (voDetail[i].getDebit_Money_B() != null) { + ((Map) verifyDetail.getData().get("m_dDebit_Money_B")).put("display", + amountFormater.formatAmount(voDetail[i].getDebit_Money_B(), local_currtype)); + } + if (voDetail[i].getCredit_Money_B() != null) { + ((Map) verifyDetail.getData().get("m_dCredit_Money_B")).put("display", + amountFormater.formatAmount(voDetail[i].getCredit_Money_B(), local_currtype)); + } + ((Map) verifyDetail.getData().get("m_localdebitamount")).put("scale", local_currDigit); + ((Map) verifyDetail.getData().get("m_localcreditamount")).put("scale", local_currDigit); + ((Map) verifyDetail.getData().get("m_Balancelocaldebitamount")).put("scale", local_currDigit); + ((Map) verifyDetail.getData().get("m_Balancelocalcreditamount")).put("scale", local_currDigit); + ((Map) verifyDetail.getData().get("m_dDebit_Money_B")).put("scale", local_currDigit); + ((Map) verifyDetail.getData().get("m_dCredit_Money_B")).put("scale", local_currDigit); + verifyDetailList.add(verifyDetail.getData()); + } catch (Exception e) { + throw new BusinessException(e); + } + } + } + return verifyDetailList.toArray(new Map[0]); + } + + public ValueObjectMap tranferVerifyDetailMap(VerifyDetailVO detailVO) { + ValueObjectMap verifyDetailMap = new ValueObjectMap(); + Map map = new HashMap(); + if (detailVO.getAssid() != null) { + verifyDetailMap.getData().put("m_assid", map); + } + + if (detailVO.getAss() != null) { + verifyDetailMap.getData().put("m_voAss", detailVO.getAss()); + } + + map = new HashMap(); + if (detailVO.getBalancecreditamount() != null) { + map.put("value", detailVO.getBalancecreditamount()); + } + verifyDetailMap.getData().put("m_Balancecreditamount", map); + + map = new HashMap(); + if (detailVO.getBalancedebitamount() != null) { + map.put("value", detailVO.getBalancedebitamount()); + } + verifyDetailMap.getData().put("m_Balancedebitamount", map); + + map = new HashMap(); + if (detailVO.getBalancelocalcreditamount() != null) { + map.put("value", detailVO.getBalancelocalcreditamount()); + } + verifyDetailMap.getData().put("m_Balancelocalcreditamount", map); + + map = new HashMap(); + if (detailVO.getBalancelocaldebitamount() != null) { + map.put("value", detailVO.getBalancelocaldebitamount()); + } + verifyDetailMap.getData().put("m_Balancelocaldebitamount", map); + + if (detailVO.getBusinessdate() != null) { + Map business = new HashMap(); + business.put("value", detailVO.getBusinessdate()); + business.put("display", DataFormatUtilGL.formatUFDateTime(new UFDateTime(detailVO.getBusinessdate().getMillis()))); + verifyDetailMap.getData().put("m_Businessdate", business); + } + + map = new HashMap(); + if (detailVO.getCredit_Money_B() != null) { + map.put("value", detailVO.getCredit_Money_B()); + } + verifyDetailMap.getData().put("m_dCredit_Money_B", map); + + map = new HashMap(); + if (detailVO.getCredit_Money_S() != null) { + map.put("value", detailVO.getCredit_Money_S()); + } + verifyDetailMap.getData().put("m_dCredit_Money_S", map); + + map = new HashMap(); + if (detailVO.getCredit_Money_Y() != null) { + map.put("value", detailVO.getCredit_Money_Y()); + } + verifyDetailMap.getData().put("m_dCredit_Money_Y", map); + + map = new HashMap(); + if (detailVO.getCreditamount() != null) { + map.put("value", detailVO.getCreditamount()); + } + verifyDetailMap.getData().put("m_creditamount", map); + + if (detailVO.getCurrCode() != null) { + map = new HashMap(); + map.put("value", detailVO.getCurrCode()); + map.put("display", detailVO.getCurrCode()); + verifyDetailMap.getData().put("m_sCurrCode", map); + } + if (detailVO.getCurrName() != null) { + map = new HashMap(); + map.put("value", detailVO.getCurrName()); + map.put("display", detailVO.getCurrName()); + verifyDetailMap.getData().put("m_sCurrName", map); + } + + map = new HashMap(); + if (detailVO.getDebit_Money_B() != null) { + map.put("value", detailVO.getDebit_Money_B()); + } + verifyDetailMap.getData().put("m_dDebit_Money_B", map); + + map = new HashMap(); + if (detailVO.getDebit_Money_S() != null) { + map.put("value", detailVO.getDebit_Money_S()); + } + verifyDetailMap.getData().put("m_dDebit_Money_S", map); + + map = new HashMap(); + if (detailVO.getDebit_Money_Y() != null) { + map.put("value", detailVO.getDebit_Money_Y()); + } + verifyDetailMap.getData().put("m_dDebit_Money_Y", map); + + map = new HashMap(); + if (detailVO.getDebitamount() != null) { + map.put("value", detailVO.getDebitamount()); + } + verifyDetailMap.getData().put("m_debitamount", map); + + if (detailVO.getDetailindex() != null) { + map = new HashMap(); + map.put("value", detailVO.getDetailindex()); + map.put("display", detailVO.getDetailindex()); + verifyDetailMap.getData().put("m_detailindex", map); + } + + if (detailVO.getExchangeRate_B() != null) { + map = new HashMap(); + map.put("value", detailVO.getExchangeRate_B()); + verifyDetailMap.getData().put("m_excrate1", map); + } + + if (detailVO.getExchangeRate_F() != null) { + map = new HashMap(); + map.put("value", detailVO.getExchangeRate_F()); + verifyDetailMap.getData().put("m_excrate2", map); + } + + if (detailVO.getExplanation() != null) { + map = new HashMap(); + map.put("value", detailVO.getExplanation()); + map.put("display", detailVO.getExplanation()); + verifyDetailMap.getData().put("m_explanation", map); + } + + if (detailVO.getInitFlag() != null) { + map = new HashMap(); + map.put("value", detailVO.getInitFlag()); + verifyDetailMap.getData().put("m_InitFlag", map); + } + + if (detailVO.getIsverifyflag() != null) { + map = new HashMap(); + map.put("value", detailVO.getIsverifyflag()); + verifyDetailMap.getData().put("m_isverifyflag", map); + } + + map = new HashMap(); + if (detailVO.getLocalcreditamount() != null) { + map.put("value", detailVO.getLocalcreditamount()); + } + verifyDetailMap.getData().put("m_localcreditamount", map); + + map = new HashMap(); + if (detailVO.getLocaldebitamount() != null) { + map.put("value", detailVO.getLocaldebitamount()); + } + verifyDetailMap.getData().put("m_localdebitamount", map); + + if (detailVO.getNetbankflag() != null) { + map = new HashMap(); + map.put("value", detailVO.getNetbankflag()); + map.put("display", detailVO.getNetbankflag()); + verifyDetailMap.getData().put("m_netbankflag", map); + } + if (detailVO.getDirect() != null) { + map = new HashMap(); + map.put("value", detailVO.getDirect()); + verifyDetailMap.getData().put("m_orientation", map); + } + if (detailVO.getPk_accsubj() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_accsubj()); + verifyDetailMap.getData().put("m_pk_accsubj", map); + } + if (detailVO.getPk_corp() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_corp()); + verifyDetailMap.getData().put("m_Pk_corp", map); + } + if (detailVO.getCurrPk() != null) { + map = new HashMap(); + map.put("value", detailVO.getCurrPk()); + verifyDetailMap.getData().put("m_pk_currtype", map); + } + if (detailVO.getPk_detail() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_detail()); + verifyDetailMap.getData().put("m_pk_detail", map); + } + if (detailVO.getPk_glorgbook() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_glorgbook()); + verifyDetailMap.getData().put("pk_glorgbook", map); + } + if (detailVO.getPk_manager() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_manager()); + verifyDetailMap.getData().put("m_pk_manager", map); + } + if (detailVO.getPk_prepared() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_prepared()); + verifyDetailMap.getData().put("m_pk_prepared", map); + } + if (detailVO.getPrepareddate() != null) { + Map preparedateMap = new HashMap(); + preparedateMap.put("value", detailVO.getPrepareddate()); + preparedateMap.put("display", DataFormatUtilGL.formatUFDateTime(new UFDateTime(detailVO.getPrepareddate().getMillis()))); + verifyDetailMap.getData().put("m_prepareddate", preparedateMap); + } + if (detailVO.getPrice() != null) { + map = new HashMap(); + map.put("value", detailVO.getPrice()); + verifyDetailMap.getData().put("m_price", map); + } + if (detailVO.getPk_sob() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_sob()); + verifyDetailMap.getData().put("m_pk_sob", map); + } + if (detailVO.getPk_unit() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_unit()); + verifyDetailMap.getData().put("m_pk_unit", map); + } + if (detailVO.getPk_unit_v() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_unit_v()); + verifyDetailMap.getData().put("m_pk_unit_v", map); + } + if (detailVO.getPrimaryKey() != null) { + map = new HashMap(); + map.put("value", detailVO.getPrimaryKey()); + verifyDetailMap.getData().put("m_Pk_VerifyDetail", map); + } + if (detailVO.getPk_voucher() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_voucher()); + verifyDetailMap.getData().put("m_Pk_voucher", map); + } + if (detailVO.getPk_vouchertype() != null) { + map = new HashMap(); + map.put("value", detailVO.getPk_vouchertype()); + verifyDetailMap.getData().put("m_pk_vouchertype", map); + } + if (detailVO.getSubjCode() != null) { + map = new HashMap(); + map.put("value", detailVO.getSubjCode()); + verifyDetailMap.getData().put("m_sSubjCode", map); + } + if (detailVO.getName() != null) { + map = new HashMap(); + map.put("value", detailVO.getName()); + verifyDetailMap.getData().put("m_sSubjName", map); + } + if (detailVO.getTs() != null) { + map = new HashMap(); + map.put("value", detailVO.getTs()); + verifyDetailMap.getData().put("m_ts", map); + } + if (detailVO.getVerifyNo() != null) { + map = new HashMap(); + map.put("value", detailVO.getVerifyNo()); + map.put("display", detailVO.getVerifyNo()); + verifyDetailMap.getData().put("m_VerifyNo", map); + } + if (detailVO.getVoucherName() != null) { + map = new HashMap(); + map.put("value", detailVO.getVoucherName()); + verifyDetailMap.getData().put("m_sVoucherName", map); + } + if (detailVO.getVoucherNo() != null) { + map = new HashMap(); + map.put("value", detailVO.getVoucherNo()); + verifyDetailMap.getData().put("m_VoucherNo", map); + } + if (detailVO.getDispVouchNO() != null) { + map = new HashMap(); + map.put("value", detailVO.getDispVouchNO()); + verifyDetailMap.getData().put("m_sDispVouchNO", map); + } + if (detailVO.getVoucherSubName() != null) { + map = new HashMap(); + map.put("value", detailVO.getVoucherSubName()); + verifyDetailMap.getData().put("m_sVoucherSubName", map); + } + + return verifyDetailMap; + } + + /** + * @param @param voDetail + * @return void + * @throws + * @Title: appendDetailInfo + * @Description: TODO(添加核销分录中的信息, 主要是添加科目信息) + */ + public VerifyDisplogWebVO[] appendLogInfo(GlVerifyDisplogVO[] displogVO) throws BusinessException { + if (displogVO == null || displogVO.length == 0) { + return null; + } + + VerifyDisplogWebVO[] verifyDisplogWebVOs = new VerifyDisplogWebVO[displogVO.length]; + Map unitMap = new HashMap(); + for (int i = 0; i < displogVO.length; i++) { + unitMap.put(displogVO[i].getCredit_PkUnitV(), null); + unitMap.put(displogVO[i].getDebit_PkUnitV(), null); + } + + IGeneralAccessor accessor = GeneralAccessorFactory.getAccessor(IOrgMetaDataIDConst.ORG); + IBDData[] unitData = accessor.getDocbyPks(unitMap.keySet().toArray(new String[0])); + accessor = GeneralAccessorFactory.getAccessor(IOrgMetaDataIDConst.ORG_V); + IBDData[] unitvData = accessor.getDocbyPks(unitMap.keySet().toArray(new String[0])); + for (int i = 0; i < unitData.length; i++) { + if (unitData[i] != null) + unitMap.put(unitData[i].getPk(), unitData[i]); + } + for (int i = 0; i < unitvData.length; i++) { + if (unitvData[i] != null) + unitMap.put(unitvData[i].getPk(), unitvData[i]); + } + + GlNumberFormat numberFormatter = new GlNumberFormat(); + GlCurrAmountFormat amountFormater = new GlCurrAmountFormat(); + String local_currtype = Currency.getLocalCurrPK(getPk_accountingbook()); + Integer local_currDigit = 2; + local_currDigit = Currency.getCurrDigit(local_currtype); + for (int i = 0; i < displogVO.length; i++) { + verifyDisplogWebVOs[i] = new VerifyDisplogWebVO(displogVO[i]); + ValueObject credit_assInfo = new ValueObject(); + credit_assInfo.setValue(ShowContentCenter.getShowAss( + this.getPk_accountingbook(), (AssVO[]) displogVO[i].getCredit_AssVO())); + credit_assInfo.setDisplay(ShowContentCenter.getShowAss( + this.getPk_accountingbook(), (AssVO[]) displogVO[i].getCredit_AssVO())); + verifyDisplogWebVOs[i].setCredit_assInfo(credit_assInfo); + + ValueObject debit_assInfo = new ValueObject(); + debit_assInfo.setValue(ShowContentCenter.getShowAss( + this.getPk_accountingbook(), (AssVO[]) displogVO[i].getDebit_AssVO())); + debit_assInfo.setDisplay(ShowContentCenter.getShowAss( + this.getPk_accountingbook(), (AssVO[]) displogVO[i].getDebit_AssVO())); + verifyDisplogWebVOs[i].setDebit_assInfo(debit_assInfo); + + IBDData unit = unitMap.get(displogVO[i].getCredit_PkUnitV()); + if (unit != null) { + verifyDisplogWebVOs[i].getM_sCredit_PkUnit().setDisplay(unit.getName().toString()); + verifyDisplogWebVOs[i].getM_sCredit_PkUnitV().setDisplay(unit.getName().toString()); + } + unit = unitMap.get(displogVO[i].getDebit_PkUnitV()); + if (unit != null) { + verifyDisplogWebVOs[i].getM_sDebit_PkUnit().setDisplay(unit.getName().toString()); + verifyDisplogWebVOs[i].getM_sDebit_PkUnitV().setDisplay(unit.getName().toString()); + } + + verifyDisplogWebVOs[i].getM_credit_s().setDisplay(numberFormatter.format( + displogVO[i].getCredit_s(), getQuantityDigit())); + verifyDisplogWebVOs[i].getM_credit_s().setScale(getQuantityDigit()); + verifyDisplogWebVOs[i].getM_debit_s().setDisplay(numberFormatter.format( + displogVO[i].getDebit_s(), getQuantityDigit())); + verifyDisplogWebVOs[i].getM_debit_s().setScale(getQuantityDigit()); + + String currtype = displogVO[i].getPk_curr(); + Integer currDigit = 2; + currDigit = Currency.getCurrDigit(currtype); + if (currtype != null) { + try { + verifyDisplogWebVOs[i].getM_debit_y().setDisplay( + amountFormater.formatAmount(displogVO[i].getDebit_y(), currtype)); + verifyDisplogWebVOs[i].getM_debit_y().setScale(currDigit); + } catch (Exception err) { + try { + verifyDisplogWebVOs[i].getM_debit_y().setDisplay( + amountFormater.formatAmount(displogVO[i].getDebit_y(), local_currtype)); + verifyDisplogWebVOs[i].getM_debit_y().setScale(local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + try { + verifyDisplogWebVOs[i].getM_credit_y().setDisplay( + amountFormater.formatAmount(displogVO[i].getCredit_y(), currtype)); + verifyDisplogWebVOs[i].getM_credit_y().setScale(currDigit); + } catch (Exception err) { + try { + verifyDisplogWebVOs[i].getM_credit_y().setDisplay( + amountFormater.formatAmount(displogVO[i].getCredit_y(), local_currtype)); + verifyDisplogWebVOs[i].getM_credit_y().setScale(local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + } + if (local_currtype != null) { + try { + verifyDisplogWebVOs[i].getM_credit_b().setDisplay( + amountFormater.formatAmount(displogVO[i].getCredit_b(), local_currtype)); + verifyDisplogWebVOs[i].getM_debit_b().setDisplay( + amountFormater.formatAmount(displogVO[i].getDebit_b(), local_currtype)); + verifyDisplogWebVOs[i].getM_credit_b().setScale(local_currDigit); + verifyDisplogWebVOs[i].getM_debit_b().setScale(local_currDigit); + } catch (Exception e) { + throw new BusinessException(e); + } + } + } + return verifyDisplogWebVOs; + } + + /** + * @param @throws java.lang.Exception + * @return void + * @throws + * @Title: beforeVerify + * @Description: TODO(核销前调用, 主要校验核销对象是否仍存在) + */ + public void checkVerifyObj(Map varMap) throws BusinessException { + try { + String pk_subj = (String) varMap.get("pk_accasoa"); + if (pk_subj == null || pk_subj.length() <= 0) { + m_verifyObj = null; + m_pk_accsubj = null; + } else { + m_pk_accsubj = pk_subj; + String[] subj_pks = VerifyTool.getInstance().getUpLevelSubjPKs(getPk_accountingbook(), pk_subj); + ObjQryVO qryVO = new ObjQryVO(); + qryVO.setPk_glorgbook(getPk_accountingbook()); + qryVO.setPk_accSubjs(subj_pks); + m_verifyObj = GLPubProxy.getRemoteVerifyobj().findObjbyCond(qryVO); + if (m_verifyObj == null || m_verifyObj.getParentVO() == null) { + m_verifyObj = null; + } else { + /* 向核销对象中添加科目编码和名称信息 */ + AccountVO voSubj = AccountUtilGL.findByPrimaryKey(((VerifyObjHeaderVO) m_verifyObj.getParentVO()).getPk_accsubj()); + ((VerifyObjHeaderVO) m_verifyObj.getParentVO()).setAccSubjCode(voSubj.getCode()); + ((VerifyObjHeaderVO) m_verifyObj.getParentVO()).setAccSubjName(voSubj.getName()); + } + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + m_verifyObj = null; + m_pk_accsubj = null; + throw new BusinessException(e); + } + } + + /** + * a功能: 作者:宋涛 创建时间:(2003-5-9 15:41:27) 参数:<|> 返回值: 算法: + * + * @return VerifyDetailVO[] + */ + public VerifyDetailVO[] getCreditVerify() { + return m_CreditVerify; + } + + /** + * 功能:得到model中的数据 作者:宋涛 创建时间:(2003-5-9 10:56:41) 参数:<|>true 借方,false 贷方 返回值: + * 算法: + * + * @param bDebit boolean + * @return VerifyDetailVO[] + */ + public VerifyDetailVO[] getData(boolean bDebit) { + if (bDebit) { + return getDebitVerify(); + } else { + return getCreditVerify(); + } + } + + /** + * 功能: 作者:宋涛 创建时间:(2003-5-9 15:38:51) 参数:<|> 返回值: 算法: + * + * @return VerifyDetailVO[] + */ + public VerifyDetailVO[] getDebitVerify() { + return m_DebitVerify; + } + + /** + * 功能:得到历史查询条件 作者:宋涛 创建时间:(2003-5-19 20:45:00) 参数:<|> 返回值: 算法: + * + * @return nc.vo.glrp.verify.LogFilterCondVO + */ + public LogFilterCondVO getHistoryCond() { + return m_historyCondvo; + } + + /** + * 功能: 作者:宋涛 创建时间:(2003-5-9 11:55:36) 参数:<|> 返回值: 算法: + * + * @return boolean + */ + public boolean getHistoryState() { + return m_bSum; + } + + + /* (非 Javadoc) + *

Title: getHistroyDataCount

+ *

Description: 得到历史纪录数量

+ * @return + * @throws java.lang.Exception + * @see nc.ui.glrp.verify.IVerifyModel#getHistroyDataCount() + */ + public int getHistroyDataCount() throws BusinessException { + try { + if (getHistoryState()) { + return m_sumLogs == null ? 0 : m_sumLogs.length; + } else { + return m_selectedDetailLogs == null ? 0 : m_selectedDetailLogs.length; + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(e.getMessage()); + } + } + + /** + * 核销汇总数据 + * + * @return + * @throws BusinessException + */ + public GlVerifyDisplogVO[] getHistroySumData() { + return m_sumLogs; + } + + /** + * 核销明细数据 + * + * @return + * @throws BusinessException + */ + public GlVerifyDisplogVO[] getHistroyData() { + return m_detailLogs; + } + + /** + * 核销明细数据 + * + * @return + * @throws BusinessException + */ + public GlVerifyDisplogVO[] setHistroyData(GlVerifyDisplogVO[] displogVO) { + return m_detailLogs = displogVO; + } + + /** + * 功能:得到凭证过滤查询条件vo 作者:宋涛 创建时间:(2003-5-19 19:35:50) 参数:<|> 返回值: 算法: + * + * @return FilterCondVO + */ + public FilterCondVO getQryVo() { + return m_voQry; + } + + /** + * @param @return + * @return VerifyRuleVO + * @throws + * @Title: getRuleVO + * @Description: TODO(生成核销规则VO) + */ + private VerifyRuleVO getRuleVO() { + if (m_rulevo == null) { + m_rulevo = new VerifyRuleVO(); + m_rulevo.setLogClassName(LOGNAME); + m_rulevo.setDateName(m_sDateName); + m_rulevo.setSimVerify(UFBoolean.FALSE); + UFBoolean m_bFarthest = UFBoolean.FALSE; +// Object o081 = SysInitQuery.getParaString(pk_accountingbook, "GL081"); +// m_bFarthest = UFBoolean.valueOf(o081.equals(GLParaValueConst.GL081_EARLIEST) ? true : false); + m_bFarthest = UFBoolean.valueOf(getEnvirment(getPk_accountingbook()).isFarthest()); + m_rulevo.setVerifySeq(m_bFarthest); + m_rulevo.sethasAgio(UFBoolean.FALSE); + m_rulevo.setStrictMatch(UFBoolean.TRUE); + m_rulevo.setSortAscend(m_bFarthest); + m_rulevo.setMultiMnyVerify(UFBoolean.FALSE); + try { +// m_rulevo.setBatchId(GLPubProxy.getRemoteVerifyLog().getVerifyBatchid()); + m_rulevo.setPairNum(Integer.valueOf(0)); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + } + } + return m_rulevo; + } + + public ParaVO getEnvirment(String pk_accountingbook) { + if (oEnv == null) { + try { + oEnv = GLPubProxy.getRemoteVerifyobj().initEnvirment(pk_accountingbook); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new GlBusinessException(e.getMessage()); + } + + } + return (ParaVO) oEnv; + } + + /** + * @param @param isDebit true借方,false贷方 + * @param @return + * @return VerifyDetailVO[] + * @throws + * @Title: getSelectedData + * @Description: TODO(取得选择的借方或贷方数据) + */ + public VerifyDetailVO[] getSelectedData(boolean isDebit) { + VerifyDetailVO[] verifyDetailVOs = isDebit ? getDebitVerify() : getCreditVerify(); + if (verifyDetailVOs == null || verifyDetailVOs.length == 0) { + return null; + } + List verifyDetailVOList = new ArrayList(); + for (int i = 0; i < verifyDetailVOs.length; i++) { + if (verifyDetailVOs[i] != null) { + verifyDetailVOList.add(verifyDetailVOs[i]); + } + } + if (verifyDetailVOList.size() > 0) { + return verifyDetailVOList.toArray(new VerifyDetailVO[0]); + } + return null; + } + + /* (非 Javadoc) + *

Title: getSelectedLogs

+ *

Description: 反核销时得到选中的log记录

+ * @return + * @see nc.ui.glrp.verify.IVerifyModel#getSelectedLogs() + */ + public GlVerifyDisplogVO[] getSelectedLogs() { + if (m_detailLogs == null || m_sumLogs == null) { + return null; + } + List al = new ArrayList(); + if (getHistoryState()) { /* 汇总状态 */ + for (int i = 0; i < m_detailLogs.length; i++) { + if (m_hashSelectedSumLogs.get(m_detailLogs[i].getBatchid()) != null) { + m_detailLogs[i].setbSelected(VerifyMsg.TRUE); + al.add(m_detailLogs[i]); + } + } + } else { /* 明细状态 */ + for (int i = 0; i < m_detailLogs.length; i++) { + if (m_hashSelectedSumLogs.get(m_detailLogs[i].getBatchid()) == null) { + m_detailLogs[i].setbSelected(VerifyMsg.FALSE); + } + if (m_detailLogs[i].getbSelected().booleanValue()) { + al.add(m_detailLogs[i]); + } + } + } + if (al.size() > 0) { + GlVerifyDisplogVO[] vos = new GlVerifyDisplogVO[al.size()]; + vos = al.toArray(vos); + return vos; + } + return null; + } + + /** + * @param @return + * @param @throws Exception + * @return String[] + * @throws + * @Title: getStandardPk + * @Description: TODO(得到自动核销或自动红蓝对冲的标准 , 主要是处理是否按辅助核算严格控制标准) + */ + private String[] getStandardPk() throws BusinessException { + List al = new ArrayList(); + String[] args = m_Standardvo.getObj(); + if (args != null && args.length > 0) { + for (int i = 0; i < args.length; i++) { + al.add(args[i]); + } + } + // 启用GL134参数,按照末级科目核销 + if (!al.contains("pk_accsubj")) { + UFBoolean paraBoolean = UFBoolean.TRUE; + try { + paraBoolean = GLParaAccessor.getParaBoolean(getPk_accountingbook(), "GL134"); + } catch (BusinessException e) { + Logger.error(e.getMessage()); + } + if (!paraBoolean.booleanValue()) + al.add("pk_accsubj"); + } + VerifyObjVO verifyObj = getVerifyObject(); + if (verifyObj == null || verifyObj.getParentVO() == null) { + throw new BusinessException(VerifyMsg.getMSG_NO_VERIFYOBJ()); + } + VerifyObjHeaderVO voHead = (VerifyObjHeaderVO) verifyObj.getParentVO(); + if (voHead.getBcontrol().booleanValue()) { /* 严格按照辅助核算控制 */ + VerifyObjItemVO[] items = (VerifyObjItemVO[]) verifyObj.getChildrenVO(); + String pk_bdinfo = null; + if (items != null && items.length > 0) { + for (int i = 0; i < items.length; i++) { + pk_bdinfo = items[i].getPk_subjass(); + al.add("control_" + pk_bdinfo); + } + } + } + if (al.size() > 0) { + return al.toArray(new String[0]); + } else { + return null; + } + } + + /** + * @param @return + * @return VerifyCom + * @throws + * @Title: getVerifyCom + * @Description: TODO(得到核销组件) + */ + private VerifyCom getVerifyCom() { + if (m_VerifyCom == null) { + try { + m_VerifyCom = new VerifyCom(); + m_VerifyCom.setDataFilter(new GlVerifyDataFilter()); + m_VerifyCom.setDataSaver(new GlVerifyDataSaver()); + // 红蓝对冲 + GLRedBlueMatch redBlueMatch = new GLRedBlueMatch(); + redBlueMatch.setPk_group(InvocationInfoProxy.getInstance().getGroupId()); + redBlueMatch.setPk_user(InvocationInfoProxy.getInstance().getUserId()); + redBlueMatch.setOprDate(new UFDate(InvocationInfoProxy.getInstance().getBizDateTime())); + m_VerifyCom.addMatchTools(REDBLUE, redBlueMatch); + // 单币种核销 + GLSingleMatch singleMatch = new GLSingleMatch(); + singleMatch.setPk_group(InvocationInfoProxy.getInstance().getGroupId()); + singleMatch.setPk_user(InvocationInfoProxy.getInstance().getUserId()); + singleMatch.setOprDate(new UFDate(InvocationInfoProxy.getInstance().getBizDateTime())); + m_VerifyCom.addMatchTools(VERIFY, singleMatch); + // 异币种核销 + MultiMatch multiMatch = new MultiMatch(); + multiMatch.setPk_group(InvocationInfoProxy.getInstance().getGroupId()); + multiMatch.setPk_user(InvocationInfoProxy.getInstance().getUserId()); + multiMatch.setOprDate(new UFDate(InvocationInfoProxy.getInstance().getBizDateTime())); + m_VerifyCom.addMatchTools(VERIFY_MULTI, multiMatch); + + m_VerifyCom.setRule(getRuleVO()); + m_VerifyCom.setPk_accountingbook(getPk_accountingbook()); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + } + } + return m_VerifyCom; + } + + /* (非 Javadoc) + *

Title: getVerifyDetailByDetailpk

+ *

Description: 根据凭证分录主键得到核销凭证分录

+ * @param pk_detail + * @return + * @see nc.ui.glrp.verify.IVerifyModel#getVerifyDetailByDetailpk(java.lang.String) + */ + public VerifyDetailVO getVerifyDetailByDetailpk(String pk_detail) { + if (pk_detail == null) { + m_voDetail = null; + return null; + } + try { + m_voDetail = GLPubProxy.getRemoteVerifydetail().getVerifyDetailbyDetailpk(pk_detail); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + m_voDetail = null; + } + return m_voDetail; + } + + public void setVerifyDetailVO(VerifyDetailVO detail) { + m_voDetail = detail; + } + + public void setVerifyObject(VerifyObjVO verifyobj) { + m_verifyObj = verifyobj; + } + + /* (非 Javadoc) + *

Title: getVerifyDetailvo

+ *

Description: 得到与总账凭证分录对应的核销凭证分录

+ * @return + * @see nc.ui.glrp.verify.IVerifyModel#getVerifyDetailvo() + */ + public VerifyDetailVO getVerifyDetailvo() { + return m_voDetail; + } + + /* (非 Javadoc) + *

Title: getVerifyObject

+ *

Description: 得到核销对象

+ * @return + * @see nc.ui.glrp.verify.IVerifyModel#getVerifyObject() + */ + public VerifyObjVO getVerifyObject() { + return m_verifyObj; + } + + + /** + * @param @return + * @return String + * @throws + * @Title: getVerifyObjectPk + * @Description: TODO(得到核销对象主键) + */ + private String getVerifyObjectPk() { + try { + return m_verifyObj.getParentVO().getPrimaryKey(); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + return null; + } + } + + /** + * 功能:判断当前辅助核算组合是否符合核销对象要求 作者:宋涛 创建时间:(2003-5-14 14:28:26) 参数:<|> 返回值: 算法: + * + * @param voDetail nc.bs.glrp.verify.VerifyDetail + * @param verifyObj VerifyObjVO + * @return boolean + */ + public boolean isAssLegal(AssVO[] assvo, + VerifyObjVO verifyObj) throws Exception { + try { + if (verifyObj == null || verifyObj.getParentVO() == null) { + throw new Exception( + VerifyMsg.getMSG_NO_VERIFYOBJ()); + // return false; + } + VerifyObjHeaderVO voHead = (VerifyObjHeaderVO) verifyObj + .getParentVO(); + if (!voHead.getBcontrol().booleanValue()) { + return true; + } + if (assvo == null) { + return false; + } + + if (voHead.getBcontrol().booleanValue()) { /* 严格按照辅助核算控制 */ + VerifyObjItemVO[] items = (VerifyObjItemVO[]) verifyObj + .getChildrenVO(); + if (assvo == null || assvo.length < items.length) { + return false; + } else { + String pk_bdinfo = null; + for (int i = 0; i < items.length; i++) { + pk_bdinfo = items[i].getPk_subjass(); + int j = 0; + for (j = 0; j < assvo.length; j++) { + if (assvo[j].getPk_Checktype().equals(pk_bdinfo)) + break; + } + if (j == assvo.length) { + return false; + } + } + } + } + return true; + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw e; + } + } + + /** + * 功能:判断当前凭证分录是否符合条件参加核销 作者:宋涛 创建时间:(2003-5-14 14:28:26) 参数:<|> 返回值: 算法: + * + * @param voDetail nc.bs.glrp.verify.VerifyDetail + * @param verifyObj VerifyObjVO + * @return boolean + */ + public boolean isDataLegal(VerifyDetailVO voDetail, VerifyObjVO verifyObj) throws BusinessException { + try { + if (voDetail == null || verifyObj == null) { + return false; + } + VerifyObjHeaderVO voHead = (VerifyObjHeaderVO) verifyObj + .getParentVO(); + if (voHead.getBcontrol().booleanValue()) { /* 严格按照辅助核算控制 */ + VerifyObjItemVO[] items = (VerifyObjItemVO[]) verifyObj + .getChildrenVO(); + AssVO[] assvo = voDetail.getAss(); + if (assvo == null || assvo.length < items.length) { + return false; + } else { + String pk_bdinfo = null; + for (int i = 0; i < items.length; i++) { + pk_bdinfo = items[i].getPk_subjass(); + int j = 0; + for (j = 0; j < assvo.length; j++) { + if (assvo[j].getPk_Checktype().equals(pk_bdinfo)) + break; + } + if (j == assvo.length) { + return false; + } + } + } + } + if (voDetail.getDirect().intValue() > 0) { /* 借方 */ + if (voDetail.getBalancedebitamount() != null + && !voDetail.getBalancedebitamount().equals( + VerifyMsg.ZERO)) { + return true; + } else if (voDetail.getBalancefracdebitamount() != null + && !voDetail.getBalancefracdebitamount().equals( + VerifyMsg.ZERO)) { + return true; + } else if (voDetail.getBalancelocaldebitamount() != null + && !voDetail.getBalancelocaldebitamount().equals( + VerifyMsg.ZERO)) { + return true; + } + } else { /* 贷方 */ + if (voDetail.getBalancecreditamount() != null + && !voDetail.getBalancecreditamount().equals( + VerifyMsg.ZERO)) { + return true; + } else if (voDetail.getBalancefraccreditamount() != null + && !voDetail.getBalancefraccreditamount().equals( + VerifyMsg.ZERO)) { + return true; + } else if (voDetail.getBalancelocalcreditamount() != null + && !voDetail.getBalancelocalcreditamount().equals( + VerifyMsg.ZERO)) { + return true; + } + } + return true; + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(e.getMessage()); + } + } + + /* (非 Javadoc) + *

Title: onAutoRedBlue

+ *

Description: 自动红蓝对冲

+ * @param bDebit + * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onAutoRedBlue(boolean) + */ + public void onAutoRedBlue(boolean bDebit) throws BusinessException { + onSelectNone(); + try { + getRuleVO().setBatchId(GLPubProxy.getRemoteVerifyLog().getVerifyBatchid()); + getRuleVO().setPairNum(Integer.valueOf(0)); + getRuleVO().setCreditObjKeys(getStandardPk()); + getRuleVO().setDebtObjKeys(getStandardPk()); + getRuleVO().setCreditSortKeys(null); + getRuleVO().setDebtSortKeys(null); + getRuleVO().setDateName(m_sDateName); + getRuleVO().setMaxDateError(m_Standardvo.getDateRange()); + getRuleVO().setVerifyMatchSeq(new String[]{REDBLUE}); + getRuleVO().setCreditVerifyObj(getVerifyObjectPk()); + getRuleVO().setDebitVerifyObj(getVerifyObjectPk()); + onSelectAll(bDebit); + getVerifyCom().removeData(); + if (bDebit) { + getRuleVO().setVerifyCurr(getDebitVerify()[0].getCurrPk()); + getVerifyCom().setDebitData(getDebitVerify()); + } else { + getRuleVO().setVerifyCurr(getCreditVerify()[0].getCurrPk()); + getVerifyCom().setCreditData(getCreditVerify()); + } + getVerifyCom().onVerify(); + + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_MANUAL_ERROR()); + } + } + + @SuppressWarnings("unchecked") + public VerifyStandardVO getStandardVO(Map varMap) { + VerifyStandardVO vo = new VerifyStandardVO(); + List al = new ArrayList(); + // 按日期范围 + if (!StrTools.isEmptyStr((String) varMap.get("sDateRange")) && "Y".equals((String) varMap.get("sDateRange"))) { + if (!StrTools.isEmptyStr((String) varMap.get("dateRange")) && ((String) varMap.get("dateRange")).length() > 0) {// 日期相差天数不为空 + vo.setDateRange(Integer.valueOf(((String) varMap.get("dateRange")).trim())); + } else { + vo.setDateRange(Integer.valueOf(0)); + } + } else { + vo.setDateRange(null); + } + // 按核销号 + if (!StrTools.isEmptyStr((String) varMap.get("sVerifyNo")) && "Y".equals((String) varMap.get("sVerifyNo"))) { + al.add("VerifyNo"); + } + // 金额相等 + if (!StrTools.isEmptyStr((String) varMap.get("sMny")) && "Y".equals((String) varMap.get("sMny"))) { + al.add("Mny"); + } + // 按末级科目 + if (!StrTools.isEmptyStr((String) varMap.get("sPk_accsubj")) && "Y".equals((String) varMap.get("sPk_accsubj"))) { + al.add("pk_accsubj"); + } + // 按对账标识码 + if (!StrTools.isEmptyStr((String) varMap.get("sNetbankflag")) && "Y".equals((String) varMap.get("sNetbankflag"))) { + al.add("netbankflag"); + } + // 按业务单元 V636 + if (!StrTools.isEmptyStr((String) varMap.get("sPk_unit")) && "Y".equals((String) varMap.get("sPk_unit"))) { + al.add("pk_unit"); + } + // 按辅助项 + if (!StrTools.isEmptyStr((String) varMap.get("sAss")) && "Y".equals((String) varMap.get("sAss"))) { + List> ass = (List>) varMap.get("ass"); + if (ass != null && ass.size() > 0) { + for (int i = 0; i < ass.size(); i++) { + if (ass.get(i) != null) { + al.add("fzhs_" + ass.get(i).get("pk_Checktype") + ass.get(i).get("pk_Checkvalue")); + } + } + } + } + if (al.size() > 0) { + vo.setObj(al.toArray(new String[0])); + } else { + vo.setObj(null); + } + // 只核销选择记录 + vo.setVerifySelected(!StrTools.isEmptyStr((String) varMap.get("sVerify")) && "Y".equals((String) varMap.get("sVerify"))); + return vo; + } + + /* (非 Javadoc) + *

Title: onAutoVerify

+ *

Description: 自动核销

+ * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onAutoVerify() + */ + public void onAutoVerify() throws BusinessException { + + if (!m_Standardvo.isVerifySelected()) { + onSelectAll(); + } + + if (getCreditVerify() == null || getDebitVerify() == null) { + throw new BusinessException(VerifyMsg.getMSG_NOVERIFYDATA()); + } + try { + getRuleVO().setBatchId(GLPubProxy.getRemoteVerifyLog().getVerifyBatchid()); + getRuleVO().setPairNum(Integer.valueOf(0)); + getRuleVO().setDateName(m_sDateName); + getRuleVO().setVerifyMatchSeq(new String[]{VERIFY}); + getRuleVO().setCreditObjKeys(getStandardPk()); + getRuleVO().setDebtObjKeys(getStandardPk()); + getRuleVO().setCreditSortKeys(new String[]{m_sDateName, "vouchertypeName", "DispVouchNO", "detailindex"}); + getRuleVO().setDebtSortKeys(new String[]{m_sDateName, "vouchertypeName", "DispVouchNO", "detailindex"}); + getRuleVO().setMaxDateError(m_Standardvo.getDateRange()); + getRuleVO().setCreditVerifyObj(getVerifyObjectPk()); + getRuleVO().setDebitVerifyObj(getVerifyObjectPk()); + /* 核销币种 */ + getRuleVO().setVerifyCurr(getCreditVerify()[0].getCurrPk()); + getVerifyCom().removeData(); + if (m_Standardvo.isVerifySelected()) { + getVerifyCom().setCreditData(getSelectedData(false)); + getVerifyCom().setDebitData(getSelectedData(true)); + } else { + getVerifyCom().setCreditData(getCreditVerify()); + getVerifyCom().setDebitData(getDebitVerify()); + } + getVerifyCom().onVerify(); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMsg_Autoverify_Error()); + } + } + + public void setRslt(FilterCondVO voCond, VerifyDetailVO[][] vos) throws BusinessException { + try { + m_voQry = voCond; + setDateName(voCond); + getVerifyCom().onFilterDataEx(voCond, vos); + VerifyDetailVO[][] filteredData = new VerifyDetailVO[][]{ + (VerifyDetailVO[]) getVerifyCom().getDebitData(), + (VerifyDetailVO[]) getVerifyCom().getCreditData()}; + if (filteredData[0] != null) { + setDebitVerifyWebInfo(appendDetailInfo(filteredData[0])); + } else { + setDebitVerifyWebInfo(null); + } + if (filteredData[1] != null) { + setCreditVerifyWebInfo(appendDetailInfo(filteredData[1])); + } else { + setCreditVerifyWebInfo(null); + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_QUERY_ERROR()); + } + } + + /* (非 Javadoc) + *

Title: onQuery

+ *

Description: 过滤参加核销的数据

+ * @param voCond + * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onQuery(FilterCondVO) + */ + public void onQuery(FilterCondVO voCond) throws BusinessException { + try { + m_voQry = voCond; + setDateName(voCond); + getVerifyCom().onFilterData(voCond); + VerifyDetailVO[] deibtvos = (VerifyDetailVO[]) getVerifyCom().getDebitData(); + VerifyDetailVO[] credtvos = (VerifyDetailVO[]) getVerifyCom().getCreditData(); + if (deibtvos != null) { + setDebitVerifyWebInfo(appendDetailInfo(deibtvos)); + } else { + setDebitVerifyWebInfo(null); + } + if (credtvos != null) { + setCreditVerifyWebInfo(appendDetailInfo(credtvos)); + } else { + setCreditVerifyWebInfo(null); + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_QUERY_ERROR()); + } + } + + /* (非 Javadoc) + *

Title: onQueryHisRecord

+ *

Description: 过滤历史纪录

+ * @param voCond + * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onQueryHisRecord(nc.vo.glrp.verify.LogFilterCondVO) + */ + public void onQueryHisRecord(LogFilterCondVO voCond) throws BusinessException { + try { + m_sumLogs = null; + m_detailLogs = null; + m_hashSelectedSumLogs.clear(); + m_historyCondvo = voCond; + getVerifyCom().setCondition(voCond); + m_detailLogs = (GlVerifyDisplogVO[]) getVerifyCom().getDispLogData(); + if (m_detailLogs == null || m_detailLogs.length <= 0) { + return; + } + calculateSumLogs(m_detailLogs); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_HISTORYQRY_ERROR()); + } + } + + /* (非 Javadoc) + *

Title: onQueryHisRecord

+ *

Description: 过滤历史纪录

+ * @param voCond + * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onQueryHisRecord(nc.vo.glrp.verify.LogFilterCondVO) + */ + public GlVerifyDisplogVO[] dealQuery(LogFilterCondVO voCond, boolean issum) throws BusinessException { + try { + m_sumLogs = null; + m_detailLogs = null; + m_hashSelectedSumLogs.clear(); + m_historyCondvo = voCond; + getVerifyCom().setCondition(voCond); + m_detailLogs = (GlVerifyDisplogVO[]) getVerifyCom().getDispLogData(); + if (m_detailLogs == null || m_detailLogs.length <= 0) { + return m_detailLogs; + } + calculateSumLogs(m_detailLogs); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_HISTORYQRY_ERROR()); + } + if (issum) + return m_sumLogs; + else + return m_detailLogs; + } + + /* (非 Javadoc) + *

Title: onSelectAll

+ *

Description: 数据全选

+ * @see nc.ui.glrp.verify.IVerifyModel#onSelectAll() + */ + public void onSelectAll() { + // 全选借方记录 + if (getDebitVerify() != null && getDebitVerify().length > 0) { + for (int i = 0; i < getDebitVerify().length; i++) { + // 设置借方本次核销金额 + getDebitVerify()[i].setDebit_Money_Y(getDebitVerify()[i].getBalancedebitamount()); + getDebitVerify()[i].setDebit_Money_B(getDebitVerify()[i].getBalancelocaldebitamount()); + } + } + // 全选贷方记录 + if (getCreditVerify() != null && getCreditVerify().length > 0) { + for (int i = 0; i < getCreditVerify().length; i++) { + // 设置贷方本次核销金额 + getCreditVerify()[i].setCredit_Money_B(getCreditVerify()[i].getBalancelocalcreditamount()); + getCreditVerify()[i].setCredit_Money_Y(getCreditVerify()[i].getBalancecreditamount()); + } + } + } + + /** + * @param @param bDebit + * @return void + * @throws + * @Title: onSelectAll + * @Description: TODO(单方向数据全选) + */ + public void onSelectAll(boolean bDebit) { + if (bDebit) {// 借方 + if (getDebitVerify() != null && getDebitVerify().length > 0) { + for (int i = 0; i < getDebitVerify().length; i++) {// 选中借方记录,并设置本次核销金额 + getDebitVerify()[i].setSelected(VerifyMsg.TRUE); + getDebitVerify()[i].setDebit_Money_B(getDebitVerify()[i].getBalancelocaldebitamount()); + getDebitVerify()[i].setDebit_Money_Y(getDebitVerify()[i].getBalancedebitamount()); + } + } + } else {// 贷方 + if (getCreditVerify() != null && getCreditVerify().length > 0) { + for (int i = 0; i < getCreditVerify().length; i++) {// 选中贷方记录,并设置本次核销金额 + getCreditVerify()[i].setSelected(VerifyMsg.TRUE); + getCreditVerify()[i].setCredit_Money_B(getCreditVerify()[i].getBalancelocalcreditamount()); + getCreditVerify()[i].setCredit_Money_Y(getCreditVerify()[i].getBalancecreditamount()); + } + } + } + } + + /* (非 Javadoc) + *

Title: onSelectNone

+ *

Description: 数据全消

+ * @see nc.ui.glrp.verify.IVerifyModel#onSelectNone() + */ + public void onSelectNone() { + if (getDebitVerify() != null) { + for (int i = 0; i < getDebitVerify().length; i++) { + getDebitVerify()[i].setSelected(VerifyMsg.FALSE); + getDebitVerify()[i].setDebit_Money_B(VerifyMsg.ZERO); + getDebitVerify()[i].setDebit_Money_Y(VerifyMsg.ZERO); + } + } + if (getCreditVerify() != null) { + for (int i = 0; i < getCreditVerify().length; i++) { + getCreditVerify()[i].setSelected(VerifyMsg.FALSE); + getCreditVerify()[i].setCredit_Money_B(VerifyMsg.ZERO); + getCreditVerify()[i].setCredit_Money_Y(VerifyMsg.ZERO); + } + } + } + + /** + * 功能:根据详细log 计算得到汇总vo 作者:宋涛 创建时间:(2003-5-10 15:33:34) 参数:<|> 返回值: 算法: + * + * @param detaillogs nc.vo.glrp.verify.GlVerifyDisplogVO[] + */ + private void calculateSumLogs(GlVerifyDisplogVO[] detaillogs) { + if (detaillogs == null) { + return; + } + Hashtable hash = new Hashtable(); + GlVerifyDisplogVO vo = null; + for (int i = 0; i < detaillogs.length; i++) { + Object oValue = hash.get(detaillogs[i].getBatchid()); + if (oValue == null) { + vo = new GlVerifyDisplogVO(); + vo.setBatchid(detaillogs[i].getBatchid()); + vo.setOprDate(detaillogs[i].getOprDate()); + vo.setPk_curr(detaillogs[i].getPk_curr()); + + } else { + vo = (GlVerifyDisplogVO) oValue; + } + if (vo.getCredit_b() == null) { + vo.setCredit_b(detaillogs[i].getCredit_b()); + } else if (detaillogs[i].getCredit_b() != null) { + vo.setCredit_b(vo.getCredit_b().add(detaillogs[i].getCredit_b())); + } + if (vo.getCredit_f() == null) { + vo.setCredit_f(detaillogs[i].getCredit_f()); + } else if (detaillogs[i].getCredit_f() != null) { + vo.setCredit_f(vo.getCredit_f().add(detaillogs[i].getCredit_f())); + } + if (vo.getCredit_y() == null) { + vo.setCredit_y(detaillogs[i].getCredit_y()); + } else if (detaillogs[i].getCredit_y() != null) { + vo.setCredit_y(vo.getCredit_y().add(detaillogs[i].getCredit_y())); + } + if (vo.getCredit_j() == null) { + vo.setCredit_j(detaillogs[i].getCredit_j()); + } else if (detaillogs[i].getCredit_j() != null) { + vo.setCredit_j(vo.getCredit_j().add(detaillogs[i].getCredit_j())); + } + if (vo.getCredit_q() == null) { + vo.setCredit_q(detaillogs[i].getCredit_q()); + } else if (detaillogs[i].getCredit_q() != null) { + vo.setCredit_q(vo.getCredit_q().add(detaillogs[i].getCredit_q())); + } + + if (vo.getDebit_b() == null) { + vo.setDebit_b(detaillogs[i].getDebit_b()); + } else if (detaillogs[i].getDebit_b() != null) { + vo.setDebit_b(vo.getDebit_b().add(detaillogs[i].getDebit_b())); + } + if (vo.getDebit_f() == null) { + vo.setDebit_f(detaillogs[i].getDebit_f()); + } else if (detaillogs[i].getDebit_f() != null) { + vo.setDebit_f(vo.getDebit_f().add(detaillogs[i].getDebit_f())); + } + if (vo.getDebit_y() == null) { + vo.setDebit_y(detaillogs[i].getDebit_y()); + } else if (detaillogs[i].getDebit_y() != null) { + vo.setDebit_y(vo.getDebit_y().add(detaillogs[i].getDebit_y())); + } + if (vo.getDebit_j() == null) { + vo.setDebit_j(detaillogs[i].getDebit_j()); + } else if (detaillogs[i].getDebit_j() != null) { + vo.setDebit_j(vo.getDebit_j().add(detaillogs[i].getDebit_j())); + } + if (vo.getDebit_q() == null) { + vo.setDebit_q(detaillogs[i].getDebit_q()); + } else if (detaillogs[i].getDebit_q() != null) { + vo.setDebit_q(vo.getDebit_q().add(detaillogs[i].getDebit_q())); + } + hash.put(detaillogs[i].getBatchid(), vo); + } + try { + Enumeration em = hash.elements(); + List al = new ArrayList(); + while (em.hasMoreElements()) { + al.add(em.nextElement()); + } + if (al.size() > 0) { + m_sumLogs = new GlVerifyDisplogVO[al.size()]; + m_sumLogs = al.toArray(m_sumLogs); + } else { + m_sumLogs = null; + } + if (m_sumLogs != null && m_sumLogs.length > 1) { + int[] iIndex = new int[]{GlVerifyDispLogKey.OPRDATE, + GlVerifyDispLogKey.BATCHID}; + nc.vo.glcom.shellsort.CShellSort objShellSort = new nc.vo.glcom.shellsort.CShellSort(); + nc.vo.glcom.sorttool.CVoSortTool objVoSortTool = new nc.vo.glcom.sorttool.CVoSortTool(); + objVoSortTool.setSortIndex(iIndex); + objShellSort.sort(m_sumLogs, objVoSortTool, false); + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new GlBusinessException(e.getMessage()); + } + } + + /* (非 Javadoc) + *

Title: onRedBlue

+ *

Description: 红蓝对冲

+ * @param bForce 是否强制红蓝对冲 + * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onRedBlue(boolean) + */ + public void onRedBlue(Map varMap) throws BusinessException { + checkVerifyObj(varMap); + VerifyDetailVO[] voDebit = getSelectedData(true); + VerifyDetailVO[] voCredit = getSelectedData(false); + if (voDebit == null && voCredit == null) { + throw new BusinessException(VerifyMsg.getMSG_NOVERIFYDATA()); + } + if ((voDebit != null && voDebit.length > 1) || (voCredit != null && voCredit.length > 1)) { + } else { + throw new BusinessException(VerifyMsg.getMSG_NOENOUGHVERIFYDATA()); + } + + // 业务单元不一致不能红蓝对冲 + String pk_unit = null; + if (voDebit != null) { + for (VerifyDetailVO detailVO : voDebit) { + if (pk_unit == null) + pk_unit = detailVO.getPk_unit(); + if (!detailVO.getPk_unit().equals(pk_unit)) + throw new BusinessException(VerifyMsg.getMSG_BUSIUNIT_UNEQUAL()); + } + } + + if (voCredit != null) { + pk_unit = null; + for (VerifyDetailVO detailVO : voCredit) { + if (pk_unit == null) + pk_unit = detailVO.getPk_unit(); + if (!detailVO.getPk_unit().equals(pk_unit)) + throw new BusinessException(VerifyMsg.getMSG_BUSIUNIT_UNEQUAL()); + } + + } + + try { + getRuleVO().setBatchId(GLPubProxy.getRemoteVerifyLog().getVerifyBatchid()); + getRuleVO().setPairNum(0); + getRuleVO().setCreditObjKeys(null); + getRuleVO().setDebtObjKeys(null); + getRuleVO().setCreditSortKeys(null); + getRuleVO().setDebtSortKeys(null); + getRuleVO().setDateName(m_sDateName); + getRuleVO().setMaxDateError(null); + getRuleVO().setVerifyMatchSeq(new String[]{REDBLUE}); + getRuleVO().setCreditVerifyObj(getVerifyObjectPk()); + getRuleVO().setDebitVerifyObj(getVerifyObjectPk()); + if (voDebit != null) { + getRuleVO().setVerifyCurr(voDebit[0].getCurrPk()); + } else if (voCredit != null) { + getRuleVO().setVerifyCurr(voCredit[0].getCurrPk()); + } + getVerifyCom().removeData(); + getVerifyCom().setDebitData(voDebit); + getVerifyCom().setCreditData(voCredit); + getVerifyCom().onVerify(); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_MANUAL_ERROR()); + } + } + + + /** + * 功能:执行核销 作者:宋涛 创建时间:(2003-5-8 16:14:08) 参数:<|> 返回值:true 强制核销,false非强制核销 + * 算法: + * + * @param bForce boolean + * @throws Exception 异常说明。 + */ + public void onVerify() throws BusinessException { + VerifyDetailVO[] voDebit = getSelectedData(true); + VerifyDetailVO[] voCredit = getSelectedData(false); + if (voDebit == null || voCredit == null) { + throw new BusinessException(VerifyMsg.getMSG_NOVERIFYDATA()); + } + try { + String batchid = GLPubProxy.getRemoteVerifyLog().getVerifyBatchid(); + getRuleVO().setBatchId(batchid); + getRuleVO().setPairNum(Integer.valueOf(0)); + getRuleVO().setCreditObjKeys(null); + getRuleVO().setDebtObjKeys(null); + getRuleVO().setCreditSortKeys(null); + getRuleVO().setDebtSortKeys(null); + getRuleVO().setDateName(m_sDateName); + getRuleVO().setMaxDateError(null); + getRuleVO().setVerifyMatchSeq(new String[]{VERIFY}); + getRuleVO().setCreditVerifyObj(getVerifyObjectPk()); + getRuleVO().setDebitVerifyObj(getVerifyObjectPk()); + /* 核销币种 */ + getRuleVO().setVerifyCurr(getCreditVerify()[0].getCurrPk()); + getVerifyCom().removeData(); + getVerifyCom().setDebitData(voDebit); + getVerifyCom().setCreditData(voCredit); + getVerifyCom().onVerify(); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_MANUAL_ERROR()); + } + + } + + /** + * 功能:执行异币种核销 作者:mzr 创建时间:(20250311) 参数:<|> 返回值:true 强制核销,false非强制核销 + * 算法: + * + * @throws Exception 异常说明。 + */ + public void onVerifyMul() throws BusinessException { + VerifyDetailVO[] voDebit = getSelectedData(true); + VerifyDetailVO[] voCredit = getSelectedData(false); + if (voDebit == null || voCredit == null) { + throw new BusinessException(VerifyMsg.getMSG_NOVERIFYDATA()); + } + try { + String batchid = GLPubProxy.getRemoteVerifyLog().getVerifyBatchid(); + getRuleVO().setBatchId(batchid); + getRuleVO().setPairNum(Integer.valueOf(0)); + getRuleVO().setCreditObjKeys(null); + getRuleVO().setDebtObjKeys(null); + getRuleVO().setCreditSortKeys(null); + getRuleVO().setDebtSortKeys(null); + getRuleVO().setDateName(m_sDateName); + getRuleVO().setMaxDateError(null); + getRuleVO().setVerifyMatchSeq(new String[]{VERIFY_MULTI}); + getRuleVO().setCreditVerifyObj(getVerifyObjectPk()); + getRuleVO().setDebitVerifyObj(getVerifyObjectPk()); + /* 核销币种 */ + String currPk = getCreditVerify()[0].getCurrPk(); + getRuleVO().setVerifyCurr(currPk); + getVerifyCom().removeData(); + getVerifyCom().setDebitData(voDebit); + getVerifyCom().setCreditData(voCredit); + getVerifyCom().onVerify(); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMSG_MANUAL_ERROR()); + } + + } + + /** + * a功能: 作者:宋涛 创建时间:(2003-5-9 15:41:27) 参数:<|> 返回值: 算法: + * + * @param newCreditVerify VerifyDetailVO[] + */ + public void setCreditVerify(VerifyDetailVO[] newCreditVerify) { + m_CreditVerify = newCreditVerify; + } + + /** + * 功能:设置日期名称 作者:宋涛 创建时间:(2003-5-9 14:20:51) 参数:<|> 返回值: 算法: + * + * @param voCond FilterCondVO + */ + private void setDateName(FilterCondVO voCond) { + if (voCond != null) { + if (voCond.getDebitCond() != null + && voCond.getDebitCond().getDateType() != null) { + m_sDateName = voCond.getDebitCond().getDateType(); + } else if (voCond.getCreditCond() != null + && voCond.getCreditCond().getDateType() != null) { + m_sDateName = voCond.getCreditCond().getDateType(); + } + } + } + + /** + * a功能: 作者:宋涛 创建时间:(2003-5-9 15:38:51) 参数:<|> 返回值: 算法: + * + * @param newDebitVerify VerifyDetailVO[] + */ + public void setDebitVerify(VerifyDetailVO[] newDebitVerify) { + m_DebitVerify = newDebitVerify; + } + + + /* (非 Javadoc) + *

Title: setVerifyStandardVO

+ *

Description: 设置核销标准

+ * @param vo + * @see nc.ui.glrp.verify.IVerifyModel#setVerifyStandardVO(nc.vo.glrp.verify.VerifyStandardVO) + */ + public void setVerifyStandardVO(VerifyStandardVO vo) { + m_Standardvo = vo; + } + + /* (非 Javadoc) + *

Title: unVerify

+ *

Description: 执行反核销

+ * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#unVerify() + */ + public void unVerify() throws BusinessException { + try { + GlVerifyDisplogVO[] logs = getHistroyData(); + if (logs == null || logs.length <= 0) { + return; + } + getVerifyCom().onUnVerify(logs, getPk_accountingbook()); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new BusinessException(VerifyMsg.getMsg_unverify_error()); + } + } + + /* (非 Javadoc) + *

Title: setFetch

+ *

Description: 设置是否处于对照状态

+ * @param newFetch + * @see nc.ui.glrp.verify.IVerifyModel#setFetch(boolean) + */ + public void setFetch(boolean newFetch) { + m_Fetch = newFetch; + } + + /* (非 Javadoc) + *

Title: isFetch

+ *

Description: 得到是否处于对照状态

+ * @return + * @see nc.ui.glrp.verify.IVerifyModel#isFetch() + */ + public boolean isFetch() { + return m_Fetch; + } + + /** + * @param @param newFetchDirect + * @return void + * @throws + * @Title: setFetchDirect + * @Description: TODO(设置对照的主方向) + */ + public void setFetchDirect(int newFetchDirect) { + m_FetchDirect = newFetchDirect; + } + + /** + * @param @return + * @return int + * @throws + * @Title: getFetchDirect + * @Description: TODO(得到对照的主方向) + */ + public int getFetchDirect() { + return m_FetchDirect; + } + + /* (非 Javadoc) + *

Title: onCancelFetch

+ *

Description: 取消对照

+ * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onCancelFetch() + */ + public void onCancelFetch() throws BusinessException { + // TODO 自动生成方法存根 + setFetch(false); + setFetchDirect(0); + onQuery(m_voQry); + } + + /* (非 Javadoc) + *

Title: onFetch

+ *

Description: 对照

+ * @throws Exception + * @see nc.ui.glrp.verify.IVerifyModel#onFetch() + */ + public void onFetch() throws BusinessException { + // TODO 自动生成方法存根 + setFetch(true); + setFetchDirect(0); + onQuery(m_voQry); + } + + /** + * @param @return + * @return String + * @throws + * @Title: getPk_accountingbook + * @Description: TODO(得到核算账簿) + */ + public String getPk_accountingbook() { + return pk_accountingbook; + } + + /* (非 Javadoc) + *

Title: setPk_accountingbook

+ *

Description: 设置核算账簿

+ * @param pkAccountingbook + * @see nc.ui.glrp.verify.IVerifyModel#setPk_accountingbook(java.lang.String) + */ + public void setPk_accountingbook(String pkAccountingbook) throws BusinessException { + pk_accountingbook = pkAccountingbook; + m_sDateName = GLParaAccessor.getVerifyDate(pk_accountingbook); + if (m_sDateName.equalsIgnoreCase(GLParaValueConst.GL080_VOUCHERDATE)) { + m_sDateName = "prepareddate"; + } else { + m_sDateName = "Businessdate"; + } + } + + /** + * 此处插入方法说明。 + * 创建日期:(2001-11-2 9:51:09) + * + * @return nc.ui.gl.accbook.BillFormatVO + */ + public FormatVO getFormat() { + if (format == null) + format = new FormatVO(); + return format; + } + + public String[] getPk_units() { + return pk_units; + } + + public void setPk_units(String[] pk_units) { + this.pk_units = pk_units; + } + + public String getM_pk_accsubj() { + return m_pk_accsubj; + } + + public FilterCondVO getFilterVOEx(DetailVO detail, String date) throws BusinessException { + FilterCondVO voCond = new FilterCondVO(); + FilterCondVO debitCond = new FilterCondVO(); + FilterCondVO creditCond = new FilterCondVO(); + + if (getEnvirment(detail.getPk_accountingbook()).getDateName().equalsIgnoreCase("VoucherDate")) { + creditCond.setDateType("prepareddate"); + } else { + creditCond.setDateType("Businessdate"); + } + + creditCond.setPkuser(InvocationInfoProxy.getInstance().getUserId()); + creditCond.setPk_glorgbook(detail.getPk_accountingbook()); + creditCond.setLogonDate(date); + creditCond.setPk_unit(new String[]{detail.getPk_unit()}); + creditCond.setAssvos(null); + + creditCond.setBeginDate(null); + creditCond.setEndDate(new UFDate(InvocationInfoProxy.getInstance().getBizDateTime()).asEnd().toString()); + creditCond.setMnyType(VerifyMsg.getDISP_ORIGIN()); + creditCond.setDigest(null); + /* 币种 */ + creditCond.setCurPk(detail.getPk_currtype()); + creditCond.setVerifyNo(null); + creditCond.sethasTally(true); + creditCond.setDirect(-1); + voCond.setCreditCond(creditCond); + voCond.setDebitCond(debitCond); + return voCond; + } + + @SuppressWarnings("unchecked") + public FilterCondVO getFilterVO(Map varMap) throws BusinessException { + FilterCondVO voCond = new FilterCondVO(); + FilterCondVO debitCond = new FilterCondVO(); + FilterCondVO creditCond = new FilterCondVO(); + String pk_accountingbook = (String) varMap.get("pk_accountingbook"); + String pk_accasoa = (String) varMap.get("pk_accasoa"); + AccountVO voSubj = AccountUtilGL.findByPrimaryKey(pk_accasoa); + creditCond.setSubjPk(voSubj.getPk_accasoa()); + creditCond.setSubjCode(voSubj.getCode()); + creditCond.setPkcorp(null); + creditCond.setPkuser(InvocationInfoProxy.getInstance().getUserId()); + creditCond.setPk_glorgbook(pk_accountingbook); + creditCond.setPkSob(null); + creditCond.setLogonDate(new UFDate(InvocationInfoProxy.getInstance().getBizDateTime()).asEnd().toString()); + if (varMap.get("pk_units") == null) { + if (GLParaAccessor.isSecondBUStart((String) varMap.get("pk_accountingbook")).booleanValue()) { + BUWithBookRefModel bumodel = new BUWithBookRefModel(pk_accountingbook); + List orgs = bumodel.getPowerBUOrgs(); + List pk_orgs = new ArrayList(); + for (OrgVO orgVO : orgs) { + pk_orgs.add(orgVO.getPk_org()); + } + creditCond.setPk_unit(pk_orgs.toArray(new String[0])); + } + } else { + Object[] objPkunits = ((List) varMap.get("pk_units")).toArray(); + String[] pk_units = new String[objPkunits.length]; + for (int i = 0; i < objPkunits.length; i++) { + pk_units[i] = (String) objPkunits[i]; + } + creditCond.setPk_unit(pk_units); + } + List> ass = (List>) varMap.get("ass"); + if (ass == null || ass.size() == 0) + creditCond.setAssvos(null); + else { + List assList = new ArrayList(); + for (Map assMap : ass) { + AssVO vo = new AssVO(); + vo.setChecktypecode(StrTools.isEmptyStr((String) assMap.get("checktypecode")) ? null : (String) assMap.get("checktypecode")); + vo.setChecktypename(StrTools.isEmptyStr((String) assMap.get("checktypename")) ? null : (String) assMap.get("checktypename")); + vo.setCheckvaluecode(StrTools.isEmptyStr((String) assMap.get("checkvaluecode")) ? null : (String) assMap.get("checkvaluecode")); + vo.setCheckvaluename(StrTools.isEmptyStr((String) assMap.get("checkvaluename")) ? null : (String) assMap.get("checkvaluename")); + vo.setInnerCode(StrTools.isEmptyStr((String) assMap.get("innerCode")) ? null : (String) assMap.get("innerCode")); + vo.setnote1(StrTools.isEmptyStr((String) assMap.get("note1")) ? null : (String) assMap.get("note1")); + vo.setnote2(StrTools.isEmptyStr((String) assMap.get("note2")) ? null : (String) assMap.get("note2")); + vo.setPk_Checktype(StrTools.isEmptyStr((String) assMap.get("pk_Checktype")) ? null : (String) assMap.get("pk_Checktype")); + vo.setPk_Checkvalue(StrTools.isEmptyStr((String) assMap.get("pk_Checkvalue")) ? null : (String) assMap.get("pk_Checkvalue")); + vo.setM_metaClassid(StrTools.isEmptyStr((String) assMap.get("m_metaClassid")) ? null : (String) assMap.get("m_metaClassid")); + vo.setUserData(StrTools.isEmptyStr((String) assMap.get("userData")) ? null : (String) assMap.get("userData")); + vo.setM_classid(StrTools.isEmptyStr((String) assMap.get("m_classid")) ? null : (String) assMap.get("m_classid")); + assList.add(vo); + } + creditCond.setAssvos(assList.toArray(new AssVO[0])); + } + + if (!StrTools.isEmptyStr((String) varMap.get("begin_date"))) { + String beginDate = GLDateUtil.toStdBeginTimeString((String) varMap.get("begin_date")); + creditCond.setBeginDate(beginDate); + creditCond.setObjBeginDate(beginDate); + } else { + creditCond.setBeginDate(null); + } + if (!StrTools.isEmptyStr((String) varMap.get("end_date"))) { + String endDate = GLDateUtil.toStdEndTimeString((String) varMap.get("end_date")); + creditCond.setEndDate(endDate); + } else { + creditCond.setEndDate(null); + } + creditCond.setDateType("prepareddate".equals(varMap.get("dateType")) ? "prepareddate" : "Businessdate"); + creditCond.setMnyType((String) varMap.get("cmbMnyType")); + if (!StrTools.isEmptyStr((String) varMap.get("mny_begin")) && ((String) varMap.get("mny_begin")).length() > 0) { + creditCond.setMnyBegin(new UFDouble((String) varMap.get("mny_begin"))); + } else { + creditCond.setMnyBegin(null); + } + if (!StrTools.isEmptyStr((String) varMap.get("mny_end")) && ((String) varMap.get("mny_end")).length() > 0) { + creditCond.setMnyEnd(new UFDouble((String) varMap.get("mny_end"))); + } else { + creditCond.setMnyEnd(null); + } + /* 摘要 */ + if (!StrTools.isEmptyStr((String) varMap.get("digest")) && ((String) varMap.get("digest")).length() > 0) { + creditCond.setDigest((String) varMap.get("digest")); + } else { + creditCond.setDigest(null); + } + /* 币种 */ + creditCond.setCurPk((String) varMap.get("pk_currency")); + if (!StrTools.isEmptyStr((String) varMap.get("verifyno")) && ((String) varMap.get("verifyno")).length() > 0) { + creditCond.setVerifyNo((String) varMap.get("verifyno")); + } else { + creditCond.setVerifyNo(null); + } + creditCond.sethasTally("Y".equals(varMap.get("hasTally"))); + /* 即时核销 */ + if (Integer.valueOf((String) varMap.get("type")) == VerifyMsg.TYPE_TIMELY) { + if (Integer.valueOf((String) varMap.get("cmbDirect")) == 0) { + creditCond.setDirect(1); + } else { + creditCond.setDirect(-1); + } + debitCond.setVoucherDetailPk((String) varMap.get("pk_detail")); + if (Integer.valueOf((String) varMap.get("cmbDirect")) == 0) { /* 借方 */ + voCond.setCreditCond(debitCond); + voCond.setDebitCond(creditCond); + } else { + voCond.setCreditCond(creditCond); + voCond.setDebitCond(debitCond); + } + } else { /* 事后核销 */ + if (Integer.valueOf((String) varMap.get("cmbDirect")) == 0) { + voCond.setCreditCond(creditCond); + creditCond.setDirect(1); + voCond.setDebitCond(creditCond); + } else if (Integer.valueOf((String) varMap.get("cmbDirect")) == 1) { + creditCond.setDirect(-1); + voCond.setCreditCond(creditCond); + voCond.setDebitCond(null); + } else { + creditCond.setDirect(-1); + debitCond.setAssvos(creditCond.getAssvos()); + debitCond.setPkcorp(creditCond.getPkcorp()); + debitCond.setPkuser(creditCond.getPkuser()); + debitCond.setPk_glorgbook(creditCond.getPk_glorgbook()); + debitCond.setPkSob(creditCond.getPkSob()); + debitCond.setSubjCode(creditCond.getSubjCode()); + debitCond.setSubjPk(creditCond.getSubjPk()); + debitCond.setBeginDate(creditCond.getBeginDate()); + debitCond.setEndDate(creditCond.getEndDate()); + debitCond.setLogonDate(creditCond.getLogonDate()); + debitCond.setObjBeginDate(creditCond.getObjBeginDate()); + debitCond.setDateType(creditCond.getDateType()); + debitCond.setMnyType(creditCond.getMnyType()); + debitCond.setMnyBegin(creditCond.getMnyBegin()); + debitCond.setMnyEnd(creditCond.getMnyEnd()); + debitCond.setDigest(creditCond.getDigest()); + debitCond.setDirect(1); + debitCond.setCurPk(creditCond.getCurPk()); + debitCond.setVerifyNo(creditCond.getVerifyNo()); + debitCond.sethasTally(creditCond.hasTally()); + debitCond.setPk_unit(creditCond.getPk_unit()); + voCond.setCreditCond(creditCond); + voCond.setDebitCond(debitCond); + } + } + return voCond; + } + + public void checkQryCond(Map varMap) throws BusinessException { + if (varMap.get("pk_currency") == null) { + throw new BusinessException(VerifyMsg.getMSG_NOCURR_ERROR()); + } + if (varMap.get("pk_accasoa") == null) { + throw new BusinessException(VerifyMsg.getMSG_NOACSUBJ_ERROR()); + } + + if (varMap.get("end_date") == null) { + throw new BusinessException(VerifyMsg.getMSG_NO_ENDDATE_ERROR()); + } + + if (new UFDate((String) varMap.get("end_date")).asEnd().after( + new UFDate(InvocationInfoProxy.getInstance().getBizDateTime()).asEnd())) { + throw new BusinessException(VerifyMsg.getMSG_LOGONDATE_EARLY_THAN_ENDDATE_ERROR()); + } + + if (varMap.get("begin_date") != null + && new UFDate((String) varMap.get("begin_date")).asBegin().after(new UFDate((String) varMap.get("end_date")).asEnd())) { + throw new BusinessException(VerifyMsg.getMSG_ENDDATE_EARLY_THAN_STARTDATE_ERROR()); + } + + if (varMap.get("mny_begin") != null && ((String) varMap.get("mny_begin")).trim().length() > 0 + && varMap.get("mny_end") != null && ((String) varMap.get("mny_end")).trim().length() > 0) { + if (new UFDouble(((String) varMap.get("mny_begin")).trim()).compareTo( + new UFDouble(((String) varMap.get("mny_end")).trim())) > 0) { + throw new BusinessException(VerifyMsg.getMSG_MNYRANGE_ERROR()); + } + } + } + + + @SuppressWarnings("unchecked") + public LogFilterCondVO getCondVO(Map varMap) throws BusinessException { + LogFilterCondVO voCond = new LogFilterCondVO(); + String pk_accountingbook = (String) varMap.get("pk_accountingbook"); + String pk_accasoa = (String) varMap.get("pk_accasoa"); + String acccode = (String) varMap.get("acccode"); + AccountVO voSubj = AccountUtilGL.findByPrimaryKey(pk_accasoa); + if (voSubj.getEndflag().booleanValue()) { + voCond.setSubjPk(voSubj.getPk_accasoa()); + voCond.setSubjCode(null); + } else { + voCond.setSubjCode(voSubj.getCode()); + voCond.setSubjPk(null); + } + + voCond.setPk_glorgbook(pk_accountingbook); + List> ass = (List>) varMap.get("ass"); + if (ass == null || ass.size() == 0) + voCond.setAssvos(null); + else { + List assList = new ArrayList(); + for (Map assMap : ass) { + AssVO vo = new AssVO(); + vo.setChecktypecode(StrTools.isEmptyStr((String) assMap.get("checktypecode")) ? null : (String) assMap.get("checktypecode")); + vo.setChecktypename(StrTools.isEmptyStr((String) assMap.get("checktypename")) ? null : (String) assMap.get("checktypename")); + vo.setCheckvaluecode(StrTools.isEmptyStr((String) assMap.get("checkvaluecode")) ? null : (String) assMap.get("checkvaluecode")); + vo.setCheckvaluename(StrTools.isEmptyStr((String) assMap.get("checkvaluename")) ? null : (String) assMap.get("checkvaluename")); + vo.setInnerCode(StrTools.isEmptyStr((String) assMap.get("innerCode")) ? null : (String) assMap.get("innerCode")); + vo.setnote1(StrTools.isEmptyStr((String) assMap.get("note1")) ? null : (String) assMap.get("note1")); + vo.setnote2(StrTools.isEmptyStr((String) assMap.get("note2")) ? null : (String) assMap.get("note2")); + vo.setPk_Checktype(StrTools.isEmptyStr((String) assMap.get("pk_Checktype")) ? null : (String) assMap.get("pk_Checktype")); + vo.setPk_Checkvalue(StrTools.isEmptyStr((String) assMap.get("pk_Checkvalue")) ? null : (String) assMap.get("pk_Checkvalue")); + vo.setM_metaClassid(StrTools.isEmptyStr((String) assMap.get("m_metaClassid")) ? null : (String) assMap.get("m_metaClassid")); + vo.setUserData(StrTools.isEmptyStr((String) assMap.get("userData")) ? null : (String) assMap.get("userData")); + vo.setM_classid(StrTools.isEmptyStr((String) assMap.get("m_classid")) ? null : (String) assMap.get("m_classid")); + assList.add(vo); + } + voCond.setAssvos(assList.toArray(new AssVO[0])); + } + + if (!StrTools.isEmptyStr((String) varMap.get("begin_date"))) { + voCond.setBeginDate(new UFDate((String) varMap.get("begin_date")).asBegin().toString()); + } else { + voCond.setBeginDate(null); + } + if (!StrTools.isEmptyStr((String) varMap.get("end_date"))) { + voCond.setEndDate(new UFDate((String) varMap.get("end_date")).asEnd().toString()); + } else { + voCond.setEndDate(null); + } + voCond.setDateType((String) varMap.get("dateType"));// voucherDate opdate Businessdate + /* 币种 */ + voCond.setCurPk((String) varMap.get("pk_currency")); + /* 核销号 */ + if (!StrTools.isEmptyStr((String) varMap.get("verifyno")) && ((String) varMap.get("verifyno")).length() > 0) { + voCond.setVerifyNo((String) varMap.get("verifyno")); + } else { + voCond.setVerifyNo(null); + } + voCond.setRedBlue("Y".equals(varMap.get("redBlue"))); + + /* 金额范围 */ + if (!StrTools.isEmptyStr((String) varMap.get("mny_begin")) && ((String) varMap.get("mny_begin")).length() > 0) { + voCond.setM_MnyBeginHis(new UFDouble((String) varMap.get("mny_begin"))); + } else { + voCond.setM_MnyBeginHis(null); + } + if (!StrTools.isEmptyStr((String) varMap.get("mny_end")) && ((String) varMap.get("mny_end")).length() > 0) { + voCond.setM_MnyEndHis(new UFDouble((String) varMap.get("mny_end"))); + } else { + voCond.setM_MnyEndHis(null); + } + + /* 摘要 */ + if (!StrTools.isEmptyStr((String) varMap.get("digest")) && ((String) varMap.get("digest")).length() > 0) { + voCond.setM_DigestHis((String) varMap.get("digest")); + } else { + voCond.setM_DigestHis(null); + } + /* 业务单元 */ + if (varMap.get("pk_units") == null) { + if (GLParaAccessor.isSecondBUStart((String) varMap.get("pk_accountingbook")).booleanValue()) { + BUWithBookRefModel bumodel = new BUWithBookRefModel(pk_accountingbook); + List orgs = bumodel.getPowerBUOrgs(); + List pk_orgs = new ArrayList(); + for (OrgVO orgVO : orgs) { + pk_orgs.add(orgVO.getPk_org()); + } + voCond.setPk_unit(pk_orgs.toArray(new String[0])); + } + } else { + Object[] objPk_units = ((List) varMap.get("pk_units")).toArray(); + String[] pk_units = new String[objPk_units.length]; + for (int i = 0; i < objPk_units.length; i++) { + pk_units[i] = (String) objPk_units[i]; + } + voCond.setPk_unit(pk_units); + } + return voCond; + } + + public void checkHistoryCondition(Map varMap) throws BusinessException { + if (varMap.get("pk_currency") == null) { + throw new BusinessException(VerifyMsg.getMSG_NOCURR_ERROR()); + } + if (varMap.get("pk_accasoa") == null) { + throw new BusinessException(VerifyMsg.getMSG_NOACSUBJ_ERROR()); + } + if (varMap.get("begin_date") != null && varMap.get("begin_date") != null) { + if (new UFDate((String) varMap.get("begin_date")).asBegin().after( + new UFDate((String) varMap.get("end_date")).asEnd())) { + throw new BusinessException(VerifyMsg.getMSG_ENDDATE_EARLY_THAN_STARTDATE_ERROR()); + } + } + } + + public Map>[] getDebitVerifyWebInfo() { + return m_DebitVerifyWeb; + } + + public void setDebitVerifyWebInfo(Map>[] m_DebitVerifyWeb) { + this.m_DebitVerifyWeb = m_DebitVerifyWeb; + } + + public Map>[] getCreditVerifyWebInfo() { + return m_CreditVerifyWeb; + } + + public void setCreditVerifyWebInfo(Map>[] m_CreditVerifyWeb) { + this.m_CreditVerifyWeb = m_CreditVerifyWeb; + } + + public VerifyDisplogWebVO[] getSumLogs() { + return m_sumLogsWeb; + } + + public void setSumLogs(VerifyDisplogWebVO[] m_sumLogs) { + this.m_sumLogsWeb = m_sumLogs; + } + + public VerifyDisplogWebVO[] getDetailLogsWeb() { + return m_detailLogsWeb; + } + + public void setDetailLogsWeb(VerifyDisplogWebVO[] m_detailLogsWeb) { + this.m_detailLogsWeb = m_detailLogsWeb; + } + + public VerifyDetailVO[] transferWebToVO(VerifyDetailWebVO[] vos) { + List detailist = new ArrayList(); + for (VerifyDetailWebVO webvo : vos) { + VerifyDetailVO detailvo = webvo.toVerifyDetail(); + detailist.add(detailvo); + } + return detailist.toArray(new VerifyDetailVO[0]); + } + + public GlVerifyDisplogVO[] transferWebToDispLogVO(VerifyDisplogWebVO[] vos) { + List detailist = new ArrayList(); + for (VerifyDisplogWebVO webvo : vos) { + GlVerifyDisplogVO diplogVO = webvo.toVerifyDisplog(); + detailist.add(diplogVO); + } + return detailist.toArray(new GlVerifyDisplogVO[0]); + } + + public Integer getQuantityDigit() throws BusinessException { + Integer quantityDigit = ICurrtypeConst.CURRTYPE_DEFAULT_DIGIT; + try { + quantityDigit = VoucherDataCenter.getQuantityPrecision(getPk_accountingbook(), + ((VerifyObjHeaderVO) m_verifyObj.getParentVO()).getPk_accsubj(), + new UFDate(InvocationInfoProxy.getInstance().getBizDateTime()).toString()); + } catch (Exception e) { + quantityDigit = ICurrtypeConst.CURRTYPE_DEFAULT_DIGIT; + } + return quantityDigit; + } +} + +/*ENgVVTBL/QYrqzND3PB6ToRGmBxhcAFpb7WzTq5L+LQ=*/ \ No newline at end of file diff --git a/gl/src/public/nc/vo/glrp/com/verify/MultiMatch.java b/gl/src/public/nc/vo/glrp/com/verify/MultiMatch.java new file mode 100644 index 0000000..4150c1d --- /dev/null +++ b/gl/src/public/nc/vo/glrp/com/verify/MultiMatch.java @@ -0,0 +1,661 @@ +/*kOCZ2rdZQh+oO4IyZSOXGg0LHHc/urYgAeiJss7fL0A=*/ +package nc.vo.glrp.com.verify; + +import nc.bs.logging.Logger; +import nc.vo.gateway60.itfs.Currency; +import nc.vo.gateway60.pub.GlBusinessException; +import nc.vo.glcom.shellsort.CShellSort; +import nc.vo.glcom.sorttool.CVoSortTool; +import nc.vo.glrp.pub.VerifyMsg; +import nc.vo.glrp.pub.VoComparer; +import nc.vo.glrp.verify.VerifyDetailKey; +import nc.vo.glrp.verify.VerifyDetailVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDouble; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.List; + +/** + * @author mzr + * @ClassName: MultiMatch + * @Description: 异币种借贷核销实现类 + * @date 2013-6-18 下午01:49:19 + */ +public class MultiMatch implements IMatchTool { + + public IVerifyVO[] m_debitvos; + public IVerifyVO[] m_creditvos; + private VerifyRuleVO m_rulevo; + private List m_alLogs; + private Hashtable> m_hash; + private VoComparer m_comparer; + private String pk_accountingbook; + private String pk_user; + private String pk_group; + private UFDate oprDate; + + public String getPk_user() { + return this.pk_user; + } + + public void setPk_user(String pk_user) { + this.pk_user = pk_user; + } + + public String getPk_group() { + return this.pk_group; + } + + public void setPk_group(String pk_group) { + this.pk_group = pk_group; + } + + public UFDate getOprDate() { + return this.oprDate; + } + + public void setOprDate(UFDate oprDate) { + this.oprDate = oprDate; + } + + public void setDebitData(IVerifyVO[] debtDataVos) { + this.m_debitvos = debtDataVos; + } + + public IVerifyVO[] getDebitData() { + return this.m_debitvos; + } + + public void setCreditData(IVerifyVO[] creditDataVo) { + this.m_creditvos = creditDataVo; + } + + public IVerifyVO[] getCreditData() { + return this.m_creditvos; + } + + public void setRule(VerifyRuleVO rulevo) { + this.m_rulevo = rulevo; + } + + public VerifyRuleVO getRule() { + return this.m_rulevo; + } + + private Hashtable> getHash() { + if (this.m_hash == null) { + this.m_hash = new Hashtable(); + } + + return this.m_hash; + } + + private VoComparer getComparer() { + if (this.m_comparer == null) { + this.m_comparer = new VoComparer(); + } + + return this.m_comparer; + } + + + /** + *

Title:

+ *

Description:

+ */ + public MultiMatch() { + + } + + /* (非 Javadoc) + *

Title: getLogData

+ *

Description:

+ * @return + * @see nc.vo.glrp.com.verify.IMatchTool#getLogData() + */ + public ILogVO[] getLogData() { + if (this.m_alLogs != null && !this.m_alLogs.isEmpty()) { + try { + ILogVO[] logs = (ILogVO[]) Array.newInstance(this.m_alLogs.get(0).getClass(), this.m_alLogs.size()); + logs = (ILogVO[]) this.m_alLogs.toArray(logs); + return logs; + } catch (Exception ex) { + Logger.error(ex.getMessage(), ex); + return null; + } + } else { + return null; + } + } + + /* (非 Javadoc) + *

Title: getToolName

+ *

Description:

+ * @return + * @see nc.vo.glrp.com.verify.IMatchTool#getToolName() + */ + public String getToolName() { + return "GLMultiMatch"; + } + + /* (非 Javadoc) + *

Title: onMatch

+ *

Description: 异币种核销匹配算法

+ * @see nc.vo.glrp.com.verify.IMatchTool#onMatch() + */ + public void onMatch() throws Exception { + try { + // 检查借贷方数据为空 + checkData(); + removeOldData(); + perpareData(); + + boolean bDebitLoop = true; + String shashKey; + bDebitLoop = (getDebitData().length < getCreditData().length); + IVerifyVO[] voloop = bDebitLoop ? getDebitData() : getCreditData(); + String[] sObjkeys = bDebitLoop ? getRule().getDebtObjKeys() : getRule().getCreditObjKeys(); + UFDouble[] dealMny = new UFDouble[2];// 记录较少的一方的未核销金额 + UFDouble[] oppMny = new UFDouble[2];// 记录较多的一方的未核销金额 + UFDouble[] verifyMny = new UFDouble[2];// 本次核销金额 + + if (getRule().getDateName() != null && getRule().getMaxDateError() != null) { + getComparer().setCompareKey(new String[]{getRule().getDateName()}); + getComparer().setDaterange(getRule().getMaxDateError().intValue()); + } + List alOpp = null; + IVerifyVO voOpp = null; + for (int i = 0; i < voloop.length; i++) { + if (bDebitLoop) { + dealMny[0] = voloop[i].getDebit_Money_Y(); + dealMny[1] = voloop[i].getDebit_Money_B(); + } else { + dealMny[0] = voloop[i].getCredit_Money_Y(); + dealMny[1] = voloop[i].getCredit_Money_B(); + } + if (isSettled(dealMny)) { + continue; + } + shashKey = gethashKey(voloop[i], sObjkeys); + try { + alOpp = getHash().get(shashKey); + if (alOpp == null || alOpp.size() == 0) { + continue; + } + } catch (Exception ex) { + continue; + } + for (int j = 0; j < alOpp.size(); ) { + if (isSettled(dealMny)) {// 如果记录较少的一方未核销金额为0,则表示改记录已核销完,继续下一条记录 + break; + } + voOpp = (IVerifyVO) alOpp.get(j); + if (bDebitLoop) { + oppMny[0] = voOpp.getCredit_Money_Y(); + oppMny[1] = voOpp.getCredit_Money_B(); + } else { + oppMny[0] = voOpp.getDebit_Money_Y(); + oppMny[1] = voOpp.getDebit_Money_B(); + } + if (isSettled(oppMny)) { + alOpp.remove(j); + continue; + } + if (!existInDateRange(voloop[i], voOpp)) { + j++; + continue; + } + //--add by pangjsh 判断数据方向是否同向 + if (!isVerifyEnable(voloop[i], voOpp, bDebitLoop)) { + j++; + continue; + } + /*判断核销金额*/ + /*如果是红对兰则按照兰字金额核销*/ + for (int m = 0; m < verifyMny.length; m++) { + if (dealMny[m] != null && oppMny[m] != null) {// 取借贷方未核销金额少的作为本次核销金额 + verifyMny[m] = dealMny[m].abs().compareTo(oppMny[m].abs()) > 0 ? oppMny[m] : dealMny[m]; + } else { + verifyMny[m] = ZERO; + } + } + if (isSettled(verifyMny)) { + j++; + continue; + } + /*形成log,回写余额*/ + // 计算本次核销后,记录较多的一方的未核销金额 + if (bDebitLoop) { + m_alLogs.addAll(generateLogs(verifyMny, voloop[i], voOpp)); + if (voOpp.getCredit_Money_Y() != null && !verifyMny[0].equals(ZERO)) { + voOpp.setCredit_Money_Y( + voOpp.getCredit_Money_Y().sub(verifyMny[0], verifyMny[0].getPower())); + } + if (voOpp.getCredit_Money_B() != null && !verifyMny[1].equals(ZERO)) { + voOpp.setCredit_Money_B( + voOpp.getCredit_Money_B().sub(verifyMny[1], verifyMny[1].getPower())); + } + + } else { + m_alLogs.addAll(generateLogs(verifyMny, voOpp, voloop[i])); + if (voOpp.getDebit_Money_Y() != null && !verifyMny[0].equals(ZERO)) { + voOpp.setDebit_Money_Y( + voOpp.getDebit_Money_Y().sub(verifyMny[0], verifyMny[0].getPower())); + } + if (voOpp.getDebit_Money_B() != null && !verifyMny[1].equals(ZERO)) { + voOpp.setDebit_Money_B( + voOpp.getDebit_Money_B().sub(verifyMny[1], verifyMny[1].getPower())); + } + } + // 计算本次核销后,记录较少的一方的未核销金额 + for (int n = 0; n < dealMny.length; n++) { + if (dealMny[n] != null && !verifyMny[n].equals(ZERO)) { + dealMny[n] = dealMny[n].sub(verifyMny[n], verifyMny[n].getPower()); + } + } + if (bDebitLoop) { + if (isSettled(new UFDouble[]{voOpp.getCredit_Money_Y(), + voOpp.getCredit_Money_B()})) { + alOpp.remove(j); + } + } else { + if (isSettled(new UFDouble[]{voOpp.getDebit_Money_Y(), + voOpp.getDebit_Money_B()})) { + alOpp.remove(j); + } + } + } + /*回写余额*/ + if (bDebitLoop) { + voloop[i].setDebit_Money_Y(dealMny[0]); + voloop[i].setDebit_Money_B(dealMny[1]); + } else { + voloop[i].setCredit_Money_Y(dealMny[0]); + voloop[i].setCredit_Money_B(dealMny[1]); + } + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new GlBusinessException(e.getMessage()); + } + } + + /** + * @param @throws BusinessException + * @return void + * @throws + * @Title: checkData + * @Description: 检查借贷方数据为空 + */ + private void checkData() throws BusinessException { + if (getDebitData() == null || getDebitData().length == 0 || getCreditData() == null || getCreditData().length == 0) { + throw new BusinessException(VerifyMsg.getMSG_NOVERIFYDATA()); + } + } + + /** + * @param + * @return void + * @throws + * @Title: removeOldData + * @Description: 清除旧数据 + */ + private void removeOldData() { + m_alLogs = new ArrayList(); + getHash().clear(); + } + + /** + * @param @throws Exception + * @return void + * @throws + * @Title: perpareData + * @Description: TODO(准备新数据) + */ + private void perpareData() throws BusinessException { + try { + // 借贷方有数据不存在就返回 + if (getDebitData() == null || getDebitData().length == 0 || getCreditData() == null || getCreditData().length == 0) { + return; + } + // 按币种格式化借方金额 + for (int i = 0; i < getDebitData().length; i++) { + // todo 1 + String currPk = getDebitData()[i].getCurrPk(); + getDebitData()[i].setDebit_Money_Y(Currency.formatByCurrType(currPk, getDebitData()[i].getDebit_Money_Y())); + getDebitData()[i].setDebit_Money_B(Currency.formatByCurrType(Currency.getLocalCurrPK(getPk_accountingbook()), getDebitData()[i].getDebit_Money_B())); + } + // 按币种格式化贷方金额 + for (int i = 0; i < getCreditData().length; i++) { + // todo 1 + String currPk = getCreditData()[i].getCurrPk(); + getCreditData()[i].setCredit_Money_Y(Currency.formatByCurrType(currPk, getCreditData()[i].getCredit_Money_Y())); + getCreditData()[i].setCredit_Money_B(Currency.formatByCurrType(Currency.getLocalCurrPK(getPk_accountingbook()), getCreditData()[i].getCredit_Money_B())); + + } + // 按规则排序借方数据 + sortData(true, getRule().getDebtSortKeys()); + // 按规则排序贷方数据 + sortData(false, getRule().getCreditSortKeys()); + + if (getCreditData().length > getDebitData().length) { + fill2Hash(getCreditData(), false); + } else { + fill2Hash(getDebitData(), true); + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new GlBusinessException(e.getMessage()); + } + } + + /** + * @param isDebit + * @param sortKeys + * @throws Exception + * @Title: sortData + * @Description: TODO(按照设置的排序字段排序) + */ + private void sortData(boolean isDebit, String[] sortKeys) throws Exception { + if (sortKeys != null && sortKeys.length > 0) { + int[] iIndex = sortKeys[0].equals("prepareddate") ? + new int[]{VerifyDetailKey.VOUCHDATE, VerifyDetailKey.VOUCHERTYPENAME, + VerifyDetailKey.DISP_VOUCHERNO, VerifyDetailKey.DETAILINDEX} : + new int[]{VerifyDetailKey.BUSINESSDATE, VerifyDetailKey.VOUCHERTYPENAME, + VerifyDetailKey.DISP_VOUCHERNO, VerifyDetailKey.DETAILINDEX}; + CShellSort objShellSort = new CShellSort(); + CVoSortTool objVoSortTool = new CVoSortTool(); + objVoSortTool.setSortIndex(iIndex); + objShellSort.sort(isDebit ? getDebitData() : getCreditData(), objVoSortTool, !getRule().getVerifySeq().booleanValue()); + } else { + getComparer().setDaterange(0); + getComparer().setAscend(getRule().getVerifySeq().booleanValue()); + getComparer().setCompareKey(new String[]{getRule().getDateName()}); + Arrays.sort(getDebitData(), getComparer()); + } + } + + /** + * @param @param vos + * @param @param bDebit + * @return void + * @throws + * @Title: fill2Hash + * @Description: TODO(将数据添加到hash表中) + */ + private void fill2Hash(IVerifyVO[] vos, boolean bDebit) { + // 得到核销部分标准(按核销号、金额相等、末级科目、按对账标识码、按辅助项中的全部或部分) + String[] sKeys = (bDebit ? getRule().getDebtObjKeys() : getRule().getCreditObjKeys()); + String sCurrKey = null; + List oCurrValues = null; + for (int i = 0; i < vos.length; i++) { + sCurrKey = gethashKey(vos[i], sKeys); + oCurrValues = getHash().get(sCurrKey); + if (oCurrValues == null) { + oCurrValues = new ArrayList(); + } + if (isEqual(vos[i], sKeys)) { + oCurrValues.add(vos[i]); + getHash().put(sCurrKey, oCurrValues); + } + } + } + + /** + * @param @param verifyvo + * @param @param skeys + * @param @return + * @return String + * @throws + * @Title: gethashKey + * @Description: TODO(得到hash键值) + */ + private String gethashKey(IVerifyVO verifyvo, String[] skeys) { + StringBuffer shashKey = new StringBuffer(); + if (skeys == null || skeys.length <= 0) { + return "null"; + } + Object ob = null; + for (int i = 0; i < skeys.length; i++) { + if (skeys[i].equals("Mny")) { + // modified by shipl 2015-11-12 15:26:58 :原币相等即可核销! + if (verifyvo.getDirect().equals(IVerifyVO.I_DEBIT)) { /*借方*/ + ob = verifyvo.getDebit_Money_Y(); + shashKey.append("_").append(ob == null ? "null" : ob.toString()); +// ob = verifyvo.getDebit_Money_B(); +// shashKey.append("_").append(ob == null ? "null" : ob.toString()); + } else { /*贷方*/ + ob = verifyvo.getCredit_Money_Y(); + shashKey.append("_").append(ob == null ? "null" : ob.toString()); +// ob = verifyvo.getCredit_Money_B(); +// shashKey.append("_").append(ob == null ? "null" : ob.toString()); + } + } else { + ob = verifyvo.getAttributeValue(skeys[i]); + shashKey.append("_").append(ob == null ? "null" : ob.toString()); + } + } + return shashKey.toString(); + } + + /** + * @param @param vo 当前待核销的数据 + * @param @param sKeys 核销部分标准(按核销号、金额相等、末级科目、按对账标识码、按辅助项中的全部或部分) + * @param @return + * @return boolean + * @throws + * @Title: isEqual + * @Description: TODO(判断数据的辅助核算与自动核销按辅助项中辅助核算是否一致) + */ + private boolean isEqual(IVerifyVO vo, String[] sKeys) { + boolean result = true; + VerifyDetailVO vo1 = (VerifyDetailVO) vo; + if (null != sKeys && sKeys.length > 0) { + for (int i = 0; i < sKeys.length; i++) { + if (null != sKeys[i] && sKeys[i].startsWith("fzhs_")) { + String asstype = sKeys[i].substring(5, 25); + String assvalue = sKeys[i].substring(25); + for (int j = 0; vo1.getAss() != null && j < vo1.getAss().length; j++) { + if (vo1.getAss()[j] != null) { + if (vo1.getAss()[j].getPk_Checktype().equals(asstype)) { + if (!"null".equals(assvalue) && !isExists(vo1.getAss()[j].getPk_Checkvalue(), assvalue)) { + result = false; + break; + } + } + } + } + } + } + } + return result; + } + + /** + * @param @param pk_checkvalue 比如pk_checkvalue="100288100000000000K2" + * @param @param assvalue 比如assvalue="100288100000000000K1,100288100000000000K2" + * @param @return + * @return boolean + * @throws + * @Title: isExists + * @Description: TODO(判断pk_checkvalue是否存在于assvalue中) + */ + private boolean isExists(String pk_checkvalue, String assvalue) { + String[] tmpArr = assvalue.split(","); + if (null != tmpArr && tmpArr.length > 0) { + for (int i = 0; i < tmpArr.length; i++) { + if (null != tmpArr[i] && tmpArr[i].equals(pk_checkvalue)) { + return true; + } + } + } + return false; + } + + /** + * @param @param vo1 + * @param @param vo2 + * @param @return + * @return boolean + * @throws + * @Title: existInDateRange + * @Description: TODO(判断两vo是否在核销规则的日期误差天数内) + */ + private boolean existInDateRange(IVerifyVO vo1, IVerifyVO vo2) { + if (getRule().getMaxDateError() != null) { + getComparer().setDaterange(getRule().getMaxDateError().intValue()); + getComparer().setCompareKey(new String[]{getRule().getDateName()}); + return getComparer().compare(vo1, vo2) == 0 ? true : false; + } + return true; + } + + /** + * 功能:判断两vo是否数据同向 + * 作者:逄居升 + * 创建时间:(2014-6-19 13:05:15) + * 参数:<|> + * 返回值: + * 算法: + * + * @param vo1 nc.vo.glrp.com.verify.IVerifyVO + * @param vo2 nc.vo.glrp.com.verify.IVerifyVO + * @return boolean + */ + private boolean isVerifyEnable(IVerifyVO vo1, IVerifyVO vo2, boolean bDebitLoop) { + + if (bDebitLoop) { + UFDouble[] debit = new UFDouble[]{vo1.getDebit_Money_Y(), vo1.getDebit_Money_B()}; + UFDouble[] credit = new UFDouble[]{vo2.getCredit_Money_Y(), vo2.getCredit_Money_B()}; + for (int i = 0; i < debit.length; i++) { + if ((debit[i].doubleValue() > 0 && credit[i].doubleValue() > 0) + || (debit[i].doubleValue() < 0 && credit[i].doubleValue() < 0) + || (debit[i].equals(ZERO) && credit[i].equals(ZERO))) {// 本币、原币不一致的可能原币已等于0,而本币不等于0 + continue; + } else { + return false; + } + } + } else { + UFDouble[] credit = new UFDouble[]{vo1.getCredit_Money_Y(), vo1.getCredit_Money_B()}; + UFDouble[] debit = new UFDouble[]{vo2.getDebit_Money_Y(), vo2.getDebit_Money_B()}; + for (int i = 0; i < debit.length; i++) { + if ((debit[i].doubleValue() > 0 && credit[i].doubleValue() > 0) + || (debit[i].doubleValue() < 0 && credit[i].doubleValue() < 0) + || (debit[i].equals(ZERO) && credit[i].equals(ZERO))) { + continue; + } else { + return false; + } + } + } + return true; + } + + /** + * @param @param ufdMny 未核销余额 + * @param @return + * @return boolean + * @throws + * @Title: isSettled + * @Description: TODO(判断一条数据的原币和组织本币金额是否已全部核销完) + */ + private boolean isSettled(UFDouble[] ufdMny) { + if (ufdMny == null || ufdMny.length < 1) { + return true; + } + for (int i = 0; i < ufdMny.length; i++) { + if (!ufdMny[i].equals(ZERO)) { + return false; + } + } + return true; + } + + /* (非 Javadoc) + *

Title: getPk_accountingbook

+ *

Description:

+ * @return + * @see nc.vo.glrp.com.verify.IMatchTool#getPk_accountingbook() + */ + @Override + public String getPk_accountingbook() { + return this.pk_accountingbook; + } + + /* (非 Javadoc) + *

Title: setPk_accountingbook

+ *

Description:

+ * @param pkAccountingbook + * @see nc.vo.glrp.com.verify.IMatchTool#setPk_accountingbook(java.lang.String) + */ + @Override + public void setPk_accountingbook(String pkAccountingbook) { + this.pk_accountingbook = pkAccountingbook; + } + + /** + * @param @param verifyMoney 本次核销金额 + * @param @param voDebit 借方数据 + * @param @param voCredit 贷方数据 + * @param @return + * @return List 返回借贷方核销日志VO集合 + * @throws + * @Title: generateLogs + * @Description: TODO(生成一条借方和一条贷方数据核销的核销日志) + */ + private List generateLogs(UFDouble[] verifyMoney, IVerifyVO voDebit, IVerifyVO voCredit) { + List logVOList = new ArrayList(); + // 借方数据核销日志 + ILogVO debitLog = LogVOFactory.getNewLogVO(getRule().getLogClassName()); + debitLog.setBatchID(getRule().getBatchId()); + debitLog.setVerifyObjPK(getRule().getDebitVerifyObj()); + debitLog.setOppVerifyObjPK(getRule().getCreditVerifyObj()); + debitLog.setData(voDebit); + debitLog.setDataPk(voDebit.getPk()); + debitLog.setDebitBalaMny_y(verifyMoney[0]); + debitLog.setDebitBalaMny_b(verifyMoney[1]); + debitLog.setCreDitBalaMny_b(ZERO); + debitLog.setCreDitBalaMny_y(ZERO); + debitLog.setFlag(MainFlag);// todo 1 + debitLog.setOppData(voCredit); + debitLog.setOppDataPk(voCredit.getPk()); + debitLog.setOprDate(getOprDate()); + debitLog.setOprPk(getPk_user()); + // debitLog.setOprType(ILogVO.VERIFY); + debitLog.setOprType(2); // 异币种核销 todo 1 + debitLog.setPairNum(getRule().getNextPairNum()); + debitLog.setPk_group(getPk_group()); + logVOList.add(debitLog); + // 贷方数据核销日志 + ILogVO creditLog = LogVOFactory.getNewLogVO(getRule().getLogClassName()); + creditLog.setBatchID(getRule().getBatchId()); + creditLog.setVerifyObjPK(getRule().getCreditVerifyObj()); + creditLog.setOppVerifyObjPK(getRule().getDebitVerifyObj()); + creditLog.setData(voCredit); + creditLog.setDataPk(voCredit.getPk()); + creditLog.setDebitBalaMny_b(ZERO); + creditLog.setDebitBalaMny_y(ZERO); + creditLog.setCreDitBalaMny_y(verifyMoney[0]); + creditLog.setCreDitBalaMny_b(verifyMoney[1]); + creditLog.setFlag(AssFlag);// todo 1 + creditLog.setOppData(voDebit); + creditLog.setOppDataPk(voDebit.getPk()); + creditLog.setOprDate(getOprDate()); + creditLog.setOprPk(getPk_user()); + // creditLog.setOprType(ILogVO.VERIFY); + creditLog.setOprType(2); // 异币种核销 todo 1 + creditLog.setPairNum(getRule().getPairNum()); + creditLog.setPk_group(getPk_group()); + logVOList.add(creditLog); + return logVOList; + } + +} + +/*kOCZ2rdZQh+oO4IyZSOXGg0LHHc/urYgAeiJss7fL0A=*/ \ No newline at end of file From 684f9a1d95602a1ee9c6be7e428e4b58d3774ac4 Mon Sep 17 00:00:00 2001 From: mzr <1562242162@qq.com> Date: Wed, 12 Mar 2025 10:56:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=B8=E9=94=802-=E5=B7=B2=E6=9A=82?= =?UTF-8?q?=E5=81=9C=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/gl/verify/action/VerifyMulAction.java | 32 +++ .../gl/app/config/authorize/verify.xml | 83 ++++++++ .../gl/verify/config/action/action.xml | 199 ++++++++++++++++++ .../lightgl/verify/VerifyWebServiceImpl.java | 87 +++++--- .../gl/lightgl/verify/IVerifyWebService.java | 47 +++++ 5 files changed, 420 insertions(+), 28 deletions(-) create mode 100644 gl/src/client/nccloud/web/gl/verify/action/VerifyMulAction.java create mode 100644 gl/src/client/yyconfig/modules/gl/app/config/authorize/verify.xml create mode 100644 gl/src/client/yyconfig/modules/gl/verify/config/action/action.xml create mode 100644 gl/src/public/nccloud/pubitf/gl/lightgl/verify/IVerifyWebService.java diff --git a/gl/src/client/nccloud/web/gl/verify/action/VerifyMulAction.java b/gl/src/client/nccloud/web/gl/verify/action/VerifyMulAction.java new file mode 100644 index 0000000..986d2c1 --- /dev/null +++ b/gl/src/client/nccloud/web/gl/verify/action/VerifyMulAction.java @@ -0,0 +1,32 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.web.gl.verify.action; + +import nc.vo.pub.BusinessException; +import nccloud.dto.gl.verify.VerifyInfoWebVO; +import nccloud.framework.core.exception.ExceptionUtils; +import nccloud.framework.service.ServiceLocator; +import nccloud.framework.web.action.itf.ICommonAction; +import nccloud.framework.web.container.IRequest; +import nccloud.framework.web.json.JsonFactory; +import nccloud.pubitf.gl.lightgl.verify.IVerifyWebService; + +public class VerifyMulAction implements ICommonAction { + public VerifyMulAction() { + } + + public Object doAction(IRequest request) { + String json = request.read(); + VerifyInfoWebVO verifyInfoWebVO = (VerifyInfoWebVO)JsonFactory.create().fromJson(json, VerifyInfoWebVO.class); + + try { + return ((IVerifyWebService)ServiceLocator.find(IVerifyWebService.class)).onVerifyMul(verifyInfoWebVO); + } catch (BusinessException e) { + ExceptionUtils.wrapException(e); + return null; + } + } +} diff --git a/gl/src/client/yyconfig/modules/gl/app/config/authorize/verify.xml b/gl/src/client/yyconfig/modules/gl/app/config/authorize/verify.xml new file mode 100644 index 0000000..2399e69 --- /dev/null +++ b/gl/src/client/yyconfig/modules/gl/app/config/authorize/verify.xml @@ -0,0 +1,83 @@ + + + + 20020NAIPT,20020VRIFY,20020VYOBS,20021DLANL,20021VYBAL,20021VYQRY + + + gl.voucher.queryBookCombineInfo + + >gl.voucher.queryAssItem + + gl.verify.query + + gl.verify.onverify + + gl.verify.onverifyMul + + gl.verify.historyquery + + gl.verify.verhistoryprint + + gl.verify.verhistoryoutput + + gl.verify.verifybeginprint + + gl.verify.verifybeginoutput + + gl.verify.unverify + + gl.verify.onRedBlue + + gl.verify.onAutoVerify + + gl.verify.onAutoRedBlue + + gl.verify.verBalanceQuery + + gl.verify.verbalanceprint + + gl.verify.verbalanceoutput + + gl.verify.verDetailQuery + + gl.verify.verDetailLinkQuery + + gl.verify.accountAgeAnalysis + + gl.verify.accountAgeAnalysisDetail + + gl.verify.badaccountrate + + gl.verify.verifyobjquery + + gl.verify.verifyobjsave + + gl.verify.verifyobjdelete + + gl.verify.verifyobjcheck + + gl.verify.verifyobjenable + + gl.verify.verifyobjdisable + + gl.verify.verifyinitquery + + gl.verify.verifyinitheadtitle + + gl.verify.verifyinitsave + + gl.verify.verifyinitimportqc + + gl.verify.verifyinitfromvoucher + + gl.verify.verifyinitexportexcel + + gl.verify.verifyinitimportexcel + + gl.verify.verifyobjcheckbu + + gl.verify.verifyobjinfo + gl.voucher.voucherRelatedApp + + + diff --git a/gl/src/client/yyconfig/modules/gl/verify/config/action/action.xml b/gl/src/client/yyconfig/modules/gl/verify/config/action/action.xml new file mode 100644 index 0000000..52e8949 --- /dev/null +++ b/gl/src/client/yyconfig/modules/gl/verify/config/action/action.xml @@ -0,0 +1,199 @@ + + + + gl.verify.rtverify + + nccloud.web.gl.verify.action.RTVerifyAction + + + gl.verify.refverify + + nccloud.web.gl.verify.action.RefVerifyAction + + + + gl.verify.query + + nccloud.web.gl.verify.action.QueryVerifyAction + + + + gl.verify.onverify + + nccloud.web.gl.verify.action.VerifyMulAction + + + + gl.verify.onverifyMul + + nccloud.web.gl.verify.action.VerifyMulAction + + + + gl.verify.historyquery + + nccloud.web.gl.verify.action.HistoryQueryAction + + + + gl.verify.verhistoryprint + + nccloud.web.gl.verify.action.VerHistoryPrintAction + + + gl.verify.verhistoryoutput + + nccloud.web.gl.verify.action.VerHistoryOutputAction + + + gl.verify.verifybeginprint + + nccloud.web.gl.verify.action.VerifyBeginPrintAction + + + gl.verify.verifybeginoutput + + nccloud.web.gl.verify.action.VerifyBeginOutputAction + + + gl.verify.unverify + + nccloud.web.gl.verify.action.UnVerifyAction + + + + gl.verify.onRedBlue + + nccloud.web.gl.verify.action.RedBlueAction + + + + gl.verify.onAutoVerify + + nccloud.web.gl.verify.action.AutoVerifyAction + + + + gl.verify.onAutoRedBlue + + nccloud.web.gl.verify.action.AutoRedBlueAction + + + + gl.verify.verBalanceQuery + + nccloud.web.gl.verify.action.VerBalanceQueryAction + + + gl.verify.verbalanceprint + + nccloud.web.gl.verify.action.VerBalancePrintAction + + + gl.verify.verbalanceoutput + + nccloud.web.gl.verify.action.VerBalanceOutputAction + + + gl.verify.verDetailQuery + + nccloud.web.gl.verify.action.VerDetailQueryAction + + + gl.verify.verDetailLinkQuery + + nccloud.web.gl.verify.action.VerDetailLinkQueryAction + + + + gl.verify.accountAgeAnalysis + + nccloud.web.gl.verify.action.AccoungAgeAnalysisAction + + + gl.verify.accountAgeAnalysisDetail + + nccloud.web.gl.verify.action.AccoungAgeAnalysisDetailAction + + + gl.verify.badaccountrate + + nccloud.web.gl.verify.action.BadAccountRateAction + + + + gl.verify.verifyobjquery + + nccloud.web.gl.verify.action.VerifyObjQueryAction + + + gl.verify.verifyobjsave + + nccloud.web.gl.verify.action.VerifyObjSaveAction + + + gl.verify.verifyobjdelete + + nccloud.web.gl.verify.action.VerifyObjDeleteAction + + + gl.verify.verifyobjcheck + + nccloud.web.gl.verify.action.VerifyObjCheckAction + + + gl.verify.verifyobjenable + + nccloud.web.gl.verify.action.VerifyObjEnableAction + + + gl.verify.verifyobjdisable + + nccloud.web.gl.verify.action.VerifyObjDisableAction + + + gl.verify.verifyinitquery + + nccloud.web.gl.verify.action.VerifyInitQueryAction + + + gl.verify.verifyinitheadtitle + + nccloud.web.gl.verify.action.VerifyInitHeadTitleAction + + + gl.verify.verifyinitsave + + nccloud.web.gl.verify.action.VerifyInitSaveAction + + + gl.verify.verifyinitimportqc + + nccloud.web.gl.verify.action.VerifyInitImportQCAction + + + gl.verify.verifyinitfromvoucher + + nccloud.web.gl.verify.action.VerifyInitFromVoucherAction + + + gl.verify.verifyinitexportexcel + + nccloud.web.gl.verify.action.VerifyInitExportExcelAction + + + gl.verify.verifyinitimportexcel + + nccloud.web.gl.verify.action.VerifyInitImportExcelAction + + + gl.verify.verifyobjcheckbu + + nccloud.web.gl.verify.action.VerifyObjCheckBUAction + + + gl.verify.verifyobjinfo + + nccloud.web.gl.verify.action.VerifyObjInfoAction + + diff --git a/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java b/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java index f3c509d..91c042e 100644 --- a/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java +++ b/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java @@ -244,8 +244,31 @@ public class VerifyWebServiceImpl implements IVerifyWebService { verifyModel.setDebitVerify(debitVerifyVOs); verifyModel.onVerify(); verifyModel.onQuery(verifyModel.getFilterVO(verifyInfoWebVO.getCondition())); - resultMap.put("credit", verifyModel.getCreditVerifyWebInfo()); - resultMap.put("debit", verifyModel.getDebitVerifyWebInfo()); + Map>[] creditInfo = verifyModel.getCreditVerifyWebInfo(); + Map>[] debitInfo = verifyModel.getDebitVerifyWebInfo(); + setCurrTypeNameForVerify(creditInfo, debitInfo); + resultMap.put("credit", creditInfo); + resultMap.put("debit", debitInfo); + return resultMap; + } + + @Override + public Map onVerifyMul(VerifyInfoWebVO verifyInfoWebVO) throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) verifyInfoWebVO.getCondition().get("pk_accountingbook")); + verifyModel.checkVerifyObj(verifyInfoWebVO.getCondition()); + VerifyDetailVO[] creditVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getCredit().toArray(new VerifyDetailWebVO[0])); + VerifyDetailVO[] debitVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getDebit().toArray(new VerifyDetailWebVO[0])); + verifyModel.setCreditVerify(creditVerifyVOs); + verifyModel.setDebitVerify(debitVerifyVOs); + verifyModel.onVerifyMul(); + verifyModel.onQuery(verifyModel.getFilterVO(verifyInfoWebVO.getCondition())); + Map>[] creditInfo = verifyModel.getCreditVerifyWebInfo(); + Map>[] debitInfo = verifyModel.getDebitVerifyWebInfo(); + setCurrTypeNameForVerify(creditInfo, debitInfo); + resultMap.put("credit", creditInfo); + resultMap.put("debit", debitInfo); return resultMap; } @@ -737,23 +760,27 @@ public class VerifyWebServiceImpl implements IVerifyWebService { processCurrencyTypes(debitInfo, pk_currtypes); // 查询币种名称 - String pk_currtypeStr = String.join("','", pk_currtypes); - // NCCForUAPLogger.debug("pk_currtypeStr:" + pk_currtypeStr); - String sql = "select pk_currtype, name from bd_currtype where pk_currtype in ('" + pk_currtypeStr + "') and dr = 0"; - List results = (List) new BaseDAO().executeQuery(sql, new MapListProcessor()); + if (!pk_currtypes.isEmpty()) { + String pk_currtypeStr = String.join("','", pk_currtypes); + // NCCForUAPLogger.debug("pk_currtypeStr:" + pk_currtypeStr); + String sql = "select pk_currtype, name from bd_currtype where pk_currtype in ('" + pk_currtypeStr + "') and dr = 0"; + List results = (List) new BaseDAO().executeQuery(sql, new MapListProcessor()); - for (Map result : results) { - String pk_currtype = result.getOrDefault("pk_currtype", "") + ""; - String name = result.getOrDefault("name", "") + ""; - if (pk_currtype.isEmpty() || name.isEmpty()) { - continue; + for (Map result : results) { + String pk_currtype = result.getOrDefault("pk_currtype", "") + ""; + String name = result.getOrDefault("name", "") + ""; + if (pk_currtype.isEmpty() || name.isEmpty()) { + continue; + } + resMap.put(pk_currtype, name); } - resMap.put(pk_currtype, name); } // 设置币种名称 - setCurrencyNameInArr(creditInfo, resMap); - setCurrencyNameInArr(debitInfo, resMap); + if (!resMap.isEmpty()) { + setCurrencyNameInArr(creditInfo, resMap); + setCurrencyNameInArr(debitInfo, resMap); + } } catch (Exception e) { NCCForUAPLogger.debug("setCurrTypeNameForVerify-exp:" + e.getMessage()); throw new RuntimeException(e); @@ -761,26 +788,30 @@ public class VerifyWebServiceImpl implements IVerifyWebService { } private void processCurrencyTypes(Map>[] infoArray, Set pk_currtypes) { - for (Map> map : infoArray) { - Map currtypeMap = map.get("m_pk_currtype"); - // NCCForUAPLogger.debug("infoArray-m_pk_currtype= " + currtypeMap); - if (!"".equals(currtypeMap.getOrDefault("value", ""))) { - String pk_currtype = currtypeMap.getOrDefault("value", "") + ""; - pk_currtypes.add(pk_currtype); + if (infoArray != null) { + for (Map> map : infoArray) { + Map currtypeMap = map.get("m_pk_currtype"); + // NCCForUAPLogger.debug("infoArray-m_pk_currtype= " + currtypeMap); + if (!"".equals(currtypeMap.getOrDefault("value", ""))) { + String pk_currtype = currtypeMap.getOrDefault("value", "") + ""; + pk_currtypes.add(pk_currtype); + } } } } private void setCurrencyNameInArr(Map>[] infoArray, Map resMap) { - for (Map> map : infoArray) { - Map currtypeMap = map.get("m_pk_currtype"); - String pk_currtype = currtypeMap.getOrDefault("value", "") + ""; - String m_currtypeName = resMap.get(pk_currtype); + if (infoArray != null) { + for (Map> map : infoArray) { + Map currtypeMap = map.get("m_pk_currtype"); + String pk_currtype = currtypeMap.getOrDefault("value", "") + ""; + String m_currtypeName = resMap.get(pk_currtype); - Map currtypeNameMap = new HashMap<>(); - currtypeNameMap.put("value", m_currtypeName); - currtypeNameMap.put("display", m_currtypeName); - map.put("m_currtypeName", currtypeNameMap); + Map currtypeNameMap = new HashMap<>(); + currtypeNameMap.put("value", m_currtypeName); + currtypeNameMap.put("display", m_currtypeName); + map.put("m_currtypeName", currtypeNameMap); + } } } diff --git a/gl/src/public/nccloud/pubitf/gl/lightgl/verify/IVerifyWebService.java b/gl/src/public/nccloud/pubitf/gl/lightgl/verify/IVerifyWebService.java new file mode 100644 index 0000000..b5141c9 --- /dev/null +++ b/gl/src/public/nccloud/pubitf/gl/lightgl/verify/IVerifyWebService.java @@ -0,0 +1,47 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.pubitf.gl.lightgl.verify; + +import nc.vo.gl.pubvoucher.DetailVO; +import nc.vo.pub.BusinessException; +import nccloud.dto.gl.verify.VerifyInfoWebVO; + +import java.util.List; +import java.util.Map; + +public interface IVerifyWebService { + Map queryRtVerifyData(String var1, String var2, String var3) throws BusinessException; + + Map queryVerifyDatas(Map var1) throws BusinessException; + + Map onVerify(VerifyInfoWebVO var1) throws BusinessException; + + Map onVerifyMul(VerifyInfoWebVO var1) throws BusinessException; + + Map onAutoVerify(VerifyInfoWebVO var1) throws BusinessException; + + Map queryHistoryDatas(Map var1) throws BusinessException; + + Map unVerify(VerifyInfoWebVO var1) throws BusinessException; + + Map onRedBlue(VerifyInfoWebVO var1) throws BusinessException; + + Map onAutoRedBlue(VerifyInfoWebVO var1) throws BusinessException; + + Map verBalanceQuery(Map var1) throws BusinessException; + + Map verDetailQuery(Map var1) throws BusinessException; + + Map verDetailLinkQuery(VerifyInfoWebVO var1) throws BusinessException; + + Map onQuery(Map var1) throws BusinessException; + + Map onDetailed(Map var1) throws BusinessException; + + Map refVerify(DetailVO var1, String var2) throws BusinessException; + + List queryBadAccountRate(String var1) throws BusinessException; +}