|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private long size; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private List<UnitConversionVO> unitConversions; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @Description: DTO转为VO | 
|---|
|  |  |  | * @Param: [dto] | 
|---|
|  |  |  | * @return: com.moral.api.pojo.vo.unitConversion.UnitConversionQueryVO | 
|---|
|  |  |  | * @Author: 陈凯裕 | 
|---|
|  |  |  | * @Date: 2021/8/26 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static UnitConversionQueryVO convert(UnitConversionQueryDTO dto) { | 
|---|
|  |  |  | if (dto.getCode() != ResponseCodeEnum.SUCCESS.getCode()) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | 
|---|
|  |  |  | return vo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @Description: 单个DTO转为VO | 
|---|
|  |  |  | * @Param: [dto] | 
|---|
|  |  |  | * @return: com.moral.api.pojo.vo.unitConversion.UnitConversionVO | 
|---|
|  |  |  | * @Author: 陈凯裕 | 
|---|
|  |  |  | * @Date: 2021/8/26 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private static UnitConversionVO convertToQueryPage(UnitConversionDTO dto) { | 
|---|
|  |  |  | UnitConversionVO vo = new UnitConversionVO(); | 
|---|
|  |  |  | UnitConversion unitConversion = dto.getUnitConversion(); | 
|---|
|  |  |  | 
|---|
|  |  |  | vo.setOriginalUnitName(originalUnit.getDataValue()); | 
|---|
|  |  |  | vo.setTargetUnitName(targetUnit.getDataValue()); | 
|---|
|  |  |  | vo.setFormula(unitConversion.getFormula()); | 
|---|
|  |  |  | vo.setSensorCode(unitConversion.getSensorCode()); | 
|---|
|  |  |  | return vo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @Description: 将带有占位符的公式转为带有原单位,目标单位的公式 | 
|---|
|  |  |  | * @Param: [formula] | 
|---|
|  |  |  | * @return: java.lang.String | 
|---|
|  |  |  | * @Author: 陈凯裕 | 
|---|
|  |  |  | * @Date: 2021/5/12 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static String formulaConvert(String formula, String originalUnitName, String targetUnitName) { | 
|---|
|  |  |  | formula = formula.replace(Constants.FORMULA_PLACEHOLDER, originalUnitName); | 
|---|
|  |  |  | formula += "=" + targetUnitName; | 
|---|
|  |  |  | return formula; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|