v3主题接口调整

This commit is contained in:
xy
2024-05-13 14:12:16 +08:00
parent eeeae803a6
commit d814600c85
5 changed files with 138 additions and 1 deletions

View File

@@ -126,5 +126,9 @@ public interface OssPath {
*/
String GOVERN_HARMONIC_FILE="govern/harmonic/";
/**
* 主题
*/
String THEME="theme/";
}

View File

@@ -683,7 +683,7 @@ public class GridServiceImpl implements IGridService {
int ubalanceTime = list33.stream()
.mapToInt(RStatLimitRateDPO::getUbalanceOvertime)
.sum();
comAssess.setQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-(devTime+freqTime+thdTime+pltTime+ubalanceTime)/(allTime*500.0)));
comAssess.setQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-(devTime+freqTime+thdTime+pltTime+ubalanceTime)*100.0/(allTime*5)));
comAssess.setVDevQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-devTime*100.0/allTime));
comAssess.setFreqQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-freqTime*100.0/allTime));
comAssess.setHarmQualifyData(allTime <= 0 ? 3.14159:PubUtils.doubleRound(2,100-thdTime*100.0/allTime));

View File

@@ -11,6 +11,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;
/**
* 类的介绍:
@@ -45,6 +46,42 @@ public class ThemeParam {
@NotNull(message = ValidMessage.FAVICON_NOT_BLANK)
private MultipartFile faviconFile;
@ApiModelProperty("切换栏位置")
private String mainAnimation;
@ApiModelProperty("主键主题色")
private List<String> elementUiPrimary;
@ApiModelProperty("表格标题背景颜色")
private List<String> tableHeaderBackground;
@ApiModelProperty("表格标题文字颜色")
private List<String> tableHeaderColor;
@ApiModelProperty("表格激活颜色")
private List<String> tableCurrent;
@ApiModelProperty("侧边菜单背景色")
private List<String> menuBackground;
@ApiModelProperty("侧边菜单文字颜色")
private List<String> menuColor;
@ApiModelProperty("侧边菜单激活项背景色")
private List<String> menuActiveBackground;
@ApiModelProperty("侧边菜单激活项文字色")
private List<String> menuActiveColor;
@ApiModelProperty("侧边菜单顶栏背景色")
private List<String> menuTopBarBackground;
@ApiModelProperty("顶栏文字色")
private List<String> headerBarTabColor;
@ApiModelProperty("顶栏背景色")
private List<String> headerBarBackground;
/**
* 用户更新操作实体
*

View File

@@ -58,4 +58,63 @@ public class Theme extends BaseEntity {
*/
private Integer state;
//V3主题使用的字段
/**
* 切换栏位置
*/
private String mainAnimation;
/**
* 主键主题色
*/
private String elementUiPrimary;
/**
* 表格标题背景颜色
*/
private String tableHeaderBackground;
/**
* 表格标题文字颜色
*/
private String tableHeaderColor;
/**
* 表格激活颜色
*/
private String tableCurrent;
/**
* 侧边菜单背景色
*/
private String menuBackground;
/**
* 侧边菜单文字颜色
*/
private String menuColor;
/**
* 侧边菜单激活项背景色
*/
private String menuActiveBackground;
/**
* 侧边菜单激活项文字色
*/
private String menuActiveColor;
/**
* 侧边菜单顶栏背景色
*/
private String menuTopBarBackground;
/**
* 顶栏文字色
*/
private String headerBarTabColor;
/**
* 顶栏背景色
*/
private String headerBarBackground;
/**
* logo文件服务器路径
*/
private String logoPath;
/**
* favicon文件服务器路径
*/
private String faviconPath;
}

View File

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.enums.ThemeEnum;
import com.njcn.system.mapper.ThemeMapper;
@@ -14,6 +16,7 @@ import com.njcn.system.pojo.param.ThemeParam;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.Theme;
import com.njcn.system.service.IThemeService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -22,6 +25,7 @@ import sun.misc.BASE64Encoder;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* <p>
@@ -32,8 +36,11 @@ import java.util.Objects;
* @since 2021-12-13
*/
@Service
@RequiredArgsConstructor
public class ThemeServiceImpl extends ServiceImpl<ThemeMapper, Theme> implements IThemeService {
private final FileStorageUtil fileStorageUtil;
@Override
public boolean addTheme(ThemeParam themeParam) {
checkThemeParam(themeParam,false);
@@ -45,6 +52,21 @@ public class ThemeServiceImpl extends ServiceImpl<ThemeMapper, Theme> implements
theme.setState(ThemeState.NORMAL);
theme.setLogoUrl(generateBase64(themeParam.getLogoFile()));
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.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME));
theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME));
return this.save(theme);
}
@@ -55,6 +77,21 @@ public class ThemeServiceImpl extends ServiceImpl<ThemeMapper, Theme> implements
theme.setLogoUrl(generateBase64(themeParam.getLogoFile()));
theme.setFaviconUrl(generateBase64(themeParam.getFaviconFile()));
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.setLogoPath(fileStorageUtil.uploadMultipart(themeParam.getLogoFile(), OssPath.THEME));
theme.setFaviconPath(fileStorageUtil.uploadMultipart(themeParam.getFaviconFile(), OssPath.THEME));
return this.updateById(theme);
}