From 7aa4d932c658e293e96251e75094c32c629a5988 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期一, 18 三月 2024 16:31:17 +0800
Subject: [PATCH] 接口修改

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/ICalibrationOrderService.java         |   30 +++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml         |   50 ++++-
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/CalibrationOrderMapper.java            |   30 +++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/CalibrationOrderServiceImpl.java |   73 +++++++-
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/CalibrationOrderController.java    |  238 ++++++++++++++++++++++++-----
 5 files changed, 343 insertions(+), 78 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/CalibrationOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/CalibrationOrderController.java
index ce24a6a..812878a 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/CalibrationOrderController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/CalibrationOrderController.java
@@ -26,6 +26,7 @@
 import org.jeecg.modules.eam.service.*;
 import org.jeecg.modules.eam.vo.CalibrationOrderPage;
 import org.jeecg.modules.eam.vo.SysFileNameVo;
+import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -61,6 +62,25 @@
 @RequestMapping("/eam/calibrationOrder")
 @Slf4j
 public class CalibrationOrderController {
+
+    /**
+     * 鐢ㄦ埛绫诲瀷(1 鏅�氭垚鍛� 2 宸ユ 3 鍒嗗巶/涓績 4 鍏徃锛�
+     */
+    private static final Integer USER_TYPE_1 = 1;
+    private static final Integer USER_TYPE_2 = 2;
+    private static final Integer USER_TYPE_3 = 3;
+    private static final Integer USER_TYPE_4 = 4;
+
+    /**
+     * 杞﹂棿灞傜骇绫诲瀷(1 鍏徃 2 鍒嗗巶銆佷腑蹇� 3 宸ユ锛�
+     */
+    private static final String ORG_TYPE_1 = "1";
+    private static final String ORG_TYPE_2 = "2";
+    private static final String ORG_TYPE_3 = "3";
+
+
+
+
     @Autowired
     private ICalibrationOrderService calibrationOrderService;
     @Autowired
@@ -736,18 +756,40 @@
     }
 
 
+
+
     /**
      *棣栭〉锛堜簩绾ч〉闈級鎶�鏈姸鎬佹暟閲忕粺璁�
      * qsw 2024-3-13
      */
     @GetMapping("getEquipmentTechnologyStatusList")
-    public Result<?> getEquipmentTechnologyStatusList(@Param("factoryNum") String factoryNum) {
-        List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list();
-        List<Map<String, Object>> list;
-        if(areaList.size()>0){
-            list = calibrationOrderService.getEquipmentTechnologyStatusList(areaList.get(0).getId());
-        }else{
-            list = null;
+    public Result<?> getEquipmentTechnologyStatusList(String productionCode) {
+
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(USER_TYPE_4.equals(userType)){
+            if(StringUtils.isBlank(productionCode)){
+                list = calibrationOrderService.getFactoryEquipmentTechnologyStatusList();
+            }else{
+                String orgType = calibrationOrderService.findOrgType(productionCode);
+                if(ORG_TYPE_2.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getEquipmentTechnologyStatusList(area.getId(),"");
+                }else if(ORG_TYPE_3.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getEquipmentTechnologyStatusList("",area.getId());
+                }
+            }
+        }else if(USER_TYPE_3.equals(userType)){
+            String code = calibrationOrderService.findProductionCode(user.getId());
+            if(StringUtils.isBlank(productionCode)){
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getEquipmentTechnologyStatusList(area.getId(),"");
+            }else{
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getEquipmentTechnologyStatusList("",area.getId());
+            }
         }
         return Result.ok(list);
     }
@@ -757,13 +799,32 @@
      * qsw 2024-3-13
      */
     @GetMapping("getReportRepairEquipmentList")
-    public Result<?> getReportRepairEquipmentList(@Param("factoryNum") String factoryNum) {
-        List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list();
-        List<Map<String, Object>> list;
-        if(areaList.size()>0){
-            list = calibrationOrderService.getReportRepairEquipmentList(areaList.get(0).getId());
-        }else{
-            list = null;
+    public Result<?> getReportRepairEquipmentList(String productionCode) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(USER_TYPE_4.equals(userType)){
+            if(StringUtils.isBlank(productionCode)){
+                list = calibrationOrderService.getFactoryReportRepairEquipmentList();
+            }else{
+                String orgType = calibrationOrderService.findOrgType(productionCode);
+                if(ORG_TYPE_2.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),"");
+                }else if(ORG_TYPE_3.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getReportRepairEquipmentList("",area.getId());
+                }
+            }
+        }else if(USER_TYPE_3.equals(userType)){
+            String code = calibrationOrderService.findProductionCode(user.getId());
+            if(StringUtils.isBlank(productionCode)){
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),"");
+            }else{
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getReportRepairEquipmentList("",area.getId());
+            }
         }
         return Result.ok(list);
     }
