From 8203359e4e68775b3ce0e540837bf3332d970798 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 09 五月 2025 11:38:49 +0800 Subject: [PATCH] art: 设备管理-维修看板-维修工排名统计 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java | 82 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 74 insertions(+), 8 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java index 864c55b..3e184b8 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java @@ -1,27 +1,27 @@ package org.jeecg.modules.eam.controller; +import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; +import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.common.util.DateUtils; +import org.jeecg.common.util.TranslateDictTextUtils; import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; import org.jeecg.modules.eam.constant.EquipmentRepairStatus; import org.jeecg.modules.eam.entity.EamEquipment; -import org.jeecg.modules.eam.service.IEamEquipmentService; -import org.jeecg.modules.eam.service.IEamInspectionOrderService; -import org.jeecg.modules.eam.service.IEamReportRepairService; -import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService; -import org.jeecg.modules.eam.vo.EquipmentInspectionStatistics; -import org.jeecg.modules.eam.vo.EquipmentMaintenanceStatistics; -import org.jeecg.modules.eam.vo.EquipmentRepairStatistics; -import org.jeecg.modules.eam.vo.EquipmentStatusStatistics; +import org.jeecg.modules.eam.service.*; +import org.jeecg.modules.eam.vo.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; import java.time.LocalDate; import java.util.*; @@ -38,6 +38,13 @@ private IEamInspectionOrderService inspectionOrderService; @Autowired private IEamWeekMaintenanceOrderService weekMaintenanceOrderService; + @Resource + private ObjectMapper objectMapper; + @Resource + private TranslateDictTextUtils translateDictTextUtils; + @Autowired + private IEamRepairOrderService repairOrderService; + @ApiOperation(value = "鐪嬫澘鎺ュ彛-缁翠繚鐘舵�佺粺璁�", notes = "鐪嬫澘鎺ュ彛-缁翠繚鐘舵�佺粺璁�") @GetMapping(value = "/equipmentStatusStatistics") @@ -151,4 +158,63 @@ resultList.sort(Comparator.comparing(EquipmentMaintenanceStatistics::getMonthStr)); return Result.ok(resultList); } + + @ApiOperation(value = "缁翠慨鐪嬫澘-缁翠慨鐘舵�佺粺璁�", notes = "缁翠慨鐪嬫澘-缁翠慨鐘舵�佺粺璁�") + @GetMapping(value = "/repairStatusStatistics") + public Result<?> repairStatusStatistics() { + EquipmentRepairStatusStatistics statistics = reportRepairService.repairStatusStatistics(); + return Result.OK(statistics); + } + + @ApiOperation(value = "缁翠慨鐪嬫澘-缁翠慨鍒楄〃", notes = "缁翠慨鐪嬫澘-缁翠慨鍒楄〃") + @GetMapping(value = "/repairList") + public Result<?> repairList() { + List<EquipmentRepairListVO> list = reportRepairService.repairList(); + if(CollectionUtil.isEmpty(list)) { + return Result.ok(Collections.emptyList()); + } + List<JSONObject> items = new ArrayList<>(); + try { + for(EquipmentRepairListVO vo : list) { + String json = objectMapper.writeValueAsString(vo); + JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); + translateDictTextUtils.translateField("reportOperator", vo.getReportOperator(), item, "sys_user,realname,username"); + translateDictTextUtils.translateField("repairOperator", vo.getRepairOperator(), item, "sys_user,realname,username"); + translateDictTextUtils.translateField("reportStatus", vo.getReportStatus(), item, "report_repair_status"); + translateDictTextUtils.translateField("orgId", vo.getOrgId(), item, "mdc_production,production_name,id"); + items.add(item); + } + return Result.OK(items); + }catch (Exception e) { + return Result.error("鏁版嵁杞瘧澶辫触锛�"); + } + } + + @ApiOperation(value = "缁翠慨鐪嬫澘-缁翠慨宸ユ帓鍚�", notes = "缁翠慨鐪嬫澘-缁翠慨宸ユ帓鍚�") + @GetMapping(value = "/repairmanRanking") + public Result<?> repairmanRanking() { + LocalDate today = LocalDate.now(); + LocalDate end = today.plusDays(1); + LocalDate start = today.minusDays(30); + //鍙彇鍓�7鍚� + List<RepairmanRankingVO> list = repairOrderService.repairmanRanking(start.toString(), end.toString()); + if(CollectionUtil.isEmpty(list)) { + return Result.ok(Collections.emptyList()); + } + if(list.size() > 7) { + list = list.subList(0, 7); + } + List<JSONObject> items = new ArrayList<>(); + try { + for(RepairmanRankingVO vo : list) { + String json = objectMapper.writeValueAsString(vo); + JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); + translateDictTextUtils.translateField("repairer", vo.getRepairer(), item, "sys_user,realname,username"); + items.add(item); + } + return Result.OK(items); + }catch (Exception e) { + return Result.error("鏁版嵁杞瘧澶辫触锛�"); + } + } } -- Gitblit v1.9.3