| | |
| | | import com.battery.business.domain.TTestDataRevisionAction; |
| | | import com.battery.business.mapper.TTestMapper; |
| | | import com.battery.business.service.ITestConsoleDataService; |
| | | import com.battery.device.api.TestDataObservationAdapter.CycleRecord; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | values.put("source_identity", String.join(":", List.of("adapter_code", "devtype", "devid", "subdevid", "chlid") |
| | | .stream().map(key -> String.valueOf(binding.get(key))).toList())); |
| | | values.put("source_record_id", importText(row, "recordNo", "记录编号", 128)); |
| | | // 导入的循环统计来自授权文件,不是设备提供的循环汇总行,也不是本系统按工步层聚合的值。 |
| | | if ("CYCLE".equals(type)) values.put("source_kind", CycleRecord.SOURCE_IMPORTED); |
| | | Date time; |
| | | try { |
| | | Object raw = row.get("recordedAt"); |
| | |
| | | } |
| | | if ("REALTIME".equals(type)) |
| | | { |
| | | // 相对时长是来源事实,独立于绝对设备时间;旧记录缺失不补算。 |
| | | BigDecimal relativeTime = importMetric(row, "relativeTimeSeconds"); |
| | | if (relativeTime != null && relativeTime.signum() < 0) throw new ServiceException("列「记录时间(h:min:s.ms)」:不能为负数"); |
| | | Map<String, Object> extension = new LinkedHashMap<>(); |
| | | extension.put("relativeTimeSeconds", relativeTime); |
| | | values.put("extension_measurements_json", JSON.toJSONString(extension)); |
| | | values.put("cabinet_sequence_id", importInteger(row, "sequenceId", "记录序号", 9007199254740991L)); |
| | | for (String field : List.of("devtype", "devid", "subdevid", "chlid")) values.put("cabinet_" + field, binding.get(field)); |
| | | // 导入不是轮询采样;同秒可有不同记录,设备时间不能为槽位唯一性而偏移。 |
| | |
| | | private String metricLabel(String field) |
| | | { |
| | | return switch (field) { |
| | | case "relativeTimeSeconds" -> "记录时间(h:min:s.ms)"; |
| | | case "voltage" -> "电压(V)"; case "current" -> "电流(A)"; case "capacity" -> "容量(Ah)"; case "energy" -> "能量(Wh)"; |
| | | case "temperature" -> "温度(℃)"; case "positivePotential" -> "正电位(V)"; case "negativePotential" -> "负电位(V)"; |
| | | case "endVoltage" -> "终止电压(V)"; case "startVoltage" -> "起始电压(V)"; case "stepDuration" -> "工步时间"; |