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
5a2f3048
Commit
5a2f3048
authored
Apr 09, 2026
by
fangxinjiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.7.21' into MVP1.7.21
parents
3e1c78dc
6fc6da3d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
24 deletions
+28
-24
SocialTask.java
...n/java/com/yifu/cloud/plus/v1/job/compont/SocialTask.java
+12
-0
TSocialFriendController.java
...us/v1/yifu/social/controller/TSocialFriendController.java
+8
-0
TSocialFriendPushService.java
...plus/v1/yifu/social/service/TSocialFriendPushService.java
+3
-0
TSocialFriendPushServiceImpl.java
...ifu/social/service/impl/TSocialFriendPushServiceImpl.java
+5
-24
No files found.
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/compont/SocialTask.java
View file @
5a2f3048
...
...
@@ -205,6 +205,18 @@ public class SocialTask {
"/tsocialfriend/inner/doPushFriend"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"------------1定时任务推送税友-定时任务结束------------"
);
}
/**
* @Description: 定时任务清理临时文件
* @Author: hgw
* @Date: 20260409
**/
public
void
doClearFriend
()
{
log
.
info
(
"------------定时任务清理临时文件-定时任务开始------------"
);
HttpDaprUtil
.
invokeMethodPost
(
daprProperties
.
getAppUrl
(),
daprProperties
.
getAppId
(),
"/tsocialfriend/inner/doClearFriend"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"------------定时任务清理临时文件-定时任务结束------------"
);
}
/**
* @Description: 2定时任务获取税友
* @Author: hgw
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TSocialFriendController.java
View file @
5a2f3048
...
...
@@ -87,6 +87,14 @@ public class TSocialFriendController {
return
tSocialFriendPushService
.
pushFriend
(
null
,
null
,
CommonConstants
.
ONE_INT
,
null
);
}
@Operation
(
description
=
"定时任务清理临时文件"
)
@PostMapping
(
"/inner/doClearFriend"
)
@SysLog
(
"定时任务清理临时文件"
)
@Inner
public
void
doClearFriend
()
{
tSocialFriendPushService
.
doClearFriend
();
}
@Operation
(
description
=
"2定时任务获取税友"
)
@PostMapping
(
"/inner/doGetFriendByRequestId"
)
@SysLog
(
"2定时任务获取税友"
)
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/TSocialFriendPushService.java
View file @
5a2f3048
...
...
@@ -43,6 +43,9 @@ public interface TSocialFriendPushService extends IService<TSocialInfo> {
**/
R
<
String
>
pushFriend
(
List
<
String
>
dispatchIdList
,
List
<
String
>
pushDispatchIdList
,
Integer
isAuto
,
String
userId
);
// 定时任务清理临时文件
void
doClearFriend
();
R
<
String
>
doExportRoster
(
String
socialId
,
String
type
,
String
unitCreditCode
,
List
<
SociaFriendYgsAddVo
>
listVo
);
R
<
String
>
test
();
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TSocialFriendPushServiceImpl.java
View file @
5a2f3048
...
...
@@ -190,7 +190,6 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
}
}
finally
{
atomicPushFriend
.
decrementAndGet
();
cleanSpireTempFiles
();
}
return
R
.
ok
();
}
else
{
...
...
@@ -203,41 +202,23 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
// 不可以并发,会使花名册转图片的字体不正确
// 后续优化,考虑升级(spire.xls)的版本
// 此方法是:删除临时文件
public
void
cleanSpireTempFiles
()
{
@Override
public
void
doClearFriend
()
{
try
{
// 暂停1分钟:不暂停,删10分钟前的数据
/*try {
Thread.sleep(60000);
} catch (InterruptedException e) {
}*/
String
tempDirPath
=
System
.
getProperty
(
"java.io.tmpdir"
);
File
tempDir
=
new
File
(
tempDirPath
);
if
(
tempDir
.
exists
()
&&
tempDir
.
isDirectory
())
{
File
[]
spireTempFiles
=
tempDir
.
listFiles
((
dir
,
name
)
->
name
.
startsWith
(
"+~JF"
)
&&
name
.
endsWith
(
".tmp"
)
);
if
(
spireTempFiles
!=
null
&&
spireTempFiles
.
length
>
0
)
{
int
count
=
0
;
long
totalSize
=
0
;
// 删30分钟前的数据
long
oneMinuteAgo
=
System
.
currentTimeMillis
()
-
30L
*
60
*
1000
;
long
fileSize
;
long
thirtyMinutesAgo
=
System
.
currentTimeMillis
()
-
30L
*
60
*
1000
;
for
(
File
file
:
spireTempFiles
)
{
if
(
file
.
isFile
()
&&
file
.
canWrite
())
{
if
(
file
.
isFile
()
&&
file
.
canWrite
()
&&
file
.
lastModified
()
<
oneMinuteAgo
)
{
fileSize
=
file
.
length
();
if
(
file
.
delete
())
{
count
++;
totalSize
+=
fileSize
;
}
}
if
(
file
.
isFile
()
&&
file
.
canWrite
()
&&
file
.
lastModified
()
<
thirtyMinutesAgo
)
{
file
.
delete
();
}
}
log
.
info
(
"清理 Spire.XLS 临时文件完成:删除 {} 个文件,释放 {} MB 空间"
,
count
,
totalSize
/
1024
/
1024
);
}
}
}
catch
(
Exception
e
)
{
...
...
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