首页数据
This commit is contained in:
@ -1,17 +1,16 @@
|
||||
package com.fuyuanshen.web.controller.device;
|
||||
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.equipment.domain.vo.AlarmInformationVo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DataOverviewVo;
|
||||
import com.fuyuanshen.equipment.domain.vo.EquipmentClassificationVo;
|
||||
import com.fuyuanshen.equipment.service.DeviceService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
@ -39,29 +38,36 @@ public class HomePageController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 获取设备使用数据
|
||||
@GetMapping("/{deviceId}")
|
||||
public Map<String, Object> getUsageData(
|
||||
@PathVariable String deviceId,
|
||||
@RequestParam String range) {
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
if ("halfYear".equals(range)) {
|
||||
response.put("months", Arrays.asList("1月", "2月", "3月", "4月", "5月", "6月"));
|
||||
response.put("data", Arrays.asList(45, 52, 38, 60, 56, 48));
|
||||
} else if ("oneYear".equals(range)) {
|
||||
response.put("months", Arrays.asList("7月", "8月", "9月", "10月", "11月", "12月",
|
||||
"1月", "2月", "3月", "4月", "5月", "6月"));
|
||||
response.put("data", Arrays.asList(42, 38, 45, 48, 52, 55, 45, 52, 38, 60, 56, 48));
|
||||
}
|
||||
|
||||
response.put("deviceId", deviceId);
|
||||
response.put("range", range);
|
||||
response.put("lastUpdate", new Date());
|
||||
|
||||
return response;
|
||||
/**
|
||||
* 获取 设备分类
|
||||
* DataOverview
|
||||
*/
|
||||
@GetMapping("/getEquipmentClassification")
|
||||
public R<EquipmentClassificationVo> getEquipmentClassification() {
|
||||
return R.ok(deviceService.getEquipmentClassification());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取 报警信息
|
||||
* DataOverview
|
||||
*/
|
||||
@GetMapping("/getAlarmInformation")
|
||||
public R<AlarmInformationVo> getAlarmInformation() {
|
||||
return R.ok(deviceService.getAlarmInformation());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取设备使用数据
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param range 时间范围 1:半年 2:一年
|
||||
* @return 每月使用数据列表
|
||||
*/
|
||||
@GetMapping("/getEquipmentUsageData/{deviceId}/{range}")
|
||||
public R<List<Map<String, Object>>> getEquipmentUsageData(@PathVariable Long deviceId, @PathVariable Integer range) {
|
||||
return R.ok(deviceService.getEquipmentUsageData(deviceId, range));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user