Merge branch 'refs/heads/master' into master_lz

# Conflicts:
#	wms-module-system/src/main/java/top/wms/admin/auth/AbstractLoginHandler.java
#	wms-module-system/src/main/java/top/wms/admin/auth/handler/SocialLoginHandler.java
This commit is contained in:
2026-03-03 14:21:14 +08:00
48 changed files with 150 additions and 2091 deletions

View File

@@ -1,6 +1,5 @@
package top.wms.admin.config.satoken;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaRequest;
import cn.dev33.satoken.interceptor.SaInterceptor;

View File

@@ -0,0 +1,38 @@
package top.wms.admin.controller.WeighManage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.wms.admin.weighManage.model.resp.MaterialResp;
/**
* 部门管理管理 API
*
* @author zc
* @since 2025/03/19 17:46
*/
@Tag(name = "部门管理管理 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/weighManage/material")
public class WeighController {
/**
* 获取材料详细信息
*/
@SaCheckPermission("Weigh:material:detail")
@GetMapping(value = "/detail")
public MaterialResp getInfo() {
MaterialResp materialResp = new MaterialResp();
materialResp.setId(1L);
materialResp.setMaterialCode("123");
materialResp.setMaterialName("测试材料");
materialResp.setMaterialSpec("测试规格");
materialResp.setWeight("100");
materialResp.setImageUrl("http://example.com/image.jpg");
return materialResp;
}
}

View File

@@ -1,118 +0,0 @@
package top.wms.admin.controller.common;
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 io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.wms.admin.common.constant.CacheConstants;
import top.wms.admin.system.model.resp.dashboard.DashboardAccessTrendResp;
import top.wms.admin.system.model.resp.dashboard.DashboardChartCommonResp;
import top.wms.admin.system.model.resp.dashboard.DashboardNoticeResp;
import top.wms.admin.system.model.resp.dashboard.DashboardOverviewCommonResp;
import top.wms.admin.system.service.DashboardService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.log.annotation.Log;
import java.io.IOException;
import java.util.List;
/**
* 仪表盘 API
*
* @author Charles7c
* @since 2023/1/22 21:48
*/
@Tag(name = "仪表盘 API")
@Log(ignore = true)
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/dashboard")
public class DashboardController {
private final DashboardService dashboardService;
@Operation(summary = "查询公告列表", description = "查询公告列表")
@GetMapping("/notice")
public List<DashboardNoticeResp> listNotice() {
return dashboardService.listNotice();
}
@Operation(summary = "查询PV总览", description = "查询PV总览")
@GetMapping("/analysis/overview/pv")
public DashboardOverviewCommonResp getOverviewPv() {
return dashboardService.getOverviewPv();
}
@Operation(summary = "查询IP总览", description = "查询IP总览")
@GetMapping("/analysis/overview/ip")
public DashboardOverviewCommonResp getOverviewIp() {
return dashboardService.getOverviewIp();
}
@Operation(summary = "查询地域分析", description = "查询地域分析")
@GetMapping("/analysis/geo")
@CachePenetrationProtect
@CacheRefresh(refresh = 7200)
@Cached(key = "'GEO'", name = CacheConstants.DASHBOARD_KEY_PREFIX, cacheType = CacheType.BOTH, syncLocal = true)
public List<DashboardChartCommonResp> getAnalysisGeo() throws IOException {
return dashboardService.getAnalysisGeo();
}
@Operation(summary = "查询访问趋势信息", description = "查询访问趋势信息")
@Parameter(name = "days", description = "日期数", example = "30", in = ParameterIn.PATH)
@GetMapping("/access/trend/{days}")
@CachePenetrationProtect
@CacheRefresh(refresh = 7200)
@Cached(key = "#days", name = CacheConstants.DASHBOARD_KEY_PREFIX, cacheType = CacheType.BOTH, syncLocal = true)
public List<DashboardAccessTrendResp> listAccessTrend(@PathVariable Integer days) {
ValidationUtils.throwIf(7 != days && 30 != days, "仅支持查询近 7/30 天访问趋势信息");
return dashboardService.listAccessTrend(days);
}
@Operation(summary = "查询访问时段分析", description = "查询访问时段分析")
@GetMapping("/analysis/timeslot")
@CachePenetrationProtect
@CacheRefresh(refresh = 7200)
@Cached(key = "'TIMESLOT'", name = CacheConstants.DASHBOARD_KEY_PREFIX, cacheType = CacheType.BOTH, syncLocal = true)
public List<DashboardChartCommonResp> getAnalysisTimeslot() {
return dashboardService.getAnalysisTimeslot();
}
@Operation(summary = "查询模块分析", description = "查询模块分析")
@GetMapping("/analysis/module")
@CachePenetrationProtect
@CacheRefresh(refresh = 7200)
@Cached(key = "'MODULE'", name = CacheConstants.DASHBOARD_KEY_PREFIX, cacheType = CacheType.BOTH, syncLocal = true)
public List<DashboardChartCommonResp> getAnalysisModule() {
return dashboardService.getAnalysisModule();
}
@Operation(summary = "查询终端分析", description = "查询终端分析")
@GetMapping("/analysis/os")
@CachePenetrationProtect
@CacheRefresh(refresh = 7200)
@Cached(key = "'OS'", name = CacheConstants.DASHBOARD_KEY_PREFIX, cacheType = CacheType.BOTH, syncLocal = true)
public List<DashboardChartCommonResp> getAnalysisOs() {
return dashboardService.getAnalysisOs();
}
@Operation(summary = "查询浏览器分析", description = "查询浏览器分析")
@GetMapping("/analysis/browser")
@CachePenetrationProtect
@CacheRefresh(refresh = 7200)
@Cached(key = "'BROWSER'", name = CacheConstants.DASHBOARD_KEY_PREFIX, cacheType = CacheType.BOTH, syncLocal = true)
public List<DashboardChartCommonResp> getAnalysisBrowser() {
return dashboardService.getAnalysisBrowser();
}
}

