fix desktop appointments

This commit is contained in:
2026-04-07 09:05:08 -06:00
parent dee517593c
commit d3563e1f75
4 changed files with 22 additions and 57 deletions

View File

@@ -2,11 +2,8 @@ package org.example.petshopdesktop.api.dto.appointment;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.List;
public class AppointmentRequest {
private List<Long> petIds;
private List<Long> customerPetIds;
private Long customerId;
private Long storeId;
private Long serviceId;
@@ -14,26 +11,11 @@ public class AppointmentRequest {
private LocalDate appointmentDate;
private LocalTime appointmentTime;
private String appointmentStatus;
private Long petId;
public AppointmentRequest() {
}
public List<Long> getPetIds() {
return petIds;
}
public void setPetIds(List<Long> petIds) {
this.petIds = petIds;
}
public List<Long> getCustomerPetIds() {
return customerPetIds;
}
public void setCustomerPetIds(List<Long> customerPetIds) {
this.customerPetIds = customerPetIds;
}
public Long getCustomerId() {
return customerId;
}
@@ -89,4 +71,12 @@ public class AppointmentRequest {
public void setAppointmentStatus(String appointmentStatus) {
this.appointmentStatus = appointmentStatus;
}
public Long getPetId() {
return petId;
}
public void setPetId(Long petId) {
this.petId = petId;
}
}

View File

@@ -10,16 +10,14 @@ public class AppointmentResponse {
private Long storeId;
private String storeName;
private Long serviceId;
private java.util.List<String> petNames;
private java.util.List<Long> petIds;
private java.util.List<String> customerPetNames;
private java.util.List<Long> customerPetIds;
private String serviceName;
private Long employeeId;
private String employeeName;
private LocalDate appointmentDate;
private LocalTime appointmentTime;
private String appointmentStatus;
private String petName;
private Long petId;
public AppointmentResponse() {
}
@@ -72,36 +70,20 @@ public class AppointmentResponse {
this.serviceId = serviceId;
}
public java.util.List<String> getPetNames() {
return petNames;
public String getPetName() {
return petName;
}
public void setPetNames(java.util.List<String> petNames) {
this.petNames = petNames;
public void setPetName(String petName) {
this.petName = petName;
}
public java.util.List<Long> getPetIds() {
return petIds;
public Long getPetId() {
return petId;
}
public void setPetIds(java.util.List<Long> petIds) {
this.petIds = petIds;
}
public java.util.List<String> getCustomerPetNames() {
return customerPetNames;
}
public void setCustomerPetNames(java.util.List<String> customerPetNames) {
this.customerPetNames = customerPetNames;
}
public java.util.List<Long> getCustomerPetIds() {
return customerPetIds;
}
public void setCustomerPetIds(java.util.List<Long> customerPetIds) {
this.customerPetIds = customerPetIds;
public void setPetId(Long petId) {
this.petId = petId;
}
public String getServiceName() {

View File

@@ -231,18 +231,12 @@ public class AppointmentController {
}
private AppointmentDTO mapToAppointmentDTO(AppointmentResponse response) {
Long petId = response.getCustomerPetIds() != null && !response.getCustomerPetIds().isEmpty()
? response.getCustomerPetIds().get(0)
: response.getPetIds() != null && !response.getPetIds().isEmpty() ? response.getPetIds().get(0) : null;
String petName = response.getCustomerPetNames() != null && !response.getCustomerPetNames().isEmpty()
? String.join(", ", response.getCustomerPetNames())
: String.join(", ", response.getPetNames());
return new AppointmentDTO(
response.getAppointmentId().intValue(),
response.getCustomerId() != null ? response.getCustomerId().intValue() : 0,
response.getCustomerName(),
petId != null ? petId.intValue() : 0,
petName,
response.getPetId() != null ? response.getPetId().intValue() : 0,
response.getPetName(),
response.getServiceId() != null ? response.getServiceId().intValue() : 0,
response.getServiceName(),
response.getEmployeeId() != null ? response.getEmployeeId().intValue() : 0,

View File

@@ -21,7 +21,6 @@ import org.example.petshopdesktop.util.ActivityLogger;
import java.time.LocalTime;
import java.time.LocalDate;
import java.util.List;
import java.util.Collections;
import java.util.Objects;
public class AppointmentDialogController {
@@ -215,7 +214,7 @@ public class AppointmentDialogController {
}
AppointmentRequest request = new AppointmentRequest();
request.setCustomerPetIds(Collections.singletonList(cbPet.getValue().getId()));
request.setPetId(cbPet.getValue().getId());
request.setCustomerId(cbCustomer.getValue().getId());
request.setStoreId(storeId);
request.setServiceId(cbService.getValue().getId());