Browse Source

设备相关信息导出优化

1 year ago
parent
commit
19b6d29af9

+ 2 - 1
platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml

@@ -14,7 +14,8 @@
             resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
         select
         <include refid="Base_Column_List"/>,
-        user4.real_name as repairUser
+        user4.real_name as repairUser,
+        part.name as partName
         from t_repair_application_form application
         left join t_sys_user user on application.user_id = user.user_id
         left join t_sys_user user2 on application.repair_user_id = user2.user_id

+ 59 - 21
platform-rest/src/main/java/com/platform/rest/controller/repair/RepairApplicationFormController.java

@@ -324,31 +324,69 @@ public class RepairApplicationFormController {
     @SysLog("历史故障导出")
     @PreAuthorize("@pms.hasPermission('repair-application-forms-export')")
     public void export2(HttpServletResponse response, RepairApplicationFormDTO record) {
-        if (record.getSearchType() != null) {
-            // 获取报修人
-            if (record.getSearchType() == 1) {
-                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                    UserInfo userInfo = SecurityUtils.getUserInfo();
-                    record.setUserId(userInfo.getUserId());
-                }
+//        if (record.getSearchType() != null) {
+//            // 获取报修人
+//            if (record.getSearchType() == 1) {
+//                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
+//                    UserInfo userInfo = SecurityUtils.getUserInfo();
+//                    record.setUserId(userInfo.getUserId());
+//                }
+//            }
+//            // 获取维修人,包括第二维修人
+//            if (record.getSearchType() == 2) {
+//                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
+//                    UserInfo userInfo = SecurityUtils.getUserInfo();
+//                    record.setRepairUserId(userInfo.getUserId());
+//                }
+//            }
+//            // 获取验收人
+//            if (record.getSearchType() == 3) {
+//                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
+//                    UserInfo userInfo = SecurityUtils.getUserInfo();
+//                    record.setCheckUserId(userInfo.getUserId());
+//                }
+//            }
+//        }
+//        List<RepairApplicationFormVO> excelList = repairApplicationFormMapper.selectPageList(record);
+//        ExcelUtil.exportResponseDict(response, ExporHistoryFaultsVO.class, BeanConverterUtil.copyListProperties(excelList, ExporHistoryFaultsVO.class), "历史故障统计");
+        List<RepairApplicationFormVO> list = repairApplicationFormService.getVOListByDTO(record);
+        List<ExportRepairApplicationFormVO> excelList = new ArrayList<>();
+        for (RepairApplicationFormVO vo : list) {
+            ExportRepairApplicationFormVO excel = BeanConverterUtil.copyObjectProperties(vo, ExportRepairApplicationFormVO.class);
+            excelList.add(excel);
+            boolean find = false;
+            if (vo.getChangeRepairPlan() != null && vo.getChangeRepairPlan()) {
+                find = true;
+                excel.setChangeRepairPlan("更新维修计划");
+                excel.setChangeRepairPlanContent(vo.getChangeRepairPlanContent());
+            }
+            if (vo.getChangeSparePlan() != null && vo.getChangeSparePlan()) {
+                find = true;
+                excel.setChangeRepairPlan("更新备件计划");
+                excel.setChangeRepairPlanContent(vo.getChangeSparePlanContent());
+            }
+            if (vo.getUserTeach() != null && vo.getUserTeach()) {
+                find = true;
+                excel.setChangeRepairPlan("人员培训");
+                excel.setChangeRepairPlanContent(vo.getUserTeachContent());
+
+            }
+            if (vo.getSbChange() != null && vo.getSbChange()) {
+                find = true;
+                excel.setChangeRepairPlan("设备改造升级");
+                excel.setChangeRepairPlanContent(vo.getSbChangeContent());
             }
-            // 获取维修人,包括第二维修人
-            if (record.getSearchType() == 2) {
-                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                    UserInfo userInfo = SecurityUtils.getUserInfo();
-                    record.setRepairUserId(userInfo.getUserId());
-                }
+            if (vo.getOtherChange() != null && vo.getOtherChange()) {
+                find = true;
+                excel.setChangeRepairPlan("其他");
+                excel.setChangeRepairPlanContent(vo.getOtherChangeContent());
             }
-            // 获取验收人
-            if (record.getSearchType() == 3) {
-                if (record.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == record.getFilter().intValue()) {
-                    UserInfo userInfo = SecurityUtils.getUserInfo();
-                    record.setCheckUserId(userInfo.getUserId());
-                }
+            if (!find) {
+                excel.setChangeRepairPlan("无");
+                excel.setChangeRepairPlanContent("无");
             }
         }
-        List<RepairApplicationFormVO> excelList = repairApplicationFormMapper.selectPageList(record);
-        ExcelUtil.exportResponseDict(response, ExporHistoryFaultsVO.class, BeanConverterUtil.copyListProperties(excelList, ExporHistoryFaultsVO.class), "历史故障统计");
+        ExcelUtil.exportResponseDict(response, ExportRepairApplicationFormVO.class, excelList, "历史故障");
     }
 
 }

+ 4 - 2
platform-rest/src/main/java/com/platform/rest/controller/repair/RepairFeeController.java

@@ -149,8 +149,10 @@ public class RepairFeeController {
   @SysLog("维修费用单导出")
   @PreAuthorize("@pms.hasPermission('repair-fees-export')")
   public void export2(HttpServletResponse response, RepairFeeDTO repairFeeDTO) {
-    List<RepairFee> list = repairFeeMapper.selectPageList(repairFeeDTO);
-    ExcelUtil.exportResponseDict(response, ExportHistoryRepairFeeVO.class, BeanConverterUtil.copyListProperties(list, ExportHistoryRepairFeeVO.class), "维修费用单");
+//    List<RepairFee> list = repairFeeMapper.selectPageList(repairFeeDTO);
+//    ExcelUtil.exportResponseDict(response, ExportHistoryRepairFeeVO.class, BeanConverterUtil.copyListProperties(list, ExportHistoryRepairFeeVO.class), "维修费用单");
+    List<RepairFee> list = repairFeeService.getModelListByDTO(repairFeeDTO);
+    ExcelUtil.exportResponseDict(response, ExportRepairFeeVO.class, BeanConverterUtil.copyListProperties(list, ExportRepairFeeVO.class), "维修费用单");
   }
 
 }

+ 2 - 2
platform-rest/src/main/java/com/platform/rest/controller/sb/SbStatusLogController.java

@@ -169,8 +169,8 @@ public class SbStatusLogController {
     @SysLog("设备状态变更记录导出")
     //@PreAuthorize("@pms.hasPermission('sb-status-logs-export')")
     public void export2(HttpServletResponse response, SbStatusLogDTO sbStatusLogDTO) {
-        List<SbStatusLogVO> list = sbStatusLogMapper.selectList(sbStatusLogDTO);
-        ExcelUtil.exportResponseDict(response, ExportSbStatusLogVO2.class, BeanConverterUtil.copyListProperties(list, ExportSbStatusLogVO2.class), "设备状态变更记录");
+        List<SbStatusLog> list = sbStatusLogService.getModelListByDTO(sbStatusLogDTO);
+        ExcelUtil.exportResponseDict(response, ExportSbStatusLogVO.class, BeanConverterUtil.copyListProperties(list, ExportSbStatusLogVO.class), "设备状态变更记录");
     }
 
 }

+ 4 - 2
platform-rest/src/main/java/com/platform/rest/controller/sb/SbStopLogController.java

@@ -155,8 +155,10 @@ public class SbStopLogController {
     @SysLog("设备停机记录表导出")
     //@PreAuthorize("@pms.hasPermission('sb-stop-logs-export')")
     public void export2(HttpServletResponse response, SbStopLogDTO sbStopLogDTO) {
-        List<SbStopLogVO> list = sbStopLogMapper.selectList(sbStopLogDTO);
-        ExcelUtil.exportResponseDict(response, ExportSbStopLogVO2.class, BeanConverterUtil.copyListProperties(list, ExportSbStopLogVO2.class), "设备停机记录表");
+//        List<SbStopLogVO> list = sbStopLogMapper.selectList(sbStopLogDTO);
+//        ExcelUtil.exportResponseDict(response, ExportSbStopLogVO2.class, BeanConverterUtil.copyListProperties(list, ExportSbStopLogVO2.class), "设备停机记录表");
+        List<SbStopLog> list = sbStopLogService.getModelListByDTO(sbStopLogDTO);
+        ExcelUtil.exportResponseDict(response, ExportSbStopLogVO.class, BeanConverterUtil.copyListProperties(list, ExportSbStopLogVO.class), "设备停机记录表");
     }
 
 }

+ 1 - 1
platform-rest/src/main/java/com/platform/rest/controller/sqarepartmanage/SparePartUsedController.java

@@ -207,7 +207,7 @@ public class SparePartUsedController {
     //@PreAuthorize("@pms.hasPermission('sqarepartmanage-spare-part-used-export')")
     public void export2(HttpServletResponse response, SparePartUsedDTO sparePartUsedDTO) {
         List<SparePartUsedVO> list = sparePartUsedMapper.selectVOList(sparePartUsedDTO);
-        ExcelUtil.exportResponseDict(response, ExportSparePartUsedVO2.class, BeanConverterUtil.copyListProperties(list, ExportSparePartUsedVO2.class), "配件记录表");
+        ExcelUtil.exportResponseDict(response, ExportSparePartUsedVO.class, BeanConverterUtil.copyListProperties(list, ExportSparePartUsedVO.class), "配件记录表");
     }
 
 }