Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
b726f221
Commit
b726f221
authored
Jul 19, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改考勤汇总
parent
57a8e1d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
2 deletions
+84
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/MockDataController.java
...c/main/java/com/mortals/xhx/busiz/MockDataController.java
+84
-2
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/MockDataController.java
View file @
b726f221
...
@@ -16,6 +16,7 @@ import com.mortals.xhx.base.system.user.model.UserEntity;
...
@@ -16,6 +16,7 @@ import com.mortals.xhx.base.system.user.model.UserEntity;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptPerformStatEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.service.DeptPerformStatService
;
import
com.mortals.xhx.module.dept.service.DeptPerformStatService
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.dept.service.DeptService
;
...
@@ -81,7 +82,7 @@ public class MockDataController {
...
@@ -81,7 +82,7 @@ public class MockDataController {
private
StaffPerformSummaryService
summaryService
;
private
StaffPerformSummaryService
summaryService
;
@Autowired
@Autowired
private
StaffPerformStatService
staffPerformStatService
;
private
StaffPerformStatService
staffPerformStatService
;
@Autowired
private
DeptPerformStatService
deptPerformStatService
;
private
DeptPerformStatService
deptPerformStatService
;
/**
/**
...
@@ -287,7 +288,7 @@ public class MockDataController {
...
@@ -287,7 +288,7 @@ public class MockDataController {
statEntity
.
setTotalSubScore
(
totalScoreSub
);
statEntity
.
setTotalSubScore
(
totalScoreSub
);
BigDecimal
subtract
=
statEntity
.
getTotalAddScore
().
subtract
(
statEntity
.
getTotalSubScore
());
BigDecimal
subtract
=
statEntity
.
getTotalAddScore
().
subtract
(
statEntity
.
getTotalSubScore
());
statEntity
.
setTotalScore
(
subtract
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
subtract:
BigDecimal
.
ZERO
);
statEntity
.
setTotalScore
(
subtract
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
subtract
:
BigDecimal
.
ZERO
);
statEntity
.
setYear
(
DateUtil
.
year
(
curDate
));
statEntity
.
setYear
(
DateUtil
.
year
(
curDate
));
statEntity
.
setMonth
(
DateUtil
.
month
(
curDate
)
+
1
);
statEntity
.
setMonth
(
DateUtil
.
month
(
curDate
)
+
1
);
statEntity
.
setDay
(
DateUtil
.
dayOfMonth
(
curDate
));
statEntity
.
setDay
(
DateUtil
.
dayOfMonth
(
curDate
));
...
@@ -301,6 +302,87 @@ public class MockDataController {
...
@@ -301,6 +302,87 @@ public class MockDataController {
}
}
/**
* 生成模拟数据
* mortals_xhx_dept_perform_stat
*
* @return
*/
@GetMapping
(
"randomDeptPerformStatData"
)
@UnAuth
public
Rest
<
Void
>
randomDeptPerformStatData
()
{
List
<
DeptEntity
>
deptEntityList
=
deptService
.
find
(
new
DeptQuery
());
//最近两月模拟数据
DateTime
beforeStartDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
60
);
for
(
int
i
=
1
;
i
<=
60
;
i
++)
{
DateTime
curDate
=
DateUtil
.
offsetDay
(
beforeStartDate
,
i
);
List
<
DeptPerformStatEntity
>
collect
=
deptEntityList
.
stream
().
map
(
item
->
{
DeptPerformStatEntity
statEntity
=
new
DeptPerformStatEntity
();
statEntity
.
initAttrValue
();
statEntity
.
setDeptId
(
item
.
getId
());
statEntity
.
setDeptName
(
item
.
getDeptName
());
BigDecimal
attendScoreAdd
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
reviewScoreAdd
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
complainScoreAdd
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
goworkScoreAdd
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
effectScoreAdd
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
otherScoreAdd
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
attendScoreSub
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
reviewScoreSub
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
complainScoreSub
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
goworkScoreSub
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
effectScoreSub
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
BigDecimal
otherScoreSub
=
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
statEntity
.
setAttendScoreAdd
(
attendScoreAdd
);
statEntity
.
setAttendScoreSub
(
attendScoreSub
);
statEntity
.
setReviewScoreAdd
(
reviewScoreAdd
);
statEntity
.
setReviewScoreSub
(
reviewScoreSub
);
statEntity
.
setComplainScoreAdd
(
complainScoreAdd
);
statEntity
.
setComplainScoreSub
(
complainScoreSub
);
statEntity
.
setGoworkScoreAdd
(
goworkScoreAdd
);
statEntity
.
setGoworkScoreSub
(
goworkScoreSub
);
statEntity
.
setEffectScoreAdd
(
effectScoreAdd
);
statEntity
.
setEffectScoreSub
(
effectScoreSub
);
statEntity
.
setOtherScoreAdd
(
otherScoreAdd
);
statEntity
.
setOtherScoreSub
(
otherScoreSub
);
BigDecimal
totalScoreAdd
=
attendScoreAdd
.
add
(
reviewScoreAdd
).
add
(
complainScoreAdd
)
.
add
(
goworkScoreAdd
).
add
(
effectScoreAdd
).
add
(
otherScoreAdd
);
BigDecimal
totalScoreSub
=
attendScoreSub
.
add
(
reviewScoreSub
).
add
(
complainScoreSub
)
.
add
(
goworkScoreSub
).
add
(
effectScoreSub
).
add
(
otherScoreSub
);
statEntity
.
setTotalAddScore
(
totalScoreAdd
);
statEntity
.
setTotalSubScore
(
totalScoreSub
);
BigDecimal
subtract
=
statEntity
.
getTotalAddScore
().
subtract
(
statEntity
.
getTotalSubScore
());
statEntity
.
setTotalScore
(
subtract
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
subtract
:
BigDecimal
.
ZERO
);
int
personNum
=
staffService
.
count
(
new
StaffQuery
().
deptId
(
item
.
getId
()),
null
);
if
(
personNum
>
0
)
{
BigDecimal
aver
=
statEntity
.
getTotalScore
().
divide
(
new
BigDecimal
(
personNum
),
2
,
BigDecimal
.
ROUND_CEILING
);
statEntity
.
setAverageScore
(
aver
);
}
else
{
statEntity
.
setAverageScore
(
BigDecimal
.
ZERO
);
}
statEntity
.
setYear
(
DateUtil
.
year
(
curDate
));
statEntity
.
setMonth
(
DateUtil
.
month
(
curDate
)
+
1
);
statEntity
.
setDay
(
DateUtil
.
dayOfMonth
(
curDate
));
return
statEntity
;
}).
collect
(
Collectors
.
toList
());
deptPerformStatService
.
save
(
collect
);
}
return
Rest
.
ok
();
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
));
System
.
out
.
println
(
RandomUtil
.
randomBigDecimal
(
BigDecimal
.
ZERO
,
new
BigDecimal
(
"1"
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
));
}
}
...
...
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