Commit c9ee7250 by liushuangwu

pain

1 parent 89cc7298
......@@ -9,10 +9,14 @@ import com.pipihelper.project.feishu.dto.FeiShuMsgCardEventDTO;
import com.pipihelper.project.feishu.dto.chat.FeiShuChatDTO;
import com.pipihelper.project.feishu.dto.employee.FeiShuEmployeeDTO;
import com.pipihelper.project.feishu.dto.msg.FeiShuMsgDTO;
import com.pipihelper.project.feishu.entity.Employee;
import com.pipihelper.project.feishu.entity.Pain;
import com.pipihelper.project.feishu.service.EmployeeService;
import com.pipihelper.project.feishu.service.FeiShuApiService;
import com.pipihelper.project.feishu.service.FeiShuEventService;
import com.pipihelper.project.feishu.service.PainService;
import com.pipihelper.project.feishu.service.massage.MassageMsgCardSerivce;
import com.pipihelper.project.feishu.service.massage.MassageService;
import com.pipihelper.project.feishu.utils.FeiShuEventDataDecrypter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -26,6 +30,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -50,6 +55,10 @@ public class FeiShuEventController {
private MassageMsgCardSerivce massageMsgCardSerivce;
@Autowired
private EmployeeService employeeService;
@Autowired
private PainService painService;
@Autowired
private MassageService massageService;
@PostMapping("/event")
......@@ -105,7 +114,6 @@ public class FeiShuEventController {
// 推迟 将当前用户放到队列最后 - 掉延迟更新卡片接口 更新大群、按摩群的按摩时间安排卡片
return getInteractiveCardStr("已为你推迟到最后");
}
default:
......@@ -138,7 +146,18 @@ public class FeiShuEventController {
public Object event() {
employeeService.uprsetAllEmployee();
employeeService.findStartList(1, 14, 30);
List<Employee> startList = employeeService.findStartList(1, 14, 30);
AtomicInteger i = new AtomicInteger();
startList.forEach(it -> {
Pain pain = new Pain();
pain.setOpenId(it.getOpenId());
pain.setStatus(0);
pain.setFloor(it.getFloor());
pain.setIndex(i.getAndIncrement());
painService.create(pain);
});
/* massageService.sendMassageMsgCardToPiPiChat(userList);*/
List<FeiShuEmployeeDTO> dtos = feiShuApiService.getEmployeeList();
return dtos;
}
......
......@@ -11,4 +11,5 @@ public class Employee {
private Integer gender;
private Integer status;
private String departmentId;
private Integer floor;
}
......@@ -2,12 +2,16 @@ package com.pipihelper.project.feishu.entity;
import lombok.Data;
import java.util.Date;
@Data
public class Pain {
private Integer id;
private String openId;
private Integer index;
private Integer status;
private Date startTime;
private Date endTime;
private String timeRange;
private Integer floor;
private String messageId;
......
package com.pipihelper.project.feishu.service;
import com.pipihelper.project.feishu.dao.PainDao;
import com.pipihelper.project.feishu.entity.Pain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PainService {
@Autowired
private PainDao painDao;
public void create(Pain pain) {
painDao.create(pain);
}
public Pain findById(Integer id) {
return painDao.findById(id);
}
public Pain findByOpenId(String openId) {
return painDao.findByOpenId(openId);
}
public void deleteById(Integer id) {
painDao.deleteById(id);
}
public void update(Pain Pain) {
painDao.update(Pain);
}
public List<Pain> findAll() {
return painDao.findAll();
}
}
......@@ -36,7 +36,7 @@
<include refid="Base_Column_List"/>
from t_employee
<where>
id >= #{id}
id >= #{startId}
and floor = #{floor}
limit #{limit};
</where>
......
......@@ -5,8 +5,8 @@
<resultMap id="PainResultMap" type="com.pipihelper.project.feishu.entity.Pain">
<id column="id" property="id"/>
<result column="open_id" property="openId"/>
<result column="start_time" property="start_time"/>
<result column="end_time" property="end_time"/>
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
<result column="status" property="status"/>
<result column="floor" property="floor"/>
<result column="messageId" property="messageId"/>
......@@ -30,18 +30,6 @@
</where>
</select>
<select id="findStartList" resultMap="PainResultMap">
select
<include refid="Base_Column_List"/>
from t_pain
<where>
id >= #{id}
and floor = #{floor}
limit #{limit};
</where>
</select>
<select id="findByOpenId" parameterType="java.lang.String" resultMap="PainResultMap">
select
<include refid="Base_Column_List"/>
......@@ -65,12 +53,12 @@
</delete>
<insert id="create" useGeneratedKeys="true" keyProperty="id"
parameterType="com.pipihelper.project.feishu.entity.Employee">
parameterType="com.pipihelper.project.feishu.entity.Pain">
insert into t_pain (open_id, start_time, end_time, status, floor,message_id)
values (#{openId}, #{startTime}, #{endTime}, #{status},#{floor},#{messageId})
</insert>
<update id="update" parameterType="com.pipihelper.project.feishu.entity.Employee">
<update id="update" parameterType="com.pipihelper.project.feishu.entity.Pain">
update t_pain
<set>
<if test="openId != null">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!