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
09ff5406
Commit
09ff5406
authored
Mar 27, 2025
by
zhuxiang
Browse files
优化
parent
3de58896
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/common/Constant.java
View file @
09ff5406
...
...
@@ -15,8 +15,13 @@ public class Constant {
*/
public
static
final
String
ADMIN
=
"ADMIN"
;
public
static
final
String
USER
=
"NORMAL"
;
//部门管理员
public
static
final
String
D_ADMIN
=
"D_ADMIN"
;
public
static
final
String
DIR_OA
=
"OA/"
;
public
static
final
String
DIR_OA
=
"OA/"
;
//总经理USER_ID
public
static
final
String
OA_ADMIN_ID
=
"1829057630693335052"
;
}
src/main/java/com/ruzhoukj/sms/controller/ReportDataInfoController.java
View file @
09ff5406
...
...
@@ -65,4 +65,9 @@ public class ReportDataInfoController extends BaseController {
return
toAjax
(
reportDataInfoService
.
removeById
(
id
));
}
@PutMapping
(
"/submit/{id}"
)
public
Result
submit
(
@PathVariable
String
id
)
{
return
toAjax
(
reportDataInfoService
.
submit
(
id
));
}
}
src/main/java/com/ruzhoukj/sms/entity/ReportDataInfoEntity.java
View file @
09ff5406
...
...
@@ -47,4 +47,7 @@ public class ReportDataInfoEntity {
@TableField
(
"status"
)
private
String
status
=
"1"
;
@TableField
(
"actor_user"
)
private
String
actorUser
;
}
src/main/java/com/ruzhoukj/sms/service/ReportDataInfoService.java
View file @
09ff5406
...
...
@@ -18,7 +18,15 @@ import java.util.List;
public
interface
ReportDataInfoService
extends
IService
<
ReportDataInfoEntity
>
{
List
<
ReportDataInfoVO
>
queryList
(
ReportDataInfoDTO
reportDataInfoDTO
);
void
countPerformance
(
String
reportDataInfo
Id
);
void
countPerformance
(
ReportDataInfoEntity
reportDataInfo
Entity
);
boolean
saveOrUpdateReportData
(
ReportDataInfoDTO
reportDataInfoDTO
);
/**
* 绩效提交
*
* @param id
* @return
*/
boolean
submit
(
String
id
);
}
src/main/java/com/ruzhoukj/sms/service/impl/ReportDataInfoServiceImpl.java
View file @
09ff5406
...
...
@@ -4,12 +4,15 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
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.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
;
...
...
@@ -32,6 +35,10 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
@Resource
private
UserService
userService
;
@Resource
private
DeptService
deptService
;
@Resource
private
ReportDataInfoService
reportDataInfoService
;
@Resource
private
UserPerformanceService
userPerformanceService
;
@Override
...
...
@@ -40,9 +47,8 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
}
@Override
public
void
countPerformance
(
String
reportDataInfo
Id
)
{
public
void
countPerformance
(
ReportDataInfoEntity
reportDataInfo
Entity
)
{
//查看已填写完成,未计算的绩效
ReportDataInfoEntity
reportDataInfoEntity
=
getById
(
reportDataInfoId
);
String
content
=
reportDataInfoEntity
.
getAllContent
();
// 解析JSON字符串为JSONArray
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
content
);
...
...
@@ -56,17 +62,17 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
for
(
int
i
=
5
;
i
<
data
.
size
();
i
++)
{
JSONArray
row
=
data
.
getJSONArray
(
i
);
JSONObject
total
=
row
.
getJSONObject
(
0
);
if
(
StringUtils
.
isNotEmpty
(
total
)){
if
(
StringUtils
.
isNotEmpty
(
total
))
{
String
totalStr
=
total
.
getString
(
"v"
);
if
(
StringUtils
.
isNotEmpty
(
totalStr
)
&&
totalStr
.
contains
(
"合计:"
))
{
//普通员工绩效
JSONObject
score
=
row
.
getJSONObject
(
11
);
if
(
StringUtils
.
isNull
(
score
)){
if
(
StringUtils
.
isNull
(
score
))
{
//部门管理员绩效
score
=
row
.
getJSONObject
(
10
);
}
//财务绩效
if
(
StringUtils
.
isNull
(
score
)){
if
(
StringUtils
.
isNull
(
score
))
{
score
=
row
.
getJSONObject
(
4
);
}
totalScore
=
score
.
getString
(
"v"
);
...
...
@@ -89,6 +95,7 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
userPerformanceService
.
save
(
userPerformanceEntity
);
reportDataInfoEntity
.
setStatus
(
"4"
);
reportDataInfoEntity
.
setId
(
reportDataInfoEntity
.
getId
());
reportDataInfoService
.
updateById
(
reportDataInfoEntity
);
}
}
else
{
System
.
out
.
println
(
"No data available in the JSON array."
);
...
...
@@ -119,12 +126,31 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
UserEntity
user
=
userService
.
getById
(
reportDataInfoDTO
.
getUserId
());
reportDataInfoDTO
.
setDeptId
(
user
.
getDeptId
());
reportDataInfoDTO
.
setUserId
(
user
.
getId
());
reportDataInfoDTO
.
setActorUser
(
user
.
getId
());
save
(
reportDataInfoDTO
);
}
//处理绩效提交
if
(
StringUtils
.
isNotEmpty
(
reportDataInfoDTO
.
getId
())
&&
reportDataInfoDTO
.
getStatus
().
equals
(
"3"
))
{
countPerformance
(
reportDataInfoDTO
.
getId
());
}
return
Boolean
.
TRUE
;
}
@Override
public
boolean
submit
(
String
id
)
{
//查看信息
ReportDataInfoEntity
reportDataInfoEntity
=
getById
(
id
);
if
(
reportDataInfoEntity
!=
null
)
{
return
Boolean
.
FALSE
;
}
//查看被处理人信息
UserEntity
user
=
userService
.
getById
(
reportDataInfoEntity
.
getActorUser
());
if
(
user
.
getUserRole
().
equals
(
Constant
.
USER
))
{
//普通用户,提交给部门负责人
//查看部门负责人Id
DeptEntity
deptEntity
=
deptService
.
getById
(
user
.
getDeptId
());
reportDataInfoEntity
.
setActorUser
(
deptEntity
.
getDeptAdmin
());
}
else
if
(
user
.
getUserRole
().
equals
(
Constant
.
D_ADMIN
))
{
reportDataInfoEntity
.
setActorUser
(
Constant
.
OA_ADMIN_ID
);
}
else
if
(
reportDataInfoEntity
.
getActorUser
().
equals
(
Constant
.
OA_ADMIN_ID
))
{
countPerformance
(
reportDataInfoEntity
);
}
return
updateById
(
reportDataInfoEntity
);
}
}
src/main/resources/com/ruzhoukj/sms/dao/ReportDataInfoDao.xml
View file @
09ff5406
...
...
@@ -13,6 +13,7 @@
r.year year,
r.month month,
r.key_value keyValue,
r.
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