From 99968f83982943669af3829ea6bc3bbe745cada4 Mon Sep 17 00:00:00 2001
From: zhangfeng <1603559716@qq.com>
Date: 星期一, 21 十一月 2022 08:41:48 +0800
Subject: [PATCH] 安全物资和设备管理相关rpc接口

---
 equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java |   88 ++++----------------------------------------
 1 files changed, 8 insertions(+), 80 deletions(-)

diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java
index 346f2c3..a82e0f9 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/KeypointEquipmentInfoController.java
@@ -51,8 +51,6 @@
     @Autowired
     public HttpServletRequest request;
 
-    @Autowired
-    public HttpServletResponse response;
 
     /**
      * 分页查询所有数据
@@ -65,7 +63,7 @@
         PageUtils.checkCheck(pageQuery);
 		return this.keypointEquipmentInfoService.queryAll(pageQuery);
     }
-	
+
 
     /**
      * 通过主键查询单条数据
@@ -102,11 +100,7 @@
      */
     @RequestMapping(value = "/delete",method = RequestMethod.POST)
     public ResultVO delete(@RequestBody Long[] ids) {
-        if(ids == null){
-            return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL);
-        }
-        List<Long> idList = Arrays.asList(ids);
-        this.keypointEquipmentInfoService.removeByIds(idList);
+        this.keypointEquipmentInfoService.delete(ids);
         return new ResultVO<>(ResultCodes.OK);
     }
 
@@ -117,31 +111,7 @@
      */
     @GetMapping(value = "/exportTemplate")
     public void exportTemplate() throws IOException {
-        Map<String,String> map = new LinkedHashMap<>();
-        map.put("1","类型/类别外键 ");
-        map.put("2","装置/部位名称");
-        map.put("3","所属单位部门/外键");
-        map.put("4","具体位置");
-        map.put("5","负责人姓名");
-        map.put("6","联系人/外键");
-        map.put("7","录入人/外键");
-        map.put("8","责任人/外键");
-        map.put("9","装置部位分类 1:关键装置 2:重点部位");
-        map.put("10","检查周期");
-        map.put("11","应急预案/外键");
-        map.put("12","主要危险有害因素");
-        map.put("13","易导致风险");
-        map.put("14","应急处置措施");
-        map.put("15","现场图片地址路径");
-
-
-        String fileName = URLEncoder.encode("重点监管装置设备数据导入模板.xls", "UTF-8");
-        response.setContentType("application/vnd.ms-excel");
-        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
-        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
-
-        ExcelUtil.exportExcel(map,new ArrayList<>() , response.getOutputStream());
-        response.getOutputStream().close();
+        keypointEquipmentInfoService.exportTemplate();
     }
 
 
@@ -151,21 +121,7 @@
      */
     @RequestMapping(value = "/importData")
     public ResultVO importData(MultipartFile file) throws IOException {
-        String contentType = file.getContentType();
-        if(!"application/vnd.ms-excel".equals(contentType)
-                && !"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(contentType)) {
-            return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL, "上传的excel格式错误");
-        }
-
-        Collection<KeypointEquipmentInfoImportExcel> importExcel = ExcelUtil.importExcel(KeypointEquipmentInfoImportExcel.class, file.getInputStream(), "yyyy-MM-dd HH:mm:ss", new ExcelLogs() , 0);
-
-        if (CollectionUtils.isEmpty(importExcel)) {
-            return new ResultVO<>(ResultCodes.OK);
-        }
-
-        List<KeypointEquipmentInfo> respList = BeanCopyUtils.copyBeanList((List<KeypointEquipmentInfoImportExcel>)importExcel, KeypointEquipmentInfo.class);
-
-        keypointEquipmentInfoService.saveBatch(respList);
+        keypointEquipmentInfoService.importData(file);
         return new ResultVO<>(ResultCodes.OK);
     }
 
@@ -178,35 +134,7 @@
      */
     @GetMapping(value = "/exportData")
     public void exportData(KeypointEquipmentInfoQueryCriteria queryCriteria) throws IOException {
-        Map<String,String> map = new LinkedHashMap<>();
-        map.put("0","ID");
-        map.put("1","类型/类别外键");
-        map.put("2","装置/部位名称");
-        map.put("3","所属单位部门/外键");
-        map.put("4","具体位置");
-        map.put("5","负责人姓名");
-        map.put("6","联系人/外键");
-        map.put("7","录入人/外键");
-        map.put("8","责任人/外键");
-        map.put("9","装置部位分类 1:关键装置 2:重点部位");
-        map.put("10","检查周期");
-        map.put("11","应急预案/外键");
-        map.put("12","主要危险有害因素");
-        map.put("13","易导致风险");
-        map.put("14","应急处置措施");
-        map.put("15","现场图片地址路径");
-
-        String key = DateUtils.date2String(new Date(), DateUtils.PATTERN_ALLTIME_NOSIGN) ;
-        String fileName = URLEncoder.encode("重点监管装置设备"+key+".xls", "UTF-8");
-        response.setContentType("application/vnd.ms-excel");
-        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
-        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
-
-
-        List<KeypointEquipmentInfoExcel> respList = BeanCopyUtils.copyBeanList(keypointEquipmentInfoService.queryAll(queryCriteria), KeypointEquipmentInfoExcel.class);
-
-        ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
-        response.getOutputStream().close();
+        keypointEquipmentInfoService.exportData(queryCriteria);
     }
 
 
@@ -221,7 +149,7 @@
         repairDetail.setRepairEndDate(new Timestamp(new java.util.Date().getTime()));
         repairDetail.setRepairPersonDepartmentId(0L);
         repairDetail.setRepairMemo("");
-        repairDetail.setRepairStatus(0);
+        repairDetail.setRepairStatus((byte)0);
         repairDetail.setExceptionInfo("");
         repairDetails.add(repairDetail);
         infoDto.setRepaireDetailList(repairDetails);
@@ -277,7 +205,7 @@
         infoDto.setConnectPersonId(0L);
         infoDto.setInputPersonId(0L);
         infoDto.setResponsibilityPersonId(0L);
-        infoDto.setPartType(0);
+        infoDto.setPartType((byte)0);
         infoDto.setCheckCycle("");
         infoDto.setEmergencePlanId(0L);
         infoDto.setDangerousElement("");
@@ -288,4 +216,4 @@
 
 
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.2