Commit fb9abf4b authored by suhuiguang's avatar suhuiguang

fix(es时区):差8小时

1.es存数据少8小时 2.技术参数整理
parent df9fc1ac
package com.yeejoin.amos.boot.module.common.api.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
......@@ -203,14 +203,14 @@ public class ESEquipmentInfo {
* 投用日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date USC_DATE;
private LocalDate USC_DATE;
/**
*
*创建日期
*/
@Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
private Date createDate;
private LocalDateTime createDate;
/**
......@@ -333,13 +333,13 @@ public class ESEquipmentInfo {
* 下次检验日期-冗余字段
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date NEXT_INSPECT_DATE;
private LocalDate NEXT_INSPECT_DATE;
/**
* 检验日期-冗余字段
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date INSPECT_DATE;
private LocalDate INSPECT_DATE;
/**
* 最新一条检验信息
......@@ -381,7 +381,7 @@ public class ESEquipmentInfo {
private Boolean boolValue;
@Field(type = FieldType.Date, format = DateFormat.date)
private Date dateValue;
private LocalDate dateValue;
public TechParam(TechParamItem paramItem, Object rawValue) {
this.paramKey = paramItem.getParamKey();
......@@ -497,13 +497,13 @@ public class ESEquipmentInfo {
* 检验日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date inspectDate;
private LocalDate inspectDate;
/**
* 下次检验日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date nextInspectDate;
private LocalDate nextInspectDate;
/**
* 检验机构编码
......@@ -545,12 +545,12 @@ public class ESEquipmentInfo {
* 维保合同开始日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date informStart;
private LocalDate informStart;
/**
* 维保合同结束日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date informEnd;
private LocalDate informEnd;
/**
* 维保负责人姓名
*/
......
......@@ -7,7 +7,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.Date;
import java.time.LocalDate;
import java.util.List;
/**
......@@ -167,7 +167,7 @@ public class EsBaseEnterpriseInfo {
* 许可到期日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date expiryDate;
private LocalDate expiryDate;
/**
* 许可项目/检验类型/设备品种(核准项目名称)
......@@ -203,6 +203,6 @@ public class EsBaseEnterpriseInfo {
* 发证日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date issueDate;
private LocalDate issueDate;
}
}
......@@ -7,7 +7,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.Date;
import java.time.LocalDate;
import java.util.List;
/**
......@@ -72,7 +72,7 @@ public class EsUserInfo {
* 出生日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date birthday;
private LocalDate birthday;
/**
* 学历
......@@ -213,7 +213,7 @@ public class EsUserInfo {
* 有效期至
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date expiryDate;
private LocalDate expiryDate;
/**
* 发证机关
......@@ -225,7 +225,7 @@ public class EsUserInfo {
* 发证日期
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private Date issueDate;
private LocalDate issueDate;
/**
* 证书类型
......
......@@ -15,5 +15,11 @@
<artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-boot-biz.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
......@@ -62,6 +62,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Timestamp;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -1512,13 +1513,17 @@ public class DataHandlerServiceImpl {
.select(IdxBizJgFactoryInfo::getRecord, IdxBizJgFactoryInfo::getProduceUnitCreditCode));
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(record);
IdxBizJgMaintenanceRecordInfo lastMaintenanceRecordInfo = maintenanceRecordInfoService.queryNewestDetailByRecord(record);
esEquipmentInfo.setINSPECT_DATE(inspectionDetectionInfo.getSequenceNbr() != null ? inspectionDetectionInfo.getInspectDate() : null);
esEquipmentInfo.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getSequenceNbr() != null ? inspectionDetectionInfo.getNextInspectDate() : null);
try {
esEquipmentInfo.setINSPECT_DATE(inspectionDetectionInfo.getSequenceNbr() != null ? inspectionDetectionInfo.getInspectDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate() : null);
esEquipmentInfo.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getSequenceNbr() != null ? inspectionDetectionInfo.getNextInspectDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate() : null);
esEquipmentInfo.setCreateDate(useInfo.getCreateDate() != null ? useInfo.getCreateDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() : null);
} catch (Exception e) {
log.error("时区转换失败:{}", record, e);
}
esEquipmentInfo.setDesignUnitCreditCode(designInfo.getDesignUnitCreditCode());
esEquipmentInfo.setMAINTAIN_UNIT(lastMaintenanceRecordInfo.getMeUnitCreditCode());
esEquipmentInfo.setMAINTAIN_UNIT_NAME(lastMaintenanceRecordInfo.getMeUnitName());
esEquipmentInfo.setDesignUnitName(designInfo.getDesignUnitName());
esEquipmentInfo.setCreateDate(useInfo.getCreateDate());
esEquipmentInfo.setProduceUnitCreditCode(factoryInfo.getProduceUnitCreditCode());
esEquipmentInfo.setInspections(inspectionDetectionInfo.getSequenceNbr() != null ? Collections.singletonList(BeanUtil.copyProperties(inspectionDetectionInfo, ESEquipmentInfo.Inspection.class)) : new ArrayList<>());
esEquipmentInfo.setMaintenances(lastMaintenanceRecordInfo.getSequenceNbr() != null ? Collections.singletonList(BeanUtil.copyProperties(lastMaintenanceRecordInfo, ESEquipmentInfo.Maintenance.class)) : new ArrayList<>());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment