Commit 94b0ab55 by huangshunlin

补充getSettlementAmount,即期结售汇 east7759

parent 6607dce9
package com.brilliance.isc.common.setmod.service.impl;
import cn.hutool.core.lang.Assert;
import com.brilliance.mda.runtime.mda.IStream;
import com.brilliance.mda.runtime.mda.impl.Argument;
import com.brilliance.mda.runtime.mda.impl.StreamImpl;
import com.brilliance.mda.runtime.mda.util.*;
import org.springframework.util.ObjectUtils;
import com.brilliance.isc.bo.*;
import com.brilliance.isc.common.cache.atpbch.AtpBchCacheService;
import com.brilliance.isc.common.cache.pta.PtaCacheService;
......@@ -68,18 +63,23 @@ import com.brilliance.isc.utils.BigDecimalUtils;
import com.brilliance.isc.utils.DateUtils;
import com.brilliance.isc.vo.component.dftcre.DftcreVo;
import com.brilliance.isc.vo.model.Fale01Vo;
import com.brilliance.mda.runtime.mda.IStream;
import com.brilliance.mda.runtime.mda.impl.Argument;
import com.brilliance.mda.runtime.mda.impl.StreamImpl;
import com.brilliance.mda.runtime.mda.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.*;
import static com.brilliance.mda.runtime.mda.Constants.*;
import static com.brilliance.isc.common.contants.CommonContants.SETGLL_DSP_CODES;
import static com.brilliance.mda.runtime.mda.Constants.*;
/**
*
......@@ -177,6 +177,10 @@ public class SetmodServiceImpl implements SetmodService {
@Autowired(required = false)
private LimCecmService limCecmService;
@Autowired
private SetstaMapper setstaMapper;
/**
* source:setmod.0021.script
*/
......@@ -319,9 +323,10 @@ public class SetmodServiceImpl implements SetmodService {
/**
* 保存cecm报送涉及的费用
*
* @param setmodVo
*/
public void saveCecmFep(SetmodVo setmodVo){
public void saveCecmFep(SetmodVo setmodVo) {
LimmodVo limmodVo = transactionHelpService.getTransactionStoreSet().getLimmodVo();
if (limmodVo == null) {
limmodVo = new LimmodVo();
......@@ -332,15 +337,15 @@ public class SetmodServiceImpl implements SetmodService {
limmodVo.getCecmBatchVo().setCecmmod(new Cecmfep());
}
Battrn battrn = limmodVo.getCecmBatchVo().getBattrn();
battrn.setBatchnam(String.format("%s费用",setmodVo.getRec().getObjtyp()));
battrn.setBatchnam(String.format("%s费用", setmodVo.getRec().getObjtyp()));
battrn.setCecmfil("trans_comm");
LimmodVo finalLimmodVo = limmodVo;
setmodVo.getSetfeg().getSetfel().forEach(setfelVo -> {
Cecmfep cecmfep=new Cecmfep();
Cecmfep cecmfep = new Cecmfep();
cecmfep.setFyzl(setfelVo.getFeecod());
cecmfep.setCur(setfelVo.getCur());
cecmfep.setSfje(BigDecimalUtils.BigD2stringHalfUP(setfelVo.getAmt(),6));
cecmfep.setSfje(BigDecimalUtils.BigD2stringHalfUP(setfelVo.getAmt(), 6));
cecmfep.setFyfsrq(DateUtils.dateTime());
cecmfep.setOwnref(setmodVo.getRec().getOwnref());
finalLimmodVo.getCecmBatchVo().setCecmmod(cecmfep);
......@@ -1860,7 +1865,7 @@ public class SetmodServiceImpl implements SetmodService {
}
}
} catch (Exception e) {
log.error("反序列化objmod{}发生错误:{}",objmod,e.getMessage());
log.error("反序列化objmod{}发生错误:{}", objmod, e.getMessage());
}
}
if (MdaUtils.isEmpty(relamt)) {
......@@ -1935,7 +1940,7 @@ public class SetmodServiceImpl implements SetmodService {
}
}
} catch (Exception e) {
log.error("反序列化objmod{}发生错误:{}",objmod,e.getMessage());
log.error("反序列化objmod{}发生错误:{}", objmod, e.getMessage());
}
}
return argSetFel.getDoccur();
......@@ -2764,4 +2769,44 @@ public class SetmodServiceImpl implements SetmodService {
}
}
}
/**
* source:setmod.0229.script
*/
@Override
public BigDecimal getSettlementAmount(SetmodVo setmodVo, String argCur) {
BigDecimal setAmt = new BigDecimal("0");
Map<String, Cbb> cbsMap = setmodVo.getCbsMap();
BizInfoVo rec = setmodVo.getRec();
String rol = sysmodService.getClientPath(SettleContext.getUserSession().getAtp().getBus() + "D", rec);
List<PtsptaVo> ptsList = setmodVo.getPtsList();
PtsptaVo ptsptaVo = ptsptaToolComponent.getPtsFromListByRol(ptsList, rol);
String ptyInr = NULLSTR;
if (Objects.nonNull(ptsptaVo) && Objects.nonNull(ptsptaVo.getPts())) {
ptyInr = ptsptaVo.getPts().getPtyinr();
}
if (!MdaUtils.isEmpty(ptyInr)) {
Cbb max = cbsMap.get("MAX");
if (Objects.nonNull(max)) {
setAmt = max.getAmt();
}
//新的一年客户时点结算量进行重新累积并与去年的结算量进行比较,取较高值进行对应相应的优惠幅度
//解决现有的从开发以来一直累积的功能设置,更改为以年为单位进行累积。并进行比较对应。
//对于手工维护的优惠点数,以维护的优惠点数与结算量达到的优惠点数进行比较取较高值进行优惠。
//上年结算量
BigDecimal lstAmt = setstaMapper.getSumLstamtByPtyinrAndCur(ptyInr, argCur);
//本年结算量
BigDecimal amt = setstaMapper.getSumAmtByPtyinrAndCur(ptyInr, argCur);
if (MdaUtils.compareTo(lstAmt, amt) > 0) {
setAmt = Decimals.add(setAmt, lstAmt);
} else {
setAmt = Decimals.add(setAmt, amt);
}
}
return setAmt;
}
}
\ No newline at end of file
......@@ -2983,6 +2983,7 @@ public class TrnmodServiceImpl implements TrnmodService {
case "FCD":
case "JSD":
case "MCD":
case "FXD":
break;
default:
throw new CommonServiceException("east7759 无效的业务种类{" + objtyp + "}");
......
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