|
|
@@ -1,30 +1,24 @@
|
|
|
package com.dcs.hnyz.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
-import com.dcs.hnyz.domain.vo.EquipmentParamFormVO;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.dcs.common.annotation.Log;
|
|
|
import com.dcs.common.core.controller.BaseController;
|
|
|
import com.dcs.common.core.domain.AjaxResult;
|
|
|
+import com.dcs.common.core.page.TableDataInfo;
|
|
|
import com.dcs.common.enums.BusinessType;
|
|
|
+import com.dcs.common.utils.poi.ExcelUtil;
|
|
|
import com.dcs.hnyz.domain.EquipmentParam;
|
|
|
+import com.dcs.hnyz.domain.vo.EquipmentParamFormVO;
|
|
|
import com.dcs.hnyz.service.IEquipmentParamService;
|
|
|
-import com.dcs.common.utils.poi.ExcelUtil;
|
|
|
-import com.dcs.common.core.page.TableDataInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 设备参数管理Controller
|
|
|
@@ -151,6 +145,25 @@ public class EquipmentParamController extends BaseController
|
|
|
return success(equipmentParamService.getAllSetParam(code));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @PostMapping("/importTemplate")
|
|
|
+ public void importTemplate(HttpServletResponse response)
|
|
|
+ {
|
|
|
+ ExcelUtil<EquipmentParam> util = new ExcelUtil<EquipmentParam>(EquipmentParam.class);
|
|
|
+ util.importTemplateExcel(response, "设备数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Log(title = "设备导入", businessType = BusinessType.IMPORT)
|
|
|
+ @PostMapping("/importData")
|
|
|
+ public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
|
|
+ {
|
|
|
+ ExcelUtil<EquipmentParam> util = new ExcelUtil<EquipmentParam>(EquipmentParam.class);
|
|
|
+ List<EquipmentParam> equipmentList = util.importExcel(file.getInputStream());
|
|
|
+ String operName = getUsername();
|
|
|
+ String message = equipmentParamService.importEquipment(equipmentList, updateSupport, operName);
|
|
|
+ return success(message);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据设备标识List获取对应所有寄存器的参数配置项数据(用于参数配置页数据初始化)
|
|
|
*/
|