Commit 2117d923 by jianan

出账检核-增加币种78

parent 4139092d
...@@ -16,6 +16,8 @@ import java.util.List; ...@@ -16,6 +16,8 @@ import java.util.List;
public interface FortuneMapper extends BaseMapper<Fortune> { public interface FortuneMapper extends BaseMapper<Fortune> {
List<FortuneStatisticsVO> getFortuneStatistics(@Param("fortuneIdList") List<Long> fortuneIdList); List<FortuneStatisticsVO> getFortuneStatistics(@Param("fortuneIdList") List<Long> fortuneIdList);
void removeByIdsPhysical(List<Long> collect);
} }
......
...@@ -48,4 +48,6 @@ public interface FortuneService extends IService<Fortune> { ...@@ -48,4 +48,6 @@ public interface FortuneService extends IService<Fortune> {
Boolean editExchangeRate(EditExchangeRateRequest editExchangeRateRequest); Boolean editExchangeRate(EditExchangeRateRequest editExchangeRateRequest);
String batchEditActualPayoutDate(BatchEditActualPayoutDateRequest editBatchActualPayoutDateRequest); String batchEditActualPayoutDate(BatchEditActualPayoutDateRequest editBatchActualPayoutDateRequest);
void removeByIdsPhysical(List<Long> collect);
} }
...@@ -646,12 +646,18 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -646,12 +646,18 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "未找到保单对应的预计发佣记录,请先创建预计发佣记录"); throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "未找到保单对应的预计发佣记录,请先创建预计发佣记录");
} }
// 2. 根据本次发佣期数,查询是否有未出账的记录 // 2. 根据本次发佣期数,删除未出账的记录
List<Fortune> fortuneList = fortuneService.lambdaQuery() List<Fortune> fortuneList = fortuneService.lambdaQuery()
.eq(Fortune::getStatus, FortuneStatusEnum.CAN_SEND.getItemValue())
.in(Fortune::getExpectedFortuneBizId, filteredExpectedFortuneList1.stream().map(ExpectedFortune::getExpectedFortuneBizId).collect(Collectors.toList())) .in(Fortune::getExpectedFortuneBizId, filteredExpectedFortuneList1.stream().map(ExpectedFortune::getExpectedFortuneBizId).collect(Collectors.toList()))
.list(); .list();
// 2.1 校验是否有未出账的记录 // 2.1 物理删除
if (CollectionUtils.isNotEmpty(fortuneList)) {
fortuneService.removeByIdsPhysical(fortuneList.stream().map(Fortune::getId).collect(Collectors.toList()));
}
// 2.2 筛选出未出账的记录
List<ExpectedFortune> filteredExpectedFortuneList2 = new ArrayList<>(); List<ExpectedFortune> filteredExpectedFortuneList2 = new ArrayList<>();
for (ExpectedFortune expectedFortune : filteredExpectedFortuneList1) { for (ExpectedFortune expectedFortune : filteredExpectedFortuneList1) {
// 如果有已出账记录,跳过 // 如果有已出账记录,跳过
...@@ -660,14 +666,14 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -660,14 +666,14 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
} }
filteredExpectedFortuneList2.add(expectedFortune); filteredExpectedFortuneList2.add(expectedFortune);
} }
// 2.2 校验预计发佣记录是否有出账币种、默认结算汇率 // 2.3 校验预计发佣记录是否有出账币种、默认结算汇率
for (ExpectedFortune expectedFortune : filteredExpectedFortuneList2) { for (ExpectedFortune expectedFortune : filteredExpectedFortuneList2) {
if (StringUtils.isBlank(expectedFortune.getRuleCurrency())) { if (StringUtils.isBlank(expectedFortune.getRuleCurrency())) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "预计发佣记录" + expectedFortune.getExpectedFortuneBizId() + "未配置保单币种"); throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "预计发佣记录" + expectedFortune.getExpectedFortuneBizId() + "未配置保单币种");
} }
} }
// 2.3 根据保单号、期数查询入账检核汇率 // 2.4 根据保单号、期数查询入账检核汇率
Map<String, BigDecimal> exchangeRateMap = this.queryCommissionExchangeRateMap(policyNoSet, commissionPeriodSet); Map<String, BigDecimal> exchangeRateMap = this.queryCommissionExchangeRateMap(policyNoSet, commissionPeriodSet);
// 3. 构建实际的初始发佣记录(使用入账检核汇率) // 3. 构建实际的初始发佣记录(使用入账检核汇率)
...@@ -756,7 +762,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -756,7 +762,12 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
List<Fortune> newFortuneList = new ArrayList<>(); List<Fortune> newFortuneList = new ArrayList<>();
// 更新预计发佣记录的港币金额 // 更新预计发佣记录的港币金额
List<ExpectedFortune> updatedExpectedFortuneList = new ArrayList<>(); List<ExpectedFortune> updatedExpectedFortuneList = new ArrayList<>();
// 更新预计发佣记录的状态
List<Long> updatedExpectedFortuneIdList = new ArrayList<>();
for (ExpectedFortune expectedFortune : expectedFortuneList) { for (ExpectedFortune expectedFortune : expectedFortuneList) {
updatedExpectedFortuneIdList.add(expectedFortune.getId());
Fortune fortune = new Fortune(); Fortune fortune = new Fortune();
BeanUtils.copyProperties(expectedFortune, fortune); BeanUtils.copyProperties(expectedFortune, fortune);
...@@ -829,6 +840,18 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -829,6 +840,18 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
} }
} }
// 更新预计发佣记录的状态
if (CollectionUtils.isNotEmpty(updatedExpectedFortuneIdList)) {
boolean updateSuccess = iExpectedFortuneService.lambdaUpdate()
.set(ExpectedFortune::getStatus, FortuneStatusEnum.CAN_SEND.getItemValue())
.in(ExpectedFortune::getId, updatedExpectedFortuneIdList)
.update();
if (!updateSuccess) {
throw new BusinessException(ResultCode.FAIL.getCode(), "更新预计发佣记录状态失败");
}
}
return newFortuneList; return newFortuneList;
} }
......
...@@ -1253,6 +1253,14 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune> ...@@ -1253,6 +1253,14 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
return String.format("设置成功。已更新 %d 条数据,跳过 %d 条(已有实际出账年月)", updateCount, skipCount); return String.format("设置成功。已更新 %d 条数据,跳过 %d 条(已有实际出账年月)", updateCount, skipCount);
} }
@Override
public void removeByIdsPhysical(List<Long> collect) {
if (CollectionUtils.isEmpty(collect)) {
return;
}
this.baseMapper.removeByIdsPhysical(collect);
}
private void validEditExchangeRate(EditExchangeRateRequest editExchangeRateRequest) { private void validEditExchangeRate(EditExchangeRateRequest editExchangeRateRequest) {
if (ObjectUtils.isEmpty(editExchangeRateRequest.getOriginalCurrency())) { if (ObjectUtils.isEmpty(editExchangeRateRequest.getOriginalCurrency())) {
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种不能为空"); throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "原币种不能为空");
......
...@@ -61,6 +61,13 @@ ...@@ -61,6 +61,13 @@
create_time,update_time create_time,update_time
</sql> </sql>
<delete id="removeByIdsPhysical">
DELETE FROM fortune WHERE id IN
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
<select id="getFortuneStatistics" resultType="com.yd.csf.service.dto.FortuneStatisticsVO"> <select id="getFortuneStatistics" resultType="com.yd.csf.service.dto.FortuneStatisticsVO">
SELECT SELECT
f.policy_no, f.policy_no,
......
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