Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-csf
Commits
0c5d37ab
Commit
0c5d37ab
authored
Apr 30, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/test' into test
parents
ed5f9a31
0ef71611
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
38 deletions
+88
-38
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneSplitDto.java
+49
-7
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
+7
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
+10
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
+18
-27
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
+4
-4
No files found.
yd-csf-service/src/main/java/com/yd/csf/service/dto/FortuneSplitDto.java
View file @
0c5d37ab
...
...
@@ -14,21 +14,63 @@ public class FortuneSplitDto {
private
BigDecimal
splitRatio
;
/**
*
原币种金额(自动计算)
*
保单币种金额
*/
@Schema
(
description
=
"原币种金额(自动计算)"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
originalAmount
;
@Schema
(
description
=
"保单币种金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
ruleAmount
;
/**
* 保单币种
*/
@Schema
(
description
=
"保单币种"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
ruleCurrency
;
/**
*
结算汇率
*
保单币种→港币汇率(入账检核汇率)
*/
@Schema
(
description
=
"
结算汇率
"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@Schema
(
description
=
"
保单币种→港币汇率(入账检核汇率)
"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
exchangeRate
;
/**
* 港币出账金额
* 原币种
*/
@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
)
@Schema
(
description
=
"港币金额"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
BigDecimal
hkdAmount
;
/**
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/IExpectedFortuneService.java
View file @
0c5d37ab
...
...
@@ -49,4 +49,11 @@ public interface IExpectedFortuneService extends IService<ExpectedFortune> {
ExpectedFortune
getByBizId
(
String
expectedFortuneBizId
);
Integer
getPayableNoCurrentSeq
();
/**
* 生成应付款编号(序号递增) 格式:发佣类型-CSF+年份+序号
* @param fortuneType 发佣类型
* @return 应付款编号
*/
String
getPayableNo
(
String
fortuneType
);
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/ExpectedFortuneServiceImpl.java
View file @
0c5d37ab
...
...
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -196,4 +197,13 @@ public class ExpectedFortuneServiceImpl extends ServiceImpl<ExpectedFortuneMappe
return
currentSeq
;
}
@Override
public
String
getPayableNo
(
String
fortuneType
)
{
Integer
currentSeq
=
getPayableNoCurrentSeq
();
return
String
.
format
(
"%s%s%s"
,
fortuneType
+
"-CSF"
,
LocalDate
.
now
().
getYear
()
%
100
,
currentSeq
+
1
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FortuneServiceImpl.java
View file @
0c5d37ab
...
...
@@ -2,7 +2,6 @@ package com.yd.csf.service.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -794,13 +793,8 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
private
ExpectedFortune
createExpectedFortune
(
FortuneAddRequest
fortuneAddRequest
,
Policy
policy
,
String
fortuneName
)
{
// 计算应付款编号 payableNo
Integer
currentSeq
=
expectedFortuneService
.
getPayableNoCurrentSeq
();
// 应付款编号(序号递增)
String
payableNo
=
String
.
format
(
"%s%s%s"
,
fortuneAddRequest
.
getFortuneType
()
+
"-CSF"
,
LocalDate
.
now
().
getYear
()
%
100
,
String
.
format
(
"%06d"
,
++
currentSeq
));
String
payableNo
=
expectedFortuneService
.
getPayableNo
(
fortuneAddRequest
.
getFortuneType
());
// 创建 expectedFortune
ExpectedFortune
expectedFortune
=
new
ExpectedFortune
();
...
...
@@ -896,7 +890,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
String
loginUserId
=
currentLoginUser
.
getId
().
toString
();
String
username
=
currentLoginUser
.
getUsername
();
for
(
FortuneSplitDto
splitDto
:
splitList
)
{
for
(
int
i
=
0
;
i
<
splitList
.
size
();
i
++)
{
FortuneSplitDto
splitDto
=
splitList
.
get
(
i
);
// 4.1 生成新的 ExpectedFortune
ExpectedFortune
newExpectedFortune
=
new
ExpectedFortune
();
...
...
@@ -908,9 +904,13 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
String
newExpectedFortuneBizId
=
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_EXPECTED_FORTUNE
.
getCode
());
newExpectedFortune
.
setExpectedFortuneBizId
(
newExpectedFortuneBizId
);
BigDecimal
originalAmount
=
splitDto
.
getOriginalAmount
();
newExpectedFortune
.
setOriginalAmount
(
originalAmount
);
newExpectedFortune
.
setHkdAmount
(
splitDto
.
getHkdAmount
());
// 赋值分期出账信息
BeanUtils
.
copyProperties
(
splitDto
,
newExpectedFortune
);
// 生成应付款编号
String
payableNo
=
originalExpectedFortune
.
getPayableNo
()
+
"_"
+
(
i
+
1
);
newExpectedFortune
.
setPayableNo
(
payableNo
);
newExpectedFortune
.
setDefaultExchangeRate
(
splitDto
.
getExchangeRate
());
newExpectedFortune
.
setPaidAmount
(
BigDecimal
.
ZERO
);
...
...
@@ -920,7 +920,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
newExpectedFortune
.
setStatus
(
"0"
);
newExpectedFortune
.
setPayoutDate
(
toPayoutDate
(
splitDto
.
getPayoutYearMonth
()
));
newExpectedFortune
.
setPayoutDate
(
LocalDate
.
parse
(
splitDto
.
getPayoutYearMonth
()
+
"-01"
));
String
expectedRemark
=
StringUtils
.
isBlank
(
splitDto
.
getRemark
())
?
""
:
splitDto
.
getRemark
();
if
(
StringUtils
.
isNotBlank
(
originalExpectedFortune
.
getRemark
()))
{
...
...
@@ -950,11 +950,10 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
newFortune
.
setExpectedFortuneBizId
(
newExpectedFortuneBizId
);
newFortune
.
setOriginalAmount
(
originalAmount
);
newFortune
.
setHkdAmount
(
splitDto
.
getHkdAmount
());
newFortune
.
setExchangeRate
(
splitDto
.
getExchangeRate
());
newFortune
.
setCurrentPaymentAmount
(
originalAmount
);
// 赋值分期出账信息
BeanUtils
.
copyProperties
(
splitDto
,
newFortune
);
// 特殊字段
newFortune
.
setCurrentPaymentAmount
(
splitDto
.
getPayoutAmount
());
newFortune
.
setCurrentPaymentHkdAmount
(
splitDto
.
getHkdAmount
());
newFortune
.
setCurrentPaymentRatio
(
splitDto
.
getSplitRatio
());
...
...
@@ -1007,15 +1006,6 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
return
true
;
}
private
static
LocalDate
toPayoutDate
(
String
payoutYearMonth
)
{
String
[]
yearMonth
=
payoutYearMonth
.
split
(
"-"
);
return
LocalDate
.
of
(
Integer
.
parseInt
(
yearMonth
[
0
]),
Integer
.
parseInt
(
yearMonth
[
1
]),
1
);
}
@Override
public
Boolean
editActualPayoutDate
(
EditActualPayoutDateRequest
editActualPayoutDateRequest
)
{
String
fortuneBizId
=
editActualPayoutDateRequest
.
getFortuneBizId
();
...
...
@@ -1031,7 +1021,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
// 计算实际出账日期
LocalDate
actualPayoutDate
=
toPayoutDate
(
editActualPayoutDateRequest
.
getActualPayoutDate
()
);
LocalDate
actualPayoutDate
=
LocalDate
.
parse
(
editActualPayoutDateRequest
.
getActualPayoutDate
()
+
"-01"
);
// 更新实际出账日期
this
.
lambdaUpdate
()
...
...
@@ -1048,6 +1038,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
editExchangeRate
(
EditExchangeRateRequest
editExchangeRateRequest
)
{
validEditExchangeRate
(
editExchangeRateRequest
);
...
...
yd-csf-service/src/main/resources/mappers/ExpectedFortuneMapper.xml
View file @
0c5d37ab
...
...
@@ -65,9 +65,9 @@
MAX(p.product_name) as productName,
ef.fortune_period as fortunePeriod,
MAX(ef.fortune_total_period) as fortuneTotalPeriod,
ifnull(sum(ef.amount), 0) as amount,
ifnull(sum(ef.
original_
amount), 0) as amount,
ifnull(sum(ef.hkd_amount), 0) as hkdAmount,
MAX(ef.currency) as currency,
MAX(ef.
original_
currency) as currency,
ifnull(sum(ef.paid_amount), 0) as paidAmount,
ifnull(sum(ef.unpaid_amount), 0) as unpaidAmount,
case when ifnull(sum(ef.hkd_amount), 0) > 0
...
...
@@ -120,9 +120,9 @@
p.product_name as productName,
ef.fortune_period as fortunePeriod,
ef.fortune_total_period as fortuneTotalPeriod,
ifnull(ef.amount, 0) as amount,
ifnull(ef.
original_
amount, 0) as amount,
ifnull(ef.hkd_amount, 0) as hkdAmount,
ef.currency as currency,
ef.
original_
currency as currency,
ifnull(ef.paid_amount, 0) as paidAmount,
ifnull(ef.unpaid_amount, 0) as unpaidAmount,
case when ifnull(ef.hkd_amount, 0) > 0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment