|
|
@ -3,19 +3,14 @@ package com.thing.calculation.excel; |
|
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
|
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
|
|
|
|
|
|
|
|
import com.thing.calculation.dto.CalcLogDTO; |
|
|
import com.thing.calculation.dto.CalcLogDTO; |
|
|
import com.thing.calculation.dto.CalcSourceConfigDTO; |
|
|
|
|
|
import com.thing.calculation.dto.CalcTargetConfigDTO; |
|
|
|
|
|
import com.thing.calculation.enumeration.CalcConfigType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.thing.calculation.enumeration.CalcConfigType; |
|
|
import com.thing.common.core.utils.ConvertUtils; |
|
|
import com.thing.common.core.utils.ConvertUtils; |
|
|
import com.thing.common.core.utils.DateTimeUtils; |
|
|
import com.thing.common.core.utils.DateTimeUtils; |
|
|
import lombok.Data; |
|
|
import lombok.Data; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.function.Function; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -27,10 +22,10 @@ public class CalcLogExcel { |
|
|
@Excel(name = "计算类型", orderNum = "1") |
|
|
@Excel(name = "计算类型", orderNum = "1") |
|
|
private String calcType; |
|
|
private String calcType; |
|
|
|
|
|
|
|
|
@Excel(name = "结果物名称", orderNum = "2", width = 18) |
|
|
|
|
|
|
|
|
@Excel(name = "结果物名称", orderNum = "2", width = 25) |
|
|
private String targetThingName; |
|
|
private String targetThingName; |
|
|
|
|
|
|
|
|
@Excel(name = "结果物编码", orderNum = "3", width = 18) |
|
|
|
|
|
|
|
|
@Excel(name = "结果物编码", orderNum = "3", width = 25) |
|
|
private String targetThingCode; |
|
|
private String targetThingCode; |
|
|
|
|
|
|
|
|
@Excel(name = "结果属性名称", orderNum = "4", width = 18) |
|
|
@Excel(name = "结果属性名称", orderNum = "4", width = 18) |
|
|
@ -39,23 +34,34 @@ public class CalcLogExcel { |
|
|
@Excel(name = "结果属性编码", orderNum = "5", width = 15) |
|
|
@Excel(name = "结果属性编码", orderNum = "5", width = 15) |
|
|
private String targetAttrCode; |
|
|
private String targetAttrCode; |
|
|
|
|
|
|
|
|
@Excel(name = "异常信息", orderNum = "6", width = 20) |
|
|
|
|
|
|
|
|
@Excel(name = "计算结果", orderNum = "7", width = 18) |
|
|
|
|
|
private String result; |
|
|
|
|
|
|
|
|
|
|
|
@Excel(name = "计算公式", orderNum = "8", width = 20) |
|
|
|
|
|
private String formula; |
|
|
|
|
|
|
|
|
|
|
|
@Excel(name = "计算参数", orderNum = "9", width = 65) |
|
|
|
|
|
private String sourceInfo; |
|
|
|
|
|
|
|
|
|
|
|
@Excel(name = "异常信息", orderNum = "10", width = 20) |
|
|
private String errorInfo; |
|
|
private String errorInfo; |
|
|
|
|
|
|
|
|
@Excel(name = "计算生成事件", orderNum = "7", width = 18) |
|
|
|
|
|
|
|
|
@Excel(name = "计算生成时间", orderNum = "11", width = 18) |
|
|
private String createTime; |
|
|
private String createTime; |
|
|
|
|
|
|
|
|
@Excel(name = "数据异常时间", orderNum = "8", width = 18) |
|
|
|
|
|
|
|
|
@Excel(name = "数据异常时间", orderNum = "12", width = 18) |
|
|
private String dataTime; |
|
|
private String dataTime; |
|
|
|
|
|
|
|
|
public static List<CalcLogExcel> convertFromDTO(List<CalcLogDTO> dtoList) { |
|
|
|
|
|
return dtoList.stream().map(CalcLogExcel::convertFromDTO).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
public static List<CalcLogExcel> convertFromDTO(List<CalcLogDTO> dtoList, Map<Long, Integer> calcTypeMap) { |
|
|
|
|
|
return dtoList.stream().map(e -> convertFromDTO(e, calcTypeMap)).collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static CalcLogExcel convertFromDTO(CalcLogDTO dto) { |
|
|
|
|
|
|
|
|
private static CalcLogExcel convertFromDTO(CalcLogDTO dto, Map<Long, Integer> calcTypeMap) { |
|
|
CalcLogExcel excel = ConvertUtils.sourceToTarget(dto, CalcLogExcel.class); |
|
|
CalcLogExcel excel = ConvertUtils.sourceToTarget(dto, CalcLogExcel.class); |
|
|
|
|
|
Integer calcType = calcTypeMap.get(dto.getCalcTargetConfigId()); |
|
|
excel.setCreateTime(DateTimeUtils.timestamp2Str(dto.getCreateDate())); |
|
|
excel.setCreateTime(DateTimeUtils.timestamp2Str(dto.getCreateDate())); |
|
|
excel.setDataTime(DateTimeUtils.timestamp2Str(dto.getTime())); |
|
|
excel.setDataTime(DateTimeUtils.timestamp2Str(dto.getTime())); |
|
|
|
|
|
excel.setCalcType(CalcConfigType.getNameByCode(calcType)); |
|
|
return excel; |
|
|
return excel; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |