seller, product service updated

parent 867d2c3e
...@@ -10,7 +10,9 @@ import java.io.BufferedReader; ...@@ -10,7 +10,9 @@ import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class ProductService { public class ProductService {
...@@ -84,4 +86,7 @@ public class ProductService { ...@@ -84,4 +86,7 @@ public class ProductService {
} }
return myProducts; return myProducts;
} }
Map<String, ProductDto> productMap = new HashMap<>();
List<ProductDto> productDtoList = (List<ProductDto>) productMap.values();
repository.saveAll(productDtoList);
} }
...@@ -33,6 +33,7 @@ public class SellerController { ...@@ -33,6 +33,7 @@ public class SellerController {
public ResponseEntity<?> getProductById(@PathVariable int id) { public ResponseEntity<?> getProductById(@PathVariable int id) {
ProductDto productDto = service.getProductById(id); ProductDto productDto = service.getProductById(id);
return ResponseEntity.ok(productDto); return ResponseEntity.ok(productDto);
} }
} }
...@@ -17,6 +17,9 @@ import java.nio.file.StandardOpenOption; ...@@ -17,6 +17,9 @@ import java.nio.file.StandardOpenOption;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.awt.SystemColor.text; import static java.awt.SystemColor.text;
...@@ -68,5 +71,6 @@ public class SellerService { ...@@ -68,5 +71,6 @@ public class SellerService {
finally { finally {
// bw.close(); // bw.close();
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment