银企直连重复下载后不覆盖已推送的合同反写标识。
This commit is contained in:
parent
5416fe5aae
commit
66a8e80f7e
|
@ -0,0 +1,855 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nc.bs.cmp.informer.listener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import nc.bs.businessevent.BusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.cmp.informer.SSCInformerReleaseBS;
|
||||
import nc.bs.cmp.informer.rule.DeletePaymentreturnRule;
|
||||
import nc.bs.cmp.pub.IsExistRecordResultSetProcessor;
|
||||
import nc.bs.cmp.util.CmpBillPubUtil;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.bs.pf.pub.PfDataCache;
|
||||
import nc.bs.uap.lock.PKLock;
|
||||
import nc.cmp.bill.util.SysInit;
|
||||
import nc.cmp.utils.CmpUtils;
|
||||
import nc.cmp.utils.DataUtil;
|
||||
import nc.itf.bd.balatype.IBalaTypeQueryService;
|
||||
import nc.itf.bd.bankacc.subinfo.IBankAccSubInfoQueryService;
|
||||
import nc.itf.bd.bankdoc.IBankdocQueryService;
|
||||
import nc.itf.bd.banktype.IBankTypeQueryService;
|
||||
import nc.itf.bd.defdoc.IDefdocQryService;
|
||||
import nc.itf.cmp.informer.IInformerManageService;
|
||||
import nc.itf.cmp.informer.IInformerQueryService;
|
||||
import nc.md.persist.framework.IMDPersistenceQueryService;
|
||||
import nc.md.persist.framework.IMDPersistenceService;
|
||||
import nc.md.persist.framework.MDPersistenceService;
|
||||
import nc.pubitf.org.IOrgUnitPubService;
|
||||
import nc.pubitf.uapbd.IBankaccPubQueryService;
|
||||
import nc.pubitf.uapbd.IBankdocPubQueryService;
|
||||
import nc.pubitf.uapbd.ICustomerPubService;
|
||||
import nc.pubitf.uapbd.ICustsupPubService;
|
||||
import nc.pubitf.uapbd.ISupplierPubService;
|
||||
import nc.ui.pub.formulaparse.FormulaParse;
|
||||
import nc.vo.bd.balatype.BalaTypeVO;
|
||||
import nc.vo.bd.bankaccount.BankAccSubVO;
|
||||
import nc.vo.bd.bankaccount.BankAccbasVO;
|
||||
import nc.vo.bd.bankdoc.BankdocVO;
|
||||
import nc.vo.bd.banktype.BankTypeVO;
|
||||
import nc.vo.bd.cust.CustSupplierVO;
|
||||
import nc.vo.bd.cust.CustomerVO;
|
||||
import nc.vo.bd.cust.CustomerVersionVO;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.bd.supplier.SupplierVO;
|
||||
import nc.vo.bd.supplier.SupplierVersionVO;
|
||||
import nc.vo.cmp.billcode.CMPBillCodeUtils;
|
||||
import nc.vo.cmp.exception.ExceptionHandler;
|
||||
import nc.vo.cmp.informer.BankaccFlagEnum;
|
||||
import nc.vo.cmp.informer.DirectionEnum;
|
||||
import nc.vo.cmp.informer.GenerateFlagEnum;
|
||||
import nc.vo.cmp.informer.InOutEnum;
|
||||
import nc.vo.cmp.informer.InformerVO;
|
||||
import nc.vo.cmp.informer.RateFlagEnum;
|
||||
import nc.vo.cmp.informer.SysSourceEnum;
|
||||
import nc.vo.cmp.informer.UnitTypeEnum;
|
||||
import nc.vo.cmp.informer.VouchFlagEnum;
|
||||
import nc.vo.cmp.settlement.vochange.OrgUnits;
|
||||
import nc.vo.cmp.util.StringUtils;
|
||||
import nc.vo.ml.MultiLangUtil;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.obm.ebankdzd.DzdVO;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.SuperVO;
|
||||
import nc.vo.pub.lang.UFBoolean;
|
||||
import nc.vo.pub.lang.UFDate;
|
||||
import nc.vo.pub.lang.UFDateTime;
|
||||
import nc.vo.pubapp.AppContext;
|
||||
import nc.vo.tmpub.util.ModuleUtil;
|
||||
import nc.vo.tmpub.util.PayRetMessageUtil;
|
||||
|
||||
public class InformerManageListener implements IBusinessListener {
|
||||
public InformerManageListener() {
|
||||
}
|
||||
|
||||
public void doAction(IBusinessEvent event) throws BusinessException {
|
||||
(new InformerManageBP()).doAction(event);
|
||||
}
|
||||
|
||||
private class InformerManageBP {
|
||||
private Map<String, ArrayList<BankAccbasVO>> bankVOMap = new HashMap();
|
||||
private Map<String, BankdocVO> bankDocMap = new HashMap();
|
||||
private Map<String, String> custPkMap = new HashMap();
|
||||
private Map<String, String> subAccPkMap = new HashMap();
|
||||
private Map<String, SupplierVO> supplierMap = new HashMap();
|
||||
private Map<String, CustomerVO> customerMap = new HashMap();
|
||||
private Map<String, SupplierVersionVO> supplierVersionMap = new HashMap();
|
||||
private Map<String, CustomerVersionVO> customerVersionMap = new HashMap();
|
||||
private Map<String, String> pkbanktypeMap = new HashMap();
|
||||
private Map<String, String> orgNameMap = new HashMap();
|
||||
private Map<String, TimeZone> timeMap = new HashMap();
|
||||
private Map<String, BankAccbasVO> bankaccMap;
|
||||
private Map<String, BalaTypeVO> balaTypeMap = null;
|
||||
private IDefdocQryService defdocQryService = null;
|
||||
private BaseDAO dao;
|
||||
|
||||
private InformerManageBP() {
|
||||
}
|
||||
|
||||
public Map<String, String> getOrgNameMap() {
|
||||
return this.orgNameMap;
|
||||
}
|
||||
|
||||
public void setOrgNameMap(Map<String, String> orgNameMap) {
|
||||
this.orgNameMap = orgNameMap;
|
||||
}
|
||||
|
||||
public Map<String, TimeZone> getTimeMap() {
|
||||
return this.timeMap;
|
||||
}
|
||||
|
||||
public void setTimeMap(Map<String, TimeZone> timeMap) {
|
||||
this.timeMap = timeMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getPkbanktypeMap() {
|
||||
return this.pkbanktypeMap;
|
||||
}
|
||||
|
||||
public void setPkbanktypeMap(Map<String, String> pkbanktypeMap) {
|
||||
this.pkbanktypeMap = pkbanktypeMap;
|
||||
}
|
||||
|
||||
public Map<String, SupplierVO> getSupplierMap() {
|
||||
return this.supplierMap;
|
||||
}
|
||||
|
||||
public void setSupplierMap(Map<String, SupplierVO> supplierMap) {
|
||||
this.supplierMap = supplierMap;
|
||||
}
|
||||
|
||||
public Map<String, CustomerVO> getCustomerMap() {
|
||||
return this.customerMap;
|
||||
}
|
||||
|
||||
public void setCustomerMap(Map<String, CustomerVO> customerMap) {
|
||||
this.customerMap = customerMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getSubAccPkMap() {
|
||||
return this.subAccPkMap;
|
||||
}
|
||||
|
||||
public void setSubAccPkMap(Map<String, String> subAccPkMap) {
|
||||
this.subAccPkMap = subAccPkMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getCustPkMap() {
|
||||
return this.custPkMap;
|
||||
}
|
||||
|
||||
public void setCustPkMap(Map<String, String> custPkMap) {
|
||||
this.custPkMap = custPkMap;
|
||||
}
|
||||
|
||||
public Map<String, BankdocVO> getBankDocMap() {
|
||||
return this.bankDocMap;
|
||||
}
|
||||
|
||||
public void setBankDocMap(Map<String, BankdocVO> bankDocMap) {
|
||||
this.bankDocMap = bankDocMap;
|
||||
}
|
||||
|
||||
public Map<String, ArrayList<BankAccbasVO>> getBankVOMap() {
|
||||
return this.bankVOMap;
|
||||
}
|
||||
|
||||
public void setBankVOMap(Map<String, ArrayList<BankAccbasVO>> bankVOMap) {
|
||||
this.bankVOMap = bankVOMap;
|
||||
}
|
||||
|
||||
public void doAction(IBusinessEvent event) throws BusinessException {
|
||||
try {
|
||||
DzdVO[] dzd = (DzdVO[])((BusinessEvent.BusinessUserObj)event.getUserObject()).getUserObj();
|
||||
if (null != dzd && dzd.length != 0) {
|
||||
List<InformerVO> informers = this.transDzd2Informer(dzd);
|
||||
|
||||
try {
|
||||
this.removeRepeatDatas(informers);
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage(), e.getCause());
|
||||
throw new BusinessException(e.getMessage(), e.getCause());
|
||||
}
|
||||
|
||||
if (null != informers && informers.size() > 0) {
|
||||
this.saveInformers(informers);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.consume(e);
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeRepeatDatas(List<InformerVO> informers) throws Exception {
|
||||
if (informers != null && informers.size() > 0) {
|
||||
List<String> srcList = new ArrayList();
|
||||
|
||||
for(int i = 0; i < informers.size(); ++i) {
|
||||
srcList.add(((InformerVO)informers.get(i)).getPk_src());
|
||||
}
|
||||
|
||||
List<InformerVO> vos = this.queryExistInformerBySrcPks(srcList);
|
||||
Iterator<InformerVO> iterator = vos.iterator();
|
||||
Map<String, InformerVO> existedSrcVOMap = new HashMap();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
InformerVO vo = (InformerVO)iterator.next();
|
||||
existedSrcVOMap.put(vo.getPk_src(), vo);
|
||||
}
|
||||
|
||||
this.removeData(existedSrcVOMap, informers);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeData(Map<String, InformerVO> existedSrcVOMap, List<InformerVO> informers) throws BusinessException {
|
||||
List<InformerVO> exist = new ArrayList();
|
||||
|
||||
for(int k = 0; k < informers.size(); ++k) {
|
||||
if (existedSrcVOMap.containsKey(((InformerVO)informers.get(k)).getPk_src())) {
|
||||
InformerVO informerVOCreate = (InformerVO)informers.get(k);
|
||||
InformerVO informerVODB = (InformerVO)existedSrcVOMap.get(((InformerVO)informers.get(k)).getPk_src());
|
||||
informerVOCreate.setPk_informer(informerVODB.getPk_informer());
|
||||
informerVOCreate.setGenerateflag(informerVODB.getGenerateflag());
|
||||
informerVOCreate.setAssociateflag(informerVODB.getAssociateflag());
|
||||
informerVOCreate.setVbillno(informerVODB.getVbillno());
|
||||
informerVOCreate.setVouchflag(informerVODB.getVouchflag());
|
||||
informerVOCreate.setBankaccflag(informerVODB.getBankaccflag());
|
||||
if (RateFlagEnum.YES.getInout().equals(informerVODB.getRateflag())) {
|
||||
((InformerVO)informers.get(k)).setRateflag(informerVODB.getRateflag());
|
||||
}
|
||||
|
||||
exist.add((InformerVO)informers.get(k));
|
||||
}
|
||||
}
|
||||
|
||||
informers.removeAll(exist);
|
||||
if (exist.size() > 0) {
|
||||
this.getMDService().updateBillWithAttrs(this.filterGenerateVO(exist), (new InformerVO()).getAttributeNames());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private InformerVO[] filterGenerateVO(List<InformerVO> exist) {
|
||||
List<InformerVO> ret = new ArrayList();
|
||||
|
||||
for(int i = 0; i < exist.size(); ++i) {
|
||||
InformerVO informerVO = (InformerVO)exist.get(i);
|
||||
boolean flag = GenerateFlagEnum.HASGENERATE.getGenerateFlag().equals(informerVO.getGenerateflag()) || GenerateFlagEnum.HASRELEASE.getGenerateFlag().equals(informerVO.getGenerateflag()) || GenerateFlagEnum.HASCLAIM.getGenerateFlag().equals(informerVO.getGenerateflag()) || VouchFlagEnum.YES.getInout().equals(informerVO.getVouchflag()) || BankaccFlagEnum.YES.getInout().equals(informerVO.getBankaccflag()) || UFBoolean.TRUE.equals(informerVO.getAssociateflag());
|
||||
if (!flag) {
|
||||
ret.add(informerVO);
|
||||
}
|
||||
}
|
||||
|
||||
return (InformerVO[])ret.toArray(new InformerVO[0]);
|
||||
}
|
||||
|
||||
private List<InformerVO> queryExistInformerBySrcPks(List<String> srcList) throws Exception {
|
||||
Object[] vos = this.getInformerQueryService().queryDataBySrc((String[])srcList.toArray(new String[0]));
|
||||
List<InformerVO> ret = new ArrayList();
|
||||
|
||||
for(int i = 0; null != vos && i < vos.length; ++i) {
|
||||
if (vos[i] != null) {
|
||||
ret.add((InformerVO)vos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void saveInformers(List<InformerVO> informers) throws BusinessException {
|
||||
((IInformerManageService)NCLocator.getInstance().lookup(IInformerManageService.class)).saveInformers(informers);
|
||||
String ssc20 = "select count(1) from sm_product_version where productcode='70'";
|
||||
UFBoolean ifResult = (UFBoolean)this.getBaseDao().executeQuery(ssc20, new IsExistRecordResultSetProcessor());
|
||||
if (UFBoolean.TRUE.equals(ifResult) && ModuleUtil.isEnableByGroup(AppContext.getInstance().getPkGroup(), "7010")) {
|
||||
SSCInformerReleaseBS bs = new SSCInformerReleaseBS();
|
||||
bs.sscAutoRelease(informers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<InformerVO> transDzd2Informer(DzdVO[] dzd) throws BusinessException {
|
||||
Map<String, List<DzdVO>> map = this.splitDzdVO(dzd);
|
||||
Set<String> keys = map.keySet();
|
||||
Iterator<String> it = keys.iterator();
|
||||
String key = null;
|
||||
List<DzdVO> list = null;
|
||||
List<InformerVO> informers = new ArrayList();
|
||||
|
||||
while(it.hasNext()) {
|
||||
key = (String)it.next();
|
||||
list = (List)map.get(key);
|
||||
if (null != list && list.size() > 0) {
|
||||
for(int i = 0; i < list.size(); ++i) {
|
||||
informers.add(this.transDzd2Informer((DzdVO)list.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (informers.size() > 0) {
|
||||
this.setBillCode((InformerVO[])CmpUtils.covertListToArrays(informers, InformerVO.class));
|
||||
}
|
||||
|
||||
return informers;
|
||||
}
|
||||
|
||||
private BankAccbasVO queryBankAcc(String curacc, String banktypecode) throws BusinessException {
|
||||
new ArrayList();
|
||||
ArrayList<BankAccbasVO> list = (ArrayList)this.bankVOMap.get(curacc);
|
||||
if (list != null && list.size() > 0) {
|
||||
for(int i = 0; i < list.size(); ++i) {
|
||||
if (banktypecode.equals(((BankAccbasVO)list.get(i)).getPk_banktype())) {
|
||||
return (BankAccbasVO)list.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return (BankAccbasVO)list.get(0);
|
||||
} else {
|
||||
String pk_banktype = this.getPkBankType(banktypecode);
|
||||
BankAccbasVO bankAccVO = this.getBankAccQueryService().queryAccbasInfByAccnumAndBankType(curacc, pk_banktype);
|
||||
if (list == null) {
|
||||
ArrayList<BankAccbasVO> newlist = new ArrayList();
|
||||
newlist.add(bankAccVO);
|
||||
this.bankVOMap.put(curacc, newlist);
|
||||
} else {
|
||||
list.add(bankAccVO);
|
||||
this.bankVOMap.put(curacc, list);
|
||||
}
|
||||
|
||||
return bankAccVO;
|
||||
}
|
||||
}
|
||||
|
||||
private String getPkBankType(String bankTypeCode) throws BusinessException {
|
||||
String pk_banktype = (String)this.pkbanktypeMap.get(bankTypeCode);
|
||||
if (pk_banktype != null) {
|
||||
return pk_banktype;
|
||||
} else {
|
||||
BankTypeVO[] vos = this.getBankTypeQueryService().queryBanktypeVOsByCon(" code ='" + bankTypeCode + "' ");
|
||||
if (null != vos && vos.length == 1) {
|
||||
this.pkbanktypeMap.put(bankTypeCode, vos[0].getPk_banktype());
|
||||
return vos[0].getPk_banktype();
|
||||
} else {
|
||||
String var10002 = NCLangRes4VoTransl.getNCLangRes().getStrByID("3607inf_0", "03607inf-0082");
|
||||
throw new BusinessException(var10002 + (vos == null ? NCLangRes4VoTransl.getNCLangRes().getStrByID("3607inf_0", "03607inf-0083") : vos.length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, List<DzdVO>> splitDzdVO(DzdVO[] dzd) throws BusinessException {
|
||||
Map<String, List<DzdVO>> map = new HashMap();
|
||||
if (dzd != null && dzd.length != 0) {
|
||||
List<String> deleteList = new ArrayList();
|
||||
String key = null;
|
||||
List<DzdVO> list = null;
|
||||
|
||||
for(int i = 0; i < dzd.length; ++i) {
|
||||
String pk_org = this.getControlorg(dzd[i]);
|
||||
if ((!UFBoolean.FALSE.equals(this.getCMP50Para(pk_org)) || !UFBoolean.TRUE.equals(dzd[i].getIsncdata())) && !"B".equalsIgnoreCase(dzd[i].getStyleflag())) {
|
||||
String var10000 = dzd[i].getCuracc();
|
||||
key = var10000 + "_" + dzd[i].getBanktypecode();
|
||||
if (map.keySet().contains(key)) {
|
||||
list = (List)map.get(key);
|
||||
list.add(dzd[i]);
|
||||
} else {
|
||||
list = new ArrayList();
|
||||
list.add(dzd[i]);
|
||||
map.put(key, list);
|
||||
}
|
||||
} else {
|
||||
deleteList.add(dzd[i].getPk_ebank_dzd());
|
||||
}
|
||||
}
|
||||
|
||||
if (deleteList.size() != 0) {
|
||||
InformerVO[] vos = (InformerVO[])this.getInformerQueryService().queryDataBySrc((String[])deleteList.toArray(new String[deleteList.size()]));
|
||||
|
||||
for(InformerVO vo : vos) {
|
||||
boolean isSuccess = PKLock.getInstance().addDynamicLock(vo.getPk_informer());
|
||||
|
||||
Object[] voSpecial;
|
||||
try {
|
||||
voSpecial = this.getInformerQueryService().queryDataByPkSet(new String[]{vo.getPk_informer()});
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
if (isSuccess && "hasnogenerate".equals(((InformerVO)voSpecial[0]).getGenerateflag()) && !UFBoolean.TRUE.equals(((InformerVO)voSpecial[0]).getAssociateflag()) && !"0".equals(((InformerVO)voSpecial[0]).getBankaccflag()) && !"0".equals(((InformerVO)voSpecial[0]).getVouchflag()) && !RateFlagEnum.YES.getInout().equals(vo.getRateflag())) {
|
||||
DeletePaymentreturnRule deleterule = new DeletePaymentreturnRule();
|
||||
deleterule.deletePaymentreturn(new String[]{vo.getPk_informer()});
|
||||
this.deleteVO(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
} else {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteVO(InformerVO vo) throws DAOException {
|
||||
this.getBaseDao().deleteVO(vo);
|
||||
}
|
||||
|
||||
private String getControlorg(DzdVO dzdvo) throws BusinessException {
|
||||
String acc = dzdvo.getCuracc();
|
||||
String fkacc = dzdvo.getDbtacc();
|
||||
String skacc = dzdvo.getCrtacc();
|
||||
InformerVO informer = new InformerVO();
|
||||
BankdocVO bankDocVO = null;
|
||||
if (acc != null && fkacc != null && acc.equals(fkacc)) {
|
||||
informer.setDirection(DirectionEnum.PAYMONEY.getDirection());
|
||||
BankAccbasVO bankAccVo = this.queryBankAcc(acc, dzdvo.getBanktypecode());
|
||||
bankDocVO = (BankdocVO)this.bankDocMap.get(bankAccVo.getPk_bankdoc());
|
||||
if (bankDocVO == null) {
|
||||
bankDocVO = this.getBankDocQueryService().getBankdocVOByPk(bankAccVo.getPk_bankdoc());
|
||||
this.bankDocMap.put(bankAccVo.getPk_bankdoc(), bankDocVO);
|
||||
}
|
||||
|
||||
return bankAccVo.getControlorg();
|
||||
} else if (acc != null && skacc != null && acc.equals(skacc)) {
|
||||
informer.setDirection(DirectionEnum.RECEIVEMONEY.getDirection());
|
||||
BankAccbasVO bankAccVo = this.queryBankAcc(acc, dzdvo.getBanktypecode());
|
||||
bankDocVO = (BankdocVO)this.bankDocMap.get(bankAccVo.getPk_bankdoc());
|
||||
if (bankDocVO == null) {
|
||||
bankDocVO = this.getBankDocQueryService().getBankdocVOByPk(bankAccVo.getPk_bankdoc());
|
||||
this.bankDocMap.put(bankAccVo.getPk_bankdoc(), bankDocVO);
|
||||
}
|
||||
|
||||
return bankAccVo.getControlorg();
|
||||
} else {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("3607inf1_0", "03607inf1-0068"));
|
||||
}
|
||||
}
|
||||
|
||||
private IDefdocQryService getIDefdocQryService() {
|
||||
if (this.defdocQryService == null) {
|
||||
this.defdocQryService = (IDefdocQryService)NCLocator.getInstance().lookup(IDefdocQryService.class);
|
||||
}
|
||||
|
||||
return this.defdocQryService;
|
||||
}
|
||||
|
||||
private InformerVO transDzd2Informer(DzdVO dzdvo) throws BusinessException {
|
||||
String acc = dzdvo.getCuracc();
|
||||
String fkacc = dzdvo.getDbtacc();
|
||||
String skacc = dzdvo.getCrtacc();
|
||||
InformerVO informer = new InformerVO();
|
||||
informer.setPk_currtype(dzdvo.getC_ccynbr());
|
||||
informer.setMoneyy(dzdvo.getTrsamt());
|
||||
informer.setStyleflag(dzdvo.getStyleflag());
|
||||
informer.setBankrelated_code(dzdvo.getReconciliationcode());
|
||||
informer.setTranserial(dzdvo.getTxseqid());
|
||||
informer.setInfodate(dzdvo.getTrans_date());
|
||||
informer.setInfodatetime(dzdvo.getTrans_time());
|
||||
BankdocVO bankDocVO = null;
|
||||
BankAccbasVO bankAccVo = null;
|
||||
if (acc != null && fkacc != null && acc.equals(fkacc)) {
|
||||
informer.setDirection(DirectionEnum.PAYMONEY.getDirection());
|
||||
bankAccVo = this.queryBankAcc(acc, dzdvo.getBanktypecode());
|
||||
bankDocVO = (BankdocVO)this.bankDocMap.get(bankAccVo.getPk_bankdoc());
|
||||
if (bankDocVO == null) {
|
||||
bankDocVO = this.getBankDocQueryService().getBankdocVOByPk(bankAccVo.getPk_bankdoc());
|
||||
this.bankDocMap.put(bankAccVo.getPk_bankdoc(), bankDocVO);
|
||||
}
|
||||
|
||||
informer.setBankaccount(acc);
|
||||
informer.setBankname(dzdvo.getDbtdwmc());
|
||||
informer.setPk_bankacc(bankAccVo.getPk_bankaccbas());
|
||||
informer.setPk_bank(bankAccVo.getPk_bankdoc());
|
||||
informer.setPk_banktype(bankAccVo.getPk_banktype());
|
||||
informer.setPk_acc_sub(this.getSubAccPk(bankAccVo, informer.getPk_currtype()));
|
||||
BankAccbasVO[] accs = this.queryBankAcc(skacc);
|
||||
BankAccbasVO oppBankAccVo = this.filterAccVO(accs, dzdvo.getCrtdwmc());
|
||||
if (oppBankAccVo != null && dzdvo.getCrtacc().equals(oppBankAccVo.getAccnum())) {
|
||||
String pk_acc_sub = this.getSubAccPk(oppBankAccVo, informer.getPk_currtype());
|
||||
informer.setPk_oppacc_sub(pk_acc_sub);
|
||||
if (2 != oppBankAccVo.getAccclass()) {
|
||||
String pk_oppunit = this.queryCustPkByAcc(oppBankAccVo.getAccclass(), pk_acc_sub);
|
||||
this.setSuppType(pk_oppunit, informer);
|
||||
informer.setPk_oppunit(pk_oppunit);
|
||||
if (null == oppBankAccVo.getControlorg()) {
|
||||
informer.setOppinout(InOutEnum.OUTER.getInout());
|
||||
} else {
|
||||
informer.setOppinout(InOutEnum.INNER.getInout());
|
||||
}
|
||||
|
||||
if (0 == oppBankAccVo.getAccclass()) {
|
||||
informer.setOppunitname(dzdvo.getOppname());
|
||||
}
|
||||
} else {
|
||||
String pk_oppunit = this.querySupPkByAcc(oppBankAccVo.getControlorg());
|
||||
informer.setPk_oppunit(pk_oppunit);
|
||||
this.setSuppType(pk_oppunit, informer);
|
||||
informer.setPk_oppbanktype(oppBankAccVo.getPk_banktype());
|
||||
informer.setOppinout(InOutEnum.INNER.getInout());
|
||||
}
|
||||
|
||||
informer.setPk_oppacc(oppBankAccVo.getPk_bankaccbas());
|
||||
informer.setPk_oppbanktype(oppBankAccVo.getPk_banktype());
|
||||
informer.setPk_oppbank(oppBankAccVo.getPk_bankdoc());
|
||||
} else {
|
||||
informer.setOppunittype(UnitTypeEnum.SUPP.getUnittype());
|
||||
informer.setOppinout(InOutEnum.OUTER.getInout());
|
||||
informer.setOppunitname(dzdvo.getCrtdwmc());
|
||||
}
|
||||
|
||||
informer.setOppbankaccount(dzdvo.getCrtacc());
|
||||
}
|
||||
|
||||
if (acc != null && skacc != null && acc.equals(skacc)) {
|
||||
informer.setDirection(DirectionEnum.RECEIVEMONEY.getDirection());
|
||||
bankAccVo = this.queryBankAcc(acc, dzdvo.getBanktypecode());
|
||||
bankDocVO = (BankdocVO)this.bankDocMap.get(bankAccVo.getPk_bankdoc());
|
||||
if (bankDocVO == null) {
|
||||
bankDocVO = this.getBankDocQueryService().getBankdocVOByPk(bankAccVo.getPk_bankdoc());
|
||||
this.bankDocMap.put(bankAccVo.getPk_bankdoc(), bankDocVO);
|
||||
}
|
||||
|
||||
informer.setBankaccount(acc);
|
||||
informer.setBankname(dzdvo.getCrtdwmc());
|
||||
informer.setPk_bankacc(bankAccVo.getPk_bankaccbas());
|
||||
informer.setPk_bank(bankAccVo.getPk_bankdoc());
|
||||
informer.setPk_banktype(bankAccVo.getPk_banktype());
|
||||
informer.setPk_acc_sub(this.getSubAccPk(bankAccVo, informer.getPk_currtype()));
|
||||
BankAccbasVO[] accs = this.queryBankAcc(fkacc);
|
||||
BankAccbasVO oppBankAccVo = this.filterAccVO(accs, dzdvo.getDbtdwmc());
|
||||
if (oppBankAccVo != null && dzdvo.getDbtacc().equals(oppBankAccVo.getAccnum())) {
|
||||
String pk_acc_sub = this.getSubAccPk(oppBankAccVo, informer.getPk_currtype());
|
||||
informer.setPk_oppacc_sub(pk_acc_sub);
|
||||
if (2 != oppBankAccVo.getAccclass()) {
|
||||
String pk_oppunit = this.queryCustPkByAcc(oppBankAccVo.getAccclass(), pk_acc_sub);
|
||||
this.setCustType(pk_oppunit, informer);
|
||||
informer.setPk_oppunit(pk_oppunit);
|
||||
if (null == oppBankAccVo.getControlorg()) {
|
||||
informer.setOppinout(InOutEnum.OUTER.getInout());
|
||||
} else {
|
||||
informer.setOppinout(InOutEnum.INNER.getInout());
|
||||
}
|
||||
|
||||
if (0 == oppBankAccVo.getAccclass()) {
|
||||
informer.setOppunitname(dzdvo.getOppname());
|
||||
}
|
||||
} else {
|
||||
String pk_oppunit = this.queryCustPkByAcc(oppBankAccVo.getControlorg());
|
||||
informer.setPk_oppunit(pk_oppunit);
|
||||
this.setCustType(pk_oppunit, informer);
|
||||
informer.setOppinout(InOutEnum.INNER.getInout());
|
||||
}
|
||||
|
||||
informer.setPk_oppacc(oppBankAccVo.getPk_bankaccbas());
|
||||
informer.setPk_oppbanktype(oppBankAccVo.getPk_banktype());
|
||||
informer.setPk_oppbank(oppBankAccVo.getPk_bankdoc());
|
||||
} else {
|
||||
informer.setOppunittype(UnitTypeEnum.CUST.getUnittype());
|
||||
informer.setOppinout(InOutEnum.OUTER.getInout());
|
||||
informer.setOppunitname(dzdvo.getDbtdwmc());
|
||||
}
|
||||
|
||||
informer.setOppbankaccount(fkacc);
|
||||
}
|
||||
|
||||
if (dzdvo.getAttributeValue("ts") != null) {
|
||||
informer.setTs(new UFDateTime(dzdvo.getString("ts")));
|
||||
}
|
||||
|
||||
informer.setDr(dzdvo.getDr());
|
||||
informer.setPk_src(dzdvo.getPk_ebank_dzd());
|
||||
informer.setSyscode(SysSourceEnum.SYSNET.getSys());
|
||||
if (UFBoolean.TRUE.equals(dzdvo.getIsncdata())) {
|
||||
informer.setGenerateflag(GenerateFlagEnum.NCLAUNCH.getGenerateFlag());
|
||||
} else {
|
||||
informer.setGenerateflag(GenerateFlagEnum.HASNOGENERATE.getGenerateFlag());
|
||||
}
|
||||
|
||||
informer.setStatus(2);
|
||||
informer.setBillmaker(DataUtil.getCurrentUser());
|
||||
informer.setModifier(DataUtil.getCurrentUser());
|
||||
informer.setModifiedtime(DataUtil.getCurrentTime());
|
||||
informer.setCreationtime(DataUtil.getCurrentTime());
|
||||
informer.setCreator(DataUtil.getCurrentUser());
|
||||
informer.setDoperatedate(informer.getInfodate());
|
||||
informer.setDoperatetime(DataUtil.getCurrentTime());
|
||||
informer.setPk_billtypecode("36S3");
|
||||
informer.setPk_billtypeid(PfDataCache.getBillTypeInfo("36S3").getPk_billtypeid());
|
||||
if (dzdvo.getConsignagreement() != null && !dzdvo.getConsignagreement().equals("")) {
|
||||
FormulaParse parser = new FormulaParse();
|
||||
parser.setExpress("getColValue(bd_mandate,PK_MANDATE,id,id)");
|
||||
parser.addVariable("id", dzdvo.getConsignagreement());
|
||||
informer.setConsignagreement(parser.getValue());
|
||||
}
|
||||
|
||||
if (dzdvo.getTrans_type() != null && !dzdvo.getTrans_type().equals("") && this.getBalaTypeMap().containsKey(dzdvo.getTrans_type())) {
|
||||
informer.setPk_balatype(((BalaTypeVO)this.getBalaTypeMap().get(dzdvo.getTrans_type())).getPk_balatype());
|
||||
}
|
||||
|
||||
if (dzdvo.getEuropdomain() != null && !"".equals(dzdvo.getEuropdomain())) {
|
||||
DefdocVO[] defdocVOs = this.getIDefdocQryService().queryDefdocVOsByDoclistPkAndWhereSql("1001Z010000000035GVU", "GLOBLE00000000000000", AppContext.getInstance().getPkGroup(), (String)null);
|
||||
HashMap<String, DefdocVO> map = new HashMap();
|
||||
|
||||
for(DefdocVO defdocVO : defdocVOs) {
|
||||
String pid = defdocVO.getPid() != null && !"".equals(defdocVO.getPid()) ? defdocVO.getPid() : "~";
|
||||
map.put(pid + defdocVO.getCode(), defdocVO);
|
||||
}
|
||||
|
||||
String domainKey = "~" + dzdvo.getEuropdomain();
|
||||
informer.setDomain(((DefdocVO)map.get(domainKey)).getPk_defdoc());
|
||||
if (dzdvo.getFamily() != null && !"".equals(dzdvo.getFamily())) {
|
||||
String var10000 = informer.getDomain();
|
||||
String keyFamily = var10000 + dzdvo.getFamily();
|
||||
informer.setFamily(((DefdocVO)map.get(keyFamily)).getPk_defdoc());
|
||||
if (dzdvo.getSubfamily() != null && !"".equals(dzdvo.getSubfamily())) {
|
||||
var10000 = informer.getFamily();
|
||||
String keySubFamily = var10000 + dzdvo.getSubfamily();
|
||||
informer.setSubfamily(((DefdocVO)map.get(keySubFamily)).getPk_defdoc());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dzdvo.getTrans_abstr() != null && !"".equals(dzdvo.getTrans_abstr())) {
|
||||
informer.setMemo(PayRetMessageUtil.getPayRetMsg(dzdvo.getTrans_abstr(), 181));
|
||||
}
|
||||
|
||||
informer.setInvoiceno(dzdvo.getNoteno());
|
||||
informer.setNote_no(dzdvo.getCheck_num());
|
||||
informer.setSddreversalflag(dzdvo.getsddreversalflag());
|
||||
informer.setPayreason(dzdvo.getPayreason());
|
||||
informer.setStructuredstandard(dzdvo.getStructuredstandard());
|
||||
informer.setCreditorreference(dzdvo.getCreditorreference());
|
||||
this.setControlorg(informer);
|
||||
return informer;
|
||||
}
|
||||
|
||||
private void setControlorg(InformerVO informer) throws BusinessException {
|
||||
BankAccbasVO bankAccbasVO = this.getBankAccbasVO(informer.getPk_acc_sub());
|
||||
String controlorg = bankAccbasVO.getControlorg();
|
||||
if (controlorg != null && !"".equals(controlorg)) {
|
||||
informer.setPk_org(controlorg);
|
||||
informer.setPk_org_v(OrgUnits.getOrgUnit_V(informer.getPk_org()));
|
||||
informer.setPk_group(bankAccbasVO.getPk_group());
|
||||
} else {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("3607inf1_0", "03607inf1-0068"));
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, BankAccbasVO> getBankaccMap() {
|
||||
if (this.bankaccMap == null) {
|
||||
this.bankaccMap = CmpUtils.makeMap();
|
||||
}
|
||||
|
||||
return this.bankaccMap;
|
||||
}
|
||||
|
||||
private BankAccbasVO getBankAccbasVO(String pk_bankaccsubs) throws BusinessException {
|
||||
if (this.getBankaccMap().containsKey(pk_bankaccsubs)) {
|
||||
return (BankAccbasVO)this.getBankaccMap().get(pk_bankaccsubs);
|
||||
} else {
|
||||
IBankaccPubQueryService bankaccPubQueryService = (IBankaccPubQueryService)NCLocator.getInstance().lookup(IBankaccPubQueryService.class);
|
||||
Map<String, BankAccSubVO> map = bankaccPubQueryService.queryBankAccSubByPk(new String[]{"pk_bankaccbas"}, new String[]{pk_bankaccsubs});
|
||||
if (map != null && map.size() != 0) {
|
||||
BankAccSubVO bankAccSubVO = (BankAccSubVO)map.get(pk_bankaccsubs);
|
||||
String pk_bankaccbas = bankAccSubVO.getPk_bankaccbas();
|
||||
BankAccbasVO[] bankAccbasVO = bankaccPubQueryService.queryBankaccsByPks(new String[]{pk_bankaccbas});
|
||||
this.getBankaccMap().put(pk_bankaccsubs, bankAccbasVO[0]);
|
||||
return bankAccbasVO[0];
|
||||
} else {
|
||||
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("3607inf1_0", "03607inf1-0068"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setBillCode(InformerVO[] bills) throws BusinessException {
|
||||
CMPBillCodeUtils util = this.getFinanceBillCodeUtils(bills);
|
||||
List<InformerVO> lastVo = new ArrayList();
|
||||
|
||||
for(InformerVO bill : bills) {
|
||||
if (!util.isPrecode(bill) && bill.getVbillno() == null) {
|
||||
lastVo.add(bill);
|
||||
}
|
||||
}
|
||||
|
||||
if (lastVo.size() > 0) {
|
||||
util.createBillCode((SuperVO[])lastVo.toArray(new InformerVO[lastVo.size()]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected CMPBillCodeUtils getFinanceBillCodeUtils(InformerVO[] bill) {
|
||||
CMPBillCodeUtils util = CmpBillPubUtil.get36S3BillCodeUtil(bill);
|
||||
return util;
|
||||
}
|
||||
|
||||
private String getOrgName(String pk_oppunit) throws BusinessException {
|
||||
String orgName = (String)this.orgNameMap.get(pk_oppunit);
|
||||
if (orgName != null) {
|
||||
return orgName;
|
||||
} else {
|
||||
OrgVO[] vos = this.getOrgPubService().getOrgs(new String[]{pk_oppunit}, new String[]{"name", "name2", "name3", "name4", "name5", "name6"});
|
||||
if (null != vos && vos.length > 0) {
|
||||
this.orgNameMap.put(pk_oppunit, MultiLangUtil.getSuperVONameOfCurrentLang(vos[0], "name", (String)null));
|
||||
return MultiLangUtil.getSuperVONameOfCurrentLang(vos[0], "name", (String)null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IBankdocPubQueryService getBankDocPubQueryService() {
|
||||
return (IBankdocPubQueryService)NCLocator.getInstance().lookup(IBankdocPubQueryService.class);
|
||||
}
|
||||
|
||||
private BankAccbasVO filterAccVO(BankAccbasVO[] accs, String dbtdwmc) {
|
||||
if (null != accs && accs.length > 0 && dbtdwmc != null) {
|
||||
for(int i = 0; i < accs.length; ++i) {
|
||||
if (dbtdwmc.equals(accs[i].getAccname())) {
|
||||
return accs[i];
|
||||
}
|
||||
}
|
||||
|
||||
return accs[0];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSupVidByOidAndDate(String oid, UFDate date) throws BusinessException {
|
||||
if (StringUtils.isEmpty(oid)) {
|
||||
return null;
|
||||
} else if (null == date) {
|
||||
return null;
|
||||
} else {
|
||||
ISupplierPubService supService = (ISupplierPubService)NCLocator.getInstance().lookup(ISupplierPubService.class);
|
||||
Map<String, UFDate> paramMap = new HashMap();
|
||||
paramMap.put(oid, date);
|
||||
Map<String, String> supMap = supService.getSupplierLastVIDByOidAndDate(paramMap);
|
||||
return null != supMap && !supMap.isEmpty() ? (String)supMap.get(oid) : null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getCustVidByOidAndDate(String oid, UFDate date) throws BusinessException {
|
||||
if (StringUtils.isEmpty(oid)) {
|
||||
return null;
|
||||
} else if (null == date) {
|
||||
return null;
|
||||
} else {
|
||||
ICustomerPubService custService = (ICustomerPubService)NCLocator.getInstance().lookup(ICustomerPubService.class);
|
||||
Map<String, UFDate> paramMap = new HashMap();
|
||||
paramMap.put(oid, date);
|
||||
Map<String, String> cutResMap = custService.getCustomerLastVIDByOidAndDate(paramMap);
|
||||
return null != cutResMap && !cutResMap.isEmpty() ? (String)cutResMap.get(oid) : null;
|
||||
}
|
||||
}
|
||||
|
||||
private void setSuppType(String pk_oppunit, InformerVO informer) throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private void setCustType(String pk_oppunit, InformerVO informer) throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private BankAccbasVO[] queryBankAcc(String skacc) throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private String getSubAccPk(BankAccbasVO bankAccbasVO, String pkCurrtype) throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private IMDPersistenceQueryService getMDQueryService() {
|
||||
return MDPersistenceService.lookupPersistenceQueryService();
|
||||
}
|
||||
|
||||
private String queryCustPkByAcc(Integer accclass, String pk_acc_sub) throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private String queryCustPkByAcc(String pk_financeorg) throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private String querySupPkByAcc(String pk_financeorg) throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private Map<String, BalaTypeVO> getBalaTypeMap() throws BusinessException {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
|
||||
private ICustsupPubService getCustsupQueryService() {
|
||||
return (ICustsupPubService)NCLocator.getInstance().lookup(ICustsupPubService.class);
|
||||
}
|
||||
|
||||
private ISupplierPubService getSuppQueryService() {
|
||||
return (ISupplierPubService)NCLocator.getInstance().lookup(ISupplierPubService.class);
|
||||
}
|
||||
|
||||
private ICustomerPubService getCustQueryService() {
|
||||
return (ICustomerPubService)NCLocator.getInstance().lookup(ICustomerPubService.class);
|
||||
}
|
||||
|
||||
private IBankAccSubInfoQueryService getBankAccSubService() {
|
||||
return (IBankAccSubInfoQueryService)NCLocator.getInstance().lookup(IBankAccSubInfoQueryService.class);
|
||||
}
|
||||
|
||||
private IBankTypeQueryService getBankTypeQueryService() {
|
||||
return (IBankTypeQueryService)NCLocator.getInstance().lookup(IBankTypeQueryService.class);
|
||||
}
|
||||
|
||||
private IBankaccPubQueryService getBankAccQueryService() {
|
||||
return (IBankaccPubQueryService)NCLocator.getInstance().lookup(IBankaccPubQueryService.class);
|
||||
}
|
||||
|
||||
private IBankdocQueryService getBankDocQueryService() {
|
||||
return (IBankdocQueryService)NCLocator.getInstance().lookup(IBankdocQueryService.class);
|
||||
}
|
||||
|
||||
private IInformerQueryService getInformerQueryService() {
|
||||
return (IInformerQueryService)NCLocator.getInstance().lookup(IInformerQueryService.class);
|
||||
}
|
||||
|
||||
private IMDPersistenceService getMDService() {
|
||||
return (IMDPersistenceService)NCLocator.getInstance().lookup(IMDPersistenceService.class);
|
||||
}
|
||||
|
||||
private IOrgUnitPubService getOrgPubService() {
|
||||
return (IOrgUnitPubService)NCLocator.getInstance().lookup(IOrgUnitPubService.class);
|
||||
}
|
||||
|
||||
private UFBoolean getCMP50Para(String pk_org) throws BusinessException {
|
||||
UFBoolean param = SysInit.getParaBoolean(pk_org, "CMP50") == null ? null : SysInit.getParaBoolean(pk_org, "CMP50");
|
||||
return param;
|
||||
}
|
||||
|
||||
private BaseDAO getBaseDao() {
|
||||
// $FF: Couldn't be decompiled
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue