Commit c39891d3 by xiaotong

FXTLOP交易方法迁移

parent 62aae43c
package com.brilliance.isc.funds.fxtlop.service;
import com.brilliance.isc.funds.bo.funds.FxtlopStoreBo;
public interface FxtlopService {
void initFxtlop(FxtlopStoreBo fxtlopStoreBo);
void defaultFxtlop(FxtlopStoreBo fxtlopStoreBo);
}
package com.brilliance.isc.funds.fxtlop.service;
import com.brilliance.isc.funds.bo.funds.FxtlopStoreBo;
public interface FxtpService {
void initFxtp(FxtlopStoreBo fxtlopStoreBo);
void defaultFxtp(FxtlopStoreBo fxtlopStoreBo);
}
package com.brilliance.isc.funds.fxtlop.service.impl;
import com.brilliance.isc.funds.bo.funds.FxtlopStoreBo;
import com.brilliance.isc.funds.fxtlop.service.FxtlopService;
import com.brilliance.mda.runtime.mda.util.Dates;
import com.brilliance.mda.runtime.mda.util.MdaUtils;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
@Service
public class FxtlopServiceImpl implements FxtlopService {
private static final Logger logger = LoggerFactory.getLogger(FxtlopServiceImpl.class);
@Override
public void initFxtlop(FxtlopStoreBo fxtlopStoreBo) {
initFxtlop950(fxtlopStoreBo);
initFxtlop1000(fxtlopStoreBo);
}
private void initFxtlop950(FxtlopStoreBo fxtlopStoreBo) {
//this.getTrnmod().troLockExistingOrNewContract ( this.getFxdgrp());
// if DISSEL is empty, a contract can be copied
// if( Dynamic.troIsObjTypLoaded( this.getFxdgrp()) )
// {
// this.getFxtp().getRecget().setDissel( "X");
// }
// else
// {
// this.getFxtp().getRecget().setDissel( "");
// }
}
private void initFxtlop1000(FxtlopStoreBo fxtlopStoreBo) {
// this.getFxtp().setPansta( PanStaEdit);
// this.getFxtp().getAplp().setPansta( PanStaEdit);
// Systems.resetVisible(this.getFxtp(),"ovwp");
// Systems.setActivePanel(this.getRegp());
// this.getFxdgrp().getCbs().getNom1().setCur( Dynamic.sysiso());
// Systems.resetEnabled(this.getFxdgrp().getCbs().getNom1(),"cur");
// Systems.setValues(this.getFxdgrp().getRec(),"fxtyp","LB" + CR + "LS");
}
@Override
public void defaultFxtlop(FxtlopStoreBo fxtlopStoreBo) {
// 成交日
if( MdaUtils.isEmpty(fxtlopStoreBo.getFxdgrp().getRec().getOpndat()) || (!fxtlopStoreBo.getFxdgrp().getRec().isModified("opndat")) )
{
fxtlopStoreBo.getFxdgrp().getRec().setOpndat( Dates.today());
fxtlopStoreBo.getFxdgrp().getRec().resetModified("opndat");
}
// 起息日
if( !fxtlopStoreBo.getFxdgrp().getRec().isModified("valdat") )
{
fxtlopStoreBo.getFxdgrp().getRec().setValdat( fxtlopStoreBo.getFxdgrp().getRec().getOpndat());
}
}
}
package com.brilliance.isc.funds.fxtlop.service;
package com.brilliance.isc.funds.fxtlop.service.impl;
import com.brilliance.isc.bo.model.Fxacbs;
import com.brilliance.isc.bo.model.Fxdgrp;
import com.brilliance.isc.common.cbsmod.service.CbsmodService;
import com.brilliance.isc.common.contants.CommonContants;
import com.brilliance.isc.common.context.SettleContext;
import com.brilliance.isc.common.liaall.service.LiaallService;
import com.brilliance.isc.common.transaction.AbstractTransactionService;
import com.brilliance.isc.common.transaction.help.TransactionHelpService;
import com.brilliance.isc.common.transaction.help.TransactionServiceSet;
import com.brilliance.isc.common.trnmod.service.TrnmodService;
import com.brilliance.isc.common.trnmod.vo.TrnmodVo;
import com.brilliance.isc.common.util.I18nUtil;
import com.brilliance.isc.common.vo.BizAmdInfoVo;
import com.brilliance.isc.common.vo.BizInfoVo;
import com.brilliance.isc.funds.bo.funds.FxtlopStoreBo;
import com.brilliance.isc.funds.bo.funds.FxtssbStoreBo;
import com.brilliance.isc.funds.common.component.FxToolComponent;
import com.brilliance.isc.funds.fxtlop.check.FxtlopValidator;
import com.brilliance.isc.funds.fxtlop.service.FxtlopService;
import com.brilliance.isc.vo.funds.FxdBizInfoVo;
import com.brilliance.mda.runtime.mda.util.Dates;
import com.brilliance.mda.runtime.mda.util.MdaUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Map;
/**
......@@ -24,6 +42,21 @@ public class FxtlopTransactionServiceImpl extends AbstractTransactionService<Fxt
@Resource
private FxtlopValidator fxtlopValidator;
@Autowired
private FxtlopService fxtlopService;
@Resource
private FxToolComponent fxToolComponent;
@Resource
private TrnmodService trnmodService;
@Resource
private TransactionHelpService transactionHelpService;
@Resource
private CbsmodService cbsmodService;
@Resource
private LiaallService liaallService;
@Resource
private SettleContext settleContext;
@PostConstruct
......@@ -47,9 +80,6 @@ public class FxtlopTransactionServiceImpl extends AbstractTransactionService<Fxt
ruleMtabutSavN500(transactionVo);
}
public void ruleMtabutSavN500(FxtlopStoreBo bo) {
}
@Override
protected Map<String, String> txnCheck(FxtlopStoreBo transactionVo) {
return fxtlopValidator.validate(transactionVo);
......@@ -57,8 +87,9 @@ public class FxtlopTransactionServiceImpl extends AbstractTransactionService<Fxt
@Override
protected BizInfoVo buildBizInfo(FxtlopStoreBo transactionVo) {
return null;
FxdBizInfoVo bizInfoVo = new FxdBizInfoVo();
bizInfoVo.setObjtyp("FXD");
return bizInfoVo;
}
@Override
......@@ -69,19 +100,62 @@ public class FxtlopTransactionServiceImpl extends AbstractTransactionService<Fxt
@Override
public FxtlopStoreBo init(FxtlopStoreBo fxtlopStoreBo) {
fxtlopStoreBo.reset();
fxtlopService.initFxtlop(fxtlopStoreBo);
fxtlopService.defaultFxtlop(fxtlopStoreBo);
return fxtlopStoreBo;
}
@Override
public void beforeSave(FxtlopStoreBo transactionVo) {
transactionVo.reset();
Fxdgrp fxdgrp = transactionVo.getFxdgrp();
TransactionServiceSet transactionServiceSet = transactionHelpService.getTransactionStoreSet();
transactionServiceSet.setRec(fxdgrp.getRec());
transactionServiceSet.setBlk(fxdgrp.getBlk());
transactionServiceSet.setTransactionVo(transactionVo);
fxToolComponent.collectCbsMap(transactionServiceSet, "", fxdgrp.getCbs(), "max", "nom1", "opn1", "opn2");
fxToolComponent.collectPtsList(transactionServiceSet, fxdgrp, null);
settleContext.loadSettleSession(transactionVo.getTransName(), transactionVo.getUserId(), buildBizInfo(transactionVo), transactionServiceSet.getPtsList());
}
@Override
protected void updateBizInfoVo(BizInfoVo bizInfoVo, FxtlopStoreBo transactionVo) {
}
public void ruleMtabutSavN500(FxtlopStoreBo transactionVo){
TrnmodVo trnmodVo = transactionHelpService.getTransactionStoreSet().getTrnmodVo();
fxToolComponent.getref(transactionVo.getFxdgrp());
// 1. Create (rsp. update) Contract (incl. Texts)
fxToolComponent.sav(transactionVo.getFxdgrp(), BigDecimal.ZERO);
// 2. Build Transaction from FTDGRP
trnmodService.trnSetFromContract ( trnmodVo);
cbsSav(transactionVo, trnmodVo);
// save documents
}
public void cbsSav(FxtlopStoreBo transactionVo, TrnmodVo trnmodVo) {
cbsmodService.cbsTrnSetNew("TRN",trnmodVo.getTrn().getInr());
//#cgl
//平盘登记后产生4条CBB,MAX,NOM,OPN,OPN2
//后续两个交易分别消OPN和OPN2
String trninr = transactionHelpService.getTrninr();
trnmodService.cbsTrnStore("MAXAMT","AMT1",Dates.today(),transactionVo.getFxdgrp().getCbs().getMax().getCur(),transactionVo.getFxdgrp().getCbs().getMax().getAmt(),MdaUtils.getI18NString("fxtlop","CT000000"),transactionVo.getFxdgrp(),trninr);
trnmodService.cbsTrnStore("NOMAMT","AMT1",Dates.today(),transactionVo.getFxdgrp().getCbs().getNom1().getCur(),transactionVo.getFxdgrp().getCbs().getNom1().getAmt(),MdaUtils.getI18NString("fxtlop","CT000001"),transactionVo.getFxdgrp(),trninr);
/**
if FXDGRP\\REC\\FXTYP.is ( "LB" ) or FXDGRP\\REC\\FXTYP.is ( "LS" ) then
**/
/**
if FXDGRP\\REC\\FXTYP.is ( "LB" ) then
**/
if( MdaUtils.compareTo(transactionVo.getFxdgrp().getRec().getFxtyp(),"LB")== 0 || MdaUtils.compareTo(transactionVo.getFxdgrp().getRec().getFxtyp(),"LS")== 0 )
{
trnmodService.cbsTrnStore("OPNAMT","AMT1",Dates.today(),transactionVo.getFxdgrp().getCbs().getMax().getCur(),transactionVo.getFxdgrp().getCbs().getMax().getAmt(),MdaUtils.getI18NString("fxtlop","CT000002"),transactionVo.getFxdgrp(),trninr);
}
liaallService.storeAll(transactionHelpService.getTransactionStoreSet().getLiaall());
//Platform.cbsTrnCommit();
}
}
package com.brilliance.isc.funds.fxtlop.service.impl;
import com.brilliance.isc.common.context.SettleContext;
import com.brilliance.isc.funds.bo.funds.FxtlopStoreBo;
import com.brilliance.isc.funds.fxtlop.service.FxtpService;
import com.brilliance.mda.runtime.mda.util.MdaUtils;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.stereotype.Service;
@Service
public class FxtpServiceImpl implements FxtpService {
@Override
public void initFxtp(FxtlopStoreBo fxtlopStoreBo){
}
@Override
public void defaultFxtp(FxtlopStoreBo fxtlopStoreBo){
String frame = SettleContext.getTransName();
if( MdaUtils.compareTo(frame,"FXTSOP") != 0 && MdaUtils.compareTo(frame,"FXTBOP") != 0 && MdaUtils.compareTo(frame,"FXTEOP") != 0 )
{
// //! Read USRGET\\USR according to USR.
// if( MdaUtils.compareTo(fxtlopStoreBo.getUsrget().getUsr().getExtkey(),fxtlopStoreBo.getFxdgrp().getRec().getUsr()) != 0 )
// {
// fxtlopStoreBo.getUsrget().recReadRecordbyExtkey ( fxtlopStoreBo.getFxdgrp().getRec().getUsr() );
// if( MdaUtils.compareTo(fxtlopStoreBo.getPansta(),PanStaShow) != 0 )
// {
// if( ctx.getErrorCode() == tdOdbcNotFound )
// {
// Dynamic.sysWarningSet( SYSWRNTypeWarning, Strings.getText(MdaUtils.getI18NString("fxtp","CT000003"),fxtlopStoreBo.getFxdgrp().getRec().getUsr()), "USRINVALID" );
// }
// else
// {
// ctx.reraise();
// Dynamic.sysWarningSet( SYSWRNTypeWarning, "", "USRINVALID" );
// }
// }
// else
// {
// if( ctx.getErrorCode() != tdOdbcNotFound )
// {
// ctx.reraise();
// }
// }
// }
// Dynamic.trnModCopyModFlag( MdaDriver.getDatafield(fxtlopStoreBo.getFxdgrp().getRec(),"usr"), MdaDriver.getDatafield(fxtlopStoreBo.getUsrget().getUsr(),"extkey") );
// }
// if( Platform.checkUsrBranch("1") || MdaUtils.compareTo(frame,"FXTSOP") == 0 || MdaUtils.compareTo(frame,"FXTBOP") == 0 || MdaUtils.compareTo(frame,"FXTEOP") == 0 )
// {
// if( MdaUtils.compareTo(fxtlopStoreBo.getUsrget().getUsr().getExtkey(),fxtlopStoreBo.getFxdgrp().getRec().getOwnusr()) != 0 )
// {
// fxtlopStoreBo.getUsrget().recReadRecordbyExtkey ( fxtlopStoreBo.getFxdgrp().getRec().getOwnusr() );
// if( MdaUtils.compareTo(fxtlopStoreBo.getPansta(),PanStaShow) != 0 )
// {
// if( ctx.getErrorCode() == tdOdbcNotFound )
// {
// Dynamic.sysWarningSet( SYSWRNTypeWarning, Strings.getText(MdaUtils.getI18NString("fxtp","CT000004"),fxtlopStoreBo.getFxdgrp().getRec().getOwnusr()), "USRINVALID" );
// }
// else
// {
// ctx.reraise();
// Dynamic.sysWarningSet( SYSWRNTypeWarning, "", "USRINVALID" );
// }
// }
// else
// {
// if( ctx.getErrorCode() != tdOdbcNotFound )
// {
// ctx.reraise();
// }
// }
// }
// Dynamic.trnModCopyModFlag( MdaDriver.getDatafield(fxtlopStoreBo.getFxdgrp().getRec(),"ownusr"), MdaDriver.getDatafield(fxtlopStoreBo.getUsrget().getUsr(),"extkey") );
}
}
}
package com.brilliance.isc.funds.bo.funds;
import com.brilliance.isc.bo.model.Fxdgrp;
import com.brilliance.isc.bo.model.Fxtp;
import com.brilliance.isc.common.transaction.vo.BaseTransactionVo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
......@@ -14,4 +16,23 @@ import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class FxtlopStoreBo extends BaseTransactionVo {
private Fxdgrp fxdgrp;
//private Fxtmod fxtmod;
private Fxtp fxtp;
@Override
public void reset() {
super.reset();
if (fxdgrp == null) {
fxdgrp = new Fxdgrp();
}
fxdgrp.reset();
if (fxtp == null) {
fxtp = new Fxtp();
}
fxtp.reset();
}
}
package com.brilliance.isc.funds.vo.funds;
import com.brilliance.isc.bo.model.Fxdgrp;
import com.brilliance.isc.bo.model.Fxtp;
import com.brilliance.isc.common.transaction.vo.BaseTransactionVo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
......@@ -14,4 +16,24 @@ import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class FxtlopStoreVo extends BaseTransactionVo {
private Fxdgrp fxdgrp;
//private Fxtmod fxtmod;
private Fxtp fxtp;
@Override
public void reset() {
super.reset();
if (fxdgrp == null) {
fxdgrp = new Fxdgrp();
}
fxdgrp.reset();
if (fxtp == null) {
fxtp = new Fxtp();
}
fxtp.reset();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment