From 1a2258c4eca2e7514b6096004fa1c3e0036b402b Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期四, 28 三月 2024 14:04:24 +0800 Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java | 91 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 89 insertions(+), 2 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java index 901b846..970f4fb 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java @@ -11,6 +11,7 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.constant.MdcConstant; import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.service.IMdcHomeService; import org.jeecg.modules.mdc.vo.MdcCommonVo; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.service.IMdcProductionService; @@ -19,7 +20,9 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @author Lius @@ -38,9 +41,41 @@ @Resource private IMdcProductionService mdcProductionService; + @Resource + private IMdcHomeService mdcHomeService; + @ApiOperation(value = "MDC棣栭〉鎺ュ彛-璁惧杩愯鐘舵�佺粺璁�", notes = "MDC棣栭〉鎺ュ彛-璁惧杩愯鐘舵�佺粺璁�") @GetMapping("/equipmentStatusStatistics") public Result<?> equipmentStatusStatistics(String productionCode) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Integer userType = user.getUserType(); + String userId = user.getId(); + String key = ""; + if (StringUtils.isNotBlank(productionCode)) { + //鍘傚尯/宸ユ + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); + key = mdcProduction.getId(); + } else { + //鍒ゆ柇鏄叕鍙哥骇杩樻槸鍘傚尯 + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); + if (userType.equals(MdcConstant.USER_TYPE_4)) { + //鍏徃 + key = mdcProduction.getId(); + } else if (userType.equals(MdcConstant.USER_TYPE_3)) { + //鍘傚尯 + key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); + } + } + List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(userId, key); + Map<String, Object> map = new HashMap<>(); + map.put("list", resultMap); + map.put("producitonId", key); + return Result.OK(map); + } + + @ApiOperation(value = "MDC棣栭〉鎺ュ彛-璁惧鍒╃敤鐜囩粺璁�(鏄ㄦ棩)", notes = "MDC棣栭〉鎺ュ彛-璁惧杩愯鐘舵�佺粺璁�(鏄ㄦ棩)") + @GetMapping("/equipmentUtilizationStatistics") + public Result<?> equipmentUtilizationStatistics(String productionCode) { LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); Integer userType = user.getUserType(); String userId = user.getId(); @@ -60,7 +95,59 @@ key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); } } - List<MdcCommonVo> resultMap = mdcEquipmentService.getEquipmentStatusStatistics(userId, key); - return Result.OK(resultMap); + List<MdcCommonVo> result = mdcHomeService.getEquipmentUtilizationStatistics(userId, key); + return Result.OK(result); + } + + @ApiOperation(value = "MDC棣栭〉鎺ュ彛-璁惧OEE缁熻(涓婃湀)", notes = "MDC棣栭〉鎺ュ彛-璁惧OEE缁熻(涓婃湀)") + @GetMapping("/equipmentOEEStatistics") + public Result<?> equipmentOEEStatistics(String productionCode) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Integer userType = user.getUserType(); + String userId = user.getId(); + String key = ""; + if (StringUtils.isNotBlank(productionCode)) { + //鍘傚尯 + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); + key = mdcProduction.getId(); + } else { + //鍒ゆ柇鏄叕鍙哥骇杩樻槸鍘傚尯 + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); + if (userType.equals(MdcConstant.USER_TYPE_4)) { + //鍏徃 + key = mdcProduction.getId(); + } else if (userType.equals(MdcConstant.USER_TYPE_3)) { + //鍘傚尯 + key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); + } + } + List<MdcCommonVo> result = mdcHomeService.getEquipmentOeeStatistics(userId, key); + return Result.OK(result); + } + + @ApiOperation(value = "MDC棣栭〉鎺ュ彛-璁惧OEE鍜屽埄鐢ㄧ巼缁熻鏌辩姸鍥�", notes = "MDC棣栭〉鎺ュ彛-璁惧OEE鍜屽埄鐢ㄧ巼缁熻鏌辩姸鍥�") + @GetMapping("/equipmentMonthStatistics") + public Result<?> equipmentMonthStatistics(String productionCode) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Integer userType = user.getUserType(); + String userId = user.getId(); + String key = ""; + if (StringUtils.isNotBlank(productionCode)) { + //鍘傚尯 + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); + key = mdcProduction.getId(); + } else { + //鍒ゆ柇鏄叕鍙哥骇杩樻槸鍘傚尯 + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); + if (userType.equals(MdcConstant.USER_TYPE_4)) { + //鍏徃 + key = mdcProduction.getId(); + } else if (userType.equals(MdcConstant.USER_TYPE_3)) { + //鍘傚尯 + key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); + } + } + Map<String, Object> result = mdcHomeService.getEquipmentMonthStatistics(userId, key); + return Result.OK(result); } } -- Gitblit v1.9.3