|
@@ -231,6 +231,19 @@ public class DeviceController {
|
|
|
return deviceService.getDeviceModelList();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("风机型号分页查询")
|
|
|
+ @GetMapping(value = "/model/page")
|
|
|
+ public ResponseWrapper queryByPage(
|
|
|
+ @ApiParam(value = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
|
|
|
+ @ApiParam(value = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
|
|
|
+ @ApiParam(value = "风机型号") @RequestParam(value = "code", required = false) String code,
|
|
|
+ @ApiParam(value = "场站名称") @RequestParam(value = "stationname", required = false) String stationname
|
|
|
+ ) {
|
|
|
+ Page<DeviceModel> page = new Page(pageNum, pageSize);
|
|
|
+ IPage<DeviceModel> pageResult = deviceService.pageQueryDeviceModel(page, code,stationname);
|
|
|
+ return ResponseWrapper.success("请求成功",pageResult);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/model/{id}")
|
|
|
public List<DeviceModel> getDeviceModelsById(@PathVariable("id") String id) {
|
|
|
return deviceService.getDeviceModelsById(id);
|
|
@@ -287,6 +300,34 @@ public class DeviceController {
|
|
|
return wrapper;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("将文件数据转化为json")
|
|
|
+ @PostMapping(value ="/conversion")
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseWrapper<DeviceMetrics> converSion(@ApiParam(value = "导入文件") @RequestParam("file") MultipartFile file){
|
|
|
+ ResponseWrapper<DeviceMetrics> wrapper = null;
|
|
|
+ if (!file.isEmpty()) {
|
|
|
+ try {
|
|
|
+ String originalFilename = file.getOriginalFilename();
|
|
|
+ String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
|
|
|
+ Integer startRows = 1;
|
|
|
+ InputStream is = file.getInputStream();
|
|
|
+ List<DeviceMetrics> bindingList = new ArrayList<>();
|
|
|
+ List<String[]> strings = ExcelUtil.readData(fileType, startRows, true, is);
|
|
|
+ for (String[] str : strings) {
|
|
|
+ DeviceMetrics deviceMetrics = new DeviceMetrics();
|
|
|
+ deviceMetrics.setDeviceid(str[0]);
|
|
|
+ deviceMetrics.setName(str[1]);
|
|
|
+ deviceMetrics.setDescription(str[2]);
|
|
|
+ deviceMetrics.setEnname(str[3]);
|
|
|
+ bindingList.add(deviceMetrics);
|
|
|
+ }
|
|
|
+ wrapper = ResponseWrapper.success("转化成功",bindingList);
|
|
|
+ }catch (IOException e) {
|
|
|
+ wrapper = ResponseWrapper.error("转化失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return wrapper;
|
|
|
+ }
|
|
|
|
|
|
//@RequestMapping("input")
|
|
|
@PostMapping(value ="/input")
|