Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
zhangshaowu
/
pipi-helper
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0ddfb056
authored
Oct 16, 2022
by
weiss
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
5e7fa5ba
4cc8c55f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
src/main/java/com/pipihelper/project/feishu/service/PainService.java
src/main/java/com/pipihelper/project/feishu/service/PainService.java
View file @
0ddfb05
...
@@ -3,12 +3,16 @@ package com.pipihelper.project.feishu.service;
...
@@ -3,12 +3,16 @@ package com.pipihelper.project.feishu.service;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.pipihelper.project.feishu.dao.PainDao
;
import
com.pipihelper.project.feishu.dao.PainDao
;
import
com.pipihelper.project.feishu.entity.Pain
;
import
com.pipihelper.project.feishu.entity.Pain
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
PainService
{
public
class
PainService
{
...
@@ -16,6 +20,14 @@ public class PainService {
...
@@ -16,6 +20,14 @@ public class PainService {
@Autowired
@Autowired
private
PainDao
painDao
;
private
PainDao
painDao
;
private
final
static
List
<
PindexFloor
>
pindexFloors
=
new
ArrayList
<>();
static
{
pindexFloors
.
add
(
new
PindexFloor
().
setStartIndex
(
1
).
setEndIndex
(
12
).
setTimeRange
(
"15:00-16:00"
).
setFloor
(
14
));
pindexFloors
.
add
(
new
PindexFloor
().
setStartIndex
(
13
).
setEndIndex
(
24
).
setTimeRange
(
"16:00-17:00"
).
setFloor
(
14
));
pindexFloors
.
add
(
new
PindexFloor
().
setStartIndex
(
25
).
setEndIndex
(
30
).
setTimeRange
(
"17:00-17:30"
).
setFloor
(
14
));
}
public
void
create
(
Pain
pain
)
{
public
void
create
(
Pain
pain
)
{
painDao
.
create
(
pain
);
painDao
.
create
(
pain
);
}
}
...
@@ -40,13 +52,22 @@ public class PainService {
...
@@ -40,13 +52,22 @@ public class PainService {
return
painDao
.
findAll
();
return
painDao
.
findAll
();
}
}
public
List
<
Pain
>
findAllReorderByFloor
(
int
floor
)
{
public
List
<
Pain
>
findAllReorderByFloor
(
int
floor
)
{
List
<
Pain
>
painList
=
painDao
.
findAllByFloor
(
floor
);
List
<
Pain
>
painList
=
painDao
.
findAllByFloor
(
floor
);
if
(
CollectionUtil
.
isEmpty
(
painList
))
{
if
(
CollectionUtil
.
isEmpty
(
painList
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
painList
.
stream
().
sorted
(
Comparator
.
comparing
(
Pain:
:
getPindex
));
painList
=
painList
.
stream
().
sorted
(
Comparator
.
comparing
(
Pain:
:
getPindex
)).
collect
(
Collectors
.
toList
());
return
new
ArrayList
<>();
AtomicInteger
atomicInteger
=
new
AtomicInteger
(
1
);
painList
.
forEach
(
pain
->
{
int
increment
=
atomicInteger
.
getAndIncrement
();
pain
.
setPindex
(
increment
);
String
timeRange
=
pindexFloors
.
stream
().
filter
(
it
->
it
.
floor
!=
null
&&
it
.
floor
==
floor
)
.
filter
(
it
->
floor
<=
it
.
getEndIndex
()
&&
floor
>=
it
.
getStartIndex
()).
findFirst
().
get
().
timeRange
;
pain
.
setTimeRange
(
timeRange
);
});
return
painList
;
}
}
public
void
waitPain
(
String
openId
)
{
public
void
waitPain
(
String
openId
)
{
...
@@ -68,4 +89,13 @@ public class PainService {
...
@@ -68,4 +89,13 @@ public class PainService {
public
void
deleteAllByFloor
(
int
floor
)
{
public
void
deleteAllByFloor
(
int
floor
)
{
painDao
.
deleteAllByFloor
(
floor
);
painDao
.
deleteAllByFloor
(
floor
);
}
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
PindexFloor
{
private
Integer
startIndex
;
private
Integer
endIndex
;
private
String
timeRange
;
private
Integer
floor
;
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment