|
|
@@ -1,6 +1,7 @@ |
|
|
package com.ffii.fpsms.modules.usage.web; |
|
|
package com.ffii.fpsms.modules.usage.web; |
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.time.LocalDate; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@@ -11,6 +12,7 @@ import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
@@ -91,12 +93,17 @@ public class FeatureUsageLogController { |
|
|
|
|
|
|
|
|
@GetMapping("/summary") |
|
|
@GetMapping("/summary") |
|
|
@PreAuthorize("hasAnyAuthority('TESTING','ADMIN')") |
|
|
@PreAuthorize("hasAnyAuthority('TESTING','ADMIN')") |
|
|
public DataRes<Map<String, List<Map<String, Object>>>> summary() { |
|
|
|
|
|
|
|
|
public DataRes<Map<String, List<Map<String, Object>>>> summary( |
|
|
|
|
|
@RequestParam(value = "startDate", required = false) LocalDate startDate, |
|
|
|
|
|
@RequestParam(value = "endDate", required = false) LocalDate endDate) { |
|
|
|
|
|
if (startDate != null && endDate != null && startDate.isAfter(endDate)) { |
|
|
|
|
|
throw new BadRequestException("startDate must be earlier than or equal to endDate"); |
|
|
|
|
|
} |
|
|
Map<String, List<Map<String, Object>>> data = new HashMap<>(2); |
|
|
Map<String, List<Map<String, Object>>> data = new HashMap<>(2); |
|
|
data.put("reportManagement", |
|
|
data.put("reportManagement", |
|
|
featureUsageLogService.summarizeByFeature(FeatureUsageLogService.FEATURE_REPORT_MANAGEMENT)); |
|
|
|
|
|
|
|
|
featureUsageLogService.summarizeByFeature(FeatureUsageLogService.FEATURE_REPORT_MANAGEMENT, startDate, endDate)); |
|
|
data.put("truckRoutingSummary", |
|
|
data.put("truckRoutingSummary", |
|
|
featureUsageLogService.summarizeByFeature(FeatureUsageLogService.FEATURE_TRUCK_ROUTING_SUMMARY)); |
|
|
|
|
|
|
|
|
featureUsageLogService.summarizeByFeature(FeatureUsageLogService.FEATURE_TRUCK_ROUTING_SUMMARY, startDate, endDate)); |
|
|
return new DataRes<>(data); |
|
|
return new DataRes<>(data); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|