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
a951fb43
Commit
a951fb43
authored
Mar 26, 2024
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
明细接口改造
parent
a487c444
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
206 additions
and
16 deletions
+206
-16
TIncomeServiceImpl.java
.../plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
+159
-16
DoJointSocialTask.java
...ifu/cloud/plus/v1/yifu/social/util/DoJointSocialTask.java
+47
-0
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
View file @
a951fb43
...
...
@@ -299,22 +299,20 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
TIncome
income
=
new
TIncome
();
income
.
setEmpIdcard
(
tIncomeDetail
.
getEmpIdcard
());
income
.
setDeptId
(
tIncomeDetail
.
getDeptId
());
synchronized
(
this
)
{
List
<
TIncome
>
incomeList
=
baseMapper
.
getTIncomeList
(
income
);
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setEmpIdcard
(
tIncomeDetail
.
getEmpIdcard
());
detail
.
setDeptId
(
tIncomeDetail
.
getDeptId
());
List
<
TIncomeDetail
>
detailList
=
tIncomeDetailService
.
getTIncomeDetailList
(
detail
);
tIncomeDetail
.
setCreateTime
(
new
Date
());
tIncomeDetail
.
setDataCreateMonth
(
DateUtil
.
addMonth
(
0
));
tIncomeDetailService
.
save
(
tIncomeDetail
);
// 不存在,直接新增
if
(
incomeList
==
null
||
incomeList
.
isEmpty
())
{
return
this
.
savePaymentIncome
(
tIncomeDetail
,
paymentId
);
}
else
{
// 核心判断
return
this
.
copyCore
(
tIncomeDetail
,
incomeList
,
detailList
,
paymentId
,
true
);
}
List
<
TIncome
>
incomeList
=
baseMapper
.
getTIncomeList
(
income
);
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setEmpIdcard
(
tIncomeDetail
.
getEmpIdcard
());
detail
.
setDeptId
(
tIncomeDetail
.
getDeptId
());
List
<
TIncomeDetail
>
detailList
=
tIncomeDetailService
.
getTIncomeDetailList
(
detail
);
tIncomeDetail
.
setCreateTime
(
new
Date
());
tIncomeDetail
.
setDataCreateMonth
(
DateUtil
.
addMonth
(
0
));
tIncomeDetailService
.
save
(
tIncomeDetail
);
// 不存在,直接新增
if
(
incomeList
==
null
||
incomeList
.
isEmpty
())
{
return
this
.
savePaymentIncomeNew
(
tIncomeDetail
,
paymentId
);
}
else
{
// 核心判断
return
this
.
copyCoreNew
(
tIncomeDetail
,
incomeList
,
detailList
,
paymentId
,
false
);
}
}
...
...
@@ -439,6 +437,19 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return
true
;
}
// 复制并保存
private
boolean
savePaymentIncomeNew
(
TIncomeDetail
tIncomeDetail
,
String
paymentId
)
{
TIncome
income
=
new
TIncome
();
BeanUtil
.
copyProperties
(
tIncomeDetail
,
income
);
income
.
setSendStatus
(
CommonConstants
.
ZERO_STRING
);
income
.
setApplyNo
(
tIncomeDetail
.
getApplyNo
());
this
.
save
(
income
);
long
start
=
System
.
currentTimeMillis
();
income
.
setSourceId
(
paymentId
);
doJointSocialTask
.
asynchronousEkpIncomePaymentNew
(
income
,
paymentId
);
return
true
;
}
/**
* @param income 收入
* @param sendParam 目标格式
...
...
@@ -713,6 +724,138 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return
true
;
}
/**
* @Description: 明细转统计核心逻辑
* @Author: hgw
* @Date: 2022/9/2 10:22
* @return: boolean
**/
private
boolean
copyCoreNew
(
TIncomeDetail
tIncomeDetail
,
List
<
TIncome
>
incomeList
,
List
<
TIncomeDetail
>
detailList
,
String
paymentId
,
boolean
synFlag
)
{
if
(
Common
.
isNotNull
(
tIncomeDetail
.
getSourceId
()))
{
// 如果该id、该类型的金额已存在,则不允许重复生成推送
TIncomeDetail
a
=
new
TIncomeDetail
();
a
.
setId
(
tIncomeDetail
.
getId
());
a
.
setSourceId
(
tIncomeDetail
.
getSourceId
());
a
.
setMoney
(
tIncomeDetail
.
getMoney
());
a
.
setRedData
(
tIncomeDetail
.
getRedData
());
a
.
setFeeType
(
tIncomeDetail
.
getFeeType
());
int
repeatNums
=
tIncomeDetailService
.
getTIncomeDetailRepeat
(
a
);
if
(
repeatNums
>
CommonConstants
.
ZERO_INT
)
{
return
true
;
}
}
// 判断,比例,直接加
if
(
CommonConstants
.
ONE_STRING
.
equals
(
tIncomeDetail
.
getFeeMode
()))
{
if
(
Common
.
isNotNull
(
paymentId
))
{
return
this
.
savePaymentIncomeNew
(
tIncomeDetail
,
paymentId
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
else
{
Map
<
String
,
Integer
>
numMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
incomeMap
=
new
HashMap
<>();
// 商险Map
Map
<
String
,
Integer
>
insureMap
=
new
HashMap
<>();
Integer
nums
;
Integer
insureNums
;
for
(
TIncomeDetail
detail
:
detailList
)
{
nums
=
numMap
.
get
(
detail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getFeeType
());
if
(
Common
.
isEmpty
(
nums
))
{
nums
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
detail
.
getRedData
()))
{
nums
--;
}
else
{
nums
++;
}
numMap
.
put
(
detail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getFeeType
(),
nums
);
}
for
(
TIncome
income
:
incomeList
)
{
nums
=
incomeMap
.
get
(
income
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
());
if
(
Common
.
isEmpty
(
nums
))
{
nums
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
income
.
getRedData
()))
{
nums
--;
}
else
{
nums
++;
}
incomeMap
.
put
(
income
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
(),
nums
);
insureNums
=
insureMap
.
get
(
income
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
());
if
(
Common
.
isEmpty
(
insureNums
))
{
insureNums
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
income
.
getRedData
()))
{
insureNums
--;
}
else
{
insureNums
++;
}
insureMap
.
put
(
income
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
(),
insureNums
);
}
// 金额人数、人次,需要判重
// 社保、公积金(收入来源:1社保2公积金3商险4薪资)
if
(
CommonConstants
.
ONE_STRING
.
equals
(
tIncomeDetail
.
getSourceType
())
||
CommonConstants
.
TWO_STRING
.
equals
(
tIncomeDetail
.
getSourceType
()))
{
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tIncomeDetail
.
getRedData
()))
{
if
(
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
==
null
||
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
<=
CommonConstants
.
ZERO_INT
)
{
if
(
Common
.
isNotNull
(
paymentId
))
{
return
this
.
savePaymentIncomeNew
(
tIncomeDetail
,
paymentId
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
else
{
// 红冲判断:当本类型是最大值,才可以红冲
if
(
this
.
redDateJudge
(
tIncomeDetail
,
numMap
))
{
if
(
Common
.
isNotNull
(
paymentId
))
{
return
this
.
savePaymentIncomeNew
(
tIncomeDetail
,
paymentId
);
}
else
{
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
}
else
if
(
CommonConstants
.
THREE_STRING
.
equals
(
tIncomeDetail
.
getSourceType
()))
{
// 商险。收费方式:2金额-人数
if
(
CommonConstants
.
TWO_STRING
.
equals
(
tIncomeDetail
.
getFeeMode
()))
{
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tIncomeDetail
.
getRedData
()))
{
if
(
insureMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
==
null
||
insureMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
<=
CommonConstants
.
ZERO_INT
)
{
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
else
{
if
(
this
.
redDateJudge
(
tIncomeDetail
,
numMap
))
{
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
}
else
{
// 各个模式累加逻辑:
return
this
.
judgeMixModel
(
tIncomeDetail
,
numMap
,
incomeMap
,
synFlag
);
}
}
else
{
// 薪资。收费方式:2金额-人数
if
(
CommonConstants
.
TWO_STRING
.
equals
(
tIncomeDetail
.
getFeeMode
()))
{
if
(
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
==
null
||
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
<=
CommonConstants
.
ZERO_INT
)
{
return
this
.
saveIncome
(
tIncomeDetail
,
synFlag
);
}
}
else
{
// 3金额-人次
// 各个模式累加逻辑:
return
this
.
judgeMixModel
(
tIncomeDetail
,
numMap
,
incomeMap
,
synFlag
);
}
}
}
if
(
Common
.
isNotNull
(
paymentId
))
{
tPaymentInfoMapper
.
updateBySocialIncomeFlag
(
paymentId
);
}
return
true
;
}
/**
* @Description: 红冲判断
* @Author: hgw
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/DoJointSocialTask.java
View file @
a951fb43
...
...
@@ -224,6 +224,53 @@ public class DoJointSocialTask {
log
.
info
(
"推送收入到EKP结束"
);
}
public
void
asynchronousEkpIncomePaymentNew
(
TIncome
income
,
String
paymentId
)
{
log
.
info
(
"推送收入到EKP-线程开始"
);
try
{
String
sendBack
=
this
.
getSendBack
(
income
);
if
((
Common
.
isEmpty
(
sendBack
)
||
sendBack
.
length
()
!=
19
)
&&
Common
.
isNotNull
(
income
.
getRedisKey
()))
{
List
<
TIncome
>
list
;
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
income
.
getRedisKey
())))
{
list
=
(
List
<
TIncome
>)
redisUtil
.
get
(
income
.
getRedisKey
());
}
else
{
list
=
new
ArrayList
<>();
}
list
.
add
(
income
);
redisUtil
.
set
(
income
.
getRedisKey
(),
list
);
}
income
.
setSendTime
(
new
Date
());
if
(
Common
.
isNotNull
(
sendBack
)
&&
sendBack
.
length
()
==
19
)
{
income
.
setSendStatus
(
CommonConstants
.
ONE_STRING
);
income
.
setSendMonth
(
DateUtil
.
addMonth
(
0
));
income
.
setEkpId
(
sendBack
);
incomeMapper
.
updateById
(
income
);
paymentInfoMapper
.
updateBySocialIncomePayment
(
paymentId
);
}
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: 合同-批量更换负责人
* @Author: huyc
...
...
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