mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 22:57:12 +08:00 
			
		
		
		
	refactor: 优化部分 JetCache 缓存定义
This commit is contained in:
		@@ -18,13 +18,8 @@ package top.charles7c.continew.admin.monitor.service.impl;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import cn.hutool.core.convert.Convert;
 | 
					import cn.hutool.core.convert.Convert;
 | 
				
			||||||
import cn.hutool.core.util.NumberUtil;
 | 
					import cn.hutool.core.util.NumberUtil;
 | 
				
			||||||
import com.alicp.jetcache.anno.CachePenetrationProtect;
 | 
					 | 
				
			||||||
import com.alicp.jetcache.anno.CacheRefresh;
 | 
					 | 
				
			||||||
import com.alicp.jetcache.anno.CacheType;
 | 
					 | 
				
			||||||
import com.alicp.jetcache.anno.Cached;
 | 
					 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import top.charles7c.continew.admin.common.constant.CacheConstants;
 | 
					 | 
				
			||||||
import top.charles7c.continew.admin.monitor.model.resp.DashboardAccessTrendResp;
 | 
					import top.charles7c.continew.admin.monitor.model.resp.DashboardAccessTrendResp;
 | 
				
			||||||
import top.charles7c.continew.admin.monitor.model.resp.DashboardGeoDistributionResp;
 | 
					import top.charles7c.continew.admin.monitor.model.resp.DashboardGeoDistributionResp;
 | 
				
			||||||
import top.charles7c.continew.admin.monitor.model.resp.DashboardPopularModuleResp;
 | 
					import top.charles7c.continew.admin.monitor.model.resp.DashboardPopularModuleResp;
 | 
				
			||||||
