Merge pull request '时间类型修改' (#14) from yanyang into master

Reviewed-on: #14
This commit is contained in:
闫阳 2022-12-09 17:01:11 +08:00
commit 1173d670e4
2 changed files with 7 additions and 4 deletions

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();