From d1cf43d2522220872bbaf45821d60deee231d637 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期一, 22 四月 2024 15:29:50 +0800
Subject: [PATCH] 第四级主页接口

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/ICalibrationOrderService.java         |   14 ++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml         |   59 +++++++++++++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/CalibrationOrderMapper.java            |   13 ++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/CalibrationOrderServiceImpl.java |   14 ++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/CalibrationOrderController.java    |   54 ++++++++++++++++++
 5 files changed, 154 insertions(+), 0 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 363203b..4cc58dc 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
@@ -1135,4 +1135,58 @@
         return Result.ok(twoMaintenancePlanList);
     }
 
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛�
+     * qsw 2024-4-22
+     */
+    @GetMapping("getAreaEquipmentList")
+    public Result<?> getAreaEquipmentList(String productionCode,String equipmentNum) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(!USER_TYPE_1.equals(userType)){
+            Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+            if(area != null){
+                list = calibrationOrderService.getAreaEquipmentList(equipmentNum,area.getId(),null);
+            }
+        }
+        return Result.ok(list);
+    }
+
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝鎵�鏈夎澶囧彴璐︿俊鎭睍绀猴紱
+     * qsw 2024-4-22
+     */
+    @GetMapping("getAllAreaEquipmentList")
+    public Result<?> getAllAreaEquipmentList(String productionCode) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Integer userType = user.getUserType();
+        List<Map<String, Object>> list = null;
+        if(!USER_TYPE_1.equals(userType)){
+            Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0));
+            if(area != null){
+                list = calibrationOrderService.getAreaEquipmentList("",area.getId(),null);
+            }
+        }else{
+            List<Map<String, Object>> operationCertificatelist = calibrationOrderService.getOperationCertificate(user.getUsername());
+            if(operationCertificatelist.size()>0){
+                String equipmentIds = (String)operationCertificatelist.get(0).get("equipmentIds");
+                List<String> strings = Arrays.asList(equipmentIds.split(","));
+                list = calibrationOrderService.getAreaEquipmentList("","",strings);
+            }
+        }
+        return Result.ok(list);
+    }
+
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝鎵�鏈夎澶囧彴璐︿俊鎭睍绀猴紱
+     * qsw 2024-4-22
+     */
+    @GetMapping("getOperationCertificate")
+    public Result<?> getOperationCertificate() {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        List<Map<String, Object>> list = calibrationOrderService.getOperationCertificate(user.getUsername());
+        return Result.ok(list);
+    }
+
 }
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 1d3b23b..8fb45d8 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
@@ -145,4 +145,17 @@
     String findMaintenanceDate(@Param("workCenterId")String workCenterId);
     List<Map<String, Object>> getAreTwoMaintenancePlanDetails(@Param("areaId")String areaId,@Param("maintenanceDate")String maintenanceDate);
 
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛�
+     * qsw 2024-4-22
+     */
+    List<Map<String, Object>> getAreaEquipmentList(@Param("equipmentNum")String equipmentNum,@Param("areaId")String areaId, @Param("equipmentNum")List<String> equipmentIds);
+
+
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛�
+     * qsw 2024-4-22
+     */
+    List<Map<String, Object>> getOperationCertificate(@Param("username")String username);
+
 }
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 b0fea68..748b03b 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
@@ -169,5 +169,64 @@
         where t4.area_id = #{areaId} and SUBSTRING(CONVERT(VARCHAR(10), t1.plan_start_time, 120), 1, 7) = #{maintenanceDate}
     </select>
 
