微调
This commit is contained in:
@@ -218,6 +218,25 @@ public class PubUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于获取对象中,前缀一样,后缀为2~50的属性值
|
||||||
|
*
|
||||||
|
* @param object 待操作对象
|
||||||
|
* @param methodPrefix 方法前缀
|
||||||
|
* @param number 方法后缀
|
||||||
|
* @return 对象属性值
|
||||||
|
*/
|
||||||
|
public static Double getValueByMethodDouble(Object object, String methodPrefix, Integer number) {
|
||||||
|
try {
|
||||||
|
Method method = object.getClass().getMethod(methodPrefix + number);
|
||||||
|
return (Double) method.invoke(object);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.REFLECT_METHOD_EXCEPTION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<String> getStartTimeEndTime(String beginDate, String endDate) throws Exception {
|
public static List<String> getStartTimeEndTime(String beginDate, String endDate) throws Exception {
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class HarmInHarmServiceImpl implements HarmInHarmService {
|
|||||||
DataHarmRateV dataHarmRateV = dataHarmRateVService.getMeanAllTimesData(influxQueryWrapper);
|
DataHarmRateV dataHarmRateV = dataHarmRateVService.getMeanAllTimesData(influxQueryWrapper);
|
||||||
if(Objects.nonNull(dataHarmRateV)){
|
if(Objects.nonNull(dataHarmRateV)){
|
||||||
for (int i = 2; i < 51; i++) {
|
for (int i = 2; i < 51; i++) {
|
||||||
floatList.add(PubUtils.getValueByMethod(dataHarmRateV, "getV", i));
|
floatList.add(PubUtils.getValueByMethodDouble(dataHarmRateV, "getV", i).floatValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -99,7 +99,7 @@ public class HarmInHarmServiceImpl implements HarmInHarmService {
|
|||||||
DataI dataI = dataIService.getMeanAllTimesData(influxQueryWrapper);
|
DataI dataI = dataIService.getMeanAllTimesData(influxQueryWrapper);
|
||||||
if(Objects.nonNull(dataI)){
|
if(Objects.nonNull(dataI)){
|
||||||
for (int i = 2; i < 51; i++) {
|
for (int i = 2; i < 51; i++) {
|
||||||
floatList.add(PubUtils.getValueByMethod(dataI, "getI", i));
|
floatList.add(PubUtils.getValueByMethodDouble(dataI, "getI", i).floatValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user