@@ -773,13 +834,39 @@
      * qsw 2024-3-14
      */
     @GetMapping("getThisMonthMaintenanceList")
-    public Result<?> getThisMonthMaintenanceList(@Param("factoryNum") String factoryNum) {
-        List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list();
-        List<Map<String, Object>> list;
-        if(areaList.size()>0){
-            list = calibrationOrderService.getThisMonthMaintenanceList(areaList.get(0).getId());
-        }else{
-            list = null;
+    public Result<?> getThisMonthMaintenanceList(String productionCode) {
+//        List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list();
+//        List<Map<String, Object>> list;
+//        if(areaList.size()>0){
+//            list = calibrationOrderService.getThisMonthMaintenanceList(areaList.get(0).getId());
+//        }else{
+//            list = null;
+//        }
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(USER_TYPE_4.equals(userType)){
+            if(StringUtils.isBlank(productionCode)){
+                list = calibrationOrderService.getFactoryThisMonthMaintenanceList();
+            }else{
+                String orgType = calibrationOrderService.findOrgType(productionCode);
+                if(ORG_TYPE_2.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),"");
+                }else if(ORG_TYPE_3.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getReportRepairEquipmentList("",area.getId());
+                }
+            }
+        }else if(USER_TYPE_3.equals(userType)){
+            String code = calibrationOrderService.findProductionCode(user.getId());
+            if(StringUtils.isBlank(productionCode)){
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getReportRepairEquipmentList(area.getId(),"");
+            }else{
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getReportRepairEquipmentList("",area.getId());
+            }
         }
         return Result.ok(list);
     }
@@ -789,13 +876,32 @@
      * qsw 2024-3-14
      */
     @GetMapping("getNextMonthMaintenanceList")
-    public Result<?> getNextMonthMaintenanceList(@Param("factoryNum") String factoryNum) {
-        List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list();
-        List<Map<String, Object>> list;
-        if(areaList.size()>0){
-            list = calibrationOrderService.getNextMonthMaintenanceList(areaList.get(0).getId());
-        }else{
-            list = null;
+    public Result<?> getNextMonthMaintenanceList(String productionCode) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(USER_TYPE_4.equals(userType)){
+            if(StringUtils.isBlank(productionCode)){
+                list = calibrationOrderService.getFactoryNextMonthMaintenanceList();
+            }else{
+                String orgType = calibrationOrderService.findOrgType(productionCode);
+                if(ORG_TYPE_2.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),"");
+                }else if(ORG_TYPE_3.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId());
+                }
+            }
+        }else if(USER_TYPE_3.equals(userType)){
+            String code = calibrationOrderService.findProductionCode(user.getId());
+            if(StringUtils.isBlank(productionCode)){
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),"");
+            }else{
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId());
+            }
         }
         return Result.ok(list);
     }
@@ -805,13 +911,32 @@
      * qsw 2024-3-14
      */
     @GetMapping("getNextNextMonthMaintenanceList")
-    public Result<?> getNextNextMonthMaintenanceList(@Param("factoryNum") String factoryNum) {
-        List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list();
-        List<Map<String, Object>> list;
-        if(areaList.size()>0){
-            list = calibrationOrderService.getNextNextMonthMaintenanceList(areaList.get(0).getId());
-        }else{
-            list = null;
+    public Result<?> getNextNextMonthMaintenanceList(String productionCode) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(USER_TYPE_4.equals(userType)){
+            if(StringUtils.isBlank(productionCode)){
+                list = calibrationOrderService.getFactoryNextMonthMaintenanceList();
+            }else{
+                String orgType = calibrationOrderService.findOrgType(productionCode);
+                if(ORG_TYPE_2.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),"");
+                }else if(ORG_TYPE_3.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId());
+                }
+            }
+        }else if(USER_TYPE_3.equals(userType)){
+            String code = calibrationOrderService.findProductionCode(user.getId());
+            if(StringUtils.isBlank(productionCode)){
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getNextMonthMaintenanceList(area.getId(),"");
+            }else{
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getNextMonthMaintenanceList("",area.getId());
+            }
         }
         return Result.ok(list);
     }
@@ -821,15 +946,44 @@
      * qsw 2024-3-14
      */
     @GetMapping("getThisMonthMaintenanceFinishList")
-    public Result<?> getThisMonthMaintenanceFinishList(@Param("factoryNum") String factoryNum) {
-        List<Area> areaList = areaService.lambdaQuery().eq(Area::getNum, factoryNum).eq(Area::getDelFlag, 0).list();
-        List<Map<String, Object>> list;
-        if(areaList.size()>0){
-            list = calibrationOrderService.getThisMonthMaintenanceFinishList(areaList.get(0).getId());
-        }else{
-            list = null;
+    public Result<?> getThisMonthMaintenanceFinishList(String productionCode) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(USER_TYPE_4.equals(userType)){
+            if(StringUtils.isBlank(productionCode)){
+                list = calibrationOrderService.getFactoryThisMonthMaintenanceFinishList();
+            }else{
+                String orgType = calibrationOrderService.findOrgType(productionCode);
+                if(ORG_TYPE_2.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getThisMonthMaintenanceFinishList(area.getId(),"");
+                }else if(ORG_TYPE_3.equals(orgType)){
+                    Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                    list = calibrationOrderService.getThisMonthMaintenanceFinishList("",area.getId());
+                }
+            }
+        }else if(USER_TYPE_3.equals(userType)){
+            String code = calibrationOrderService.findProductionCode(user.getId());
+            if(StringUtils.isBlank(productionCode)){
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, code).eq(Area::getType, "1").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getThisMonthMaintenanceFinishList(area.getId(),"");
+            }else{
+                Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+                list = calibrationOrderService.getThisMonthMaintenanceFinishList("",area.getId());
+            }
         }
         return Result.ok(list);
     }
 
+    /**
+     *棣栭〉浜屼繚璁″垝灞曠ず
+     * qsw 2024-3-15
+     */
+    @GetMapping("getTwoMaintenancePlanList")
+    public Result<?> getTwoMaintenancePlanList() {
+        List<Map<String, Object>> twoMaintenancePlanList = calibrationOrderService.getTwoMaintenancePlanList();
+        return Result.ok();
+    }
+
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/CalibrationOrderMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/CalibrationOrderMapper.java
index b985950..0bc73b1 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/CalibrationOrderMapper.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/CalibrationOrderMapper.java
@@ -24,6 +24,18 @@
     List<Map<String, Object>> getPrecisionParameterList(@Param("equipmentId")String equipmentId);
 
     /**
+     * 鑾峰彇褰撳墠鐧诲綍浜烘槸涓績鍙婂搴旂殑缂栫爜
+     * qsw 2024-3-18
+     */
+    String findProductionCode(@Param("userId") String userId);
+
+    /**
+     * 鏍规嵁妯″瀷浼犲叆鐨勭紪鐮�  鍒ゆ柇鏀圭紪鐮佸叕鍙�/涓績/宸ユ鐨勫摢涓�绾�
+     * qsw 2024-3-18
+     */
+    String findOrgType(@Param("productionCode") String productionCode);
+
+    /**
      *棣栭〉鍏徃绾� 鎶�鏈姸鎬佹暟閲忕粺璁�
      * qsw 2024-3-13
      */
@@ -63,36 +75,42 @@
      *棣栭〉锛堜簩绾ч〉闈級鎶�鏈姸鎬佹暟閲忕粺璁�
      * qsw 2024-3-13
      */
-    List<Map<String, Object>> getEquipmentTechnologyStatusList(@Param("factoryModelId")String factoryModelId);
+    List<Map<String, Object>> getEquipmentTechnologyStatusList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級璁惧鎶ヤ慨鎯呭喌缁熻
      * qsw 2024-3-13
      */
-    List<Map<String, Object>> getReportRepairEquipmentList(@Param("factoryModelId")String factoryModelId);
+    List<Map<String, Object>> getReportRepairEquipmentList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級鏈湀涓変繚璁″垝
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getThisMonthMaintenanceList(@Param("factoryModelId")String factoryModelId);
+    List<Map<String, Object>> getThisMonthMaintenanceList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級涓嬫湀涓変繚璁″垝
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getNextMonthMaintenanceList(@Param("factoryModelId")String factoryModelId);
+    List<Map<String, Object>> getNextMonthMaintenanceList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級涓嬩笅鏈堜笁淇濊鍒�
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getNextNextMonthMaintenanceList(@Param("factoryModelId")String factoryModelId);
+    List<Map<String, Object>> getNextNextMonthMaintenanceList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級鏈湀涓変繚瀹屾垚鏁伴噺
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getThisMonthMaintenanceFinishList(@Param("factoryModelId")String factoryModelId);
+    List<Map<String, Object>> getThisMonthMaintenanceFinishList(@Param("workCenterId")String workCenterId,@Param("areaId")String areaId);
+
+    /**
+     *棣栭〉浜岀骇淇濆吇灞曠ず椤甸潰 鑾峰彇姣忎竴涓腑蹇冧笅浜岀骇淇濆吇璁″垝
+     * qsw 2024-3-15
+     */
+    List<Map<String, Object>> getCenterTwoMaintenancePlanList(@Param("workCenterId")String workCenterId);
 
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml
index b14cfa4..06f679e 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml
@@ -21,6 +21,16 @@
         WHERE t1.del_flag = 0 and t1.equipment_id = #{equipmentId}
     </select>
 
+    <!--鏍规嵁妯″瀷浼犲叆鐨勭紪鐮�  鍒ゆ柇鏀圭紪鐮佸叕鍙�/涓績/宸ユ鐨勫摢涓�绾�-->
+    <select id="findOrgType" resultType="java.lang.String">
+        select TOP 1 org_type as orgType from mdc_production where production_code = #{productionCode}
+    </select>
+
+    <!--鑾峰彇褰撳墠鐧诲綍浜烘槸涓績鍙婂搴旂殑缂栫爜-->
+    <select id="findProductionCode" resultType="java.lang.String">
+        SELECT top 1 t2.production_code  as productionCode FROM mdc_user_production t1 LEFT JOIN mdc_production t2 ON t1.pro_id = t2.id  where t1.user_id =#{userId} and t2.org_type = '2'
+    </select>
+
     <select id="getFactoryEquipmentTechnologyStatusList"  parameterType="String" resultType="Map">
         SELECT
             ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified') as qualifiedCount,
@@ -48,39 +58,55 @@
     </select>
 
     <select id="getFactoryThisMonthMaintenanceFinishList"  parameterType="String" resultType="Map">
-        select count(0) as totalConnt from 	mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id
+        select count(0) as totalCount from 	mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id
         where t1.del_flag = '0' and t1.status = '5' and  SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7)
     </select>
 
     <select id="getEquipmentTechnologyStatusList"  parameterType="String" resultType="Map">
         SELECT
-            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified' and work_center_id = #{factoryModelId}) as qualifiedCount,
-            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'limitedUse' and work_center_id = #{factoryModelId}) as  limitedUseCount,
-            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'disabled' and work_center_id = #{factoryModelId})  as disabledCount
+            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'qualified'   <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as qualifiedCount,
+            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'limitedUse'  <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> ) as  limitedUseCount,
+            ( SELECT COUNT ( 0 ) FROM mom_eam_equipment WHERE del_flag = '0' and technology_status = 'disabled'    <if test="workCenterId != null and workCenterId != ''"> and work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and area_id = #{areaId} </if> )  as disabledCount
     </select>
 
     <select id="getReportRepairEquipmentList"  parameterType="String" resultType="Map">
         SELECT
-            ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)  and t2.work_center_id = #{factoryModelId}) as failurTotalCount,
-            ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '1' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)  and t2.work_center_id = #{factoryModelId}) as  noStopCount,
-            ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '2' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)  and t2.work_center_id = #{factoryModelId}) as  stopCount
+            ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id WHERE t1.del_flag = '0' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)  <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as failurTotalCount,
+            ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '1' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)  <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as  noStopCount,
+            ( select COUNT(0) from mom_eam_equipment_report_repair t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id where t1.del_flag = '0' and t1.is_stop = '2' and SUBSTRING(CONVERT(VARCHAR(10), t1.fault_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)  <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if> ) as  stopCount
     </select>
 
     <select id="getThisMonthMaintenanceList"  parameterType="String" resultType="Map">
-        select  count(0) as totalCount from  mom_eam_equipment t1 where t1.del_flag = '0' and  SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7)  and t1.work_center_id = #{factoryModelId}
+        select  count(0) as totalCount from  mom_eam_equipment t1 where t1.del_flag = '0' and  SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7)  <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if>
     </select>
 
     <select id="getNextMonthMaintenanceList"  parameterType="String" resultType="Map">
-        select  count(0) as totalCount from  mom_eam_equipment t1 where t1.del_flag = '0' and  SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH, 1, GETDATE()), 120), 1, 7)  and t1.work_center_id = #{factoryModelId}
+        select  count(0) as totalCount from  mom_eam_equipment t1 where t1.del_flag = '0' and  SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH, 1, GETDATE()), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if>
     </select>
 
     <select id="getNextNextMonthMaintenanceList"  parameterType="String" resultType="Map">
-        select  count(0) as totalCount from  mom_eam_equipment t1 where t1.del_flag = '0' and  SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH,2 , GETDATE()), 120), 1, 7)  and t1.work_center_id = #{factoryModelId}
+        select  count(0) as totalCount from  mom_eam_equipment t1 where t1.del_flag = '0' and  SUBSTRING(CONVERT(VARCHAR(10), t1.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), DATEADD(MONTH,2 , GETDATE()), 120), 1, 7)  <if test="workCenterId != null and workCenterId != ''"> and t1.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t1.area_id = #{areaId} </if>
     </select>
 
     <select id="getThisMonthMaintenanceFinishList"  parameterType="String" resultType="Map">
-        select count(0) as totalConnt from 	mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id
-        where t1.del_flag = '0' and t1.status = '5' and  SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7)   and t2.work_center_id = #{factoryModelId}
+        select count(0) as totalCount from 	mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id
+        where t1.del_flag = '0' and t1.status = '5' and  SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7)   <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if>
+    </select>
+
+    <select id="getCenterTwoMaintenancePlanList"  parameterType="String" resultType="Map">
+        SELECT
+            top 1
+	        t1.id,
+            t5.name centerName,
+            SUBSTRING(CONVERT(VARCHAR(10),t1.plan_start_time, 120), 1, 10) maintenanceDate,
+            '浜岀骇淇濆吇' as content
+        FROM
+            mom_eam_equipment_maintenance_plan_detail t1
+            LEFT JOIN mom_eam_equipment_maintenance_plan t2 ON t1.plan_id= t2.id
+            left join mom_eam_maintenance_standard t3 on t1.standard_id = t3.id
+            left join mom_eam_equipment t4 on t3.equipment_id = t4.id
+            left join mom_base_area t5 on t4.work_center_id = t5.id
+        where t5.id = #{workCenterId} ORDER BY t1.plan_start_time desc
     </select>
 
 
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/ICalibrationOrderService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/ICalibrationOrderService.java
index b525ede..667bd48 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/ICalibrationOrderService.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/ICalibrationOrderService.java
@@ -51,6 +51,18 @@
 
 
     //qsw 2023-7-18================================================================================