+    <!--  棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛�  -->
+    <select id="getAreaEquipmentList"  parameterType="String" resultType="Map">
+        SELECT
+            t1.id,
+            t1.id as value,
+            t1.num,
+            t1.num as text,
+            t1.name,
+            t1.model,
+            t1.specification,
+            t1.equipment_importance_id as abc,
+            t2.name as equipmentCategoryName,
+            t3.name as siteName,
+            t4.name as areaName,
+            t5.name as workShopName,
+            t1.system,
+            t6.depart_name as manageName,
+            t7.item_text as equipmentStatus,
+            t8.item_text as technology_status,
+            t1.next_second_maintenance_time AS nextSecondMaintenanceTime,
+            t1.next_third_maintenance_time as nextThirdMaintenanceTime
+        FROM
+            mom_eam_equipment t1
+            LEFT JOIN mom_eam_equipment_category t2 ON t1.equipment_category_id = t2.id
+            left join mom_base_area t3 on t1.work_center_id = t3.id
+            left join mom_base_area t4 on t1.factory_model_id = t4.id
+            left join mom_base_area t5 on t1.area_id = t5.id
+            left join sys_depart t6 on t1.manage_id = t6.id
+            LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'equipment_status' ) t7 ON t7.item_value = t1.equipment_status
+            LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t8 ON t8.item_value = t1.technology_status
+        where t1.del_flag = '0'
+        <if test="areaId != null and areaId != ''">
+            and t1.area_id = #{areaId}
+        </if>
+        <if test="equipmentNum != null and equipmentNum != ''">
+            and t1.num = #{equipmentNum}
+        </if>
+        <if test="equipmentIds.size()>0">
+            and  t1.id in
+            <foreach collection='equipmentIds' index='index' item='item' open='(' separator=',' close=')'>#{item}</foreach>
+        </if>
+    </select>
+
+    <!--  棣栭〉 绗洓绾� 褰撳墠鐧诲綍浜虹殑鎿嶄綔璇侊紱  -->
+    <select id="getOperationCertificate"  parameterType="String" resultType="Map">
+        SELECT
+            t1.id,
+            t1.num,
+            SUBSTRING(CONVERT(VARCHAR(10),t1.issue_date, 120), 1, 10) AS issueDate,
+            SUBSTRING(CONVERT(VARCHAR(10),t1.end_time, 120), 1, 10) as endTime,
+            t1.current_cycle_score AS currentCycleScore,
+            t2.realname,
+            t1.equipment_ids AS equipmentIds
+        FROM
+            mom_eam_operation_certificate t1
+        LEFT JOIN sys_user t2 on t1.user_id = t2.username
+        where t1.del_flag = '0' and t1.user_id = #{username}
+    </select>
+
 
 </mapper>
\ No newline at end of file
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 30afc5e..e3cded3 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
@@ -1,5 +1,6 @@
 package org.jeecg.modules.eam.service;
 
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.eam.entity.CalibrationOrderDetail;
 import org.jeecg.modules.eam.entity.CalibrationOrder;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -168,4 +169,17 @@
      */
     List<Map<String, Object>> getTwoMaintenancePlanList(String productionCode);
 
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛�
+     * qsw 2024-4-22
+     */
+    List<Map<String, Object>> getAreaEquipmentList(String equipmentNum,String areaId,List<String> equipmentIds);
+
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛�
+     * qsw 2024-4-22
+     */
+    List<Map<String, Object>> getOperationCertificate(String username);
+
+
 }
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 13ad3d5..fd03c61 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
@@ -346,4 +346,18 @@
         }
         return list;
     }
+
+    @Override
+    public List<Map<String, Object>> getAreaEquipmentList(String equipmentNum, String areaId,List<String> equipmentIds) {
+        return this.baseMapper.getAreaEquipmentList(equipmentNum,areaId,equipmentIds);
+    }
+
+    /**
+     *棣栭〉  绗洓绾�  瀵瑰簲宸ュ尯涓嬶紝璁惧鍙拌处淇℃伅灞曠ず锛�
+     * qsw 2024-4-22
+     */
+    @Override
+    public List<Map<String, Object>> getOperationCertificate(String username) {
+        return this.baseMapper.getOperationCertificate(username);
+    }
 }

--
Gitblit v1.9.3