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
460ebd75
Commit
460ebd75
authored
Oct 09, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
社保自动化配置-fxj
parent
b1236e7c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
255 additions
and
35 deletions
+255
-35
TAutoSocialRuleInfo.java
...oud/plus/v1/yifu/archives/entity/TAutoSocialRuleInfo.java
+13
-13
TAutoSocialRuleRel.java
...loud/plus/v1/yifu/archives/entity/TAutoSocialRuleRel.java
+19
-20
TAutoMainRelAddVo.java
...ifu/cloud/plus/v1/yifu/archives/vo/TAutoMainRelAddVo.java
+6
-0
TAutoMainRelDetailVo.java
.../cloud/plus/v1/yifu/archives/vo/TAutoMainRelDetailVo.java
+6
-0
TAutoMainRelServiceImpl.java
...1/yifu/archives/service/impl/TAutoMainRelServiceImpl.java
+211
-2
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TAutoSocialRuleInfo.java
View file @
460ebd75
...
...
@@ -61,34 +61,34 @@ public class TAutoSocialRuleInfo extends BaseEntity {
/**
* 是否自动触发派增(字典:0自动触发派增,1:手动派增)
*/
@ExcelAttribute
(
name
=
"是否自动触发派增
(字典:0自动触发派增,1:手动派增)"
,
isNotEmpty
=
true
,
errorInfo
=
"是否自动触发派增(字典:0自动触发派增,1:手动派增)
不能为空"
,
maxLength
=
1
)
@NotBlank
(
message
=
"是否自动触发派增
(字典:0自动触发派增,1:手动派增)
不能为空"
)
@Length
(
max
=
1
,
message
=
"是否自动触发派增
(字典:0自动触发派增,1:手动派增)
不能超过1个字符"
)
@ExcelProperty
(
"是否自动触发派增
(字典:0自动触发派增,1:手动派增)
"
)
@ExcelAttribute
(
name
=
"是否自动触发派增
"
,
isNotEmpty
=
true
,
errorInfo
=
"是否自动触发派增
不能为空"
,
maxLength
=
1
)
@NotBlank
(
message
=
"是否自动触发派增不能为空"
)
@Length
(
max
=
1
,
message
=
"是否自动触发派增不能超过1个字符"
)
@ExcelProperty
(
"是否自动触发派增"
)
@Schema
(
description
=
"是否自动触发派增(字典:0自动触发派增,1:手动派增)"
)
private
String
autoFlag
;
/**
* 派单发起时间(字典::0:入职满1个月...入职满6个月)
*/
@ExcelAttribute
(
name
=
"派单发起时间
(字典::0:入职满1个月...入职满6个月)"
,
maxLength
=
2
)
@Length
(
max
=
2
,
message
=
"派单发起时间
(字典::0:入职满1个月...入职满6个月)
不能超过2个字符"
)
@ExcelProperty
(
"派单发起时间
(字典::0:入职满1个月...入职满6个月)
"
)
@ExcelAttribute
(
name
=
"派单发起时间
"
,
maxLength
=
2
,
isNotEmpty
=
true
,
errorInfo
=
"派单发起时间不能为空"
)
@Length
(
max
=
2
,
message
=
"派单发起时间不能超过2个字符"
)
@ExcelProperty
(
"派单发起时间"
)
@Schema
(
description
=
"派单发起时间(字典::0:入职满1个月...入职满6个月)"
)
private
String
startPeriod
;
/**
* 派单发起具体时间字典:0:15:20
*/
@ExcelAttribute
(
name
=
"派单发起具体时间
字典:0:15:20
"
,
maxLength
=
10
)
@Length
(
max
=
10
,
message
=
"派单发起具体时间
字典:0:15:20
不能超过10个字符"
)
@ExcelProperty
(
"派单发起具体时间字典
:0:15:20
"
)
@ExcelAttribute
(
name
=
"派单发起具体时间"
,
maxLength
=
10
)
@Length
(
max
=
10
,
message
=
"派单发起具体时间不能超过10个字符"
)
@ExcelProperty
(
"派单发起具体时间字典"
)
@Schema
(
description
=
"派单发起具体时间字典:0:15:20"
)
private
String
startTime
;
/**
* 派单确认时间,字典:0:派单发起当日
*/
@ExcelAttribute
(
name
=
"派单确认时间
,字典:0:派单发起当日"
,
maxLength
=
50
)
@Length
(
max
=
50
,
message
=
"派单确认时间
,字典:0:派单发起当日
不能超过50个字符"
)
@ExcelProperty
(
"派单确认时间
,字典:0:派单发起当日
"
)
@ExcelAttribute
(
name
=
"派单确认时间
"
,
maxLength
=
50
,
isNotEmpty
=
true
,
errorInfo
=
"派单发起时间不能为空"
)
@Length
(
max
=
50
,
message
=
"派单确认时间不能超过50个字符"
)
@ExcelProperty
(
"派单确认时间"
)
@Schema
(
description
=
"派单确认时间,字典:0:派单发起当日"
)
private
String
confirmPeriod
;
/**
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TAutoSocialRuleRel.java
View file @
460ebd75
...
...
@@ -52,8 +52,7 @@ public class TAutoSocialRuleRel extends BaseEntity {
/**
* 社保配置ID
*/
@ExcelAttribute
(
name
=
"社保配置ID"
,
isNotEmpty
=
true
,
errorInfo
=
"社保配置ID不能为空"
,
maxLength
=
32
)
@NotBlank
(
message
=
"社保配置ID不能为空"
)
@ExcelAttribute
(
name
=
"社保配置ID"
,
isNotEmpty
=
false
,
errorInfo
=
"社保配置ID不能为空"
,
maxLength
=
32
)
@Length
(
max
=
32
,
message
=
"社保配置ID不能超过32个字符"
)
@ExcelProperty
(
"社保配置ID"
)
@Schema
(
description
=
"社保配置ID"
)
...
...
@@ -70,7 +69,7 @@ public class TAutoSocialRuleRel extends BaseEntity {
/**
* 社保户ID
*/
@ExcelAttribute
(
name
=
"社保户ID"
,
maxLength
=
50
)
@ExcelAttribute
(
name
=
"社保户ID"
,
maxLength
=
50
,
isNotEmpty
=
true
,
errorInfo
=
"社保户不能为空"
)
@Length
(
max
=
50
,
message
=
"社保户ID不能超过50个字符"
)
@ExcelProperty
(
"社保户ID"
)
@Schema
(
description
=
"社保户ID"
)
...
...
@@ -78,33 +77,33 @@ public class TAutoSocialRuleRel extends BaseEntity {
/**
* 社保起缴日期是否一致(0-是,1-否)
*/
@ExcelAttribute
(
name
=
"社保起缴日期是否一致
(0-是,1-否)"
,
maxLength
=
1
)
@Length
(
max
=
1
,
message
=
"社保起缴日期是否一致
(0-是,1-否)
不能超过1个字符"
)
@ExcelProperty
(
"社保起缴日期是否一致
(0-是,1-否)
"
)
@ExcelAttribute
(
name
=
"社保起缴日期是否一致
"
,
maxLength
=
1
,
isNotEmpty
=
true
,
errorInfo
=
"社保起缴日期是否一致不能为空"
)
@Length
(
max
=
1
,
message
=
"社保起缴日期是否一致不能超过1个字符"
)
@ExcelProperty
(
"社保起缴日期是否一致"
)
@Schema
(
description
=
"社保起缴日期是否一致(0-是,1-否)"
)
private
String
socialDateFlag
;
/**
* 起缴日期:0 入职日期
*/
@ExcelAttribute
(
name
=
"起缴日期
:0 入职日期
"
,
maxLength
=
2
)
@Length
(
max
=
2
,
message
=
"起缴日期
:0 入职日期
不能超过2个字符"
)
@ExcelProperty
(
"起缴日期
:0 入职日期
"
)
@ExcelAttribute
(
name
=
"起缴日期"
,
maxLength
=
2
)
@Length
(
max
=
2
,
message
=
"起缴日期不能超过2个字符"
)
@ExcelProperty
(
"起缴日期"
)
@Schema
(
description
=
"起缴日期:0 入职日期"
)
private
String
socialDateType
;
/**
* 缴纳类型:0最低、1自定义、2最高
*/
@ExcelAttribute
(
name
=
"缴纳类型
:0最低、1自定义、2最高"
,
maxLength
=
2
)
@Length
(
max
=
2
,
message
=
"缴纳类型
:0最低、1自定义、2最高
不能超过2个字符"
)
@ExcelProperty
(
"缴纳类型
:0最低、1自定义、2最高
"
)
@ExcelAttribute
(
name
=
"缴纳类型
"
,
maxLength
=
2
,
isNotEmpty
=
true
,
errorInfo
=
"缴纳类型不能为空"
)
@Length
(
max
=
2
,
message
=
"缴纳类型不能超过2个字符"
)
@ExcelProperty
(
"缴纳类型"
)
@Schema
(
description
=
"缴纳类型:0最低、1自定义、2最高"
)
private
String
paymentType
;
/**
* 备案基数类型:0固定值1自定义
*/
@ExcelAttribute
(
name
=
"备案基数类型
:0固定值1自定义"
,
maxLength
=
2
)
@Length
(
max
=
2
,
message
=
"备案基数类型
:0固定值1自定义
不能超过2个字符"
)
@ExcelProperty
(
"备案基数类型
:0固定值1自定义
"
)
@ExcelAttribute
(
name
=
"备案基数类型
"
,
maxLength
=
2
,
isNotEmpty
=
true
,
errorInfo
=
"备案基数类型不能为空"
)
@Length
(
max
=
2
,
message
=
"备案基数类型不能超过2个字符"
)
@ExcelProperty
(
"备案基数类型"
)
@Schema
(
description
=
"备案基数类型:0固定值1自定义"
)
private
String
recordBaseType
;
/**
...
...
@@ -118,15 +117,15 @@ public class TAutoSocialRuleRel extends BaseEntity {
/**
* 委托备注(字典值)
*/
@ExcelAttribute
(
name
=
"委托备注
(字典值)
"
,
maxLength
=
100
)
@Length
(
max
=
100
,
message
=
"委托备注
(字典值)
不能超过100个字符"
)
@ExcelProperty
(
"委托备注
(字典值)
"
)
@ExcelAttribute
(
name
=
"委托备注"
,
maxLength
=
100
)
@Length
(
max
=
100
,
message
=
"委托备注不能超过100个字符"
)
@ExcelProperty
(
"委托备注"
)
@Schema
(
description
=
"委托备注(字典值)"
)
private
String
remarkDict
;
/**
* 项目编码
*/
@ExcelAttribute
(
name
=
"项目编码"
,
isNotEmpty
=
true
,
errorInfo
=
"项目编码不能为空"
,
maxLength
=
50
)
@ExcelAttribute
(
name
=
"项目编码"
,
maxLength
=
50
)
@NotBlank
(
message
=
"项目编码不能为空"
)
@Length
(
max
=
50
,
message
=
"项目编码不能超过50个字符"
)
@ExcelProperty
(
"项目编码"
)
...
...
@@ -135,7 +134,7 @@ public class TAutoSocialRuleRel extends BaseEntity {
/**
* 项目ID
*/
@ExcelAttribute
(
name
=
"项目ID"
,
isNotEmpty
=
true
,
errorInfo
=
"项目ID不能为空"
,
maxLength
=
50
)
@ExcelAttribute
(
name
=
"项目ID"
,
maxLength
=
50
)
@NotBlank
(
message
=
"项目ID不能为空"
)
@Length
(
max
=
50
,
message
=
"项目ID不能超过50个字符"
)
@ExcelProperty
(
"项目ID"
)
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TAutoMainRelAddVo.java
View file @
460ebd75
...
...
@@ -46,4 +46,10 @@ public class TAutoMainRelAddVo implements Serializable {
//员工合同签订规则配置方案子表表
private
List
<
TAutoContractScheme
>
contractSchemes
;
//社保规则主表
private
TAutoSocialRuleInfo
autoSocialRuleInfo
;
//社保规则明细表
private
List
<
TAutoSocialRuleRel
>
socialRuleRels
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TAutoMainRelDetailVo.java
View file @
460ebd75
...
...
@@ -60,4 +60,10 @@ public class TAutoMainRelDetailVo implements Serializable {
//员工合同签订规则配置方案子表表
private
List
<
TAutoContractScheme
>
contractSchemes
;
//社保规则表
private
TAutoSocialRuleInfo
socialRuleInfo
;
//社保规则明细表
private
List
<
TAutoSocialRuleRel
>
socialRuleRels
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TAutoMainRelServiceImpl.java
View file @
460ebd75
...
...
@@ -95,6 +95,14 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
@Autowired
private
TAutoContractSchemeMapper
contractSchemeMapper
;
// 社保规则主表Mapper
@Autowired
private
TAutoSocialRuleInfoMapper
autoSocialRuleInfoMapper
;
// 社保规则明细表Mapper
@Autowired
private
TAutoSocialRuleRelMapper
autoSocialRuleRelMapper
;
public
static
final
String
itemsLabel
=
"label,description,disable"
;
public
static
final
String
itemsLabelRepeat
=
"同一项目岗位名称不可重复"
;
...
...
@@ -270,6 +278,12 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
detailVo
.
setContractSchemes
(
contractSchemeMapper
.
selectList
(
Wrappers
.<
TAutoContractScheme
>
query
().
lambda
()
.
eq
(
TAutoContractScheme:
:
getDeptId
,
mainRel
.
getDeptId
())));
}
//社保规则配置表
detailVo
.
setSocialRuleInfo
(
autoSocialRuleInfoMapper
.
selectOne
(
Wrappers
.<
TAutoSocialRuleInfo
>
query
().
lambda
()
.
eq
(
TAutoSocialRuleInfo:
:
getMainId
,
id
)));
//社保规则配置明细表
detailVo
.
setSocialRuleRels
(
autoSocialRuleRelMapper
.
selectList
(
Wrappers
.<
TAutoSocialRuleRel
>
query
().
lambda
()
.
eq
(
TAutoSocialRuleRel:
:
getDeptId
,
mainRel
.
getDeptId
())));
return
R
.
ok
(
detailVo
);
}
/**
...
...
@@ -351,6 +365,21 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
if
(
PARAM_IS_NOT_ERROR
!=
null
){
return
PARAM_IS_NOT_ERROR
;
}
//校验社保规则主表信息
TAutoSocialRuleInfo
autoSocialRuleInfo
=
entity
.
getAutoSocialRuleInfo
();
if
(
Common
.
isNotNull
(
autoSocialRuleInfo
)){
ExcelUtil
<
TAutoSocialRuleInfo
>
excelUtil
=
new
ExcelUtil
<>(
TAutoSocialRuleInfo
.
class
);
ErrorMessage
errorMessage
=
excelUtil
.
checkEntity
(
autoSocialRuleInfo
,
0
);
if
(
Common
.
isNotNull
(
errorMessage
)){
return
R
.
failed
(
errorMessage
.
getMessage
());
}
}
//校验社保规则明细表信息
List
<
TAutoSocialRuleRel
>
socialRuleRels
=
entity
.
getSocialRuleRels
();
PARAM_IS_NOT_ERROR
=
checkSocialRuleRels
(
socialRuleRels
);
if
(
PARAM_IS_NOT_ERROR
!=
null
){
return
PARAM_IS_NOT_ERROR
;
}
//新增主表
autoMainRel
.
setRuleUpdatePerson
(
user
.
getNickname
());
autoMainRel
.
setRuleUpdateTime
(
DateUtil
.
getCurrentDateTime
());
...
...
@@ -408,6 +437,28 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
contractSchemeMapper
.
insert
(
scheme
);
}
}
//新增社保规则主表
if
(
Common
.
isNotNull
(
autoSocialRuleInfo
)){
autoSocialRuleInfo
.
setDeptNo
(
autoMainRel
.
getDeptNo
());
autoSocialRuleInfo
.
setDeptId
(
autoMainRel
.
getDeptId
());
autoSocialRuleInfo
.
setMainId
(
autoMainRel
.
getId
());
autoSocialRuleInfo
.
setCreateBy
(
user
.
getId
());
autoSocialRuleInfo
.
setCreateTime
(
LocalDateTime
.
now
());
autoSocialRuleInfo
.
setCreateName
(
user
.
getNickname
());
autoSocialRuleInfoMapper
.
insert
(
autoSocialRuleInfo
);
}
//新增社保规则明细表
if
(
Common
.
isNotNull
(
socialRuleRels
)){
for
(
TAutoSocialRuleRel
rel:
socialRuleRels
){
rel
.
setMainId
(
autoSocialRuleInfo
.
getId
());
rel
.
setDeptNo
(
autoMainRel
.
getDeptNo
());
rel
.
setDeptId
(
autoMainRel
.
getDeptId
());
rel
.
setCreateBy
(
user
.
getId
());
rel
.
setCreateTime
(
LocalDateTime
.
now
());
rel
.
setCreateName
(
user
.
getNickname
());
autoSocialRuleRelMapper
.
insert
(
rel
);
}
}
return
R
.
ok
();
}
catch
(
Exception
e
){
// 捕获异常并返回友好提示
...
...
@@ -652,6 +703,31 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
return
R
.
failed
(
schemeNameRepeat
);
}
//校验社保规则主表信息
TAutoSocialRuleInfo
autoSocialRuleNew
=
entity
.
getAutoSocialRuleInfo
();
TAutoSocialRuleInfo
autoSocialRuleOld
=
null
;
if
(
Common
.
isNotNull
(
autoSocialRuleNew
)){
// 检查社保规则信息的有效性
ExcelUtil
<
TAutoSocialRuleInfo
>
excelUtil
=
new
ExcelUtil
<>(
TAutoSocialRuleInfo
.
class
);
ErrorMessage
errorMessage
=
excelUtil
.
checkEntity
(
autoSocialRuleNew
,
0
);
if
(
Common
.
isNotNull
(
errorMessage
)){
return
R
.
failed
(
errorMessage
.
getMessage
());
}
// 根据ID查询原有的社保规则信息
autoSocialRuleOld
=
autoSocialRuleInfoMapper
.
selectOne
(
Wrappers
.<
TAutoSocialRuleInfo
>
query
().
lambda
()
.
eq
(
TAutoSocialRuleInfo:
:
getMainId
,
autoMainRel
.
getId
()).
last
(
CommonConstants
.
LAST_ONE_SQL
));
}
//社保规则明细是否更新标识 false 未更新 true 更新
boolean
socialFlag
=
false
;
List
<
TAutoSocialRuleRel
>
socialRuleRelsOld
=
null
;
//校验社保规则明细
List
<
TAutoSocialRuleRel
>
socialRuleRels
=
entity
.
getSocialRuleRels
();
PARAM_IS_NOT_ERROR
=
checkSocialRuleRels
(
socialRuleRels
);
if
(
PARAM_IS_NOT_ERROR
!=
null
){
return
PARAM_IS_NOT_ERROR
;
}
//保存商险规则
if
(
Common
.
isNotNull
(
autoInsurRuleNew
)){
if
(
Common
.
isNotNull
(
autoInsurRuleNew
.
getId
())){
...
...
@@ -715,6 +791,50 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
// 判断数据对象是否都在页面传的对象里,有不在的数据,则返回true 目的是判断是否更新了
schemeFlag
=
checkContractSchemeForNotIn
(
schemesOld
,
schemes
);
}
//保存社保规则配置
if
(
Common
.
isNotNull
(
autoSocialRuleNew
)){
if
(
Common
.
isNotNull
(
autoSocialRuleNew
.
getId
())){
autoSocialRuleNew
.
setUpdateBy
(
user
.
getId
());
autoSocialRuleNew
.
setUpdateTime
(
LocalDateTime
.
now
());
autoSocialRuleInfoMapper
.
updateById
(
autoSocialRuleNew
);
}
else
{
autoSocialRuleNew
.
setDeptNo
(
autoMainRel
.
getDeptNo
());
autoSocialRuleNew
.
setDeptId
(
autoMainRel
.
getDeptId
());
autoSocialRuleNew
.
setMainId
(
autoMainRel
.
getId
());
autoSocialRuleNew
.
setCreateBy
(
user
.
getId
());
autoSocialRuleNew
.
setCreateTime
(
LocalDateTime
.
now
());
autoSocialRuleNew
.
setCreateName
(
user
.
getNickname
());
autoSocialRuleInfoMapper
.
insert
(
autoSocialRuleNew
);
}
//获取旧的社保规则明细
if
(
Common
.
isNotNull
(
autoSocialRuleNew
.
getId
())){
//获取旧的社保规则明细
socialRuleRelsOld
=
autoSocialRuleRelMapper
.
selectList
(
Wrappers
.<
TAutoSocialRuleRel
>
query
().
lambda
().
eq
(
TAutoSocialRuleRel:
:
getMainId
,
autoSocialRuleNew
.
getId
()));
//先删除后面再批增
autoSocialRuleRelMapper
.
delete
(
Wrappers
.<
TAutoSocialRuleRel
>
query
().
lambda
().
eq
(
TAutoSocialRuleRel:
:
getMainId
,
autoSocialRuleNew
.
getId
()));
}
//保存社保规则明细
if
(
Common
.
isNotNull
(
socialRuleRels
)){
for
(
TAutoSocialRuleRel
rel:
socialRuleRels
){
//存在新增的直接socialFlag =true 后面不在判断此种场景
if
(!
Common
.
isNotNull
(
rel
.
getId
())){
socialFlag
=
true
;
}
rel
.
setMainId
(
autoSocialRuleNew
.
getId
());
rel
.
setDeptNo
(
autoMainRel
.
getDeptNo
());
rel
.
setDeptId
(
autoMainRel
.
getDeptId
());
rel
.
setCreateBy
(
user
.
getId
());
rel
.
setCreateTime
(
LocalDateTime
.
now
());
rel
.
setCreateName
(
user
.
getNickname
());
autoSocialRuleRelMapper
.
insert
(
rel
);
}
}
// 判断数据对象是否都在页面传的对象里,有不在的数据,则返回true 目的是判断是否更新了
socialFlag
=
checkSocialRuleRelForNotIn
(
socialRuleRelsOld
,
socialRuleRels
);
}
// 更新主表
autoMainRel
.
setRuleUpdatePerson
(
user
.
getNickname
());
...
...
@@ -837,6 +957,45 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
newMap
.
put
(
"newSchemes"
,
schemes
);
}
}
//处理社保规则日志 (更新时不存在规则删除的场景)
if
(
Common
.
isNotNull
(
autoSocialRuleNew
)
&&
Common
.
isNotNull
(
autoSocialRuleOld
)){
differenceKey
=
HrEquator
.
comparisonValueIgnoreField
(
autoSocialRuleOld
,
autoSocialRuleNew
,
ignoreFields
);
if
(!
Common
.
isEmpty
(
differenceKey
)){
diffKeyMap
.
put
(
"socialRule"
,
differenceKey
);
oldMap
.
put
(
"oldSocialRule"
,
autoSocialRuleOld
);
newMap
.
put
(
"newSocialRule"
,
autoSocialRuleNew
);
}
//处理社保规则明细日志
diffKeys
=
new
StringBuilder
();
if
(
Common
.
isNotNull
(
socialRuleRels
)){
Map
<
String
,
TAutoSocialRuleRel
>
map
;
// 不为空且无新增数据,为空前面校验过了,这里不处理
if
(
Common
.
isNotNull
(
socialRuleRels
)
&&
!
socialFlag
){
map
=
socialRuleRels
.
stream
().
collect
(
Collectors
.
toMap
(
TAutoSocialRuleRel:
:
getId
,
v
->
v
));
if
(
Common
.
isNotNull
(
autoSocialRuleOld
)){
TAutoSocialRuleRel
newTemp
;
for
(
TAutoSocialRuleRel
old:
socialRuleRelsOld
){
// 如果存在,则比较,不存在则标记为更新
newTemp
=
map
.
get
(
old
.
getId
());
if
(
Common
.
isEmpty
(
newTemp
)){
socialFlag
=
true
;
newTemp
=
new
TAutoSocialRuleRel
();
}
differenceKey
=
HrEquator
.
comparisonValueIgnoreField
(
old
,
newTemp
,
ignoreFields
);
if
(!
Common
.
isEmpty
(
differenceKey
)){
diffKeys
.
append
(
differenceKey
);
socialFlag
=
true
;
}
}
}
}
}
if
(
socialFlag
){
diffKeyMap
.
put
(
"socialRuleRel"
,
"socialRuleRels"
);
oldMap
.
put
(
"oldSocialRuleRels"
,
socialRuleRelsOld
);
newMap
.
put
(
"newSocialRuleRels"
,
socialRuleRels
);
}
}
// 插入变更日志
insertLog
(
autoMainRel
,
diffKeyMap
,
oldMap
,
newMap
);
// 返回更新成功的响应
...
...
@@ -1129,4 +1288,54 @@ private R<Boolean> checkItemRepeat(List<SysAutoDictItem> autoDictItems, Map<Stri
}
return
map
;
}
/**
* @Author fxj
* @Description 校验社保规则
* @Date 10:24 2025/6/11
**/
private
R
<
Boolean
>
checkSocialRuleRels
(
List
<
TAutoSocialRuleRel
>
socialRuleRels
)
{
if
(
Common
.
isNotNull
(
socialRuleRels
)){
ExcelUtil
<
TAutoSocialRuleRel
>
excelUtil
=
new
ExcelUtil
<>(
TAutoSocialRuleRel
.
class
);
ErrorMessage
errorMessage
;
for
(
TAutoSocialRuleRel
rel:
socialRuleRels
){
errorMessage
=
excelUtil
.
checkEntity
(
rel
,
0
);
if
(
Common
.
isNotNull
(
errorMessage
)){
return
R
.
failed
(
errorMessage
.
getMessage
());
}
}
// 校验socialRuleRels 配置名称是否重复
Set
<
String
>
names
=
socialRuleRels
.
stream
().
map
(
TAutoSocialRuleRel:
:
getConfigName
).
collect
(
Collectors
.
toSet
());
if
(
names
.
size
()
!=
socialRuleRels
.
size
())
{
return
R
.
failed
(
schemeNameRepeat
);
}
}
return
null
;
}
/**
* @Author fxj
* @Description 校验社保规则明细是否不在已存在的集合中
* @Date 10:24 2025/6/11
**/
private
boolean
checkSocialRuleRelForNotIn
(
List
<
TAutoSocialRuleRel
>
socialRuleRels
,
List
<
TAutoSocialRuleRel
>
existingRuleRels
)
{
if
(
Common
.
isEmpty
(
socialRuleRels
)
&&
!
Common
.
isEmpty
(
existingRuleRels
))
{
return
true
;
// 数据库数据无 新增有 返回true
}
if
(!
Common
.
isEmpty
(
socialRuleRels
)
&&
Common
.
isEmpty
(
existingRuleRels
))
{
return
true
;
// 数据库有 新增无返回 true
}
// 不为空判断
if
(!
Common
.
isEmpty
(
socialRuleRels
)
&&
!
Common
.
isEmpty
(
existingRuleRels
))
{
Set
<
String
>
existingKeys
=
existingRuleRels
.
stream
()
.
map
(
standard
->
Optional
.
ofNullable
(
standard
.
getId
()).
orElse
(
""
))
.
collect
(
Collectors
.
toSet
());
for
(
TAutoSocialRuleRel
standard
:
socialRuleRels
)
{
if
(!
existingKeys
.
contains
(
standard
.
getId
()))
{
return
true
;
// 存在不在现有集合中的数据,表示需要处理
}
}
}
return
false
;
// 所有数据都在现有集合中,无需额外处理
}
}
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