Commit 86092161 authored by suhuiguang's avatar suhuiguang

feat(综合搜索):字段调整

1.post newPost subPost equipType equipCategory 由【】调整为逗号分割 2.企业+人员信息增加创建日期
parent 43929d75
......@@ -8,6 +8,7 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -131,6 +132,13 @@ public class EsBaseEnterpriseInfo {
@Field(type = FieldType.Nested)
private List<License> licenses;
/**
* 创建时间
*/
@Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
private LocalDateTime createDate;
@Data
public static class License {
......@@ -204,5 +212,6 @@ public class EsBaseEnterpriseInfo {
*/
@Field(type = FieldType.Date, format = DateFormat.date)
private LocalDate issueDate;
}
}
......@@ -8,6 +8,7 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -176,6 +177,12 @@ public class EsUserInfo {
@Field(type = FieldType.Nested)
private List<License> licenses;
/**
* 创建时间
*/
@Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
private LocalDateTime createDate;
@Data
public static class License {
......
......@@ -1424,6 +1424,7 @@ public class DataHandlerServiceImpl {
EsBaseEnterpriseInfo esBaseEnterpriseInfo = new EsBaseEnterpriseInfo();
BeanUtil.copyProperties(enterpriseInfo, esBaseEnterpriseInfo);
esBaseEnterpriseInfo.setSequenceNbr(enterpriseInfo.getSequenceNbr() + "");
esBaseEnterpriseInfo.setEquipCategory(StatisticsDataUpdateService.castStrList2String(enterpriseInfo.getEquipCategory()));
List<TzBaseUnitLicence> unitLicences = licenceMapper.selectList(new LambdaQueryWrapper<TzBaseUnitLicence>()
.eq(TzBaseUnitLicence::getUnitCode, enterpriseInfo.getUseUnitCode())
.eq(TzBaseUnitLicence::getIsDelete, false));
......@@ -1465,6 +1466,10 @@ public class DataHandlerServiceImpl {
List<EsUserInfo> esUserInfos = tzsUserInfoPage.getRecords().stream().map(u -> {
EsUserInfo esUserInfo = new EsUserInfo();
BeanUtil.copyProperties(u, esUserInfo);
esUserInfo.setPost(StatisticsDataUpdateService.castStrList2String(u.getPost()));
esUserInfo.setNewPost(StatisticsDataUpdateService.castStrList2String(u.getNewPost()));
esUserInfo.setSubPost(StatisticsDataUpdateService.castStrList2String(u.getSubPost()));
esUserInfo.setEquipType(StatisticsDataUpdateService.castStrList2String(u.getEquipType()));
esUserInfo.setUnitType(useCodeEnterpriseMap.getOrDefault(u.getUnitCode(), new TzBaseEnterpriseInfo()).getUnitType());
esUserInfo.setSuperviseOrgName(useCodeEnterpriseMap.getOrDefault(u.getUnitCode(), new TzBaseEnterpriseInfo()).getSuperviseOrgName());
esUserInfo.setSuperviseOrgCode(useCodeEnterpriseMap.getOrDefault(u.getUnitCode(), new TzBaseEnterpriseInfo()).getSuperviseOrgCode());
......@@ -1550,4 +1555,5 @@ public class DataHandlerServiceImpl {
private List<ESEquipmentInfo.TechParam> buildTechParamByEquList(String record, String equListCode) {
return StringUtils.isNotEmpty(equListCode) ? statisticsDataUpdateService.getTechParams(equListCode, record) : new ArrayList<>();
}
}
package com.yeejoin.amos.boot.module.jg.biz.statistics.service;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.biz.utils.TechParamUtil;
import com.yeejoin.amos.boot.module.jg.biz.edit.backup.TechParamsBackupService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
......@@ -31,4 +33,33 @@ public class StatisticsDataUpdateService {
return techParams;
}
/**
* 判断字符串是否为合法的 JSON 格式
*/
public static boolean isJSONValid(String test) {
try {
JSON.parseArray(test);
return true;
} catch (Exception ex) {
return false;
}
}
public static String castList2String(List<String> posts){
return String.join(",", posts);
}
public static String castStrList2String(String postJsonStr){
if(!isNullOrEmpty(postJsonStr)){
List<String> posts = JSON.parseArray(postJsonStr, String.class);
return String.join(",", posts);
}
return null;
}
public static boolean isNullOrEmpty(String str) {
return str == null || str.trim().isEmpty() || "null".equals(str);
}
}
......@@ -202,4 +202,10 @@ public class TzBaseEnterpriseInfo extends BaseEntity {
@ApiModelProperty(value = "省内详细办公地址")
private String officeAddress;
/**
* 创建时间
*/
@TableField(value = "create_date")
private Date createDate;
}
......@@ -235,4 +235,10 @@ public class TzsUserInfo extends BaseEntity {
*/
@TableField(value = "transfer_out_time")
protected Date transferOutTime;
/**
* 创建时间
*/
@TableField(value = "create_date")
private Date createDate;
}
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