|
|
|
@ -111,6 +111,8 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String gid = "";
|
|
|
|
|
String bsno="";
|
|
|
|
|
InvBusinessInfo businessinfo = invBusinessInfoMapper.getByBusiness(business);
|
|
|
|
|
if(null != businessinfo){
|
|
|
|
|
try {
|
|
|
|
@ -120,8 +122,12 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
|
}
|
|
|
|
|
// invBusinessInfoMapper.deleteByGID(businessinfo);
|
|
|
|
|
invBusinessInfoMapper.updateInvBusinessInfo(businessinfo);
|
|
|
|
|
gid = businessinfo.getGID();
|
|
|
|
|
bsno = businessinfo.getBSNO();
|
|
|
|
|
}else{
|
|
|
|
|
invBusinessInfoMapper.add(business);
|
|
|
|
|
gid = business.getGID();
|
|
|
|
|
bsno = business.getBSNO();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -132,8 +138,8 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
|
JSONObject feeobject = feearray.getJSONObject(j);
|
|
|
|
|
InvFeeInfo fee = JSONObject.parseObject(feeobject.toJSONString() , InvFeeInfo.class);// 将string类型直接封装成对象
|
|
|
|
|
fee.setGID((String)feeobject.get("FeeId"));
|
|
|
|
|
fee.setBSNO(business.getBSNO());
|
|
|
|
|
fee.setBusinessId(business.getGID());
|
|
|
|
|
fee.setBSNO(bsno);
|
|
|
|
|
fee.setBusinessId(gid);
|
|
|
|
|
fee.setLinkId(linkinfo.getGID());
|
|
|
|
|
try {
|
|
|
|
|
fee.setCreateTime(sdf.parse(sdf.format(new Date())));
|
|
|
|
@ -832,19 +838,33 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
|
fee.setLinkId(info.getGID());
|
|
|
|
|
fee.setCurrency("RMB");
|
|
|
|
|
List<InvFeeInfo> fees = invFeeInfoMapper.getListBylink(fee);
|
|
|
|
|
BigDecimal sumfees = fees.stream().map(InvFeeInfo::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
|
|
|
|
|
int rmbamount = getInvoiceAmount(fees,link,sumfees);
|
|
|
|
|
int rmbamount =0;
|
|
|
|
|
BigDecimal sumfees = new BigDecimal(0);
|
|
|
|
|
if(null != fees && fees.size()>0){
|
|
|
|
|
sumfees = fees.stream().map(InvFeeInfo::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
rmbamount = getInvoiceAmount(fees,link,sumfees);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InvFeeInfo feeNoRmb = new InvFeeInfo();
|
|
|
|
|
feeNoRmb.setLinkId(info.getGID());
|
|
|
|
|
List<InvFeeInfo> feesNoRmb = invFeeInfoMapper.getListBylinkNoRmb(feeNoRmb);
|
|
|
|
|
BigDecimal usdfees = feesNoRmb.stream().map(InvFeeInfo::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
|
|
|
|
|
int usdamount = getInvoiceAmount(feesNoRmb,link,usdfees);
|
|
|
|
|
int usdamount =0;
|
|
|
|
|
BigDecimal usdInvoiceAmount = new BigDecimal(0);
|
|
|
|
|
BigDecimal usdfees = new BigDecimal(0);
|
|
|
|
|
if(null != feesNoRmb && feesNoRmb.size()>0){
|
|
|
|
|
usdfees = feesNoRmb.stream().map(InvFeeInfo::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
|
|
usdamount = getInvoiceAmount(feesNoRmb,link,usdfees);
|
|
|
|
|
usdInvoiceAmount = usdfees.multiply(feesNoRmb.get(0).getExchangeRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal usdInvoiceAmount = usdfees.multiply(feesNoRmb.get(0).getExchangeRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
|
|
|
|
link.setUsdInvoiceAmount(usdInvoiceAmount);
|
|
|
|
|
link.setInvoiceAmount(rmbamount+usdamount);
|
|
|
|
|