Commit 19b3f83f by zhangxingmin

Merge remote-tracking branch 'origin/test' into test

parents 8af5cb04 5a30fd12
...@@ -464,6 +464,9 @@ public class ApiFortuneController { ...@@ -464,6 +464,9 @@ public class ApiFortuneController {
if (editExchangeRateRequest.getExchangeRate() == null) { if (editExchangeRateRequest.getExchangeRate() == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), "exchangeRate 不能为空"); return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), "exchangeRate 不能为空");
} }
if (editExchangeRateRequest.getHkdAmount() == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), "hkdAmount 不能为空");
}
return Result.success(fortuneService.editExchangeRate(editExchangeRateRequest)); return Result.success(fortuneService.editExchangeRate(editExchangeRateRequest));
} }
......
...@@ -952,10 +952,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -952,10 +952,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
expectedFortune.setFortuneName(queryByDict(expectedFortuneDto.getFortuneType())); expectedFortune.setFortuneName(queryByDict(expectedFortuneDto.getFortuneType()));
// 应付款编号(序号递增) // 应付款编号(序号递增)
expectedFortune.setPayableNo(this.createPayableNo(expectedFortune.getFortuneBizType(), ++currentSeq)); expectedFortune.setPayableNo(this.createPayableNo(expectedFortune.getFortuneBizType(), ++currentSeq));
// 计算金额
expectedFortune.setAmount(
NumberUtil.div(expectedFortuneDto.getHkdAmount(), expectedFortuneDto.getDefaultExchangeRate(), 2)
);
// 已出帐金额、待出帐金额、已出帐比例、待出帐比例 // 已出帐金额、待出帐金额、已出帐比例、待出帐比例
expectedFortune.setPaidAmount(BigDecimal.ZERO); expectedFortune.setPaidAmount(BigDecimal.ZERO);
...@@ -1018,7 +1015,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -1018,7 +1015,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if (Objects.isNull(expectedFortuneDto.getCurrency())) { if (Objects.isNull(expectedFortuneDto.getCurrency())) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "预计出账币种不能为空"); throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "预计出账币种不能为空");
} }
if (Objects.isNull(expectedFortuneDto.getDefaultExchangeRate())) { if (Objects.isNull(expectedFortuneDto.getExchangeRate())) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "结算汇率不能为空"); throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "结算汇率不能为空");
} }
} }
...@@ -1167,6 +1164,10 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -1167,6 +1164,10 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if (request == null) { if (request == null) {
return queryWrapper; return queryWrapper;
} }
// 默认查询条件 是否分期出账 1-是 0-否 2-拆分的原纪录
queryWrapper.in("is_part", 0, 1);
// 获取参数 // 获取参数
String payableNo = request.getPayableNo(); String payableNo = request.getPayableNo();
String policyNo = request.getPolicyNo(); String policyNo = request.getPolicyNo();
......
...@@ -79,7 +79,7 @@ public class ExpectedFortuneAddRequest { ...@@ -79,7 +79,7 @@ public class ExpectedFortuneAddRequest {
* 结算汇率 * 结算汇率
*/ */
@Schema(description = "结算汇率") @Schema(description = "结算汇率")
private BigDecimal defaultExchangeRate; private BigDecimal exchangeRate;
/** /**
* 出账金额 单位:港币 * 出账金额 单位:港币
...@@ -113,4 +113,9 @@ public class ExpectedFortuneAddRequest { ...@@ -113,4 +113,9 @@ public class ExpectedFortuneAddRequest {
@Schema(description = "出账状态 0=待出账 1=可出帐,待检核 2=完成出账 3=部分出账 4=保留 5=已失效 6=可出帐,检核完成 7=未找到当前预计发佣对应的来佣, 字典值: csf_expected_fortune_status") @Schema(description = "出账状态 0=待出账 1=可出帐,待检核 2=完成出账 3=部分出账 4=保留 5=已失效 6=可出帐,检核完成 7=未找到当前预计发佣对应的来佣, 字典值: csf_expected_fortune_status")
private String status; private String status;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
} }
...@@ -193,6 +193,24 @@ public class ExpectedFortune implements Serializable { ...@@ -193,6 +193,24 @@ public class ExpectedFortune implements Serializable {
private BigDecimal defaultExchangeRate; private BigDecimal defaultExchangeRate;
/** /**
* 出账原币种金额
*/
@TableField("payout_amount")
private BigDecimal payoutAmount;
/**
* 出账原币种
*/
@TableField("payout_currency")
private String payoutCurrency;
/**
* 出账原币种结算汇率(出账原币种 → 港币的结算汇率)
*/
@TableField("payout_exchange_rate")
private BigDecimal payoutExchangeRate;
/**
* 港币预计出账金额 * 港币预计出账金额
*/ */
@TableField("hkd_amount") @TableField("hkd_amount")
......
...@@ -43,7 +43,7 @@ public class Fortune implements Serializable { ...@@ -43,7 +43,7 @@ public class Fortune implements Serializable {
private String fortuneBizType; private String fortuneBizType;
/** /**
* 是否部分出账拆分出来的出账记录 0=No, 1=Yes * 是否拆分出来的出账 1-是 0-否 2-拆分的原纪录
*/ */
private Integer isPart; private Integer isPart;
......
...@@ -79,6 +79,11 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -79,6 +79,11 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
if (fortuneQueryRequest == null) { if (fortuneQueryRequest == null) {
return queryWrapper; return queryWrapper;
} }
// 默认查询条件 是否分期出账 1-是 0-否 2-拆分的原纪录
queryWrapper.in("is_part", 0, 1);
// 获取参数
String reconciliationYearMonth = fortuneQueryRequest.getReconciliationYearMonth(); String reconciliationYearMonth = fortuneQueryRequest.getReconciliationYearMonth();
List<String> statusList = fortuneQueryRequest.getStatusList(); List<String> statusList = fortuneQueryRequest.getStatusList();
String policyNo = fortuneQueryRequest.getPolicyNo(); String policyNo = fortuneQueryRequest.getPolicyNo();
...@@ -368,7 +373,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -368,7 +373,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
List<FortuneAccountExportDTO> accountExportDTOList = new ArrayList<>(); List<FortuneAccountExportDTO> accountExportDTOList = new ArrayList<>();
// 设置出账年月(实) // 设置出账年月(实)
LocalDate actualPayoutDate = LocalDate.parse(fortuneDownloadRequest.getActualPayoutDate()); LocalDate actualPayoutDate = LocalDate.parse(fortuneDownloadRequest.getActualPayoutDate() + "-01");
fortuneList.forEach(fortune -> fortune.setActualPayoutDate(actualPayoutDate)); fortuneList.forEach(fortune -> fortune.setActualPayoutDate(actualPayoutDate));
// 处理每个分组的数据 // 处理每个分组的数据
...@@ -1031,7 +1036,41 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -1031,7 +1036,41 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
@Override @Override
public Boolean editExchangeRate(EditExchangeRateRequest editExchangeRateRequest) { public Boolean editExchangeRate(EditExchangeRateRequest editExchangeRateRequest) {
return null; String fortuneBizId = editExchangeRateRequest.getFortuneBizId();
Fortune fortune = this.getByFortuneBizId(fortuneBizId);
if (fortune == null) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "出账记录不存在");
}
if (FortuneStatusEnum.SENT.getItemValue().equals(fortune.getStatus())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "已完成出账状态的记录不能修改结算汇率");
}
ExpectedFortune originalExpectedFortune = expectedFortuneService.getByBizId(fortune.getExpectedFortuneBizId());
if (originalExpectedFortune == null) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "对应的预计出账记录不存在");
}
// 获取入参
BigDecimal exchangeRate = editExchangeRateRequest.getExchangeRate();
BigDecimal hkdAmount = editExchangeRateRequest.getHkdAmount();
// 更新 fortune 的结算汇率、港币金额
this.lambdaUpdate()
.set(Fortune::getExchangeRate, exchangeRate)
.set(Fortune::getHkdAmount, hkdAmount)
.eq(Fortune::getId, fortune.getId())
.update();
// 更新 expected fortune 的出账原币种结算汇率、港币金额
expectedFortuneService.lambdaUpdate()
.set(ExpectedFortune::getPayoutExchangeRate, exchangeRate)
.set(ExpectedFortune::getHkdAmount, hkdAmount)
.set(ExpectedFortune::getUnpaidAmount, hkdAmount)
.eq(ExpectedFortune::getId, originalExpectedFortune.getId())
.update();
return true;
} }
private void validSplitFortune(FortuneSplitRequest fortuneSplitRequest) { private void validSplitFortune(FortuneSplitRequest fortuneSplitRequest) {
......
...@@ -42,6 +42,12 @@ public class FortuneVO implements Serializable { ...@@ -42,6 +42,12 @@ public class FortuneVO implements Serializable {
private String fortuneBizType; private String fortuneBizType;
/** /**
* 是否拆分出来的出账 1-是 0-否 2-拆分的原纪录
*/
@Schema(description = "是否拆分出来的出账 1-是 0-否 2-拆分的原纪录")
private Integer isPart;
/**
* 预计出账业务ID * 预计出账业务ID
*/ */
@Schema(description = "预计出账业务ID") @Schema(description = "预计出账业务ID")
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
AND ef.is_part in (0,1)
</where> </where>
</select> </select>
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
#{fortuneId} #{fortuneId}
</foreach> </foreach>
</if> </if>
AND f.is_part in (0,1)
GROUP BY f.policy_no GROUP BY f.policy_no
</select> </select>
......
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