代码优化

This commit is contained in:
xy
2024-05-15 11:49:18 +08:00
parent b496452fd2
commit d7920e744e
6 changed files with 31 additions and 27 deletions

View File

@@ -15,7 +15,7 @@ public class FloatUtils {
* @param data Float参数
*/
public static float get2Float(Float data) {
if (data == null) {
if (data == null || data.isNaN() || data.isInfinite()) {
return 0f;
}
int scale = 2;//设置位数

View File

@@ -15,7 +15,7 @@ public class FloatUtils {
* @param data Float参数
*/
public static float get2Float(Float data) {
if (data == null) {
if (data == null || data.isNaN() || data.isInfinite()) {
return 0f;
}
int scale = 2;//设置位数

View File

@@ -17,6 +17,7 @@
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and quality_flag = 0
group by
`time`,line_id
</select>

View File

@@ -14,10 +14,11 @@
`time` between #{startTime} and #{endTime}
and phasic_type = 'T'
and value_type = 'MAX'
AND line_id IN
and line_id IN
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and quality_flag = 0
group by
`time`,line_id
</select>
@@ -26,7 +27,7 @@
select
`time` time,
line_id lineId,
avg(vl_dev) vlDev
avg(vu_dev) vuDev
from
r_stat_data_v_d
where
@@ -37,6 +38,7 @@
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and quality_flag = 0
group by
`time`,line_id
</select>
@@ -56,6 +58,7 @@
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and quality_flag = 0
group by
`time`,line_id
</select>

View File

@@ -317,7 +317,7 @@ public class GridServiceImpl implements IGridService {
vo1.setSd(targetSd(d,avg));
}
if (CollUtil.isNotEmpty(list2)) {
List<Double> d = list2.stream().map(o->o.getVlDev().doubleValue()).collect(Collectors.toList());
List<Double> d = list2.stream().map(o->o.getVuDev().doubleValue()).collect(Collectors.toList());
double avg = d.stream().collect(Collectors.averagingDouble(x->x));
vo2.setAvg(PubUtils.doubleRound(2,avg));
vo2.setSd(targetSd(d,avg));

View File

@@ -54,17 +54,17 @@ public class ThemeServiceImpl extends ServiceImpl<ThemeMapper, Theme> implements
theme.setFaviconUrl(generateBase64(themeParam.getFaviconFile()));
//v3参数
theme.setMainAnimation(themeParam.getMainAnimation());
theme.setElementUiPrimary(String.join("", themeParam.getElementUiPrimary()));
theme.setTableHeaderBackground(String.join("", themeParam.getTableHeaderBackground()));
theme.setTableHeaderColor(String.join("", themeParam.getTableHeaderColor()));
theme.setTableCurrent(String.join("", themeParam.getTableCurrent()));
theme.setMenuBackground(String.join("", themeParam.getMenuBackground()));
theme.setMenuColor(String.join("", themeParam.getMenuColor()));
theme.setMenuActiveBackground(String.join("", themeParam.getMenuActiveBackground()));
theme.setMenuActiveColor(String.join("", themeParam.getMenuActiveColor()));
theme.setMenuTopBarBackground(String.join("", themeParam.getMenuTopBarBackground()));
theme.setHeaderBarTabColor(String.join("", themeParam.getHeaderBarTabColor()));
theme.setHeaderBarBackground(String.join("", themeParam.getHeaderBarBackground()));
theme.setElementUiPrimary(String.join(",", themeParam.getElementUiPrimary()));
theme.setTableHeaderBackground(String.join(",", themeParam.getTableHeaderBackground()));
theme.setTableHeaderColor(String.join(",", themeParam.getTableHeaderColor()));
theme.setTableCurrent(String.join(",", themeParam.getTableCurrent()));
theme.setMenuBackground(String.join(",", themeParam.getMenuBackground()));
theme.setMenuColor(String.join(",", themeParam.getMenuColor()));
theme.setMenuActiveBackground(String.join(",", themeParam.getMenuActiveBackground()));
theme.setMenuActiveColor(String.join(",", themeParam.getMenuActiveColor()));
theme.setMenuTopBarBackground(String.join(",", themeParam.getMenuTopBarBackground()));
theme.setHeaderBarTabColor(String.join(",", themeParam.getHeaderBarTabColor()));
theme.setHeaderBarBackground(String.join(",", themeParam.getHeaderBarBackground()));
theme.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME));
theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME));
return this.save(theme);
@@ -79,17 +79,17 @@ public class ThemeServiceImpl extends ServiceImpl<ThemeMapper, Theme> implements
BeanUtil.copyProperties(themeParam, theme);
//v3参数
theme.setMainAnimation(themeParam.getMainAnimation());
theme.setElementUiPrimary(String.join("", themeParam.getElementUiPrimary()));
theme.setTableHeaderBackground(String.join("", themeParam.getTableHeaderBackground()));
theme.setTableHeaderColor(String.join("", themeParam.getTableHeaderColor()));
theme.setTableCurrent(String.join("", themeParam.getTableCurrent()));
theme.setMenuBackground(String.join("", themeParam.getMenuBackground()));
theme.setMenuColor(String.join("", themeParam.getMenuColor()));
theme.setMenuActiveBackground(String.join("", themeParam.getMenuActiveBackground()));
theme.setMenuActiveColor(String.join("", themeParam.getMenuActiveColor()));
theme.setMenuTopBarBackground(String.join("", themeParam.getMenuTopBarBackground()));
theme.setHeaderBarTabColor(String.join("", themeParam.getHeaderBarTabColor()));
theme.setHeaderBarBackground(String.join("", themeParam.getHeaderBarBackground()));
theme.setElementUiPrimary(String.join(",", themeParam.getElementUiPrimary()));
theme.setTableHeaderBackground(String.join(",", themeParam.getTableHeaderBackground()));
theme.setTableHeaderColor(String.join(",", themeParam.getTableHeaderColor()));
theme.setTableCurrent(String.join(",", themeParam.getTableCurrent()));
theme.setMenuBackground(String.join(",", themeParam.getMenuBackground()));
theme.setMenuColor(String.join(",", themeParam.getMenuColor()));
theme.setMenuActiveBackground(String.join(",", themeParam.getMenuActiveBackground()));
theme.setMenuActiveColor(String.join(",", themeParam.getMenuActiveColor()));
theme.setMenuTopBarBackground(String.join(",", themeParam.getMenuTopBarBackground()));
theme.setHeaderBarTabColor(String.join(",", themeParam.getHeaderBarTabColor()));
theme.setHeaderBarBackground(String.join(",", themeParam.getHeaderBarBackground()));
theme.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME));
theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME));
return this.updateById(theme);