From f241a39f07acc5d5ede28b4152d74cbb84e4885b Mon Sep 17 00:00:00 2001
From: zhangfeng <1603559716@qq.com>
Date: Tue, 08 Nov 2022 08:37:36 +0800
Subject: [PATCH] 安全物资和设备管理
---
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java | 171 ++++----------------------------------------------------
1 files changed, 13 insertions(+), 158 deletions(-)
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java
index a7f0856..5658e24 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java
@@ -1,11 +1,13 @@
package com.gkhy.safePlatform.equipment.controller;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.equipment.entity.*;
import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoImportExcel;
import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoSaveOrUpdate;
import com.gkhy.safePlatform.equipment.model.dto.resp.EquipmentInfoExcel;
import com.gkhy.safePlatform.equipment.utils.DateUtils;
+import com.gkhy.safePlatform.equipment.utils.QueryHelpPlus;
import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelLogs;
import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelUtil;
import com.google.common.collect.Lists;
@@ -52,8 +54,6 @@
@Autowired
public HttpServletRequest request;
- @Autowired
- public HttpServletResponse response;
/**
* 分页查询所有数据
@@ -63,14 +63,9 @@
*/
@PostMapping(value = "/page/list")
public ResultVO selectAll(@RequestBody PageQuery<EquipmentInfoQueryCriteria> pageQuery){
- if(pageQuery.getSearchParams().getInfoType() == null){
- return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL,"缺少infoType");
- }
-
- PageUtils.checkCheck(pageQuery);
return this.equipmentInfoService.queryAll(pageQuery);
}
-
+
/**
* 通过主键查询单条数据
@@ -91,13 +86,6 @@
*/
@PostMapping(value = "/addOrUpdate")
public ResultVO update(@RequestBody EquipmentInfoSaveOrUpdate infoDto) {
- if(infoDto.getInfoType() == null || infoDto.getEquipmentTypeId() == null){
- return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL,"缺少infoType或者equipmentTypeId");
- }
- if(infoDto.getInfoType() == 3){
- return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL,"infoType值异常");
- }
-
equipmentInfoService.addOrUpdate(infoDto);
return new ResultVO<>(ResultCodes.OK);
}
@@ -110,11 +98,8 @@
*/
@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.equipmentInfoService.removeByIds(idList);
+
+ this.equipmentInfoService.delete(ids);
return new ResultVO<>(ResultCodes.OK);
}
@@ -138,62 +123,7 @@
*/
@GetMapping(value = "/exportTemplate")
public void exportTemplate() throws IOException {
- Map<String,String> map = new LinkedHashMap<>();
- map.put("1", "类型/类别外键");
- map.put("2", "具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施 ");
- map.put("3", "名称");
- map.put("4", "位号");
- map.put("5", "用途");
- map.put("6", "型号");
- map.put("7", "单位部门外键");
- map.put("8", "设置部位");
- map.put("9", "生产日期(yyyy-MM-dd HH:mm:ss)");
- map.put("10", "使用期限(天)");
- map.put("11", "生命周期 1:已使用 2:库存中 3:报废");
- map.put("12", "投用日期(yyyy-MM-dd HH:mm:ss)");
- map.put("13", "维修状态 1:维修中 2:已修好");
- map.put("14", "停用状态 1:停用 2.在用 3.维修 4.报废");
- map.put("15", "上次检查日期(yyyy-MM-dd HH:mm:ss)");
- map.put("16", "上次检测日期(yyyy-MM-dd HH:mm:ss)");
- map.put("17", "上次保养日期(yyyy-MM-dd HH:mm:ss)");
- map.put("18", "下次检查日期(yyyy-MM-dd HH:mm:ss)");
- map.put("19", "下次检测日期(yyyy-MM-dd HH:mm:ss)");
- map.put("20", "下次保养日期(yyyy-MM-dd HH:mm:ss)");
- map.put("21", "负责人ID外键");
- map.put("22", "负责人部门外键");
- map.put("23", "供应商");
- map.put("24", "使用说明");
- map.put("25", "是否检查 1:是 2:否");
- map.put("26", "检查周期");
- map.put("27", "检查提前提醒");
- map.put("28", "是否检测 1:是 2:否");
- map.put("29", "检测周期");
- map.put("30", "检测提前提醒");
- map.put("31", "是否保养 1:是 2:否");
- map.put("32", "检查内容");
- map.put("33", "负责部门/外键");
- map.put("34", "检查指标");
- map.put("35", "预警值");
- map.put("36", "联锁值");
- map.put("37", "停用理由");
- map.put("38", "停用后措施");
- map.put("39", "实际停用日期(yyyy-MM-dd HH:mm:ss)");
- map.put("40", "停用提交人/外键");
- map.put("41", "停用提交日期(yyyy-MM-dd HH:mm:ss)");
- map.put("42", "恢复理由");
- map.put("43", "恢复填报日期(yyyy-MM-dd HH:mm:ss)");
- map.put("44", "实际恢复日期(yyyy-MM-dd HH:mm:ss)");
- map.put("45", "报废理由");
- map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
- map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
- map.put("48", "保养周期");
- 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();
+ equipmentInfoService.exportTemplate();
}
@@ -203,21 +133,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<EquipmentInfoImportExcel> importExcel = ExcelUtil.importExcel(EquipmentInfoImportExcel.class, file.getInputStream(), "yyyy-MM-dd HH:mm:ss", new ExcelLogs() , 0);
-
- if (CollectionUtils.isEmpty(importExcel)) {
- return new ResultVO<>(ResultCodes.OK);
- }
-
- List<EquipmentInfo> respList = BeanCopyUtils.copyBeanList((List<EquipmentInfoImportExcel>)importExcel, EquipmentInfo.class);
-
- equipmentInfoService.saveBatch(respList);
+ equipmentInfoService.importData(file);
return new ResultVO<>(ResultCodes.OK);
}
@@ -230,68 +146,7 @@
*/
@GetMapping(value = "/exportData")
public void exportData(EquipmentInfoQueryCriteria queryCriteria) throws IOException {
- Map<String,String> map = new LinkedHashMap<>();
- map.put("0", "ID");
- map.put("1", "类型/类别外键");
- map.put("2", "具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施 ");
- map.put("3", "名称");
- map.put("4", "位号");
- map.put("5", "用途");
- map.put("6", "型号");
- map.put("7", "单位部门外键");
- map.put("8", "设置部位");
- map.put("9", "生产日期(yyyy-MM-dd HH:mm:ss)");
- map.put("10", "使用期限(天)");
- map.put("11", "生命周期 1:已使用 2:库存中 3:报废");
- map.put("12", "投用日期(yyyy-MM-dd HH:mm:ss)");
- map.put("13", "维修状态 1:维修中 2:已修好");
- map.put("14", "停用状态 1:停用 2.在用 3.维修 4.报废");
- map.put("15", "上次检查日期(yyyy-MM-dd HH:mm:ss)");
- map.put("16", "上次检测日期(yyyy-MM-dd HH:mm:ss)");
- map.put("17", "上次保养日期(yyyy-MM-dd HH:mm:ss)");
- map.put("18", "下次检查日期(yyyy-MM-dd HH:mm:ss)");
- map.put("19", "下次检测日期(yyyy-MM-dd HH:mm:ss)");
- map.put("20", "下次保养日期(yyyy-MM-dd HH:mm:ss)");
- map.put("21", "负责人ID外键");
- map.put("22", "负责人部门外键");
- map.put("23", "供应商");
- map.put("24", "使用说明");
- map.put("25", "是否检查 1:是 2:否");
- map.put("26", "检查周期");
- map.put("27", "检查提前提醒");
- map.put("28", "是否检测 1:是 2:否");
- map.put("29", "检测周期");
- map.put("30", "检测提前提醒");
- map.put("31", "是否保养 1:是 2:否");
- map.put("32", "检查内容");
- map.put("33", "负责部门/外键");
- map.put("34", "检查指标");
- map.put("35", "预警值");
- map.put("36", "联锁值");
- map.put("37", "停用理由");
- map.put("38", "停用后措施");
- map.put("39", "实际停用日期(yyyy-MM-dd HH:mm:ss)");
- map.put("40", "停用提交人/外键");
- map.put("41", "停用提交日期(yyyy-MM-dd HH:mm:ss)");
- map.put("42", "恢复理由");
- map.put("43", "恢复填报日期(yyyy-MM-dd HH:mm:ss)");
- map.put("44", "实际恢复日期(yyyy-MM-dd HH:mm:ss)");
- map.put("45", "报废理由");
- map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
- map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
- map.put("48", "保养周期");
-
- 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<EquipmentInfoExcel> respList = BeanCopyUtils.copyBeanList(equipmentInfoService.queryAll(queryCriteria), EquipmentInfoExcel.class);
-
- ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
- response.getOutputStream().close();
+ equipmentInfoService.exportData(queryCriteria);
}
@@ -307,7 +162,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);
@@ -368,10 +223,10 @@
infoDto.setSetPart("");
infoDto.setProduceTime(new Timestamp(new java.util.Date().getTime()));
infoDto.setUseEndDay("");
- infoDto.setLifeCycle(0);
+ infoDto.setLifeCycle((byte)0);
infoDto.setUseDate(new Timestamp(new java.util.Date().getTime()));
- infoDto.setRepairStatus(0);
- infoDto.setStopStatus(0);
+ infoDto.setRepairStatus((byte)0);
+ infoDto.setStopStatus((byte)0);
infoDto.setPreviousCheckDate(new Timestamp(new java.util.Date().getTime()));
infoDto.setPreviousTestDate(new Timestamp(new java.util.Date().getTime()));
infoDto.setPreviousTakecareDate(new Timestamp(new java.util.Date().getTime()));
@@ -409,4 +264,4 @@
System.out.println(JSONObject.toJSONString(infoDto));
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.2