| | |
| | | // 查询订单Id |
| | | InsOrder order = insOrderMapper.selectFirstSubmit(dto.getId()); |
| | | if (order == null) { |
| | | return BeanUtil.isEmpty(insProducts) ? null : insProducts; |
| | | return BeanUtil.isEmpty(insProducts) ? Collections.emptyList() : insProducts; |
| | | } |
| | | insProducts = mergeDirectTemplateSnapshots(order, dto.getId(), dto.getLaboratory(), insProducts); |
| | | if (BeanUtil.isEmpty(insProducts)) { |
| | | return null; |
| | | return Collections.emptyList(); |
| | | } |
| | | getTemplateThing(order, insProducts, dto.getLaboratory()); |
| | | return insProducts; |
| | |
| | | if (snapshots.isEmpty()) { |
| | | return source; |
| | | } |
| | | InsSample sample = insSampleMapper.selectById(sampleId); |
| | | boolean directTemplateOrder = source.stream() |
| | | .anyMatch(product -> product.getTemplateRowIndex() != null) |
| | | || isDirectTemplateSample(order, sample); |
| | | if (!directTemplateOrder) { |
| | | return source; |
| | | } |
| | | |
| | | Map<Integer, List<InsProduct>> productsByTemplate = source.stream() |
| | | .filter(product -> product.getTemplateId() != null) |
| | | .collect(Collectors.groupingBy(InsProduct::getTemplateId, LinkedHashMap::new, Collectors.toList())); |
| | |
| | | firstInspectDate = submitTime; |
| | | } |
| | | |
| | | String insTime = firstInspectDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")) + "-" |
| | | + submitTime.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")); |
| | | String testStartDate = firstInspectDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")); |
| | | String testEndDate = submitTime.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")); |
| | | String insTime = formatReportTestDate(firstInspectDate, submitTime); |
| | | |
| | | String insTimeEn = monthNames[firstInspectDate.getMonthValue() - 1] + " " + firstInspectDate.format(DateTimeFormatter.ofPattern("dd, yyyy")) + "-" |
| | | + monthNames[submitTime.getMonthValue() - 1] + " " + submitTime.format(DateTimeFormatter.ofPattern("dd, yyyy")); |
| | |
| | | put("batch", finalBatchNo); |
| | | put("phone", defaultReportText(insOrder.getPhone(), "/")); |
| | | put("testDate", insTime); |
| | | put("testStartDate", testStartDate); |
| | | put("testEndDate", testEndDate); |
| | | put("entrustNo", defaultReportText(insOrder.getEntrustCode(), "/")); |
| | | put("sampling", "/"); |
| | | put("standard", finalStandardMethodText); |
| | |
| | | if (CollectionUtils.isEmpty(deviceList)) { |
| | | return "/"; |
| | | } |
| | | Set<String> lines = new LinkedHashSet<>(); |
| | | int sequence = 1; |
| | | Set<String> equipmentItems = new LinkedHashSet<>(); |
| | | for (Map<String, String> device : deviceList) { |
| | | String name = getMapText(device, "deviceName", "device_name"); |
| | | String managementNumber = getMapText(device, "managementNumber", "management_number"); |
| | | String line = sequence++ + ". " + defaultReportText(name, "/"); |
| | | String item = defaultReportText(name, "/"); |
| | | if (StringUtils.isNotBlank(managementNumber)) { |
| | | line += ":" + managementNumber; |
| | | item += ":" + managementNumber; |
| | | } |
| | | lines.add(line); |
| | | equipmentItems.add(item); |
| | | } |
| | | List<String> items = new ArrayList<>(equipmentItems); |
| | | List<String> lines = new ArrayList<>(); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | String punctuation = i == items.size() - 1 ? "。" : ";"; |
| | | lines.add((i + 1) + ". " + items.get(i) + punctuation); |
| | | } |
| | | return String.join("\n", lines); |
| | | } |
| | |
| | | .collect(Collectors.toList()); |
| | | |
| | | String temperature = formatConditionRange(temperatures, order.getTemperature(), "℃"); |
| | | String humidity = formatConditionRange(humidities, order.getHumidity(), "%"); |
| | | String humidity = formatConditionRange(humidities, order.getHumidity(), "%RH"); |
| | | return Stream.of(temperature, humidity) |
| | | .filter(StringUtils::isNotBlank) |
| | | .collect(Collectors.joining(" ")); |
| | |
| | | return StringUtils.isNotBlank(fallback) ? fallback : "/"; |
| | | } |
| | | |
| | | private static String formatReportTestDate(LocalDateTime startTime, LocalDateTime endTime) { |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日"); |
| | | if (startTime.toLocalDate().equals(endTime.toLocalDate())) { |
| | | return startTime.format(formatter); |
| | | } |
| | | return startTime.format(formatter) + "至" + endTime.format(formatter); |
| | | } |
| | | |
| | | /** |
| | | * 计算表格列宽度 |
| | | * |