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
b77aaa60
You need to sign in or sign up before continuing.
Commit
b77aaa60
authored
Jan 31, 2023
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化修改
parent
3a99dbf6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
50 deletions
+59
-50
TPaymentInfoServiceImpl.java
.../v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
+59
-50
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
View file @
b77aaa60
...
...
@@ -1428,6 +1428,25 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
importSuccessKey
)))
{
redisUtil
.
remove
(
importSuccessKey
);
}
//批量插入的集合
List
<
TPaymentInfo
>
batchInsertList
=
new
ArrayList
<>();
//获取所有项目信息
Map
<
String
,
TSettleDomainSelectVo
>
domainMap
=
this
.
getSelectVoMapById
();
//地区数据
HashMap
<
String
,
String
>
areaMap
=
new
HashMap
<>();
HashMap
<
String
,
String
>
areaMap2
=
new
HashMap
<>();
R
<
AreaVo
>
areaListR
=
upmsDaprUtils
.
getAreaListR
();
if
(
Common
.
isNotNull
(
areaListR
))
{
AreaVo
areaList
=
areaListR
.
getData
();
if
(
null
!=
areaList
&&
!
areaList
.
getSysAreaList
().
isEmpty
())
{
for
(
SysArea
area
:
areaList
.
getSysAreaList
())
{
areaMap
.
put
(
Integer
.
toString
(
area
.
getId
()),
area
.
getAreaName
());
areaMap2
.
put
(
area
.
getAreaName
()
+
CommonConstants
.
DOWN_LINE_STRING
+
(
null
==
area
.
getParentId
()
?
"null"
:
(
0
==
area
.
getParentId
()
?
"null"
:
Integer
.
toString
(
area
.
getParentId
()))),
Integer
.
toString
(
area
.
getId
()));
}
}
}
List
<
ErrorDetailVO
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
TPaymentHeFeiVo
>
util1
=
new
ExcelUtil
<>(
TPaymentHeFeiVo
.
class
);
ConcurrentHashMap
<
String
,
BigDecimal
>
pensionMoneyMap
=
new
ConcurrentHashMap
<>();
...
...
@@ -1482,10 +1501,16 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
private
void
saveData
()
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
importTPaymentSocialHeFei
(
cachedDataList
,
errorMessageList
,
user
,
type
,
rowNumber
,
pensionMoneyMap
,
bigMoneyMap
,
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
,
sumNumKey
,
importSuccessKey
);
bigMoneyMap
,
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
,
sumNumKey
,
importSuccessKey
,
batchInsertList
,
areaMap
,
areaMap2
,
domainMap
);
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
//批量插入数据
if
(!
batchInsertList
.
isEmpty
())
{
this
.
saveBatch
(
batchInsertList
);
batchInsertList
.
clear
();
}
}
catch
(
Exception
e
)
{
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
...
...
@@ -1495,6 +1520,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
unEmpMoneyMap
.
clear
();
injuryMoneyMap
.
clear
();
medicalMoneyMap
.
clear
();
areaMap
.
clear
();
areaMap2
.
clear
();
domainMap
.
clear
();
return
this
.
judgeAllMessage
(
errorMessageList
);
}
...
...
@@ -1793,10 +1821,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo
.
setProvidentSum
(
null
==
infoVo
.
getProvidentSum
()
?
BigDecimal
.
ZERO
:
infoVo
.
getProvidentSum
());
paymentInfo
.
setSumAll
(
paymentInfo
.
getProvidentSum
());
paymentInfo
.
setFundId
(
UUID
.
randomUUID
().
toString
());
if
(
Common
.
isNotNull
(
paymentInfo
.
getSocialCreateMonth
())
&&
Common
.
isNotNull
(
paymentInfo
.
getSocialPayMonth
()))
{
paymentInfo
.
setSortTime
(
paymentInfo
.
getSocialCreateMonth
().
concat
(
paymentInfo
.
getSocialPayMonth
()).
concat
(
String
.
valueOf
(
System
.
currentTimeMillis
())));
}
batchInsertList
.
add
(
paymentInfo
);
//批量插入数据
if
(
batchInsertList
.
size
()
>=
100000
)
{
...
...
@@ -1827,22 +1851,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap
<
String
,
BigDecimal
>
unEmpMoneyMap
,
ConcurrentHashMap
<
String
,
BigDecimal
>
injuryMoneyMap
,
ConcurrentHashMap
<
String
,
BigDecimal
>
medicalMoneyMap
,
String
sumNumKey
,
String
importSuccessKey
)
{
HashMap
<
String
,
String
>
areaMap
=
new
HashMap
<>();
HashMap
<
String
,
String
>
areaMap2
=
new
HashMap
<>();
R
<
AreaVo
>
areaListR
=
upmsDaprUtils
.
getAreaListR
();
if
(
Common
.
isNotNull
(
areaListR
))
{
AreaVo
areaList
=
areaListR
.
getData
();
if
(
null
!=
areaList
&&
!
areaList
.
getSysAreaList
().
isEmpty
())
{
for
(
SysArea
area
:
areaList
.
getSysAreaList
())
{
areaMap
.
put
(
Integer
.
toString
(
area
.
getId
()),
area
.
getAreaName
());
areaMap2
.
put
(
area
.
getAreaName
()
+
CommonConstants
.
DOWN_LINE_STRING
+
(
null
==
area
.
getParentId
()
?
"null"
:
(
0
==
area
.
getParentId
()
?
"null"
:
Integer
.
toString
(
area
.
getParentId
()))),
Integer
.
toString
(
area
.
getId
()));
}
}
}
String
sumNumKey
,
String
importSuccessKey
,
List
<
TPaymentInfo
>
batchInsertList
,
HashMap
<
String
,
String
>
areaMap
,
HashMap
<
String
,
String
>
areaMap2
,
Map
<
String
,
TSettleDomainSelectVo
>
domainMap
)
{
// 将以下代码提取出来,使用paymentInfoMap提升性能,避免list多次循环查询数据库浪费性能
// 导入前做队列空闲判断,防止队列不足出现数据丢失的场景
...
...
@@ -2032,7 +2043,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
->
executeImportSocialListThree
(
user
,
list
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
paymentInfoBigMap
,
type
,
errorMessageList
,
pensionMoneyMap
,
bigMoneyMap
,
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
),
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
,
batchInsertList
,
domainMap
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
...
...
@@ -2047,7 +2058,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
paymentInfoBigMap
,
type
,
errorMessageList
,
pensionMoneyMap
,
bigMoneyMap
,
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
),
yfSocialImportThreadPoolExecutor
);
medicalMoneyMap
,
batchInsertList
,
domainMap
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
oneCompletableFuture
);
lastIdx
=
1
;
for
(
int
i
=
1
;
i
<
list
.
size
();
i
++)
{
...
...
@@ -2061,7 +2072,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
paymentInfoBigMap
,
type
,
errorMessageList
,
pensionMoneyMap
,
bigMoneyMap
,
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
),
yfSocialImportThreadPoolExecutor
);
injuryMoneyMap
,
medicalMoneyMap
,
batchInsertList
,
domainMap
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
tempList
=
new
ArrayList
<>();
}
...
...
@@ -2087,7 +2099,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
->
executeImportSocialListThree
(
user
,
finalTempList
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
paymentInfoBigMap
,
type
,
errorMessageList
,
pensionMoneyMap
,
bigMoneyMap
,
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
)
bigMoneyMap
,
unEmpMoneyMap
,
injuryMoneyMap
,
medicalMoneyMap
,
batchInsertList
,
domainMap
)
,
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
...
...
@@ -2124,16 +2136,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap
<
String
,
BigDecimal
>
bigMoneyMap
,
ConcurrentHashMap
<
String
,
BigDecimal
>
unEmpMoneyMap
,
ConcurrentHashMap
<
String
,
BigDecimal
>
injuryMoneyMap
,
ConcurrentHashMap
<
String
,
BigDecimal
>
medicalMoneyMap
)
{
ConcurrentHashMap
<
String
,
BigDecimal
>
medicalMoneyMap
,
List
<
TPaymentInfo
>
batchInsertList
,
Map
<
String
,
TSettleDomainSelectVo
>
domainMap
)
{
if
(
Common
.
isNotNull
(
list
))
{
TPaymentInfo
payExists
;
TSocialFundInfo
socialInfo
=
null
;
TSocialInfo
tSocialInfo
=
null
;
String
temp
;
List
<
TSocialInfo
>
socialist
;
int
res
;
List
<
TSettleDomainSelectVo
>
settleDomainR
;
R
<
TSettleDomainListVo
>
listVo
;
TSettleDomain
domain
;
List
<
TSocialFundInfo
>
socialInfoList
=
socialFundInfoMapper
.
selectList
(
Wrappers
.<
TSocialFundInfo
>
query
().
lambda
()
.
in
(
TSocialFundInfo:
:
getEmpIdcard
,
Common
.
listObjectToStrList
(
list
,
ExcelAttributeConstants
.
EMPIDCARD
)));
...
...
@@ -2142,8 +2155,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if
(
Common
.
isNotNull
(
socialInfoList
))
{
for
(
TSocialFundInfo
tSocialInfo1
:
socialInfoList
)
{
socialMap
.
put
(
tSocialInfo1
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tSocialInfo1
.
getSocialProvince
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tSocialInfo1
.
getSocialCity
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tSocialInfo1
.
getSocialProvince
()
+
CommonConstants
.
DOWN_LINE_STRING
+
(
null
==
tSocialInfo1
.
getSocialTown
()
?
"null"
:
tSocialInfo1
.
getSocialTown
()),
tSocialInfo1
);
}
...
...
@@ -2425,18 +2438,16 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists
.
setEmpIdcard
(
tSocialInfo
.
getEmpIdcard
());
payExists
.
setEmpName
(
tSocialInfo
.
getEmpName
());
payExists
.
setSettleDomainId
(
tSocialInfo
.
getSettleDomain
());
listVo
=
archivesDaprUtil
.
selectSettleDomainSelectVoById
(
tSocialInfo
.
getSettleDomain
());
if
(
Common
.
isNotNull
(
listVo
))
{
TSettleDomainListVo
tSettleDomainListVo
=
listVo
.
getData
();
if
(
Common
.
isNotNull
(
tSettleDomainListVo
)
&&
Common
.
isNotEmpty
(
tSettleDomainListVo
.
getListSelectVO
()))
{
settleDomainR
=
tSettleDomainListVo
.
getListSelectVO
();
for
(
TSettleDomainSelectVo
vo
:
settleDomainR
)
{
payExists
.
setSettleDomainName
(
vo
.
getDepartName
());
payExists
.
setSettleDomainCode
(
vo
.
getDepartNo
());
payExists
.
setUnitId
(
vo
.
getCustomerId
());
payExists
.
setUnitName
(
vo
.
getCustomerName
());
}
if
(
Common
.
isNotNull
(
domainMap
))
{
domain
=
domainMap
.
get
(
tSocialInfo
.
getSettleDomain
());
}
else
{
domain
=
null
;
}
if
(
Common
.
isNotNull
(
domain
))
{
payExists
.
setSettleDomainName
(
domain
.
getDepartName
());
payExists
.
setSettleDomainCode
(
domain
.
getDepartNo
());
payExists
.
setUnitId
(
domain
.
getCustomerId
());
payExists
.
setUnitName
(
domain
.
getCustomerName
());
}
payExists
.
setSocialProvince
(
tSocialInfo
.
getSocialProvince
());
payExists
.
setSocialCity
(
tSocialInfo
.
getSocialCity
());
...
...
@@ -2513,12 +2524,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists
.
setCreateBy
(
user
.
getId
());
payExists
.
setCreateName
(
user
.
getNickname
());
payExists
.
setSocialId
(
UUID
.
randomUUID
().
toString
());
res
=
insertAndSTimestamp
(
payExists
);
if
(
res
<
0
)
{
errorMessageList
.
add
(
new
ErrorDetailVO
(
infoVo
.
getRowIndex
(),
CommonConstants
.
ZERO_INT
,
infoVo
.
getEmpIdcard
(),
payExists
.
getSocialHousehold
(),
payExists
.
getProvidentHousehold
(),
infoVo
.
getEmpName
(),
CommonConstants
.
SAVE_FAILED
));
}
else
{
errorMessageList
.
add
(
new
ErrorDetailVO
(
infoVo
.
getRowIndex
(),
CommonConstants
.
ONE_INT
,
infoVo
.
getEmpIdcard
(),
payExists
.
getSocialHousehold
(),
payExists
.
getProvidentHousehold
(),
infoVo
.
getEmpName
(),
CommonConstants
.
SAVE_SUCCESS
));
batchInsertList
.
add
(
payExists
);
//批量插入数据
if
(
batchInsertList
.
size
()
>=
50000
)
{
this
.
saveBatch
(
batchInsertList
);
batchInsertList
.
clear
();
}
}
}
...
...
@@ -3109,8 +3119,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if
(
Common
.
isNotNull
(
settleDomain
.
getRiskServerItem
())
&&
((
settleDomain
.
getRiskServerItem
().
contains
(
CommonConstants
.
ONE_STRING
)
&&
CommonConstants
.
ONE_STRING
.
equals
(
socialFundFlag
))
||
(
settleDomain
.
getRiskServerItem
().
contains
(
CommonConstants
.
TWO_STRING
)
&&
CommonConstants
.
TWO_STRING
.
equals
(
socialFundFlag
)))
&&
CommonConstants
.
ZERO_STRING
.
equals
(
settleDomain
.
getRiskFundTag
())
&&
CommonConstants
.
TWO_STRING
.
equals
(
settleDomain
.
getMrSettleType
())
&&
CommonConstants
.
ZERO_STRING
.
equals
(
settleDomain
.
getRiskFundTag
()))
{
&&
CommonConstants
.
TWO_STRING
.
equals
(
settleDomain
.
getMrSettleType
()))
{
//实缴模式
BigDecimal
money
;
if
(
CommonConstants
.
TWO_STRING
.
equals
(
settleDomain
.
getRiskFundType
()))
{
...
...
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