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 c2422c65
authored
Oct 15, 2022
by
zhaolianjie
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
4d1274c8
c9bafd46
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
167 additions
and
8 deletions
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
src/main/java/com/pipihelper/project/feishu/dao/LastMaxPainDao.java
src/main/java/com/pipihelper/project/feishu/entity/LastMaxPain.java
src/main/java/com/pipihelper/project/feishu/entity/Pain.java
src/main/java/com/pipihelper/project/feishu/service/LastMaxPainService.java
src/main/resources/mybatis/MaxEmployeeMapper.xml
src/main/resources/mybatis/PainMapper.xml
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
View file @
c2422c6
...
@@ -11,10 +11,12 @@ import com.pipihelper.project.feishu.dto.chat.FeiShuChatDTO;
...
@@ -11,10 +11,12 @@ import com.pipihelper.project.feishu.dto.chat.FeiShuChatDTO;
import
com.pipihelper.project.feishu.dto.employee.FeiShuEmployeeDTO
;
import
com.pipihelper.project.feishu.dto.employee.FeiShuEmployeeDTO
;
import
com.pipihelper.project.feishu.dto.msg.FeiShuMsgDTO
;
import
com.pipihelper.project.feishu.dto.msg.FeiShuMsgDTO
;
import
com.pipihelper.project.feishu.entity.Employee
;
import
com.pipihelper.project.feishu.entity.Employee
;
import
com.pipihelper.project.feishu.entity.LastMaxPain
;
import
com.pipihelper.project.feishu.entity.Pain
;
import
com.pipihelper.project.feishu.entity.Pain
;
import
com.pipihelper.project.feishu.service.EmployeeService
;
import
com.pipihelper.project.feishu.service.EmployeeService
;
import
com.pipihelper.project.feishu.service.FeiShuApiService
;
import
com.pipihelper.project.feishu.service.FeiShuApiService
;
import
com.pipihelper.project.feishu.service.FeiShuEventService
;
import
com.pipihelper.project.feishu.service.FeiShuEventService
;
import
com.pipihelper.project.feishu.service.LastMaxPainService
;
import
com.pipihelper.project.feishu.service.PainService
;
import
com.pipihelper.project.feishu.service.PainService
;
import
com.pipihelper.project.feishu.service.massage.MassageMsgCardSerivce
;
import
com.pipihelper.project.feishu.service.massage.MassageMsgCardSerivce
;
import
com.pipihelper.project.feishu.service.massage.MassageService
;
import
com.pipihelper.project.feishu.service.massage.MassageService
;
...
@@ -30,6 +32,7 @@ import java.io.BufferedReader;
...
@@ -30,6 +32,7 @@ import java.io.BufferedReader;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -57,6 +60,8 @@ public class FeiShuEventController {
...
@@ -57,6 +60,8 @@ public class FeiShuEventController {
@Autowired
@Autowired
private
EmployeeService
employeeService
;
private
EmployeeService
employeeService
;
@Autowired
@Autowired
private
LastMaxPainService
lastMaxPainService
;
@Autowired
private
PainService
painService
;
private
PainService
painService
;
@Autowired
@Autowired
private
MassageService
massageService
;
private
MassageService
massageService
;
...
@@ -176,19 +181,42 @@ public class FeiShuEventController {
...
@@ -176,19 +181,42 @@ public class FeiShuEventController {
@PostMapping
(
"/employee-list"
)
@PostMapping
(
"/employee-list"
)
public
Object
event
()
{
public
Object
event
()
{
employeeService
.
uprsetAllEmployee
();
//employeeService.uprsetAllEmployee();
List
<
Employee
>
startList
=
employeeService
.
findStartList
(
1
,
14
,
30
);
LastMaxPain
maxPain
=
lastMaxPainService
.
findByFloor
(
14
);
int
startEmployeeId
=
0
;
if
(
maxPain
!=
null
)
{
startEmployeeId
=
maxPain
.
getId
();
}
List
<
Employee
>
employeeList
=
employeeService
.
findStartList
(
startEmployeeId
,
14
,
30
);
Integer
maxEmploeeId
=
0
;
if
(
employeeList
.
size
()
==
30
)
{
maxEmploeeId
=
employeeList
.
stream
().
map
(
Employee:
:
getId
).
max
(
Comparator
.
comparing
(
x
->
x
)).
orElse
(
0
);
}
else
{
List
<
Employee
>
employees
=
employeeService
.
findStartList
(
0
,
14
,
30
-
employeeList
.
size
());
maxEmploeeId
=
employees
.
stream
().
map
(
Employee:
:
getId
).
max
(
Comparator
.
comparing
(
x
->
x
)).
orElse
(
0
);
employeeList
.
addAll
(
employees
);
}
AtomicInteger
i
=
new
AtomicInteger
();
AtomicInteger
i
=
new
AtomicInteger
();
start
List
.
forEach
(
it
->
{
employee
List
.
forEach
(
it
->
{
Pain
pain
=
new
Pain
();
Pain
pain
=
new
Pain
();
pain
.
setOpenId
(
it
.
getOpenId
());
pain
.
setOpenId
(
it
.
getOpenId
());
pain
.
setStatus
(
0
);
pain
.
setStatus
(
0
);
pain
.
setFloor
(
it
.
getFloor
());
pain
.
setFloor
(
it
.
getFloor
());
pain
.
setIndex
(
i
.
getAndIncrement
());
pain
.
setIndex
(
i
.
getAndIncrement
());
pain
.
setName
(
it
.
getName
());
painService
.
create
(
pain
);
painService
.
create
(
pain
);
});
});
/* massageService.sendMassageMsgCardToPiPiChat(userList);*/
/* massageService.sendMassageMsgCardToPiPiChat(userList);*/
if
(
maxPain
!=
null
)
{
maxPain
.
setEmployeeId
(
maxEmploeeId
);
lastMaxPainService
.
update
(
maxPain
);
}
else
{
maxPain
=
new
LastMaxPain
();
maxPain
.
setEmployeeId
(
maxEmploeeId
);
maxPain
.
setFloor
(
14
);
lastMaxPainService
.
create
(
maxPain
);
}
List
<
FeiShuEmployeeDTO
>
dtos
=
feiShuApiService
.
getEmployeeList
();
List
<
FeiShuEmployeeDTO
>
dtos
=
feiShuApiService
.
getEmployeeList
();
return
dtos
;
return
dtos
;
}
}
...
...
src/main/java/com/pipihelper/project/feishu/dao/LastMaxPainDao.java
0 → 100644
View file @
c2422c6
package
com
.
pipihelper
.
project
.
feishu
.
dao
;
import
com.pipihelper.project.feishu.entity.LastMaxPain
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
LastMaxPainDao
{
LastMaxPain
findById
(
Integer
id
);
LastMaxPain
findByFloor
(
Integer
floor
);
void
create
(
LastMaxPain
pain
);
void
update
(
LastMaxPain
pain
);
}
src/main/java/com/pipihelper/project/feishu/entity/LastMaxPain.java
0 → 100644
View file @
c2422c6
package
com
.
pipihelper
.
project
.
feishu
.
entity
;
import
lombok.Data
;
/**
* 上一次按摩id最大的雇员
*/
@Data
public
class
LastMaxPain
{
private
Integer
id
;
private
Integer
employeeId
;
private
Integer
floor
;
}
src/main/java/com/pipihelper/project/feishu/entity/Pain.java
View file @
c2422c6
...
@@ -9,6 +9,7 @@ public class Pain {
...
@@ -9,6 +9,7 @@ public class Pain {
private
Integer
id
;
private
Integer
id
;
private
String
openId
;
private
String
openId
;
private
Integer
index
;
private
Integer
index
;
private
String
name
;
private
Integer
status
;
private
Integer
status
;
private
Date
startTime
;
private
Date
startTime
;
private
Date
endTime
;
private
Date
endTime
;
...
...
src/main/java/com/pipihelper/project/feishu/service/LastMaxPainService.java
0 → 100644
View file @
c2422c6
package
com
.
pipihelper
.
project
.
feishu
.
service
;
import
com.pipihelper.project.feishu.dao.LastMaxPainDao
;
import
com.pipihelper.project.feishu.entity.LastMaxPain
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
LastMaxPainService
{
@Autowired
private
LastMaxPainDao
lastMaxPainDao
;
public
LastMaxPain
findById
(
Integer
id
)
{
return
lastMaxPainDao
.
findById
(
id
);
}
public
LastMaxPain
findByFloor
(
Integer
floor
)
{
return
lastMaxPainDao
.
findByFloor
(
floor
);
}
public
void
create
(
LastMaxPain
pain
)
{
lastMaxPainDao
.
create
(
pain
);
}
public
void
update
(
LastMaxPain
pain
)
{
lastMaxPainDao
.
update
(
pain
);
}
}
src/main/resources/mybatis/MaxEmployeeMapper.xml
0 → 100644
View file @
c2422c6
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.pipihelper.project.feishu.dao.LastMaxPainDao"
>
<resultMap
id=
"LastMaxPainResultMap"
type=
"com.pipihelper.project.feishu.entity.LastMaxPain"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"employee_id"
property=
"employeeId"
/>
<result
column=
"floor"
property=
"floor"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,employee_id,floor
</sql>
<select
id=
"findById"
parameterType=
"java.lang.Integer"
resultMap=
"LastMaxPainResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from t_last_max_pain
<where>
id = #{id}
</where>
</select>
<select
id=
"findByFloor"
parameterType=
"java.lang.Integer"
resultMap=
"LastMaxPainResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from t_last_max_pain
<where>
floor = #{floor}
</where>
</select>
<select
id=
"findBackIndex"
resultMap=
"LastMaxPainResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from t_last_max_pain
<where>
index >= #{index}
order by index asc
limit #{limit}
</where>
</select>
<insert
id=
"create"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"com.pipihelper.project.feishu.entity.LastMaxPain"
>
insert into t_last_max_pain (employee_id, floor)
values (#{employeeId},#{floor})
</insert>
<update
id=
"update"
parameterType=
"com.pipihelper.project.feishu.entity.LastMaxPain"
>
update t_last_max_pain
<set>
<if
test=
"employeeId != null"
>
employee_id = #{employeeId},
</if>
<if
test=
"floor != null"
>
floor = #{floor},
</if>
</set>
<where>
id = #{id}
</where>
</update>
</mapper>
src/main/resources/mybatis/PainMapper.xml
View file @
c2422c6
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
<result
column=
"end_time"
property=
"endTime"
/>
<result
column=
"end_time"
property=
"endTime"
/>
<result
column=
"status"
property=
"status"
/>
<result
column=
"status"
property=
"status"
/>
<result
column=
"floor"
property=
"floor"
/>
<result
column=
"floor"
property=
"floor"
/>
<result
column=
"messageId"
property=
"messageId"
/>
<result
column=
"message_id"
property=
"messageId"
/>
<result
column=
"name"
property=
"name"
/>
<result
column=
"index"
property=
"index"
/>
<result
column=
"index"
property=
"index"
/>
</resultMap>
</resultMap>
...
@@ -18,7 +19,7 @@
...
@@ -18,7 +19,7 @@
</resultMap>-->
</resultMap>-->
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id,open_id,start_time,end_time,status,floor
id,open_id,start_time,end_time,status,floor
,message_id,name
</sql>
</sql>
<select
id=
"findById"
parameterType=
"java.lang.Integer"
resultMap=
"PainResultMap"
>
<select
id=
"findById"
parameterType=
"java.lang.Integer"
resultMap=
"PainResultMap"
>
...
@@ -86,8 +87,8 @@
...
@@ -86,8 +87,8 @@
<insert
id=
"create"
useGeneratedKeys=
"true"
keyProperty=
"id"
<insert
id=
"create"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"com.pipihelper.project.feishu.entity.Pain"
>
parameterType=
"com.pipihelper.project.feishu.entity.Pain"
>
insert into t_pain (open_id, start_time, end_time, status, floor,message_id)
insert into t_pain (open_id, start_time, end_time, status, floor,message_id
,name
)
values (#{openId}, #{startTime}, #{endTime}, #{status},#{floor},#{messageId})
values (#{openId}, #{startTime}, #{endTime}, #{status},#{floor},#{messageId}
,#{name}
)
</insert>
</insert>
<update
id=
"waitPain"
parameterType=
"com.pipihelper.project.feishu.entity.Pain"
>
<update
id=
"waitPain"
parameterType=
"com.pipihelper.project.feishu.entity.Pain"
>
...
@@ -121,6 +122,9 @@
...
@@ -121,6 +122,9 @@
<if
test=
"messageId != null"
>
<if
test=
"messageId != null"
>
message_id = #{messageId},
message_id = #{messageId},
</if>
</if>
<if
test=
"name != null"
>
name = #{name},
</if>
</set>
</set>
<where>
<where>
id = #{id}
id = #{id}
...
...
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