Не знаю
This commit is contained in:
parent
82dcfd163c
commit
77ce0752c1
@ -7,6 +7,14 @@ plugins {
|
||||
id "de.undercouch.download" version '5.3.1'
|
||||
}
|
||||
|
||||
//task wrapper(type: Wrapper){
|
||||
// gradleVersion = '7.2'
|
||||
//}
|
||||
//
|
||||
//task prepareKotlinBuildScriptModel {
|
||||
//
|
||||
//}
|
||||
|
||||
node {
|
||||
version = '18.15.0'
|
||||
download = true
|
||||
|
BIN
front/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
front/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
front/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
front/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
4773
front/package-lock.json
generated
4773
front/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,14 +13,9 @@ import java.util.List;
|
||||
@RequestMapping("/order")
|
||||
public class OrderController {
|
||||
private final OrderService orderService;
|
||||
private final CustomerService customerService;
|
||||
private final TicketService ticketService;
|
||||
|
||||
public OrderController(OrderService orderService,
|
||||
CustomerService customerService, TicketService ticketService) {
|
||||
public OrderController(OrderService orderService) {
|
||||
this.orderService = orderService;
|
||||
this.customerService = customerService;
|
||||
this.ticketService = ticketService;
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ -35,23 +30,23 @@ public class OrderController {
|
||||
.toList();
|
||||
}
|
||||
|
||||
@PostMapping("/post")
|
||||
public OrderDto createOrder(@RequestParam("post") String post) {
|
||||
return new OrderDto(orderService.addOrder());
|
||||
@PostMapping
|
||||
public OrderDto createOrder(@RequestParam("customer") Long customer) {
|
||||
return new OrderDto(orderService.addOrder(customer));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/updcustomer")
|
||||
/*@PutMapping("/{id}/updcustomer")
|
||||
public OrderDto updateOrderCustomer(@PathVariable Long id,
|
||||
@RequestParam("customer") Long customer) {
|
||||
return new OrderDto(orderService.addCustomer(id, customer));
|
||||
}
|
||||
}*/
|
||||
|
||||
@PutMapping("/{id}/updticket")
|
||||
/*@PutMapping("/{id}/updticket")
|
||||
public OrderDto updateOrder(@PathVariable Long id,
|
||||
@RequestParam("ticket") String ticket) {
|
||||
return new OrderDto(orderService.addTicket(id,
|
||||
ticketService.findTicket(Long.parseLong(ticket))));
|
||||
}
|
||||
}*/
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public OrderDto deleteOrder(@PathVariable Long id) {
|
||||
|
@ -32,19 +32,27 @@ public class OrderService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Order addOrder() {
|
||||
public Order addOrder(Long customer_id) {
|
||||
final Order order = new Order(new Date(System.currentTimeMillis()));
|
||||
final Customer customer = findCustomer(customer_id);
|
||||
order.setCustomer(customer);
|
||||
validatorUtil.validate(order);
|
||||
return orderRepository.save(order);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
/*@Transactional
|
||||
public Order addCustomer(Long id, Long customer_id) {
|
||||
final Order order = findOrder(id);
|
||||
final Customer customer = customerRepository.findById(customer_id).get();
|
||||
order.setCustomer(customer);
|
||||
validatorUtil.validate(order);
|
||||
return order;
|
||||
}*/
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
Customer findCustomer(Long customer_id) {
|
||||
final Optional<Customer> customer = customerRepository.findById(customer_id);
|
||||
return customer.orElseThrow(() -> new CustomerNotFoundException(customer_id));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
Loading…
Reference in New Issue
Block a user