Commit bbadda55 by zhoujunpeng

头寸调拨确认交易

parent b2792fd0
......@@ -3,14 +3,12 @@ package com.brilliance.isc.funds.basesel.common;
import com.brilliance.isc.bo.Cbb;
import com.brilliance.isc.bo.Cnd;
import com.brilliance.isc.bo.Ftd;
import com.brilliance.isc.bo.model.Cpacbs;
import com.brilliance.isc.bo.model.Cpdgrp;
import com.brilliance.isc.bo.model.Ftdgrp;
import com.brilliance.isc.bo.model.*;
import com.brilliance.isc.common.cbsmod.service.CbsmodService;
import com.brilliance.isc.common.component.PtsptaToolComponent;
import com.brilliance.isc.common.exception.CommonServiceException;
import com.brilliance.isc.common.transaction.help.TransactionServiceSet;
import com.brilliance.isc.common.util.StringUtils;
import com.brilliance.isc.common.context.SettleContext;import com.brilliance.isc.common.exception.CommonServiceException;
import com.brilliance.isc.common.sysmod.SysmodService;import com.brilliance.isc.common.transaction.help.TransactionServiceSet;
import com.brilliance.isc.common.trnmod.service.TrnmodService;import com.brilliance.isc.common.util.StringUtils;
import com.brilliance.isc.common.util.Utils;
import com.brilliance.isc.common.vo.FremsgVo;
import com.brilliance.isc.common.vo.PtsptaVo;
......@@ -30,7 +28,7 @@ import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Objects;import static com.brilliance.mda.runtime.mda.Constants.NULLSTR;
@Component
public class FtToolComponent {
......@@ -39,6 +37,8 @@ public class FtToolComponent {
// @Autowired
// private CpdMapper cpdMapper;
@Autowired
private TrnmodService trnmodService;
@Autowired
private FtdselMapper ftdselMapper;
@Autowired
private CbbMapper cbbMapper;
......@@ -48,9 +48,8 @@ public class FtToolComponent {
private PtsptaToolComponent ptsptaToolComponent;
@Autowired
private CndMapper cndMapper;
// @Autowired
// private ICheckRule iCheckRule;
@Autowired
private SysmodService sysmodService;
public Ftdgrp getCpdgrpByInr(String inr) {
......@@ -63,24 +62,42 @@ public class FtToolComponent {
Ftdgrp ftdgrp = new Ftdgrp();
ftdgrp.reset();
ftdgrp.setRec(ftd);
// Cbb cbb = new Cbb();
// cbb.setInr(inr);
// cbb = cbbMapper.selectByPrimaryKey(cbb);
//
// ftdgrp.setCbb(cbb);
//
// //获取cbb金额信息
// Date date = Dates.add(Utils.getMaxDate(), -1);
// cbsmodService.cbsGetBalance(ftdgrp.getCbb(), "CBB", inr, "MAXSUM", "AMT1", date);
// //获取ptspta信息
// storePtsToGrp(cpdgrp, inr, "CPD");
// //获取cnd信息
// getCndInfo(cpdgrp, inr, "CPD");
return ftdgrp;
}
public void getref(Ftdgrp ftdgrp) {
//! Set reference number, if not already set (usually called in transaction`s MTABUT\\SAV Event)
String tbl = NULLSTR;
int len = 0;
switch (ftdgrp.getRec().getFttyp()) {
case "LS":
case "LB":
tbl = "FX";
len = 4;
break;
case "XS":
case "XB":
tbl = "DX";
len = 4;
break;
case "US":
tbl = "S" + Strings.mid(ftdgrp.getCbs().getMax().getCur(), 1, 1);
len = 4;
break;
case "UB":
tbl = "B" + Strings.mid(ftdgrp.getCbs().getMax().getCur(), 1, 1);
len = 4;
break;
default:
tbl = "J" + Strings.mid(ftdgrp.getCbs().getMax().getCur(), 1, 1);
len = 4;
}
if (MdaUtils.isEmpty(ftdgrp.getRec().getOwnref())) {
ftdgrp.getRec().setOwnref(sysmodService.getRef(tbl, len));
}
}
public void getCndInfo(Cpdgrp cpdgrp, String objInr, String objType) {
List<Cnd> cnds = cndMapper.selectByObjtypAndObjinr(objType, objInr);
......@@ -104,7 +121,7 @@ public class FtToolComponent {
}
}
public void collectCbsMap(TransactionServiceSet set, String prefix, Cpacbs cbs, String... cbsNames) {
public void collectCbsMap(TransactionServiceSet set, String prefix, Ftacbs cbs, String... cbsNames) {
Map<String, Cbb> cbsMap = set.getCbsMap();
if (cbsMap == null) {
cbsMap = new HashMap<>();
......@@ -119,7 +136,7 @@ public class FtToolComponent {
}
public void collectPtsList(TransactionServiceSet set, Cpdgrp cpdgrp, String... ptsNames) {
public void collectPtsList(TransactionServiceSet set, Ftdgrp cpdgrp, String... ptsNames) {
if (ptsNames == null) {
//找所有的ptspta对象
Field[] fields = cpdgrp.getClass().getDeclaredFields();
......@@ -271,6 +288,20 @@ public class FtToolComponent {
}
}
public void sav(Ftdgrp ftdgrp, BigDecimal zero) {
// saves contract including texts. CBS resp. of transaction
String frm = SettleContext.getTransName();
switch (frm) {
case "FXTSUS":
case "FXTSUB":
case "FXTSST":
case "FXTSCN":
//Datas.getContentNumeric(this, "\\LIAALL\\LIACCV\\CSHPCT")
ftdgrp.getRec().setRat(zero);
break;
}
trnmodService.trnStoreContract(ftdgrp);
}
}
......@@ -4,13 +4,13 @@ import com.brilliance.isc.common.transaction.newcheck.AbstractModuleValidator;
import com.brilliance.isc.common.transaction.newcheck.Validate;
import com.brilliance.isc.funds.bo.funds.FttpcmStoreBo;
import com.brilliance.isc.funds.vo.funds.FttpcmStoreVo;
import com.brilliance.mda.runtime.mda.util.MdaUtils;
import com.brilliance.mda.runtime.mda.util.MdaUtils;import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
@Component
public class FttpcmValidator extends AbstractModuleValidator<FttpcmStoreBo> {
@Override
......@@ -19,12 +19,12 @@ public class FttpcmValidator extends AbstractModuleValidator<FttpcmStoreBo> {
super.register();
}
// @Override
// public Map<String, String> validate(FttpcmStoreVo vo) {
// Map<String, String> maps = new HashMap<>();
// maps.putAll(super.validate(vo));
// return maps;
// }
@Override
public Map<String, String> validate(FttpcmStoreBo bo) {
Map<String, String> maps = new HashMap<>();
maps.putAll(super.validate(bo));
return maps;
}
/**
* source:fttpcm.0016.script
......
......@@ -35,5 +35,6 @@ public class FttpcmDiasavRegister implements IDiasavRegister {
}
private void trnDiasav(TrndiaVo trndiaVo) {
}
}
......@@ -2,11 +2,15 @@ package com.brilliance.isc.funds.fttpcm.resource;
import com.brilliance.isc.common.context.SettleContext;
import com.brilliance.isc.common.transaction.controller.AbstractTransactionController;
import com.brilliance.isc.funds.bo.funds.FttpcmStoreBo;
import com.brilliance.isc.funds.bo.funds.FxtfopStoreBo;
import com.brilliance.isc.funds.fttpcm.service.FttpcmTransactionServiceImpl;
import com.brilliance.isc.funds.transfer.transaction.FttpcmStructMapper;
import com.brilliance.isc.funds.vo.funds.FttpcmStoreVo;
import com.brilliance.isc.funds.vo.funds.FxtfopStoreVo;import com.brilliance.isc.transfer.IStructMapper;
import com.brilliance.isc.vo.ResponseSet;
import io.swagger.annotations.Api;
import org.apache.ibatis.transaction.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -22,15 +26,47 @@ import javax.annotation.Resource;
public class FttpcmResource extends AbstractTransactionController<FttpcmStoreVo> {
@Resource
private FttpcmStructMapper fttpcmStructMapper;
public IStructMapper getStructMapper() {
return fttpcmStructMapper;
}
@Resource(name = "fttpcm.transaction")
FttpcmTransactionServiceImpl transactionService;
FttpcmTransactionServiceImpl fttpcmTransactionService;
@Autowired
private SettleContext settleContext;
@PostMapping("/getRef")
public ResponseSet<String> getRef(@RequestBody FttpcmStoreVo fttpcmStoreVo) {
return ResponseSet.simpleSuccess(transactionService.getRef(fttpcmStoreVo));
String ref = fttpcmTransactionService.getRef(fttpcmStoreVo);
return ResponseSet.simpleSuccess(ref);
}
@PostMapping("/defaultRateN1000")
public ResponseSet defaultRateN1000(@RequestBody FxtfopStoreVo fxtfopStoreVo) {
try {
settleContext.loadSettleSession("FTTPCM","","");
fttpcmTransactionService.defaultRateN1000(fxtfopStoreVo);
return ResponseSet.simpleSuccess(fxtfopStoreVo);
} catch (Exception e) {
throw e;
} finally {
SettleContext.removeUserSession();
}
}
@PostMapping("/defaultCalculateN1100")
public ResponseSet defaultCalculateN1100(@RequestBody FttpcmStoreVo fttpcmStoreVo) {
try {
settleContext.loadSettleSession("FTTPCM","","");
fttpcmTransactionService.defaultCalculateN1100(fttpcmStoreVo);
return ResponseSet.simpleSuccess(fttpcmStoreVo);
} catch (Exception e) {
throw e;
} finally {
SettleContext.removeUserSession();
}
}
}
......@@ -2,18 +2,33 @@ package com.brilliance.isc.funds.fttpcm.service;
import com.brilliance.isc.bo.Bch;
import com.brilliance.isc.bo.Pta;
import com.brilliance.isc.bo.model.Fxdgrp;
import com.brilliance.isc.bo.model.Ftacbs;
import com.brilliance.isc.bo.model.Ftdgrp;
import com.brilliance.isc.common.api.bch.service.BchService;
import com.brilliance.isc.common.cache.pta.PtaCacheService;
import com.brilliance.isc.common.cbsmod.service.CbsmodService;
import com.brilliance.isc.common.cbsmod.service.XrtmodService;
import com.brilliance.isc.common.context.SettleContext;
import com.brilliance.isc.common.sysmod.SysmodService;
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.StringUtils;
import com.brilliance.isc.common.vo.BizInfoVo;
import com.brilliance.isc.common.vo.PtsptaVo;
import com.brilliance.isc.funds.basesel.common.FtToolComponent;
import com.brilliance.isc.funds.bo.funds.FttpcmStoreBo;
import com.brilliance.isc.funds.fttpcm.check.FttpcmValidator;
import com.brilliance.isc.funds.vo.funds.FttpcmStoreVo;
import com.brilliance.isc.funds.vo.funds.FxtfopStoreVo;
;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 java.util.Map;
import javax.annotation.Resource;import java.math.BigDecimal;import java.util.Map;
import java.util.Objects;
import static com.brilliance.mda.runtime.mda.Constants.NULLSTR;
......@@ -21,44 +36,141 @@ import static com.brilliance.mda.runtime.mda.Constants.NULLSTR;
@Service("fttpcm.transaction")
public class FttpcmTransactionServiceImpl extends AbstractTransactionService<FttpcmStoreBo> {
@Autowired
private PtaCacheService ptaCacheService;
@Resource
private FttpcmValidator fttpcmValidator;
@Resource
private FtToolComponent ftToolComponent;
@Resource
private BchService bchService;
@Resource
private XrtmodService xrtmodService;
@Resource
private SysmodService sysmodService;
@Resource
private CbsmodService cbsmodService;
@Resource
private TransactionHelpService transactionHelpService;
@Resource
private TrnmodService trnmodService;
@Resource
private SettleContext settleContext;
// @Resource
// private FttpService fttpService;
@Override
protected void txnSave(FttpcmStoreBo transactionVo) {
protected void txnSave(FttpcmStoreBo transactionVo){
ruleMtabutSavN500(transactionVo);
}
public void ruleMtabutSavN500(FttpcmStoreBo bo) {
TrnmodVo trnmodVo = transactionHelpService.getTransactionStoreSet().getTrnmodVo();
Ftdgrp ftdgrp = bo.getFtdgrp();
ftToolComponent.getref(ftdgrp);
ftToolComponent.sav(ftdgrp, BigDecimal.ZERO);
// 2. Build Transaction from FTDGRP
trnmodService.trnSetFromContract(trnmodVo);
cbsSav(bo, trnmodVo);
}
/**
* source:fttpcm.0003.script
*/
public void cbsSav(FttpcmStoreBo transactionVo, TrnmodVo trnmodVo){
//取得上下文
cbsmodService.cbsTrnSetNew("TRN", trnmodVo.getTrn().getInr());
Ftacbs cbs = transactionVo.getFtdgrp().getCbs();
String trninr = transactionHelpService.getTrninr();
trnmodService.cbsTrnStore("MAXAMT","AMT1",Dates.today(),cbs.getMax().getCur(),cbs.getMax().getAmt(),MdaUtils.getI18NString("fttpcm","CT000098"),transactionVo.getFtdgrp().getRec(), trninr);
trnmodService.cbsTrnStore("UTLAMT","AMT1",Dates.today(),cbs.getMax().getCur(),cbs.getMax().getAmt(),MdaUtils.getI18NString("fttpcm","CT000094"),transactionVo.getFtdgrp().getRec(), trninr);
trnmodService.cbsTrnStore("OPNAMT","AMT1",Dates.today(),cbs.getMax().getCur(),cbs.getMax().getAmt(),MdaUtils.getI18NString("fttpcm","CT000099"),transactionVo.getFtdgrp().getRec(), trninr);
// trnmodService.troCommit();
}
@Override
protected Map<String, String> txnCheck(FttpcmStoreBo transactionVo) {
return null;
return fttpcmValidator.validate(transactionVo);
}
@Override
protected BizInfoVo buildBizInfo(FttpcmStoreBo transactionVo) {
return null;
return null;
}
@Override
public void beforeSave(FttpcmStoreBo transactionVo) {
transactionVo.reset();
Ftdgrp ftdgrp = transactionVo.getFtdgrp();
TransactionServiceSet transactionServiceSet = transactionHelpService.getTransactionStoreSet();
transactionServiceSet.setRec(ftdgrp.getRec());
transactionServiceSet.setBlk(ftdgrp.getBlk());
transactionServiceSet.setTransactionVo(transactionVo);
ftToolComponent.collectCbsMap(transactionServiceSet, "", ftdgrp.getCbs(), "max");
ftToolComponent.collectPtsList(transactionServiceSet, ftdgrp, null);
settleContext.loadSettleSession(transactionVo.getTransName(), transactionVo.getUserId(), buildBizInfo(transactionVo), transactionServiceSet.getPtsList());
}
public String getRef(FttpcmStoreVo fttpcmStoreVo) {
fttpcmStoreVo.reset();
// PtsptaVo ptsptaVo = fttpcmStoreVo.getFtdgrp().getApl();
// if (ptsptaVo == null || StringUtils.isEmpty(ptsptaVo.getPtainr())) {
// return NULLSTR;
// }
// Pta pta = ptaCacheService.getPtaByInr(ptsptaVo.getPtainr());
// Bch wrkbch = new Bch();
// wrkbch.setInr(pta.getBranchinr());
// wrkbch = bchService.selectByPrimaryKey(wrkbch);
// if (Objects.isNull(wrkbch)) {
// return NULLSTR;
// }
// SettleContext.getUserSession().setWrkbch(wrkbch);
// Fxdgrp fxdgrp = fttpcmStoreVo.getFxdgrp();
// fxToolComponent.getref(fxdgrp);
// return fxdgrp.getRec().getOwnref();
return null;
PtsptaVo ptsptaVo = fttpcmStoreVo.getFtdgrp().getApl();
if (ptsptaVo == null || StringUtils.isEmpty(ptsptaVo.getPtainr())) {
return NULLSTR;
}
Pta pta = ptaCacheService.getPtaByInr(ptsptaVo.getPtainr());
Bch wrkbch = new Bch();
wrkbch.setInr(pta.getBranchinr());
wrkbch = bchService.selectByPrimaryKey(wrkbch);
if (Objects.isNull(wrkbch)) {
return NULLSTR;
}
SettleContext.getUserSession().setWrkbch(wrkbch);
Ftdgrp ftdgrp = fttpcmStoreVo.getFtdgrp();
ftToolComponent.getref(ftdgrp);
return ftdgrp.getRec().getOwnref();
}
public void defaultCalculateN1100(FttpcmStoreVo fttpcmStoreVo) {
fttpcmStoreVo.reset();
// fttpService.defaultCalculateN1100(fxtfopStoreVo.getFxdgrp(), fxtfopStoreVo.getFxtp());
}
public void defaultRateN1000(FxtfopStoreVo fxtfopStoreVo) {
}
@Override
public FttpcmStoreBo init(FttpcmStoreBo fttpcmStoreBo) {
fttpcmStoreBo.reset();
init950(fttpcmStoreBo);
init1000(fttpcmStoreBo);
return fttpcmStoreBo;
}
/**
* source:fxtfop.0001.script
*/
public void init1000(FttpcmStoreBo bo) {
bo.getFtdgrp().getCbs().getMax().setCur(xrtmodService.sysiso());
bo.getFtdgrp().getRec().setFttyp("FT");
String extkey = SettleContext.getUserSession().getUsr().getExtkey();
bo.getFtdgrp().getRec().setUsr(extkey);
if (bo.getFtdgrp().getRec().getOpndat() ==null ){
bo.getFtdgrp().getRec().setOpndat(Dates.today());
}
if (bo.getFtdgrp().getRec().getValdat() ==null ){
bo.getFtdgrp().getRec().setValdat(Dates.today());
}
}
private void init950(FttpcmStoreBo fttpcmStoreBo) {
}
}
package com.brilliance.isc.funds.bo.funds;
import com.brilliance.isc.bo.model.Ftdgrp;
import com.brilliance.isc.bo.model.Fttp;
import com.brilliance.isc.common.transaction.vo.BaseTransactionVo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
......@@ -10,7 +11,7 @@ import lombok.Data;
public class FttpcmStoreBo extends BaseTransactionVo {
private Ftdgrp ftdgrp;
// private Fttp fttp;
private Fttp fttp;
@Override
public void reset(){
super.reset();
......@@ -19,9 +20,9 @@ public class FttpcmStoreBo extends BaseTransactionVo {
}
ftdgrp.reset();
// if (fttp == null){
// fttp = new Fttp();
// }
// fttp.reset();
if (fttp == null){
fttp = new Fttp();
}
fttp.reset();
}
}
package com.brilliance.isc.funds.vo.funds;
import com.brilliance.isc.bo.model.Ftdgrp;
import com.brilliance.isc.bo.model.Fttp;
import com.brilliance.isc.bo.model.Fxdgrp;
import com.brilliance.isc.bo.model.Fxtp;
import com.brilliance.isc.common.transaction.vo.BaseTransactionVo;
......@@ -13,7 +14,7 @@ import lombok.Data;
public class FttpcmStoreVo extends BaseTransactionVo {
private Ftdgrp ftdgrp;
// private Fttp fttp;
private Fttp fttp;
@Override
public void reset() {
......@@ -23,10 +24,10 @@ public class FttpcmStoreVo extends BaseTransactionVo {
}
ftdgrp.reset();
// if (fttp == null) {
// fttp = new Fxtp();
// }
// fttp.reset();
if (fttp == null) {
fttp = new Fttp();
}
fttp.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