+
+    /**
+     * 鏍规嵁妯″瀷浼犲叆鐨勭紪鐮�  鍒ゆ柇鏀圭紪鐮佸叕鍙�/涓績/宸ユ鐨勫摢涓�绾�
+     */
+    String findOrgType(String productionCode);
+
+    /**
+     * 鏍规嵁妯″瀷浼犲叆鐨勭紪鐮�  鍒ゆ柇鏀圭紪鐮佸叕鍙�/涓績/宸ユ鐨勫摢涓�绾�
+     * qsw 2024-3-18
+     */
+    String findProductionCode(String userId);
+
     /**
      * 璁惧妫�瀹氬伐鍗� 鍒涘缓鏃堕�氳繃璁惧鑾峰彇璁惧绮惧害鍙傛暟
      * qsw 2023-7-18
@@ -99,36 +111,42 @@
      *棣栭〉锛堜簩绾ч〉闈級鎶�鏈姸鎬佹暟閲忕粺璁�
      * qsw 2024-3-13
      */
-    List<Map<String, Object>> getEquipmentTechnologyStatusList(String factoryModelId);
+    List<Map<String, Object>> getEquipmentTechnologyStatusList(String workCenterId,String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級璁惧鎶ヤ慨鎯呭喌缁熻
      * qsw 2024-3-13
      */
-    List<Map<String, Object>> getReportRepairEquipmentList(String factoryModelId);
+    List<Map<String, Object>> getReportRepairEquipmentList(String workCenterId,String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級鏈湀涓変繚璁″垝
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getThisMonthMaintenanceList(String factoryModelId);
+    List<Map<String, Object>> getThisMonthMaintenanceList(String workCenterId,String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級涓嬫湀涓変繚璁″垝
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getNextMonthMaintenanceList(String factoryModelId);
+    List<Map<String, Object>> getNextMonthMaintenanceList(String workCenterId,String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級涓嬩笅鏈堜笁淇濊鍒�
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getNextNextMonthMaintenanceList(String factoryModelId);
+    List<Map<String, Object>> getNextNextMonthMaintenanceList(String workCenterId,String areaId);
 
     /**
      *棣栭〉锛堜簩绾ч〉闈級鏈湀涓変繚瀹屾垚鏁伴噺
      * qsw 2024-3-14
      */
-    List<Map<String, Object>> getThisMonthMaintenanceFinishList(String factoryModelId);
+    List<Map<String, Object>> getThisMonthMaintenanceFinishList(String workCenterId,String areaId);
+
+    /**
+     *棣栭〉浜屼繚璁″垝灞曠ず
+     * qsw 2024-3-15
+     */
+    List<Map<String, Object>> getTwoMaintenancePlanList();
 
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/CalibrationOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/CalibrationOrderServiceImpl.java
index 37ac0f2..6cc9e33 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/CalibrationOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/CalibrationOrderServiceImpl.java
@@ -1,11 +1,17 @@
 package org.jeecg.modules.eam.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.eam.entity.Area;
 import org.jeecg.modules.eam.entity.CalibrationOrder;
 import org.jeecg.modules.eam.entity.CalibrationOrderDetail;
+import org.jeecg.modules.eam.entity.Equipment;
 import org.jeecg.modules.eam.mapper.CalibrationOrderDetailMapper;
 import org.jeecg.modules.eam.mapper.CalibrationOrderMapper;
 import org.jeecg.modules.eam.model.MaintenanceCycleVo;
+import org.jeecg.modules.eam.service.IAreaService;
 import org.jeecg.modules.eam.service.ICalibrationOrderService;
 import org.jeecg.modules.eam.service.IEamEquipmentService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +19,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -30,6 +37,9 @@
     private CalibrationOrderMapper calibrationOrderMapper;
     @Autowired
     private CalibrationOrderDetailMapper calibrationOrderDetailMapper;
+
+    @Autowired
+    private IAreaService areaService;
 
 
     @Override
@@ -81,6 +91,25 @@
     }
 
     //qsw 2023-7-18================================================================================
+
+    /**
+     * 鏍规嵁妯″瀷浼犲叆鐨勭紪鐮�  鍒ゆ柇鏀圭紪鐮佸叕鍙�/涓績/宸ユ鐨勫摢涓�绾�
+     * qsw 2024-3-18
+     */
+    @Override
+    public String findOrgType(String productionCode) {
+        return this.baseMapper.findOrgType(productionCode);
+    }
+
+    /**
+     * 鑾峰彇褰撳墠鐧诲綍浜烘槸涓績鍙婂搴旂殑缂栫爜
+     * qsw 2024-3-18
+     */
+    @Override
+    public String findProductionCode(String userId) {
+        return this.baseMapper.findProductionCode(userId);
+    }
+
     /**
      * 璁惧妫�瀹氬伐鍗� 鍒涘缓鏃堕�氳繃璁惧鑾峰彇璁惧绮惧害鍙傛暟
      * qsw 2023-7-18
@@ -150,8 +179,8 @@
      * qsw 2024-3-13
      */
     @Override
-    public List<Map<String, Object>> getEquipmentTechnologyStatusList(String factoryModelId) {
-        return this.baseMapper.getEquipmentTechnologyStatusList(factoryModelId);
+    public List<Map<String, Object>> getEquipmentTechnologyStatusList(String workCenterId,String areaId) {
+        return this.baseMapper.getEquipmentTechnologyStatusList(workCenterId,areaId);
     }
 
     /**
@@ -159,8 +188,8 @@
      * qsw 2024-3-13
      */
     @Override
-    public List<Map<String, Object>> getReportRepairEquipmentList(String factoryModelId) {
-        return this.baseMapper.getReportRepairEquipmentList(factoryModelId);
+    public List<Map<String, Object>> getReportRepairEquipmentList(String workCenterId,String areaId) {
+        return this.baseMapper.getReportRepairEquipmentList(workCenterId,areaId);
     }
 
     /**
@@ -168,8 +197,8 @@
      * qsw 2024-3-14
      */
     @Override
-    public List<Map<String, Object>> getThisMonthMaintenanceList(String factoryModelId) {
-        return this.baseMapper.getThisMonthMaintenanceList(factoryModelId);
+    public List<Map<String, Object>> getThisMonthMaintenanceList(String workCenterId,String areaId) {
+        return this.baseMapper.getThisMonthMaintenanceList(workCenterId,areaId);
     }
 
     /**
@@ -177,8 +206,8 @@
      * qsw 2024-3-14
      */
     @Override
-    public List<Map<String, Object>> getNextMonthMaintenanceList(String factoryModelId) {
-        return this.baseMapper.getNextMonthMaintenanceList(factoryModelId);
+    public List<Map<String, Object>> getNextMonthMaintenanceList(String workCenterId,String areaId) {
+        return this.baseMapper.getNextMonthMaintenanceList(workCenterId,areaId);
     }
 
     /**
@@ -186,8 +215,8 @@
      * qsw 2024-3-14
      */
     @Override
-    public List<Map<String, Object>> getNextNextMonthMaintenanceList(String factoryModelId) {
-        return this.baseMapper.getNextNextMonthMaintenanceList(factoryModelId);
+    public List<Map<String, Object>> getNextNextMonthMaintenanceList(String workCenterId,String areaId) {
+        return this.baseMapper.getNextNextMonthMaintenanceList(workCenterId,areaId);
     }
 
     /**
@@ -195,7 +224,27 @@
      * qsw 2024-3-14
      */
     @Override
-    public List<Map<String, Object>> getThisMonthMaintenanceFinishList(String factoryModelId) {
-        return this.baseMapper.getThisMonthMaintenanceFinishList(factoryModelId);
+    public List<Map<String, Object>> getThisMonthMaintenanceFinishList(String workCenterId,String areaId) {
+        return this.baseMapper.getThisMonthMaintenanceFinishList(workCenterId,areaId);
+    }
+
+    /**
+     *棣栭〉浜屼繚璁″垝灞曠ず
+     * qsw 2024-3-15
+     */
+    @Override
+    public List<Map<String, Object>> getTwoMaintenancePlanList() {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        List<Area> areaList = areaService.lambdaQuery().eq(Area::getType, "1").eq(Area::getDelFlag, "0").list();
+        List<Map<String, Object>> arrayList = new ArrayList<>();
+        for (Area area : areaList) {
+            String id = area.getId();
+            List<Map<String, Object>> centerTwoMaintenancePlanList = this.baseMapper.getCenterTwoMaintenancePlanList(id);
+            if(centerTwoMaintenancePlanList.size()>0){
+                arrayList.add(centerTwoMaintenancePlanList.get(0));
+            }
+        }
+        return null;
     }
 }

--
Gitblit v1.9.3