| | |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.framework.excel.core.util.ExcelUtils; |
| | | import com.iailab.module.data.channel.opcua.collector.OpcUaCollector; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagExportExcelVO; |
| | |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagPageReqVO; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagRespVO; |
| | | import com.iailab.module.data.channel.tag.vo.TagImportRespVO; |
| | | import com.iailab.module.data.common.enums.DataQualityEnum; |
| | | import com.iailab.module.data.common.enums.IsEnableEnum; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | |
| | | |
| | | /** |
| | | * 操作opcua tag配置 |
| | | * |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | |
| | | @Resource |
| | | private ChannelOPCUATagService channelOpcuaTagService; |
| | | |
| | | @Resource |
| | | private OpcUaCollector opcUaCollector; |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')") |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<OpcUaTagRespVO>> list(@Valid OpcUaTagPageReqVO reqVO) { |
| | | PageResult<ChannelOPCUATagEntity> page = channelOpcuaTagService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, OpcUaTagRespVO.class)); |
| | | PageResult<OpcUaTagRespVO> pageResult = BeanUtils.toBean(page, OpcUaTagRespVO.class); |
| | | pageResult.getList().forEach(item -> { |
| | | item.setDataValue(opcUaCollector.getTagValue(reqVO.getDeviceId(), item.getTagName())); |
| | | item.setDataTime(new Date()); |
| | | item.setDataQuality(DataQualityEnum.getEumByValue(item.getDataValue()).getDesc()); |
| | | }); |
| | | return success(pageResult); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')") |
| | |
| | | .build() |
| | | ); |
| | | // 输出 |
| | | ExcelUtils.write(response, "tag导入模板.xls", "tag列表", OpcUaTagImportExcelVO.class, list,true); |
| | | ExcelUtils.write(response, "tag导入模板.xls", "tag列表", OpcUaTagImportExcelVO.class, list, true); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | |
| | | @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport, |
| | | @RequestParam("device") String device) throws Exception { |
| | | List<OpcUaTagImportExcelVO> list = ExcelUtils.read(file, OpcUaTagImportExcelVO.class); |
| | | return success(channelOpcuaTagService.importOpcUaTagList(list, updateSupport,device)); |
| | | return success(channelOpcuaTagService.importOpcUaTagList(list, updateSupport, device)); |
| | | } |
| | | } |