From 55be07a4bd6b7b176014882fb480a90b66444ad5 Mon Sep 17 00:00:00 2001 From: syruan <15555146157@163.com> Date: Wed, 23 Jul 2025 22:08:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=88=A9=E7=94=A8=E7=8E=87=E5=88=86=E6=9E=90=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=92=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增资源利用率分析相关的 VO、DTO、Mapper、Service 等类 - 实现资源利用率概览、详细信息、趋势分析、分布分析、优化建议等功能 - 添加实时资源状态相关接口和功能 --- .../screen/controller/ResourceController.java | 70 ++++ .../screen/dto/ResourceQueryDto.java | 49 +++ .../screen/mapper/ResourceMapper.java | 88 +++++ .../screen/service/ResourceService.java | 61 ++++ .../service/impl/ResourceServiceImpl.java | 316 ++++++++++++++++++ .../screen/vo/OptimizationSuggestionVo.java | 43 +++ .../screen/vo/RealtimeResourceVo.java | 59 ++++ .../screen/vo/ResourceDetailVo.java | 40 +++ .../screen/vo/ResourceDistributionVo.java | 25 ++ .../screen/vo/ResourceOverviewVo.java | 53 +++ .../screen/vo/ResourceTrendVo.java | 25 ++ .../resources/mapper/ResourceMapperBack.xml | 232 +++++++++++++ 12 files changed, 1061 insertions(+) create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ResourceController.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/dto/ResourceQueryDto.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/ResourceMapper.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/ResourceService.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ResourceServiceImpl.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/OptimizationSuggestionVo.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/RealtimeResourceVo.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDetailVo.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDistributionVo.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceOverviewVo.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceTrendVo.java create mode 100644 securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ResourceMapperBack.xml diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ResourceController.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ResourceController.java new file mode 100644 index 0000000..64ad809 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ResourceController.java @@ -0,0 +1,70 @@ +package com.securitycontrol.screen.controller; + +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.common.log.annotation.Log; +import com.securitycontrol.common.log.enums.OperationType; +import com.securitycontrol.screen.dto.ResourceQueryDto; +import com.securitycontrol.screen.service.ResourceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 资源利用率分析控制器 + * + * @author syruan + */ +@Api(tags = "资源利用率分析") +@RestController +@RequestMapping("/api/resource") +public class ResourceController { + + @Resource + private ResourceService resourceService; + + @ApiOperation(value = "获取资源利用率概览") + @GetMapping("/overview") + @Log(title = "资源利用率分析", menu = "资源利用率分析->概览", grade = OperationType.QUERY_BUSINESS, details = "获取资源利用率概览数据", type = "业务日志") + public AjaxResult getResourceOverview(ResourceQueryDto dto) { + return resourceService.getResourceOverview(dto); + } + + @ApiOperation(value = "获取资源详细信息") + @GetMapping("/details") + @Log(title = "资源利用率分析", menu = "资源利用率分析->详细信息", grade = OperationType.QUERY_BUSINESS, details = "获取资源详细信息列表", type = "业务日志") + public AjaxResult getResourceDetails(ResourceQueryDto dto) { + return resourceService.getResourceDetails(dto); + } + + @ApiOperation(value = "获取资源利用率趋势") + @GetMapping("/trends") + @Log(title = "资源利用率分析", menu = "资源利用率分析->趋势分析", grade = OperationType.QUERY_BUSINESS, details = "获取资源利用率趋势数据", type = "业务日志") + public AjaxResult getResourceTrends(ResourceQueryDto dto) { + return resourceService.getResourceTrends(dto); + } + + @ApiOperation(value = "获取资源利用率分布") + @GetMapping("/distribution") + @Log(title = "资源利用率分析", menu = "资源利用率分析->分布分析", grade = OperationType.QUERY_BUSINESS, details = "获取资源利用率分布数据", type = "业务日志") + public AjaxResult getResourceDistribution(ResourceQueryDto dto) { + return resourceService.getResourceDistribution(dto); + } + + @ApiOperation(value = "获取优化建议") + @GetMapping("/suggestions") + @Log(title = "资源利用率分析", menu = "资源利用率分析->优化建议", grade = OperationType.QUERY_BUSINESS, details = "获取优化建议", type = "业务日志") + public AjaxResult getOptimizationSuggestions(ResourceQueryDto dto) { + return resourceService.getOptimizationSuggestions(dto); + } + + @ApiOperation(value = "获取实时资源状态") + @GetMapping("/realtime") + @Log(title = "资源利用率分析", menu = "资源利用率分析->实时状态", grade = OperationType.QUERY_BUSINESS, details = "获取实时资源状态", type = "业务日志") + public AjaxResult getRealtimeResourceStatus(ResourceQueryDto dto) { + return resourceService.getRealtimeResourceStatus(dto); + } +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/dto/ResourceQueryDto.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/dto/ResourceQueryDto.java new file mode 100644 index 0000000..5527014 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/dto/ResourceQueryDto.java @@ -0,0 +1,49 @@ +package com.securitycontrol.screen.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 资源利用率查询参数DTO + * + * @author system + * @date 2024-01-21 + */ +@Data +@ApiModel("资源利用率查询参数") +public class ResourceQueryDto { + + @ApiModelProperty("项目ID") + private String projectId; + + @ApiModelProperty("时间范围:today/week/month,默认today") + private String timeRange = "today"; + + @ApiModelProperty("资源类型:personnel/equipment/material/energy,不传则返回全部") + private String resourceType; + + @ApiModelProperty("页码,默认1") + private Integer page = 1; + + @ApiModelProperty("每页数量,默认20") + private Integer pageSize = 20; + + @ApiModelProperty("开始日期,格式:YYYY-MM-DD") + private String startDate; + + @ApiModelProperty("结束日期,格式:YYYY-MM-DD") + private String endDate; + + @ApiModelProperty("时间粒度:hour/day/week,默认day") + private String granularity = "day"; + + @ApiModelProperty("指定日期,格式:YYYY-MM-DD,默认今天") + private String date; + + @ApiModelProperty("返回建议数量,默认5") + private Integer limit = 5; + + @ApiModelProperty("上次更新时间,用于增量更新") + private String lastUpdateTime; +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/ResourceMapper.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/ResourceMapper.java new file mode 100644 index 0000000..b8c137d --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/ResourceMapper.java @@ -0,0 +1,88 @@ +package com.securitycontrol.screen.mapper; + +import com.securitycontrol.screen.dto.ResourceQueryDto; +import com.securitycontrol.screen.vo.OptimizationSuggestionVo; +import com.securitycontrol.screen.vo.RealtimeResourceVo; +import com.securitycontrol.screen.vo.ResourceDetailVo; +import com.securitycontrol.screen.vo.ResourceDistributionVo; +import org.apache.ibatis.annotations.MapKey; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +/** + * 资源利用率分析数据访问层接口 + * + * @author system + * @date 2024-01-21 + */ +@Repository +public interface ResourceMapper { + + /** + * 获取总体统计数据 + * + * @param dto 查询参数 + * @return 统计数据 + */ + Map getOverallStats(ResourceQueryDto dto); + + /** + * 获取各类资源概览 + * + * @param dto 查询参数 + * @return 资源概览列表 + */ + @MapKey("type") + List> getResourceOverview(ResourceQueryDto dto); + + /** + * 获取资源详细信息 + * + * @param dto 查询参数 + * @return 资源详细信息列表 + */ + List getResourceDetails(ResourceQueryDto dto); + + /** + * 获取资源详细信息总数 + * + * @param dto 查询参数 + * @return 总数 + */ + int getResourceDetailsCount(ResourceQueryDto dto); + + /** + * 获取资源利用率趋势数据 + * + * @param dto 查询参数 + * @return 趋势数据 + */ + @MapKey("date") + List> getResourceTrends(ResourceQueryDto dto); + + /** + * 获取资源利用率分布数据 + * + * @param dto 查询参数 + * @return 分布数据 + */ + List getResourceDistribution(ResourceQueryDto dto); + + /** + * 获取优化建议 + * + * @param dto 查询参数 + * @return 优化建议列表 + */ + List getOptimizationSuggestions(ResourceQueryDto dto); + + /** + * 获取变化的资源 + * + * @param dto 查询参数 + * @return 变化的资源列表 + */ + List getChangedResources(ResourceQueryDto dto); +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/ResourceService.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/ResourceService.java new file mode 100644 index 0000000..905a024 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/ResourceService.java @@ -0,0 +1,61 @@ +package com.securitycontrol.screen.service; + +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.screen.dto.ResourceQueryDto; + +/** + * 资源利用率分析业务层接口 + * + * @author system + * @date 2024-01-21 + */ +public interface ResourceService { + + /** + * 获取资源利用率概览 + * + * @param dto 查询参数 + * @return 概览数据 + */ + AjaxResult getResourceOverview(ResourceQueryDto dto); + + /** + * 获取资源详细信息 + * + * @param dto 查询参数 + * @return 资源详细信息列表 + */ + AjaxResult getResourceDetails(ResourceQueryDto dto); + + /** + * 获取资源利用率趋势 + * + * @param dto 查询参数 + * @return 趋势数据 + */ + AjaxResult getResourceTrends(ResourceQueryDto dto); + + /** + * 获取资源利用率分布 + * + * @param dto 查询参数 + * @return 分布数据 + */ + AjaxResult getResourceDistribution(ResourceQueryDto dto); + + /** + * 获取优化建议 + * + * @param dto 查询参数 + * @return 优化建议列表 + */ + AjaxResult getOptimizationSuggestions(ResourceQueryDto dto); + + /** + * 获取实时资源状态 + * + * @param dto 查询参数 + * @return 实时状态数据 + */ + AjaxResult getRealtimeResourceStatus(ResourceQueryDto dto); +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ResourceServiceImpl.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ResourceServiceImpl.java new file mode 100644 index 0000000..4649361 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ResourceServiceImpl.java @@ -0,0 +1,316 @@ +package com.securitycontrol.screen.service.impl; + +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.screen.dto.ResourceQueryDto; +import com.securitycontrol.screen.mapper.ResourceMapper; +import com.securitycontrol.screen.service.ResourceService; +import com.securitycontrol.screen.vo.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 资源利用率分析业务层实现 + * + * @author system + * @date 2024-01-21 + */ +@Slf4j +@Service +public class ResourceServiceImpl implements ResourceService { + + @Resource + private ResourceMapper resourceMapper; + + @Override + public AjaxResult getResourceOverview(ResourceQueryDto dto) { + try { + // 验证必填参数 + if (!StringUtils.hasText(dto.getProjectId())) { + return AjaxResult.error("项目ID不能为空"); + } + + ResourceOverviewVo result = new ResourceOverviewVo(); + + // 获取总体统计数据 + Map overallData = resourceMapper.getOverallStats(dto); + ResourceOverviewVo.OverallStats overallStats = new ResourceOverviewVo.OverallStats(); + if (overallData != null) { + log.info("获取到的overallData: {}", overallData); + overallStats.setPersonnelRate(getDoubleValue(overallData.get("personnelRate"))); + overallStats.setEquipmentRate(getDoubleValue(overallData.get("equipmentRate"))); + overallStats.setMaterialRate(getDoubleValue(overallData.get("materialRate"))); + // 注意:OverallStats中没有energyRate字段,但我们可以在计算总体利用率时使用它 + Double energyRate = getDoubleValue(overallData.get("energyRate")); + + // 计算总体利用率 - 包含能源利用率 + double totalRate = (overallStats.getPersonnelRate() + overallStats.getEquipmentRate() + overallStats.getMaterialRate() + energyRate) / 4; + overallStats.setTotalRate(BigDecimal.valueOf(totalRate).setScale(1, RoundingMode.HALF_UP).doubleValue()); + } else { + log.warn("overallData为null"); + } + result.setOverallStats(overallStats); + + // 获取各类资源概览 + List> resourceList = resourceMapper.getResourceOverview(dto); + Map resourceOverview = new HashMap<>(); + + for (Map item : resourceList) { + ResourceOverviewVo.ResourceInfo info = new ResourceOverviewVo.ResourceInfo(); + info.setCount(getIntValue(item.get("count"))); + info.setRate(getDoubleValue(item.get("rate"))); + info.setStatus(getString(item.get("status"))); + + String type = getString(item.get("type")); + resourceOverview.put(type, info); + } + result.setResourceOverview(resourceOverview); + + return AjaxResult.success(result); + } catch (Exception e) { + e.printStackTrace(); + log.error("获取资源利用率概览失败", e); + return AjaxResult.error("获取数据失败"); + } + } + + @Override + public AjaxResult getResourceDetails(ResourceQueryDto dto) { + try { + if (!StringUtils.hasText(dto.getProjectId())) { + return AjaxResult.error("项目ID不能为空"); + } + + // 计算分页参数 + int offset = (dto.getPage() - 1) * dto.getPageSize(); + dto.setPage(offset); + + List list = resourceMapper.getResourceDetails(dto); + int total = resourceMapper.getResourceDetailsCount(dto); + + Map result = new HashMap<>(); + result.put("total", total); + result.put("list", list); + + return AjaxResult.success(result); + } catch (Exception e) { + log.error("获取资源详细信息失败", e); + return AjaxResult.error("获取数据失败"); + } + } + + @Override + public AjaxResult getResourceTrends(ResourceQueryDto dto) { + try { + if (!StringUtils.hasText(dto.getProjectId()) || + !StringUtils.hasText(dto.getStartDate()) || + !StringUtils.hasText(dto.getEndDate())) { + return AjaxResult.error("项目ID、开始日期和结束日期不能为空"); + } + + ResourceTrendVo result = new ResourceTrendVo(); + + // 生成日期列表 + List dates = generateDateList(dto.getStartDate(), dto.getEndDate(), dto.getGranularity()); + result.setDates(dates); + + // 获取趋势数据 + Map> trends = new HashMap<>(); + List> trendData = resourceMapper.getResourceTrends(dto); + + // 按日期和类型分组数据 + Map> dateTypeMap = trendData.stream() + .collect(Collectors.groupingBy( + item -> getString(item.get("date")), + Collectors.toMap( + item -> getString(item.get("type")), + item -> getDoubleValue(item.get("rate")) + ) + )); + + // 为每种资源类型生成完整的时间序列数据 + String[] resourceTypes = {"personnel", "equipment", "material", "energy"}; + for (String type : resourceTypes) { + List values = new ArrayList<>(); + for (String date : dates) { + Double value = dateTypeMap.getOrDefault(date, new HashMap<>()).get(type); + values.add(value != null ? value : 0.0); + } + trends.put(type, values); + } + result.setTrends(trends); + + return AjaxResult.success(result); + } catch (Exception e) { + log.error("获取资源利用率趋势失败", e); + return AjaxResult.error("获取数据失败"); + } + } + + @Override + public AjaxResult getResourceDistribution(ResourceQueryDto dto) { + try { + if (!StringUtils.hasText(dto.getProjectId())) { + return AjaxResult.error("项目ID不能为空"); + } + + // 如果没有指定日期,使用当前日期 + if (!StringUtils.hasText(dto.getDate())) { + dto.setDate(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + } + + List result = resourceMapper.getResourceDistribution(dto); + + // 设置颜色 + String[] colors = {"#16baaa", "#20d3c2", "#25e5d0", "#2af0dd"}; + for (int i = 0; i < result.size() && i < colors.length; i++) { + result.get(i).setColor(colors[i]); + } + + return AjaxResult.success(result); + } catch (Exception e) { + log.error("获取资源利用率分布失败", e); + return AjaxResult.error("获取数据失败"); + } + } + + @Override + public AjaxResult getOptimizationSuggestions(ResourceQueryDto dto) { + try { + if (!StringUtils.hasText(dto.getProjectId())) { + return AjaxResult.error("项目ID不能为空"); + } + + List suggestions = resourceMapper.getOptimizationSuggestions(dto); + + // 限制返回数量 + if (suggestions.size() > dto.getLimit()) { + suggestions = suggestions.subList(0, dto.getLimit()); + } + + return AjaxResult.success(suggestions); + } catch (Exception e) { + log.error("获取优化建议失败", e); + return AjaxResult.error("获取数据失败"); + } + } + + @Override + public AjaxResult getRealtimeResourceStatus(ResourceQueryDto dto) { + try { + if (!StringUtils.hasText(dto.getProjectId())) { + return AjaxResult.error("项目ID不能为空"); + } + + RealtimeResourceVo result = new RealtimeResourceVo(); + result.setUpdateTime(new Date().toString()); + + // 检查是否有更新 + boolean hasUpdate = true; // 这里可以根据lastUpdateTime判断 + result.setHasUpdate(hasUpdate); + + if (hasUpdate) { + RealtimeResourceVo.Updates updates = new RealtimeResourceVo.Updates(); + + // 获取最新的总体统计 + Map overallData = resourceMapper.getOverallStats(dto); + ResourceOverviewVo.OverallStats overallStats = new ResourceOverviewVo.OverallStats(); + if (overallData != null) { + overallStats.setPersonnelRate(getDoubleValue(overallData.get("personnelRate"))); + overallStats.setEquipmentRate(getDoubleValue(overallData.get("equipmentRate"))); + overallStats.setMaterialRate(getDoubleValue(overallData.get("materialRate"))); + + double totalRate = (overallStats.getPersonnelRate() + overallStats.getEquipmentRate() + overallStats.getMaterialRate()) / 3; + overallStats.setTotalRate(BigDecimal.valueOf(totalRate).setScale(1, RoundingMode.HALF_UP).doubleValue()); + } + updates.setOverallStats(overallStats); + + // 获取变化的资源 + List changedResources = resourceMapper.getChangedResources(dto); + updates.setChangedResources(changedResources); + + result.setUpdates(updates); + } + + return AjaxResult.success(result); + } catch (Exception e) { + log.error("获取实时资源状态失败", e); + return AjaxResult.error("获取数据失败"); + } + } + + /** + * 生成日期列表 + */ + private List generateDateList(String startDate, String endDate, String granularity) { + List dates = new ArrayList<>(); + LocalDate start = LocalDate.parse(startDate); + LocalDate end = LocalDate.parse(endDate); + + LocalDate current = start; + while (!current.isAfter(end)) { + dates.add(current.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + + switch (granularity) { + case "hour": + // 小时粒度暂时按天处理 + current = current.plusDays(1); + break; + case "week": + current = current.plusWeeks(1); + break; + case "day": + default: + current = current.plusDays(1); + break; + } + } + + return dates; + } + + /** + * 获取Double值,处理null情况 + */ + private Double getDoubleValue(Object value) { + if (value == null) return 0.0; + if (value instanceof Number) { + return ((Number) value).doubleValue(); + } + try { + return Double.parseDouble(value.toString()); + } catch (NumberFormatException e) { + return 0.0; + } + } + + /** + * 获取Integer值,处理null情况 + */ + private Integer getIntValue(Object value) { + if (value == null) return 0; + if (value instanceof Number) { + return ((Number) value).intValue(); + } + try { + return Integer.parseInt(value.toString()); + } catch (NumberFormatException e) { + return 0; + } + } + + /** + * 获取String值,处理null情况 + */ + private String getString(Object value) { + return value != null ? value.toString() : ""; + } +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/OptimizationSuggestionVo.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/OptimizationSuggestionVo.java new file mode 100644 index 0000000..5fdd3f6 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/OptimizationSuggestionVo.java @@ -0,0 +1,43 @@ +package com.securitycontrol.screen.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 优化建议VO + * + * @author system + * @date 2024-01-21 + */ +@Data +@ApiModel("优化建议") +public class OptimizationSuggestionVo { + + @ApiModelProperty("建议ID") + private String id; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("优先级") + private String priority; + + @ApiModelProperty("分类") + private String category; + + @ApiModelProperty("目标利用率") + private Double targetRate; + + @ApiModelProperty("当前利用率") + private Double currentRate; + + @ApiModelProperty("预估改进幅度") + private Double estimatedImprovement; + + @ApiModelProperty("创建时间") + private String createTime; +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/RealtimeResourceVo.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/RealtimeResourceVo.java new file mode 100644 index 0000000..fc432ec --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/RealtimeResourceVo.java @@ -0,0 +1,59 @@ +package com.securitycontrol.screen.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 实时资源状态VO + * + * @author system + * @date 2024-01-21 + */ +@Data +@ApiModel("实时资源状态") +public class RealtimeResourceVo { + + @ApiModelProperty("更新时间") + private String updateTime; + + @ApiModelProperty("是否有更新") + private Boolean hasUpdate; + + @ApiModelProperty("更新信息") + private Updates updates; + + @Data + @ApiModel("更新信息") + public static class Updates { + @ApiModelProperty("总体统计") + private ResourceOverviewVo.OverallStats overallStats; + + @ApiModelProperty("变化的资源") + private List changedResources; + } + + @Data + @ApiModel("变化的资源") + public static class ChangedResource { + @ApiModelProperty("资源ID") + private String id; + + @ApiModelProperty("资源类型") + private String type; + + @ApiModelProperty("资源名称") + private String name; + + @ApiModelProperty("旧利用率") + private Double oldRate; + + @ApiModelProperty("新利用率") + private Double newRate; + + @ApiModelProperty("变化类型") + private String changeType; + } +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDetailVo.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDetailVo.java new file mode 100644 index 0000000..cee01f9 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDetailVo.java @@ -0,0 +1,40 @@ +package com.securitycontrol.screen.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 资源详细信息VO + * + * @author system + * @date 2024-01-21 + */ +@Data +@ApiModel("资源详细信息") +public class ResourceDetailVo { + + @ApiModelProperty("资源ID") + private String id; + + @ApiModelProperty("资源类型") + private String type; + + @ApiModelProperty("资源名称") + private String name; + + @ApiModelProperty("状态") + private String status; + + @ApiModelProperty("利用率") + private Double rate; + + @ApiModelProperty("评估") + private String assessment; + + @ApiModelProperty("位置") + private String location; + + @ApiModelProperty("更新时间") + private String updateTime; +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDistributionVo.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDistributionVo.java new file mode 100644 index 0000000..2b6f067 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceDistributionVo.java @@ -0,0 +1,25 @@ +package com.securitycontrol.screen.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 资源利用率分布VO + * + * @author system + * @date 2024-01-21 + */ +@Data +@ApiModel("资源利用率分布") +public class ResourceDistributionVo { + + @ApiModelProperty("资源名称") + private String name; + + @ApiModelProperty("利用率值") + private Double value; + + @ApiModelProperty("颜色") + private String color; +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceOverviewVo.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceOverviewVo.java new file mode 100644 index 0000000..fb00479 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceOverviewVo.java @@ -0,0 +1,53 @@ +package com.securitycontrol.screen.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Map; + +/** + * 资源利用率概览VO + * + * @author system + * @date 2024-01-21 + */ +@Data +@ApiModel("资源利用率概览") +public class ResourceOverviewVo { + + @ApiModelProperty("总体统计") + private OverallStats overallStats; + + @ApiModelProperty("资源概览") + private Map resourceOverview; + + @Data + @ApiModel("总体统计") + public static class OverallStats { + @ApiModelProperty("总体利用率") + private Double totalRate; + + @ApiModelProperty("人员利用率") + private Double personnelRate; + + @ApiModelProperty("设备利用率") + private Double equipmentRate; + + @ApiModelProperty("材料利用率") + private Double materialRate; + } + + @Data + @ApiModel("资源信息") + public static class ResourceInfo { + @ApiModelProperty("数量") + private Integer count; + + @ApiModelProperty("利用率") + private Double rate; + + @ApiModelProperty("状态") + private String status; + } +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceTrendVo.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceTrendVo.java new file mode 100644 index 0000000..83d5db6 --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/vo/ResourceTrendVo.java @@ -0,0 +1,25 @@ +package com.securitycontrol.screen.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * 资源利用率趋势VO + * + * @author system + * @date 2024-01-21 + */ +@Data +@ApiModel("资源利用率趋势") +public class ResourceTrendVo { + + @ApiModelProperty("日期列表") + private List dates; + + @ApiModelProperty("趋势数据") + private Map> trends; +} \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ResourceMapperBack.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ResourceMapperBack.xml new file mode 100644 index 0000000..6f8921f --- /dev/null +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ResourceMapperBack.xml @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file