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/EquipmentInfoController.java |   93 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 68 insertions(+), 25 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 fe40613..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,26 +1,40 @@
 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;
+
+import java.io.IOException;
+import java.net.URLEncoder;
 import java.sql.Timestamp;
 
 
 import com.gkhy.safePlatform.equipment.model.dto.resp.EquipmentInfoDto;
 import com.gkhy.safePlatform.equipment.service.EquipmentInfoService;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.gkhy.safePlatform.commons.query.PageQuery;
 import com.gkhy.safePlatform.commons.utils.PageUtils;
 import com.gkhy.safePlatform.commons.vo.ResultVO;
 import com.gkhy.safePlatform.commons.enums.ResultCodes;
 import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoQueryCriteria;
+import org.springframework.web.multipart.MultipartFile;
 
-import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.*;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.io.Serializable;
-import java.util.List;
 
 /**
  * 设备设施详细信息(EquipmentInfo)表控制层
@@ -37,6 +51,10 @@
     @Resource
     private EquipmentInfoService equipmentInfoService;
 
+    @Autowired
+    public HttpServletRequest request;
+
+
     /**
      * 分页查询所有数据
      *
@@ -45,11 +63,6 @@
      */
     @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.getPageIndex(), pageQuery.getPageSize());
 		return this.equipmentInfoService.queryAll(pageQuery);
     }
 
@@ -73,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);
     }
@@ -90,11 +96,10 @@
      * @param ids 主键结合
      * @return 删除结果
      */
-    @GetMapping(value = "/delete")
-    public ResultVO delete(String ids) {
-	List<String> idList = Arrays.stream(ids.split(","))
-                .collect(Collectors.toList());
-        this.equipmentInfoService.removeByIds(idList);
+    @RequestMapping(value = "/delete",method = RequestMethod.POST)
+    public ResultVO delete(@RequestBody Long[] ids) {
+
+        this.equipmentInfoService.delete(ids);
         return new ResultVO<>(ResultCodes.OK);
     }
 
@@ -109,6 +114,44 @@
         return new ResultVO<>(ResultCodes.OK,this.equipmentInfoService.statistics());
     }
 
+
+
+
+    /**
+     * 下载模板
+     *
+     */
+    @GetMapping(value = "/exportTemplate")
+    public void exportTemplate() throws IOException {
+        equipmentInfoService.exportTemplate();
+    }
+
+
+    /**
+     * 导入数据
+     *
+     */
+    @RequestMapping(value = "/importData")
+    public ResultVO importData(MultipartFile file) throws IOException {
+        equipmentInfoService.importData(file);
+        return new ResultVO<>(ResultCodes.OK);
+    }
+
+
+
+
+    /**
+     * 导出一览数据
+     *
+     */
+    @GetMapping(value = "/exportData")
+    public void exportData(EquipmentInfoQueryCriteria queryCriteria) throws IOException {
+        equipmentInfoService.exportData(queryCriteria);
+    }
+
+
+
+
     public static void main(String[] args) {
         EquipmentInfoDto infoDto = new EquipmentInfoDto();
         List<EquipmentRepairDetail> repairDetails = Lists.newArrayList();
@@ -119,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);
@@ -180,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()));
@@ -217,8 +260,8 @@
         infoDto.setDestoryReason("");
         infoDto.setDestorySubmitDate(new Timestamp(new java.util.Date().getTime()));
         infoDto.setActualDestoryDate(new Timestamp(new java.util.Date().getTime()));
-        System.out.println(JSONObject.toJSONString(infoDto));
 
+        System.out.println(JSONObject.toJSONString(infoDto));
 
     }
 }

--
Gitblit v1.9.2