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
a06adabf
Commit
a06adabf
authored
Mar 05, 2024
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
明细接口改造
parent
d64aab7d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
125 deletions
+122
-125
EkpPushSocialParam.java
...om/yifu/cloud/plus/v1/yifu/ekp/vo/EkpPushSocialParam.java
+4
-0
OTAStrategyShardingAlgorithm.java
...loud/plus/v1/ekp/config/OTAStrategyShardingAlgorithm.java
+12
-12
EkpSocialInfoServiceImpl.java
...ud/plus/v1/ekp/service/impl/EkpSocialInfoServiceImpl.java
+75
-52
EkpSocialInfoMapper.xml
...ekp-biz/src/main/resources/mapper/EkpSocialInfoMapper.xml
+1
-1
DoJointSocialTask.java
...ifu/cloud/plus/v1/yifu/social/util/DoJointSocialTask.java
+30
-60
No files found.
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/vo/EkpPushSocialParam.java
View file @
a06adabf
...
...
@@ -265,4 +265,8 @@ public class EkpPushSocialParam implements Serializable {
* 社保ids
**/
private
String
socialIds
;
/**
* 是否为预估
**/
private
String
ygFlag
;
}
\ No newline at end of file
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/config/OTAStrategyShardingAlgorithm.java
View file @
a06adabf
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
config
;
import
com.google.common.collect.Range
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue
;
import
org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue
;
import
org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
@Component
public
class
OTAStrategyShardingAlgorithm
implements
StandardShardingAlgorithm
<
LocalDateTime
>
{
public
class
OTAStrategyShardingAlgorithm
implements
StandardShardingAlgorithm
<
String
>
{
private
static
final
DateTimeFormatter
yyyy
=
DateTimeFormatter
.
ofPattern
(
"yyyy"
);
...
...
@@ -24,10 +24,10 @@ public class OTAStrategyShardingAlgorithm implements StandardShardingAlgorithm<L
* @return
*/
@Override
public
String
doSharding
(
Collection
<
String
>
collection
,
PreciseShardingValue
<
LocalDateTime
>
preciseShardingValue
)
{
public
String
doSharding
(
Collection
<
String
>
collection
,
PreciseShardingValue
<
String
>
preciseShardingValue
)
{
LocalDateTime
value
=
preciseShardingValue
.
getValue
();
String
tableSuffix
=
value
.
format
(
yyyy
);
String
value
=
preciseShardingValue
.
getValue
();
String
tableSuffix
=
value
.
substring
(
0
,
4
);
String
logicTableName
=
preciseShardingValue
.
getLogicTableName
();
String
table
=
logicTableName
.
concat
(
"_"
).
concat
(
tableSuffix
);
return
collection
.
stream
().
filter
(
s
->
s
.
equals
(
table
)).
findFirst
().
orElseThrow
(()
->
new
RuntimeException
(
"逻辑分表不存在"
));
...
...
@@ -42,12 +42,12 @@ public class OTAStrategyShardingAlgorithm implements StandardShardingAlgorithm<L
* @return
*/
@Override
public
Collection
<
String
>
doSharding
(
Collection
<
String
>
collection
,
RangeShardingValue
<
LocalDateTime
>
rangeShardingValue
)
{
public
Collection
<
String
>
doSharding
(
Collection
<
String
>
collection
,
RangeShardingValue
<
String
>
rangeShardingValue
)
{
// 逻辑表名
String
logicTableName
=
rangeShardingValue
.
getLogicTableName
();
// 范围参数
Range
<
LocalDateTime
>
valueRange
=
rangeShardingValue
.
getValueRange
();
Range
<
String
>
valueRange
=
rangeShardingValue
.
getValueRange
();
Set
<
String
>
queryRangeTables
=
extracted
(
logicTableName
,
valueRange
.
lowerEndpoint
(),
valueRange
.
upperEndpoint
());
ArrayList
<
String
>
tables
=
new
ArrayList
<>(
collection
);
tables
.
retainAll
(
queryRangeTables
);
...
...
@@ -63,12 +63,12 @@ public class OTAStrategyShardingAlgorithm implements StandardShardingAlgorithm<L
* @Date 2022-07-21
* @return 物理表名集合
*/
private
Set
<
String
>
extracted
(
String
logicTableName
,
LocalDateTime
lowerEndpoint
,
LocalDateTime
upperEndpoint
)
{
private
Set
<
String
>
extracted
(
String
logicTableName
,
String
lowerEndpoint
,
String
upperEndpoint
)
{
Set
<
String
>
rangeTable
=
new
HashSet
<>();
while
(
lowerEndpoint
.
isBefore
(
upperEndpoint
))
{
while
(
DateUtil
.
stringToDate
(
lowerEndpoint
+
"01"
).
before
(
DateUtil
.
stringToDate
(
upperEndpoint
+
"01"
)
))
{
String
str
=
getTableNameByDate
(
lowerEndpoint
,
logicTableName
);
rangeTable
.
add
(
str
);
lowerEndpoint
=
lowerEndpoint
.
plusYears
(
1
);
lowerEndpoint
=
DateUtil
.
dateToString
(
DateUtil
.
dateIncreaseByYear
(
DateUtil
.
stringToDate
(
lowerEndpoint
+
"01"
),
1
),
DateUtil
.
DATETIME_YYYYMM
);
}
// 获取物理表明
String
tableName
=
getTableNameByDate
(
upperEndpoint
,
logicTableName
);
...
...
@@ -84,8 +84,8 @@ public class OTAStrategyShardingAlgorithm implements StandardShardingAlgorithm<L
* @Date 2022-07-21
* @return 物理表名
*/
private
String
getTableNameByDate
(
LocalDateTime
dateTime
,
String
logicTableName
)
{
String
tableSuffix
=
dateTime
.
format
(
yyyy
);
private
String
getTableNameByDate
(
String
dateTime
,
String
logicTableName
)
{
String
tableSuffix
=
dateTime
.
substring
(
0
,
4
);
return
logicTableName
.
concat
(
"_"
).
concat
(
tableSuffix
);
}
...
...
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/service/impl/EkpSocialInfoServiceImpl.java
View file @
a06adabf
This diff is collapsed.
Click to expand it.
yifu-ekp/yifu-ekp-biz/src/main/resources/mapper/EkpSocialInfoMapper.xml
View file @
a06adabf
...
...
@@ -110,7 +110,7 @@
round(sum(ifnull(fd_3b35a57b6e9d0a,0)),2) as dwYs,
round(sum(ifnull(fd_3adfeb7bd97464,0)),2) as yzc,
round(sum(ifnull(fd_3b35a5b03100c4,0)),2) as personYzc,
round(sum(ifnull(fd_3b35a5b0b04d54,0)),2) as dwYzc
,
round(sum(ifnull(fd_3b35a5b0b04d54,0)),2) as dwYzc
from ekp_9264ea0160848a681328
where fd_3adfe8c7e4cf7a = #{card} and DATE_FORMAT(fd_3adfe8cb96c41e,'%Y-%m') = #{month}
</select>
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/DoJointSocialTask.java
View file @
a06adabf
...
...
@@ -667,6 +667,8 @@ public class DoJointSocialTask {
// 薪酬申请编号
socialParam
.
setFd_3b3cab77923f44
(
CommonConstants
.
EMPTY_STRING
);
socialParam
.
setSocialIds
(
library
.
getIds
());
//实缴
socialParam
.
setYgFlag
(
CommonConstants
.
ZERO_STRING
);
insertList
.
add
(
socialParam
);
}
R
<
EkpSocialPushInfoVo
>
info
=
ekpDaprUtil
.
pushSocialInfoToEkp
(
insertList
);
...
...
@@ -921,9 +923,10 @@ public class DoJointSocialTask {
log
.
info
(
"推送社保预估费用到EKP-线程开始"
);
TSettleDomain
settleDomain
;
EkpPushSocialParam
socialParam
;
List
<
EkpPushSocialParam
>
paramList
=
new
ArrayList
<>();
for
(
TForecastLibrary
library
:
unPushInfo
)
{
try
{
List
<
EkpPushSocialParam
>
insertList
=
new
ArrayList
<>();
try
{
for
(
TForecastLibrary
library
:
unPushInfo
)
{
//获取项目信息
settleDomain
=
selectVoMap
.
get
(
library
.
getDeptNo
());
if
(
Common
.
isEmpty
(
settleDomain
))
{
...
...
@@ -1145,72 +1148,39 @@ public class DoJointSocialTask {
socialParam
.
setFd_3b0afbe1f94a08
(
library
.
getId
());
// 薪酬申请编号
socialParam
.
setFd_3b3cab77923f44
(
CommonConstants
.
EMPTY_STRING
);
String
body
=
ekpSocialUtil
.
sendToEKP
(
socialParam
);
if
(
Common
.
isEmpty
(
body
)
||
body
.
length
()
!=
32
)
{
paramList
.
add
(
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
)
{
//预估
socialParam
.
setYgFlag
(
CommonConstants
.
ONE_STRING
);
insertList
.
add
(
socialParam
);
}
R
<
EkpSocialPushInfoVo
>
info
=
ekpDaprUtil
.
pushSocialInfoToEkp
(
insertList
);
if
(
Common
.
isNotNull
(
info
)
&&
Common
.
isNotNull
(
info
.
getData
()))
{
EkpSocialPushInfoVo
vo
=
info
.
getData
();
List
<
String
>
idList
=
vo
.
getPaymentIds
();
forecastLibraryMapper
.
updatePushStatus
(
idList
);
}
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
(
e
.
getMessage
()
);
error
.
setLinkId
(
unPushInfo
.
get
(
0
)
.
getId
());
error
.
setTitle
(
"社保预估明细批量保存失败"
);
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
log
.
error
(
"推送社保预估费用到EKP错误"
,
e
);
}
}
//推送失败的数据重新推送
if
(!
paramList
.
isEmpty
())
{
for
(
EkpPushSocialParam
s:
paramList
)
{
try
{
String
body
=
ekpSocialUtil
.
sendToEKP
(
s
);
if
(
Common
.
isNotNull
(
body
)
&&
body
.
length
()
==
32
)
{
TForecastLibrary
library
=
forecastLibraryMapper
.
selectById
(
s
.
getFd_3b0afbe1f94a08
());
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
(
s
.
getFd_3b0afbe1f94a08
());
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
(
s
.
getFd_3b0afbe1f94a08
());
error
.
setTitle
(
e
.
getMessage
());
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
log
.
error
(
"推送社保预估费用到EKP错误"
,
e
);
}
}
}
catch
(
Exception
e
)
{
TSendEkpError
error
=
new
TSendEkpError
();
error
.
setCreateTime
(
new
Date
());
error
.
setCreateDay
(
DateUtil
.
getThisDay
());
error
.
setType
(
CommonConstants
.
TWO_STRING
);
error
.
setCreateUserName
(
"社保预估费用推送"
);
error
.
setLinkId
(
unPushInfo
.
get
(
0
).
getId
());
error
.
setTitle
(
e
.
getMessage
());
error
.
setNums
(
CommonConstants
.
ONE_INT
);
tSendEkpErrorService
.
saveError
(
error
);
log
.
error
(
"推送社保预估费用到EKP错误"
,
e
);
}
log
.
info
(
"推送社保预估费用到EKP结束"
);
log
.
info
(
"推送社保预估费
预估
用到EKP结束"
);
}
/**
...
...
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