Commit 60d950e8 by jianan

新单跟进v2

parent c5a47f61
......@@ -250,9 +250,15 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//查询当前保单号的所有预计发佣记录
List<ExpectedFortune> expectedFortuneList = iExpectedFortuneService.queryList(policyNo);
//批量更新应付款编号
for (ExpectedFortune expectedFortune : expectedFortuneList) {
expectedFortune.setPayableNo(this.createPayableNo("R", latest));
//获取当前序号作为起点
int currentSeq = 0;
if (!Objects.isNull(latest)) {
currentSeq = Integer.parseInt(latest.getPayableNo().substring(12));
}
//批量更新应付款编号,每个item递增
for (int i = 0; i < expectedFortuneList.size(); i++) {
expectedFortuneList.get(i).setPayableNo(this.createPayableNo("R", currentSeq + i + 1));
}
iExpectedFortuneService.updateBatchById(expectedFortuneList);
}
......@@ -411,6 +417,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
// fortune.setAmount(algorithmResDto.getCalculatedValue());
//保单发佣批次ID
// fortune.setBatchBizId(fortuneDto.getBatchBizId());
fortune.setFortuneBizType("R");
//转介人姓名 (获得积分的业务员)
fortune.setBroker(fortuneDto.getBroker());
//转介人业务ID (获得积分的业务员)
......@@ -499,6 +506,11 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
new QueryWrapper<ExpectedFortune>().isNotNull("payable_no").orderByDesc("id").last("LIMIT 1"),
true
);
//获取当前序号作为起点
int currentSeq = 0;
if (!Objects.isNull(latest)) {
currentSeq = Integer.parseInt(latest.getPayableNo().substring(12));
}
List<ExpectedFortune> fortuneList = new ArrayList<>();
for (ExpectedFortuneAddRequest expectedFortuneDto : fortuneAddRequestList) {
......@@ -507,8 +519,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
// 预计发佣业务id
expectedFortune.setExpectedFortuneBizId(RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_EXPECTED_FORTUNE.getCode()));
// 应付款编号
expectedFortune.setPayableNo(this.createPayableNo(expectedFortune.getFortuneBizType(), latest));
// 应付款编号(序号递增)
expectedFortune.setPayableNo(this.createPayableNo(expectedFortune.getFortuneBizType(), ++currentSeq));
// 默认结算汇率
expectedFortune.setDefaultExchangeRate(queryDefaultExchangeRate(expectedFortune.getCurrency()));
// 计算港币金额
......@@ -601,19 +613,14 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
* 创建应付款编号 应付款类型-CSF-年份后两位-6位数字(不重复)
*
* @param fortuneBizType 预计发佣业务类型
* @param latest 最新一条有 payableNo 记录
* @param seq 序号
* @return
*/
private String createPayableNo(String fortuneBizType, ExpectedFortune latest) {
String seq = "000001";
// 有最新记录,根据最新记录的序号生成下一个序号
if (!Objects.isNull(latest)) {
seq = String.format("%06d", Integer.parseInt(latest.getPayableNo().substring(12)) + 1);
}
private String createPayableNo(String fortuneBizType, int seq) {
return String.format("%s%s%s",
fortuneBizType + "-CSF",
LocalDate.now().getYear() % 100,
seq);
String.format("%06d", seq));
}
/**
......
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