首页数据
This commit is contained in:
@ -1,27 +1,27 @@
|
||||
package com.fuyuanshen.web.controller.device;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备分组
|
||||
@ -51,6 +51,24 @@ public class DeviceGroupController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询设备分组列表(分页)
|
||||
*/
|
||||
@Operation(summary = "查询设备分组列表(分页)")
|
||||
@SaCheckPermission("fys-equipment:group:list")
|
||||
@GetMapping("/listPage")
|
||||
public TableDataInfo<DeviceGroupVo> listPage(DeviceGroupBo bo) {
|
||||
List<DeviceGroupVo> list = deviceGroupService.queryList(bo);
|
||||
// return R.ok(list);
|
||||
return null;
|
||||
}
|
||||
|
||||
// @GetMapping("/list")
|
||||
// public TableDataInfo<DeviceAlarmVo> list(DeviceAlarmBo bo, PageQuery pageQuery) {
|
||||
// return deviceAlarmService.queryPageList(bo, pageQuery);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 导出设备分组列表
|
||||
*/
|
||||
@ -110,7 +128,7 @@ public class DeviceGroupController extends BaseController {
|
||||
@SaCheckPermission("fys-equipment:group:remove")
|
||||
@Log(title = "设备分组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||
public R<Void> remove(@NotNull(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||
return toAjax(deviceGroupService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
@ -124,11 +142,25 @@ public class DeviceGroupController extends BaseController {
|
||||
@Operation(summary = "绑定设备分组")
|
||||
// @SaCheckPermission("fys-equipment:group:remove")
|
||||
@Log(title = "绑定设备分组", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/groupId/{deviceId}")
|
||||
public R<Void> bindingDevice(@NotEmpty(message = "分组id 不能为空") @PathVariable Long groupId,
|
||||
@NotEmpty(message = "设备id 不能为空") @PathVariable Long[] deviceId) {
|
||||
@GetMapping("/groupId/{groupId}/{deviceId}")
|
||||
public R<Void> bindingDevice(@NotNull(message = "分组id 不能为空") @PathVariable Long groupId,
|
||||
@NotNull(message = "设备id 不能为空") @PathVariable Long[] deviceId) {
|
||||
return toAjax(deviceGroupService.bindingDevice(groupId, deviceId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解绑设备分组
|
||||
*
|
||||
* @param deviceId 设备id
|
||||
*/
|
||||
@Operation(summary = "解绑设备分组")
|
||||
// @SaCheckPermission("fys-equipment:group:remove")
|
||||
@Log(title = "解绑设备分组", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/groupUnbind/{deviceId}")
|
||||
public R<Void> groupUnbind(@NotNull(message = "设备id 不能为空") @PathVariable Long[] deviceId) {
|
||||
return toAjax(deviceGroupService.groupUnbind(deviceId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,67 @@
|
||||
package com.fuyuanshen.web.controller.device;
|
||||
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.equipment.domain.vo.DataOverviewVo;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
*
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-09-0113:46
|
||||
*/
|
||||
@Tag(name = "首页数据", description = "首页数据")
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/api/device/homepage")
|
||||
public class HomePageController {
|
||||
|
||||
private final DeviceService deviceService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取 数据总览
|
||||
* DataOverview
|
||||
*/
|
||||
@GetMapping("/getDataOverview")
|
||||
public R<DataOverviewVo> getDataOverview() {
|
||||
return R.ok(deviceService.getDataOverview());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 获取设备使用数据
|
||||
@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;
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@ public class WEBDeviceController extends BaseController {
|
||||
*/
|
||||
@Operation(summary = "设备详情")
|
||||
@GetMapping(value = "/pc/detail/{id}")
|
||||
public R<WebDeviceVo> getDevice(@PathVariable Long id) {
|
||||
public R<WebDeviceVo> getDeviceDetail(@PathVariable Long id) {
|
||||
WebDeviceVo device = deviceService.getDevice(id);
|
||||
return R.ok(device);
|
||||
}
|
||||
@ -101,7 +101,6 @@ public class WEBDeviceController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,7 +382,7 @@ public class DeviceBizService {
|
||||
detailVo.setDeviceName(device.getDeviceName());
|
||||
detailVo.setStartLocation(entry.getValue().get(0).getString("address"));
|
||||
detailVo.setEndLocation(entry.getValue().get(entry.getValue().size()-1).getString("address"));
|
||||
detailVo.setDetailList(entry.getValue());
|
||||
// detailVo.setDetailList(entry.getValue());
|
||||
result.add(detailVo);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user