From e8ad669f7c97d45cd23630dc101180a130d6c17e Mon Sep 17 00:00:00 2001 From: dongyukun <1208714201@qq.com> Date: 星期二, 05 十一月 2024 10:04:57 +0800 Subject: [PATCH] tag当前值开发 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java | 36 ++++++++++++++++++++++-------------- 1 files changed, 22 insertions(+), 14 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java index f4d16b2..efc7dce 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java @@ -8,6 +8,8 @@ import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.framework.excel.core.util.ExcelUtils; import com.iailab.module.data.api.dto.ApiPointValueQueryDTO; +import com.iailab.module.data.channel.common.service.ChannelSourceService; +import com.iailab.module.data.common.enums.DataSourceType; import com.iailab.module.data.influxdb.service.InfluxDBService; import com.iailab.module.data.point.dto.DaPointDTO; import com.iailab.module.data.point.entity.DaPointEntity; @@ -55,7 +57,7 @@ @PreAuthorize("@ss.hasPermission('data:point:query')") @GetMapping("page") - public CommonResult<PageResult<DaPointDTO>> page(@Valid DaPointPageReqVO reqVO){ + public CommonResult<PageResult<DaPointDTO>> page(@Valid DaPointPageReqVO reqVO) { PageResult<DaPointDTO> page = daPointService.queryPage(reqVO); return success(page); } @@ -70,14 +72,14 @@ @PreAuthorize("@ss.hasPermission('data:point:query')") @GetMapping("/info/{id}") - public CommonResult<DaPointDTO> info(@PathVariable("id") String id){ - DaPointDTO info= daPointService.info(id); + public CommonResult<DaPointDTO> info(@PathVariable("id") String id) { + DaPointDTO info = daPointService.info(id); return success(info); } @PreAuthorize("@ss.hasPermission('data:point:create')") @PostMapping("create") - public CommonResult<Boolean> create(@RequestBody DaPointDTO daPointDTO){ + public CommonResult<Boolean> create(@RequestBody DaPointDTO daPointDTO) { String id = UUID.randomUUID().toString(); daPointDTO.setId(id); daPointService.add(daPointDTO); @@ -100,7 +102,7 @@ @PreAuthorize("@ss.hasPermission('data:point:query')") @GetMapping("pointNo") - public CommonResult<List<DaPointDTO>> getpoint(@RequestParam Map<String, Object> params){ + public CommonResult<List<DaPointDTO>> getPoint(@RequestParam Map<String, Object> params) { List<DaPointDTO> list = daPointService.list(params); return new CommonResult<List<DaPointDTO>>().setData(list); @@ -129,11 +131,16 @@ @PreAuthorize("@ss.hasPermission('data:point:export')") @ApiAccessLog(operateType = EXPORT) public void exportPointList(@Validated DaPointPageReqVO exportReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List<DaPointEntity> list = daPointService.queryExcelList(exportReqVO).getList(); - List<DaPointExcelVO> daPointExcelVOlist = ConvertUtils.sourceToTarget(list,DaPointExcelVO.class); - ExcelUtils.write(response, "测点列表.xls", "数据", DaPointExcelVO.class, daPointExcelVOlist); + List<DaPointExcelVO> dataList = new ArrayList<>(); + List<DaPointDTO> measurePointList = daPointService.getMeasurePoint(exportReqVO); + dataList.addAll(ConvertUtils.sourceToTarget(measurePointList, DaPointExcelVO.class)); + List<DaPointDTO> mathPointList = daPointService.getMathPoint(exportReqVO); + dataList.addAll(ConvertUtils.sourceToTarget(mathPointList, DaPointExcelVO.class)); + List<DaPointDTO> constantPointList = daPointService.getConstantPoint(exportReqVO); + dataList.addAll(ConvertUtils.sourceToTarget(constantPointList, DaPointExcelVO.class)); + ExcelUtils.write(response, "测点列表.xls", "测点列表", DaPointExcelVO.class, dataList); } @GetMapping("/exportValue") @@ -149,16 +156,16 @@ List<String> pointNos = new ArrayList<>(); pointNos.add(pointNo); queryDto.setPointNos(pointNos); - try{ + try { if (start == null) { queryDto.setStart(new Date()); - }else{ + } else { queryDto.setStart(formatter.parse(start)); } if (end == null) { queryDto.setEnd(new Date()); - }else{ + } else { queryDto.setStart(formatter.parse(end)); } } catch (ParseException e) { @@ -175,11 +182,12 @@ List<PointImportExcelVO> list = Arrays.asList( PointImportExcelVO.builder().pointName("测点1").pointType("MEASURE").dataType("float").valueType("SIMULATE") .storeType(null).unit("t(非必填)").unittransfactor(new BigDecimal(1)).defaultValue(new BigDecimal(0)).maxValue(new BigDecimal(10000000.000000)).minValue(new BigDecimal(0)) - .minfreqid("NET10").remark("备注(非必填)").sourceType("HTTP").sourceId("b9d0f670-2135-458f-9494-0cda4f35ec09").tagNo("SARD1200G00102RC001") + .minfreqid("1min").remark("备注(非必填)").sourceType(DataSourceType.HTTP.getCode()) + .sourceName("").tagNo("SARD1200G00102RC001") .build() ); // 输出 - ExcelUtils.write(response, "测点导入模板.xls", "测点列表", PointImportExcelVO.class, list); + ExcelUtils.write(response, "测点导入模板.xlsx", "测点列表", PointImportExcelVO.class, list); } @PostMapping("/import") -- Gitblit v1.9.3