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
1cdf589a
"...com/example/git@gitlab.ruzhoukj.com:wangcaixuan/rz-gb.git" did not exist on "db8f601025c9b8570578ec8b5233a38ade3f2a35"
Commit
1cdf589a
authored
Feb 25, 2025
by
zhuxiang
Browse files
联调优化
parent
d1690f64
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/entity/UserPerformanceEntity.java
View file @
1cdf589a
...
@@ -33,6 +33,9 @@ public class UserPerformanceEntity {
...
@@ -33,6 +33,9 @@ public class UserPerformanceEntity {
@TableField
(
"dept_id"
)
@TableField
(
"dept_id"
)
private
String
deptId
;
private
String
deptId
;
@TableField
(
"report_data_id"
)
private
String
reportDataId
;
public
void
setPerformanceDate
(
int
year
,
int
month
)
{
public
void
setPerformanceDate
(
int
year
,
int
month
)
{
if
(
month
<
10
)
{
if
(
month
<
10
)
{
this
.
performanceDate
=
year
+
"-0"
+
month
;
this
.
performanceDate
=
year
+
"-0"
+
month
;
...
...
src/main/java/com/ruzhoukj/sms/service/impl/ReportDataInfoServiceImpl.java
View file @
1cdf589a
package
com.ruzhoukj.sms.service.impl
;
package
com.ruzhoukj.sms.service.impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
@@ -17,7 +16,6 @@ import com.ruzhoukj.sms.service.UserService;
...
@@ -17,7 +16,6 @@ import com.ruzhoukj.sms.service.UserService;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -43,48 +41,39 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
...
@@ -43,48 +41,39 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
@Override
@Override
public
void
test
()
{
public
void
test
()
{
ReportDataInfoEntity
reportDataInfoEntity
=
getById
(
"189
3947910320414721
"
);
ReportDataInfoEntity
reportDataInfoEntity
=
getById
(
"189
4302342735548417
"
);
String
content
=
reportDataInfoEntity
.
getAllContent
();
String
content
=
reportDataInfoEntity
.
getAllContent
();
// 解析JSON字符串为JSONArray
// 解析JSON字符串为JSONArray
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
content
);
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
content
);
// 获取第一个元素(假设第一个元素是Sheet1的数据)
// 获取第一个元素(假设第一个元素是Sheet1的数据)
if
(
jsonArray
.
size
()
>
0
)
{
if
(
jsonArray
.
size
()
>
0
)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
0
);
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
0
);
// 获取Sheet1中的data数组
// 获取Sheet1中的data数组
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
double
totalScore
=
0
;
String
totalScore
=
"0"
;
// 遍历data数组,从第6行开始
// 遍历data数组,从第6行开始
for
(
int
i
=
5
;
i
<
data
.
size
();
i
++)
{
for
(
int
i
=
5
;
i
<
data
.
size
();
i
++)
{
JSONArray
row
=
data
.
getJSONArray
(
i
);
JSONArray
row
=
data
.
getJSONArray
(
i
);
//权重
JSONObject
total
=
row
.
getJSONObject
(
0
);
if
(
row
.
getJSONObject
(
6
).
containsKey
(
"v"
))
{
String
totalStr
=
total
.
getString
(
"v"
);
double
weight
=
row
.
getJSONObject
(
6
).
getDouble
(
"v"
);
if
(
StringUtils
.
isNotEmpty
(
totalStr
)
&&
totalStr
.
contains
(
"合计:"
))
{
int
selfScore
=
row
.
getJSONObject
(
8
).
getIntValue
(
"v"
);
JSONObject
score
=
row
.
getJSONObject
(
11
);
int
leaderScore
=
row
.
getJSONObject
(
9
).
getIntValue
(
"v"
);
totalScore
=
score
.
getString
(
"v"
);
int
adminScore
=
row
.
getJSONObject
(
10
).
getIntValue
(
"v"
);
//计算每行的分数
double
rowScore
=
countRowScore
(
weight
,
selfScore
,
leaderScore
,
adminScore
);
totalScore
=
totalScore
+
rowScore
;
}
JSONObject
subjoin
=
row
.
getJSONObject
(
0
);
String
subjoinStr
=
subjoin
.
getString
(
"v"
);
if
(
StringUtils
.
isNotEmpty
(
subjoinStr
)
&&
subjoinStr
.
contains
(
"附加考核"
))
{
break
;
break
;
}
}
}
}
//更新用户绩效分
if
(!
totalScore
.
equals
(
"0"
))
{
UserPerformanceEntity
userPerformanceEntity
=
new
UserPerformanceEntity
();
//更新用户绩效分
userPerformanceEntity
.
setUserId
(
reportDataInfoEntity
.
getUserId
());
UserPerformanceEntity
userPerformanceEntity
=
new
UserPerformanceEntity
();
userPerformanceEntity
.
setPerformanceDate
(
reportDataInfoEntity
.
getYear
(),
reportDataInfoEntity
.
getMonth
());
userPerformanceEntity
.
setUserId
(
reportDataInfoEntity
.
getUserId
());
String
formattedScore
=
String
.
format
(
"%.2f"
,
totalScore
);
userPerformanceEntity
.
setPerformanceDate
(
reportDataInfoEntity
.
getYear
(),
reportDataInfoEntity
.
getMonth
());
userPerformanceEntity
.
setPerformanceScore
(
formattedScore
);
userPerformanceEntity
.
setPerformanceScore
(
totalScore
);
userPerformanceEntity
.
setDeptId
(
reportDataInfoEntity
.
getDeptId
());
userPerformanceEntity
.
setDeptId
(
reportDataInfoEntity
.
getDeptId
());
userPerformanceService
.
save
(
userPerformanceEntity
);
userPerformanceEntity
.
setReportDataId
(
reportDataInfoEntity
.
getId
());
reportDataInfoEntity
.
setStatus
(
"4"
);
userPerformanceService
.
save
(
userPerformanceEntity
);
reportDataInfoEntity
.
setStatus
(
"4"
);
reportDataInfoEntity
.
setId
(
reportDataInfoEntity
.
getId
());
}
}
else
{
}
else
{
System
.
out
.
println
(
"No data available in the JSON array."
);
System
.
out
.
println
(
"No data available in the JSON array."
);
}
}
...
...
src/main/resources/application.yml
View file @
1cdf589a
...
@@ -30,5 +30,5 @@ pagehelper:
...
@@ -30,5 +30,5 @@ pagehelper:
oss
:
oss
:
key
:
LTAI5tENboKK5bcuqHfPvEdr
key
:
LTAI5tENboKK5bcuqHfPvEdr
secret
:
Q006EvMzC63i1ozDiVNxEAxo8eH9zA
secret
:
Q006EvMzC63i1ozDiVNxEAxo8eH9zA
endPoint
:
oss-cn-beijing.aliyuncs.com
endPoint
:
https://
oss-cn-beijing.aliyuncs.com
bucket
:
manj
bucket
:
manj
\ No newline at end of file
src/main/resources/com/ruzhoukj/sms/dao/UserDao.xml
View file @
1cdf589a
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
name,
name,
second_dept as secondDept,
second_dept as secondDept,
third_dept as thirdDept,
third_dept as thirdDept,
user_role userRole,
create_time as createTime
create_time as createTime
FROM user
FROM user
WHERE name = #{name}
WHERE name = #{name}
...
...
src/main/resources/com/ruzhoukj/sms/dao/UserPerformanceDao.xml
View file @
1cdf589a
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<select
id=
"queryList"
resultType=
"com.ruzhoukj.sms.model.vo.UserPerformanceVO"
>
<select
id=
"queryList"
resultType=
"com.ruzhoukj.sms.model.vo.UserPerformanceVO"
>
select
select
up.report_data_id id,
u.name userName,
u.name userName,
up.user_id userId,
up.user_id userId,
u.dept_id deptId,
u.dept_id deptId,
...
...
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