Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
ops
Commits
84f466dc
Commit
84f466dc
authored
Mar 07, 2025
by
zhuxiang
Browse files
优化
parent
263d9ef7
Changes
5
Show whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/controller/ReportDataInfoController.java
View file @
84f466dc
...
...
@@ -65,9 +65,4 @@ public class ReportDataInfoController extends BaseController {
return
toAjax
(
reportDataInfoService
.
removeById
(
id
));
}
@GetMapping
(
"/test"
)
public
void
test
()
{
reportDataInfoService
.
countPerformance
();
}
}
src/main/java/com/ruzhoukj/sms/entity/ReportDataInfoEntity.java
View file @
84f466dc
...
...
@@ -46,5 +46,5 @@ public class ReportDataInfoEntity {
private
String
deptId
;
@TableField
(
"status"
)
private
String
status
;
private
String
status
=
"1"
;
}
src/main/java/com/ruzhoukj/sms/service/ReportDataInfoService.java
View file @
84f466dc
...
...
@@ -18,7 +18,7 @@ import java.util.List;
public
interface
ReportDataInfoService
extends
IService
<
ReportDataInfoEntity
>
{
List
<
ReportDataInfoVO
>
queryList
(
ReportDataInfoDTO
reportDataInfoDTO
);
void
countPerformance
();
void
countPerformance
(
String
reportDataInfoId
);
boolean
saveOrUpdateReportData
(
ReportDataInfoDTO
reportDataInfoDTO
);
}
src/main/java/com/ruzhoukj/sms/service/impl/ReportDataInfoServiceImpl.java
View file @
84f466dc
...
...
@@ -2,7 +2,6 @@ package com.ruzhoukj.sms.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.platform.utils.StringUtils
;
import
com.ruzhoukj.sms.dao.ReportDataInfoDao
;
...
...
@@ -41,11 +40,9 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
}
@Override
public
void
countPerformance
()
{
public
void
countPerformance
(
String
reportDataInfoId
)
{
//查看已填写完成,未计算的绩效
List
<
ReportDataInfoEntity
>
reportDataInfoEntityList
=
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
ReportDataInfoEntity
>()
.
eq
(
ReportDataInfoEntity:
:
getStatus
,
3
));
reportDataInfoEntityList
.
forEach
(
reportDataInfoEntity
->
{
ReportDataInfoEntity
reportDataInfoEntity
=
getById
(
reportDataInfoId
);
String
content
=
reportDataInfoEntity
.
getAllContent
();
// 解析JSON字符串为JSONArray
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
content
);
...
...
@@ -63,6 +60,10 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
if
(
StringUtils
.
isNotEmpty
(
totalStr
)
&&
totalStr
.
contains
(
"合计:"
))
{
JSONObject
score
=
row
.
getJSONObject
(
11
);
totalScore
=
score
.
getString
(
"v"
);
if
(
StringUtils
.
isEmpty
(
totalScore
))
{
JSONObject
scoreSj
=
row
.
getJSONObject
(
9
);
totalScore
=
scoreSj
.
getString
(
"m"
);
}
break
;
}
}
...
...
@@ -81,7 +82,6 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
}
else
{
System
.
out
.
println
(
"No data available in the JSON array."
);
}
});
}
/**
...
...
@@ -99,10 +99,21 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
@Override
public
boolean
saveOrUpdateReportData
(
ReportDataInfoDTO
reportDataInfoDTO
)
{
if
(
StringUtils
.
isNotEmpty
(
reportDataInfoDTO
.
getId
()))
{
//是编辑
updateById
(
reportDataInfoDTO
);
}
else
{
//查看当前用户所属部门
UserEntity
user
=
userService
.
getById
(
reportDataInfoDTO
.
get
Login
UserId
());
UserEntity
user
=
userService
.
getById
(
reportDataInfoDTO
.
getUserId
());
reportDataInfoDTO
.
setDeptId
(
user
.
getDeptId
());
reportDataInfoDTO
.
setUserId
(
user
.
getId
());
return
saveOrUpdate
(
reportDataInfoDTO
);
save
(
reportDataInfoDTO
);
}
//处理绩效提交
if
(
StringUtils
.
isNotEmpty
(
reportDataInfoDTO
.
getId
())
&&
reportDataInfoDTO
.
getStatus
().
equals
(
"3"
))
{
countPerformance
(
reportDataInfoDTO
.
getId
());
}
return
Boolean
.
TRUE
;
}
}
src/main/java/com/ruzhoukj/sms/task/PerformanceTask.java
deleted
100644 → 0
View file @
263d9ef7
package
com.ruzhoukj.sms.task
;
import
com.ruzhoukj.sms.service.ReportDataInfoService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
@Component
@Slf4j
public
class
PerformanceTask
{
@Resource
private
ReportDataInfoService
reportDataInfoService
;
//每天八点查询一次绩效
@Scheduled
(
cron
=
"0 0 20 * * ?"
)
private
void
performanceTask
()
{
reportDataInfoService
.
countPerformance
();
}
}
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