代码优化

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参数 * @param data Float参数
*/ */
public static float get2Float(Float data) { public static float get2Float(Float data) {
if (data == null) { if (data == null || data.isNaN() || data.isInfinite()) {
return 0f; return 0f;
} }
int scale = 2;//设置位数 int scale = 2;//设置位数

View File

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

View File

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

View File

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

View File

@@ -317,7 +317,7 @@ public class GridServiceImpl implements IGridService {
vo1.setSd(targetSd(d,avg)); vo1.setSd(targetSd(d,avg));
} }
if (CollUtil.isNotEmpty(list2)) { 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)); double avg = d.stream().collect(Collectors.averagingDouble(x->x));
vo2.setAvg(PubUtils.doubleRound(2,avg)); vo2.setAvg(PubUtils.doubleRound(2,avg));
vo2.setSd(targetSd(d,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())); theme.setFaviconUrl(generateBase64(themeParam.getFaviconFile()));
//v3参数 //v3参数
theme.setMainAnimation(themeParam.getMainAnimation()); theme.setMainAnimation(themeParam.getMainAnimation());
theme.setElementUiPrimary(String.join("", themeParam.getElementUiPrimary())); theme.setElementUiPrimary(String.join(",", themeParam.getElementUiPrimary()));
theme.setTableHeaderBackground(String.join("", themeParam.getTableHeaderBackground())); theme.setTableHeaderBackground(String.join(",", themeParam.getTableHeaderBackground()));
theme.setTableHeaderColor(String.join("", themeParam.getTableHeaderColor())); theme.setTableHeaderColor(String.join(",", themeParam.getTableHeaderColor()));
theme.setTableCurrent(String.join("", themeParam.getTableCurrent())); theme.setTableCurrent(String.join(",", themeParam.getTableCurrent()));
theme.setMenuBackground(String.join("", themeParam.getMenuBackground())); theme.setMenuBackground(String.join(",", themeParam.getMenuBackground()));
theme.setMenuColor(String.join("", themeParam.getMenuColor())); theme.setMenuColor(String.join(",", themeParam.getMenuColor()));
theme.setMenuActiveBackground(String.join("", themeParam.getMenuActiveBackground())); theme.setMenuActiveBackground(String.join(",", themeParam.getMenuActiveBackground()));
theme.setMenuActiveColor(String.join("", themeParam.getMenuActiveColor())); theme.setMenuActiveColor(String.join(",", themeParam.getMenuActiveColor()));
theme.setMenuTopBarBackground(String.join("", themeParam.getMenuTopBarBackground())); theme.setMenuTopBarBackground(String.join(",", themeParam.getMenuTopBarBackground()));
theme.setHeaderBarTabColor(String.join("", themeParam.getHeaderBarTabColor())); theme.setHeaderBarTabColor(String.join(",", themeParam.getHeaderBarTabColor()));
theme.setHeaderBarBackground(String.join("", themeParam.getHeaderBarBackground())); theme.setHeaderBarBackground(String.join(",", themeParam.getHeaderBarBackground()));
theme.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME)); theme.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME));
theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME)); theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME));
return this.save(theme); return this.save(theme);
@@ -79,17 +79,17 @@ public class ThemeServiceImpl extends ServiceImpl<ThemeMapper, Theme> implements
BeanUtil.copyProperties(themeParam, theme); BeanUtil.copyProperties(themeParam, theme);
//v3参数 //v3参数
theme.setMainAnimation(themeParam.getMainAnimation()); theme.setMainAnimation(themeParam.getMainAnimation());
theme.setElementUiPrimary(String.join("", themeParam.getElementUiPrimary())); theme.setElementUiPrimary(String.join(",", themeParam.getElementUiPrimary()));
theme.setTableHeaderBackground(String.join("", themeParam.getTableHeaderBackground())); theme.setTableHeaderBackground(String.join(",", themeParam.getTableHeaderBackground()));
theme.setTableHeaderColor(String.join("", themeParam.getTableHeaderColor())); theme.setTableHeaderColor(String.join(",", themeParam.getTableHeaderColor()));
theme.setTableCurrent(String.join("", themeParam.getTableCurrent())); theme.setTableCurrent(String.join(",", themeParam.getTableCurrent()));
theme.setMenuBackground(String.join("", themeParam.getMenuBackground())); theme.setMenuBackground(String.join(",", themeParam.getMenuBackground()));
theme.setMenuColor(String.join("", themeParam.getMenuColor())); theme.setMenuColor(String.join(",", themeParam.getMenuColor()));
theme.setMenuActiveBackground(String.join("", themeParam.getMenuActiveBackground())); theme.setMenuActiveBackground(String.join(",", themeParam.getMenuActiveBackground()));
theme.setMenuActiveColor(String.join("", themeParam.getMenuActiveColor())); theme.setMenuActiveColor(String.join(",", themeParam.getMenuActiveColor()));
theme.setMenuTopBarBackground(String.join("", themeParam.getMenuTopBarBackground())); theme.setMenuTopBarBackground(String.join(",", themeParam.getMenuTopBarBackground()));
theme.setHeaderBarTabColor(String.join("", themeParam.getHeaderBarTabColor())); theme.setHeaderBarTabColor(String.join(",", themeParam.getHeaderBarTabColor()));
theme.setHeaderBarBackground(String.join("", themeParam.getHeaderBarBackground())); theme.setHeaderBarBackground(String.join(",", themeParam.getHeaderBarBackground()));
theme.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME)); theme.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME));
theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME)); theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME));
return this.updateById(theme); return this.updateById(theme);