Commit f8c94a36 authored by yangyang's avatar yangyang

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 9e9b97d4 5ed78b2a
package com.yeejoin.amos.boot.module.common.api.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 通用的自定义字段转换器
* 用于处理Excel导入导出时的字段转换逻辑
*/
@Component
public class CommonCustomConverter {
/**
* 年月日格式转换器
*/
public static class Y_M_D_DateConverter implements Converter<Date> {
@Override
public Class supportJavaTypeKey() {
return null;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return null;
}
@Override
public Date convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return null;
}
@Override
public CellData convertToExcelData(Date value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
if (value == null) {
return new CellData("");
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
return new CellData(sdf.format(value));
}
}
}
package com.yeejoin.amos.boot.module.common.api.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 企业信息自定义字段转换器
* 用于处理Excel导入导出时的字段转换逻辑
*/
@Component
public class CompanyFieldCustomConverter {
private static DataDictionaryServiceImpl dataDictionaryService;
@Autowired
public void setDataDictionaryService(DataDictionaryServiceImpl dataDictionaryService) {
CompanyFieldCustomConverter.dataDictionaryService = dataDictionaryService;
}
/**
* 【行业主管部门】转换器
*/
public static class HYZGBMTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("HYZGBM");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【涉及设备类型】转换器
*/
public static class InvolvedEquipTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
NAME_TO_CODE_MAP.put("起重机械", "4000");
NAME_TO_CODE_MAP.put("场内机动车辆", "5000");
NAME_TO_CODE_MAP.put("锅炉", "1000");
NAME_TO_CODE_MAP.put("压力容器", "2000");
NAME_TO_CODE_MAP.put("压力管道", "8000");
NAME_TO_CODE_MAP.put("大型游乐设施", "6000");
NAME_TO_CODE_MAP.put("客运索道", "9000");
NAME_TO_CODE_MAP.put("电梯", "3000");
CODE_TO_NAME_MAP.put("4000", "起重机械");
CODE_TO_NAME_MAP.put("5000", "场内机动车辆");
CODE_TO_NAME_MAP.put("1000", "锅炉");
CODE_TO_NAME_MAP.put("2000", "压力容器");
CODE_TO_NAME_MAP.put("8000", "压力管道");
CODE_TO_NAME_MAP.put("6000", "大型游乐设施");
CODE_TO_NAME_MAP.put("9000", "客运索道");
CODE_TO_NAME_MAP.put("3000", "电梯");
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
List<String> list = Arrays.asList(value.split(","));
if (list.isEmpty()) {
return new CellData("");
}
List<String> res = new ArrayList<>();
list.forEach(item -> {
res.add(CODE_TO_NAME_MAP.getOrDefault(item, item));
});
return new CellData(String.join(",", res));
}
}
/**
* 【发证机关】转换器
*/
public static class ApprovedOrganCodeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("DJJG");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
List<String> list = Arrays.asList(value.split(","));
if (list.isEmpty()) {
return new CellData("");
}
List<String> res = new ArrayList<>();
list.forEach(item -> {
res.add(CODE_TO_NAME_MAP.getOrDefault(item, item));
});
return new CellData(String.join(",", res));
}
}
/**
* 【核准项目】转换器
*/
public static class ItemCodeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("HZXM");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
List<String> list = Arrays.asList(value.split(","));
if (list.isEmpty()) {
return new CellData("");
}
List<String> res = new ArrayList<>();
list.forEach(item -> {
res.add(CODE_TO_NAME_MAP.getOrDefault(item, item));
});
return new CellData(String.join(",", res));
}
}
/**
* 【机构类别】转换器
*/
public static class AgencyTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("JYJC_TYPE");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
List<String> list = Arrays.asList(value.split(","));
if (list.isEmpty()) {
return new CellData("");
}
List<String> res = new ArrayList<>();
list.forEach(item -> {
res.add(CODE_TO_NAME_MAP.getOrDefault(item, item));
});
return new CellData(String.join(",", res));
}
}
/**
* 【资质类型】转换器
* 检验检测、其他
*/
public static class LicenceTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
CODE_TO_NAME_MAP.put("jyjc", "检验检测");
CODE_TO_NAME_MAP.put("other", "其他");
NAME_TO_CODE_MAP.put("检验检测", "jyjc");
NAME_TO_CODE_MAP.put("其他", "other");
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
List<String> list = Arrays.asList(value.split(","));
if (list.isEmpty()) {
return new CellData("");
}
List<String> res = new ArrayList<>();
list.forEach(item -> {
res.add(CODE_TO_NAME_MAP.getOrDefault(item, item));
});
return new CellData(String.join(",", res));
}
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.api.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 人员信息自定义字段转换器
* 用于处理Excel导入导出时的字段转换逻辑
*/
@Component
public class EquipFieldCustomConverter {
private static DataDictionaryServiceImpl dataDictionaryService;
@Autowired
public void setDataDictionaryService(DataDictionaryServiceImpl dataDictionaryService) {
EquipFieldCustomConverter.dataDictionaryService = dataDictionaryService;
}
/**
* 【设备状态】类型转换器
*/
public static class EquStateConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("SHZT");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【检验类型】类型转换器
*/
public static class InspectTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("JYJC");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【检验结论】类型转换器
*/
public static class InspectConclusionConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("JYJL");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【控制方式】类型转换器
*/
public static class ControlModeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("KZFS");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【区域防爆等级】类型转换器
*/
public static class ExplosionProofGradeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("FBDJ");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【顶升方式】类型转换器
*/
public static class JackingTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("DSXS");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【工作级别】类型转换器
*/
public static class WorkLevelConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("GZJB");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【区域防爆等级】类型转换器
*/
public static class EplosionproofGradeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("FBDJ");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【受压部件名称】类型转换器
*/
public static class NameOfPressurePartsConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("GLBJMC");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【燃料(热源)种类】类型转换器
*/
public static class FuelTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("GLZL");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【管道级别】类型转换器
*/
public static class DeviceLevelConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("GLJB");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【充装介质】类型转换器
*/
public static class ChargingMediumConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DictionarieValueModel> dictionaries = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM").getResult();
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getDictDataKey(), dictionary.getDictDataValue());
NAME_TO_CODE_MAP.put(dictionary.getDictDataValue(), dictionary.getDictDataKey());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【无损检测方法】类型转换器
*/
public static class GlLosslessConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("RQJCFF");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【主体结构型式】类型转换器
*/
public static class MainStructureTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("RQJG");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【技术参数】【运载索】类型转换器
*/
public static class CarrierLineConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("YZS");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.api.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 人员信息自定义字段转换器
* 用于处理Excel导入导出时的字段转换逻辑
*/
@Component
public class PersonFieldCustomConverter {
private static DataDictionaryServiceImpl dataDictionaryService;
@Autowired
public void setDataDictionaryService(DataDictionaryServiceImpl dataDictionaryService) {
PersonFieldCustomConverter.dataDictionaryService = dataDictionaryService;
}
/**
* 【证件类型】转换器
*/
public static class CertificateTypeConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("ZJLX");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
/**
* 【性别】类型转换器
*/
public static class GenderConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
CODE_TO_NAME_MAP.put("1", "男");
CODE_TO_NAME_MAP.put("0", "女");
NAME_TO_CODE_MAP.put("男", "1");
NAME_TO_CODE_MAP.put("女", "0");
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, "未知");
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, "未知");
return new CellData(displayValue);
}
}
/**
* 【学历】类型转换器
*/
public static class EducationConverter implements Converter<String> {
private static final Map<String, String> CODE_TO_NAME_MAP = new ConcurrentHashMap<>();
private static final Map<String, String> NAME_TO_CODE_MAP = new ConcurrentHashMap<>();
// 使用静态初始化块加载数据字典
static {
refreshDictionaryCache();
}
/**
* 刷新数据字典缓存
*/
public static void refreshDictionaryCache() {
List<DataDictionary> dictionaries = dataDictionaryService.getByType("QYRYXL");
CODE_TO_NAME_MAP.clear();
NAME_TO_CODE_MAP.clear();
dictionaries.forEach(dictionary -> {
CODE_TO_NAME_MAP.put(dictionary.getCode(), dictionary.getName());
NAME_TO_CODE_MAP.put(dictionary.getName(), dictionary.getCode());
});
}
@Override
public Class<?> supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String cellValue = cellData.getStringValue();
return NAME_TO_CODE_MAP.getOrDefault(cellValue, cellValue);
}
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
String displayValue = CODE_TO_NAME_MAP.getOrDefault(value, value);
return new CellData(displayValue);
}
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.api.entity; 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.biz.common.annotation.TechnicalParameter;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem; import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*; 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 java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -389,6 +391,9 @@ public class ESEquipmentInfo { ...@@ -389,6 +391,9 @@ public class ESEquipmentInfo {
@Field(type = FieldType.Date, format = DateFormat.date) @Field(type = FieldType.Date, format = DateFormat.date)
private LocalDate dateValue; private LocalDate dateValue;
public TechParam() {
}
public TechParam(TechParamItem paramItem, Object rawValue) { public TechParam(TechParamItem paramItem, Object rawValue) {
this.paramKey = paramItem.getParamKey(); this.paramKey = paramItem.getParamKey();
this.paramLabel = paramItem.getParamLabel(); this.paramLabel = paramItem.getParamLabel();
......
...@@ -253,4 +253,17 @@ public class DataHandlerController extends BaseController { ...@@ -253,4 +253,17 @@ public class DataHandlerController extends BaseController {
return ResponseHelper.buildResponse(dataHandlerService.initEquipStatistData2Es()); return ResponseHelper.buildResponse(dataHandlerService.initEquipStatistData2Es());
} }
/**
* @apiNote 场车车牌号刷入ES
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "场车车牌号刷入ES", notes = "场车车牌号刷入ES")
@PutMapping(value = "/equip/initFactoryCarNumber2Es")
public ResponseModel<Integer> initFactoryCarNumber2Es() {
return ResponseHelper.buildResponse(dataHandlerService.initFactoryCarNumber2Es());
}
} }
\ No newline at end of file
...@@ -139,6 +139,8 @@ public class DataHandlerServiceImpl { ...@@ -139,6 +139,8 @@ public class DataHandlerServiceImpl {
private final StatisticsDataUpdateService statisticsDataUpdateService; private final StatisticsDataUpdateService statisticsDataUpdateService;
private final IdxBizJgRegisterInfoMapper registerInfoMapper;
/** /**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式 * 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
...@@ -1559,4 +1561,17 @@ public class DataHandlerServiceImpl { ...@@ -1559,4 +1561,17 @@ public class DataHandlerServiceImpl {
return StringUtils.isNotEmpty(equListCode) ? statisticsDataUpdateService.getTechParams(equListCode, record) : new ArrayList<>(); return StringUtils.isNotEmpty(equListCode) ? statisticsDataUpdateService.getTechParams(equListCode, record) : new ArrayList<>();
} }
public Integer initFactoryCarNumber2Es() {
List<IdxBizJgRegisterInfo> registerInfoList = registerInfoMapper.selectList(new QueryWrapper<IdxBizJgRegisterInfo>().lambda().isNotNull(IdxBizJgRegisterInfo::getCarNumber));
Map<String, Map<String, Object>> resultMap = new HashMap<>();
if (!CollectionUtils.isEmpty(registerInfoList)) {
registerInfoList.parallelStream().forEach(v->{
Map<String, Object> param = new HashMap<>();
param.put("CAR_NUMBER", v.getCarNumber());
resultMap.put(v.getRecord(), param);
});
tzsServiceFeignClient.commonUpdateEsDataByIds(resultMap);
}
return registerInfoList.size();
}
} }
...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.statistics.api.enums; ...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.statistics.api.enums;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum StatisticalAnalysisEnum { public enum StatisticalAnalysisEnum {
...@@ -22,4 +25,21 @@ public enum StatisticalAnalysisEnum { ...@@ -22,4 +25,21 @@ public enum StatisticalAnalysisEnum {
private String code; private String code;
private String key; private String key;
private static final Map<String, StatisticalAnalysisEnum> CODE_MAP = new HashMap<>();
static {
for (StatisticalAnalysisEnum value : values()) {
CODE_MAP.put(value.code, value);
}
}
/**
* 根据code获取枚举实例(优化版)
* @param code 枚举编码
* @return 对应的枚举实例,未找到时返回null
*/
public static StatisticalAnalysisEnum getEnumByCode(String code) {
return CODE_MAP.get(code);
}
} }
package com.yeejoin.amos.boot.module.statistics.api.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.yeejoin.amos.boot.module.common.api.converter.CommonCustomConverter;
import com.yeejoin.amos.boot.module.common.api.converter.CompanyFieldCustomConverter;
import lombok.*;
import java.util.Date;
/**
* 企业
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@HeadRowHeight(35)// 标题行高度
@ContentRowHeight(15)// 内容行高度
@ColumnWidth(30)// 默认列宽
public class CompanyInfoVo {
// -------------------------- 基本信息 -------------------------------
@ExcelProperty("企业名称")
private String useUnit;
@ExcelProperty("企业统一信用代码")
private String useCode;
@ExcelProperty("单位类型")
private String unitType;
@ExcelProperty("管辖机构名称")
private String superviseOrgName;
@ExcelProperty("监管系统唯一编码")
private String superviseCode;
@ExcelProperty("联系人")
private String contactUser;
@ExcelProperty("联系人电话")
private String contactPhone;
@ExcelProperty("企业详情地址")
private String address;
@ExcelProperty("监管标签")
private String regulatoryLabels;
@ExcelProperty(value = "行业主管部门", converter = CompanyFieldCustomConverter.HYZGBMTypeConverter.class)
private String industrySupervisor;
@ExcelProperty("经营状态")
private String operatingStatus;
@ExcelProperty(value = "涉及设备类型", converter = CompanyFieldCustomConverter.InvolvedEquipTypeConverter.class)
@ColumnWidth(50)
private String equipCategory;
@ExcelProperty("办公区域")
private String officeRegion;
// ------------------------------------- 资质 ------------------------------------
@ExcelProperty(value = {"资质信息", "证书编号"})
private String certNo;
@ExcelProperty(value = {"资质信息", "证书类型名称"})
private String certType;
@ExcelProperty(value = {"资质信息", "发证机关"}, converter = CompanyFieldCustomConverter.ApprovedOrganCodeConverter.class)
private String approvedOrganCode;
@ExcelProperty(value = {"资质信息", "许可到期日期"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date expiryDate;
@ExcelProperty(value = {"资质信息", "许可项目/检验类型/设备品种(核准项目名称)"}, converter = CompanyFieldCustomConverter.ItemCodeConverter.class)
@ColumnWidth(80)
private String itemCode;
@ExcelProperty(value = {"资质信息", "机构类别枚举"}, converter = CompanyFieldCustomConverter.AgencyTypeConverter.class)
private String agencyType;
@ExcelProperty(value = {"资质信息", "资质类型编码(检验检测、其他)"}, converter = CompanyFieldCustomConverter.LicenceTypeConverter.class)
private String licenceType;
@ExcelProperty(value = {"资质信息", "发证日期"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date issueDate;
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.statistics.api.vo; package com.yeejoin.amos.boot.module.statistics.api.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.module.jg.api.annotation.DictCode2DictName; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.yeejoin.amos.boot.module.common.api.converter.CommonCustomConverter;
import com.yeejoin.amos.boot.module.common.api.converter.EquipFieldCustomConverter;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 设备 * 设备
*/ */
@Data @Data
@HeadRowHeight(35)// 标题行高度
@ContentRowHeight(15)// 内容行高度
@ColumnWidth(30)// 默认列宽
public class EquipInfoVo { public class EquipInfoVo {
// ----------------------------- 基本信息 ------------------------------------
@ExcelProperty("管辖机构名称") @ExcelProperty("管辖机构名称")
private String ORG_BRANCH_NAME; private String ORG_BRANCH_NAME;
...@@ -48,8 +56,8 @@ public class EquipInfoVo { ...@@ -48,8 +56,8 @@ public class EquipInfoVo {
@ExcelProperty("详细地址") @ExcelProperty("详细地址")
private String ADDRESS; private String ADDRESS;
@ExcelProperty("设备状态") @ExcelProperty(value = "设备状态", converter = EquipFieldCustomConverter.EquStateConverter.class)
private Integer EQU_STATE; private String EQU_STATE;
@ExcelProperty("认领状态") @ExcelProperty("认领状态")
private String STATUS; private String STATUS;
...@@ -81,7 +89,7 @@ public class EquipInfoVo { ...@@ -81,7 +89,7 @@ public class EquipInfoVo {
@ExcelProperty("安改维单位统名称") @ExcelProperty("安改维单位统名称")
private String USC_UNIT_NAME; private String USC_UNIT_NAME;
@ExcelProperty("投用日期") @ExcelProperty(value = "投用日期", converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date USC_DATE; private Date USC_DATE;
@ExcelProperty("产品名称") @ExcelProperty("产品名称")
...@@ -93,11 +101,8 @@ public class EquipInfoVo { ...@@ -93,11 +101,8 @@ public class EquipInfoVo {
@ExcelProperty("设备型号") @ExcelProperty("设备型号")
private String EQU_TYPE; private String EQU_TYPE;
@ExcelProperty("制造日期") @ExcelProperty(value = "制造日期", converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private String PRODUCE_DATE; private Date PRODUCE_DATE;
@ExcelProperty("设备来源")
private String DATA_SOURCE;
@ExcelProperty("是否车用气瓶") @ExcelProperty("是否车用气瓶")
private String WHETHER_VEHICLE_CYLINDER; private String WHETHER_VEHICLE_CYLINDER;
...@@ -108,9 +113,6 @@ public class EquipInfoVo { ...@@ -108,9 +113,6 @@ public class EquipInfoVo {
@ExcelProperty("气瓶分类") @ExcelProperty("气瓶分类")
private String CYLINDER_CATEGORY; private String CYLINDER_CATEGORY;
@ExcelProperty("是否纳管")
private Boolean IS_INTO_MANAGEMENT;
@ExcelProperty("工程装置") @ExcelProperty("工程装置")
private String PROJECT_CONTRAPTION; private String PROJECT_CONTRAPTION;
...@@ -121,7 +123,7 @@ public class EquipInfoVo { ...@@ -121,7 +123,7 @@ public class EquipInfoVo {
private String projectContraptionId; private String projectContraptionId;
@ExcelProperty("数据质量等级") @ExcelProperty("数据质量等级")
private Integer dataQualityScore; private String dataQualityScore;
@ExcelProperty("设计单位统一信用代码") @ExcelProperty("设计单位统一信用代码")
private String designUnitCreditCode; private String designUnitCreditCode;
...@@ -132,171 +134,479 @@ public class EquipInfoVo { ...@@ -132,171 +134,479 @@ public class EquipInfoVo {
@ExcelProperty("制造单位统一社会信用代码") @ExcelProperty("制造单位统一社会信用代码")
private String produceUnitCreditCode; private String produceUnitCreditCode;
/** // ----------------------------- 最近一条检验信息------------------------------------
* 最新一条检验信息 @ExcelProperty(value = {"最近一条检验信息", "检验类型"}, converter = EquipFieldCustomConverter.InspectTypeConverter.class)
*/ private String inspectType;
@ExcelProperty("")
private List<Inspection> inspections; @ExcelProperty(value = {"最近一条检验信息", "检验机构名称"})
private String inspectOrgName;
/**
* 最新一条维保信息 @ExcelProperty(value = {"最近一条检验信息", "检验人员"})
*/ private String inspectStaff;
@ExcelProperty("")
private List<Maintenance> maintenances; @ExcelProperty(value = {"最近一条检验信息", "检验结论"}, converter = EquipFieldCustomConverter.InspectConclusionConverter.class)
private String inspectConclusion;
/**
* 技术参数 @ExcelProperty(value = {"最近一条检验信息", "检验日期"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
*/ private Date inspectDate;
@ExcelProperty("")
private List<TechParam> techParams; @ExcelProperty(value = {"最近一条检验信息", "下次检验日期"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date nextInspectDate;
@Data
public static class TechParam { @ExcelProperty(value = {"最近一条检验信息", "检验机构编码"})
private String inspectOrgCode;
@ExcelProperty("")
private String paramKey; @ExcelProperty(value = {"最近一条检验信息", "报告编号"})
private String inspectReportNo;
@ExcelProperty("")
private String paramLabel; // ----------------------------- 最近一条维保信息------------------------------------
@ExcelProperty(value = {"最近一条维保信息", "维保单位统一社会信用代码"})
@ExcelProperty("") private String meUnitCreditCode;
private String strValue;
@ExcelProperty(value = {"最近一条维保信息", "维保单位名称"})
@ExcelProperty("") private String meUnitName;
private Long longValue;
@ExcelProperty(value = {"最近一条维保信息", "维保备案合同"})
@ExcelProperty("") private String repairInform;
private Double doubleValue;
@ExcelProperty(value = {"最近一条维保信息", "维保合同开始日期"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
@ExcelProperty("") private Date informStart;
private Boolean boolValue;
@ExcelProperty(value = {"最近一条维保信息", "维保合同结束日期"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
@ExcelProperty("") private Date informEnd;
private Date dateValue;
} @ExcelProperty(value = {"最近一条维保信息", "维保负责人姓名"})
private String meMaster;
@Data @ExcelProperty(value = {"最近一条维保信息", "维保负责人身份证"})
public static class Inspection { private String meMasterId;
@ExcelProperty("")
private String sequenceNbr; @ExcelProperty(value = {"最近一条维保信息", "紧急救援电话"})
private String emergencyCall;
/**
* 检验类型 @ExcelProperty(value = {"最近一条维保信息", "维保周期"})
*/ private String meCycle;
@ExcelProperty("")
private String inspectType; @ExcelProperty(value = {"最近一条维保信息", "大修周期"})
private String overhaulCycle;
/**
* 检验机构名称 @ExcelProperty(value = {"最近一条维保信息", "24小时维保电话"})
*/ private String me24Telephone;
@ExcelProperty("")
private String inspectOrgName; // ----------------------------- 所有设备类别技术参数 ------------------------------------
@ExcelProperty(value = {"技术参数", "观光列车牵引车头座位数"})
/** private String tractorSeatNumber;
* 检验人员 @ExcelProperty(value = {"技术参数", "小车运行速度"})
*/ private String smallcarrunSpeed;
@ExcelProperty("") @ExcelProperty(value = {"技术参数", "给水温度"})
private String inspectStaff; private String feedwaterTemperature;
@ExcelProperty(value = {"技术参数", "容器自重"})
private String selfWeight;
/** @ExcelProperty(value = {"技术参数", "材料(筒体)"})
* 检验结论 private String materialCylinder;
*/ @ExcelProperty(value = {"技术参数", "受压部件热处理温度"})
@ExcelProperty("") private String heatTreatmentTemperatureOfPressureParts;
private String inspectConclusion; @ExcelProperty(value = {"技术参数", "再热蒸汽流量"})
private String reheatSteamFlow;
/** @ExcelProperty(value = {"技术参数", "动力方式"})
* 检验日期 private String powerMode;
*/ @ExcelProperty(value = {"技术参数", "气体/粉尘组别(防爆)"})
@ExcelProperty("") private String gasGroup;
private Date inspectDate; @ExcelProperty(value = {"技术参数", "单车最大进车时间"})
private String bicycleMaxComeTime;
/** @ExcelProperty(value = {"技术参数", "车辆VIN码"})
* 下次检验日期 private String vin;
*/ @ExcelProperty(value = {"技术参数", "再热器进(出)口温度"})
@ExcelProperty("") private String inletOutletTemperatureOfReheater;
private Date nextInspectDate; @ExcelProperty(value = {"技术参数", "容器高(长)"})
private String height;
/** @ExcelProperty(value = {"技术参数", "适停车辆尺寸高"})
* 检验机构编码 private String parkingVehicleHeight;
*/ @ExcelProperty(value = {"技术参数", "额定载重量"})
@ExcelProperty("") private String ratedLoadCapacity;
private String inspectOrgCode; @ExcelProperty(value = {"技术参数", "公称工作压力"})
private String nominalWorkingPressure;
/** @ExcelProperty(value = {"技术参数", "运行高度"})
* 报告编号 private String operatingHeight;
*/ @ExcelProperty(value = {"技术参数", "气体置换后压力"})
@ExcelProperty("") private String displacementPressure;
private String inspectReportNo; @ExcelProperty(value = {"技术参数", "运量"})
} private String freightVolume;
@ExcelProperty(value = {"技术参数", "管道级别"}, converter = EquipFieldCustomConverter.DeviceLevelConverter.class)
@Data private String deviceLevel;
public static class Maintenance { @ExcelProperty(value = {"技术参数", "锅炉本体水(油)容积"})
private String waterOilVolumeOfBoilerProper;
@ExcelProperty("") @ExcelProperty(value = {"技术参数", "受压部件水(耐)压试验压力"})
private String sequenceNbr; private String hydrostaticTestPressure;
@ExcelProperty(value = {"技术参数", "起升速度"})
/** private String liftingSpeed;
* 维保单位统一社会信用代码 @ExcelProperty(value = {"技术参数", "轴距"})
*/ private String wheelBase;
@ExcelProperty(value = {"技术参数", "名义宽度"})
@ExcelProperty("") private String nominalWidth;
private String meUnitCreditCode; @ExcelProperty(value = {"技术参数", "设计温度"})
/** private String temperature;
* 维保单位名称 @ExcelProperty(value = {"技术参数", "轮距(前)"})
*/ private String trackWidthFront;
@ExcelProperty(value = {"技术参数", "无损检测比例(气瓶)"})
@ExcelProperty("") private String qpRatio;
private String meUnitName; @ExcelProperty(value = {"技术参数", "设备高度"})
/** private String equipmentHeight;
* 维保备案合同 @ExcelProperty(value = {"技术参数", "热处理温度"})
*/ private String qpHeatTreatmentTemperature;
@ExcelProperty("") @ExcelProperty(value = {"技术参数", "腐蚀裕量"})
private String repairInform; private String corrosionMargin;
/** @ExcelProperty(value = {"技术参数", "单瓶容积"})
* 维保合同开始日期 private String singleBottleVolume;
*/ @ExcelProperty(value = {"技术参数", "耐压试验压力(管路)"})
@ExcelProperty("") private String glPressure;
private Date informStart; @ExcelProperty(value = {"技术参数", "乘坐人数"})
/** private String numberOfPassengers;
* 维保合同结束日期 @ExcelProperty(value = {"技术参数", "温度组别(防爆)"})
*/ private String temperatureGroup;
@ExcelProperty("") @ExcelProperty(value = {"技术参数", "耐压试验种类"})
private Date informEnd; private String withstandVoltage;
/** @ExcelProperty(value = {"技术参数", "厚度(衬里)"})
* 维保负责人姓名 private String fixedLining;
*/ @ExcelProperty(value = {"技术参数", "厚度(筒体(球壳))"})
@ExcelProperty("") private String thickness;
private String meMaster; @ExcelProperty(value = {"技术参数", "跨度(工作幅度)"})
/** private String spanWorkingRange;
* 维保负责人身份证 @ExcelProperty(value = {"技术参数", "设计温度(夹套)"})
*/ private String temperatureJacket;
@ExcelProperty(value = {"技术参数", "最高允许工作压力(管程)"})
@ExcelProperty("") private String maxPressurePipe;
private String meMasterId; @ExcelProperty(value = {"技术参数", "设计温度(管程)"})
/** private String temperaturePipe;
* 紧急救援电话 @ExcelProperty(value = {"技术参数", "受压部件水(耐)压试验介质"})
*/ private String hydrostaticTestMedium;
@ExcelProperty(value = {"技术参数", "层数/泊位数"})
@ExcelProperty("") private String numberStorey;
private String emergencyCall; @ExcelProperty(value = {"技术参数", "倾角"})
private String dip;
/** @ExcelProperty(value = {"技术参数", "观光列车车厢数"})
* 维保周期 private String carsNumber;
*/ @ExcelProperty(value = {"技术参数", "额定起重量"})
@ExcelProperty("") private String ratedLiftingCapacity;
private String meCycle; @ExcelProperty(value = {"技术参数", "额定蒸发量(热功率)"})
/** private String ratedEvaporationCapacityThermalPower;
* 大修周期 @ExcelProperty(value = {"技术参数", "受压部件壁厚"})
*/ private String wallThicknessOfPressureParts;
@ExcelProperty(value = {"技术参数", "工作介质"})
@ExcelProperty("") private String workMedium;
private String overhaulCycle; @ExcelProperty(value = {"技术参数", "材料(瓶体)"})
/** private String bottleBody;
* 24小时维保电话 @ExcelProperty(value = {"技术参数", "吊笼数量"})
*/ private String hangingCagesNumber;
@ExcelProperty("") @ExcelProperty(value = {"技术参数", "额定速度(上行)"})
private String me24Telephone; private String ratedSpeedUp;
} @ExcelProperty(value = {"技术参数", "无损检测方法(管路)"}, converter = EquipFieldCustomConverter.GlLosslessConverter.class)
private String glLossless;
@ExcelProperty(value = {"技术参数", "管道名称(登记单元)"})
private String pipeName;
@ExcelProperty(value = {"技术参数", "气瓶安装位置"})
private String installationPosition;
@ExcelProperty(value = {"技术参数", "人均舱容"})
private String perCapitaCabinCapacity;
@ExcelProperty(value = {"技术参数", "运行速度"})
private String runningSpeed;
@ExcelProperty(value = {"技术参数", "高差"})
private String altitudeDifference;
@ExcelProperty(value = {"技术参数", "倾斜角"})
private String angleRoll;
@ExcelProperty(value = {"技术参数", "设计温度(壳程)"})
private String temperatureShell;
@ExcelProperty(value = {"技术参数", "自重"})
private String weight;
@ExcelProperty(value = {"技术参数", "存容量"})
private String storageCapacity;
@ExcelProperty(value = {"技术参数", "容积"})
private String volume;
@ExcelProperty(value = {"技术参数", "运载工具数量和类型"})
private String numberAndTypeOfVehicles;
@ExcelProperty(value = {"技术参数", "受压部件无损检测方法"})
private String nonDestructiveTestingMethodsForPressureParts;
@ExcelProperty(value = {"技术参数", "容器内径"})
private String pressureVesselDiameter;
@ExcelProperty(value = {"技术参数", "介质(管程)"})
private String mediumPipe;
@ExcelProperty(value = {"技术参数", "区域防爆等级"}, converter = EquipFieldCustomConverter.ExplosionProofGradeConverter.class)
private String explosionProofGrade;
@ExcelProperty(value = {"技术参数", "支座型式"})
private String support;
@ExcelProperty(value = {"技术参数", "变幅速度"})
private String derrickingSpeed;
@ExcelProperty(value = {"技术参数", "门数"})
private String numberDoors;
@ExcelProperty(value = {"技术参数", "大车运行速度"})
private String bigcarRunSpeed;
@ExcelProperty(value = {"技术参数", "设计温度"})
private String designTemperature;
@ExcelProperty(value = {"技术参数", "额定工作压力"})
private String ratedWorkingPressure;
@ExcelProperty(value = {"技术参数", "吊笼工作行程"})
private String workStrokeCage;
@ExcelProperty(value = {"技术参数", "管道长度"})
private String pipeLength;
@ExcelProperty(value = {"技术参数", "设计介质"})
private String medium;
@ExcelProperty(value = {"技术参数", "速度"})
private String speed;
@ExcelProperty(value = {"技术参数", "额定质量"})
private String ratedQuality;
@ExcelProperty(value = {"技术参数", "整车整备质量"})
private String vehicleMass;
@ExcelProperty(value = {"技术参数", "受压部件材料"})
private String materialOfPressureParts;
@ExcelProperty(value = {"技术参数", "公称壁厚"})
private String wallThickness;
@ExcelProperty(value = {"技术参数", "单车最大进(出)车时间"})
private String bicycleMaxExitTime;
@ExcelProperty(value = {"技术参数", "额定横移速度"})
private String ratedTraverseSpeed;
@ExcelProperty(value = {"技术参数", "受压部件无损检测比例"})
private String proportionOfNdtForPressureParts;
@ExcelProperty(value = {"技术参数", "单边摆角"})
private String unilateralSwingAngle;
@ExcelProperty(value = {"技术参数", "长度"})
private String length;
@ExcelProperty(value = {"技术参数", "规格"})
private String specification;
@ExcelProperty(value = {"技术参数", "材料(封头)"})
private String pressureMaterialHead;
@ExcelProperty(value = {"技术参数", "工作压力"})
private String workingPressure;
@ExcelProperty(value = {"技术参数", "罐车编号"})
private String container;
@ExcelProperty(value = {"技术参数", "材料(夹套)"})
private String materialJacket;
@ExcelProperty(value = {"技术参数", "压力"})
private String chamberPressure;
@ExcelProperty(value = {"技术参数", "蹦极绳长度"})
private String slideHeight;
@ExcelProperty(value = {"技术参数", "额定载客人数"})
private String passengersNumber;
@ExcelProperty(value = {"技术参数", "充装介质"}, converter = EquipFieldCustomConverter.ChargingMediumConverter.class)
private String chargingMedium;
@ExcelProperty(value = {"技术参数", "燃烧方式"})
private String combustionMode;
@ExcelProperty(value = {"技术参数", "设备保护等级(防爆)"}, converter = EquipFieldCustomConverter.EplosionproofGradeConverter.class)
private String protectGrade;
@ExcelProperty(value = {"技术参数", "自由端高度"})
private String heightFreeEnd;
@ExcelProperty(value = {"技术参数", "轮距(后)"})
private String trackWidthBehind;
@ExcelProperty(value = {"技术参数", "空载最大运行速度"})
private String carryingIdlerMaxRunningSpeed;
@ExcelProperty(value = {"技术参数", "输送能力"})
private String conveyingCapacity;
@ExcelProperty(value = {"技术参数", "工作级别"}, converter = EquipFieldCustomConverter.WorkLevelConverter.class)
private String workLevel;
@ExcelProperty(value = {"技术参数", "发动机(行走电机)编号"})
private String engineNo;
@ExcelProperty(value = {"技术参数", "额定起重量"})
private String liftingCapacity;
@ExcelProperty(value = {"技术参数", "最高允许工作压力(壳程)"})
private String maxPressureShell;
@ExcelProperty(value = {"技术参数", "受压部件名称"}, converter = EquipFieldCustomConverter.NameOfPressurePartsConverter.class)
private String nameOfPressureParts;
@ExcelProperty(value = {"技术参数", "主体结构型式"}, converter = EquipFieldCustomConverter.MainStructureTypeConverter.class)
private String mainStructureType;
@ExcelProperty(value = {"技术参数", "额定升降速度"})
private String ratedLiftSpeed;
@ExcelProperty(value = {"技术参数", "设计压力(夹套)"})
private String pressureJacket;
@ExcelProperty(value = {"技术参数", "平距"})
private String horizontalDistance;
@ExcelProperty(value = {"技术参数", "名义速度"})
private String nominalSpeed;
@ExcelProperty(value = {"技术参数", "额定乘员数"})
private String ratedMembers;
@ExcelProperty(value = {"技术参数", "额定速度(下行)"})
private String ratedSpeedDown;
@ExcelProperty(value = {"技术参数", "材料(端塞)"})
private String endPlug;
@ExcelProperty(value = {"技术参数", "设计热效率"})
private String designThermalEfficiency;
@ExcelProperty(value = {"技术参数", "运载索"}, converter = EquipFieldCustomConverter.CarrierLineConverter.class)
private String carrierLine;
@ExcelProperty(value = {"技术参数", "区域防爆等级"}, converter = EquipFieldCustomConverter.EplosionproofGradeConverter.class)
private String explosionproofGrade;
@ExcelProperty(value = {"技术参数", "支架数目"})
private String supportsCount;
@ExcelProperty(value = {"技术参数", "瓶体内含氧量"})
private String heatTreatmentMethod;
@ExcelProperty(value = {"技术参数", "最大充装量"})
private String maxFill;
@ExcelProperty(value = {"技术参数", "悬臂长度"})
private String cantileverLength;
@ExcelProperty(value = {"技术参数", "外径"})
private String outsideDiameter;
@ExcelProperty(value = {"技术参数", "气密性试验压力(管路)"})
private String glAirTightness;
@ExcelProperty(value = {"技术参数", "油缸数量"})
private String numberCylinders;
@ExcelProperty(value = {"技术参数", "安装型式"})
private String installation;
@ExcelProperty(value = {"技术参数", "最大运行速度"})
private String maxRunningSpeed;
@ExcelProperty(value = {"技术参数", "额定起重力矩"})
private String ratedLiftingTorque;
@ExcelProperty(value = {"技术参数", "站数"})
private String stand;
@ExcelProperty(value = {"技术参数", "承载索"})
private String bearingCable;
@ExcelProperty(value = {"技术参数", "气密性试验压力(气瓶)"})
private String qpAirTightness;
@ExcelProperty(value = {"技术参数", "氧舱品种"})
private String oxygenChamber;
@ExcelProperty(value = {"技术参数", "控制方式"}, converter = EquipFieldCustomConverter.ControlModeConverter.class)
private String controlMode;
@ExcelProperty(value = {"技术参数", "提升高度"})
private String liftingHeight;
@ExcelProperty(value = {"技术参数", "轨道高度"})
private String trackHeight;
@ExcelProperty(value = {"技术参数", "回转直径"})
private String rotaryDiameter;
@ExcelProperty(value = {"技术参数", "罐车编号"})
private String carNum;
@ExcelProperty(value = {"技术参数", "有机热载体锅炉气密试验介质/压力"})
private String glAirtightTest;
@ExcelProperty(value = {"技术参数", "受压部件热处理时间"})
private String heatTreatmentTimeOfPressureParts;
@ExcelProperty(value = {"技术参数", "顶升方式"}, converter = EquipFieldCustomConverter.JackingTypeConverter.class)
private String jackingType;
@ExcelProperty(value = {"技术参数", "燃料(热源)种类"}, converter = EquipFieldCustomConverter.FuelTypeConverter.class)
private String fuelType;
@ExcelProperty(value = {"技术参数", "设计压力(管程)"})
private String pressurePipe;
@ExcelProperty(value = {"技术参数", "型号"})
private String modelNumber;
@ExcelProperty(value = {"技术参数", "厚度(筒体)"})
private String thicknessCylinder;
@ExcelProperty(value = {"技术参数", "总容积"})
private String totalVolume;
@ExcelProperty(value = {"技术参数", "主电机型式"})
private String mainMotorModel;
@ExcelProperty(value = {"技术参数", "厚度(夹套)"})
private String fixedJacket;
@ExcelProperty(value = {"技术参数", "数量"})
private String num;
@ExcelProperty(value = {"技术参数", "设计压力"})
private String designPressure;
@ExcelProperty(value = {"技术参数", "工作装置空载最大起升高度"})
private String maxLiftingHeight;
@ExcelProperty(value = {"技术参数", "盛装介质重量"})
private String mediumWeight;
@ExcelProperty(value = {"技术参数", "主体结构"})
private String chamberMain;
@ExcelProperty(value = {"技术参数", "公称直径"})
private String nominalDiameter;
@ExcelProperty(value = {"技术参数", "最大起重量"})
private String maxLiftingCapacity;
@ExcelProperty(value = {"技术参数", "容器容积"})
private String containerVolume;
@ExcelProperty(value = {"技术参数", "管道编号"})
private String pipelineNumber;
@ExcelProperty(value = {"技术参数", "额定提升速度"})
private String ratedLiftingSpeed;
@ExcelProperty(value = {"技术参数", "空载最大起升速度"})
private String maxLiftingSpeed;
@ExcelProperty(value = {"技术参数", "额定出/回水(油)温度"})
private String ratedOutletReturnWaterOilTemperature;
@ExcelProperty(value = {"技术参数", "索距"})
private String cablePitch;
@ExcelProperty(value = {"技术参数", "瓶体内含氧量"})
private String oxygen;
@ExcelProperty(value = {"技术参数", "适停车辆尺寸宽"})
private String parkingVehicleWeight;
@ExcelProperty(value = {"技术参数", "工作压力"})
private String workPressure;
@ExcelProperty(value = {"技术参数", "斜长"})
private String obliqueLength;
@ExcelProperty(value = {"技术参数", "最大起重力矩"})
private String maxLiftingTorque;
@ExcelProperty(value = {"技术参数", "耐压试验压力(气瓶)"})
private String qpPressure;
@ExcelProperty(value = {"技术参数", "泄漏试验压力"})
private String leakPressure;
@ExcelProperty(value = {"技术参数", "设计压力"})
private String pressure;
@ExcelProperty(value = {"技术参数", "压力介质"})
private String pressureMedium;
@ExcelProperty(value = {"技术参数", "材料(筒体(球壳))"})
private String materialCylinderShell;
@ExcelProperty(value = {"技术参数", "保温绝热方式"})
private String insulation;
@ExcelProperty(value = {"技术参数", "无损检测方法(气瓶)"}, converter = EquipFieldCustomConverter.GlLosslessConverter.class)
private String qpLossless;
@ExcelProperty(value = {"技术参数", "车辆数"})
private String numberOfVehicles;
@ExcelProperty(value = {"技术参数", "无损检测比例(管路)"})
private String glRatio;
@ExcelProperty(value = {"技术参数", "轿门位置"})
private String doorPosition;
@ExcelProperty(value = {"技术参数", "泄漏试验种类"})
private String leakage;
@ExcelProperty(value = {"技术参数", "车架编号"})
private String frameNo;
@ExcelProperty(value = {"技术参数", "传动方式"})
private String transmissionMode;
@ExcelProperty(value = {"技术参数", "额定速度"})
private String ratedSpeed;
@ExcelProperty(value = {"技术参数", "最大行驶坡度"})
private String maxDrivingSlope;
@ExcelProperty(value = {"技术参数", "泄漏试验压力"})
private String withstandPressureTest;
@ExcelProperty(value = {"技术参数", "观光列车每节车厢座位数"})
private String seatNumber;
@ExcelProperty(value = {"技术参数", "主电机功率"})
private String mainMotorPower;
@ExcelProperty(value = {"技术参数", "适停车辆尺寸长"})
private String parkingVehicleLength;
@ExcelProperty(value = {"技术参数", "整装锅炉本体液压试验介质/压力"})
private String hydraulicTestMediumPressureOfPackagedBoilerBody;
@ExcelProperty(value = {"技术参数", "驾驶方式"})
private String drivingMode;
@ExcelProperty(value = {"技术参数", "介质(壳程)"})
private String mediumShell;
@ExcelProperty(value = {"技术参数", "额定工作温度"})
private String ratedOperatingTemperature;
@ExcelProperty(value = {"技术参数", "再热器进(出)口压力"})
private String reheaterInletOutletPressure;
@ExcelProperty(value = {"技术参数", "整机防爆标志"})
private String explosionproofSignComplete;
@ExcelProperty(value = {"技术参数", "无损检测方法"}, converter = EquipFieldCustomConverter.GlLosslessConverter.class)
private String checkLossless;
@ExcelProperty(value = {"技术参数", "车架结构"})
private String frameStructure;
@ExcelProperty(value = {"技术参数", "燃爆物质"})
private String explosiveSubstance;
@ExcelProperty(value = {"技术参数", "设计压力(壳程)"})
private String pressureHousingPath;
@ExcelProperty(value = {"技术参数", "额定进舱人数"})
private String ratedEntryCapacity;
@ExcelProperty(value = {"技术参数", "张紧油压(重锤重量)"})
private String oilPressureHeavyHammer;
@ExcelProperty(value = {"技术参数", "使用环境温度"})
private String ambientTemperature;
@ExcelProperty(value = {"技术参数", "最高允许工作压力(夹套)"})
private String maxPressureJacket;
@ExcelProperty(value = {"技术参数", "滑道长度"})
private String slideLength;
@ExcelProperty(value = {"技术参数", "材料(管路)"})
private String piping;
@ExcelProperty(value = {"技术参数", "材料(衬里)"})
private String pressureMaterialLining;
@ExcelProperty(value = {"技术参数", "工作温度"})
private String workTemperature;
@ExcelProperty(value = {"技术参数", "厚度(封头)"})
private String fixedHead;
@ExcelProperty(value = {"技术参数", "使用区段长度"})
private String useSectionLength;
@ExcelProperty(value = {"技术参数", "备注"})
private String remarks;
@ExcelProperty(value = {"技术参数", "介质(夹套)"})
private String mediumJacket;
} }
package com.yeejoin.amos.boot.module.statistics.api.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.yeejoin.amos.boot.module.common.api.converter.CommonCustomConverter;
import com.yeejoin.amos.boot.module.common.api.converter.PersonFieldCustomConverter;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 人员
*/
@Data
@HeadRowHeight(35)// 标题行高度
@ContentRowHeight(15)// 内容行高度
@ColumnWidth(30)// 默认列宽
public class PersonVo implements Serializable {
// -------------------------- 基本信息 -------------------------------
@ExcelProperty("姓名")
private String name;
@ExcelProperty(value = "证件类型", converter = PersonFieldCustomConverter.CertificateTypeConverter.class)
private String certificateType;
@ExcelProperty("证件编号")
private String certificateNum;
@ExcelProperty(value = "性别", converter = PersonFieldCustomConverter.GenderConverter.class)
private String gender;
@ExcelProperty("单位名称")
private String unitName;
@ExcelProperty("企业编码")
private String unitCode;
@ExcelProperty("岗位名称")
private String postName;
@ExcelProperty("联系电话")
private String phone;
@ExcelProperty(value = "出生日期", converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date birthday;
@ExcelProperty(value = "学历", converter = PersonFieldCustomConverter.EducationConverter.class)
private String education;
@ExcelProperty("专业")
private String speciality;
@ExcelProperty("邮箱")
private String email;
@ExcelProperty("住址")
private String address;
@ExcelProperty("人员所属企业单位类型")
@ColumnWidth(60)
private String unitType;
@ExcelProperty("设备类型")
private String equipType;
@ExcelProperty("职称")
private String jobTitle;
@ExcelProperty("岗位子类型")
private String subPostName;
@ExcelProperty("管辖机构名称")
private String superviseOrgName;
@ExcelProperty(value = "创建时间", converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date createDate;
// ------------------------------------- 资质 ------------------------------------
@ExcelProperty(value = {"资质信息", "检验检测-级别"})
private String permissionLevel;
@ExcelProperty(value = {"资质信息", "检验检测-资质项目"})
private String permissionItem;
@ExcelProperty(value = {"资质信息", "证书编号"})
private String certNo;
@ExcelProperty(value = {"资质信息", "有效期至"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date expiryDate;
@ExcelProperty(value = {"资质信息", "发证机关"})
private String approvedOrgan;
@ExcelProperty(value = {"资质信息", "发证日期"}, converter = CommonCustomConverter.Y_M_D_DateConverter.class)
private Date issueDate;
@ExcelProperty(value = {"资质信息", "证书类型"})
private String certType;
@ExcelProperty(value = {"资质信息", "作业项目"})
private String jobItem;
@ExcelProperty(value = {"资质信息", "项目代号"})
private String itemCode;
@ExcelProperty(value = {"资质信息", "其他作业项目"})
private String otherItem;
}
\ No newline at end of file
...@@ -13,6 +13,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients; ...@@ -13,6 +13,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
...@@ -43,6 +44,7 @@ public class AmosStatisticsApplication { ...@@ -43,6 +44,7 @@ public class AmosStatisticsApplication {
ConfigurableApplicationContext context = SpringApplication.run(AmosStatisticsApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosStatisticsApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
GlobalExceptionHandler.setAlwaysOk(true);
String ip = InetAddress.getLocalHost().getHostAddress(); String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port"); String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
......
...@@ -16,7 +16,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -16,7 +16,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
/** /**
* 综合统计分析API * 综合统计分析API
...@@ -170,12 +169,10 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController { ...@@ -170,12 +169,10 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController {
@PostMapping(value = "/export") @PostMapping(value = "/export")
@ApiOperation(httpMethod = "POST", value = "综合统计分析接口-导出", notes = "综合统计分析接口-导出") @ApiOperation(httpMethod = "POST", value = "综合统计分析接口-导出", notes = "综合统计分析接口-导出")
public ResponseModel<String> export(@RequestBody Map<String, Object> map) { public ResponseModel<String> export(@RequestBody Map<String, Object> map) {
String uuid = UUID.randomUUID().toString();
statisticalAnalysisService.startDownLoadMsg("综合统计分析设备列表", uuid);
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
statisticalAnalysisService.export(uuid, new JSONObject(map)); statisticalAnalysisService.export(new JSONObject(map));
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl; package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -11,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil; ...@@ -11,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem; 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.common.biz.utils.TechParamUtil;
import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum; import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
...@@ -19,7 +22,9 @@ import com.yeejoin.amos.boot.module.statistcs.factory.DynamicQueryBuilder; ...@@ -19,7 +22,9 @@ import com.yeejoin.amos.boot.module.statistcs.factory.DynamicQueryBuilder;
import com.yeejoin.amos.boot.module.statistcs.factory.EnhancedDynamicQueryBuilder; import com.yeejoin.amos.boot.module.statistcs.factory.EnhancedDynamicQueryBuilder;
import com.yeejoin.amos.boot.module.statistics.api.enums.*; import com.yeejoin.amos.boot.module.statistics.api.enums.*;
import com.yeejoin.amos.boot.module.statistics.api.mapper.TzsCustomFilterMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.TzsCustomFilterMapper;
import com.yeejoin.amos.boot.module.statistics.api.vo.CompanyInfoVo;
import com.yeejoin.amos.boot.module.statistics.api.vo.EquipInfoVo; import com.yeejoin.amos.boot.module.statistics.api.vo.EquipInfoVo;
import com.yeejoin.amos.boot.module.statistics.api.vo.PersonVo;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
...@@ -33,7 +38,10 @@ import org.elasticsearch.action.search.SearchRequest; ...@@ -33,7 +38,10 @@ import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.*; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.NestedQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermsQueryBuilder;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder; import org.elasticsearch.search.sort.FieldSortBuilder;
...@@ -47,6 +55,7 @@ import org.springframework.util.ObjectUtils; ...@@ -47,6 +55,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -54,7 +63,9 @@ import java.io.IOException; ...@@ -54,7 +63,9 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.stream.Stream;
import static org.elasticsearch.index.query.QueryBuilders.existsQuery; import static org.elasticsearch.index.query.QueryBuilders.existsQuery;
...@@ -78,7 +89,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -78,7 +89,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private final EmqKeeper emqKeeper; private final EmqKeeper emqKeeper;
private final StCommonServiceImpl stCommonService; private final StCommonServiceImpl stCommonService;
private final RestHighLevelClient restHighLevelClient; private final RestHighLevelClient restHighLevelClient;
private final String DOWN_LOAD_START_TEMP = "{\"id\":\"%s\",\"status\":\"starting\",\"fileName\":\"%s\",\"time\":\"%s\"}"; private final String DOWN_LOAD_START_TEMP = "{\"id\":\"%s\",\"status\":\"starting\",\"fileName\":\"%s\",\"time\":\"%s\"}";
private final String DOWNLOAD_TOPIC = "/topic/download/excel/%s"; private final String DOWNLOAD_TOPIC = "/topic/download/excel/%s";
...@@ -232,9 +242,13 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -232,9 +242,13 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (filterType.equals("advanced")) { if (filterType.equals("advanced")) {
filterParams.forEach((k, v) -> { filterParams.forEach((k, v) -> {
if (v instanceof JSONArray) { if (v instanceof JSONArray) {
if (!((JSONArray) v).contains("all")) { if (!((JSONArray) v).contains("all") && ((JSONArray) v).size() > 0) {
String field = k; String field = k;
if (k.equals("equipType") || k.equals("unitType") || k.equals("newPost") || k.equals("subPost")) { if (k.equals("newPost") || k.equals("subPost")) {
((JSONArray) v).forEach(item -> {
boolMust.must(QueryBuilders.wildcardQuery(field + ".keyword", "*" + item + "*"));
});
} else if (k.equals("equipType") || k.equals("unitType")) {
boolMust.must(existsQuery(field)); boolMust.must(existsQuery(field));
((JSONArray) v).forEach(item -> boolMust.must(QueryBuilders.wildcardQuery(k.equals("equipType") ? field : field + ".keyword", "*" + item + "*"))); ((JSONArray) v).forEach(item -> boolMust.must(QueryBuilders.wildcardQuery(k.equals("equipType") ? field : field + ".keyword", "*" + item + "*")));
} else if (k.equals("education")) { } else if (k.equals("education")) {
...@@ -256,7 +270,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -256,7 +270,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
); );
// 以下人员类型有资质要求 // 以下人员类型有资质要求
// 人员类型(newPost):检验人员:66151、检测人员:66152 // 人员类型(newPost):检验人员:66151、检测人员:66152
// 人员子类型(subPost): 持证人员:6712、持证人员(P):6764、持证人员(R2):6765 // 人员子类型(subPost): 持证人员:6713、持证人员(P):6764、持证人员(R2):6765
if (item.equals("1")) { if (item.equals("1")) {
boolMust.must(nestedQuery); boolMust.must(nestedQuery);
} else if (item.equals("0")) { } else if (item.equals("0")) {
...@@ -264,7 +278,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -264,7 +278,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery() BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery()
.should(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*")) .should(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*"))
.should(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*")) .should(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*"))
.should(QueryBuilders.wildcardQuery("subPost.keyword", "*6712*")) .should(QueryBuilders.wildcardQuery("subPost.keyword", "*6713*"))
.should(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*")) .should(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*"))
.should(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*")) .should(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*"))
.minimumShouldMatch(1); .minimumShouldMatch(1);
...@@ -275,7 +289,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -275,7 +289,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery() BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery()
.mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*")) .mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*"))
.mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*")) .mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*"))
.mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6712*")) .mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6713*"))
.mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*")) .mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*"))
.mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*")); .mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*"));
boolMust.must(queryBuilder); boolMust.must(queryBuilder);
...@@ -383,6 +397,49 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -383,6 +397,49 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
} }
dto.put("equipType", equipTypes.substring(0, equipTypes.length() - 1)); dto.put("equipType", equipTypes.substring(0, equipTypes.length() - 1));
} }
String licensesStauts = "";
if (dto.containsKey("licenses")) {
// 以下人员类型有资质要求
// 人员类型(newPost):检验人员:66151、检测人员:66152
// 人员子类型(subPost): 持证人员:6713、持证人员(P):6764、持证人员(R2):6765
String newPost = ObjectUtils.isEmpty(dto.getString("newPost")) ? "" : dto.getString("newPost");
String subPost = ObjectUtils.isEmpty(dto.getString("subPost")) ? "" : dto.getString("subPost");
if (newPost.contains("66151") || newPost.contains("66152") || subPost.contains("6713") || subPost.contains("6764") || subPost.contains("6765")) {
JSONArray licenses = dto.getJSONArray("licenses");
if (!ObjectUtils.isEmpty(licenses)) {
List<String> permissionStatusList = new ArrayList<>();
for (Object object : licenses) {
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(object));
String expiryDate = json.getString("expiryDate");
if (!ObjectUtils.isEmpty(expiryDate)) {
long daysBetween = ChronoUnit.DAYS.between(LocalDate.now(), LocalDate.parse(expiryDate, formatter));
if (daysBetween <= 0) {
permissionStatusList.add("超期");
} else if (daysBetween <= 30) {
permissionStatusList.add("临期");
} else {
permissionStatusList.add("正常");
}
}
}
long cq = permissionStatusList.stream().filter(e -> e.equals("超期")).count();
long lq = permissionStatusList.stream().filter(e -> e.equals("临期")).count();
long zc = permissionStatusList.stream().filter(e -> e.equals("正常")).count();
if (cq > 0) {
licensesStauts = "超期";
} else if (lq > 0) {
licensesStauts = "临期";
} else if (zc > 0) {
licensesStauts = "正常";
}
} else {
licensesStauts = "无资质";
}
} else {
licensesStauts = "无资质要求";
}
}
dto.put("licensesStauts", licensesStauts);
list.add(dto); list.add(dto);
} }
totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value; totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value;
...@@ -508,6 +565,38 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -508,6 +565,38 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
for (SearchHit hit : response.getHits().getHits()) { for (SearchHit hit : response.getHits().getHits()) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
JSONObject dto = jsonObject.getJSONObject("sourceAsMap"); JSONObject dto = jsonObject.getJSONObject("sourceAsMap");
String permissionStatus = null;
if (dto.containsKey("licenses")) {
JSONArray licenses = dto.getJSONArray("licenses");
if (!ObjectUtils.isEmpty(licenses)) {
List<String> permissionStatusList = new ArrayList<>();
for (Object object : licenses) {
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(object));
String expiryDate = json.getString("expiryDate");
if (!ObjectUtils.isEmpty(expiryDate)) {
long daysBetween = ChronoUnit.DAYS.between(LocalDate.now(), LocalDate.parse(expiryDate, formatter));
if (daysBetween <= 0) {
permissionStatusList.add("超期");
} else if (daysBetween <= 30) {
permissionStatusList.add("临期");
} else {
permissionStatusList.add("正常");
}
}
}
long cq = permissionStatusList.stream().filter(e -> e.equals("超期")).count();
long lq = permissionStatusList.stream().filter(e -> e.equals("临期")).count();
long zc = permissionStatusList.stream().filter(e -> e.equals("正常")).count();
if (cq > 0) {
permissionStatus = "超期";
} else if (lq > 0) {
permissionStatus = "临期";
} else if (zc > 0) {
permissionStatus = "正常";
}
}
}
dto.put("permissionStatus", permissionStatus);
list.add(dto); list.add(dto);
} }
totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value; totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value;
...@@ -749,6 +838,34 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -749,6 +838,34 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return result; return result;
} }
private double getPipeLength(BoolQueryBuilder boolMust, SearchSourceBuilder builder, SearchSourceBuilder searchSourceBuilder) {
SearchRequest request = new SearchRequest();
double pipeLong = 0L;
builder.query(boolMust);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
for (SearchHit hit : response.getHits().getHits()) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
JSONObject dto = jsonObject.getJSONObject("sourceAsMap");
if (dto.get("EQU_LIST_CODE").equals("8000")) {
JSONArray techParams = (JSONArray) dto.get("techParams");
if (!ObjectUtils.isEmpty(techParams)) {
Object obj = techParams.stream().filter(item -> JSONObject.parseObject(JSONObject.toJSONString(item)).get("paramKey").equals("pipeLength")).findFirst().get();
JSONObject jsonParam = JSONObject.parseObject(JSONObject.toJSONString(obj));
if (jsonParam.containsKey("doubleValue")) {
String pipeLength = JSONObject.parseObject(JSONObject.toJSONString(obj)).get("doubleValue").toString();
pipeLong += Double.parseDouble(pipeLength);
}
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return pipeLong;
}
private Boolean getParamAnalysis(Object v) { private Boolean getParamAnalysis(Object v) {
Boolean result = false; Boolean result = false;
if (v instanceof JSONArray) { if (v instanceof JSONArray) {
...@@ -1080,7 +1197,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1080,7 +1197,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder noCertQuery = QueryBuilders.boolQuery() BoolQueryBuilder noCertQuery = QueryBuilders.boolQuery()
.should(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*")) .should(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*"))
.should(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*")) .should(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*"))
.should(QueryBuilders.wildcardQuery("subPost.keyword", "*6712*")) .should(QueryBuilders.wildcardQuery("subPost.keyword", "*6713*"))
.should(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*")) .should(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*"))
.should(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*")) .should(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*"))
.minimumShouldMatch(1); .minimumShouldMatch(1);
...@@ -1088,7 +1205,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1088,7 +1205,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder noCertRequestQuery = QueryBuilders.boolQuery() BoolQueryBuilder noCertRequestQuery = QueryBuilders.boolQuery()
.mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*")) .mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66151*"))
.mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*")) .mustNot(QueryBuilders.wildcardQuery("newPost.keyword", "*66152*"))
.mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6712*")) .mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6713*"))
.mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*")) .mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6764*"))
.mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*")); .mustNot(QueryBuilders.wildcardQuery("subPost.keyword", "*6765*"));
...@@ -1420,7 +1537,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1420,7 +1537,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
//有无资质 //有无资质
JSONArray certNoData = new JSONArray(); JSONArray certNoData = new JSONArray();
for (int i = 0; i < 2; i++) { for (int i = 0; i < 3; i++) {
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
if (0 == i) { if (0 == i) {
object.put("key", "2"); object.put("key", "2");
...@@ -1440,7 +1557,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1440,7 +1557,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
result.put("certNo", certNoData); result.put("certNo", certNoData);
//资质状态 //资质状态
JSONArray permissionStatus = new JSONArray(); JSONArray permissionStatus = new JSONArray();
for (int i = 0; i < 2; i++) { for (int i = 0; i < 3; i++) {
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
if (0 == i) { if (0 == i) {
object.put("key", "overdue"); object.put("key", "overdue");
...@@ -1609,28 +1726,129 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1609,28 +1726,129 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
/** /**
* 综合统计分析接口-导出 * 综合统计分析接口-导出
* *
* @param uuid uuid
* @param filter 过滤条件 * @param filter 过滤条件
*/ */
public void export(String uuid, JSONObject filter) { public void export(JSONObject filter) {
String uuid = UUID.randomUUID().toString();
// 业务类型
String businessType = filter.getString("businessType");
// fileName
String fileName = "综合统计分析-" + StatisticalAnalysisEnum.getEnumByCode(businessType).getName() + "数据";
// sheetName
String sheetName = "综合统计分析-" + StatisticalAnalysisEnum.getEnumByCode(businessType).getName() + "列表";
// 开始下载提醒
this.startDownLoadMsg(fileName, uuid);
// 查询数据 // 查询数据
JSONObject jsonData = this.queryForPage(filter); JSONObject jsonData = this.queryForPage(filter);
// 类型转化 // 获取 result -> pageData -> records
List<EquipInfoVo> exportData = JSONArray.parseArray(JSON.toJSONString(jsonData.get("pageData")), EquipInfoVo.class); JSONObject pageData = jsonData.getJSONObject("pageData");
// 转化附件 JSONArray records = pageData.getJSONArray("records");
MultipartFile templateExcelFile = ExcelUtil.createTemplateExcelFile("综合统计分析设备列表数据", MultipartFile templateExcelFile;
"综合统计分析设备列表", exportData, EquipInfoVo.class, null, false); // 数据转化 + 附件生成
if (StatisticalAnalysisEnum.equip.getCode().equals(businessType)) {
templateExcelFile = getEquipMultipartFile(records, fileName, sheetName);
} else if (StatisticalAnalysisEnum.company.getCode().equals(businessType)) {
templateExcelFile = getCompanyMultipartFile(records, fileName, sheetName);
} else {
templateExcelFile = getPersonMultipartFile(records, fileName, sheetName);
}
// 上传minio服务器 // 上传minio服务器
String urlString = MinioUtils.uploadExcelFile(templateExcelFile, BUCKET_NAME, UPLOAD_PATH); String urlString = MinioUtils.uploadExcelFile(templateExcelFile, BUCKET_NAME, UPLOAD_PATH);
// 提醒下载 // 提醒下载
this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject() this.sendDownLoadExcelMsg(String.format(DOWNLOAD_TOPIC, RequestContext.getToken()), new JSONObject()
.fluentPut("id", uuid) .fluentPut("id", uuid)
.fluentPut("status", "done") .fluentPut("status", "done")
.fluentPut("fileName", "综合统计分析设备列表") .fluentPut("fileName", fileName)
.fluentPut("url", urlString) .fluentPut("url", urlString)
.fluentPut("time", new Date().getTime())); .fluentPut("time", new Date().getTime()));
} }
private static MultipartFile getEquipMultipartFile(JSONArray records, String fileName, String sheetName) {
MultipartFile templateExcelFile;
List<EquipInfoVo> exportData = new ArrayList<>();
records.forEach(obj -> {
JSONObject equip = JSONObject.parseObject(JSON.toJSONString(obj));
EquipInfoVo equipInfoVo = new EquipInfoVo();
BeanUtil.copyProperties(equip, equipInfoVo, CopyOptions.create().setIgnoreNullValue(true));
// 最新一条检验信息
if (!equip.getJSONArray("inspections").isEmpty()) {
JSONObject inspection = equip.getJSONArray("inspections").getJSONObject(0);
BeanUtil.copyProperties(inspection, equipInfoVo, CopyOptions.create().setIgnoreNullValue(true));
}
// 最新一条维保信息
if (!equip.getJSONArray("maintenances").isEmpty()) {
JSONObject maintenances = equip.getJSONArray("maintenances").getJSONObject(0);
BeanUtil.copyProperties(maintenances, equipInfoVo, CopyOptions.create().setIgnoreNullValue(true));
}
// 技术参数
if (!equip.getJSONArray("techParams").isEmpty()) {
JSONObject paramsJson = new JSONObject();
equip.getJSONArray("techParams").forEach(techParam -> {
ESEquipmentInfo.TechParam techParamItem = JSONObject.parseObject(JSON.toJSONString(techParam), ESEquipmentInfo.TechParam.class);
Optional.ofNullable(techParamItem.getParamKey()).ifPresent(key -> Stream.of(
Optional.ofNullable(techParamItem.getBoolValue()),
Optional.ofNullable(techParamItem.getDateValue()),
Optional.ofNullable(techParamItem.getLongValue()),
Optional.ofNullable(techParamItem.getStrValue()),
Optional.ofNullable(techParamItem.getDoubleValue())
)
.filter(Optional::isPresent)
.findFirst()
.ifPresent(value -> paramsJson.put(key, value.get())));
});
BeanUtil.copyProperties(paramsJson, equipInfoVo, CopyOptions.create().setIgnoreNullValue(true));
}
exportData.add(equipInfoVo);
});
templateExcelFile = ExcelUtil.createTemplateExcelFile(fileName, sheetName, exportData, EquipInfoVo.class, null, false);
return templateExcelFile;
}
private static MultipartFile getCompanyMultipartFile(JSONArray records, String fileName, String sheetName) {
MultipartFile templateExcelFile;
List<CompanyInfoVo> exportData = new ArrayList<>();
records.forEach(company -> {
String jsonString = JSON.toJSONString(company);
CompanyInfoVo companyInfoVo = JSONObject.parseObject(jsonString, CompanyInfoVo.class);
JSONArray licenses = JSON.parseArray(JSON.toJSONString(JSON.parseObject(jsonString).get("licenses")));
if (!licenses.isEmpty()) {
licenses.forEach(lic -> {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(lic));
CompanyInfoVo temp = jsonObject.toJavaObject(CompanyInfoVo.class);
BeanUtil.copyProperties(companyInfoVo, temp, CopyOptions.create().setIgnoreNullValue(true));
exportData.add(temp);
});
} else {
exportData.add(companyInfoVo);
}
});
templateExcelFile = ExcelUtil.createTemplateExcelFile(fileName, sheetName, exportData, CompanyInfoVo.class, null, false);
return templateExcelFile;
}
private static MultipartFile getPersonMultipartFile(JSONArray records, String fileName, String sheetName) {
MultipartFile templateExcelFile;
List<PersonVo> exportData = new ArrayList<>();
records.forEach(company -> {
String jsonString = JSON.toJSONString(company);
PersonVo personVo = JSONObject.parseObject(jsonString, PersonVo.class);
JSONArray licenses = JSON.parseArray(JSON.toJSONString(JSON.parseObject(jsonString).get("licenses")));
if (!licenses.isEmpty()) {
licenses.forEach(lic -> {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(lic));
PersonVo temp = jsonObject.toJavaObject(PersonVo.class);
BeanUtil.copyProperties(personVo, temp, CopyOptions.create().setIgnoreNullValue(true));
exportData.add(temp);
});
} else {
exportData.add(personVo);
}
});
templateExcelFile = ExcelUtil.createTemplateExcelFile(fileName, sheetName, exportData, PersonVo.class, null, false);
return templateExcelFile;
}
public JSONArray queryZYXM(String type) { public JSONArray queryZYXM(String type) {
JSONArray result = new JSONArray(); JSONArray result = new JSONArray();
if ("特种设备安全管理和作业人员证".equals(type)) { if ("特种设备安全管理和作业人员证".equals(type)) {
...@@ -1721,8 +1939,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1721,8 +1939,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
} }
public JSONArray queryTechParam(String type) { public JSONArray queryTechParam(String type) {
if(ValidationUtil.isEmpty(type)){ if (ValidationUtil.isEmpty(type)) {
throw new BadRequest("需要先选择设备品种,才能选择技术参数"); throw new BaseException("需要先选择设备品种,才能选择技术参数","200","需要先选择设备品种,才能选择技术参数");
} }
List<TechParamItem> paramMetaList = TechParamUtil.getParamMetaList(type); List<TechParamItem> paramMetaList = TechParamUtil.getParamMetaList(type);
JSONArray list = new JSONArray(); JSONArray list = new JSONArray();
......
package com.yeejoin.amos.boot.module.statistcs.biz.utils;
import com.yeejoin.amos.boot.biz.common.annotation.TechnicalParameter;
import com.yeejoin.amos.boot.module.common.api.dto.ITechParamDefine;
import org.reflections.Reflections;
import java.lang.reflect.Field;
import java.util.AbstractMap;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class TechParamUtil {
private static final Set<Class<? extends ITechParamDefine>> subClasses;
private static final ConcurrentHashMap<String, String> allTechParamsMap = new ConcurrentHashMap<>();
static {
//▼ 指定扫描包路径(根据实际项目调整)
Reflections reflections = new Reflections("com.yeejoin.amos.boot.module.common.api.dto");
//▼ 获取所有继承ITechParamsMeta的类
subClasses = reflections.getSubTypesOf(ITechParamDefine.class);
for (Class<? extends ITechParamDefine> subClass : subClasses) {
Field[] fields = subClass.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
TechnicalParameter technicalParameter = field.getAnnotation(TechnicalParameter.class);
allTechParamsMap.put(technicalParameter.key(), technicalParameter.label());
}
}
}
/**
* 获取所有设备类型的技术参数
*
* @return result
*/
public static AbstractMap<String, String> getAllTechParams() {
return allTechParamsMap;
}
}
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