fix desktop appointments
This commit is contained in:
@@ -2,11 +2,8 @@ package org.example.petshopdesktop.api.dto.appointment;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AppointmentRequest {
|
public class AppointmentRequest {
|
||||||
private List<Long> petIds;
|
|
||||||
private List<Long> customerPetIds;
|
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
private Long serviceId;
|
private Long serviceId;
|
||||||
@@ -14,26 +11,11 @@ public class AppointmentRequest {
|
|||||||
private LocalDate appointmentDate;
|
private LocalDate appointmentDate;
|
||||||
private LocalTime appointmentTime;
|
private LocalTime appointmentTime;
|
||||||
private String appointmentStatus;
|
private String appointmentStatus;
|
||||||
|
private Long petId;
|
||||||
|
|
||||||
public AppointmentRequest() {
|
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() {
|
public Long getCustomerId() {
|
||||||
return customerId;
|
return customerId;
|
||||||
}
|
}
|
||||||
@@ -89,4 +71,12 @@ public class AppointmentRequest {
|
|||||||
public void setAppointmentStatus(String appointmentStatus) {
|
public void setAppointmentStatus(String appointmentStatus) {
|
||||||
this.appointmentStatus = appointmentStatus;
|
this.appointmentStatus = appointmentStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getPetId() {
|
||||||
|
return petId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPetId(Long petId) {
|
||||||
|
this.petId = petId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,14 @@ public class AppointmentResponse {
|
|||||||
private Long storeId;
|
private Long storeId;
|
||||||
private String storeName;
|
private String storeName;
|
||||||
private Long serviceId;
|
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 String serviceName;
|
||||||
private Long employeeId;
|
private Long employeeId;
|
||||||
private String employeeName;
|
private String employeeName;
|
||||||
private LocalDate appointmentDate;
|
private LocalDate appointmentDate;
|
||||||
private LocalTime appointmentTime;
|
private LocalTime appointmentTime;
|
||||||
private String appointmentStatus;
|
private String appointmentStatus;
|
||||||
|
private String petName;
|
||||||
|
private Long petId;
|
||||||
|
|
||||||
public AppointmentResponse() {
|
public AppointmentResponse() {
|
||||||
}
|
}
|
||||||
@@ -72,36 +70,20 @@ public class AppointmentResponse {
|
|||||||
this.serviceId = serviceId;
|
this.serviceId = serviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.util.List<String> getPetNames() {
|
public String getPetName() {
|
||||||
return petNames;
|
return petName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPetNames(java.util.List<String> petNames) {
|
public void setPetName(String petName) {
|
||||||
this.petNames = petNames;
|
this.petName = petName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.util.List<Long> getPetIds() {
|
public Long getPetId() {
|
||||||
return petIds;
|
return petId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPetIds(java.util.List<Long> petIds) {
|
public void setPetId(Long petId) {
|
||||||
this.petIds = petIds;
|
this.petId = petId;
|
||||||
}
|
|
||||||
|
|
||||||
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 String getServiceName() {
|
public String getServiceName() {
|
||||||
|
|||||||
@@ -231,18 +231,12 @@ public class AppointmentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private AppointmentDTO mapToAppointmentDTO(AppointmentResponse response) {
|
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(
|
return new AppointmentDTO(
|
||||||
response.getAppointmentId().intValue(),
|
response.getAppointmentId().intValue(),
|
||||||
response.getCustomerId() != null ? response.getCustomerId().intValue() : 0,
|
response.getCustomerId() != null ? response.getCustomerId().intValue() : 0,
|
||||||
response.getCustomerName(),
|
response.getCustomerName(),
|
||||||
petId != null ? petId.intValue() : 0,
|
response.getPetId() != null ? response.getPetId().intValue() : 0,
|
||||||
petName,
|
response.getPetName(),
|
||||||
response.getServiceId() != null ? response.getServiceId().intValue() : 0,
|
response.getServiceId() != null ? response.getServiceId().intValue() : 0,
|
||||||
response.getServiceName(),
|
response.getServiceName(),
|
||||||
response.getEmployeeId() != null ? response.getEmployeeId().intValue() : 0,
|
response.getEmployeeId() != null ? response.getEmployeeId().intValue() : 0,
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import org.example.petshopdesktop.util.ActivityLogger;
|
|||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class AppointmentDialogController {
|
public class AppointmentDialogController {
|
||||||
@@ -215,7 +214,7 @@ public class AppointmentDialogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AppointmentRequest request = new AppointmentRequest();
|
AppointmentRequest request = new AppointmentRequest();
|
||||||
request.setCustomerPetIds(Collections.singletonList(cbPet.getValue().getId()));
|
request.setPetId(cbPet.getValue().getId());
|
||||||
request.setCustomerId(cbCustomer.getValue().getId());
|
request.setCustomerId(cbCustomer.getValue().getId());
|
||||||
request.setStoreId(storeId);
|
request.setStoreId(storeId);
|
||||||
request.setServiceId(cbService.getValue().getId());
|
request.setServiceId(cbService.getValue().getId());
|
||||||
|
|||||||
Reference in New Issue
Block a user