| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | List<EngineeringSequence> list = engineeringSequenceService.list(); |
| | | List<Map<String, Object>> result = list.stream() |
| | | .map(seq -> { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("engineeringId", seq.getEngineeringId()); |
| | | map.put("date", seq.getDate()); |
| | | map.put("sequence", seq.getSequence()); |
| | | return map; |
| | | }) |
| | | .sorted(Comparator.comparing( |
| | | (Map<String, Object> map) -> (Date) map.get("date"), |
| | | Comparator.nullsLast(Comparator.reverseOrder()) |
| | | ).thenComparing( |
| | | map -> (Integer) map.get("sequence"), |
| | | Comparator.nullsLast(Comparator.reverseOrder()) |
| | | )) |
| | | .collect(Collectors.toList()); |
| | | return ResponseEntity.ok(result); |
| | | } catch (Exception e) { |