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

@@ -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);
}