Merge branch 'feature/SUPPORT-9484_fix_date' into develop
This commit is contained in:
commit
6da5b0e096
9 changed files with 42 additions and 20 deletions
|
|
@ -100,9 +100,9 @@ public class InteractionLog extends TableImpl<InteractionLogRecord> {
|
|||
public final TableField<InteractionLogRecord, String> ERVU_ID = createField(DSL.name("ervu_id"), SQLDataType.VARCHAR(36), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.interaction_log.offset</code>.
|
||||
* The column <code>public.interaction_log.zone_offset</code>.
|
||||
*/
|
||||
public final TableField<InteractionLogRecord, String> OFFSET = createField(DSL.name("offset"), SQLDataType.VARCHAR(10), this, "");
|
||||
public final TableField<InteractionLogRecord, String> ZONE_OFFSET = createField(DSL.name("zone_offset"), SQLDataType.VARCHAR(10), this, "");
|
||||
|
||||
private InteractionLog(Name alias, Table<InteractionLogRecord> aliased) {
|
||||
this(alias, aliased, (Field<?>[]) null, null);
|
||||
|
|
|
|||
|
|
@ -160,16 +160,16 @@ public class InteractionLogRecord extends TableRecordImpl<InteractionLogRecord>
|
|||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>public.interaction_log.offset</code>.
|
||||
* Setter for <code>public.interaction_log.zone_offset</code>.
|
||||
*/
|
||||
public void setOffset(String value) {
|
||||
public void setZoneOffset(String value) {
|
||||
set(10, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.interaction_log.offset</code>.
|
||||
* Getter for <code>public.interaction_log.zone_offset</code>.
|
||||
*/
|
||||
public String getOffset() {
|
||||
public String getZoneOffset() {
|
||||
return (String) get(10);
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ public class InteractionLogRecord extends TableRecordImpl<InteractionLogRecord>
|
|||
/**
|
||||
* Create a detached, initialised InteractionLogRecord
|
||||
*/
|
||||
public InteractionLogRecord(Long id, Timestamp sentDate, String form, String sender, String status, String fileName, Integer recordsSent, Integer recordsAccepted, String fileId, String ervuId, String offset) {
|
||||
public InteractionLogRecord(Long id, Timestamp sentDate, String form, String sender, String status, String fileName, Integer recordsSent, Integer recordsAccepted, String fileId, String ervuId, String zoneOffset) {
|
||||
super(InteractionLog.INTERACTION_LOG);
|
||||
|
||||
setId(id);
|
||||
|
|
@ -200,7 +200,7 @@ public class InteractionLogRecord extends TableRecordImpl<InteractionLogRecord>
|
|||
setRecordsAccepted(recordsAccepted);
|
||||
setFileId(fileId);
|
||||
setErvuId(ervuId);
|
||||
setOffset(offset);
|
||||
setZoneOffset(zoneOffset);
|
||||
resetChangedOnNotNull();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package ru.micord.ervu.journal;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
|
@ -78,7 +79,7 @@ public class JournalFileInfo {
|
|||
private Integer filePatternCode; // Номер шаблона(Формы)
|
||||
private String filePatternName;
|
||||
@JsonDeserialize(using = DepartureDateTimeDeserializer.class)
|
||||
private LocalDateTime departureDateTime; // Дата-время отправки файла
|
||||
private ZonedDateTime departureDateTime; // Дата-время отправки файла
|
||||
private String timeZone; //Таймзона
|
||||
private JournalFileStatus fileStatus;
|
||||
private String type;
|
||||
|
|
@ -119,11 +120,11 @@ public class JournalFileInfo {
|
|||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDepartureDateTime() {
|
||||
public ZonedDateTime getDepartureDateTime() {
|
||||
return departureDateTime;
|
||||
}
|
||||
|
||||
public JournalFileDetails setDepartureDateTime(LocalDateTime departureDateTime) {
|
||||
public JournalFileDetails setDepartureDateTime(ZonedDateTime departureDateTime) {
|
||||
this.departureDateTime = departureDateTime;
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,18 +2,19 @@ package ru.micord.ervu.journal.deserializer;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import ru.micord.ervu.util.DateUtils;
|
||||
|
||||
public class DepartureDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
|
||||
public class DepartureDateTimeDeserializer extends JsonDeserializer<ZonedDateTime> {
|
||||
|
||||
@Override
|
||||
public LocalDateTime deserialize(JsonParser jsonParser,
|
||||
public ZonedDateTime deserialize(JsonParser jsonParser,
|
||||
DeserializationContext deserializationContext) throws IOException {
|
||||
String dateTimeString = jsonParser.getText();
|
||||
return DateUtils.convertToLocalDateTime(dateTimeString);
|
||||
return DateUtils.convertToZoneDateTime(dateTimeString);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package ru.micord.ervu.journal.mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
|
@ -35,7 +34,7 @@ public class JournalDtoMapper {
|
|||
public static JournalDto mapToJournalDto(InteractionLogRecord record) {
|
||||
return new JournalDto()
|
||||
.setDepartureDateTime(
|
||||
parseDateTime(record.getSentDate().toLocalDateTime(), record.getOffset()))
|
||||
parseDateTime(record.getSentDate().toInstant().atZone(ZoneOffset.UTC), record.getZoneOffset()))
|
||||
.setFileName(record.getFileName())
|
||||
.setFilePatternCode(Integer.valueOf(record.getForm()))
|
||||
.setSenderFio(record.getSender())
|
||||
|
|
@ -46,14 +45,13 @@ public class JournalDtoMapper {
|
|||
.setFileId(record.getFileId());
|
||||
}
|
||||
|
||||
private static String parseDateTime(LocalDateTime dateTime, String timeZone) {
|
||||
private static String parseDateTime(ZonedDateTime dateTime, String timeZone) {
|
||||
if (timeZone == null) {
|
||||
timeZone = "+00:00";
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss");
|
||||
ZonedDateTime utcZoned = dateTime.atZone(ZoneOffset.UTC);
|
||||
ZoneOffset offset = ZoneOffset.of(timeZone);
|
||||
ZonedDateTime zonedDateTime = utcZoned.withZoneSameInstant(offset);
|
||||
ZonedDateTime zonedDateTime = dateTime.withZoneSameInstant(offset);
|
||||
return zonedDateTime.format(formatter) + " (" + timeZone + ")";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class InteractionServiceImpl implements InteractionService {
|
|||
.set(INTERACTION_LOG.SENDER, sender)
|
||||
.set(INTERACTION_LOG.FILE_NAME, fileName)
|
||||
.set(INTERACTION_LOG.ERVU_ID, ervuId)
|
||||
.set(INTERACTION_LOG.OFFSET, offset)
|
||||
.set(INTERACTION_LOG.ZONE_OFFSET, offset)
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,12 @@ public final class DateUtils {
|
|||
: null;
|
||||
}
|
||||
|
||||
public static ZonedDateTime convertToZoneDateTime(String dateTime) {
|
||||
return hasText(dateTime)
|
||||
? ZonedDateTime.parse(dateTime, DATE_TIME_FORMATTER)
|
||||
: null;
|
||||
}
|
||||
|
||||
public static String convertToString(LocalDateTime dateTime) {
|
||||
return dateTime == null ? "" : dateTime.format(DATE_TIME_FORMATTER);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
|
||||
|
||||
<changeSet id="01" author="tihomirov">
|
||||
<comment>Rename column offset to zoneOffset</comment>
|
||||
<createTable tableName="organization_allowed">
|
||||
<column name="id" type="bigint" autoIncrement="true">
|
||||
<constraints primaryKey="true" primaryKeyName="pk_organization_allowed"/>
|
||||
</column>
|
||||
<column name="ogrn" type="varchar(15)">
|
||||
<constraints nullable="false" unique="true" uniqueConstraintName="uni_organization_allowed_ogrn"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
|
@ -10,5 +10,6 @@
|
|||
<include file="2024-09-18--02-add-shedlock-table.xml" relativeToChangelogFile="true"/>
|
||||
<include file="2025-10-20-create-offset-column.xml" relativeToChangelogFile="true"/>
|
||||
<include file="2025-10-24-add-org-allowed-table.xml" relativeToChangelogFile="true"/>
|
||||
<include file="2025-11-05-rename-column.xml" relativeToChangelogFile="true"/>
|
||||
|
||||
</databaseChangeLog>
|
||||
Loading…
Add table
Add a link
Reference in a new issue