From 83a1769ebe19d0d5d16ba353cb8369a852e9be6a Mon Sep 17 00:00:00 2001 From: Aug <17674666882@163.com> Date: Fri, 26 Sep 2025 11:41:38 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=BB=9F=E8=AE=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/exhibitController/ConfigController.java | 7 +++ .../jeecg/modules/api/service/ConfigService.java | 3 + .../api/service/impl/ConfigServiceImpl.java | 70 +++++++++++++++++++++- 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/exhibitController/ConfigController.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/exhibitController/ConfigController.java index 6c4cc98..f1a4509 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/exhibitController/ConfigController.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/exhibitController/ConfigController.java @@ -66,4 +66,11 @@ public class ConfigController { return configService.queryMalfunctionDescList(pageBean); } + //数量统计接口 + @ApiOperation(value="配置-数量统计", notes="配置-数量统计") + @RequestMapping(value = "/queryCount", method = {RequestMethod.GET}) + public Result queryCount(){ + return configService.queryCount(); + } + } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java index 49ff2d1..2786eb8 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/ConfigService.java @@ -27,4 +27,7 @@ public interface ConfigService { //配置-查看常见故障情况 public Result queryMalfunctionDescList(PageBean pageBean); + //数量统计接口 + public Result queryCount(); + } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java index a47b9ec..5104820 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/ConfigServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.api.service.impl; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; @@ -16,11 +17,19 @@ import org.jeecg.modules.exhibitConfig.entity.ExhibitConfig; import org.jeecg.modules.exhibitConfig.service.IExhibitConfigService; import org.jeecg.modules.exhibitDepartment.entity.ExhibitDepartment; import org.jeecg.modules.exhibitDepartment.service.IExhibitDepartmentService; +import org.jeecg.modules.exhibitMaintenance.service.IExhibitMaintenanceService; +import org.jeecg.modules.exhibitMalfunction.entity.ExhibitMalfunction; +import org.jeecg.modules.exhibitMalfunction.service.IExhibitMalfunctionService; import org.jeecg.modules.exhibitMalfunctionDesc.entity.ExhibitMalfunctionDesc; import org.jeecg.modules.exhibitMalfunctionDesc.service.IExhibitMalfunctionDescService; +import org.jeecg.modules.exhibitRepair.service.IExhibitRepairService; +import org.jeecg.modules.exhibitShowpiece.service.IExhibitShowpieceService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @Service @Slf4j @@ -39,9 +48,21 @@ public class ConfigServiceImpl implements ConfigService { //展品分类列表 @Resource private IExhibitCategoryService exhibitCategoryService; - //展品分类列表 + //展品信息 + @Resource + private IExhibitShowpieceService exhibitShowpieceService; + //常见故障列表 @Resource private IExhibitMalfunctionDescService exhibitMalfunctionDescService; + //报修单信息 + @Resource + private IExhibitMalfunctionService exhibitMalfunctionService; + //维修单信息 + @Resource + private IExhibitRepairService exhibitRepairService; + //保养单信息 + @Resource + private IExhibitMaintenanceService exhibitMaintenanceService; /******************************************************************************************************************/ //配置-查看轮播图列表 @@ -252,4 +273,51 @@ public class ConfigServiceImpl implements ConfigService { } } + @Override + public Result queryCount() { + log.info("开始查询统计信息"); + //返回信息 + String massege = ""; + Map map = new HashMap<>(); + + try{ + //展品数量 + long showpieceNum = exhibitShowpieceService.count(); + map.put("showpieceNum", showpieceNum); + + //维护中的数量 + long repairingNum = exhibitMalfunctionService.lambdaQuery().notIn(ExhibitMalfunction::getStatus, "2").count(); + map.put("repairingNum", repairingNum); + + //无法使用数量 + long cannotUseNum = exhibitMalfunctionService.lambdaQuery().notIn(ExhibitMalfunction::getStatus, "2").eq(ExhibitMalfunction::getIsAffectUse, "1").count(); + map.put("cannotUseNum", cannotUseNum); + + //完好率 + double undamaged = (showpieceNum - repairingNum) * 1.0 / showpieceNum; + String undamagedRate = String.format("%.2f", undamaged * 100) + "%"; + map.put("undamagedRate", undamagedRate); + + //维修率(暂不处理) + + //维修次数 + long repairedNum = exhibitMalfunctionService.count(); + map.put("repairedNum", repairedNum); + + //保养次数 + long maintenancedNum = exhibitMaintenanceService.count(); + map.put("maintenancedNum", maintenancedNum); + + //维修次数最多的展品 + + + log.info("统计信息查询结束"); + return Result.OK("统计信息", map); + }catch (Exception e){ + log.error("统计信息查询失败"); + e.printStackTrace(); + return Result.error("统计信息查询失败"); + } + } + }