View File

@@ -30,9 +30,6 @@ public class DemoEnvironmentJob {
private final DictItemMapper dictItemMapper;
private final DictMapper dictMapper;
private final StorageMapper storageMapper;
private final NoticeMapper noticeMapper;
private final MessageMapper messageMapper;
private final MessageUserMapper messageUserMapper;
private final UserMapper userMapper;
private final UserRoleMapper userRoleMapper;
private final UserSocialMapper userSocialMapper;
@@ -67,10 +64,6 @@ public class DemoEnvironmentJob {
this.log(dictCount, "字典");
Long storageCount = storageMapper.lambdaQuery().gt(StorageDO::getId, DELETE_FLAG).count();
this.log(storageCount, "存储");
Long noticeCount = noticeMapper.lambdaQuery().gt(NoticeDO::getId, DELETE_FLAG).count();
this.log(noticeCount, "公告");
Long messageCount = messageMapper.lambdaQuery().count();
this.log(messageCount, "通知");
Long userCount = userMapper.lambdaQuery().notIn(UserDO::getId, USER_FLAG).count();
this.log(userCount, "用户");
Long roleCount = roleMapper.lambdaQuery().notIn(RoleDO::getId, ROLE_FLAG).count();
@@ -83,8 +76,6 @@ public class DemoEnvironmentJob {
this.log(clientCount, "终端");
InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().blockAttack(true).build());
SnailJobLog.REMOTE.info("演示环境待清理数据项检测完成,开始执行清理。");
// 清理关联数据
messageUserMapper.lambdaUpdate().gt(MessageUserDO::getMessageId, MESSAGE_FLAG).remove();
userRoleMapper.lambdaUpdate().notIn(UserRoleDO::getRoleId, ROLE_FLAG).remove();
userRoleMapper.lambdaUpdate().notIn(UserRoleDO::getUserId, USER_FLAG).remove();
roleDeptMapper.lambdaUpdate().notIn(RoleDeptDO::getRoleId, ROLE_FLAG).remove();
@@ -100,12 +91,6 @@ public class DemoEnvironmentJob {
this.clean(storageCount, "存储", null, () -> storageMapper.lambdaUpdate()
.gt(StorageDO::getId, DELETE_FLAG)
.remove());
this.clean(noticeCount, "公告", null, () -> noticeMapper.lambdaUpdate()
.gt(NoticeDO::getId, DELETE_FLAG)
.remove());
this.clean(messageCount, "通知", null, () -> messageMapper.lambdaUpdate()
.gt(MessageDO::getId, MESSAGE_FLAG)
.remove());
this.clean(userCount, "用户", null, () -> userMapper.lambdaUpdate().notIn(UserDO::getId, USER_FLAG).remove());
this.clean(roleCount, "角色", null, () -> roleMapper.lambdaUpdate().notIn(RoleDO::getId, ROLE_FLAG).remove());
this.clean(menuCount, "菜单", CacheConstants.ROLE_MENU_KEY_PREFIX, () -> menuMapper.lambdaUpdate()

View File

@@ -1,65 +0,0 @@
package top.wms.admin.controller.system;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.wms.admin.common.context.UserContextHolder;
import top.wms.admin.system.model.query.MessageQuery;
import top.wms.admin.system.model.resp.message.MessageResp;
import top.wms.admin.system.model.resp.message.MessageUnreadResp;
import top.wms.admin.system.service.MessageService;
import top.wms.admin.system.service.MessageUserService;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.resp.PageResp;
import top.continew.starter.log.annotation.Log;
import java.util.List;
/**
* 消息管理 API
*
* @author Bull-BCLS
* @since 2023/10/15 19:05
*/
@Tag(name = "消息管理 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/system/message")
public class MessageController {
private final MessageService baseService;
private final MessageUserService messageUserService;
@Operation(summary = "分页查询列表", description = "分页查询列表")
@GetMapping
public PageResp<MessageResp> page(MessageQuery query, @Validated PageQuery pageQuery) {
query.setUserId(UserContextHolder.getUserId());
return baseService.page(query, pageQuery);
}
@Operation(summary = "删除数据", description = "删除数据")
@Parameter(name = "ids", description = "ID 列表", example = "1,2", in = ParameterIn.PATH)
@DeleteMapping("/{ids}")
public void delete(@PathVariable List<Long> ids) {
baseService.delete(ids);
}
@Operation(summary = "标记已读", description = "将消息标记为已读状态")
@Parameter(name = "ids", description = "消息ID列表", example = "1,2", in = ParameterIn.QUERY)
@PatchMapping("/read")
public void readMessage(@RequestParam(required = false) List<Long> ids) {
messageUserService.readMessage(ids);
}
@Log(ignore = true)
@Operation(summary = "查询未读消息数量", description = "查询当前用户的未读消息数量")
@Parameter(name = "isDetail", description = "是否查询详情", example = "true", in = ParameterIn.QUERY)
@GetMapping("/unread")
public MessageUnreadResp countUnreadMessage(@RequestParam(required = false) Boolean detail) {
return messageUserService.countUnreadMessageByUserId(UserContextHolder.getUserId(), detail);
}
}

View File

@@ -1,50 +0,0 @@
package top.wms.admin.controller.system;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;
import top.wms.admin.common.controller.BaseController;
import top.wms.admin.system.enums.NoticeScopeEnum;
import top.wms.admin.system.model.query.NoticeQuery;
import top.wms.admin.system.model.req.NoticeReq;
import top.wms.admin.system.model.resp.NoticeDetailResp;
import top.wms.admin.system.model.resp.NoticeResp;
import top.wms.admin.system.service.NoticeService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudApi;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
/**
* 公告管理 API
*
* @author Charles7c
* @since 2023/8/20 10:55
*/
@Tag(name = "公告管理 API")
@RestController
@CrudRequestMapping(value = "/system/notice", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE})
public class NoticeController extends BaseController<NoticeService, NoticeResp, NoticeDetailResp, NoticeQuery, NoticeReq> {
@Override
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) throws Exception {
super.preHandle(crudApi, args, targetMethod, targetClass);
Api api = crudApi.value();
if (!(Api.ADD.equals(api) || Api.UPDATE.equals(api))) {
return;
}
NoticeReq req = (NoticeReq)args[0];
// 校验生效时间
LocalDateTime effectiveTime = req.getEffectiveTime();
LocalDateTime terminateTime = req.getTerminateTime();
if (null != effectiveTime && null != terminateTime) {
ValidationUtils.throwIf(terminateTime.isBefore(effectiveTime), "终止时间必须晚于生效时间");
}
// 校验通知范围
if (NoticeScopeEnum.USER.equals(req.getNoticeScope())) {
ValidationUtils.throwIfEmpty(req.getNoticeUsers(), "通知用户不能为空");
}
}
}