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
283420fd
Commit
283420fd
authored
Aug 08, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预派单 参数校验修改
parent
72d3d523
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
233 additions
and
211 deletions
+233
-211
TPaymentInfoVo.java
...com/yifu/cloud/plus/v1/yifu/social/vo/TPaymentInfoVo.java
+1
-11
YFSocialImportThreadPoolExecutor.java
...ncurrent/threadpool/YFSocialImportThreadPoolExecutor.java
+0
-0
YFThreadFactory.java
...v1/yifu/social/concurrent/threadpool/YFThreadFactory.java
+0
-0
YFThreadPoolConfig.java
...yifu/social/concurrent/threadpool/YFThreadPoolConfig.java
+0
-0
TPaymentInfoServiceImpl.java
.../v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
+228
-198
ServiceUtil.java
.../com/yifu/cloud/plus/v1/yifu/social/util/ServiceUtil.java
+2
-2
spring.factories
...u-social-biz/src/main/resources/META-INF/spring.factories
+2
-0
No files found.
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/vo/TPaymentInfoVo.java
View file @
283420fd
...
...
@@ -38,16 +38,6 @@ import java.util.Date;
@Data
public
class
TPaymentInfoVo
extends
RowIndex
implements
Serializable
{
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@NotBlank
(
message
=
"主键 不能为空"
)
@Length
(
max
=
32
,
message
=
"主键 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"主键"
,
isNotEmpty
=
true
,
errorInfo
=
"主键 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"主键"
)
@ExcelProperty
(
"主键"
)
private
String
id
;
/**
* 员工姓名
*/
...
...
@@ -69,7 +59,7 @@ public class TPaymentInfoVo extends RowIndex implements Serializable {
*/
@NotBlank
(
message
=
"员工ID 不能为空"
)
@Length
(
max
=
32
,
message
=
"员工ID 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"员工ID"
,
isNotEmpty
=
true
,
errorInfo
=
"员工ID 不能为空"
,
maxLength
=
32
)
@ExcelAttribute
(
name
=
"员工ID"
,
maxLength
=
32
)
@Schema
(
description
=
"员工ID"
)
@ExcelProperty
(
"员工ID"
)
private
String
empId
;
...
...
yifu-social/yifu-social-
api
/src/main/java/com/yifu/cloud/plus/v1/yifu/social/concurrent/threadpool/YFSocialImportThreadPoolExecutor.java
→
yifu-social/yifu-social-
biz
/src/main/java/com/yifu/cloud/plus/v1/yifu/social/concurrent/threadpool/YFSocialImportThreadPoolExecutor.java
View file @
283420fd
File moved
yifu-social/yifu-social-
api
/src/main/java/com/yifu/cloud/plus/v1/yifu/social/concurrent/threadpool/YFThreadFactory.java
→
yifu-social/yifu-social-
biz
/src/main/java/com/yifu/cloud/plus/v1/yifu/social/concurrent/threadpool/YFThreadFactory.java
View file @
283420fd
File moved
yifu-social/yifu-social-
api
/src/main/java/com/yifu/cloud/plus/v1/yifu/social/concurrent/threadpool/YFThreadPoolConfig.java
→
yifu-social/yifu-social-
biz
/src/main/java/com/yifu/cloud/plus/v1/yifu/social/concurrent/threadpool/YFThreadPoolConfig.java
View file @
283420fd
File moved
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
View file @
283420fd
...
...
@@ -34,7 +34,6 @@ import com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool.YFSocialImportTh
import
com.yifu.cloud.plus.v1.yifu.social.constants.PaymentConstants
;
import
com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfoImportLog
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoMapper
;
...
...
@@ -91,7 +90,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Autowired
private
RedisUtil
redisUtil
;
@
Qualifier
(
"yfSocialImportThreadPoolExecutor"
)
@
Autowired
private
YFSocialImportThreadPoolExecutor
yfSocialImportThreadPoolExecutor
;
@Autowired
...
...
@@ -374,7 +373,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
int
residualCapacity
=
yfSocialImportThreadPoolExecutor
.
getResidualCapacity
();
if
(
taskSize
>
residualCapacity
)
{
errorMessageList
.
add
(
new
ErrorMessage
(-
1
,
MsgUtils
.
getMessage
(
ErrorCodes
.
SOCIALINFO_LIST_NUM_LARGE
)));
}
}
else
{
// -----------------------------生成paymentInfoMap本段开始--------------------------------
//已存在的档案数据
...
...
@@ -482,14 +480,16 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List
<
TPaymentInfoVo
>
tempList
=
new
ArrayList
<>();
AtomicInteger
atomicLine
=
new
AtomicInteger
(
CommonConstants
.
ZERO_INT
);
List
<
CompletableFuture
<
List
<
ErrorMessage
>>>
completableFutureList
=
new
ArrayList
<>();
try
{
// 1.list.size()不足partSize,直接执行
if
(
list
.
size
()
<
partSize
)
{
CompletableFuture
.
supplyAsync
(()
->
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialList
(
user
,
atomicLine
,
random
,
list
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoBigMap
,
paymentInfoBirMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
CommonConstants
.
ONE_INT
,
errorMessageList
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
// 2.list.size()大于partSize,循环分批执行
...
...
@@ -497,11 +497,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if
(
partSize
<=
list
.
size
())
{
// 处理第一个0位元素
final
List
<
TPaymentInfoVo
>
finalList
=
list
.
subList
(
0
,
1
);
CompletableFuture
.
supplyAsync
(()
->
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialList
(
user
,
atomicLine
,
random
,
list
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoBigMap
,
paymentInfoBirMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
CommonConstants
.
ONE_INT
,
errorMessageList
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
lastIdx
=
1
;
for
(
int
i
=
1
;
i
<
list
.
size
();
i
++)
{
// partSize数量的list为一个执行单元
...
...
@@ -536,12 +538,24 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List
<
TPaymentInfoVo
>
finalTempList
=
tempList
;
int
finalLastIdx
=
lastIdx
+
1
;
CompletableFuture
.
supplyAsync
(()
->
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialList
(
user
,
atomicLine
,
random
,
list
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoBigMap
,
paymentInfoBirMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
finalLastIdx
,
errorMessageList
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
// 阻塞当前线程,等待所有的线程执行完毕
boolean
computeFlag
;
do
{
computeFlag
=
false
;
for
(
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
:
completableFutureList
)
{
if
(!
listCompletableFuture
.
isDone
())
{
computeFlag
=
true
;
}
}
}
while
(
computeFlag
);
String
importSuccessKey
=
user
.
getId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
PAYMENT_SOCIAL_WAIT_EXPORT
;
redisUtil
.
set
(
importSuccessKey
,
random
,
1800L
);
...
...
@@ -564,6 +578,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
}
}
/**
* 转换缴纳地址为省市县ID
...
...
@@ -723,7 +738,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
if
(
null
==
socialInfo
||
(
null
!=
socialInfo
&&
!
ServiceUtil
.
checkMothForPaymentImport
(
socialInfo
.
getSocialStartDate
(),
infoVo
.
getSocialPayMonth
(),
socialInfo
.
getSocialReduceDate
())))
{
if
(
null
!=
socialMapTemp
)
{
if
(
socialMapTemp
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
socialInfo
=
socialMapTemp
.
get
(
infoVo
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
infoVo
.
getSocialProvince
()
+
CommonConstants
.
DOWN_LINE_STRING
+
infoVo
.
getSocialCity
()
...
...
@@ -752,8 +767,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
if
(
null
==
socialInfo
)
{
errorMessageList
.
add
(
new
ErrorMessage
(
infoVo
.
getRowIndex
(),
infoVo
.
getEmpIdcard
()
+
"无对应员工"
+
infoVo
.
getEmpIdcard
()
+
"的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)"
));
errorMessageList
.
add
(
new
ErrorMessage
(
infoVo
.
getRowIndex
(),
"无对应员工"
+
infoVo
.
getEmpIdcard
()
+
"的社保数据(请查验社保办理状态|缴纳地|起缴月份|停缴月份)"
));
continue
;
}
//如果导入项目数大于办理成功项目数给提示,少于给进,有问题自行删除后导入
...
...
@@ -1007,7 +1022,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo
.
setSocialSum
(
BigDecimalUtils
.
safeAdd
(
paymentInfo
.
getUnitSocialSum
(),
paymentInfo
.
getSocialSecurityPersonalSum
()));
paymentInfo
.
setSumAll
(
paymentInfo
.
getSocialSum
());
paymentInfo
.
setUpdateBy
(
user
.
getId
());
if
(
null
!=
paymentInfo
&&
Common
.
isEmpty
(
paymentInfo
.
getSocialId
()))
{
paymentInfo
.
setSocialId
(
UUID
.
randomUUID
().
toString
());
}
...
...
@@ -1648,13 +1662,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List
<
TPaymentHeFeiVo
>
tempList
=
new
ArrayList
<>();
AtomicInteger
atomicLine
=
new
AtomicInteger
(
CommonConstants
.
ZERO_INT
);
List
<
CompletableFuture
<
List
<
ErrorMessage
>>>
completableFutureList
=
new
ArrayList
<>();
try
{
// 1.list.size()不足partSize,直接执行
if
(
list
.
size
()
<
partSize
)
{
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
list
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
list
,
areaMap
,
areaMap2
,
paymentInfo
PensionMap
,
paymentInfo
MedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
CommonConstants
.
ONE_INT
,
type
,
errorMessageList
),
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
// 2.list.size()大于partSize,循环分批执行
...
...
@@ -1662,11 +1678,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if
(
partSize
<=
list
.
size
())
{
// 处理第一个0位元素
final
List
<
TPaymentHeFeiVo
>
finalList
=
list
.
subList
(
0
,
1
);
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
finalList
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
CompletableFuture
<
List
<
ErrorMessage
>>
oneCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
finalList
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
CommonConstants
.
ONE_INT
,
type
,
errorMessageList
)
,
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
oneCompletableFuture
);
lastIdx
=
1
;
for
(
int
i
=
1
;
i
<
list
.
size
();
i
++)
{
// partSize数量的list为一个执行单元
...
...
@@ -1675,11 +1692,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
lastIdx
=
i
;
final
int
idx
=
i
-
partSize
+
2
;
List
<
TPaymentHeFeiVo
>
finalTempList1
=
tempList
;
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
finalTempList1
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmp
Map
,
paymentInfoInjuryMap
,
idx
,
type
,
errorMessageList
)
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
finalTempList1
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedical
Map
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
idx
,
type
,
errorMessageList
)
,
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
tempList
=
new
ArrayList
<>();
}
}
...
...
@@ -1701,12 +1719,24 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List
<
TPaymentHeFeiVo
>
finalTempList
=
tempList
;
int
finalLastIdx
=
lastIdx
+
1
;
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
finalTempList
,
areaMap
,
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
=
CompletableFuture
.
supplyAsync
(()
->
executeImportSocialListThree
(
user
,
atomicLine
,
random
,
finalTempList
,
areaMap
,
areaMap2
,
paymentInfoPensionMap
,
paymentInfoMedicalMap
,
paymentInfoUnEmpMap
,
paymentInfoInjuryMap
,
finalLastIdx
,
type
,
errorMessageList
)
,
yfSocialImportThreadPoolExecutor
);
completableFutureList
.
add
(
listCompletableFuture
);
}
// 阻塞当前线程,等待所有的线程执行完毕
boolean
computeFlag
;
do
{
computeFlag
=
false
;
for
(
CompletableFuture
<
List
<
ErrorMessage
>>
listCompletableFuture
:
completableFutureList
)
{
if
(!
listCompletableFuture
.
isDone
())
{
computeFlag
=
true
;
}
}
}
while
(
computeFlag
);
String
importSuccessKey
=
user
.
getId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
PAYMENT_SOCIAL_WAIT_EXPORT
;
redisUtil
.
set
(
importSuccessKey
,
random
,
1800L
);
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/ServiceUtil.java
View file @
283420fd
...
...
@@ -87,12 +87,12 @@ public class ServiceUtil {
public
static
boolean
checkMothForPaymentImport
(
Date
socialStartDate
,
String
socialPayMonth
,
Date
reduceDate
)
{
if
(
socialStartDate
!=
null
)
{
if
(
null
==
reduceDate
){
if
(
Integer
.
parseInt
(
socialPayMonth
)
>=
Integer
.
parseInt
(
DateUtil
.
dateToString
(
socialStartDate
))){
if
(
Integer
.
parseInt
(
socialPayMonth
)
>=
Integer
.
parseInt
(
DateUtil
.
dateToString
(
socialStartDate
)
.
replace
(
"-"
,
""
)
)){
return
true
;
}
}
else
{
if
(
Integer
.
parseInt
(
socialPayMonth
)
>=
Integer
.
parseInt
(
DateUtil
.
dateToString
(
socialStartDate
))
&&
Integer
.
parseInt
(
socialPayMonth
)
<
Integer
.
parseInt
(
DateUtil
.
dateToString
(
reduceDate
))){
&&
Integer
.
parseInt
(
socialPayMonth
)
<
Integer
.
parseInt
(
DateUtil
.
dateToString
(
reduceDate
)
.
replace
(
"-"
,
""
)
)){
return
true
;
}
}
...
...
yifu-social/yifu-social-biz/src/main/resources/META-INF/spring.factories
0 → 100644
View file @
283420fd
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool.YFThreadPoolConfig
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