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
205a5162
Commit
205a5162
authored
Apr 02, 2025
by
zhuxiang
Browse files
优化
parent
09ff5406
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/service/impl/ReportDataInfoServiceImpl.java
View file @
205a5162
...
...
@@ -6,16 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.platform.utils.StringUtils
;
import
com.ruzhoukj.sms.common.Constant
;
import
com.ruzhoukj.sms.dao.ReportDataInfoDao
;
import
com.ruzhoukj.sms.entity.DeptEntity
;
import
com.ruzhoukj.sms.entity.ReportDataInfoEntity
;
import
com.ruzhoukj.sms.entity.UserEntity
;
import
com.ruzhoukj.sms.entity.UserPerformanceEntity
;
import
com.ruzhoukj.sms.entity.*
;
import
com.ruzhoukj.sms.model.dto.ReportDataInfoDTO
;
import
com.ruzhoukj.sms.model.vo.ReportDataInfoVO
;
import
com.ruzhoukj.sms.service.DeptService
;
import
com.ruzhoukj.sms.service.ReportDataInfoService
;
import
com.ruzhoukj.sms.service.UserPerformanceService
;
import
com.ruzhoukj.sms.service.UserService
;
import
com.ruzhoukj.sms.service.*
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -40,6 +34,8 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
private
ReportDataInfoService
reportDataInfoService
;
@Resource
private
UserPerformanceService
userPerformanceService
;
@Resource
private
ReportTemplateService
reportTemplateService
;
@Override
public
List
<
ReportDataInfoVO
>
queryList
(
ReportDataInfoDTO
reportDataInfoDTO
)
{
...
...
@@ -48,58 +44,63 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
@Override
public
void
countPerformance
(
ReportDataInfoEntity
reportDataInfoEntity
)
{
//查看已填写完成,未计算的绩效
String
content
=
reportDataInfoEntity
.
getAllContent
();
// 解析JSON字符串为JSONArray
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
content
);
// 获取第一个元素(假设第一个元素是Sheet1的数据)
if
(
jsonArray
.
size
()
>
0
)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
0
);
// 获取Sheet1中的data数组
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
String
totalScore
=
"0"
;
// 遍历data数组,从第6行开始
for
(
int
i
=
5
;
i
<
data
.
size
();
i
++)
{
JSONArray
row
=
data
.
getJSONArray
(
i
);
JSONObject
total
=
row
.
getJSONObject
(
0
);
if
(
StringUtils
.
isNotEmpty
(
total
))
{
String
totalStr
=
total
.
getString
(
"v"
);
if
(
StringUtils
.
isNotEmpty
(
totalStr
)
&&
totalStr
.
contains
(
"合计:"
))
{
//普通员工绩效
JSONObject
score
=
row
.
getJSONObject
(
11
);
if
(
StringUtils
.
isNull
(
score
))
{
//部门管理员绩效
score
=
row
.
getJSONObject
(
10
);
}
//财务绩效
if
(
StringUtils
.
isNull
(
score
))
{
score
=
row
.
getJSONObject
(
4
);
}
totalScore
=
score
.
getString
(
"v"
);
if
(
StringUtils
.
isEmpty
(
totalScore
))
{
JSONObject
scoreSj
=
row
.
getJSONObject
(
9
);
totalScore
=
scoreSj
.
getString
(
"m"
);
//查看模板信息
ReportTemplateEntity
reportTemplateEntity
=
reportTemplateService
.
getById
(
reportDataInfoEntity
.
getTemplateId
());
if
(
reportTemplateEntity
!=
null
&&
reportTemplateEntity
.
getType
().
equals
(
"绩效"
))
{
//查看已填写完成,未计算的绩效
String
content
=
reportDataInfoEntity
.
getAllContent
();
// 解析JSON字符串为JSONArray
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
content
);
// 获取第一个元素(假设第一个元素是Sheet1的数据)
if
(
jsonArray
.
size
()
>
0
)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
0
);
// 获取Sheet1中的data数组
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
String
totalScore
=
"0"
;
// 遍历data数组,从第6行开始
for
(
int
i
=
5
;
i
<
data
.
size
();
i
++)
{
JSONArray
row
=
data
.
getJSONArray
(
i
);
JSONObject
total
=
row
.
getJSONObject
(
0
);
if
(
StringUtils
.
isNotEmpty
(
total
))
{
String
totalStr
=
total
.
getString
(
"v"
);
if
(
StringUtils
.
isNotEmpty
(
totalStr
)
&&
totalStr
.
contains
(
"合计:"
))
{
//普通员工绩效
JSONObject
score
=
row
.
getJSONObject
(
11
);
if
(
StringUtils
.
isNull
(
score
))
{
//部门管理员绩效
score
=
row
.
getJSONObject
(
10
);
}
//财务绩效
if
(
StringUtils
.
isNull
(
score
))
{
score
=
row
.
getJSONObject
(
4
);
}
totalScore
=
score
.
getString
(
"v"
);
if
(
StringUtils
.
isEmpty
(
totalScore
))
{
JSONObject
scoreSj
=
row
.
getJSONObject
(
9
);
totalScore
=
scoreSj
.
getString
(
"m"
);
}
break
;
}
break
;
}
}
if
(!
totalScore
.
equals
(
"0"
))
{
//更新用户绩效分
UserPerformanceEntity
userPerformanceEntity
=
new
UserPerformanceEntity
();
userPerformanceEntity
.
setUserId
(
reportDataInfoEntity
.
getUserId
());
userPerformanceEntity
.
setPerformanceDate
(
reportDataInfoEntity
.
getYear
(),
reportDataInfoEntity
.
getMonth
());
userPerformanceEntity
.
setPerformanceScore
(
totalScore
);
userPerformanceEntity
.
setDeptId
(
reportDataInfoEntity
.
getDeptId
());
userPerformanceEntity
.
setReportDataId
(
reportDataInfoEntity
.
getId
());
userPerformanceService
.
save
(
userPerformanceEntity
);
reportDataInfoEntity
.
setStatus
(
"4"
);
}
}
else
{
System
.
out
.
println
(
"No data available in the JSON array."
);
}
if
(!
totalScore
.
equals
(
"0"
))
{
//更新用户绩效分
UserPerformanceEntity
userPerformanceEntity
=
new
UserPerformanceEntity
();
userPerformanceEntity
.
setUserId
(
reportDataInfoEntity
.
getUserId
());
userPerformanceEntity
.
setPerformanceDate
(
reportDataInfoEntity
.
getYear
(),
reportDataInfoEntity
.
getMonth
());
userPerformanceEntity
.
setPerformanceScore
(
totalScore
);
userPerformanceEntity
.
setDeptId
(
reportDataInfoEntity
.
getDeptId
());
userPerformanceEntity
.
setReportDataId
(
reportDataInfoEntity
.
getId
());
userPerformanceService
.
save
(
userPerformanceEntity
);
reportDataInfoEntity
.
setStatus
(
"4"
);
reportDataInfoEntity
.
setId
(
reportDataInfoEntity
.
getId
());
reportDataInfoService
.
updateById
(
reportDataInfoEntity
);
}
}
else
{
System
.
out
.
println
(
"No data available in the JSON array."
);
}
else
{
reportDataInfoEntity
.
setStatus
(
"3"
);
}
reportDataInfoService
.
updateById
(
reportDataInfoEntity
);
}
/**
...
...
@@ -136,7 +137,7 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
public
boolean
submit
(
String
id
)
{
//查看信息
ReportDataInfoEntity
reportDataInfoEntity
=
getById
(
id
);
if
(
reportDataInfoEntity
!
=
null
)
{
if
(
reportDataInfoEntity
=
=
null
)
{
return
Boolean
.
FALSE
;
}
//查看被处理人信息
...
...
src/main/resources/com/ruzhoukj/sms/dao/ReportDataInfoDao.xml
View file @
205a5162
...
...
@@ -13,7 +13,7 @@
r.year year,
r.month month,
r.key_value keyValue,
r.
r.
actor_user actorUser,
u.name userName,
r.status status
from
...
...
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