@@ -65,9 +60,6 @@ public class DashboardServiceImpl implements DashboardService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @CachePenetrationProtect
 | 
					 | 
				
			||||||
    @CacheRefresh(refresh = 7200)
 | 
					 | 
				
			||||||
    @Cached(key = "#days", cacheType = CacheType.BOTH, name = CacheConstants.DASHBOARD_KEY_PREFIX)
 | 
					 | 
				
			||||||
    public List<DashboardAccessTrendResp> listAccessTrend(Integer days) {
 | 
					    public List<DashboardAccessTrendResp> listAccessTrend(Integer days) {
 | 
				
			||||||
        return logService.listDashboardAccessTrend(days);
 | 
					        return logService.listDashboardAccessTrend(days);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,10 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package top.charles7c.continew.admin.system.service;
 | 
					package top.charles7c.continew.admin.system.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.springframework.web.multipart.MultipartFile;
 | 
					import org.springframework.web.multipart.MultipartFile;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import top.charles7c.continew.admin.system.model.entity.UserDO;
 | 
					import top.charles7c.continew.admin.system.model.entity.UserDO;
 | 
				
			||||||
import top.charles7c.continew.admin.system.model.query.UserQuery;
 | 
					import top.charles7c.continew.admin.system.model.query.UserQuery;
 | 
				
			||||||
import top.charles7c.continew.admin.system.model.req.UserBasicInfoUpdateReq;
 | 
					import top.charles7c.continew.admin.system.model.req.UserBasicInfoUpdateReq;
 | 
				
			||||||
@@ -29,6 +26,8 @@ import top.charles7c.continew.admin.system.model.resp.UserDetailResp;
 | 
				
			|||||||
import top.charles7c.continew.admin.system.model.resp.UserResp;
 | 
					import top.charles7c.continew.admin.system.model.resp.UserResp;
 | 
				
			||||||
import top.charles7c.continew.starter.extension.crud.base.BaseService;
 | 
					import top.charles7c.continew.starter.extension.crud.base.BaseService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 用户业务接口
 | 
					 * 用户业务接口
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -57,10 +56,10 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 修改基础信息
 | 
					     * 修改基础信息
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param updateReq 修改信息
 | 
					     * @param req 修改信息
 | 
				
			||||||
     * @param id  ID
 | 
					     * @param id  ID
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void updateBasicInfo(UserBasicInfoUpdateReq updateReq, Long id);
 | 
					    void updateBasicInfo(UserBasicInfoUpdateReq req, Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 修改密码
 | 
					     * 修改密码
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,6 @@ public class DictItemServiceImpl extends BaseServiceImpl<DictItemMapper, DictIte
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    //    @CacheInvalidate(key = "#id", name = CacheConstants.DICT_KEY_PREFIX)
 | 
					 | 
				
			||||||
    public void update(DictItemReq req, Long id) {
 | 
					    public void update(DictItemReq req, Long id) {
 | 
				
			||||||
        String value = req.getValue();
 | 
					        String value = req.getValue();
 | 
				
			||||||
        CheckUtils.throwIf(this.isValueExists(value, id, req.getDictId()), "修改失败,字典值 [{}] 已存在", value);
 | 
					        CheckUtils.throwIf(this.isValueExists(value, id, req.getDictId()), "修改失败,字典值 [{}] 已存在", value);
 | 
				
			||||||
@@ -74,7 +73,6 @@ public class DictItemServiceImpl extends BaseServiceImpl<DictItemMapper, DictIte
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    //    @CacheInvalidate(key = "#dictIds", name = CacheConstants.DICT_KEY_PREFIX, multi = true)
 | 
					 | 
				
			||||||
    public void deleteByDictIds(List<Long> dictIds) {
 | 
					    public void deleteByDictIds(List<Long> dictIds) {
 | 
				
			||||||
        baseMapper.lambdaUpdate().in(DictItemDO::getDictId, dictIds).remove();
 | 
					        baseMapper.lambdaUpdate().in(DictItemDO::getDictId, dictIds).remove();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,7 +56,7 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @CacheInvalidate(key = "#id", name = CacheConstants.MENU_KEY_PREFIX)
 | 
					    @CacheInvalidate(key = "'ALL'", name = CacheConstants.MENU_KEY_PREFIX)
 | 
				
			||||||
    public void update(MenuReq req, Long id) {
 | 
					    public void update(MenuReq req, Long id) {
 | 
				
			||||||
        String title = req.getTitle();
 | 
					        String title = req.getTitle();
 | 
				
			||||||
        CheckUtils.throwIf(this.isNameExists(title, req.getParentId(), id), "修改失败,[{}] 已存在", title);
 | 
					        CheckUtils.throwIf(this.isNameExists(title, req.getParentId(), id), "修改失败,[{}] 已存在", title);
 | 
				
			||||||
@@ -64,8 +64,8 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @CacheInvalidate(key = "#ids", name = CacheConstants.MENU_KEY_PREFIX, multi = true)
 | 
					 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    @CacheInvalidate(key = "'ALL'", name = CacheConstants.MENU_KEY_PREFIX)
 | 
				
			||||||
    public void delete(List<Long> ids) {
 | 
					    public void delete(List<Long> ids) {
 | 
				
			||||||
        baseMapper.lambdaUpdate().in(MenuDO::getParentId, ids).remove();
 | 
					        baseMapper.lambdaUpdate().in(MenuDO::getParentId, ids).remove();
 | 
				
			||||||
        super.delete(ids);
 | 
					        super.delete(ids);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,6 @@ public class OptionServiceImpl implements OptionService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    //    @CacheInvalidate(key = "#req.code", name = CacheConstants.OPTION_KEY_PREFIX, multi = true)
 | 
					 | 
				
			||||||
    public void update(List<OptionReq> req) {
 | 
					    public void update(List<OptionReq> req) {
 | 
				
			||||||
        baseMapper.updateBatchById(BeanUtil.copyToList(req, OptionDO.class));
 | 
					        baseMapper.updateBatchById(BeanUtil.copyToList(req, OptionDO.class));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,8 +78,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @CacheInvalidate(key = "#req.code == 'admin' ? 'ALL' : #req.code", name = CacheConstants.MENU_KEY_PREFIX)
 | 
					 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    @CacheInvalidate(key = "#req.code == 'admin' ? 'ALL' : #req.code", name = CacheConstants.MENU_KEY_PREFIX)
 | 
				
			||||||
    public void update(RoleReq req, Long id) {
 | 
					    public void update(RoleReq req, Long id) {
 | 
				
			||||||
        String name = req.getName();
 | 
					        String name = req.getName();
 | 
				
			||||||
        CheckUtils.throwIf(this.isNameExists(name, id), "修改失败,[{}] 已存在", name);
 | 
					        CheckUtils.throwIf(this.isNameExists(name, id), "修改失败,[{}] 已存在", name);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,9 @@ import cn.hutool.core.collection.CollUtil;
 | 
				
			|||||||
import cn.hutool.core.io.file.FileNameUtil;
 | 
					import cn.hutool.core.io.file.FileNameUtil;
 | 
				
			||||||
import cn.hutool.core.util.ObjectUtil;
 | 
					import cn.hutool.core.util.ObjectUtil;
 | 
				
			||||||
import cn.hutool.core.util.StrUtil;
 | 
					import cn.hutool.core.util.StrUtil;
 | 
				
			||||||
 | 
					import com.alicp.jetcache.anno.CacheInvalidate;
 | 
				
			||||||
import com.alicp.jetcache.anno.CacheType;
 | 
					import com.alicp.jetcache.anno.CacheType;
 | 
				
			||||||
 | 
					import com.alicp.jetcache.anno.CacheUpdate;
 | 
				
			||||||
import com.alicp.jetcache.anno.Cached;
 | 
					import com.alicp.jetcache.anno.Cached;
 | 
				
			||||||
import jakarta.annotation.Resource;
 | 
					import jakarta.annotation.Resource;
 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
@@ -103,6 +105,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    @CacheUpdate(key = "#id", value = "#req.nickname", name = CacheConstants.USER_KEY_PREFIX)
 | 
				
			||||||
    public void update(UserReq req, Long id) {
 | 
					    public void update(UserReq req, Long id) {
 | 
				
			||||||
        String username = req.getUsername();
 | 
					        String username = req.getUsername();
 | 
				
			||||||
        CheckUtils.throwIf(this.isNameExists(username, id), "修改失败,[{}] 已存在", username);
 | 
					        CheckUtils.throwIf(this.isNameExists(username, id), "修改失败,[{}] 已存在", username);
 | 
				
			||||||
@@ -129,6 +132,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
 | 
					    @CacheInvalidate(key = "#ids", name = CacheConstants.USER_KEY_PREFIX, multi = true)
 | 
				
			||||||
    public void delete(List<Long> ids) {
 | 
					    public void delete(List<Long> ids) {
 | 
				
			||||||
        CheckUtils.throwIf(CollUtil.contains(ids, LoginHelper.getUserId()), "不允许删除当前用户");
 | 
					        CheckUtils.throwIf(CollUtil.contains(ids, LoginHelper.getUserId()), "不允许删除当前用户");
 | 
				
			||||||
        List<UserDO> list = baseMapper.lambdaQuery()
 | 
					        List<UserDO> list = baseMapper.lambdaQuery()
 | 
				
			||||||
@@ -178,11 +182,12 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void updateBasicInfo(UserBasicInfoUpdateReq updateReq, Long id) {
 | 
					    @CacheUpdate(key = "#id", value = "#req.nickname", name = CacheConstants.USER_KEY_PREFIX)
 | 
				
			||||||
 | 
					    public void updateBasicInfo(UserBasicInfoUpdateReq req, Long id) {
 | 
				
			||||||
        super.getById(id);
 | 
					        super.getById(id);
 | 
				
			||||||
        baseMapper.lambdaUpdate()
 | 
					        baseMapper.lambdaUpdate()
 | 
				
			||||||
            .set(UserDO::getNickname, updateReq.getNickname())
 | 
					            .set(UserDO::getNickname, req.getNickname())
 | 
				
			||||||
            .set(UserDO::getGender, updateReq.getGender())
 | 
					            .set(UserDO::getGender, req.getGender())
 | 
				
			||||||
            .eq(UserDO::getId, id)
 | 
					            .eq(UserDO::getId, id)
 | 
				
			||||||
            .update();
 | 
					            .update();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -263,7 +268,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Cached(key = "#id", cacheType = CacheType.BOTH, name = CacheConstants.USER_KEY_PREFIX)
 | 
					    @Cached(key = "#id", cacheType = CacheType.BOTH, name = CacheConstants.USER_KEY_PREFIX, syncLocal = true)
 | 
				
			||||||
    public String getNicknameById(Long id) {
 | 
					    public String getNicknameById(Long id) {
 | 
				
			||||||
        return baseMapper.selectNicknameById(id);
 | 
					        return baseMapper.selectNicknameById(id);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,8 @@ import cn.dev33.satoken.annotation.SaIgnore;
 | 
				
			|||||||
import cn.hutool.core.lang.tree.Tree;
 | 
					import cn.hutool.core.lang.tree.Tree;
 | 
				
			||||||
import cn.hutool.core.util.ClassUtil;
 | 
					import cn.hutool.core.util.ClassUtil;
 | 
				
			||||||
import cn.hutool.core.util.StrUtil;
 | 
					import cn.hutool.core.util.StrUtil;
 | 
				
			||||||
 | 
					import com.alicp.jetcache.anno.CachePenetrationProtect;
 | 
				
			||||||
 | 
					import com.alicp.jetcache.anno.CacheRefresh;
 | 
				
			||||||
import com.alicp.jetcache.anno.Cached;
 | 
					import com.alicp.jetcache.anno.Cached;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.Operation;
 | 
					import io.swagger.v3.oas.annotations.Operation;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.Parameter;
 | 
					import io.swagger.v3.oas.annotations.Parameter;
 | 
				
			||||||
@@ -103,6 +105,8 @@ public class CommonController {
 | 
				
			|||||||
    @Operation(summary = "查询字典", description = "查询字典列表")
 | 
					    @Operation(summary = "查询字典", description = "查询字典列表")
 | 
				
			||||||
    @Parameter(name = "code", description = "字典编码", example = "announcement_type", in = ParameterIn.PATH)
 | 
					    @Parameter(name = "code", description = "字典编码", example = "announcement_type", in = ParameterIn.PATH)
 | 
				
			||||||
    @GetMapping("/dict/{code}")
 | 
					    @GetMapping("/dict/{code}")
 | 
				
			||||||
 | 
					    @CachePenetrationProtect
 | 
				
			||||||
 | 
					    @CacheRefresh(refresh = 3600, stopRefreshAfterLastAccess = 7200)
 | 
				
			||||||
    @Cached(key = "#code", name = CacheConstants.DICT_KEY_PREFIX)
 | 
					    @Cached(key = "#code", name = CacheConstants.DICT_KEY_PREFIX)
 | 
				
			||||||
    public R<List<LabelValueResp>> listDict(@PathVariable String code) {
 | 
					    public R<List<LabelValueResp>> listDict(@PathVariable String code) {
 | 
				
			||||||
        Optional<Class<?>> enumClass = this.getEnumClassByName(code);
 | 
					        Optional<Class<?>> enumClass = this.getEnumClassByName(code);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,21 +16,21 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package top.charles7c.continew.admin.webapi.common;
 | 
					package top.charles7c.continew.admin.webapi.common;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import com.alicp.jetcache.anno.CachePenetrationProtect;
 | 
				
			||||||
 | 
					import com.alicp.jetcache.anno.CacheRefresh;
 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import com.alicp.jetcache.anno.CacheType;
 | 
				
			||||||
 | 
					import com.alicp.jetcache.anno.Cached;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.Operation;
 | 
					import io.swagger.v3.oas.annotations.Operation;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.Parameter;
 | 
					import io.swagger.v3.oas.annotations.Parameter;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
 | 
					import io.swagger.v3.oas.annotations.enums.ParameterIn;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.tags.Tag;
 | 
					import io.swagger.v3.oas.annotations.tags.Tag;
 | 
				
			||||||
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
import org.springframework.validation.annotation.Validated;
 | 
					import org.springframework.validation.annotation.Validated;
 | 
				
			||||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
					import org.springframework.web.bind.annotation.GetMapping;
 | 
				
			||||||
import org.springframework.web.bind.annotation.PathVariable;
 | 
					import org.springframework.web.bind.annotation.PathVariable;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RestController;
 | 
					import org.springframework.web.bind.annotation.RestController;
 | 
				
			||||||
 | 
					import top.charles7c.continew.admin.common.constant.CacheConstants;
 | 
				
			||||||
import top.charles7c.continew.admin.monitor.model.resp.DashboardAccessTrendResp;
 | 
					import top.charles7c.continew.admin.monitor.model.resp.DashboardAccessTrendResp;
 | 
				
			||||||
import top.charles7c.continew.admin.monitor.model.resp.DashboardGeoDistributionResp;
 | 
					import top.charles7c.continew.admin.monitor.model.resp.DashboardGeoDistributionResp;
 | 
				
			||||||
import top.charles7c.continew.admin.monitor.model.resp.DashboardPopularModuleResp;
 | 
					import top.charles7c.continew.admin.monitor.model.resp.DashboardPopularModuleResp;
 | 
				
			||||||
@@ -41,6 +41,8 @@ import top.charles7c.continew.starter.core.util.validate.ValidationUtils;
 | 
				
			|||||||
import top.charles7c.continew.starter.extension.crud.model.resp.R;
 | 
					import top.charles7c.continew.starter.extension.crud.model.resp.R;
 | 
				
			||||||
import top.charles7c.continew.starter.log.common.annotation.Log;
 | 
					import top.charles7c.continew.starter.log.common.annotation.Log;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 仪表盘 API
 | 
					 * 仪表盘 API
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -66,6 +68,9 @@ public class DashboardController {
 | 
				
			|||||||
    @Operation(summary = "查询访问趋势信息", description = "查询访问趋势信息")
 | 
					    @Operation(summary = "查询访问趋势信息", description = "查询访问趋势信息")
 | 
				
			||||||
    @Parameter(name = "days", description = "日期数", example = "30", in = ParameterIn.PATH)
 | 
					    @Parameter(name = "days", description = "日期数", example = "30", in = ParameterIn.PATH)
 | 
				
			||||||
    @GetMapping("/access/trend/{days}")
 | 
					    @GetMapping("/access/trend/{days}")
 | 
				
			||||||
 | 
					    @CachePenetrationProtect
 | 
				
			||||||
 | 
					    @CacheRefresh(refresh = 7200)
 | 
				
			||||||
 | 
					    @Cached(key = "#days", cacheType = CacheType.BOTH, name = CacheConstants.DASHBOARD_KEY_PREFIX, syncLocal = true)
 | 
				
			||||||
    public R<List<DashboardAccessTrendResp>> listAccessTrend(@PathVariable Integer days) {
 | 
					    public R<List<DashboardAccessTrendResp>> listAccessTrend(@PathVariable Integer days) {
 | 
				
			||||||
        ValidationUtils.throwIf(7 != days && 30 != days, "仅支持查询近 7/30 天访问趋势信息");
 | 
					        ValidationUtils.throwIf(7 != days && 30 != days, "仅支持查询近 7/30 天访问趋势信息");
 | 
				
			||||||
        return R.ok(dashboardService.listAccessTrend(days));
 | 
					        return R.ok(dashboardService.listAccessTrend(days));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,26 +16,21 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package top.charles7c.continew.admin.webapi.system;
 | 
					package top.charles7c.continew.admin.webapi.system;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import cn.hutool.core.util.ReUtil;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import com.xkcoding.justauth.AuthRequestFactory;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import jakarta.validation.constraints.NotNull;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import io.swagger.v3.oas.annotations.Operation;
 | 
					import io.swagger.v3.oas.annotations.Operation;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.Parameter;
 | 
					import io.swagger.v3.oas.annotations.Parameter;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
 | 
					import io.swagger.v3.oas.annotations.enums.ParameterIn;
 | 
				
			||||||
import io.swagger.v3.oas.annotations.tags.Tag;
 | 
					import io.swagger.v3.oas.annotations.tags.Tag;
 | 
				
			||||||
 | 
					import jakarta.validation.constraints.NotNull;
 | 
				
			||||||
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
 | 
					import me.zhyd.oauth.model.AuthCallback;
 | 
				
			||||||
 | 
					import me.zhyd.oauth.model.AuthResponse;
 | 
				
			||||||
 | 
					import me.zhyd.oauth.model.AuthUser;
 | 
				
			||||||
 | 
					import me.zhyd.oauth.request.AuthRequest;
 | 
				
			||||||
import org.springframework.validation.annotation.Validated;
 | 
					import org.springframework.validation.annotation.Validated;
 | 
				
			||||||
import org.springframework.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
import org.springframework.web.multipart.MultipartFile;
 | 
					import org.springframework.web.multipart.MultipartFile;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.xkcoding.justauth.AuthRequestFactory;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import cn.hutool.core.util.ReUtil;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import top.charles7c.continew.admin.common.constant.CacheConstants;
 | 
					import top.charles7c.continew.admin.common.constant.CacheConstants;
 | 
				
			||||||
import top.charles7c.continew.admin.common.constant.RegexConstants;
 | 
					import top.charles7c.continew.admin.common.constant.RegexConstants;
 | 
				
			||||||
import top.charles7c.continew.admin.common.enums.SocialSourceEnum;
 | 
					import top.charles7c.continew.admin.common.enums.SocialSourceEnum;
 | 
				
			||||||
@@ -55,10 +50,8 @@ import top.charles7c.continew.starter.core.util.ExceptionUtils;
 | 
				
			|||||||
import top.charles7c.continew.starter.core.util.validate.ValidationUtils;
 | 
					import top.charles7c.continew.starter.core.util.validate.ValidationUtils;
 | 
				
			||||||
import top.charles7c.continew.starter.extension.crud.model.resp.R;
 | 
					import top.charles7c.continew.starter.extension.crud.model.resp.R;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import me.zhyd.oauth.model.AuthCallback;
 | 
					import java.util.List;
 | 
				
			||||||
import me.zhyd.oauth.model.AuthResponse;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
import me.zhyd.oauth.model.AuthUser;
 | 
					 | 
				
			||||||
import me.zhyd.oauth.request.AuthRequest;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 个人中心 API
 | 
					 * 个人中心 API
 | 
				
			||||||
@@ -87,8 +80,8 @@ public class UserCenterController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Operation(summary = "修改基础信息", description = "修改用户基础信息")
 | 
					    @Operation(summary = "修改基础信息", description = "修改用户基础信息")
 | 
				
			||||||
    @PatchMapping("/basic/info")
 | 
					    @PatchMapping("/basic/info")
 | 
				
			||||||
    public R updateBasicInfo(@Validated @RequestBody UserBasicInfoUpdateReq updateReq) {
 | 
					    public R updateBasicInfo(@Validated @RequestBody UserBasicInfoUpdateReq req) {
 | 
				
			||||||
        userService.updateBasicInfo(updateReq, LoginHelper.getUserId());
 | 
					        userService.updateBasicInfo(req, LoginHelper.getUserId());
 | 
				
			||||||
        return R.ok("修改成功");
 | 
					        return R.ok("修改成功");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user