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
fe73d4f2
Commit
fe73d4f2
authored
Jul 27, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时器
parent
256173ba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
221 additions
and
1 deletion
+221
-1
DaprSocialProperties.java
...plus/v1/yifu/common/dapr/config/DaprSocialProperties.java
+39
-0
SocialTask.java
...n/java/com/yifu/cloud/plus/v1/job/compont/SocialTask.java
+53
-0
TForecastLibraryController.java
...v1/yifu/social/controller/TForecastLibraryController.java
+28
-0
TForecastLibraryServiceImpl.java
...yifu/social/service/impl/TForecastLibraryServiceImpl.java
+101
-1
No files found.
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/config/DaprSocialProperties.java
0 → 100644
View file @
fe73d4f2
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
dapr
.
config
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.stereotype.Component
;
/**
* @Author hgw
* @Date 2022-7-27 19:38:08
* @Description
* @Version 1.0
*/
@Data
@Component
@PropertySource
(
"classpath:daprConfig.properties"
)
@ConfigurationProperties
(
value
=
"dapr.social"
,
ignoreInvalidFields
=
false
)
public
class
DaprSocialProperties
{
/*
* @author fxj
* @date 14:34
* @Description dapr sidercar url 如:http://localhost:3005/v1.0/invoke/
**/
String
appUrl
;
/*
* @author fxj
* @date 14:35
* @decription app_id 如:"yifu_upms_sider"
**/
String
appId
;
String
appPort
;
String
httpPort
;
String
grpcPort
;
String
metricsPort
;
}
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/compont/SocialTask.java
0 → 100644
View file @
fe73d4f2
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
compont
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.stereotype.Component
;
/**
* @Author hgw
* @Date 2022-7-27 19:37:14
* @Description 社保定时任务
* @Version 1.0
*/
@Component
(
value
=
"socialTask"
)
@Slf4j
@EnableConfigurationProperties
(
DaprSocialProperties
.
class
)
public
class
SocialTask
{
@Autowired
private
DaprSocialProperties
daprProperties
;
/**
* @Description: 定时生成基数配置新增的数据
* @Author: hgw
* @Date: 2022/7/27 19:39
* @return: void
**/
public
void
updateForecastLibaryBySysBase
()
{
log
.
info
(
"------------定时生成基数配置新增的数据-定时任务开始------------"
);
HttpDaprUtil
.
invokeMethodPost
(
daprProperties
.
getAppUrl
(),
daprProperties
.
getAppId
(),
"/tforecastlibrary/inner/updateForecastLibaryBySysBase"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"------------定时生成基数配置新增的数据-定时任务结束------------"
);
}
/**
* @Description: 每月定时生成下月预估库数据
*
* 必须在【定时生成基数配置新增的数据】之后执行
*
* @Author: hgw
* @Date: 2022/7/27 19:39
* @return: void
**/
public
void
everyMonthCreateForecastLibary
()
{
log
.
info
(
"------------每月定时生成下月预估库数据-定时任务开始------------"
);
HttpDaprUtil
.
invokeMethodPost
(
daprProperties
.
getAppUrl
(),
daprProperties
.
getAppId
(),
"/tforecastlibrary/inner/everyMonthCreateForecastLibary"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"------------每月定时生成下月预估库数据-定时任务结束------------"
);
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TForecastLibraryController.java
View file @
fe73d4f2
...
...
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary
;
import
com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -168,4 +169,31 @@ public class TForecastLibraryController {
return
tForecastLibraryService
.
createForecastlibary
(
payMonths
,
empIdCard
,
settleDomainIds
);
}
/**
* @Description: 每日定时刷新社保公积金信息、预估数据,根据新增的户数据
* @Author: hgw
* @Date: 2022/7/27 19:34
* @return: void
**/
@SysLog
(
"每日定时刷新社保公积金信息、预估数据,根据新增的户数据"
)
@Inner
@GetMapping
(
"/inner/updateForecastLibaryBySysBase"
)
public
void
updateForecastLibaryBySysBase
()
{
tForecastLibraryService
.
updateForecastLibaryBySysBase
(
null
);
}
/**
* @Description: 每月定时生成下月预估库数据
* @Author: hgw
* @Date: 2022/7/27 19:34
* @return: void
**/
@SysLog
(
"每月定时生成下月预估库数据"
)
@Inner
@GetMapping
(
"/inner/everyMonthCreateForecastLibary"
)
public
void
everyMonthCreateForecastLibary
()
{
tForecastLibraryService
.
everyMonthCreateForecastLibary
();
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TForecastLibraryServiceImpl.java
View file @
fe73d4f2
...
...
@@ -1656,15 +1656,115 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return
null
;
}
/**
* @Description: 每月1号定时生成下月预估库数据
* @Author: hgw
* @Date: 2022/7/27 19:30
* @return: void
**/
@Override
public
void
everyMonthCreateForecastLibary
()
{
List
<
TSocialFundInfo
>
socialFundInfoList
=
socialFundInfoMapper
.
selectList
(
Wrappers
.<
TSocialFundInfo
>
query
().
lambda
());
if
(
socialFundInfoList
!=
null
&&
!
socialFundInfoList
.
isEmpty
())
{
String
payMonth
=
DateUtil
.
addMonth
(
1
);
for
(
TSocialFundInfo
socialFundInfo
:
socialFundInfoList
)
{
// TODO-生成新的社保公积金数据
everyMonthCreateForecastLibaryCore
(
payMonth
,
socialFundInfo
);
}
}
}
private
R
<
String
>
everyMonthCreateForecastLibaryCore
(
String
payMonth
,
TSocialFundInfo
socialFundInfo
)
{
String
empIdCard
=
socialFundInfo
.
getEmpIdcard
();
//定义未推送的按条件查询得到的预估数据
List
<
TForecastLibrary
>
librarySocialList
=
null
;
//定义已推送的按条件查询得到的预估数据
List
<
TForecastLibrary
>
librarySocialListTemp
=
null
;
//定义未推送的按条件查询得到的预估数据
List
<
TForecastLibrary
>
libraryFundList
=
null
;
//定义已推送的按条件查询得到的预估数据
List
<
TForecastLibrary
>
libraryFundListTemp
=
null
;
List
<
String
>
payMonthList
=
new
ArrayList
<>();
payMonthList
.
add
(
payMonth
);
//查询出所有符合条件的社保数据
List
<
TSocialFundInfo
>
socialInfoList
=
null
;
List
<
TSocialFundInfo
>
fundList
=
null
;
// 查询当年所有的社保临时政策用于生成预估数据
List
<
TAgentConfig
>
configList
=
agentConfigMapper
.
selectList
(
Wrappers
.<
TAgentConfig
>
query
().
lambda
()
.
eq
(
TAgentConfig:
:
getOpenFlag
,
CommonConstants
.
ZERO_INT
));
HashMap
<
String
,
TAgentConfig
>
agentConfigHashMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
configList
)
&&
Common
.
isNotNull
(
payMonthList
))
{
initConfigByPayMonths
(
configList
,
payMonthList
,
agentConfigHashMap
);
}
//查询出所有对应条件的预估数、社保数据、公积金数据据用于重新生成
if
(
Common
.
isNotNull
(
empIdCard
))
{
librarySocialList
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
eq
(
TForecastLibrary:
:
getEmpIdcard
,
empIdCard
)
.
eq
(
TForecastLibrary:
:
getDataType
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TForecastLibrary:
:
getSocialPayMonth
,
payMonth
)
.
eq
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ZERO_INT
));
librarySocialListTemp
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
eq
(
TForecastLibrary:
:
getEmpIdcard
,
empIdCard
)
.
eq
(
TForecastLibrary:
:
getDataType
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TForecastLibrary:
:
getSocialPayMonth
,
payMonth
)
.
eq
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ONE_INT
));
libraryFundList
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
eq
(
TForecastLibrary:
:
getEmpIdcard
,
empIdCard
)
.
eq
(
TForecastLibrary:
:
getDataType
,
CommonConstants
.
ONE_INT
)
.
eq
(
TForecastLibrary:
:
getProvidentPayMonth
,
payMonth
)
.
eq
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ZERO_INT
));
libraryFundListTemp
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
eq
(
TForecastLibrary:
:
getEmpIdcard
,
empIdCard
)
.
eq
(
TForecastLibrary:
:
getDataType
,
CommonConstants
.
ONE_INT
)
.
eq
(
TForecastLibrary:
:
getProvidentPayMonth
,
payMonth
)
.
eq
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ONE_INT
));
socialInfoList
=
socialFundInfoMapper
.
getSocialList
(
empIdCard
,
null
);
fundList
=
socialFundInfoMapper
.
getFundList
(
empIdCard
,
null
);
}
if
(
Common
.
isEmpty
(
socialInfoList
)
&&
Common
.
isEmpty
(
fundList
))
{
return
R
.
failed
(
"无需要重新生成的数据(无数据或数据已结算不可重新生成!)"
);
}
//先删除然后重新生成
if
(
Common
.
isNotNull
(
librarySocialList
))
{
baseMapper
.
deleteBatchIds
(
librarySocialList
);
}
if
(
Common
.
isNotNull
(
libraryFundList
))
{
baseMapper
.
deleteBatchIds
(
libraryFundList
);
}
// 已存在的预估数据,采用比例
HashMap
<
String
,
TForecastLibrary
>
socialHistoryMap
=
new
HashMap
<>();
HashMap
<
String
,
TForecastLibrary
>
fundHistoryMap
=
new
HashMap
<>();
// 已推送的预估明细Map
HashMap
<
String
,
TForecastLibrary
>
socialPushMap
=
new
HashMap
<>();
HashMap
<
String
,
TForecastLibrary
>
fundPushMap
=
new
HashMap
<>();
// 组建基础Map
this
.
getBaseMap
(
librarySocialList
,
librarySocialListTemp
,
libraryFundList
,
libraryFundListTemp
,
socialHistoryMap
,
fundHistoryMap
,
socialPushMap
,
fundPushMap
);
Map
<
String
,
TForecastLibrary
>
saveLibraryMap
=
new
HashMap
<>();
boolean
isReduceSocial
=
false
;
boolean
isReduceFund
=
false
;
// 核心刷新
R
<
String
>
coreR
=
this
.
doCore
(
payMonthList
,
socialInfoList
,
fundList
,
agentConfigHashMap
,
socialHistoryMap
,
fundHistoryMap
,
socialPushMap
,
fundPushMap
,
saveLibraryMap
,
isReduceSocial
,
isReduceFund
);
if
(
coreR
!=
null
)
return
coreR
;
boolean
isSaveAndUpdate
=
false
;
for
(
TForecastLibrary
library
:
saveLibraryMap
.
values
())
{
if
(
Common
.
isEmpty
(
library
.
getSocialId
())
&&
Common
.
isEmpty
(
library
.
getProvidentId
()))
{
continue
;
}
if
(
Common
.
isNotNull
(
library
.
getId
()))
{
baseMapper
.
updateById
(
library
);
}
else
{
library
.
setCreateTime
(
LocalDateTime
.
now
());
baseMapper
.
insert
(
library
);
}
isSaveAndUpdate
=
true
;
}
if
(
isSaveAndUpdate
)
{
return
R
.
ok
(
null
,
"执行成功!"
);
}
else
{
return
R
.
failed
(
"执行失败!无需更新的数据!"
);
}
}
}
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