Commit 80847624 by jianan

出账检核-增加币种2

parent 707000af
...@@ -10,9 +10,63 @@ public class EditExchangeRateRequest { ...@@ -10,9 +10,63 @@ public class EditExchangeRateRequest {
@Schema(description = "fortuneBizId", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "fortuneBizId", requiredMode = Schema.RequiredMode.REQUIRED)
private String fortuneBizId; private String fortuneBizId;
@Schema(description = "结算汇率", requiredMode = Schema.RequiredMode.REQUIRED) /**
* 保单币种金额
*/
@Schema(description = "保单币种金额", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal ruleAmount;
/**
* 保单币种
*/
@Schema(description = "保单币种", requiredMode = Schema.RequiredMode.REQUIRED)
private String ruleCurrency;
/**
* 保单币种→港币汇率(入账检核汇率)
*/
@Schema(description = "保单币种→港币汇率(入账检核汇率)", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal exchangeRate; private BigDecimal exchangeRate;
@Schema(description = "港币出账金额", requiredMode = Schema.RequiredMode.REQUIRED) /**
* 原币种
*/
@Schema(description = "原币种", requiredMode = Schema.RequiredMode.REQUIRED)
private String originalCurrency;
/**
* 原币种金额
*/
@Schema(description = "原币种金额", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal originalAmount;
/**
* 原币种→港币汇率
*/
@Schema(description = "原币种→港币汇率", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal originalToHkdRate;
/**
* 发放币种
*/
@Schema(description = "发放币种", requiredMode = Schema.RequiredMode.REQUIRED)
private String payoutCurrency;
/**
* 发放币种金额
*/
@Schema(description = "发放币种金额", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal payoutAmount;
/**
* 港币→发放币种汇率
*/
@Schema(description = "港币→发放币种汇率", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal hkdToPayoutRate;
/**
* 港币金额
*/
@Schema(description = "港币金额", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal hkdAmount; private BigDecimal hkdAmount;
} }
...@@ -131,6 +131,12 @@ public class FortuneAddRequest implements Serializable { ...@@ -131,6 +131,12 @@ public class FortuneAddRequest implements Serializable {
private BigDecimal payoutAmount; private BigDecimal payoutAmount;
/** /**
* 港币→发放币种汇率
*/
@Schema(description = "港币→发放币种汇率", requiredMode = Schema.RequiredMode.REQUIRED)
private BigDecimal hkdToPayoutRate;
/**
* 港币金额 * 港币金额
*/ */
@Schema(description = "港币金额", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "港币金额", requiredMode = Schema.RequiredMode.REQUIRED)
......
...@@ -154,14 +154,14 @@ public class ExpectedFortune implements Serializable { ...@@ -154,14 +154,14 @@ public class ExpectedFortune implements Serializable {
/** /**
* 保单币种金额(保单币种金额 = 标准发佣金额 * 转介人介绍费占比) * 保单币种金额(保单币种金额 = 标准发佣金额 * 转介人介绍费占比)
*/ */
@TableField("amount") @TableField("rule_amount")
private BigDecimal amount; private BigDecimal ruleAmount;
/** /**
* 保单币种 * 保单币种
*/ */
@TableField("currency") @TableField("rule_currency")
private String currency; private String ruleCurrency;
/** /**
* 出账状态 0=待出账 1=可出帐 2=可出帐,待检核 3=部分出账 4=保留 5=已失效 6=可出账, 已检核 7=未找到当前预计发佣对应的来佣 字典值: csf_expected_fortune_status * 出账状态 0=待出账 1=可出帐 2=可出帐,待检核 3=部分出账 4=保留 5=已失效 6=可出账, 已检核 7=未找到当前预计发佣对应的来佣 字典值: csf_expected_fortune_status
......
...@@ -168,6 +168,11 @@ public class Fortune { ...@@ -168,6 +168,11 @@ public class Fortune {
private BigDecimal payoutAmount; private BigDecimal payoutAmount;
/** /**
* 港币→发放币种汇率
*/
private BigDecimal hkdToPayoutRate;
/**
* 港币金额 * 港币金额
*/ */
private BigDecimal hkdAmount; private BigDecimal hkdAmount;
......
...@@ -645,11 +645,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -645,11 +645,8 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
} }
// 2.3 校验预计发佣记录是否有出账币种、默认结算汇率 // 2.3 校验预计发佣记录是否有出账币种、默认结算汇率
for (ExpectedFortune expectedFortune : filteredExpectedFortuneList2) { for (ExpectedFortune expectedFortune : filteredExpectedFortuneList2) {
if (StringUtils.isBlank(expectedFortune.getCurrency())) { if (StringUtils.isBlank(expectedFortune.getRuleCurrency())) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "预计发佣记录" + expectedFortune.getExpectedFortuneBizId() + "未配置出账币种"); throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "预计发佣记录" + expectedFortune.getExpectedFortuneBizId() + "未配置保单币种");
}
if (expectedFortune.getDefaultExchangeRate() == null) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "预计发佣记录" + expectedFortune.getExpectedFortuneBizId() + "未配置默认结算汇率");
} }
} }
...@@ -703,7 +700,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -703,7 +700,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
fortune.setFortuneBizType("R"); fortune.setFortuneBizType("R");
fortune.setExchangeRate(expectedFortune.getDefaultExchangeRate()); fortune.setExchangeRate(expectedFortune.getDefaultExchangeRate());
fortune.setCurrentPaymentAmount(expectedFortune.getAmount()); fortune.setCurrentPaymentAmount(expectedFortune.getOriginalAmount());
fortune.setCurrentPaymentHkdAmount(expectedFortune.getHkdAmount()); fortune.setCurrentPaymentHkdAmount(expectedFortune.getHkdAmount());
fortune.setExpectedFortuneBizId(expectedFortune.getExpectedFortuneBizId()); fortune.setExpectedFortuneBizId(expectedFortune.getExpectedFortuneBizId());
fortune.setStatus(FortuneStatusEnum.CAN_SEND.getItemValue()); fortune.setStatus(FortuneStatusEnum.CAN_SEND.getItemValue());
......
...@@ -546,49 +546,49 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -546,49 +546,49 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
private static void valiAddFortune(FortuneAddRequest fortuneAddRequest) { private static void valiAddFortune(FortuneAddRequest fortuneAddRequest) {
if (ObjectUtils.isEmpty(fortuneAddRequest.getFortuneBizType())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getFortuneBizType())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "出账类型不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "出账类型不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getOriginalCurrency())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getOriginalCurrency())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "原币种不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getOriginalAmount())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getOriginalAmount())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "原币种金额不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种金额不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getOriginalToHkdRate())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getOriginalToHkdRate())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "原币种→港币汇率不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种→港币汇率不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getPayoutCurrency())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getPayoutCurrency())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "发放币种不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "发放币种不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getPayoutAmount())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getPayoutAmount())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "发放币种金额不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "发放币种金额不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getRuleCurrency())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getRuleCurrency())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "保单币种不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "保单币种不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getRuleAmount())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getRuleAmount())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "保单币种金额不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "保单币种金额不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getExchangeRate())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getExchangeRate())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "保单币种→港币汇率不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "保单币种→港币汇率不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getHkdAmount())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getHkdAmount())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "港币金额不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "港币金额不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getFortuneType())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getFortuneType())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "出账项目不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "出账项目不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getBrokerBizId())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getBrokerBizId())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "转介人不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "转介人不能为空");
} }
if ("R".equals(fortuneAddRequest.getFortuneBizType())) { if ("R".equals(fortuneAddRequest.getFortuneBizType())) {
if (ObjectUtils.isEmpty(fortuneAddRequest.getPolicyNo())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getPolicyNo())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "关联保单应付款,保单号不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "关联保单应付款,保单号不能为空");
} }
if (ObjectUtils.isEmpty(fortuneAddRequest.getFortunePeriod())) { if (ObjectUtils.isEmpty(fortuneAddRequest.getFortunePeriod())) {
throw new BusinessException(ResultCode.FAIL.getCode(), "关联保单应付款,佣金期数不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "关联保单应付款,佣金期数不能为空");
} }
} }
} }
...@@ -909,7 +909,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -909,7 +909,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
newExpectedFortune.setExpectedFortuneBizId(newExpectedFortuneBizId); newExpectedFortune.setExpectedFortuneBizId(newExpectedFortuneBizId);
BigDecimal originalAmount = splitDto.getOriginalAmount(); BigDecimal originalAmount = splitDto.getOriginalAmount();
newExpectedFortune.setAmount(originalAmount); newExpectedFortune.setOriginalAmount(originalAmount);
newExpectedFortune.setHkdAmount(splitDto.getHkdAmount()); newExpectedFortune.setHkdAmount(splitDto.getHkdAmount());
newExpectedFortune.setDefaultExchangeRate(splitDto.getExchangeRate()); newExpectedFortune.setDefaultExchangeRate(splitDto.getExchangeRate());
...@@ -1049,6 +1049,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -1049,6 +1049,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
@Override @Override
public Boolean editExchangeRate(EditExchangeRateRequest editExchangeRateRequest) { public Boolean editExchangeRate(EditExchangeRateRequest editExchangeRateRequest) {
validEditExchangeRate(editExchangeRateRequest);
String fortuneBizId = editExchangeRateRequest.getFortuneBizId(); String fortuneBizId = editExchangeRateRequest.getFortuneBizId();
Fortune fortune = this.getByFortuneBizId(fortuneBizId); Fortune fortune = this.getByFortuneBizId(fortuneBizId);
...@@ -1065,27 +1068,81 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -1065,27 +1068,81 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
} }
// 获取入参 // 获取入参
BigDecimal ruleAmount = editExchangeRateRequest.getRuleAmount();
String ruleCurrency = editExchangeRateRequest.getRuleCurrency();
BigDecimal exchangeRate = editExchangeRateRequest.getExchangeRate(); BigDecimal exchangeRate = editExchangeRateRequest.getExchangeRate();
String originalCurrency = editExchangeRateRequest.getOriginalCurrency();
BigDecimal originalAmount = editExchangeRateRequest.getOriginalAmount();
BigDecimal originalToHkdRate = editExchangeRateRequest.getOriginalToHkdRate();
String payoutCurrency = editExchangeRateRequest.getPayoutCurrency();
BigDecimal payoutAmount = editExchangeRateRequest.getPayoutAmount();
BigDecimal hkdToPayoutRate = editExchangeRateRequest.getHkdToPayoutRate();
BigDecimal hkdAmount = editExchangeRateRequest.getHkdAmount(); BigDecimal hkdAmount = editExchangeRateRequest.getHkdAmount();
// 更新 fortune 的结算汇率、港币金额 // 更新 fortune 的结算汇率、港币金额
this.lambdaUpdate() this.lambdaUpdate()
.set(Fortune::getRuleAmount, ruleAmount)
.set(Fortune::getRuleCurrency, ruleCurrency)
.set(Fortune::getExchangeRate, exchangeRate) .set(Fortune::getExchangeRate, exchangeRate)
.set(Fortune::getOriginalCurrency, originalCurrency)
.set(Fortune::getOriginalAmount, originalAmount)
.set(Fortune::getOriginalToHkdRate, originalToHkdRate)
.set(Fortune::getPayoutCurrency, payoutCurrency)
.set(Fortune::getPayoutAmount, payoutAmount)
.set(Fortune::getHkdToPayoutRate, hkdToPayoutRate)
.set(Fortune::getHkdAmount, hkdAmount) .set(Fortune::getHkdAmount, hkdAmount)
.eq(Fortune::getId, fortune.getId()) .eq(Fortune::getId, fortune.getId())
.update(); .update();
// 更新 expected fortune 的出账原币种结算汇率、港币金额 // 更新 expected fortune 的出账原币种结算汇率、港币金额
// expectedFortuneService.lambdaUpdate() expectedFortuneService.lambdaUpdate()
// .set(ExpectedFortune::getPayoutExchangeRate, exchangeRate) .set(ExpectedFortune::getRuleAmount, ruleAmount)
// .set(ExpectedFortune::getHkdAmount, hkdAmount) .set(ExpectedFortune::getRuleCurrency, ruleCurrency)
// .set(ExpectedFortune::getUnpaidAmount, hkdAmount) .set(ExpectedFortune::getDefaultExchangeRate, exchangeRate)
// .eq(ExpectedFortune::getId, originalExpectedFortune.getId()) .set(ExpectedFortune::getOriginalCurrency, originalCurrency)
// .update(); .set(ExpectedFortune::getOriginalAmount, originalAmount)
.set(ExpectedFortune::getOriginalToHkdRate, originalToHkdRate)
.set(ExpectedFortune::getPayoutCurrency, payoutCurrency)
.set(ExpectedFortune::getPayoutAmount, payoutAmount)
.set(ExpectedFortune::getHkdToPayoutRate, hkdToPayoutRate)
.set(ExpectedFortune::getHkdAmount, hkdAmount)
.set(ExpectedFortune::getUnpaidAmount, hkdAmount)
.eq(ExpectedFortune::getId, originalExpectedFortune.getId())
.update();
return true; return true;
} }
private void validEditExchangeRate(EditExchangeRateRequest editExchangeRateRequest) {
if (ObjectUtils.isEmpty(editExchangeRateRequest.getOriginalCurrency())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getOriginalAmount())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种金额不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getOriginalToHkdRate())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种→港币汇率不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getPayoutCurrency())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "发放币种不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getPayoutAmount())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "发放币种金额不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getRuleCurrency())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "保单币种不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getRuleAmount())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "保单币种金额不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getExchangeRate())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "保单币种→港币汇率不能为空");
}
if (ObjectUtils.isEmpty(editExchangeRateRequest.getHkdAmount())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "港币金额不能为空");
}
}
private void validSplitFortune(FortuneSplitRequest fortuneSplitRequest) { private void validSplitFortune(FortuneSplitRequest fortuneSplitRequest) {
if (fortuneSplitRequest == null) { if (fortuneSplitRequest == null) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "分期出账请求不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "分期出账请求不能为空");
......
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