时间类型修改

This commit is contained in:
闫阳 2022-12-09 17:00:02 +08:00
bovenliggende d03a3e06a3
commit c7c43cd906
2 gewijzigde bestanden met toevoegingen van 7 en 4 verwijderingen

Bestand weergeven

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

Bestand weergeven

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