| | |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public int upDeviceParameter(Device itemParameter) { |
| | | // 删除数采集配置数据 |
| | | dataConfigService.deleteDataConfig(); |
| | | // 需要同时更改 device表 |
| | | |
| | | |
| | | return deviceMapper.updateById(itemParameter); |
| | | } |
| | |
| | | .eq(DataConfig::getDeviceId, device.getId())); |
| | | |
| | | // 获取设备配置类 |
| | | // 判断设备是否是数字直桥 |
| | | // 判断设备是否是数字直桥JCZX-ZB-ER02022 |
| | | if (device.getManagementNumber().equals("JCZX-ZB-ER02022")) { |
| | | map.putAll(dataCollectBridge(list, device, dto.getEntrustCode())); |
| | | // list:包含设备配置信息的 DataConfig 列表。 |
| | | // device:当前的设备对象。 |
| | | // dto.getEntrustCode():从 DeviceCollectionDto 对象中获取的委托编码 |
| | | } else { |
| | | map.putAll(DataAcquisition.dataAcquisitionEntrance(list, device, dto.getEntrustCode(), dto.getEntrustCode(), ip, insProducts.get(0).getCableTag())); |
| | | // list:包含设备配置信息的 DataConfig 列表。 |
| | | // device:当前的设备对象。 |
| | | // dto.getEntrustCode():委托编码,此处传入两次。 |
| | | // ip:当前设备的 IP 地址。 |
| | | // insProducts.get(0).getCableTag():从 insProducts 列表的第一个元素中获取的电缆标签 |
| | | } |
| | | } |
| | | |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导出失败"); |
| | |
| | | DeviceMaintenance deviceMaintenance = deviceMaintenanceList.get(i); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | // 维修日期 |
| | | deviceMetricRecordAndMaintenanceDto.setMaintenanceDateString(deviceMaintenance.getDate().format(dateTimeFormatter)); |
| | | deviceMetricRecordAndMaintenanceDto.setMaintenanceDateString(deviceMaintenance.getMaintenanceDate().format(dateTimeFormatter)); |
| | | // 处理方法 |
| | | deviceMetricRecordAndMaintenanceDto.setHandlingMethod(deviceMaintenance.getContent()); |
| | | deviceMetricRecordAndMaintenanceDto.setHandlingMethod(deviceMaintenance.getMaintenanceContent()); |
| | | // 备注 |
| | | deviceMetricRecordAndMaintenanceDto.setComments(deviceMaintenance.getComments()); |
| | | deviceMetricRecordAndMaintenanceDto.setComments(deviceMaintenance.getRemark()); |
| | | } |
| | | |
| | | deviceMetricRecordAndMaintenanceDtoList.add(deviceMetricRecordAndMaintenanceDto); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导出失败"); |