package com.rj.tools; import com.rj.pojo.Reservation; import com.rj.service.IReservationService; import dev.langchain4j.agent.tool.P; import dev.langchain4j.agent.tool.Tool; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.time.LocalDateTime; /** * Author: 李中华 wx: spllzh email(qq): 28668817@qq.com * Date: 2025/8/5 20:36 **/ @Component public class ReservationTool { @Autowired private IReservationService reservationService; @Tool("根据手机号查询志愿填报预约信息") public String getReservationsByPhone(String phone) { return reservationService.getReservationsByPhone(phone).toString(); } @Tool("保存志愿填报预约信息") public String saveReservation(String name , @P("考生姓名") String gender , @P("考生手机号")String phone , @P("考生手省份")String province , @P("考生预约时间,格式为:yyy-MM-dd'T' HH:mm") String datetime) { Reservation reservation = new Reservation(); reservation.setName(name); reservation.setGender(gender); reservation.setPhone(phone); reservation.setProvince(province); reservation.setDatetime(LocalDateTime.parse(datetime)); return reservationService.saveReservation(reservation) ? "保存成功" : "保存失败"; } }