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
7380f8b2
Commit
7380f8b2
authored
Dec 18, 2024
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
社保批量办理事务控制范围减少-fxj
parent
b619bd72
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
428 additions
and
414 deletions
+428
-414
TDispatchInfoService.java
...oud/plus/v1/yifu/social/service/TDispatchInfoService.java
+6
-1
TDispatchInfoServiceImpl.java
...v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
+422
-413
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/TDispatchInfoService.java
View file @
7380f8b2
...
...
@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.*
;
import
org.apache.shardingsphere.transaction.annotation.ShardingTransactionType
;
import
org.apache.shardingsphere.transaction.core.TransactionType
;
...
...
@@ -34,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* 派单信息记录表
...
...
@@ -84,6 +86,9 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
// isAutoFlag:是否社保士兵的自动办理,true :是
R
<
List
<
ErrorMessage
>>
addApplyHandle
(
List
<
String
>
ids
,
String
typeSub
,
String
handleStatus
,
String
handleRemark
,
String
socialType
,
String
remark
,
YifuUser
user
,
boolean
isAutoHandle
);
//代码优化-解决死锁问题:fxj 2024-12-18 事务控制集中到每次循环,而不是所有for循环
boolean
extracted
(
ConcurrentHashMap
<
String
,
String
>
socialMap
,
ConcurrentHashMap
<
String
,
String
>
fundMap
,
String
typeSub
,
YifuUser
user
,
int
flag
,
String
handleStatus
,
String
handleRemark
,
String
socialType
,
String
remark
,
boolean
isAutoHandle
,
List
<
ErrorMessage
>
errorList
,
Map
<
String
,
TSocialFundInfo
>
socialFundMap
,
TDispatchInfo
dis
);
/**
* @Description: 社保士兵导出
* @Author: hgw
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
View file @
7380f8b2
...
...
@@ -3944,7 +3944,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
* @Author fxj
* @Date 2022-07-26
**/
@Transactional
(
rollbackFor
=
Exception
.
class
)
//
@Transactional(rollbackFor = Exception.class)
public
List
<
ErrorMessage
>
addBatchApplyHandle
(
ConcurrentHashMap
<
String
,
String
>
socialMap
,
ConcurrentHashMap
<
String
,
String
>
fundMap
,
List
<
String
>
idsList
,
String
typeSub
,
YifuUser
user
,
int
flag
,
String
handleStatus
,
String
handleRemark
,
String
socialType
,
String
remark
,
boolean
isAutoHandle
)
{
...
...
@@ -3958,6 +3958,26 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 获取所有派单查询信息
Map
<
String
,
TSocialFundInfo
>
socialFundMap
=
initSocialFundMap
(
disList
);
try
{
for
(
TDispatchInfo
dis
:
disList
)
{
if
(
extracted
(
socialMap
,
fundMap
,
typeSub
,
user
,
flag
,
handleStatus
,
handleRemark
,
socialType
,
remark
,
isAutoHandle
,
errorList
,
socialFundMap
,
dis
))
continue
;
}
}
catch
(
Exception
e
){
log
.
error
(
DispatchConstants
.
DISPATCH_EXCEPTION
,
e
);
errorList
.
add
(
new
ErrorMessage
(-
1
,
DispatchConstants
.
DISPATCH_EXCEPTION
+
e
.
getMessage
()));
return
errorList
;
}
}
else
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
DispatchConstants
.
NO_OPERATOR_DATA
));
return
errorList
;
}
return
errorList
;
}
//代码优化-解决死锁问题:fxj 2024-12-18 事务控制集中到每次循环,而不是所有for循环 TODO参数过多需要二次优化
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
extracted
(
ConcurrentHashMap
<
String
,
String
>
socialMap
,
ConcurrentHashMap
<
String
,
String
>
fundMap
,
String
typeSub
,
YifuUser
user
,
int
flag
,
String
handleStatus
,
String
handleRemark
,
String
socialType
,
String
remark
,
boolean
isAutoHandle
,
List
<
ErrorMessage
>
errorList
,
Map
<
String
,
TSocialFundInfo
>
socialFundMap
,
TDispatchInfo
dis
)
{
TSocialInfo
socialInfo
=
null
;
TProvidentFund
providentFund
=
null
;
TAuditInfo
auditInfo
=
null
;
...
...
@@ -3971,7 +3991,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
boolean
auditFlag
=
true
;
boolean
partSuccess
=
false
;
TDispatchSocialFundInfo
socialFundInfo
;
for
(
TDispatchInfo
dis
:
disList
)
{
auditFlag
=
true
;
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
typeSub
))
{
forecastFlag
=
CommonConstants
.
ONE_INT
;
...
...
@@ -3984,7 +4003,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
if
(
Common
.
isEmpty
(
sf
)){
errorList
.
add
(
new
ErrorMessage
(-
1
,
"找不到员工社保公积金查询数据:"
+
dis
.
getEmpName
()));
contin
ue
;
return
tr
ue
;
}
partSuccess
=
Common
.
isNotNull
(
sf
)
&&
Common
.
isNotNull
(
dis
.
getSocialId
())
&&
(
CommonConstants
.
ONE_STRING
.
equals
(
sf
.
getPensionHandle
())
...
...
@@ -4018,20 +4037,20 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
);
if
(!
CommonConstants
.
TWO_STRING
.
equals
(
dis
.
getStatus
()))
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
"已办理完结,请勿重复操作:"
+
dis
.
getEmpName
()));
contin
ue
;
return
tr
ue
;
}
if
(
Common
.
isNotNull
(
dis
.
getSocialId
()))
{
// 无更新直接跳过
if
(
Common
.
isEmpty
(
socialTypeRemark
)
&&
CommonConstants
.
ZERO_STRING
.
equals
(
typeSub
)
&&
Common
.
isEmpty
(
socialType
))
{
contin
ue
;
return
tr
ue
;
}
socialInfo
=
socialMapper
.
selectById
(
dis
.
getSocialId
());
socialTypeRemark
=
getHandleRemark
(
socialType
,
socialInfo
,
dis
.
getType
(),
sf
);
socialTypeRemark
=
getHandleRemark
(
socialType
,
socialInfo
,
dis
.
getType
(),
sf
);
// 无更新直接跳过
if
(
Common
.
isEmpty
(
socialTypeRemark
.
toString
())
&&
CommonConstants
.
ZERO_STRING
.
equals
(
typeSub
))
{
contin
ue
;
return
tr
ue
;
}
}
else
{
socialInfo
=
null
;
...
...
@@ -4076,7 +4095,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
else
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
"找不到对应员工社保派增派单数据:"
+
dis
.
getEmpName
()));
contin
ue
;
return
tr
ue
;
}
//公积金办理
}
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
typeSub
))
{
...
...
@@ -4137,7 +4156,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
auditInfo
.
setProvidentId
(
dis
.
getId
());
}
else
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
"找不到对应员工公积金派增派单数据:"
+
dis
.
getEmpName
()));
contin
ue
;
return
tr
ue
;
}
}
//派减处理
...
...
@@ -4176,7 +4195,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
auditInfo
.
setSocialId
(
dis
.
getId
());
}
else
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
"找不到对应员工社保数据:"
+
dis
.
getEmpName
()));
contin
ue
;
return
tr
ue
;
}
//公积金派减办理
}
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
typeSub
))
{
...
...
@@ -4215,7 +4234,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
auditInfo
.
setProvidentId
(
dis
.
getId
());
}
else
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
"找不到对应员工公积金数据:"
+
dis
.
getEmpName
()));
contin
ue
;
return
tr
ue
;
}
}
...
...
@@ -4306,7 +4325,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&&
(
CommonConstants
.
FIVE_STRING
.
equals
(
sf
.
getSocialStatus
())
||
CommonConstants
.
FOUR_STRING
.
equals
(
sf
.
getFundStatus
())))
{
// 派增办理,全部失败 同步预估库数据
socialTask
.
asynchronousDisPatchHandle
(
socialMap
,
fundMap
,
sf
,
forecastFlag
,
null
,
null
,
CommonConstants
.
ZERO_INT
);
socialTask
.
asynchronousDisPatchHandle
(
socialMap
,
fundMap
,
sf
,
forecastFlag
,
null
,
null
,
CommonConstants
.
ZERO_INT
);
}
// 社保办理只要办理成功就刷新预估数据 公积金办理不用处理(前面公积金办理成功的时候处理过了)
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
typeSub
)
...
...
@@ -4314,9 +4333,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&&
CommonConstants
.
FOUR_STRING
.
equals
(
sf
.
getSocialStatus
())
||
CommonConstants
.
THREE_STRING
.
equals
(
sf
.
getSocialStatus
())))
{
if
(
partSuccess
)
{
forecastLibraryService
.
updateForecastLibaryByDispatch
(
socialMap
,
fundMap
,
sf
);
forecastLibraryService
.
updateForecastLibaryByDispatch
(
socialMap
,
fundMap
,
sf
);
}
else
{
socialTask
.
asynchronousDisPatchHandle
(
socialMap
,
fundMap
,
sf
,
0
,
null
,
null
,
CommonConstants
.
ONE_INT
);
socialTask
.
asynchronousDisPatchHandle
(
socialMap
,
fundMap
,
sf
,
0
,
null
,
null
,
CommonConstants
.
ONE_INT
);
}
}
}
...
...
@@ -4326,7 +4345,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&&
(
CommonConstants
.
EIGHT_STRING
.
equals
(
sf
.
getSocialStatus
())
||
CommonConstants
.
SEVEN_STRING
.
equals
(
sf
.
getFundStatus
()))){
// 同步预估库数据
socialTask
.
asynchronousDisPatchHandle
(
socialMap
,
fundMap
,
sf
,
forecastFlag
,
null
,
null
,
CommonConstants
.
ZERO_INT
);
socialTask
.
asynchronousDisPatchHandle
(
socialMap
,
fundMap
,
sf
,
forecastFlag
,
null
,
null
,
CommonConstants
.
ZERO_INT
);
}
//社保公积金派减办理成功
if
((
CommonConstants
.
ONE_STRING
.
equals
(
dis
.
getType
())
&&
CommonConstants
.
ZERO_INT
==
flag
...
...
@@ -4355,7 +4374,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
R
<
Boolean
>
resUp
=
archivesDaprUtil
.
updateProjectSocialFund
(
vo
);
if
(
Common
.
isEmpty
(
resUp
)
||
!(
CommonConstants
.
SUCCESS
.
intValue
()
==
resUp
.
getCode
())
||
!
resUp
.
getData
().
booleanValue
())
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
vo
.
getEmpIdCard
()
+
DispatchConstants
.
DISPATCH_SYN_DOC_EXE
,
CommonConstants
.
RED
,
dis
.
getEmpName
()));
contin
ue
;
return
tr
ue
;
}
// 派减公积金办理失败不同步档案的相关字段信息
}
else
if
(!(
CommonConstants
.
ONE_STRING
.
equals
(
dis
.
getType
())
...
...
@@ -4369,25 +4388,15 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
vo
.
setDepartNo
(
dis
.
getSettleDomainCode
());
R
<
Boolean
>
resUp
=
archivesDaprUtil
.
updateProjectSocialFund
(
vo
);
if
(
Common
.
isEmpty
(
resUp
)
||
!(
CommonConstants
.
SUCCESS
.
intValue
()
==
resUp
.
getCode
())
||
!
resUp
.
getData
().
booleanValue
()){
errorList
.
add
(
new
ErrorMessage
(-
1
,
vo
.
getEmpIdCard
()+
DispatchConstants
.
DISPATCH_SYN_DOC_EXE
,
CommonConstants
.
RED
,
dis
.
getEmpName
()));
contin
ue
;
errorList
.
add
(
new
ErrorMessage
(-
1
,
vo
.
getEmpIdCard
()+
DispatchConstants
.
DISPATCH_SYN_DOC_EXE
,
CommonConstants
.
RED
,
dis
.
getEmpName
()));
return
tr
ue
;
}
}
}
}
else
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
"派单数据错误!"
));
}
}
}
catch
(
Exception
e
){
log
.
error
(
DispatchConstants
.
DISPATCH_EXCEPTION
,
e
);
errorList
.
add
(
new
ErrorMessage
(-
1
,
DispatchConstants
.
DISPATCH_EXCEPTION
+
e
.
getMessage
()));
return
errorList
;
}
}
else
{
errorList
.
add
(
new
ErrorMessage
(-
1
,
DispatchConstants
.
NO_OPERATOR_DATA
));
return
errorList
;
}
return
errorList
;
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