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
af60df30
Commit
af60df30
authored
May 20, 2026
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单个派单+批量派单备案基数限制及各险种基数初始化调整-fxj
parent
15fe9ecc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
259 additions
and
9 deletions
+259
-9
TDispatchInfoServiceImpl.java
...v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
+259
-9
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
View file @
af60df30
...
...
@@ -2855,13 +2855,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
if
(
Common
.
isNotNull
(
excel
.
getSocialHousehold
()))
{
// 各个社保基数和日期空 默认养老日期和基数
// 校验备案基数范围(不含大病)
if
(
validateRecordBaseRange
(
errorMessageList
,
excel
,
socialSet
))
{
return
true
;
}
// 根据缴纳类型赋值各险种基数(不含大病)
assignSocialCardinalByPaymentType
(
excel
,
socialSet
);
// 各个社保基数和日期空 默认养老日期和基数(兜底逻辑,包含大病)
initExcelBaseAndDate
(
excel
);
// 校验各项起缴日期 查看是否符合社保补缴政策
if
(
validSocialStartDate
(
errorMessageList
,
excel
,
socialSet
))
{
return
true
;
}
//
校验各项基数
//
校验社保日期相关信息(含委托备注判断 + 大病校验原有逻辑)
if
(
validSocialBaseInfo
(
errorMessageList
,
excel
,
empVo
,
socialSet
,
contractDateTemp
))
{
return
true
;
}
...
...
@@ -2995,7 +3001,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
private
boolean
validSocialBaseInfo
(
List
<
ErrorMessage
>
errorMessageList
,
TDispatchImportVo
excel
,
DispatchEmpVo
empVo
,
SysBaseSetInfo
socialSet
,
Date
contractDateTemp
)
{
if
(
Common
.
isNotNull
(
socialSet
)
&&
CommonConstants
.
ONE_STRING
.
equals
(
excel
.
getPaymentType
()))
{
// 删除: 自定义类型的各险种范围校验(已迁移到 validateCustomBase 方法)
/*if (Common.isNotNull(socialSet) && CommonConstants.ONE_STRING.equals(excel.getPaymentType())) {
if (Common.isNotNull(excel.getPensionCardinal())
&& (excel.getPensionCardinal().compareTo(socialSet.getUpPersion()) > CommonConstants.ZERO_INT
|| excel.getPensionCardinal().compareTo(socialSet.getLowerPersion()) < CommonConstants.ZERO_INT)) {
...
...
@@ -3026,6 +3033,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.BIR_DISPATCH_SOCIAL_LIMIT_ERROR)));
return true;
}
}*/
// ✅ 保留: 大病基数校验(原有逻辑,保持不变)
if
(
Common
.
isNotNull
(
socialSet
)
&&
CommonConstants
.
ONE_STRING
.
equals
(
excel
.
getPaymentType
()))
{
if
(
Common
.
isNotNull
(
excel
.
getBigailmentCardinal
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
socialSet
.
getCollectType
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
socialSet
.
getValueType
())
&&
(
excel
.
getBigailmentCardinal
().
compareTo
(
socialSet
.
getUpBig
())
>
CommonConstants
.
ZERO_INT
...
...
@@ -3037,7 +3048,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 备案基数和养老基数 养老起缴日期 必填在前面已必填校验,这里不重复校验
if
(
Common
.
isNotNull
(
excel
.
getRecordBase
())
&&
Common
.
isNotNull
(
excel
.
getSocialHousehold
()))
{
// 自定义 只要有一个不相同的 日期或基数 就要提示
if
(
CommonConstants
.
ONE_STRING
.
equals
(
excel
.
getPaymentType
())
&&
Common
.
isEmpty
(
excel
.
getTrustRemark
()))
{
/*
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType()) && Common.isEmpty(excel.getTrustRemark())) {
boolean flag = (Common.isNotNull(excel.getPensionCardinal())
&& excel.getPensionCardinal().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT)
|| (Common.isNotNull(excel.getMedicalCardinal())
...
...
@@ -3056,7 +3067,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_BASE_LIMIT_ERROR)));
return true;
}
}
}
*/
Date
temp
;
if
(
Common
.
isEmpty
(
empVo
))
{
temp
=
excel
.
getContractStart
();
...
...
@@ -3080,14 +3091,15 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
MsgUtils
.
getMessage
(
ErrorCodes
.
EMP_DISPATCH_SOCIAL_DATE_LIMIT_ERROR2
)));
return
true
;
}
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
excel
.
getPaymentType
()))
{
// 删除: 最低/最高类型的赋值逻辑(已迁移到 assignSocialCardinalByPaymentType 方法)
/*if (CommonConstants.ZERO_STRING.equals(excel.getPaymentType())) {
excel.setPensionCardinal(socialSet.getLowerPersion());
}
if (CommonConstants.TWO_STRING.equals(excel.getPaymentType())) {
excel.setPensionCardinal(socialSet.getUpPersion());
}
}
*/
//最低最高时候去校验时候去校验
if
(
Common
.
isEmpty
(
excel
.
getTrustRemark
())
&&
((
CommonConstants
.
ZERO_STRING
.
equals
(
excel
.
getPaymentType
())
/*
if (Common.isEmpty(excel.getTrustRemark()) && ((CommonConstants.ZERO_STRING.equals(excel.getPaymentType())
&& (socialSet.getLowerPersion().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT ||
socialSet.getLowerMedical().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT ||
socialSet.getLowerUnemployment().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT ||
...
...
@@ -3107,7 +3119,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialSet.getUpBig().compareTo(excel.getRecordBase()) != CommonConstants.ZERO_INT))))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_BASE_LIMIT_ERROR)));
return true;
}
}
*/
}
return
false
;
}
...
...
@@ -9367,4 +9379,242 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
}
// ==================== 备案基数校验相关方法(新增) ====================
/**
* 校验备案基数范围(仅校验养老、医疗、失业、工伤、生育,❌ 不包含大病)
* @param errorMessageList 错误信息列表
* @param excel 派单导入数据
* @param socialSet 社保户配置
* @return true-校验失败, false-校验通过
*/
private
boolean
validateRecordBaseRange
(
List
<
ErrorMessage
>
errorMessageList
,
TDispatchImportVo
excel
,
SysBaseSetInfo
socialSet
)
{
// 无备案基数,跳过校验
if
(
Common
.
isEmpty
(
excel
.
getRecordBase
()))
{
return
false
;
}
String
paymentType
=
excel
.
getPaymentType
();
BigDecimal
recordBase
;
try
{
recordBase
=
Common
.
isBlankToBigDecimalZero
(
excel
.
getRecordBase
());
}
catch
(
NumberFormatException
e
)
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
"备案基数格式不正确,请输入有效的数字格式"
));
return
true
;
}
R
<
Boolean
>
validateResult
=
null
;
// 根据缴纳类型进行范围校验
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
paymentType
))
{
// 最低基数场景
validateResult
=
validateMinBase
(
recordBase
,
socialSet
);
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
paymentType
))
{
// 最高基数场景
validateResult
=
validateMaxBase
(
recordBase
,
socialSet
);
}
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
paymentType
))
{
// 自定义场景
validateResult
=
validateCustomBase
(
recordBase
,
socialSet
);
}
// 校验失败,添加错误信息
if
(
validateResult
!=
null
&&
!
R
.
isSuccess
(
validateResult
))
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
validateResult
.
getMsg
()));
return
true
;
}
return
false
;
// 校验通过
}
/**
* 校验最低基数: 备案基数 <= 养老、医疗、失业、工伤、生育最低基数的最小值(❌ 不含大病)
*/
private
R
<
Boolean
>
validateMinBase
(
BigDecimal
recordBase
,
SysBaseSetInfo
socialSet
)
{
BigDecimal
minLowerLimit
;
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
socialSet
.
getIsSameBase
()))
{
// 五险合一: 直接使用统一最低基数
minLowerLimit
=
socialSet
.
getLowerLimit
();
}
else
{
// 分险种: 取养老、医疗、失业、工伤、生育最低基数中的最小值(不含大病)
minLowerLimit
=
getMinLowerLimitWithoutBig
(
socialSet
);
}
if
(
recordBase
.
compareTo
(
minLowerLimit
)
>
0
)
{
return
R
.
failed
(
"备案基数需小于等于最低缴纳基数("
+
minLowerLimit
+
")"
);
}
return
null
;
// 校验通过
}
/**
* 校验最高基数: 备案基数 >= 养老、医疗、失业、工伤、生育最高基数的最大值(❌ 不含大病)
*/
private
R
<
Boolean
>
validateMaxBase
(
BigDecimal
recordBase
,
SysBaseSetInfo
socialSet
)
{
BigDecimal
maxUpperLimit
;
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
socialSet
.
getIsSameBase
()))
{
// 五险合一: 直接使用统一最高基数
maxUpperLimit
=
socialSet
.
getUpperLimit
();
}
else
{
// 分险种: 取养老、医疗、失业、工伤、生育最高基数中的最大值( 不含大病)
maxUpperLimit
=
getMaxUpperLimitWithoutBig
(
socialSet
);
}
if
(
recordBase
.
compareTo
(
maxUpperLimit
)
<
0
)
{
return
R
.
failed
(
"备案基数需大于等于最高缴纳基数("
+
maxUpperLimit
+
")"
);
}
return
null
;
// 校验通过
}
/**
* 校验自定义基数: 备案基数在养老、医疗、失业、工伤、生育的有效范围内(不含大病)
*/
private
R
<
Boolean
>
validateCustomBase
(
BigDecimal
recordBase
,
SysBaseSetInfo
socialSet
)
{
List
<
String
>
invalidRanges
=
new
ArrayList
<>();
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
socialSet
.
getIsSameBase
()))
{
// 五险合一: 直接校验统一基数
if
(
recordBase
.
compareTo
(
socialSet
.
getLowerLimit
())
<
0
||
recordBase
.
compareTo
(
socialSet
.
getUpperLimit
())
>
0
)
{
invalidRanges
.
add
(
"社保基数["
+
socialSet
.
getLowerLimit
()
+
"-"
+
socialSet
.
getUpperLimit
()
+
"]"
);
}
}
else
{
// 分险种: 逐个险种校验(不含大病)
checkInsuranceRange
(
recordBase
,
"养老"
,
socialSet
.
getLowerPersion
(),
socialSet
.
getUpPersion
(),
invalidRanges
);
checkInsuranceRange
(
recordBase
,
"医疗"
,
socialSet
.
getLowerMedical
(),
socialSet
.
getUpMedical
(),
invalidRanges
);
checkInsuranceRange
(
recordBase
,
"失业"
,
socialSet
.
getLowerUnemployment
(),
socialSet
.
getUpUnemployment
(),
invalidRanges
);
checkInsuranceRange
(
recordBase
,
"工伤"
,
socialSet
.
getLowerInjury
(),
socialSet
.
getUpInjury
(),
invalidRanges
);
checkInsuranceRange
(
recordBase
,
"生育"
,
socialSet
.
getLowerBirth
(),
socialSet
.
getUpBirth
(),
invalidRanges
);
// 不校验大病,保持原有逻辑(在第3029-3034行)
}
// 如果有超出范围的险种,返回错误提示
if
(!
invalidRanges
.
isEmpty
())
{
String
message
=
"备案基数需在"
+
String
.
join
(
"、"
,
invalidRanges
)
+
"范围之内(含最低/最高)"
;
return
R
.
failed
(
message
);
}
return
null
;
// 校验通过
}
/**
* 检查单个险种的基数范围
*/
private
void
checkInsuranceRange
(
BigDecimal
recordBase
,
String
insuranceName
,
BigDecimal
lowerLimit
,
BigDecimal
upperLimit
,
List
<
String
>
invalidRanges
)
{
if
(
Common
.
isNotNull
(
lowerLimit
)
&&
Common
.
isNotNull
(
upperLimit
))
{
if
(
recordBase
.
compareTo
(
lowerLimit
)
<
0
||
recordBase
.
compareTo
(
upperLimit
)
>
0
)
{
invalidRanges
.
add
(
insuranceName
+
"基数["
+
lowerLimit
+
"-"
+
upperLimit
+
"]"
);
}
}
}
/**
* 获取养老、医疗、失业、工伤、生育最低基数中的最小值(❌ 不含大病)
*/
private
BigDecimal
getMinLowerLimitWithoutBig
(
SysBaseSetInfo
socialSet
)
{
List
<
BigDecimal
>
lowerLimits
=
new
ArrayList
<>();
if
(
Common
.
isNotNull
(
socialSet
.
getLowerPersion
()))
{
lowerLimits
.
add
(
socialSet
.
getLowerPersion
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getLowerMedical
()))
{
lowerLimits
.
add
(
socialSet
.
getLowerMedical
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getLowerBirth
()))
{
lowerLimits
.
add
(
socialSet
.
getLowerBirth
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getLowerInjury
()))
{
lowerLimits
.
add
(
socialSet
.
getLowerInjury
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getLowerUnemployment
()))
{
lowerLimits
.
add
(
socialSet
.
getLowerUnemployment
());
}
// 不加入大病最低基数,保持原有逻辑
if
(
lowerLimits
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"社保户未配置最低基数"
);
}
return
Collections
.
min
(
lowerLimits
);
}
/**
* 获取养老、医疗、失业、工伤、生育最高基数中的最大值(不含大病)
*/
private
BigDecimal
getMaxUpperLimitWithoutBig
(
SysBaseSetInfo
socialSet
)
{
List
<
BigDecimal
>
upperLimits
=
new
ArrayList
<>();
if
(
Common
.
isNotNull
(
socialSet
.
getUpPersion
()))
{
upperLimits
.
add
(
socialSet
.
getUpPersion
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getUpMedical
()))
{
upperLimits
.
add
(
socialSet
.
getUpMedical
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getUpBirth
()))
{
upperLimits
.
add
(
socialSet
.
getUpBirth
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getUpInjury
()))
{
upperLimits
.
add
(
socialSet
.
getUpInjury
());
}
if
(
Common
.
isNotNull
(
socialSet
.
getUpUnemployment
()))
{
upperLimits
.
add
(
socialSet
.
getUpUnemployment
());
}
// 不加入大病最高基数,保持原有逻辑
if
(
upperLimits
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"社保户未配置最高基数"
);
}
return
Collections
.
max
(
upperLimits
);
}
/**
* 根据缴纳类型赋值各险种基数(仅赋值养老、医疗、失业、工伤、生育,❌ 不包含大病)
*/
private
void
assignSocialCardinalByPaymentType
(
TDispatchImportVo
excel
,
SysBaseSetInfo
socialSet
)
{
String
paymentType
=
excel
.
getPaymentType
();
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
paymentType
))
{
// 最低: 5个险种基数 = 对应险种的最低基数(不含大病)
excel
.
setPensionCardinal
(
socialSet
.
getLowerPersion
());
excel
.
setMedicalCardinal
(
socialSet
.
getLowerMedical
());
excel
.
setUnemploymentCardinal
(
socialSet
.
getLowerUnemployment
());
excel
.
setWorkInjuryCardinal
(
socialSet
.
getLowerInjury
());
excel
.
setBirthCardinal
(
socialSet
.
getLowerBirth
());
// 不赋值大病基数,保持原有逻辑(在第1902-1951行)
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
paymentType
))
{
// 最高: 5个险种基数 = 对应险种的最高基数(不含大病)
excel
.
setPensionCardinal
(
socialSet
.
getUpPersion
());
excel
.
setMedicalCardinal
(
socialSet
.
getUpMedical
());
excel
.
setUnemploymentCardinal
(
socialSet
.
getUpUnemployment
());
excel
.
setWorkInjuryCardinal
(
socialSet
.
getUpInjury
());
excel
.
setBirthCardinal
(
socialSet
.
getUpBirth
());
// 不赋值大病基数,保持原有逻辑(在第1902-1951行)
}
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
paymentType
))
{
// 自定义: 5个险种基数 = 备案基数(不含大病)
BigDecimal
recordBase
=
Common
.
isBlankToBigDecimalZero
(
excel
.
getRecordBase
());
excel
.
setPensionCardinal
(
recordBase
);
excel
.
setMedicalCardinal
(
recordBase
);
excel
.
setUnemploymentCardinal
(
recordBase
);
excel
.
setWorkInjuryCardinal
(
recordBase
);
excel
.
setBirthCardinal
(
recordBase
);
// 不赋值大病基数,保持原有逻辑(在第1902-1951行)
}
}
}
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