| | |
| | | import com.iailab.module.data.influxdb.service.InfluxDBService; |
| | | import com.iailab.module.data.point.common.PointTypeEnum; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.dto.DaPointSimpleDTO; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.point.vo.*; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:point:query')") |
| | | @GetMapping("/simple-list") |
| | | @Operation(summary = "列表") |
| | | public CommonResult<List<DaPointSimpleDTO>> simpleList(@Valid @RequestParam Map<String, Object> params) { |
| | | List<DaPointDTO> list = daPointService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, DaPointSimpleDTO.class)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:point:query')") |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<DaPointDTO> info(@PathVariable("id") String id) { |
| | | DaPointDTO info = daPointService.info(id); |
| | |
| | | @PreAuthorize("@ss.hasPermission('data:point:update')") |
| | | @PutMapping("/enable") |
| | | @Operation(summary = "启用") |
| | | @Transactional |
| | | public CommonResult<Boolean> enable(@RequestBody String[] ids) { |
| | | daPointService.enableByIds(ids); |
| | | return success(true); |
| | |
| | | @PreAuthorize("@ss.hasPermission('data:point:update')") |
| | | @PutMapping("/disable") |
| | | @Operation(summary = "禁用") |
| | | @Transactional |
| | | public CommonResult<Boolean> disable(@RequestBody String[] ids) { |
| | | daPointService.disableByIds(ids); |
| | | return success(true); |
| | |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportPointList(@Validated DaPointPageReqVO exportReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<DaPointExcelVO> dataList = new ArrayList<>(); |
| | | List<DaPointDTO> measurePointList = daPointService.getMeasurePoint(exportReqVO); |
| | | List<DaPointExcelVO> dataList = ConvertUtils.sourceToTarget(daPointService.getList(exportReqVO), DaPointExcelVO.class); |
| | | /*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)); |
| | | List<DaPointDTO> cumulatePointList = daPointService.getCumulatePoint(exportReqVO); |
| | | dataList.addAll(ConvertUtils.sourceToTarget(cumulatePointList, DaPointExcelVO.class));*/ |
| | | ExcelUtils.write(response, "测点列表.xls", "测点列表", DaPointExcelVO.class, dataList); |
| | | } |
| | | |
| | |
| | | @Parameter(name = "file", description = "Excel 文件", required = true), |
| | | @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") |
| | | }) |
| | | // @PreAuthorize("@ss.hasPermission('data:point:import')") |
| | | public CommonResult<PointImportRespVO> importExcel(@RequestParam("file") MultipartFile file, |
| | | @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { |
| | | List<PointImportExcelVO> list = ExcelUtils.read(file, PointImportExcelVO.class); |