From c33eedaf999b84dd8377aba96d8aeeeba264b4f6 Mon Sep 17 00:00:00 2001
From: hyingbo <1363390067@qq.com>
Date: 星期二, 09 九月 2025 15:07:35 +0800
Subject: [PATCH] mdc首页功能迁移

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java |  128 +++++++-----------------------------------
 1 files changed, 22 insertions(+), 106 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 29867c9..fb7219c 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
@@ -14,7 +14,6 @@
 import org.jeecg.modules.mdc.entity.MdcEquipment;
 import org.jeecg.modules.mdc.entity.MdcFeedback;
 import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency;
-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.mdc.vo.MdcHomeEfficiencyVo;
@@ -42,139 +41,54 @@
 public class MdcHomeController {
 
     @Resource
-    private IMdcEquipmentService mdcEquipmentService;
-
-    @Resource
     private IMdcProductionService mdcProductionService;
 
     @Resource
     private IMdcHomeService mdcHomeService;
 
+    @ApiOperation(value = "MDC棣栭〉鎺ュ彛-鏌ヨ鎵�鏈夎溅闂�", notes = "MDC棣栭〉鎺ュ彛-鏌ヨ鎵�鏈夎溅闂�")
+    @GetMapping("/getAllWorkShop")
+    public Result<List<MdcProduction>> getAllWorkShop() {
+        return Result.OK(mdcHomeService.getAllWorkShop());
+    }
+
     @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());
-            } else if (userType.equals(MdcConstant.USER_TYPE_2)) {
-                //宸ユ 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勫伐娈垫潈闄�
-                key = mdcProductionService.findThreeProductionId(userId);
-            }
-        }
-        List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(userId, key);
+    public Result<?> equipmentStatusStatistics(String productionId) {
+        List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(productionId);
         Map<String, Object> map = new HashMap<>();
         map.put("list", resultMap);
-        map.put("productionId", 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();
-        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.getEquipmentUtilizationStatistics(userId, key);
+    public Result<?> equipmentUtilizationStatistics(String productionId) {
+        List<MdcCommonVo> result = mdcHomeService.getEquipmentUtilizationStatistics(productionId);
         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);
+    public Result<?> equipmentOEEStatistics(String productionId) {
+        List<MdcCommonVo> result = mdcHomeService.getEquipmentOeeStatistics(productionId);
         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);
+    public Result<?> equipmentMonthStatistics(String productionId) {
+        MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
+
+        String key = mdcProduction.getId();
+        Map<String, Object> result = mdcHomeService.getEquipmentMonthStatistics(productionId);
         return Result.OK(result);
     }
 
-    @ApiOperation(value = "MDC棣栭〉鎺ュ彛-宸ユ绾у墠涓冨ぉ鍒╃敤鐜囨姌绾垮浘", notes = "MDC棣栭〉鎺ュ彛-宸ユ绾у墠涓冨ぉ鍒╃敤鐜囨姌绾垮浘")
+    @ApiOperation(value = "MDC棣栭〉鎺ュ彛-宸ユ绾у墠15澶╁埄鐢ㄧ巼鎶樼嚎鍥�", notes = "MDC棣栭〉鎺ュ彛-宸ユ绾у墠15澶╁埄鐢ㄧ巼鎶樼嚎鍥�")
     @GetMapping("/equipmentDayUtilizationStatistics")
-    public Result<?> equipmentDayUtilizationStatistics(String productionCode) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        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 {
-            //宸ユ 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勫伐娈垫潈闄�
-            key = mdcProductionService.findThreeProductionId(userId);
-        }
-        Map<String, Object> result = mdcHomeService.getEquipmentDayUtilizationStatistics(userId, key);
+    public Result<?> equipmentDayUtilizationStatistics(String productionId) {
+        Map<String, Object> result = mdcHomeService.getEquipmentDayUtilizationStatistics(productionId);
         return Result.OK(result);
     }
 
@@ -253,6 +167,8 @@
         return Result.OK(result);
     }
 
+
+
     @ApiOperation(value = "MDC棣栭〉鎺ュ彛-闂鍒楄〃", notes = "MDC棣栭〉鎺ュ彛-闂鍒楄〃")
     @GetMapping("/feedbackList")
     public Result<?> feedbackList(String productionCode) {

--
Gitblit v1.9.3