package me.zhengjie.modules.attendance.rabbit;
|
|
import com.alibaba.fastjson.JSON;
|
import me.zhengjie.modules.attendance.domain.AttendanceLeave;
|
import me.zhengjie.modules.attendance.service.AttendanceLeaveService;
|
import me.zhengjie.modules.constant.Constant;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Map;
|
|
@Component
|
@RabbitListener(queues = "attendance.attendanceLeaveApply")
|
public class AttendanceLeaveRabbit {
|
|
@Autowired
|
private AttendanceLeaveService attendanceLeaveService;
|
|
@RabbitHandler
|
public void process(Map<String, Object> message) throws Exception {
|
// Map 转 实体类
|
AttendanceLeave attendanceLeave = JSON.parseObject(JSON.toJSONString(message), AttendanceLeave.class);
|
attendanceLeave.setApprovalStatus(Constant.APPROVAL_STATUS_PASSED);
|
// 新增考勤请假
|
attendanceLeaveService.flowableCreate(attendanceLeave);
|
}
|
}
|