|
@@ -47,6 +47,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.*;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.ZonedDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
@@ -233,11 +236,43 @@ public class TrialSummaryController {
|
|
|
}
|
|
|
} else {
|
|
|
//非跨行
|
|
|
- String[] splitValues = tabDataStr.split(Pattern.quote("_^_"));
|
|
|
- String valueInput = splitValues[0];
|
|
|
- String indexKey = splitValues[1];
|
|
|
- String keyName = elementKey + "__" + indexKey;
|
|
|
- map.put(keyName, valueInput);
|
|
|
+ if (tabDataStr.contains(".000Z]") && tabDataStr.contains("T")) {
|
|
|
+ String[] splitValues = tabDataStr.split(Pattern.quote("_^_"));
|
|
|
+ String valueInput = splitValues[0];
|
|
|
+ String indexKey = splitValues[1];
|
|
|
+ String keyName = elementKey + "__" + indexKey;
|
|
|
+
|
|
|
+ //范围日期
|
|
|
+ String[] split = valueInput.split(",");
|
|
|
+ String date_1 = split[0].trim();
|
|
|
+ String date_2 = split[1].trim();
|
|
|
+ LocalDateTime startTime = LocalDateTime.parse(date_1, DateTimeFormatter.ISO_DATE_TIME);
|
|
|
+ LocalDateTime endTime = LocalDateTime.parse(date_2, DateTimeFormatter.ISO_DATE_TIME);
|
|
|
+ ZonedDateTime startZonedTime = startTime.atZone(ZoneId.of("UTC"));
|
|
|
+ ZonedDateTime endZonedTime = endTime.atZone(ZoneId.of("UTC"));
|
|
|
+ String time_1 = startZonedTime.format(DateTimeFormatter.ISO_DATE_TIME);
|
|
|
+ String time_2 = endZonedTime.format(DateTimeFormatter.ISO_DATE_TIME);
|
|
|
+ map.put(keyName, time_1 + "~" + time_2);
|
|
|
+
|
|
|
+ } else if (tabDataStr.contains(".000Z") && tabDataStr.contains("T")) {
|
|
|
+ String[] splitValues = tabDataStr.split(Pattern.quote("_^_"));
|
|
|
+ String valueInput = splitValues[0];
|
|
|
+ String indexKey = splitValues[1];
|
|
|
+ String keyName = elementKey + "__" + indexKey;
|
|
|
+
|
|
|
+ //单日期
|
|
|
+ LocalDateTime time = LocalDateTime.parse(valueInput, DateTimeFormatter.ISO_DATE_TIME);
|
|
|
+ ZonedDateTime zonedDateTime = time.atZone(ZoneId.of("UTC"));
|
|
|
+ String timeStr = zonedDateTime.format(DateTimeFormatter.ISO_DATE_TIME);
|
|
|
+ map.put(keyName, timeStr);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ String[] splitValues = tabDataStr.split(Pattern.quote("_^_"));
|
|
|
+ String valueInput = splitValues[0];
|
|
|
+ String indexKey = splitValues[1];
|
|
|
+ String keyName = elementKey + "__" + indexKey;
|
|
|
+ map.put(keyName, valueInput);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -270,6 +305,15 @@ public class TrialSummaryController {
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存记录数据
|
|
|
+ *
|
|
|
+ * @param needsSavedData
|
|
|
+ * @param obj
|
|
|
+ * @param classC
|
|
|
+ * @return
|
|
|
+ * @throws JsonProcessingException
|
|
|
+ */
|
|
|
private boolean saveData(Map<String, String> needsSavedData, TrialSummaryRecord obj, TrialSummaryClassificationConfiguration classC) throws JsonProcessingException {
|
|
|
if (needsSavedData.size() > 0) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
@@ -322,7 +366,7 @@ public class TrialSummaryController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public static void mergeAndCenterCells(Sheet sheet, int x1, int x2, int y1, int y2, String value) {
|
|
|
+ private void mergeAndCenterCells(Sheet sheet, int x1, int x2, int y1, int y2, String value) {
|
|
|
if (!isAlreadyMerged(sheet, x1, x2, y1, y2)) {
|
|
|
CellRangeAddress mergedRegion = new CellRangeAddress(y1, y2, x1, x2);
|
|
|
sheet.addMergedRegion(mergedRegion);
|
|
@@ -352,7 +396,7 @@ public class TrialSummaryController {
|
|
|
cell.setCellStyle(style);
|
|
|
}
|
|
|
|
|
|
- private static boolean isAlreadyMerged(Sheet sheet, int x1, int x2, int y1, int y2) {
|
|
|
+ private boolean isAlreadyMerged(Sheet sheet, int x1, int x2, int y1, int y2) {
|
|
|
for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
|
|
|
CellRangeAddress existingRegion = sheet.getMergedRegion(i);
|
|
|
if (existingRegion.getFirstColumn() == x1
|
|
@@ -400,17 +444,21 @@ public class TrialSummaryController {
|
|
|
private Map<String, String> indexMap(String htmlString, Map<String, Object> values, Map<String, String> needsSavedData) {
|
|
|
Map<String, String> resultIndex = new LinkedHashMap<>();
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
- Elements elInputs = doc.select("el-input");
|
|
|
- for (Element elInput : elInputs) {
|
|
|
- String keyName = elInput.attr("keyname");
|
|
|
- if (values.containsKey(keyName)) {
|
|
|
- String value = values.get(keyName).toString();
|
|
|
- String colIndex_1 = elInput.attr("x1");
|
|
|
- String colIndex_2 = elInput.attr("x2");
|
|
|
- String rowIndex_1 = elInput.attr("y1");
|
|
|
- String rowIndex_2 = elInput.attr("y2");
|
|
|
- resultIndex.put(colIndex_1 + ":" + colIndex_2 + "@" + rowIndex_1 + ":" + rowIndex_2, value);
|
|
|
- needsSavedData.put(keyName, value);
|
|
|
+ String[] tagNames = {"el-input", "el-date-picker", "el-time-picker", "hc-form-select-search",
|
|
|
+ "hc-table-form-upload", "hc-form-checkbox-group", "el-radio-group", "el-select"};
|
|
|
+ for (String tagName : tagNames) {
|
|
|
+ Elements matchedElements = doc.select(tagName);
|
|
|
+ for (Element element : matchedElements) {
|
|
|
+ String keyName = element.attr("keyname");
|
|
|
+ if (values.containsKey(keyName)) {
|
|
|
+ String value = values.get(keyName).toString();
|
|
|
+ String colIndex_1 = element.attr("x1");
|
|
|
+ String colIndex_2 = element.attr("x2");
|
|
|
+ String rowIndex_1 = element.attr("y1");
|
|
|
+ String rowIndex_2 = element.attr("y2");
|
|
|
+ resultIndex.put(colIndex_1 + ":" + colIndex_2 + "@" + rowIndex_1 + ":" + rowIndex_2, value);
|
|
|
+ needsSavedData.put(keyName, value);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return resultIndex;
|
|
@@ -453,10 +501,9 @@ public class TrialSummaryController {
|
|
|
|
|
|
@PostMapping("/download")
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
- @ApiOperation(value = "下载", notes = "")
|
|
|
+ @ApiOperation(value = "下载", notes = "调page接口的pdfUrl下载")
|
|
|
public R<Object> download() {
|
|
|
- //TODO
|
|
|
- return null;
|
|
|
+ return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
|