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
a513f279
Commit
a513f279
authored
Nov 29, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
派单批量办理优化
parent
c8a2b2ee
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
357 additions
and
152 deletions
+357
-152
AsyncConfig.java
...fu/cloud/plus/v1/yifu/common/core/config/AsyncConfig.java
+3
-3
TIncomeController.java
...oud/plus/v1/yifu/social/controller/TIncomeController.java
+1
-1
TForecastLibraryService.java
.../plus/v1/yifu/social/service/TForecastLibraryService.java
+2
-2
TIncomeService.java
...ifu/cloud/plus/v1/yifu/social/service/TIncomeService.java
+1
-1
TDispatchInfoServiceImpl.java
...v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
+13
-93
TForecastLibraryServiceImpl.java
...yifu/social/service/impl/TForecastLibraryServiceImpl.java
+43
-33
TIncomeServiceImpl.java
.../plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
+23
-19
DoJointSocialTask.java
...ifu/cloud/plus/v1/yifu/social/util/DoJointSocialTask.java
+109
-0
DoSocialTask.java
...com/yifu/cloud/plus/v1/yifu/social/util/DoSocialTask.java
+162
-0
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/config/AsyncConfig.java
View file @
a513f279
...
...
@@ -41,17 +41,17 @@ public class AsyncConfig implements AsyncConfigurer {
* <!-- 允许的空闲时间,当线程空闲时间达到keepAliveTime时,线程会退出,直到线程数量=corePoolSize -->
* <!-- 如果allowCoreThreadTimeout=true,则会直到线程数量=0 -->
*/
taskExecutor
.
setKeepAliveSeconds
(
20
0
);
taskExecutor
.
setKeepAliveSeconds
(
6
0
);
/**
* <!-- 线程池维护线程的最大数量 -->
* <!-- 当线程数>=corePoolSize,且任务队列已满时。线程池会创建新线程来处理任务 -->
* <!-- 当线程数=maxPoolSize,且任务队列已满时,线程池会拒绝处理任务而抛出异常,异常见下
*/
taskExecutor
.
setMaxPoolSize
(
5
0
);
taskExecutor
.
setMaxPoolSize
(
10
0
);
/**
* <!-- 缓存队列(阻塞队列)当核心线程数达到最大时,新任务会放在队列中排队等待执行 -->
*/
taskExecutor
.
setQueueCapacity
(
1
00
);
taskExecutor
.
setQueueCapacity
(
6
00
);
/**
* 建议配置threadNamePrefix属性,出问题时可以更方便的进行排查。
**/
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TIncomeController.java
View file @
a513f279
...
...
@@ -168,7 +168,7 @@ public class TIncomeController {
@Inner
@PostMapping
(
"/inner/saveDetail"
)
public
Boolean
saveDetail
(
@RequestBody
TIncomeDetail
tIncomeDetail
)
{
return
tIncomeService
.
saveDetail
(
tIncomeDetail
);
return
tIncomeService
.
saveDetail
(
tIncomeDetail
,
true
);
}
/**
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/TForecastLibraryService.java
View file @
a513f279
...
...
@@ -128,8 +128,8 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
void
createForecastInfo
();
void
createForecastFundInfo
();
void
pushForecastInfo
(
List
<
TForecastLibrary
>
library
);
void
pushForecastInfo
(
List
<
TForecastLibrary
>
library
,
boolean
synFlag
);
void
pushForecastFundInfo
(
List
<
TForecastLibrary
>
library
);
void
pushForecastFundInfo
(
List
<
TForecastLibrary
>
library
,
boolean
synFlag
);
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/TIncomeService.java
View file @
a513f279
...
...
@@ -58,7 +58,7 @@ public interface TIncomeService extends IService<TIncome> {
* @Date: 2022/8/31 16:31
* @return: boolean
**/
boolean
saveDetail
(
TIncomeDetail
tIncomeDetail
);
boolean
saveDetail
(
TIncomeDetail
tIncomeDetail
,
boolean
synFlag
);
/**
* @Description: 新增收入明细-详情表,同时统计;
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
View file @
a513f279
...
...
@@ -53,6 +53,7 @@ import com.yifu.cloud.plus.v1.yifu.social.service.TDispatchInfoService;
import
com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService
;
import
com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService
;
import
com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService
;
import
com.yifu.cloud.plus.v1.yifu.social.util.DoSocialTask
;
import
com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.*
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -64,6 +65,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -117,6 +119,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
ExcelUtil
<
Object
>
excelUtil
=
new
ExcelUtil
<>(
Object
.
class
);
@Autowired
private
DoSocialTask
socialTask
;
/**
* 派单信息记录表简单分页查询
*
...
...
@@ -679,7 +685,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
// 生成预付数据
if
(
Common
.
isNotNull
(
socialFund
)
&&
Common
.
isNotNull
(
socialFund
.
getId
())){
forecastLibraryService
.
updateForecastLibaryByDispatch
(
socialFund
);
socialTask
.
asynchronousDisPatchHandle
(
socialFund
,
0
,
null
,
null
,
CommonConstants
.
ONE_INT
);
}
// 同步更新人员档案和项目档案的社保公积金状态
updateDocSocialFund
(
social
,
fund
,
socialFund
,
excel
);
...
...
@@ -3124,7 +3130,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&&
CommonConstants
.
ONE_INT
==
flag
){
// 更新预估数据 -- 失败项重新派单审核不通过不处理预估
if
(!
flagTemp
){
forecastLibraryService
.
updateForecastLibaryByDispatchReduce
(
sf
,
forecastFlag
);
socialTask
.
asynchronousDisPatchHandle
(
sf
,
forecastFlag
,
null
,
null
,
CommonConstants
.
ZERO_INT
);
}
// 更新人员档案和项目档案的社保公积金状态
UpProjectSocialFundVo
vo
=
new
UpProjectSocialFundVo
();
...
...
@@ -3384,13 +3390,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if
(
Common
.
isNotNull
(
libraryFundInfoList
))
{
for
(
TForecastLibrary
library
:
libraryFundInfoList
)
{
//办理成功生成收入
createIncomeInfo
(
library
);
socialTask
.
asynchronousDisPatchHandle
(
null
,
0
,
null
,
library
,
CommonConstants
.
THREE_INT
);
if
(
CommonConstants
.
ZERO_INT
==
library
.
getDataPush
())
{
libraryFundInfoList1
.
add
(
library
);
}
}
if
(
Common
.
isNotNull
(
libraryFundInfoList1
))
{
forecastLibraryService
.
pushForecastFundInfo
(
libraryFundInfoList1
);
socialTask
.
asynchronousDisPatchHandle
(
null
,
0
,
libraryFundInfoList1
,
null
,
CommonConstants
.
TWO_INT
);
}
}
}
...
...
@@ -3569,21 +3575,21 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&&
(
CommonConstants
.
FIVE_STRING
.
equals
(
sf
.
getSocialStatus
())
||
CommonConstants
.
FOUR_STRING
.
equals
(
sf
.
getFundStatus
()))){
// 派增办理,全部失败 同步预估库数据
forecastLibraryService
.
updateForecastLibaryByDispatchReduce
(
sf
,
forecastFlag
);
socialTask
.
asynchronousDisPatchHandle
(
sf
,
forecastFlag
,
null
,
null
,
CommonConstants
.
ZERO_INT
);
}
// 社保办理只要办理成功就刷新预估数据 公积金办理不用处理
if
(
Common
.
isNotNull
(
dis
.
getSocialId
())
&&
CommonConstants
.
FOUR_STRING
.
equals
(
sf
.
getSocialStatus
())
||
CommonConstants
.
TWO_STRING
.
equals
(
sf
.
getSocialStatus
())
||
CommonConstants
.
THREE_STRING
.
equals
(
sf
.
getSocialStatus
())){
forecastLibraryService
.
updateForecastLibaryByDispatch
(
sf
);
socialTask
.
asynchronousDisPatchHandle
(
sf
,
0
,
null
,
null
,
CommonConstants
.
ONE_INT
);
}
}
// 2.派减办理成功 处理预估 (不管社保还是公积金办理失败)
if
(
CommonConstants
.
ONE_STRING
.
equals
(
dis
.
getType
())
&&
CommonConstants
.
ZERO_INT
==
flag
){
// 同步预估库数据
forecastLibraryService
.
updateForecastLibaryByDispatchReduce
(
sf
,
forecastFlag
);
socialTask
.
asynchronousDisPatchHandle
(
sf
,
forecastFlag
,
null
,
null
,
CommonConstants
.
ZERO_INT
);
}
// 派减办理失败不同步档案的相关字段信息
if
(!(
CommonConstants
.
ONE_STRING
.
equals
(
dis
.
getType
())
&&
CommonConstants
.
ONE_INT
==
flag
)){
...
...
@@ -4249,90 +4255,4 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
return
minStartDate
;
}
public
void
createIncomeInfo
(
TForecastLibrary
library
)
{
//获取项目信息
TSettleDomain
settleDomain
=
new
TSettleDomain
();
List
<
TSettleDomainSelectVo
>
settleDomainR
=
null
;
R
<
TSettleDomainListVo
>
listVo
=
null
;
listVo
=
archivesDaprUtil
.
selectSettleDomainSelectVoById
(
library
.
getSettleDomainId
());
if
(
Common
.
isNotNull
(
listVo
))
{
TSettleDomainListVo
tSettleDomainListVo
=
listVo
.
getData
();
if
(
Common
.
isNotNull
(
tSettleDomainListVo
)
&&
Common
.
isNotEmpty
(
tSettleDomainListVo
.
getListSelectVO
()))
{
settleDomainR
=
tSettleDomainListVo
.
getListSelectVO
();
for
(
TSettleDomainSelectVo
vo
:
settleDomainR
)
{
BeanUtils
.
copyProperties
(
vo
,
settleDomain
);
}
}
}
//判断是否存在当月的公积金收入数据
boolean
isExist
=
false
;
TIncomeDetail
incomeDetail
=
new
TIncomeDetail
();
incomeDetail
.
setEmpIdcard
(
library
.
getEmpIdcard
());
incomeDetail
.
setPayMonth
(
library
.
getProvidentPayMonth
());
incomeDetail
.
setDeptNo
(
library
.
getDeptNo
());
incomeDetail
.
setSourceType
(
CommonConstants
.
TWO_STRING
);
List
<
TIncomeDetail
>
detailList
=
detailService
.
getTIncomeDetailList
(
incomeDetail
);
if
(
Common
.
isNotNull
(
detailList
))
{
BigDecimal
sumMoney
=
BigDecimal
.
ZERO
;
for
(
TIncomeDetail
income
:
detailList
)
{
sumMoney
=
BigDecimalUtils
.
safeAdd
(
income
.
getMoney
(),
sumMoney
);
}
if
(
sumMoney
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
isExist
=
true
;
}
}
if
(
Common
.
isNotNull
(
settleDomain
))
{
// 含有社保,则计算收入
if
(
Common
.
isNotNull
(
settleDomain
.
getManageServerItem
())
&&
settleDomain
.
getManageServerItem
()
.
contains
(
CommonConstants
.
TWO_STRING
)
&&
!
isExist
&&
CommonConstants
.
ZERO_STRING
.
equals
(
settleDomain
.
getManagementTag
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
settleDomain
.
getMrSettleType
()))
{
//预估模式
//预估模式只有按人次和人数收费
createIncomeInsurance
(
library
,
settleDomain
,
CommonConstants
.
ONE_STRING
,
settleDomain
.
getManagementFee
().
toString
(),
settleDomain
.
getManagementType
(),
settleDomain
.
getManagementFee
());
}
if
(
Common
.
isNotNull
(
settleDomain
.
getRiskServerItem
())
&&
settleDomain
.
getRiskServerItem
()
.
contains
(
CommonConstants
.
TWO_STRING
)
&&
!
isExist
&&
CommonConstants
.
ZERO_STRING
.
equals
(
settleDomain
.
getRiskFundTag
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
settleDomain
.
getMrSettleType
()))
{
//预估模式
createIncomeInsurance
(
library
,
settleDomain
,
CommonConstants
.
TWO_STRING
,
settleDomain
.
getRiskFundFee
().
toString
(),
settleDomain
.
getRiskFundType
(),
settleDomain
.
getRiskFundFee
());
}
}
}
public
void
createIncomeInsurance
(
TForecastLibrary
library
,
TSettleDomain
settleDomain
,
String
feeType
,
String
charges
,
String
feeMode
,
BigDecimal
money
)
{
//生成收入数据
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setCreateTime
(
DateUtil
.
getCurrentDateTime
());
detail
.
setDeptName
(
settleDomain
.
getDepartName
());
detail
.
setDeptNo
(
settleDomain
.
getDepartNo
());
detail
.
setDeptId
(
settleDomain
.
getId
());
detail
.
setEmpIdcard
(
library
.
getEmpIdcard
());
detail
.
setEmpName
(
library
.
getEmpName
());
detail
.
setUnitNo
(
settleDomain
.
getCustomerNo
());
detail
.
setUnitId
(
settleDomain
.
getCustomerId
());
detail
.
setUnitName
(
settleDomain
.
getCustomerName
());
detail
.
setDataCreateMonth
(
DateUtil
.
addMonth
(
0
));
detail
.
setSourceId
(
library
.
getId
());
detail
.
setSourceType
(
CommonConstants
.
TWO_STRING
);
detail
.
setCreateMonth
(
library
.
getProvidentCreateMonth
());
detail
.
setPayMonth
(
library
.
getProvidentPayMonth
());
detail
.
setMoney
(
money
);
detail
.
setFeeType
(
feeType
);
detail
.
setFeeMode
(
feeMode
);
detail
.
setCharges
(
charges
);
detail
.
setMrSettleType
(
settleDomain
.
getMrSettleType
());
detail
.
setRedData
(
CommonConstants
.
ZERO_STRING
);
detail
.
setId
(
CommonConstants
.
NULL
);
incomeService
.
saveDetail
(
detail
);
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TForecastLibraryServiceImpl.java
View file @
a513f279
...
...
@@ -352,7 +352,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
&&
CommonConstants
.
FOUR_STRING
.
equals
(
socialFundInfo
.
getSocialStatus
())
||
CommonConstants
.
THREE_STRING
.
equals
(
socialFundInfo
.
getSocialStatus
())))
{
//办理成功生成收入
createIncomeInfo
(
library
);
createIncomeInfo
(
library
,
true
);
if
(
CommonConstants
.
ZERO_INT
==
library
.
getDataPush
())
{
libraryFundInfoListSocial
.
add
(
library
);
}
...
...
@@ -365,7 +365,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if
(
Common
.
isNotNull
(
socialFundInfoF
)
&&
(
Common
.
isNotNull
(
socialFundInfoF
.
getFundId
())
&&
CommonConstants
.
THREE_STRING
.
equals
(
socialFundInfoF
.
getFundStatus
())))
{
//办理成功生成收入
createIncomeInfo
(
library
);
createIncomeInfo
(
library
,
true
);
if
(
CommonConstants
.
ZERO_INT
==
library
.
getDataPush
())
{
libraryFundInfoListFund
.
add
(
library
);
}
...
...
@@ -373,11 +373,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//推送社保明细
if
(
Common
.
isNotNull
(
libraryFundInfoListSocial
))
{
pushForecastInfo
(
libraryFundInfoListSocial
);
pushForecastInfo
(
libraryFundInfoListSocial
,
true
);
}
//推送公积金明细
if
(
Common
.
isNotNull
(
libraryFundInfoListFund
))
{
pushForecastFundInfo
(
libraryFundInfoListFund
);
pushForecastFundInfo
(
libraryFundInfoListFund
,
true
);
}
if
(
isSaveAndUpdate
)
{
return
R
.
ok
(
null
,
"执行成功!"
);
...
...
@@ -1482,7 +1482,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
sysBaseSetInfoMapper
.
updateById
(
sysBaseSetInfo
);
}
for
(
TSocialFundInfo
socialFundInfo
:
socialFundInfoMap
.
values
())
{
this
.
updateForecastLibaryCore
(
socialFundInfo
,
socialFundInfo
.
getDoMonth
(),
true
,
false
);
this
.
updateForecastLibaryCore
(
socialFundInfo
,
socialFundInfo
.
getDoMonth
(),
true
,
false
,
true
);
socialFundInfoMapper
.
updateById
(
socialFundInfo
);
}
}
...
...
@@ -1497,7 +1497,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
**/
@Override
public
R
<
String
>
updateToneForecastLibary
(
TSocialFundInfo
socialFundInfo
,
String
doMonth
)
{
return
this
.
updateForecastLibaryCore
(
socialFundInfo
,
doMonth
,
false
,
false
);
return
this
.
updateForecastLibaryCore
(
socialFundInfo
,
doMonth
,
false
,
false
,
true
);
}
/**
...
...
@@ -1509,7 +1509,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
**/
@Override
public
R
<
String
>
updateForecastLibaryByDispatch
(
TSocialFundInfo
socialFundInfo
)
{
return
this
.
updateForecastLibaryCore
(
socialFundInfo
,
null
,
false
,
true
);
return
this
.
updateForecastLibaryCore
(
socialFundInfo
,
null
,
false
,
true
,
false
);
}
/**
...
...
@@ -1577,11 +1577,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//推送社保明细
if
(
Common
.
isNotNull
(
libraryFundInfoListSocial
))
{
pushForecastInfo
(
libraryFundInfoListSocial
);
pushForecastInfo
(
libraryFundInfoListSocial
,
false
);
}
//推送公积金明细
if
(
Common
.
isNotNull
(
libraryFundInfoListFund
))
{
pushForecastFundInfo
(
libraryFundInfoListFund
);
pushForecastFundInfo
(
libraryFundInfoListFund
,
false
);
}
}
return
R
.
ok
();
...
...
@@ -1632,7 +1632,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
detail
.
setId
(
CommonConstants
.
NULL
);
detail
.
setRedData
(
CommonConstants
.
ONE_STRING
);
detail
.
setMoney
(
detail
.
getMoney
().
negate
());
incomeService
.
saveDetail
(
detail
);
incomeService
.
saveDetail
(
detail
,
false
);
}
}
}
...
...
@@ -1672,7 +1672,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
detail
.
setId
(
CommonConstants
.
NULL
);
detail
.
setRedData
(
CommonConstants
.
ONE_STRING
);
detail
.
setMoney
(
detail
.
getMoney
().
negate
());
incomeService
.
saveDetail
(
detail
);
incomeService
.
saveDetail
(
detail
,
false
);
}
}
}
...
...
@@ -1686,7 +1686,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @Date: 2022/7/26 19:01
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private
R
<
String
>
updateForecastLibaryCore
(
TSocialFundInfo
socialFundInfo
,
String
doMonth
,
boolean
isOnly
,
boolean
isDispatch
)
{
private
R
<
String
>
updateForecastLibaryCore
(
TSocialFundInfo
socialFundInfo
,
String
doMonth
,
boolean
isOnly
,
boolean
isDispatch
,
boolean
synFlag
)
{
String
empIdCard
=
socialFundInfo
.
getEmpIdcard
();
//定义未推送的按条件查询得到的预估数据
List
<
TForecastLibrary
>
librarySocialList
=
null
;
...
...
@@ -1899,13 +1899,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if
(
Common
.
isNotNull
(
librarySocialInfoList
))
{
for
(
TForecastLibrary
library
:
librarySocialInfoList
)
{
//办理成功生成收入
createIncomeInfo
(
library
);
createIncomeInfo
(
library
,
synFlag
);
if
(
CommonConstants
.
ZERO_INT
==
library
.
getDataPush
())
{
librarySocialInfoList1
.
add
(
library
);
}
}
if
(
Common
.
isNotNull
(
librarySocialInfoList1
))
{
this
.
pushForecastInfo
(
librarySocialInfoList1
);
this
.
pushForecastInfo
(
librarySocialInfoList1
,
synFlag
);
}
}
}
...
...
@@ -2244,7 +2244,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if
(
Common
.
isNotNull
(
librarySocialInfoList
))
{
for
(
TForecastLibrary
library
:
librarySocialInfoList
)
{
//办理成功生成收入
createIncomeInfo
(
library
);
createIncomeInfo
(
library
,
true
);
if
(
CommonConstants
.
ZERO_INT
==
library
.
getDataPush
())
{
libraryFundInfoListSocial
.
add
(
library
);
}
...
...
@@ -2266,7 +2266,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if
(
Common
.
isNotNull
(
libraryFundInfoList
))
{
for
(
TForecastLibrary
library
:
libraryFundInfoList
)
{
//办理成功生成收入
createIncomeInfo
(
library
);
createIncomeInfo
(
library
,
true
);
if
(
CommonConstants
.
ZERO_INT
==
library
.
getDataPush
())
{
libraryFundInfoListFund
.
add
(
library
);
}
...
...
@@ -2275,11 +2275,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//推送社保明细
if
(
Common
.
isNotNull
(
libraryFundInfoListSocial
))
{
pushForecastInfo
(
libraryFundInfoListSocial
);
pushForecastInfo
(
libraryFundInfoListSocial
,
true
);
}
//推送公积金明细
if
(
Common
.
isNotNull
(
libraryFundInfoListFund
))
{
pushForecastFundInfo
(
libraryFundInfoListFund
);
pushForecastFundInfo
(
libraryFundInfoListFund
,
true
);
}
if
(
isSaveAndUpdate
)
{
return
R
.
ok
(
null
,
"执行成功!"
);
...
...
@@ -2343,7 +2343,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.
eq
(
TForecastLibrary:
:
getDataType
,
CommonConstants
.
ZERO_INT
));
if
(
Common
.
isNotNull
(
unPushInfo
))
{
//推送数据封装并推送
initEkpPushSocialParam
(
unPushInfo
);
initEkpPushSocialParam
(
unPushInfo
,
true
);
}
}
...
...
@@ -2355,27 +2355,27 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.
eq
(
TForecastLibrary:
:
getDataType
,
CommonConstants
.
ONE_INT
));
if
(
Common
.
isNotNull
(
unPushInfo
))
{
//推送数据封装并推送
initEkpPushFundParam
(
unPushInfo
);
initEkpPushFundParam
(
unPushInfo
,
true
);
}
}
@Override
public
void
pushForecastInfo
(
List
<
TForecastLibrary
>
library
)
{
public
void
pushForecastInfo
(
List
<
TForecastLibrary
>
library
,
boolean
synFlag
)
{
if
(
Common
.
isNotNull
(
library
))
{
//推送数据封装并推送
initEkpPushSocialParam
(
library
);
initEkpPushSocialParam
(
library
,
synFlag
);
}
}
@Override
public
void
pushForecastFundInfo
(
List
<
TForecastLibrary
>
library
)
{
public
void
pushForecastFundInfo
(
List
<
TForecastLibrary
>
library
,
boolean
synFlag
)
{
if
(
Common
.
isNotNull
(
library
))
{
//推送数据封装并推送
initEkpPushFundParam
(
library
);
initEkpPushFundParam
(
library
,
synFlag
);
}
}
public
void
initEkpPushSocialParam
(
List
<
TForecastLibrary
>
unPushInfo
)
{
public
void
initEkpPushSocialParam
(
List
<
TForecastLibrary
>
unPushInfo
,
boolean
synFlag
)
{
R
<
TSettleDomainListVo
>
listVo
;
List
<
TSettleDomainSelectVo
>
settleDomainR
;
for
(
TForecastLibrary
library
:
unPushInfo
)
{
...
...
@@ -2607,11 +2607,16 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
socialParam
.
setFd_3b0afbe1f94a08
(
library
.
getId
());
// 薪酬申请编号
socialParam
.
setFd_3b3cab77923f44
(
CommonConstants
.
EMPTY_STRING
);
doJointSocialTask
.
asynchronousEkpForecastSocial
(
socialParam
,
library
);
// synFlag=true 异步推送 synFlag=false 非异步推送 兼容批量办理处理 fxj
if
(
synFlag
){
doJointSocialTask
.
asynchronousEkpForecastSocial
(
socialParam
,
library
);
}
else
{
doJointSocialTask
.
asynchronousEkpForecastSocialAsso
(
socialParam
,
library
);
}
}
}
public
void
initEkpPushFundParam
(
List
<
TForecastLibrary
>
unPushInfo
)
{
public
void
initEkpPushFundParam
(
List
<
TForecastLibrary
>
unPushInfo
,
boolean
synFlag
)
{
R
<
TSettleDomainListVo
>
listVo
;
List
<
TSettleDomainSelectVo
>
settleDomainR
;
for
(
TForecastLibrary
library
:
unPushInfo
)
{
...
...
@@ -2741,11 +2746,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
fundParam
.
setFd_3b0afbaf10df2c
(
library
.
getId
());
// 薪酬申请编号
fundParam
.
setFd_3b3cabde83d1d0
(
CommonConstants
.
EMPTY_STRING
);
doJointSocialTask
.
asynchronousEkpForecastFund
(
fundParam
,
library
);
if
(
synFlag
){
doJointSocialTask
.
asynchronousEkpForecastFund
(
fundParam
,
library
);
}
else
{
doJointSocialTask
.
asynchronousEkpForecastFundAsso
(
fundParam
,
library
);
}
}
}
public
void
createIncomeInfo
(
TForecastLibrary
library
)
{
public
void
createIncomeInfo
(
TForecastLibrary
library
,
boolean
synFlag
)
{
//获取项目信息
TSettleDomain
settleDomain
=
new
TSettleDomain
();
List
<
TSettleDomainSelectVo
>
settleDomainR
;
...
...
@@ -2800,7 +2809,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
CommonConstants
.
ONE_STRING
.
equals
(
settleDomain
.
getMrSettleType
())
&&
!
isExist
)
{
createIncomeInsurance
(
library
,
settleDomain
,
CommonConstants
.
ONE_STRING
,
settleDomain
.
getManagementFee
().
toString
(),
settleDomain
.
getManagementType
(),
settleDomain
.
getManagementFee
(),
sourceType
);
settleDomain
.
getManagementFee
(),
sourceType
,
synFlag
);
}
}
if
(
Common
.
isNotNull
(
settleDomain
.
getRiskServerItem
())
&&
((
settleDomain
.
getRiskServerItem
().
contains
(
CommonConstants
.
ONE_STRING
)
...
...
@@ -2811,14 +2820,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
CommonConstants
.
ONE_STRING
.
equals
(
settleDomain
.
getMrSettleType
())
&&
!
isExist
)
{
createIncomeInsurance
(
library
,
settleDomain
,
CommonConstants
.
TWO_STRING
,
settleDomain
.
getRiskFundFee
().
toString
(),
settleDomain
.
getRiskFundType
(),
settleDomain
.
getRiskFundFee
(),
sourceType
);
settleDomain
.
getRiskFundFee
(),
sourceType
,
synFlag
);
}
}
}
}
public
void
createIncomeInsurance
(
TForecastLibrary
library
,
TSettleDomain
settleDomain
,
String
feeType
,
String
charges
,
String
feeMode
,
BigDecimal
money
,
String
sourceType
)
{
String
charges
,
String
feeMode
,
BigDecimal
money
,
String
sourceType
,
boolean
synFlag
)
{
//生成收入数据
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setCreateTime
(
DateUtil
.
getCurrentDateTime
());
...
...
@@ -2847,7 +2857,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
detail
.
setMrSettleType
(
settleDomain
.
getMrSettleType
());
detail
.
setRedData
(
CommonConstants
.
ZERO_STRING
);
detail
.
setId
(
CommonConstants
.
NULL
);
incomeService
.
saveDetail
(
detail
);
incomeService
.
saveDetail
(
detail
,
synFlag
);
}
public
String
dateStringInsert
(
String
month
)
{
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
View file @
a513f279
...
...
@@ -49,6 +49,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import
com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeVo
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.ServletOutputStream
;
...
...
@@ -251,8 +252,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @Date: 2022/8/31 16:34
* @return: boolean
**/
@Override
public
boolean
saveDetail
(
TIncomeDetail
tIncomeDetail
)
{
public
boolean
saveDetail
(
TIncomeDetail
tIncomeDetail
,
boolean
synFlag
)
{
if
(
Common
.
isEmpty
(
tIncomeDetail
.
getEmpIdcard
())
||
Common
.
isEmpty
(
tIncomeDetail
.
getDeptId
())
||
Common
.
isEmpty
(
tIncomeDetail
.
getPayMonth
()))
{
...
...
@@ -274,10 +274,10 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
tIncomeDetailService
.
save
(
tIncomeDetail
);
// 不存在,直接新增
if
(
incomeList
==
null
||
incomeList
.
isEmpty
())
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
else
{
// 核心判断
return
this
.
copyCore
(
tIncomeDetail
,
incomeList
,
detailList
,
null
);
return
this
.
copyCore
(
tIncomeDetail
,
incomeList
,
detailList
,
null
,
synFlag
);
}
}
...
...
@@ -313,7 +313,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentInfo
);
}
else
{
// 核心判断
return
this
.
copyCore
(
tIncomeDetail
,
incomeList
,
detailList
,
paymentInfo
);
return
this
.
copyCore
(
tIncomeDetail
,
incomeList
,
detailList
,
paymentInfo
,
true
);
}
}
...
...
@@ -401,14 +401,18 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
// 复制并保存
private
boolean
saveIncome
(
TIncomeDetail
tIncomeDetail
)
{
private
boolean
saveIncome
(
TIncomeDetail
tIncomeDetail
,
boolean
synFlag
)
{
TIncome
income
=
new
TIncome
();
BeanUtil
.
copyProperties
(
tIncomeDetail
,
income
);
income
.
setSendStatus
(
CommonConstants
.
ZERO_STRING
);
income
.
setApplyNo
(
tIncomeDetail
.
getApplyNo
());
this
.
save
(
income
);
long
start
=
System
.
currentTimeMillis
();
doJointSocialTask
.
asynchronousEkpIncome
(
income
);
if
(
synFlag
){
doJointSocialTask
.
asynchronousEkpIncome
(
income
);
}
else
{
doJointSocialTask
.
asynchronousEkpIncomeAsso
(
income
);
}
log
.
error
(
"线程执行耗时:"
+
(
System
.
currentTimeMillis
()-
start
));
return
true
;
}
...
...
@@ -571,13 +575,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @return: boolean
**/
private
boolean
copyCore
(
TIncomeDetail
tIncomeDetail
,
List
<
TIncome
>
incomeList
,
List
<
TIncomeDetail
>
detailList
,
TPaymentInfo
paymentInfo
)
{
TPaymentInfo
paymentInfo
,
boolean
synFlag
)
{
// 判断,比例,直接加
if
(
CommonConstants
.
ONE_STRING
.
equals
(
tIncomeDetail
.
getFeeMode
()))
{
if
(
Common
.
isNotNull
(
paymentInfo
))
{
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentInfo
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
else
{
Map
<
String
,
Integer
>
numMap
=
new
HashMap
<>();
...
...
@@ -633,7 +637,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if
(
Common
.
isNotNull
(
paymentInfo
))
{
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentInfo
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
else
{
...
...
@@ -642,7 +646,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if
(
Common
.
isNotNull
(
paymentInfo
))
{
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentInfo
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
...
...
@@ -655,7 +659,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if
(
Common
.
isNotNull
(
paymentInfo
))
{
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentInfo
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
else
{
...
...
@@ -663,13 +667,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if
(
Common
.
isNotNull
(
paymentInfo
))
{
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentInfo
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
}
else
{
// 各个模式累加逻辑:
return
this
.
judgeMixModel
(
tIncomeDetail
,
numMap
,
incomeMap
);
return
this
.
judgeMixModel
(
tIncomeDetail
,
numMap
,
incomeMap
,
synFlag
);
}
}
else
{
// 薪资。收费方式:2金额-人数
...
...
@@ -679,13 +683,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if
(
Common
.
isNotNull
(
paymentInfo
))
{
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentInfo
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
else
{
// 3金额-人次
// 各个模式累加逻辑:
return
this
.
judgeMixModel
(
tIncomeDetail
,
numMap
,
incomeMap
);
return
this
.
judgeMixModel
(
tIncomeDetail
,
numMap
,
incomeMap
,
synFlag
);
}
}
}
...
...
@@ -742,7 +746,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @Date: 2022/9/1 18:17
* @return: boolean
**/
private
boolean
judgeMixModel
(
TIncomeDetail
tIncomeDetail
,
Map
<
String
,
Integer
>
numMap
,
Map
<
String
,
Integer
>
incomeMap
)
{
private
boolean
judgeMixModel
(
TIncomeDetail
tIncomeDetail
,
Map
<
String
,
Integer
>
numMap
,
Map
<
String
,
Integer
>
incomeMap
,
boolean
synFlag
)
{
String
month
=
tIncomeDetail
.
getPayMonth
();
if
(
CommonConstants
.
THREE_STRING
.
equals
(
tIncomeDetail
.
getSourceType
()))
{
month
=
tIncomeDetail
.
getDataCreateMonth
();
...
...
@@ -753,11 +757,11 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
Integer
maxNum
=
incomeMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
// 当明细的次数大于总次数,才可以新增统计
if
(
Common
.
isEmpty
(
maxNum
)
||
ifNullToZero
(
nums
)
>=
maxNum
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
else
{
// 红冲判断:当本类型是最大值,才可以红冲
if
(
this
.
redDateJudge
(
tIncomeDetail
,
numMap
))
return
this
.
saveIncome
(
tIncomeDetail
);
if
(
this
.
redDateJudge
(
tIncomeDetail
,
numMap
))
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
return
true
;
}
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/DoJointSocialTask.java
View file @
a513f279
...
...
@@ -102,6 +102,44 @@ public class DoJointSocialTask {
}
log
.
info
(
"推送收入到EKP结束"
);
}
public
void
asynchronousEkpIncomeAsso
(
TIncome
income
)
{
log
.
info
(
"推送收入到EKP-线程开始"
);
try
{
String
sendBack
=
this
.
getSendBack
(
income
);
if
(
Common
.
isEmpty
(
sendBack
)
||
sendBack
.
length
()
!=
32
)
{
sendBack
=
this
.
getSendBack
(
income
);
}
income
.
setSendTime
(
new
Date
());
if
(
Common
.
isNotNull
(
sendBack
)
&&
sendBack
.
length
()
==
32
)
{
income
.
setSendStatus
(
CommonConstants
.
ONE_STRING
);
income
.
setSendMonth
(
DateUtil
.
addMonth
(
0
));
income
.
setEkpId
(
sendBack
);
incomeMapper
.
updateById
(
income
);
}
else
{
TSendEkpError
error
=
new
TSendEkpError
();
error
.
setCreateTime
(
new
Date
());
error
.
setCreateDay
(
DateUtil
.
getThisDay
());
error
.
setType
(
CommonConstants
.
FOUR_STRING
);
error
.
setCreateUserName
(
"收入表推送"
);
error
.
setLinkId
(
income
.
getId
());
error
.
setTitle
(
sendBack
);
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
}
}
catch
(
Exception
e
)
{
TSendEkpError
error
=
new
TSendEkpError
();
error
.
setCreateTime
(
new
Date
());
error
.
setCreateDay
(
DateUtil
.
getThisDay
());
error
.
setType
(
CommonConstants
.
FOUR_STRING
);
error
.
setCreateUserName
(
"收入表推送"
);
error
.
setLinkId
(
income
.
getId
());
error
.
setTitle
(
e
.
getMessage
());
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
log
.
error
(
"推送收入到EKP错误"
,
e
);
}
log
.
info
(
"推送收入到EKP结束"
);
}
/**
* @Description: 合同-批量更换负责人
...
...
@@ -435,6 +473,41 @@ public class DoJointSocialTask {
}
log
.
info
(
"推送社保预估费用到EKP结束"
);
}
public
void
asynchronousEkpForecastSocialAsso
(
EkpPushSocialParam
socialParam
,
TForecastLibrary
library
)
{
log
.
info
(
"推送社保预估费用到EKP-线程开始"
);
try
{
String
body
=
ekpSocialUtil
.
sendToEKP
(
socialParam
);
if
(
Common
.
isEmpty
(
body
)
||
body
.
length
()
!=
32
)
{
body
=
ekpSocialUtil
.
sendToEKP
(
socialParam
);
}
if
(
Common
.
isNotNull
(
body
)
&&
body
.
length
()
==
32
)
{
library
.
setDataPush
(
CommonConstants
.
ONE_INT
);
forecastLibraryMapper
.
updateById
(
library
);
}
else
{
TSendEkpError
error
=
new
TSendEkpError
();
error
.
setCreateTime
(
new
Date
());
error
.
setCreateDay
(
DateUtil
.
getThisDay
());
error
.
setType
(
CommonConstants
.
TWO_STRING
);
error
.
setCreateUserName
(
"社保预估费用推送"
);
error
.
setLinkId
(
library
.
getId
());
error
.
setTitle
(
body
);
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
}
}
catch
(
Exception
e
)
{
TSendEkpError
error
=
new
TSendEkpError
();
error
.
setCreateTime
(
new
Date
());
error
.
setCreateDay
(
DateUtil
.
getThisDay
());
error
.
setType
(
CommonConstants
.
TWO_STRING
);
error
.
setCreateUserName
(
"社保预估费用推送"
);
error
.
setLinkId
(
library
.
getId
());
error
.
setTitle
(
e
.
getMessage
());
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
log
.
error
(
"推送社保预估费用到EKP错误"
,
e
);
}
log
.
info
(
"推送社保预估费用到EKP结束"
);
}
/**
* @Description: 预估数据推送
...
...
@@ -478,4 +551,40 @@ public class DoJointSocialTask {
}
log
.
info
(
"推送公积金预估费用到EKP结束"
);
}
public
void
asynchronousEkpForecastFundAsso
(
EkpPushFundParam
fundParam
,
TForecastLibrary
library
)
{
log
.
info
(
"推送公积金预估费用到EKP-线程开始"
);
try
{
String
body
=
ekpFundUtil
.
sendToEKP
(
fundParam
);
if
(
Common
.
isEmpty
(
body
)
||
body
.
length
()
!=
32
)
{
body
=
ekpFundUtil
.
sendToEKP
(
fundParam
);
}
if
(
Common
.
isNotNull
(
body
)
&&
body
.
length
()
==
32
)
{
library
.
setDataPush
(
CommonConstants
.
ONE_INT
);
forecastLibraryMapper
.
updateById
(
library
);
}
else
{
TSendEkpError
error
=
new
TSendEkpError
();
error
.
setCreateTime
(
new
Date
());
error
.
setCreateDay
(
DateUtil
.
getThisDay
());
error
.
setType
(
CommonConstants
.
TWO_STRING
);
error
.
setCreateUserName
(
"公积金预估费用推送"
);
error
.
setLinkId
(
library
.
getId
());
error
.
setTitle
(
body
);
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
}
}
catch
(
Exception
e
)
{
TSendEkpError
error
=
new
TSendEkpError
();
error
.
setCreateTime
(
new
Date
());
error
.
setCreateDay
(
DateUtil
.
getThisDay
());
error
.
setType
(
CommonConstants
.
TWO_STRING
);
error
.
setCreateUserName
(
"公积金预估费用推送"
);
error
.
setLinkId
(
library
.
getId
());
error
.
setTitle
(
e
.
getMessage
());
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
log
.
error
(
"推送公积金预估费用到EKP错误"
,
e
);
}
log
.
info
(
"推送公积金预估费用到EKP结束"
);
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/DoSocialTask.java
0 → 100644
View file @
a513f279
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
util
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.BigDecimalUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService
;
import
com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService
;
import
com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService
;
import
lombok.Synchronized
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* @Author fxj
* @Date 2022/11/28
* @Description 批量办理异步处理
* @Version 1.0
*/
@Slf4j
@Component
public
class
DoSocialTask
{
@Autowired
private
TForecastLibraryService
forecastLibraryService
;
@Autowired
private
TIncomeDetailService
detailService
;
@Autowired
private
ArchivesDaprUtil
archivesDaprUtil
;
@Autowired
private
TIncomeService
incomeService
;
/**
* @Author fxj
* @Description 异步处理相关信息
* @Date 11:23 2022/11/28
* @param type=0 updateForecastLibaryByDispatchReduce type=1 updateForecastLibaryByDispatch type=2 pushForecastFundInfo createIncomeInfo(library);
**/
@Async
public
void
asynchronousDisPatchHandle
(
TSocialFundInfo
sf
,
int
forecastFlag
,
List
<
TForecastLibrary
>
libs
,
TForecastLibrary
library
,
int
type
)
{
synchronized
(
this
){
// 派单减少变更预估库-派减
if
(
type
==
CommonConstants
.
ZERO_INT
){
forecastLibraryService
.
updateForecastLibaryByDispatchReduce
(
sf
,
forecastFlag
);
}
// 派单变更预估库
if
(
type
==
CommonConstants
.
ONE_INT
){
forecastLibraryService
.
updateForecastLibaryByDispatch
(
sf
);
}
// 获取预估库数据并推送
if
(
type
==
CommonConstants
.
TWO_INT
){
forecastLibraryService
.
pushForecastFundInfo
(
libs
,
false
);
}
// 获取预估库数据并推送
if
(
type
==
CommonConstants
.
THREE_INT
){
createIncomeInfo
(
library
);
}
}
}
public
void
createIncomeInfo
(
TForecastLibrary
library
)
{
//获取项目信息
TSettleDomain
settleDomain
=
new
TSettleDomain
();
List
<
TSettleDomainSelectVo
>
settleDomainR
=
null
;
R
<
TSettleDomainListVo
>
listVo
=
null
;
listVo
=
archivesDaprUtil
.
selectSettleDomainSelectVoById
(
library
.
getSettleDomainId
());
if
(
Common
.
isNotNull
(
listVo
))
{
TSettleDomainListVo
tSettleDomainListVo
=
listVo
.
getData
();
if
(
Common
.
isNotNull
(
tSettleDomainListVo
)
&&
Common
.
isNotEmpty
(
tSettleDomainListVo
.
getListSelectVO
()))
{
settleDomainR
=
tSettleDomainListVo
.
getListSelectVO
();
for
(
TSettleDomainSelectVo
vo
:
settleDomainR
)
{
BeanUtils
.
copyProperties
(
vo
,
settleDomain
);
}
}
}
//判断是否存在当月的公积金收入数据
boolean
isExist
=
false
;
TIncomeDetail
incomeDetail
=
new
TIncomeDetail
();
incomeDetail
.
setEmpIdcard
(
library
.
getEmpIdcard
());
incomeDetail
.
setPayMonth
(
library
.
getProvidentPayMonth
());
incomeDetail
.
setDeptNo
(
library
.
getDeptNo
());
incomeDetail
.
setSourceType
(
CommonConstants
.
TWO_STRING
);
List
<
TIncomeDetail
>
detailList
=
detailService
.
getTIncomeDetailList
(
incomeDetail
);
if
(
Common
.
isNotNull
(
detailList
))
{
BigDecimal
sumMoney
=
BigDecimal
.
ZERO
;
for
(
TIncomeDetail
income
:
detailList
)
{
sumMoney
=
BigDecimalUtils
.
safeAdd
(
income
.
getMoney
(),
sumMoney
);
}
if
(
sumMoney
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
isExist
=
true
;
}
}
if
(
Common
.
isNotNull
(
settleDomain
))
{
// 含有社保,则计算收入
if
(
Common
.
isNotNull
(
settleDomain
.
getManageServerItem
())
&&
settleDomain
.
getManageServerItem
()
.
contains
(
CommonConstants
.
TWO_STRING
)
&&
!
isExist
&&
CommonConstants
.
ZERO_STRING
.
equals
(
settleDomain
.
getManagementTag
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
settleDomain
.
getMrSettleType
()))
{
//预估模式
//预估模式只有按人次和人数收费
createIncomeInsurance
(
library
,
settleDomain
,
CommonConstants
.
ONE_STRING
,
settleDomain
.
getManagementFee
().
toString
(),
settleDomain
.
getManagementType
(),
settleDomain
.
getManagementFee
());
}
if
(
Common
.
isNotNull
(
settleDomain
.
getRiskServerItem
())
&&
settleDomain
.
getRiskServerItem
()
.
contains
(
CommonConstants
.
TWO_STRING
)
&&
!
isExist
&&
CommonConstants
.
ZERO_STRING
.
equals
(
settleDomain
.
getRiskFundTag
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
settleDomain
.
getMrSettleType
()))
{
//预估模式
createIncomeInsurance
(
library
,
settleDomain
,
CommonConstants
.
TWO_STRING
,
settleDomain
.
getRiskFundFee
().
toString
(),
settleDomain
.
getRiskFundType
(),
settleDomain
.
getRiskFundFee
());
}
}
}
public
void
createIncomeInsurance
(
TForecastLibrary
library
,
TSettleDomain
settleDomain
,
String
feeType
,
String
charges
,
String
feeMode
,
BigDecimal
money
)
{
//生成收入数据
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setCreateTime
(
DateUtil
.
getCurrentDateTime
());
detail
.
setDeptName
(
settleDomain
.
getDepartName
());
detail
.
setDeptNo
(
settleDomain
.
getDepartNo
());
detail
.
setDeptId
(
settleDomain
.
getId
());
detail
.
setEmpIdcard
(
library
.
getEmpIdcard
());
detail
.
setEmpName
(
library
.
getEmpName
());
detail
.
setUnitNo
(
settleDomain
.
getCustomerNo
());
detail
.
setUnitId
(
settleDomain
.
getCustomerId
());
detail
.
setUnitName
(
settleDomain
.
getCustomerName
());
detail
.
setDataCreateMonth
(
DateUtil
.
addMonth
(
0
));
detail
.
setSourceId
(
library
.
getId
());
detail
.
setSourceType
(
CommonConstants
.
TWO_STRING
);
detail
.
setCreateMonth
(
library
.
getProvidentCreateMonth
());
detail
.
setPayMonth
(
library
.
getProvidentPayMonth
());
detail
.
setMoney
(
money
);
detail
.
setFeeType
(
feeType
);
detail
.
setFeeMode
(
feeMode
);
detail
.
setCharges
(
charges
);
detail
.
setMrSettleType
(
settleDomain
.
getMrSettleType
());
detail
.
setRedData
(
CommonConstants
.
ZERO_STRING
);
detail
.
setId
(
CommonConstants
.
NULL
);
// 批量办理成功 收入不异步推送
incomeService
.
saveDetail
(
detail
,
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