Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
01136f48
Commit
01136f48
authored
May 16, 2023
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.5.4-SALARY实发倒推应发初次提交
parent
15e3902b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
216 additions
and
156 deletions
+216
-156
TSalaryAccountItem.java
.../cloud/plus/v1/yifu/salary/entity/TSalaryAccountItem.java
+6
-0
TSalaryTaxConfigMapper.java
...ud/plus/v1/yifu/salary/mapper/TSalaryTaxConfigMapper.java
+9
-0
TSalaryTaxConfigService.java
.../plus/v1/yifu/salary/service/TSalaryTaxConfigService.java
+2
-0
SalaryUploadServiceImpl.java
.../v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
+125
-57
TSalaryTaxConfigServiceImpl.java
...yifu/salary/service/impl/TSalaryTaxConfigServiceImpl.java
+12
-0
SalaryConstants.java
.../yifu/cloud/plus/v1/yifu/salary/util/SalaryConstants.java
+2
-0
TSalaryAccountItemMapper.xml
...iz/src/main/resources/mapper/TSalaryAccountItemMapper.xml
+5
-2
TSalaryTaxConfigMapper.xml
...-biz/src/main/resources/mapper/TSalaryTaxConfigMapper.xml
+55
-97
No files found.
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TSalaryAccountItem.java
View file @
01136f48
...
@@ -113,4 +113,10 @@ public class TSalaryAccountItem extends Model<TSalaryAccountItem> {
...
@@ -113,4 +113,10 @@ public class TSalaryAccountItem extends Model<TSalaryAccountItem> {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
salaryMonth
;
private
String
salaryMonth
;
/**
* 年终奖扣税方案0:合并;1:单独
*/
@TableField
(
exist
=
false
)
private
String
annualBonusType
;
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TSalaryTaxConfigMapper.java
View file @
01136f48
...
@@ -42,5 +42,14 @@ public interface TSalaryTaxConfigMapper extends BaseMapper<TSalaryTaxConfig> {
...
@@ -42,5 +42,14 @@ public interface TSalaryTaxConfigMapper extends BaseMapper<TSalaryTaxConfig> {
**/
**/
List
<
TSalaryTaxConfig
>
getTaxConfigByAnnualBonusList
(
@Param
(
"tSalaryTaxConfig"
)
TSalaryTaxConfig
tSalaryTaxConfig
);
List
<
TSalaryTaxConfig
>
getTaxConfigByAnnualBonusList
(
@Param
(
"tSalaryTaxConfig"
)
TSalaryTaxConfig
tSalaryTaxConfig
);
/**
* @param tSalaryTaxConfig
* @Description: 实发倒推
* @Author: hgw
* @Date: 2023/5/16 10:33
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryTaxConfig>
**/
List
<
TSalaryTaxConfig
>
getTaxConfigByActualList
(
@Param
(
"tSalaryTaxConfig"
)
TSalaryTaxConfig
tSalaryTaxConfig
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TSalaryTaxConfigService.java
View file @
01136f48
...
@@ -41,5 +41,7 @@ public interface TSalaryTaxConfigService extends IService<TSalaryTaxConfig> {
...
@@ -41,5 +41,7 @@ public interface TSalaryTaxConfigService extends IService<TSalaryTaxConfig> {
**/
**/
List
<
TSalaryTaxConfig
>
getTaxConfigByAnnualBonusList
(
TSalaryTaxConfig
tSalaryTaxConfig
);
List
<
TSalaryTaxConfig
>
getTaxConfigByAnnualBonusList
(
TSalaryTaxConfig
tSalaryTaxConfig
);
List
<
TSalaryTaxConfig
>
getTaxConfigByActualList
(
TSalaryTaxConfig
tSalaryTaxConfig
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
View file @
01136f48
...
@@ -505,6 +505,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -505,6 +505,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
String
checkYearFinalStyle
;
//薪资和年终奖扣税方案(0:合并;1:单独)
String
checkYearFinalStyle
;
//薪资和年终奖扣税方案(0:合并;1:单独)
List
<
TSalaryTaxConfig
>
personTax
=
tSalaryTaxConfigService
.
getTaxConfigByPersonList
(
new
TSalaryTaxConfig
());
List
<
TSalaryTaxConfig
>
personTax
=
tSalaryTaxConfigService
.
getTaxConfigByPersonList
(
new
TSalaryTaxConfig
());
List
<
TSalaryTaxConfig
>
annousTax
=
tSalaryTaxConfigService
.
getTaxConfigByAnnualBonusList
(
new
TSalaryTaxConfig
());
List
<
TSalaryTaxConfig
>
annousTax
=
tSalaryTaxConfigService
.
getTaxConfigByAnnualBonusList
(
new
TSalaryTaxConfig
());
List
<
TSalaryTaxConfig
>
actualTax
=
tSalaryTaxConfigService
.
getTaxConfigByActualList
(
new
TSalaryTaxConfig
());
int
size
=
savList
.
size
();
int
size
=
savList
.
size
();
TSalaryAccountItem
annousSai
;
TSalaryAccountItem
annousSai
;
// 自有员工人数
// 自有员工人数
...
@@ -725,7 +726,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -725,7 +726,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
//年终奖优化方案 2:自动计算
//年终奖优化方案 2:自动计算
if
(
CommonConstants
.
TWO_STRING
.
equals
(
checkYearFinalStyle
))
{
if
(
CommonConstants
.
TWO_STRING
.
equals
(
checkYearFinalStyle
))
{
checkYearFinalStyle
=
checkYearFinalStyle
(
isActual
,
asList
,
sdSum
checkYearFinalStyle
=
checkYearFinalStyle
(
isActual
,
asList
,
sdSum
,
costReduction
,
personTax
,
saiList
,
annualBonus
,
annousTax
,
a
);
,
costReduction
,
personTax
,
actualTax
,
saiList
,
annualBonus
,
annousTax
,
a
);
}
}
//年终奖单独扣税
//年终奖单独扣税
if
(
CommonConstants
.
ONE_STRING
.
equals
(
checkYearFinalStyle
))
{
if
(
CommonConstants
.
ONE_STRING
.
equals
(
checkYearFinalStyle
))
{
...
@@ -748,14 +749,14 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -748,14 +749,14 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
personalDebt
=
personalDebt
.
add
(
this
.
saveNewItems
(
saiList
,
SalaryConstants
.
SALARY_TAX
,
personalDebt
=
personalDebt
.
add
(
this
.
saveNewItems
(
saiList
,
SalaryConstants
.
SALARY_TAX
,
SalaryConstants
.
SALARY_TAX_JAVA
,
SalaryConstants
.
SALARY_TAX_JAVA
,
calculation2PersonSalary
(
isActual
,
saiList
,
asList
,
sdSum
calculation2PersonSalary
(
isActual
,
saiList
,
asList
,
sdSum
,
costReduction
,
personTax
,
saiList
,
a
),
CommonConstants
.
ZERO_INT
));
,
costReduction
,
personTax
,
actualTax
,
saiList
,
a
),
CommonConstants
.
ZERO_INT
));
}
else
{
}
else
{
// 实发倒推个税应发
// 实发倒推个税应发
if
(!
isLabor
)
{
if
(!
isLabor
)
{
this
.
saveNewItems
(
saiList
,
SalaryConstants
.
SALARY_TAX
,
this
.
saveNewItems
(
saiList
,
SalaryConstants
.
SALARY_TAX
,
SalaryConstants
.
SALARY_TAX_JAVA
,
SalaryConstants
.
SALARY_TAX_JAVA
,
calculation2PersonSalary
(
isActual
,
saiList
,
asList
,
sdSum
calculation2PersonSalary
(
isActual
,
saiList
,
asList
,
sdSum
,
costReduction
,
personTax
,
saiList
,
a
),
CommonConstants
.
ZERO_INT
);
,
costReduction
,
personTax
,
actualTax
,
saiList
,
a
),
CommonConstants
.
ZERO_INT
);
}
else
{
}
else
{
// 实发劳务费,按月累计扣税 2022-3-2 17:32:40 樊青青提的需求
// 实发劳务费,按月累计扣税 2022-3-2 17:32:40 樊青青提的需求
this
.
saveNewItems
(
saiList
,
SalaryConstants
.
SALARY_TAX
,
this
.
saveNewItems
(
saiList
,
SalaryConstants
.
SALARY_TAX
,
...
@@ -1160,37 +1161,52 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -1160,37 +1161,52 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
**/
**/
private
static
BigDecimal
calculation2PersonSalary
(
boolean
isActual
,
List
<
TSalaryAccountItem
>
itemList
private
static
BigDecimal
calculation2PersonSalary
(
boolean
isActual
,
List
<
TSalaryAccountItem
>
itemList
,
List
<
TSalaryAccountItem
>
itemHistoryList
,
BigDecimal
specialDeductionSum
,
List
<
TSalaryAccountItem
>
itemHistoryList
,
BigDecimal
specialDeductionSum
,
BigDecimal
costReduction
,
List
<
TSalaryTaxConfig
>
subs
,
List
<
TSalaryAccountItem
>
saiList
,
TSalaryAccount
a
)
{
,
BigDecimal
costReduction
,
List
<
TSalaryTaxConfig
>
subs
,
List
<
TSalaryTaxConfig
>
actualTax
,
List
<
TSalaryAccountItem
>
saiList
,
TSalaryAccount
a
)
{
//本次纳税额
//本次纳税额
BigDecimal
res
=
SalaryConstants
.
B_ZERO
;
BigDecimal
res
=
SalaryConstants
.
B_ZERO
;
BigDecimal
annualBonus
=
SalaryConstants
.
B_ZERO
;
BigDecimal
sumTax
=
SalaryConstants
.
B_ZERO
;
BigDecimal
sumTax
=
SalaryConstants
.
B_ZERO
;
BigDecimal
realDeduSalary
=
SalaryConstants
.
B_ZERO
;
BigDecimal
realDeduSalary
=
SalaryConstants
.
B_ZERO
;
BigDecimal
addRelaySalary
=
SalaryConstants
.
B_ZERO
;
// 实发倒推应发后需要加上其余金额,成为应发。
BigDecimal
actualSalarySumNow
=
SalaryConstants
.
B_ZERO
;
// 本次实发。
// 实发倒推-属性:
BigDecimal
actualSalaryNow
=
SalaryConstants
.
B_ZERO
;
// 本次实发
BigDecimal
actualSalary
=
SalaryConstants
.
B_ZERO
;
// 实发
BigDecimal
annualBonus
=
SalaryConstants
.
B_ZERO
;
// -单独年终奖
BigDecimal
deduction
=
SalaryConstants
.
B_ZERO
;
// +个人代扣
BigDecimal
phoneSubsidy
=
SalaryConstants
.
B_ZERO
;
// -通讯补贴(不计税)
BigDecimal
otherDeduction
=
SalaryConstants
.
B_ZERO
;
// -其他扣除项,包含【累计个人社保(含代扣,含本期)+累计个人公积金(含代扣)
// +累计年金(个人含本期)+累计个人代扣(各类个人代扣费用,含本期)+免个税个人代扣(含本期)】
// - costReduction - specialDeductionSum
BigDecimal
relaySalaryHistory
=
SalaryConstants
.
B_ZERO
;
// 历史应发
//本次
//本次
for
(
TSalaryAccountItem
item
:
itemList
)
{
for
(
TSalaryAccountItem
item
:
itemList
)
{
if
(
SalaryConstants
.
ANNUAL_BONUS_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
if
(
SalaryConstants
.
ANNUAL_BONUS_JAVA
.
equals
(
item
.
getJavaFiedName
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
a
.
getAnnualBonusType
())
)
{
annualBonus
=
item
.
getSalaryMoney
();
annualBonus
=
item
.
getSalaryMoney
();
}
}
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
res
=
res
.
add
(
item
.
getSalaryMoney
());
res
=
res
.
add
(
item
.
getSalaryMoney
());
}
}
if
(
SalaryConstants
.
PDEDUCTION_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
deduction
=
deduction
.
add
(
item
.
getSalaryMoney
());
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
PHONE_SUBSIDY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
phoneSubsidy
=
phoneSubsidy
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
realDeduSalary
=
realDeduSalary
.
add
(
item
.
getSalaryMoney
());
realDeduSalary
=
realDeduSalary
.
add
(
item
.
getSalaryMoney
());
actualSalarySumNow
=
actualSalarySumNow
.
add
(
item
.
getSalaryMoney
());
actualSalary
=
actualSalary
.
add
(
item
.
getSalaryMoney
());
actualSalaryNow
=
actualSalaryNow
.
add
(
item
.
getSalaryMoney
());
}
}
if
(
CommonConstants
.
ONE_INT
==
item
.
getIsTax
())
{
if
(
CommonConstants
.
ONE_INT
==
item
.
getIsTax
())
{
res
=
res
.
subtract
(
item
.
getSalaryMoney
());
res
=
res
.
subtract
(
item
.
getSalaryMoney
());
realDeduSalary
=
realDeduSalary
.
subtract
(
item
.
getSalaryMoney
());
realDeduSalary
=
realDeduSalary
.
subtract
(
item
.
getSalaryMoney
());
addRelaySalary
=
addRelaySalary
.
add
(
item
.
getSalaryMoney
());
}
}
otherDeduction
=
getOtherDeducation
(
otherDeduction
,
item
);
}
}
BigDecimal
realSalaryHistory
=
SalaryConstants
.
B_ZERO
;
//历史累计
//历史累计
for
(
TSalaryAccountItem
item
:
itemHistoryList
)
{
for
(
TSalaryAccountItem
item
:
itemHistoryList
)
{
if
(
SalaryConstants
.
ANNUAL_BONUS_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
if
(
SalaryConstants
.
ANNUAL_BONUS_JAVA
.
equals
(
item
.
getJavaFiedName
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
item
.
getAnnualBonusType
())
)
{
annualBonus
=
annualBonus
.
add
(
item
.
getSalaryMoney
());
annualBonus
=
annualBonus
.
add
(
item
.
getSalaryMoney
());
}
}
if
(
SalaryConstants
.
SALARY_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
if
(
SalaryConstants
.
SALARY_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
...
@@ -1198,15 +1214,23 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -1198,15 +1214,23 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
}
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
res
=
res
.
add
(
item
.
getSalaryMoney
());
res
=
res
.
add
(
item
.
getSalaryMoney
());
realSalaryHistory
=
realSalaryHistory
.
add
(
item
.
getSalaryMoney
());
relaySalaryHistory
=
relaySalaryHistory
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
PHONE_SUBSIDY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
phoneSubsidy
=
phoneSubsidy
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
PDEDUCTION_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
deduction
=
deduction
.
add
(
item
.
getSalaryMoney
());
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
}
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
realDeduSalary
=
realDeduSalary
.
add
(
item
.
getSalaryMoney
());
realDeduSalary
=
realDeduSalary
.
add
(
item
.
getSalaryMoney
());
actualSalary
=
actualSalary
.
add
(
item
.
getSalaryMoney
());
}
}
if
(
CommonConstants
.
ONE_INT
==
item
.
getIsTax
())
{
if
(
CommonConstants
.
ONE_INT
==
item
.
getIsTax
())
{
res
=
res
.
subtract
(
item
.
getSalaryMoney
());
res
=
res
.
subtract
(
item
.
getSalaryMoney
());
addRelaySalary
=
addRelaySalary
.
add
(
item
.
getSalaryMoney
());
}
}
otherDeduction
=
getOtherDeducation
(
otherDeduction
,
item
);
}
}
if
(
specialDeductionSum
!=
null
)
{
if
(
specialDeductionSum
!=
null
)
{
res
=
res
.
subtract
(
specialDeductionSum
);
res
=
res
.
subtract
(
specialDeductionSum
);
...
@@ -1215,7 +1239,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -1215,7 +1239,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if
(
costReduction
!=
null
)
{
if
(
costReduction
!=
null
)
{
res
=
res
.
subtract
(
costReduction
);
res
=
res
.
subtract
(
costReduction
);
realDeduSalary
=
realDeduSalary
.
subtract
(
costReduction
);
realDeduSalary
=
realDeduSalary
.
subtract
(
costReduction
);
addRelaySalary
=
addRelaySalary
.
add
(
costReduction
);
}
}
if
(!
isActual
)
{
if
(!
isActual
)
{
for
(
TSalaryTaxConfig
sub
:
subs
)
{
for
(
TSalaryTaxConfig
sub
:
subs
)
{
...
@@ -1229,49 +1252,62 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -1229,49 +1252,62 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
}
}
}
}
else
{
}
else
{
BigDecimal
testArea
;
// 应发-起征点,判断计算金额范围;
// -实发倒推应发改版-2023-5-16 10:51:31-版本MVP1.5.4-王成提供的新倒推公式
//倒推公式(原先):
// 1 数据处理:报账明细中若存在“年终奖单独扣税”不为0的行时,在进行本公式计算时,应将年终奖金额从应发和实发中分别扣除后,再参与计算
//((实发合计-减除费用)/ (1-税率) - (速算/(1-税率)) + 减除费用)
// -
// 2 计算税率档(税率、速算扣除数)=(累计实发金额(去掉年终奖单独扣税的部分实发,含本期)+个人代扣(各类个人代扣费用,不包含免个税个人代扣,含本期)
// (历史应发)
// -通讯补贴(不计税)-费用扣除标准(本期)-专项附加扣除(含本期))
// =
// 本次应发
// 税率档
TSalaryAccountItem
sai
;
BigDecimal
areaMoney
=
actualSalary
.
subtract
(
annualBonus
).
add
(
deduction
).
subtract
(
phoneSubsidy
);
BigDecimal
relaySalary
;
if
(
costReduction
!=
null
)
{
for
(
TSalaryTaxConfig
sub
:
subs
)
{
areaMoney
=
areaMoney
.
subtract
(
costReduction
);
//res = realDeduSalary / (1- (double) ((sub.getTaxRate() * 1.0) / 100))
}
// - (sub.getQuick()/ (1- (double) ((sub.getTaxRate() * 1.0) / 100)))
if
(
specialDeductionSum
!=
null
)
{
// + addRelaySalary
areaMoney
=
areaMoney
.
subtract
(
specialDeductionSum
);
res
=
realDeduSalary
.
divide
(
new
BigDecimal
(
"1"
).
subtract
(
new
BigDecimal
(
sub
.
getWithholdingRate
()).
divide
(
}
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
)),
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
)
// 应缴税所得额
.
subtract
(
sub
.
getQuickDeducation
().
divide
(
new
BigDecimal
(
"1"
).
subtract
(
new
BigDecimal
(
sub
.
getWithholdingRate
()).
divide
(
BigDecimal
doTaxMoney
=
BigDecimal
.
ZERO
;
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
)),
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
))
for
(
TSalaryTaxConfig
sub
:
actualTax
)
{
.
add
(
addRelaySalary
);
if
(
areaMoney
.
compareTo
(
sub
.
getMinIncome
())
>
SalaryConstants
.
EQUAL
testArea
=
res
.
subtract
(
costReduction
);
&&
areaMoney
.
compareTo
(
sub
.
getMaxIncome
())
<=
SalaryConstants
.
EQUAL
)
{
if
(
testArea
.
compareTo
(
SalaryConstants
.
B_ZERO
)
<
SalaryConstants
.
EQUAL
)
{
// 3 计算应缴税所得额(参与计税的金额)= (税率档位-速算扣除数)/(1—税率)
testArea
=
SalaryConstants
.
B_ZERO
;
doTaxMoney
=
(
areaMoney
.
subtract
(
sub
.
getQuickDeducation
())).
divide
(
SalaryConstants
.
B_ONEHUNDRED
.
subtract
(
new
BigDecimal
(
sub
.
getWithholdingRate
())).
divide
(
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
));
break
;
}
}
if
(
testArea
.
compareTo
(
sub
.
getMinIncome
())
>
SalaryConstants
.
EQUAL
}
&&
testArea
.
compareTo
(
sub
.
getMaxIncome
())
<=
SalaryConstants
.
EQUAL
)
{
// 累计个税
//res = res - realSalary - tf.getActualSalarySum(); //应发-历史应发=本次应发;本次应发-本次实发=税
BigDecimal
taxAll
=
BigDecimal
.
ZERO
;
relaySalary
=
res
.
subtract
(
realSalaryHistory
);
// 4 计算累计个税 =应纳税所得额×适用税率-速算扣除数
res
=
relaySalary
.
subtract
(
actualSalarySumNow
);
for
(
TSalaryTaxConfig
sub
:
subs
)
{
// 本次个人应发合计
if
(
doTaxMoney
.
compareTo
(
sub
.
getMinIncome
())
>
SalaryConstants
.
EQUAL
sai
=
new
TSalaryAccountItem
();
&&
doTaxMoney
.
compareTo
(
sub
.
getMaxIncome
())
<=
SalaryConstants
.
EQUAL
)
{
sai
.
setCnName
(
SalaryConstants
.
RELAY_SALARY
);
taxAll
=
doTaxMoney
.
multiply
(
new
BigDecimal
(
sub
.
getWithholdingRate
()).
divide
(
sai
.
setJavaFiedName
(
SalaryConstants
.
RELAY_SALARY_JAVA
);
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
))
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
.
subtract
(
sub
.
getQuickDeducation
());
// 应纳税额
if
(
res
.
compareTo
(
SalaryConstants
.
B_ZERO
)
<=
SalaryConstants
.
EQUAL
)
{
sai
.
setSalaryMoney
(
actualSalarySumNow
);
a
.
setRelaySalary
(
actualSalarySumNow
);
}
else
{
sai
.
setSalaryMoney
(
relaySalary
);
a
.
setRelaySalary
(
relaySalary
);
}
saiList
.
add
(
sai
);
break
;
break
;
}
}
}
}
if
(
taxAll
.
compareTo
(
SalaryConstants
.
B_ZERO
)
<
SalaryConstants
.
EQUAL
)
{
taxAll
=
BigDecimal
.
ZERO
;
}
// 5 计算应发=累计实发工资(含本期)+累计个税+累计个人社保(含代扣,含本期)+累计个人公积金(含代扣)
// +累计年金(个人含本期)+累计个人代扣(各类个人代扣费用,含本期)+免个税个人代扣(含本期)-历史累计应发(不含本期)
// 本次应发
BigDecimal
relaySalaryNow
=
actualSalary
.
add
(
taxAll
).
add
(
otherDeduction
).
subtract
(
relaySalaryHistory
);
if
(
relaySalaryNow
.
compareTo
(
actualSalaryNow
)
<=
SalaryConstants
.
EQUAL
)
{
relaySalaryNow
=
actualSalaryNow
;
}
res
=
relaySalaryNow
.
subtract
(
actualSalaryNow
);
// 本次个人应发合计
TSalaryAccountItem
sai
=
new
TSalaryAccountItem
();
sai
.
setCnName
(
SalaryConstants
.
RELAY_SALARY
);
sai
.
setJavaFiedName
(
SalaryConstants
.
RELAY_SALARY_JAVA
);
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
sai
.
setSalaryMoney
(
relaySalaryNow
);
a
.
setRelaySalary
(
relaySalaryNow
);
saiList
.
add
(
sai
);
}
}
if
(
res
.
compareTo
(
SalaryConstants
.
B_ZERO
)
<
SalaryConstants
.
EQUAL
)
{
if
(
res
.
compareTo
(
SalaryConstants
.
B_ZERO
)
<
SalaryConstants
.
EQUAL
)
{
return
SalaryConstants
.
B_ZERO
;
return
SalaryConstants
.
B_ZERO
;
...
@@ -1281,6 +1317,38 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -1281,6 +1317,38 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
return
res
;
return
res
;
}
}
/**
* @param otherDeduction
* @param item
* @Description: 实发倒推应发,获取其他累加项
* @Author: hgw
* @Date: 2023/5/16 17:09
* @return: java.math.BigDecimal
**/
private
static
BigDecimal
getOtherDeducation
(
BigDecimal
otherDeduction
,
TSalaryAccountItem
item
)
{
if
(
SalaryConstants
.
WITHHOLIDING_PERSON_SOCIAL
.
equals
(
item
.
getJavaFiedName
()))
{
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
WITHHOLIDING_PERSON_FUND
.
equals
(
item
.
getJavaFiedName
()))
{
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
PERSONAL_SOCIAL_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
PERSONAL_FUND_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
// 企业(职业)年金
if
(
SalaryConstants
.
ENTERPRISE_ANNUITY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
// 免个税个人代扣
if
(
SalaryConstants
.
EXEMPTION_PERSION_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
otherDeduction
=
otherDeduction
.
add
(
item
.
getSalaryMoney
());
}
return
otherDeduction
;
}
/**
/**
* @param itemList
* @param itemList
...
@@ -1364,11 +1432,11 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -1364,11 +1432,11 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
* @author hgw
* @author hgw
*/
*/
public
static
String
checkYearFinalStyle
(
boolean
isActual
,
List
<
TSalaryAccountItem
>
asList
,
BigDecimal
sdSum
public
static
String
checkYearFinalStyle
(
boolean
isActual
,
List
<
TSalaryAccountItem
>
asList
,
BigDecimal
sdSum
,
BigDecimal
costReduction
,
List
<
TSalaryTaxConfig
>
personTax
,
BigDecimal
costReduction
,
List
<
TSalaryTaxConfig
>
personTax
,
List
<
TSalaryTaxConfig
>
actualTax
,
List
<
TSalaryAccountItem
>
saiList
,
BigDecimal
annualBonus
,
List
<
TSalaryAccountItem
>
saiList
,
BigDecimal
annualBonus
,
List
<
TSalaryTaxConfig
>
annousTax
,
TSalaryAccount
a
)
{
,
List
<
TSalaryTaxConfig
>
annousTax
,
TSalaryAccount
a
)
{
BigDecimal
finalSalaryWithSalary
=
calculation2PersonSalary
(
isActual
,
saiList
,
asList
,
sdSum
BigDecimal
finalSalaryWithSalary
=
calculation2PersonSalary
(
isActual
,
saiList
,
asList
,
sdSum
,
costReduction
,
personTax
,
saiList
,
a
);
,
costReduction
,
personTax
,
actualTax
,
saiList
,
a
);
BigDecimal
finalSalaryNoSalary
=
calculation2FinalSalary
(
a
,
annualBonus
,
annousTax
);
BigDecimal
finalSalaryNoSalary
=
calculation2FinalSalary
(
a
,
annualBonus
,
annousTax
);
if
(
finalSalaryWithSalary
.
compareTo
(
finalSalaryNoSalary
)
>
SalaryConstants
.
EQUAL
)
{
if
(
finalSalaryWithSalary
.
compareTo
(
finalSalaryNoSalary
)
>
SalaryConstants
.
EQUAL
)
{
return
"1"
;
return
"1"
;
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryTaxConfigServiceImpl.java
View file @
01136f48
...
@@ -55,4 +55,16 @@ public class TSalaryTaxConfigServiceImpl extends ServiceImpl<TSalaryTaxConfigMap
...
@@ -55,4 +55,16 @@ public class TSalaryTaxConfigServiceImpl extends ServiceImpl<TSalaryTaxConfigMap
return
baseMapper
.
getTaxConfigByAnnualBonusList
(
tSalaryTaxConfig
);
return
baseMapper
.
getTaxConfigByAnnualBonusList
(
tSalaryTaxConfig
);
}
}
/**
* @param tSalaryTaxConfig
* @Description: 获取年终奖配置
* @Author: hgw
* @Date: 2019/10/8 14:40
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryTaxConfig>
**/
@Override
public
List
<
TSalaryTaxConfig
>
getTaxConfigByActualList
(
TSalaryTaxConfig
tSalaryTaxConfig
)
{
return
baseMapper
.
getTaxConfigByActualList
(
tSalaryTaxConfig
);
}
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/util/SalaryConstants.java
View file @
01136f48
...
@@ -155,6 +155,8 @@ public class SalaryConstants {
...
@@ -155,6 +155,8 @@ public class SalaryConstants {
public
static
final
String
IS_PERSON
=
"个人承担全部税费"
;
public
static
final
String
IS_PERSON
=
"个人承担全部税费"
;
//个人代扣
//个人代扣
public
static
final
String
PDEDUCTION_JAVA
=
"pdeduction"
;
public
static
final
String
PDEDUCTION_JAVA
=
"pdeduction"
;
// 通讯补贴(不计税)
public
static
final
String
PHONE_SUBSIDY_JAVA
=
"phoneSubsidy"
;
// 代扣前缀
// 代扣前缀
public
static
final
String
WITHHOLIDING
=
"withholiding"
;
public
static
final
String
WITHHOLIDING
=
"withholiding"
;
//单位代扣
//单位代扣
...
...
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TSalaryAccountItemMapper.xml
View file @
01136f48
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"settlementMonth"
column=
"SETTLEMENT_MONTH"
/>
<result
property=
"settlementMonth"
column=
"SETTLEMENT_MONTH"
/>
<result
property=
"formType"
column=
"FORM_TYPE"
/>
<result
property=
"formType"
column=
"FORM_TYPE"
/>
<result
property=
"annualBonusType"
column=
"ANNUAL_BONUS_TYPE"
/>
</resultMap>
</resultMap>
<!--tSalaryAccountItem简单分页查询-->
<!--tSalaryAccountItem简单分页查询-->
...
@@ -423,7 +424,8 @@
...
@@ -423,7 +424,8 @@
i.IS_TAX,
i.IS_TAX,
a.EMP_IDCARD,
a.EMP_IDCARD,
a.SETTLEMENT_MONTH,
a.SETTLEMENT_MONTH,
a.FORM_TYPE
a.FORM_TYPE,
a.ANNUAL_BONUS_TYPE
FROM
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
<where>
...
@@ -453,7 +455,8 @@
...
@@ -453,7 +455,8 @@
i.IS_TAX,
i.IS_TAX,
a.EMP_IDCARD,
a.EMP_IDCARD,
a.SETTLEMENT_MONTH,
a.SETTLEMENT_MONTH,
a.FORM_TYPE
a.FORM_TYPE,
a.ANNUAL_BONUS_TYPE
FROM
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
<where>
...
...
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TSalaryTaxConfigMapper.xml
View file @
01136f48
...
@@ -16,10 +16,8 @@
...
@@ -16,10 +16,8 @@
<result
property=
"startPoint"
column=
"START_POINT"
/>
<result
property=
"startPoint"
column=
"START_POINT"
/>
</resultMap>
</resultMap>
<!--tSalaryTaxConfig简单分页查询-->
<sql
id=
"Base_Column_List"
>
<select
id=
"getTSalaryTaxConfigPage"
resultMap=
"tSalaryTaxConfigMap"
>
ID,
SELECT
ID,
TAXABLE_INCOME_REMARK,
TAXABLE_INCOME_REMARK,
WITHHOLDING_RATE,
WITHHOLDING_RATE,
QUICK_DEDUCATION,
QUICK_DEDUCATION,
...
@@ -28,122 +26,82 @@
...
@@ -28,122 +26,82 @@
LEVEL,
LEVEL,
TYPE,
TYPE,
START_POINT
START_POINT
</sql>
<sql
id=
"tSalaryTaxConfig_where"
>
<if
test=
"tSalaryTaxConfig != null"
>
<if
test=
"tSalaryTaxConfig.id != null and tSalaryTaxConfig.id.trim() != ''"
>
AND ID = #{tSalaryTaxConfig.id}
</if>
<if
test=
"tSalaryTaxConfig.taxableIncomeRemark != null and tSalaryTaxConfig.taxableIncomeRemark.trim() != ''"
>
AND TAXABLE_INCOME_REMARK = #{tSalaryTaxConfig.taxableIncomeRemark}
</if>
<if
test=
"tSalaryTaxConfig.withholdingRate != null"
>
AND WITHHOLDING_RATE = #{tSalaryTaxConfig.withholdingRate}
</if>
<if
test=
"tSalaryTaxConfig.quickDeducation != null"
>
AND QUICK_DEDUCATION = #{tSalaryTaxConfig.quickDeducation}
</if>
<if
test=
"tSalaryTaxConfig.minIncome != null"
>
AND MIN_INCOME = #{tSalaryTaxConfig.minIncome}
</if>
<if
test=
"tSalaryTaxConfig.maxIncome != null"
>
AND MAX_INCOME = #{tSalaryTaxConfig.maxIncome}
</if>
<if
test=
"tSalaryTaxConfig.level != null"
>
AND LEVEL = #{tSalaryTaxConfig.level}
</if>
<if
test=
"tSalaryTaxConfig.type != null"
>
AND TYPE = #{tSalaryTaxConfig.type}
</if>
<if
test=
"tSalaryTaxConfig.startPoint != null"
>
AND START_POINT = #{tSalaryTaxConfig.startPoint}
</if>
</if>
</sql>
<!--tSalaryTaxConfig简单分页查询-->
<select
id=
"getTSalaryTaxConfigPage"
resultMap=
"tSalaryTaxConfigMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_salary_tax_config
FROM t_salary_tax_config
<where>
<where>
1=1
1=1
<if
test=
"tSalaryTaxConfig.id != null and tSalaryTaxConfig.id.trim() != ''"
>
<include
refid=
"tSalaryTaxConfig_where"
/>
AND ID = #{tSalaryTaxConfig.id}
</if>
<if
test=
"tSalaryTaxConfig.taxableIncomeRemark != null and tSalaryTaxConfig.taxableIncomeRemark.trim() != ''"
>
AND TAXABLE_INCOME_REMARK = #{tSalaryTaxConfig.taxableIncomeRemark}
</if>
<if
test=
"tSalaryTaxConfig.withholdingRate != null"
>
AND WITHHOLDING_RATE = #{tSalaryTaxConfig.withholdingRate}
</if>
<if
test=
"tSalaryTaxConfig.quickDeducation != null"
>
AND QUICK_DEDUCATION = #{tSalaryTaxConfig.quickDeducation}
</if>
<if
test=
"tSalaryTaxConfig.minIncome != null"
>
AND MIN_INCOME = #{tSalaryTaxConfig.minIncome}
</if>
<if
test=
"tSalaryTaxConfig.maxIncome != null"
>
AND MAX_INCOME = #{tSalaryTaxConfig.maxIncome}
</if>
<if
test=
"tSalaryTaxConfig.level != null"
>
AND LEVEL = #{tSalaryTaxConfig.level}
</if>
<if
test=
"tSalaryTaxConfig.type != null"
>
AND TYPE = #{tSalaryTaxConfig.type}
</if>
<if
test=
"tSalaryTaxConfig.startPoint != null"
>
AND START_POINT = #{tSalaryTaxConfig.startPoint}
</if>
</where>
</where>
</select>
</select>
<!--tSalaryTaxConfig获取个税配置-->
<!--tSalaryTaxConfig获取个税配置-->
<select
id=
"getTaxConfigByPersonList"
resultMap=
"tSalaryTaxConfigMap"
>
<select
id=
"getTaxConfigByPersonList"
resultMap=
"tSalaryTaxConfigMap"
>
SELECT
SELECT
ID,
<include
refid=
"Base_Column_List"
/>
TAXABLE_INCOME_REMARK,
WITHHOLDING_RATE,
QUICK_DEDUCATION,
MIN_INCOME,
MAX_INCOME,
LEVEL,
TYPE,
START_POINT
FROM t_salary_tax_config
FROM t_salary_tax_config
<where>
<where>
TYPE = 0
TYPE = 0
<if
test=
"tSalaryTaxConfig.id != null and tSalaryTaxConfig.id.trim() != ''"
>
<include
refid=
"tSalaryTaxConfig_where"
/>
AND ID = #{tSalaryTaxConfig.id}
</if>
<if
test=
"tSalaryTaxConfig.taxableIncomeRemark != null and tSalaryTaxConfig.taxableIncomeRemark.trim() != ''"
>
AND TAXABLE_INCOME_REMARK = #{tSalaryTaxConfig.taxableIncomeRemark}
</if>
<if
test=
"tSalaryTaxConfig.withholdingRate != null"
>
AND WITHHOLDING_RATE = #{tSalaryTaxConfig.withholdingRate}
</if>
<if
test=
"tSalaryTaxConfig.quickDeducation != null"
>
AND QUICK_DEDUCATION = #{tSalaryTaxConfig.quickDeducation}
</if>
<if
test=
"tSalaryTaxConfig.minIncome != null"
>
AND MIN_INCOME = #{tSalaryTaxConfig.minIncome}
</if>
<if
test=
"tSalaryTaxConfig.maxIncome != null"
>
AND MAX_INCOME = #{tSalaryTaxConfig.maxIncome}
</if>
<if
test=
"tSalaryTaxConfig.level != null"
>
AND LEVEL = #{tSalaryTaxConfig.level}
</if>
<if
test=
"tSalaryTaxConfig.startPoint != null"
>
AND START_POINT = #{tSalaryTaxConfig.startPoint}
</if>
</where>
</where>
</select>
</select>
<!--tSalaryTaxConfig获取年终奖配置-->
<!--tSalaryTaxConfig获取年终奖配置-->
<select
id=
"getTaxConfigByAnnualBonusList"
resultMap=
"tSalaryTaxConfigMap"
>
<select
id=
"getTaxConfigByAnnualBonusList"
resultMap=
"tSalaryTaxConfigMap"
>
SELECT
SELECT
ID,
<include
refid=
"Base_Column_List"
/>
TAXABLE_INCOME_REMARK,
WITHHOLDING_RATE,
QUICK_DEDUCATION,
MIN_INCOME,
MAX_INCOME,
LEVEL,
TYPE,
START_POINT
FROM t_salary_tax_config
FROM t_salary_tax_config
<where>
<where>
TYPE = 1
TYPE = 1
<if
test=
"tSalaryTaxConfig.id != null and tSalaryTaxConfig.id.trim() != ''"
>
<include
refid=
"tSalaryTaxConfig_where"
/>
AND ID = #{tSalaryTaxConfig.id}
</if>
<if
test=
"tSalaryTaxConfig.taxableIncomeRemark != null and tSalaryTaxConfig.taxableIncomeRemark.trim() != ''"
>
AND TAXABLE_INCOME_REMARK = #{tSalaryTaxConfig.taxableIncomeRemark}
</if>
<if
test=
"tSalaryTaxConfig.withholdingRate != null"
>
AND WITHHOLDING_RATE = #{tSalaryTaxConfig.withholdingRate}
</if>
<if
test=
"tSalaryTaxConfig.quickDeducation != null"
>
AND QUICK_DEDUCATION = #{tSalaryTaxConfig.quickDeducation}
</if>
<if
test=
"tSalaryTaxConfig.minIncome != null"
>
AND MIN_INCOME = #{tSalaryTaxConfig.minIncome}
</if>
<if
test=
"tSalaryTaxConfig.maxIncome != null"
>
AND MAX_INCOME = #{tSalaryTaxConfig.maxIncome}
</if>
<if
test=
"tSalaryTaxConfig.level != null"
>
AND LEVEL = #{tSalaryTaxConfig.level}
</if>
<if
test=
"tSalaryTaxConfig.startPoint != null"
>
AND START_POINT = #{tSalaryTaxConfig.startPoint}
</if>
</where>
</where>
</select>
</select>
<!--tSalaryTaxConfig获取实发倒推配置-->
<select
id=
"getTaxConfigByActualList"
resultMap=
"tSalaryTaxConfigMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_salary_tax_config
<where>
TYPE = 2
<include
refid=
"tSalaryTaxConfig_where"
/>
</where>
</select>
</mapper>
</mapper>
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