时间类型修改 #14

Merged
yanyang merged 1 commits from yanyang into master 2022-12-09 17:01:11 +08:00
2 changed files with 7 additions and 4 deletions
Showing only changes of commit c7c43cd906 - Show all commits

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
@ -30,7 +31,7 @@ public class InspectionSampleDTO implements Serializable {
private String batchNum; private String batchNum;
@ApiModelProperty(value = "取样时间") @ApiModelProperty(value = "取样时间")
private LocalDateTime sampleTime; private Instant sampleTime;
@ApiModelProperty(value = "样本号") @ApiModelProperty(value = "样本号")
private String sampleNumber; private String sampleNumber;

View File

@ -238,7 +238,8 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
InspectionSampleDTO sampleDTO = new InspectionSampleDTO(); InspectionSampleDTO sampleDTO = new InspectionSampleDTO();
sampleDTO.setSampleNumber(sampleNumber); sampleDTO.setSampleNumber(sampleNumber);
sampleDTO.setSampleTime(LocalDateTime.ofInstant(events.get(0).getTime(), ZoneId.systemDefault())); //sampleDTO.setSampleTime(LocalDateTime.ofInstant(events.get(0).getTime(), ZoneId.systemDefault()));
sampleDTO.setSampleTime(events.get(0).getTime());
sampleDTO.setBatchNum(dto.getBatchNumber()); sampleDTO.setBatchNum(dto.getBatchNumber());
sampleDTO.setInspectionSheetId(events.get(0).getInspectionSheetId()); sampleDTO.setInspectionSheetId(events.get(0).getInspectionSheetId());
@ -264,8 +265,9 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
String sampleNumber = dto.getSampleNumber(); String sampleNumber = dto.getSampleNumber();
String jsonData = dto.getJsonData(); String jsonData = dto.getJsonData();
JSONObject json = JSON.parseObject(jsonData); JSONObject json = JSON.parseObject(jsonData);
LocalDateTime sampleTime = dto.getSampleTime(); // LocalDateTime sampleTime = dto.getSampleTime();
Instant eventTime = sampleTime.toInstant(ZoneOffset.UTC); // Instant eventTime = sampleTime.toInstant(ZoneOffset.UTC);
Instant eventTime = dto.getSampleTime();
List<Event> list = new ArrayList<>(); List<Event> list = new ArrayList<>();
for (Map.Entry entry : json.entrySet()) { for (Map.Entry entry : json.entrySet()) {
String key = entry.getKey().toString(); String key = entry.getKey().toString();