diff --git a/wms-module-system/src/main/java/top/wms/admin/auth/AbstractLoginHandler.java b/wms-module-system/src/main/java/top/wms/admin/auth/AbstractLoginHandler.java index e8fe1c5..4a94318 100644 --- a/wms-module-system/src/main/java/top/wms/admin/auth/AbstractLoginHandler.java +++ b/wms-module-system/src/main/java/top/wms/admin/auth/AbstractLoginHandler.java @@ -13,6 +13,7 @@ import top.wms.admin.common.context.UserContext; import top.wms.admin.common.context.UserContextHolder; import top.wms.admin.common.context.UserExtraContext; import top.wms.admin.common.enums.DisEnableStatusEnum; +import top.wms.admin.system.model.entity.DeptDO; import top.wms.admin.system.model.entity.UserDO; import top.wms.admin.system.model.resp.ClientResp; import top.wms.admin.system.service.DeptService; @@ -105,5 +106,7 @@ public abstract class AbstractLoginHandler implements LoginH */ protected void checkUserStatus(UserDO user) { CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, user.getStatus(), "此账号已被禁用,如有疑问,请联系管理员"); +// DeptDO dept = deptService.getById(user.getDeptId()); +// CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, dept.getStatus(), "此账号所属部门已被禁用,如有疑问,请联系管理员"); } } diff --git a/wms-module-system/src/main/java/top/wms/admin/auth/enums/AuthTypeEnum.java b/wms-module-system/src/main/java/top/wms/admin/auth/enums/AuthTypeEnum.java index 93d28d4..c2cdf0d 100644 --- a/wms-module-system/src/main/java/top/wms/admin/auth/enums/AuthTypeEnum.java +++ b/wms-module-system/src/main/java/top/wms/admin/auth/enums/AuthTypeEnum.java @@ -34,7 +34,12 @@ public enum AuthTypeEnum implements BaseEnum { /** * 第三方账号 */ - SOCIAL("SOCIAL", "第三方账号", UiConstants.COLOR_ERROR); + SOCIAL("SOCIAL", "第三方账号", UiConstants.COLOR_ERROR), + + /** + * 卡号 + */ + CARD("CARD", "卡号", UiConstants.COLOR_PRIMARY); private final String value; private final String description; diff --git a/wms-module-system/src/main/java/top/wms/admin/auth/handler/CardLoginHandler.java b/wms-module-system/src/main/java/top/wms/admin/auth/handler/CardLoginHandler.java new file mode 100644 index 0000000..3847914 --- /dev/null +++ b/wms-module-system/src/main/java/top/wms/admin/auth/handler/CardLoginHandler.java @@ -0,0 +1,43 @@ +package top.wms.admin.auth.handler; + +import jakarta.servlet.http.HttpServletRequest; +import top.continew.starter.cache.redisson.util.RedisUtils; +import top.continew.starter.core.validation.ValidationUtils; +import top.wms.admin.auth.AbstractLoginHandler; +import top.wms.admin.auth.enums.AuthTypeEnum; +import top.wms.admin.auth.model.req.CardLoginReq; +import top.wms.admin.auth.model.req.PhoneLoginReq; +import top.wms.admin.auth.model.resp.LoginResp; +import top.wms.admin.common.constant.CacheConstants; +import top.wms.admin.system.model.entity.UserDO; +import top.wms.admin.system.model.resp.ClientResp; + +public class CardLoginHandler extends AbstractLoginHandler { + + @Override + public LoginResp login(CardLoginReq req, ClientResp client, HttpServletRequest request) { + // 验证手机号 + UserDO user = userService.getByCard(req.getCardNumber()); + ValidationUtils.throwIfNull(user, "此手机号未绑定本系统账号"); + // 检查用户状态 + super.checkUserStatus(user); + // 执行认证 + String token = super.authenticate(user, client); + return LoginResp.builder().token(token).build(); + } + + @Override + public void preLogin(PhoneLoginReq req, ClientResp client, HttpServletRequest request) { + String phone = req.getPhone(); + String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + phone; + String captcha = RedisUtils.get(captchaKey); + ValidationUtils.throwIfBlank(captcha, CAPTCHA_EXPIRED); + ValidationUtils.throwIfNotEqualIgnoreCase(req.getCaptcha(), captcha, CAPTCHA_ERROR); + RedisUtils.delete(captchaKey); + } + + @Override + public AuthTypeEnum getAuthType() { + return AuthTypeEnum.PHONE; + } +} diff --git a/wms-module-system/src/main/java/top/wms/admin/auth/handler/SocialLoginHandler.java b/wms-module-system/src/main/java/top/wms/admin/auth/handler/SocialLoginHandler.java index 88a1c40..22a0a89 100644 --- a/wms-module-system/src/main/java/top/wms/admin/auth/handler/SocialLoginHandler.java +++ b/wms-module-system/src/main/java/top/wms/admin/auth/handler/SocialLoginHandler.java @@ -2,7 +2,6 @@ package top.wms.admin.auth.handler; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.ReUtil; @@ -23,24 +22,18 @@ import top.wms.admin.common.constant.RegexConstants; import top.wms.admin.common.constant.SysConstants; import top.wms.admin.common.enums.DisEnableStatusEnum; import top.wms.admin.common.enums.GenderEnum; -import top.wms.admin.system.enums.MessageTemplateEnum; -import top.wms.admin.system.enums.MessageTypeEnum; import top.wms.admin.system.model.entity.RoleDO; import top.wms.admin.system.model.entity.UserDO; import top.wms.admin.system.model.entity.UserSocialDO; -import top.wms.admin.system.model.req.MessageReq; import top.wms.admin.system.model.resp.ClientResp; -import top.wms.admin.system.service.MessageService; import top.wms.admin.system.service.UserRoleService; import top.wms.admin.system.service.UserSocialService; import top.continew.starter.core.autoconfigure.project.ProjectProperties; import top.continew.starter.core.exception.BadRequestException; import top.continew.starter.core.validation.ValidationUtils; -import top.continew.starter.messaging.websocket.util.WebSocketUtils; import java.time.LocalDateTime; import java.util.Collections; -import java.util.List; /** * 第三方账号登录处理器 @@ -56,7 +49,6 @@ public class SocialLoginHandler extends AbstractLoginHandler { private final AuthRequestFactory authRequestFactory; private final UserSocialService userSocialService; private final UserRoleService userRoleService; - private final MessageService messageService; private final ProjectProperties projectProperties; @Override @@ -94,7 +86,6 @@ public class SocialLoginHandler extends AbstractLoginHandler { userSocial.setUserId(userId); userSocial.setSource(source); userSocial.setOpenId(openId); - this.sendSecurityMsg(user); } else { user = BeanUtil.copyProperties(userService.getById(userSocial.getUserId()), UserDO.class); } @@ -135,21 +126,4 @@ public class SocialLoginHandler extends AbstractLoginHandler { } } - /** - * 发送安全消息 - * - * @param user 用户信息 - */ - private void sendSecurityMsg(UserDO user) { - MessageReq req = new MessageReq(); - MessageTemplateEnum socialRegister = MessageTemplateEnum.SOCIAL_REGISTER; - req.setTitle(socialRegister.getTitle().formatted(projectProperties.getName())); - req.setContent(socialRegister.getContent().formatted(user.getUsername())); - req.setType(MessageTypeEnum.SECURITY); - messageService.add(req, CollUtil.toList(user.getId())); - List tokenList = StpUtil.getTokenValueListByLoginId(user.getId()); - for (String token : tokenList) { - WebSocketUtils.sendMessage(token, "1"); - } - } } diff --git a/wms-module-system/src/main/java/top/wms/admin/auth/model/req/CardLoginReq.java b/wms-module-system/src/main/java/top/wms/admin/auth/model/req/CardLoginReq.java new file mode 100644 index 0000000..6e1dd9c --- /dev/null +++ b/wms-module-system/src/main/java/top/wms/admin/auth/model/req/CardLoginReq.java @@ -0,0 +1,30 @@ +package top.wms.admin.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serial; + +/** + * 卡号登录参数 + * + * @author KAI + * @author Charles7c + * @since 2024/12/25 15:43 + */ +@Data +@Schema(description = "卡号登录参数") +public class CardLoginReq extends LoginReq { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 卡号 + */ + @Schema(description = "卡号", example = "1234567890") + @NotBlank(message = "卡号不能为空") + private String cardNumber; + +} diff --git a/wms-module-system/src/main/java/top/wms/admin/auth/model/req/LoginReq.java b/wms-module-system/src/main/java/top/wms/admin/auth/model/req/LoginReq.java index d27e49f..1e2c84c 100644 --- a/wms-module-system/src/main/java/top/wms/admin/auth/model/req/LoginReq.java +++ b/wms-module-system/src/main/java/top/wms/admin/auth/model/req/LoginReq.java @@ -23,7 +23,8 @@ import java.io.Serializable; @JsonSubTypes({@JsonSubTypes.Type(value = AccountLoginReq.class, name = "ACCOUNT"), @JsonSubTypes.Type(value = EmailLoginReq.class, name = "EMAIL"), @JsonSubTypes.Type(value = PhoneLoginReq.class, name = "PHONE"), - @JsonSubTypes.Type(value = SocialLoginReq.class, name = "SOCIAL")}) + @JsonSubTypes.Type(value = SocialLoginReq.class, name = "SOCIAL"), + @JsonSubTypes.Type(value = CardLoginReq.class, name = "CARD")}) @Schema(description = "基础登录参数") public class LoginReq implements Serializable { diff --git a/wms-module-system/src/main/java/top/wms/admin/system/mapper/LogMapper.java b/wms-module-system/src/main/java/top/wms/admin/system/mapper/LogMapper.java index e45aaa5..d0c611a 100644 --- a/wms-module-system/src/main/java/top/wms/admin/system/mapper/LogMapper.java +++ b/wms-module-system/src/main/java/top/wms/admin/system/mapper/LogMapper.java @@ -1,20 +1,14 @@ package top.wms.admin.system.mapper; -import com.alicp.jetcache.anno.Cached; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import top.wms.admin.common.constant.CacheConstants; import top.wms.admin.system.model.entity.LogDO; -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.DashboardOverviewCommonResp; import top.wms.admin.system.model.resp.log.LogResp; import top.continew.starter.data.mp.base.BaseMapper; -import java.util.Date; import java.util.List; /** @@ -51,83 +45,4 @@ public interface LogMapper extends BaseMapper { @Select("SELECT COUNT(*) FROM sys_log") Long selectTotalCount(); - /** - * 查询仪表盘 PV 总览 - * - * @return 仪表盘 PV 总览 - */ - DashboardOverviewCommonResp selectDashboardOverviewPv(); - - /** - * 查询仪表盘 IP 总览 - * - * @return 仪表盘 IP 总览 - */ - DashboardOverviewCommonResp selectDashboardOverviewIp(); - - /** - * 查询仪表盘 PV 近 N 月各月份信息 - * - * @param months 近 N 月月份列表 - * @return 仪表盘 PV 近 N 月各月份信息 - */ - @Cached(key = "#months[0]", name = CacheConstants.DASHBOARD_KEY_PREFIX + "PV:") - List selectListDashboardAnalysisPv(@Param("months") List months); - - /** - * 查询仪表盘 IP 近 N 月各月份信息 - * - * @param months 近 N 月月份列表 - * @return 仪表盘 IP 近 N 月各月份信息 - */ - @Cached(key = "#months[0]", name = CacheConstants.DASHBOARD_KEY_PREFIX + "IP:") - List selectListDashboardAnalysisIp(@Param("months") List months); - - /** - * 查询仪表盘地域分析信息 - * - * @return 仪表盘地域分析信息 - */ - List selectListDashboardAnalysisGeo(); - - /** - * 查询仪表盘访问趋势信息 - * - * @param startTime 开始时间 - * @param endTime 结束时间 - * @return 仪表盘访问趋势信息 - */ - List selectListDashboardAccessTrend(@Param("startTime") Date startTime, - @Param("endTime") Date endTime); - - /** - * 查询仪表盘访问时段分析信息 - * - * @return 仪表盘访问时段分析信息 - */ - List selectListDashboardAnalysisTimeslot(); - - /** - * 查询仪表盘模块分析信息 - * - * @param top 显示数量 - * @return 仪表盘模块分析信息 - */ - List selectListDashboardAnalysisModule(@Param("top") Integer top); - - /** - * 查询仪表盘终端分析信息 - * - * @param top 显示数量 - * @return 仪表盘终端分析信息 - */ - List selectListDashboardAnalysisOs(@Param("top") Integer top); - - /** - * 查询仪表盘浏览器分析信息 - * - * @param top 显示数量 - * @return 仪表盘浏览器分析信息 - */ - List selectListDashboardAnalysisBrowser(@Param("top") Integer top); } diff --git a/wms-module-system/src/main/java/top/wms/admin/system/mapper/MessageMapper.java b/wms-module-system/src/main/java/top/wms/admin/system/mapper/MessageMapper.java deleted file mode 100644 index e4a6462..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/mapper/MessageMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package top.wms.admin.system.mapper; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Constants; -import org.apache.ibatis.annotations.Param; -import top.wms.admin.system.model.entity.MessageDO; -import top.wms.admin.system.model.resp.message.MessageResp; -import top.continew.starter.data.mp.base.BaseMapper; - -/** - * 消息 Mapper - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -public interface MessageMapper extends BaseMapper { - - /** - * 分页查询列表 - * - * @param page 分页查询条件 - * @param queryWrapper 查询条件 - * @return 分页信息 - */ - IPage selectPageByUserId(@Param("page") IPage page, - @Param(Constants.WRAPPER) QueryWrapper queryWrapper); -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/mapper/MessageUserMapper.java b/wms-module-system/src/main/java/top/wms/admin/system/mapper/MessageUserMapper.java deleted file mode 100644 index f1058d7..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/mapper/MessageUserMapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package top.wms.admin.system.mapper; - -import org.apache.ibatis.annotations.Param; -import top.wms.admin.system.model.entity.MessageUserDO; -import top.continew.starter.data.mp.base.BaseMapper; - -/** - * 消息和用户 Mapper - * - * @author Bull-BCLS - * @since 2023/10/15 20:25 - */ -public interface MessageUserMapper extends BaseMapper { - - /** - * 根据用户 ID 和消息类型查询未读消息数量 - * - * @param userId 用户 ID - * @param type 消息类型 - * @return 未读消息信息 - */ - Long selectUnreadCountByUserIdAndType(@Param("userId") Long userId, @Param("type") Integer type); -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/mapper/NoticeMapper.java b/wms-module-system/src/main/java/top/wms/admin/system/mapper/NoticeMapper.java deleted file mode 100644 index 2b0c82c..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/mapper/NoticeMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package top.wms.admin.system.mapper; - -import org.apache.ibatis.annotations.Param; -import top.wms.admin.system.model.entity.NoticeDO; -import top.wms.admin.system.model.resp.dashboard.DashboardNoticeResp; -import top.continew.starter.data.mp.base.BaseMapper; - -import java.util.List; - -/** - * 公告 Mapper - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -public interface NoticeMapper extends BaseMapper { - - /** - * 查询仪表盘公告列表 - * - * @param userId 用户 ID - * @return 仪表盘公告列表 - */ - List selectDashboardList(@Param("userId") Long userId); -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/entity/MessageDO.java b/wms-module-system/src/main/java/top/wms/admin/system/model/entity/MessageDO.java deleted file mode 100644 index f014dfc..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/entity/MessageDO.java +++ /dev/null @@ -1,59 +0,0 @@ -package top.wms.admin.system.model.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import top.wms.admin.system.enums.MessageTypeEnum; - -import java.io.Serial; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 消息实体 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -@Data -@TableName("sys_message") -public class MessageDO implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @TableId - private Long id; - - /** - * 标题 - */ - private String title; - - /** - * 内容 - */ - private String content; - - /** - * 类型(1:系统消息) - */ - private MessageTypeEnum type; - - /** - * 创建人 - */ - @TableField(fill = FieldFill.INSERT) - private Long createUser; - - /** - * 创建时间 - */ - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createTime; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/entity/MessageUserDO.java b/wms-module-system/src/main/java/top/wms/admin/system/model/entity/MessageUserDO.java deleted file mode 100644 index deaf8fd..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/entity/MessageUserDO.java +++ /dev/null @@ -1,42 +0,0 @@ -package top.wms.admin.system.model.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serial; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 消息和用户关联实体 - * - * @author Bull-BCLS - * @since 2023/10/15 20:25 - */ -@Data -@TableName("sys_message_user") -public class MessageUserDO implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 消息 ID - */ - private Long messageId; - - /** - * 用户 ID - */ - private Long userId; - - /** - * 是否已读 - */ - private Boolean isRead; - - /** - * 读取时间 - */ - private LocalDateTime readTime; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/entity/NoticeDO.java b/wms-module-system/src/main/java/top/wms/admin/system/model/entity/NoticeDO.java deleted file mode 100644 index 3f34686..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/entity/NoticeDO.java +++ /dev/null @@ -1,62 +0,0 @@ -package top.wms.admin.system.model.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import lombok.Data; -import top.wms.admin.common.model.entity.BaseDO; -import top.wms.admin.system.enums.NoticeScopeEnum; - -import java.io.Serial; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 公告实体 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -@Data -@TableName(value = "sys_notice", autoResultMap = true) -public class NoticeDO extends BaseDO { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 标题 - */ - private String title; - - /** - * 内容 - */ - private String content; - - /** - * 类型 - */ - private String type; - - /** - * 生效时间 - */ - private LocalDateTime effectiveTime; - - /** - * 终止时间 - */ - private LocalDateTime terminateTime; - - /** - * 通知范围 - */ - private NoticeScopeEnum noticeScope; - - /** - * 通知用户 - */ - @TableField(typeHandler = JacksonTypeHandler.class) - private List noticeUsers; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/query/MessageQuery.java b/wms-module-system/src/main/java/top/wms/admin/system/model/query/MessageQuery.java deleted file mode 100644 index 250e09f..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/query/MessageQuery.java +++ /dev/null @@ -1,58 +0,0 @@ -package top.wms.admin.system.model.query; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.wms.admin.system.enums.MessageTypeEnum; -import top.continew.starter.data.core.annotation.Query; -import top.continew.starter.data.core.annotation.QueryIgnore; -import top.continew.starter.data.core.enums.QueryType; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 消息查询条件 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -@Data -@Schema(description = "消息查询条件") -public class MessageQuery implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @Schema(description = "ID", example = "1") - private Long id; - - /** - * 标题 - */ - @Schema(description = "标题", example = "欢迎注册 xxx") - @Query(type = QueryType.LIKE) - private String title; - - /** - * 类型 - */ - @Schema(description = "类型", example = "1") - private MessageTypeEnum type; - - /** - * 是否已读 - */ - @Schema(description = "是否已读", example = "true") - @QueryIgnore - private Boolean isRead; - - /** - * 用户 ID - */ - @Schema(hidden = true) - @QueryIgnore - private Long userId; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/query/NoticeQuery.java b/wms-module-system/src/main/java/top/wms/admin/system/model/query/NoticeQuery.java deleted file mode 100644 index 02ae6e7..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/query/NoticeQuery.java +++ /dev/null @@ -1,36 +0,0 @@ -package top.wms.admin.system.model.query; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.continew.starter.data.core.annotation.Query; -import top.continew.starter.data.core.enums.QueryType; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 公告查询条件 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -@Data -@Schema(description = "公告查询条件") -public class NoticeQuery implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 标题 - */ - @Schema(description = "标题", example = "这是公告标题") - @Query(type = QueryType.LIKE) - private String title; - - /** - * 类型 - */ - @Schema(description = "类型", example = "1") - private String type; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/req/MessageReq.java b/wms-module-system/src/main/java/top/wms/admin/system/model/req/MessageReq.java deleted file mode 100644 index ded4501..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/req/MessageReq.java +++ /dev/null @@ -1,48 +0,0 @@ -package top.wms.admin.system.model.req; - -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import lombok.Data; -import org.hibernate.validator.constraints.Length; -import top.wms.admin.system.enums.MessageTypeEnum; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 创建消息参数 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -@Data -@Schema(description = "创建消息参数") -public class MessageReq implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 标题 - */ - @Schema(description = "标题", example = "欢迎注册 xxx") - @NotBlank(message = "标题不能为空") - @Length(max = 50, message = "标题长度不能超过 {max} 个字符") - private String title; - - /** - * 内容 - */ - @Schema(description = "内容", example = "尊敬的 xx,欢迎注册使用,请及时配置您的密码。") - @NotBlank(message = "内容不能为空") - @Length(max = 255, message = "内容长度不能超过 {max} 个字符") - private String content; - - /** - * 类型 - */ - @Schema(description = "类型(1:系统消息)", example = "1") - @NotNull(message = "类型非法") - private MessageTypeEnum type; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/req/NoticeReq.java b/wms-module-system/src/main/java/top/wms/admin/system/model/req/NoticeReq.java deleted file mode 100644 index 0565fbe..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/req/NoticeReq.java +++ /dev/null @@ -1,77 +0,0 @@ -package top.wms.admin.system.model.req; - -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.Future; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import lombok.Data; -import org.hibernate.validator.constraints.Length; -import top.wms.admin.system.enums.NoticeScopeEnum; - -import java.io.Serial; -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 创建或修改公告参数 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -@Data -@Schema(description = "创建或修改公告参数") -public class NoticeReq implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 标题 - */ - @Schema(description = "标题", example = "这是公告标题") - @NotBlank(message = "标题不能为空") - @Length(max = 150, message = "标题长度不能超过 {max} 个字符") - private String title; - - /** - * 内容 - */ - @Schema(description = "内容", example = "这是公告内容") - @NotBlank(message = "内容不能为空") - private String content; - - /** - * 类型(取值于字典 notice_type) - */ - @Schema(description = "类型(取值于字典 notice_type)", example = "1") - @NotBlank(message = "类型不能为空") - @Length(max = 30, message = "类型长度不能超过 {max} 个字符") - private String type; - - /** - * 生效时间 - */ - @Schema(description = "生效时间", example = "2023-08-08 00:00:00", type = "string") - private LocalDateTime effectiveTime; - - /** - * 终止时间 - */ - @Schema(description = "终止时间", example = "2023-08-08 23:59:59", type = "string") - @Future(message = "终止时间必须是未来时间") - private LocalDateTime terminateTime; - - /** - * 通知范围 - */ - @Schema(description = "通知范围", example = "2") - @NotNull(message = "通知范围不能为空") - private NoticeScopeEnum noticeScope; - - /** - * 指定用户 - */ - @Schema(description = "指定用户", example = "[1,2,3]") - private List noticeUsers; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/NoticeDetailResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/NoticeDetailResp.java deleted file mode 100644 index 451127f..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/NoticeDetailResp.java +++ /dev/null @@ -1,74 +0,0 @@ -package top.wms.admin.system.model.resp; - -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; -import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.wms.admin.common.model.resp.BaseDetailResp; -import top.wms.admin.system.enums.NoticeScopeEnum; - -import java.io.Serial; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 公告详情信息 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -@Data -@ExcelIgnoreUnannotated -@Schema(description = "公告详情信息") -public class NoticeDetailResp extends BaseDetailResp { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 标题 - */ - @Schema(description = "标题", example = "这是公告标题") - @ExcelProperty(value = "标题") - private String title; - - /** - * 内容 - */ - @Schema(description = "内容", example = "这是公告内容") - @ExcelProperty(value = "内容") - private String content; - - /** - * 类型(取值于字典 notice_type) - */ - @Schema(description = "类型(取值于字典 notice_type)", example = "1") - @ExcelProperty(value = "类型") - private String type; - - /** - * 生效时间 - */ - @Schema(description = "生效时间", example = "2023-08-08 00:00:00", type = "string") - @ExcelProperty(value = "生效时间") - private LocalDateTime effectiveTime; - - /** - * 终止时间 - */ - @Schema(description = "终止时间", example = "2023-08-08 23:59:59", type = "string") - @ExcelProperty(value = "终止时间") - private LocalDateTime terminateTime; - - /** - * 通知范围 - */ - @Schema(description = "通知范围", example = "2") - private NoticeScopeEnum noticeScope; - - /** - * 指定用户 - */ - @Schema(description = "指定用户", example = "[1,2,3]") - private List noticeUsers; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/NoticeResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/NoticeResp.java deleted file mode 100644 index 0920f80..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/NoticeResp.java +++ /dev/null @@ -1,71 +0,0 @@ -package top.wms.admin.system.model.resp; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.wms.admin.common.model.resp.BaseResp; -import top.wms.admin.system.enums.NoticeScopeEnum; -import top.wms.admin.system.enums.NoticeStatusEnum; - -import java.io.Serial; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 公告信息 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -@Data -@Schema(description = "公告信息") -public class NoticeResp extends BaseResp { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 标题 - */ - @Schema(description = "标题", example = "这是公告标题") - private String title; - - /** - * 类型(取值于字典 notice_type) - */ - @Schema(description = "类型(取值于字典 notice_type)", example = "1") - private String type; - - /** - * 生效时间 - */ - @Schema(description = "生效时间", example = "2023-08-08 00:00:00", type = "string") - private LocalDateTime effectiveTime; - - /** - * 终止时间 - */ - @Schema(description = "终止时间", example = "2023-08-08 23:59:59", type = "string") - private LocalDateTime terminateTime; - - /** - * 状态 - * - * @return 公告状态 - */ - @Schema(description = "状态", example = "1") - public NoticeStatusEnum getStatus() { - return NoticeStatusEnum.getStatus(effectiveTime, terminateTime); - } - - /** - * 通知范围 - */ - @Schema(description = "通知范围(1.所有人 2.指定用户)", example = "1") - private NoticeScopeEnum noticeScope; - - /** - * 指定用户 - */ - @Schema(description = "指定用户", example = "[1,2,3]") - private List noticeUsers; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardAccessTrendResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardAccessTrendResp.java deleted file mode 100644 index 61eb5bf..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardAccessTrendResp.java +++ /dev/null @@ -1,43 +0,0 @@ -package top.wms.admin.system.model.resp.dashboard; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 仪表盘-访问趋势信息 - * - * @author Charles7c - * @since 2023/9/9 20:20 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Schema(description = "仪表盘-访问趋势信息") -public class DashboardAccessTrendResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 日期 - */ - @Schema(description = "日期", example = "2023-08-08") - private String date; - - /** - * 浏览量(PV) - */ - @Schema(description = "浏览量(PV)", example = "1000") - private Long pvCount; - - /** - * IP 数 - */ - @Schema(description = "IP 数", example = "500") - private Long ipCount; -} diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardChartCommonResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardChartCommonResp.java deleted file mode 100644 index 558b733..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardChartCommonResp.java +++ /dev/null @@ -1,37 +0,0 @@ -package top.wms.admin.system.model.resp.dashboard; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 仪表盘-通用图表信息 - * - * @author Charles7c - * @since 2024/10/17 21:37 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Schema(description = "仪表盘-通用图表信息") -public class DashboardChartCommonResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @Schema(description = "名称", example = "Windows 10") - private String name; - - /** - * 数量 - */ - @Schema(description = "数量", example = "1234") - private Long value; -} diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardNoticeResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardNoticeResp.java deleted file mode 100644 index 63007a5..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardNoticeResp.java +++ /dev/null @@ -1,39 +0,0 @@ -package top.wms.admin.system.model.resp.dashboard; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 仪表盘-公告信息 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -@Data -@Schema(description = "仪表盘-公告信息") -public class DashboardNoticeResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @Schema(description = "ID", example = "1") - private Long id; - - /** - * 标题 - */ - @Schema(description = "标题", example = "这是公告标题") - private String title; - - /** - * 类型(取值于字典 notice_type) - */ - @Schema(description = "类型(取值于字典 notice_type)", example = "1") - private String type; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardOverviewCommonResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardOverviewCommonResp.java deleted file mode 100644 index 2572488..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardOverviewCommonResp.java +++ /dev/null @@ -1,58 +0,0 @@ -package top.wms.admin.system.model.resp.dashboard; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serial; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** - * 仪表盘-通用总览信息 - * - * @author Charles7c - * @since 2024/10/19 12:19 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Schema(description = "仪表盘-通用总览信息") -public class DashboardOverviewCommonResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 总数 - */ - @Schema(description = "总数", example = "888888") - private Long total; - - /** - * 今日数量 - */ - @Schema(description = "今日数量", example = "888") - private Long today; - - /** - * 较昨日新增(百分比) - */ - @Schema(description = "较昨日新增(百分比)", example = "23.4") - private BigDecimal growth; - - /** - * 图表数据 - */ - @Schema(description = "图表数据") - private List dataList; - - /** - * 昨日数量 - */ - @JsonIgnore - private Long yesterday; -} diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardTotalResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardTotalResp.java deleted file mode 100644 index f3eddb3..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/dashboard/DashboardTotalResp.java +++ /dev/null @@ -1,53 +0,0 @@ -package top.wms.admin.system.model.resp.dashboard; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serial; -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 仪表盘-总计信息 - * - * @author Charles7c - * @since 2023/9/8 21:32 - */ -@Data -@Schema(description = "仪表盘-总计信息") -public class DashboardTotalResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 浏览量(PV) - */ - @Schema(description = "浏览量(PV)", example = "88888") - private Long pvCount; - - /** - * IP 数 - */ - @Schema(description = "IP 数", example = "66666") - private Long ipCount; - - /** - * 今日浏览量(PV) - */ - @Schema(description = "今日浏览量(PV)", example = "1234") - private Long todayPvCount; - - /** - * 较昨日新增 PV(百分比) - */ - @Schema(description = "较昨日新增(百分比)", example = "23.4") - private BigDecimal newPvFromYesterday; - - /** - * 昨日浏览量(PV) - */ - @JsonIgnore - private Long yesterdayPvCount; -} diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageResp.java deleted file mode 100644 index 2c93309..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageResp.java +++ /dev/null @@ -1,81 +0,0 @@ -package top.wms.admin.system.model.resp.message; - -import cn.crane4j.annotation.Assemble; -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.wms.admin.common.constant.ContainerConstants; -import top.wms.admin.system.enums.MessageTypeEnum; - -import java.io.Serial; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 消息信息 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -@Data -@Schema(description = "消息信息") -public class MessageResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @Schema(description = "ID", example = "1") - private Long id; - - /** - * 标题 - */ - @Schema(description = "标题", example = "欢迎注册 xxx") - private String title; - - /** - * 内容 - */ - @Schema(description = "内容", example = "尊敬的 xx,欢迎注册使用,请及时配置您的密码。") - private String content; - - /** - * 类型 - */ - @Schema(description = "类型(1:系统消息)", example = "1") - private MessageTypeEnum type; - - /** - * 是否已读 - */ - @Schema(description = "是否已读", example = "true") - private Boolean isRead; - - /** - * 读取时间 - */ - @Schema(description = "读取时间", example = "2023-08-08 23:59:59", type = "string") - private LocalDateTime readTime; - - /** - * 创建人 - */ - @JsonIgnore - @Assemble(prop = ":createUserString", container = ContainerConstants.USER_NICKNAME) - private Long createUser; - - /** - * 创建人 - */ - @Schema(description = "创建人", example = "超级管理员") - private String createUserString; - - /** - * 创建时间 - */ - @Schema(description = "创建时间", example = "2023-08-08 08:08:08", type = "string") - private LocalDateTime createTime; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageTypeUnreadResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageTypeUnreadResp.java deleted file mode 100644 index d69281c..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageTypeUnreadResp.java +++ /dev/null @@ -1,34 +0,0 @@ -package top.wms.admin.system.model.resp.message; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.wms.admin.system.enums.MessageTypeEnum; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 各类型未读消息信息 - * - * @author Charles7c - * @since 2023/11/2 23:00 - */ -@Data -@Schema(description = "各类型未读消息信息") -public class MessageTypeUnreadResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 类型 - */ - @Schema(description = "类型(1:系统消息)", example = "1") - private MessageTypeEnum type; - - /** - * 数量 - */ - @Schema(description = "数量", example = "10") - private Long count; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageUnreadResp.java b/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageUnreadResp.java deleted file mode 100644 index f8091c5..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/model/resp/message/MessageUnreadResp.java +++ /dev/null @@ -1,36 +0,0 @@ -package top.wms.admin.system.model.resp.message; - -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serial; -import java.io.Serializable; -import java.util.List; - -/** - * 未读消息信息 - * - * @author Charles7c - * @since 2023/11/2 23:00 - */ -@Data -@Schema(description = "未读消息信息") -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class MessageUnreadResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 未读消息数量 - */ - @Schema(description = "未读消息数量", example = "20") - private Long total; - - /** - * 各类型未读消息数量 - */ - @Schema(description = "各类型未读消息数量") - private List details; -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/DashboardService.java b/wms-module-system/src/main/java/top/wms/admin/system/service/DashboardService.java deleted file mode 100644 index ee84518..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/DashboardService.java +++ /dev/null @@ -1,83 +0,0 @@ -package top.wms.admin.system.service; - -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 java.io.IOException; -import java.util.List; - -/** - * 仪表盘业务接口 - * - * @author Charles7c - * @since 2023/9/8 21:32 - */ -public interface DashboardService { - - /** - * 查询公告列表 - * - * @return 公告列表 - */ - List listNotice(); - - /** - * 查询 PV 总览 - * - * @return PV 总览 - */ - DashboardOverviewCommonResp getOverviewPv(); - - /** - * 查询 IP 总览 - * - * @return IP 总览 - */ - DashboardOverviewCommonResp getOverviewIp(); - - /** - * 查询地域分析信息 - * - * @return 地域分析信息 - * @throws IOException / - */ - List getAnalysisGeo() throws IOException; - - /** - * 查询访问趋势信息 - * - * @param days 日期数 - * @return 访问趋势信息 - */ - List listAccessTrend(Integer days); - - /** - * 查询访问时段分析信息 - * - * @return 访问时段分析信息 - */ - List getAnalysisTimeslot(); - - /** - * 查询模块分析信息 - * - * @return 模块分析信息 - */ - List getAnalysisModule(); - - /** - * 查询终端分析信息 - * - * @return 终端分析信息 - */ - List getAnalysisOs(); - - /** - * 查询浏览器分析信息 - * - * @return 浏览器分析信息 - */ - List getAnalysisBrowser(); -} diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/MessageService.java b/wms-module-system/src/main/java/top/wms/admin/system/service/MessageService.java deleted file mode 100644 index c4cb819..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/MessageService.java +++ /dev/null @@ -1,42 +0,0 @@ -package top.wms.admin.system.service; - -import top.wms.admin.system.model.query.MessageQuery; -import top.wms.admin.system.model.req.MessageReq; -import top.wms.admin.system.model.resp.message.MessageResp; -import top.continew.starter.extension.crud.model.query.PageQuery; -import top.continew.starter.extension.crud.model.resp.PageResp; - -import java.util.List; - -/** - * 消息业务接口 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -public interface MessageService { - - /** - * 分页查询列表 - * - * @param query 查询条件 - * @param pageQuery 分页查询条件 - * @return 分页列表信息 - */ - PageResp page(MessageQuery query, PageQuery pageQuery); - - /** - * 新增 - * - * @param req 新增信息 - * @param userIdList 接收人列表 - */ - void add(MessageReq req, List userIdList); - - /** - * 删除 - * - * @param ids ID 列表 - */ - void delete(List ids); -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/MessageUserService.java b/wms-module-system/src/main/java/top/wms/admin/system/service/MessageUserService.java deleted file mode 100644 index b6e5e1c..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/MessageUserService.java +++ /dev/null @@ -1,45 +0,0 @@ -package top.wms.admin.system.service; - -import top.wms.admin.system.model.resp.message.MessageUnreadResp; - -import java.util.List; - -/** - * 消息和用户关联业务接口 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -public interface MessageUserService { - - /** - * 根据用户 ID 查询未读消息数量 - * - * @param userId 用户 ID - * @param isDetail 是否查询详情 - * @return 未读消息信息 - */ - MessageUnreadResp countUnreadMessageByUserId(Long userId, Boolean isDetail); - - /** - * 新增 - * - * @param messageId 消息 ID - * @param userIdList 用户 ID 列表 - */ - void add(Long messageId, List userIdList); - - /** - * 将消息标记已读 - * - * @param ids 消息ID(为空则将所有消息标记已读) - */ - void readMessage(List ids); - - /** - * 根据消息 ID 删除 - * - * @param messageIds 消息 ID 列表 - */ - void deleteByMessageIds(List messageIds); -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/NoticeService.java b/wms-module-system/src/main/java/top/wms/admin/system/service/NoticeService.java deleted file mode 100644 index cd2171c..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/NoticeService.java +++ /dev/null @@ -1,28 +0,0 @@ -package top.wms.admin.system.service; - -import top.wms.admin.system.model.entity.NoticeDO; -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.model.resp.dashboard.DashboardNoticeResp; -import top.continew.starter.data.mp.service.IService; -import top.continew.starter.extension.crud.service.BaseService; - -import java.util.List; - -/** - * 公告业务接口 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -public interface NoticeService extends BaseService, IService { - - /** - * 查询仪表盘公告列表 - * - * @return 仪表盘公告列表 - */ - List listDashboard(); -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/UserService.java b/wms-module-system/src/main/java/top/wms/admin/system/service/UserService.java index 5f2b305..5e43cc7 100644 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/UserService.java +++ b/wms-module-system/src/main/java/top/wms/admin/system/service/UserService.java @@ -132,6 +132,14 @@ public interface UserService extends BaseService listNotice() { - return noticeService.listDashboard(); - } - - @Override - public DashboardOverviewCommonResp getOverviewPv() { - DashboardOverviewCommonResp resp = logMapper.selectDashboardOverviewPv(); - resp.setGrowth(this.calcGrowthFromYesterday(resp.getToday(), resp.getYesterday())); - List last12MonthList = this.getLast12Months(); - List dataList = logMapper.selectListDashboardAnalysisPv(last12MonthList); - if (dataList.size() < 12) { - // 填充缺失的数据 - this.fillMissingDateData(last12MonthList, dataList); - } - resp.setDataList(dataList); - return resp; - } - - @Override - public DashboardOverviewCommonResp getOverviewIp() { - DashboardOverviewCommonResp resp = logMapper.selectDashboardOverviewIp(); - resp.setGrowth(this.calcGrowthFromYesterday(resp.getToday(), resp.getYesterday())); - List last12MonthList = this.getLast12Months(); - List dataList = logMapper.selectListDashboardAnalysisIp(last12MonthList); - if (dataList.size() < 12) { - // 填充缺失的数据 - this.fillMissingDateData(last12MonthList, dataList); - } - resp.setDataList(dataList); - return resp; - } - - @Override - public List getAnalysisGeo() throws IOException { - List originList = logMapper.selectListDashboardAnalysisGeo(); - List list = new ArrayList<>(34); - // 获取省份数据 - String chinaJson = IoUtil.readUtf8(new ClassPathResource("china.json").getInputStream()); - JSONArray jsonArr = JSONUtil.parseObj(chinaJson).getJSONArray("children"); - List provinceList = jsonArr.stream().map(item -> { - JSONObject itemJsonObj = JSONUtil.parseObj(item); - return "%s:%s".formatted(itemJsonObj.getStr("name"), itemJsonObj.getStr("fullname")); - }).toList(); - // 汇总各省份访问数据 - for (String province : provinceList) { - String[] split = province.split(StringConstants.COLON); - String name = split[0]; - String fullName = split[1]; - long sum = originList.stream() - .filter(item -> item.getName().contains(name)) - .mapToLong(DashboardChartCommonResp::getValue) - .sum(); - list.add(new DashboardChartCommonResp(fullName, sum)); - } - return list; - } - - @Override - public List listAccessTrend(Integer days) { - DateTime currentDate = DateUtil.date(); - Date startTime = DateUtil.beginOfDay(DateUtil.offsetDay(currentDate, -days)).toJdkDate(); - Date endTime = DateUtil.endOfDay(DateUtil.offsetDay(currentDate, -1)).toJdkDate(); - List list = logMapper.selectListDashboardAccessTrend(startTime, endTime); - if (list.size() < days) { - List all = DateUtil.rangeToList(startTime, endTime, DateField.DAY_OF_MONTH) - .stream() - .map(date -> date.toString(DatePattern.NORM_DATE_FORMAT)) - .toList(); - Collection missings = CollUtil.disjunction(all, list.stream() - .map(DashboardAccessTrendResp::getDate) - .toList()); - list.addAll(missings.stream().map(missing -> new DashboardAccessTrendResp(missing, 0L, 0L)).toList()); - list.sort(Comparator.comparing(DashboardAccessTrendResp::getDate)); - } - return list; - } - - @Override - public List getAnalysisTimeslot() { - List list = logMapper.selectListDashboardAnalysisTimeslot(); - if (list.size() < 12) { - // 获取所有时间段 - List allTimeSlotList = new ArrayList<>(12); - for (int hour = 0; hour < 24; hour += 2) { - allTimeSlotList.add(String.format("%02d:00", hour)); - } - // 填充缺失的数据 - this.fillMissingDateData(allTimeSlotList, list); - } - return list; - } - - @Override - public List getAnalysisModule() { - return logMapper.selectListDashboardAnalysisModule(10); - } - - @Override - public List getAnalysisOs() { - List list = logMapper.selectListDashboardAnalysisOs(4); - return this.buildOtherPieChartData(list); - } - - @Override - public List getAnalysisBrowser() { - List list = logMapper.selectListDashboardAnalysisBrowser(4); - return this.buildOtherPieChartData(list); - } - - /** - * 计算增长百分比 - * - * @param today 今日数量 - * @param yesterday 昨日数量 - * @return 增长百分比 - */ - private BigDecimal calcGrowthFromYesterday(Long today, Long yesterday) { - return (0 == yesterday) - ? BigDecimal.valueOf(100) - : NumberUtil.round(NumberUtil.mul(NumberUtil.div(NumberUtil.sub(today, yesterday), yesterday), 100), 1); - } - - /** - * 构建其他饼图数据 - * - * @param list 饼图数据列表 - * @return 饼图数据列表 - */ - private List buildOtherPieChartData(List list) { - Long totalCount = logMapper.selectTotalCount(); - long sumCount = list.stream().mapToLong(DashboardChartCommonResp::getValue).sum(); - if (sumCount < totalCount) { - list.add(new DashboardChartCommonResp("其他", totalCount - sumCount)); - } - return list; - } - - /** - * 填充缺失时间段的数据 - * - * @param all 所有时间段 - * @param list 待填充数据 - */ - private void fillMissingDateData(List all, List list) { - Collection missings = CollUtil.disjunction(all, list.stream() - .map(DashboardChartCommonResp::getName) - .toList()); - list.addAll(missings.stream().map(missing -> new DashboardChartCommonResp(missing, 0L)).toList()); - list.sort(Comparator.comparing(DashboardChartCommonResp::getName)); - } - - /** - * 获取最近12个月的月份列表 - * - * @return 月份列表 - */ - private List getLast12Months() { - DateTime currentMonth = DateUtil.beginOfMonth(DateUtil.date()); - return DateUtil.rangeToList(DateUtil.offsetMonth(currentMonth, -12), DateUtil - .offsetMonth(currentMonth, -1), DateField.MONTH) - .stream() - .map(dateTime -> DateUtil.format(dateTime, DatePattern.NORM_MONTH_FORMAT)) - .toList(); - } -} diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/MessageServiceImpl.java b/wms-module-system/src/main/java/top/wms/admin/system/service/impl/MessageServiceImpl.java deleted file mode 100644 index 51ffbe8..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/MessageServiceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package top.wms.admin.system.service.impl; - -import cn.crane4j.annotation.AutoOperate; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import top.wms.admin.system.mapper.MessageMapper; -import top.wms.admin.system.model.entity.MessageDO; -import top.wms.admin.system.model.query.MessageQuery; -import top.wms.admin.system.model.req.MessageReq; -import top.wms.admin.system.model.resp.message.MessageResp; -import top.wms.admin.system.service.MessageService; -import top.wms.admin.system.service.MessageUserService; -import top.continew.starter.core.validation.CheckUtils; -import top.continew.starter.data.mp.util.QueryWrapperHelper; -import top.continew.starter.extension.crud.model.query.PageQuery; -import top.continew.starter.extension.crud.model.resp.PageResp; - -import java.util.List; - -/** - * 消息业务实现 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -@Service -@RequiredArgsConstructor -public class MessageServiceImpl implements MessageService { - - private final MessageMapper baseMapper; - private final MessageUserService messageUserService; - - @Override - @AutoOperate(type = MessageResp.class, on = "list") - public PageResp page(MessageQuery query, PageQuery pageQuery) { - QueryWrapper queryWrapper = QueryWrapperHelper.build(query, pageQuery.getSort()); - queryWrapper.apply(null != query.getUserId(), "t2.user_id={0}", query.getUserId()) - .apply(null != query.getIsRead(), "t2.is_read={0}", query.getIsRead()); - IPage page = baseMapper.selectPageByUserId(new Page<>(pageQuery.getPage(), pageQuery - .getSize()), queryWrapper); - return PageResp.build(page); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void add(MessageReq req, List userIdList) { - CheckUtils.throwIf(() -> CollUtil.isEmpty(userIdList), "消息接收人不能为空"); - MessageDO message = BeanUtil.copyProperties(req, MessageDO.class); - baseMapper.insert(message); - messageUserService.add(message.getId(), userIdList); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(List ids) { - baseMapper.deleteByIds(ids); - messageUserService.deleteByMessageIds(ids); - } -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/MessageUserServiceImpl.java b/wms-module-system/src/main/java/top/wms/admin/system/service/impl/MessageUserServiceImpl.java deleted file mode 100644 index 5119955..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/MessageUserServiceImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -package top.wms.admin.system.service.impl; - -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import top.wms.admin.system.enums.MessageTypeEnum; -import top.wms.admin.system.mapper.MessageUserMapper; -import top.wms.admin.system.model.entity.MessageUserDO; -import top.wms.admin.system.model.resp.message.MessageTypeUnreadResp; -import top.wms.admin.system.model.resp.message.MessageUnreadResp; -import top.wms.admin.system.service.MessageUserService; -import top.continew.starter.core.validation.CheckUtils; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; - -/** - * 消息和用户关联业务实现 - * - * @author Bull-BCLS - * @since 2023/10/15 19:05 - */ -@Service -@RequiredArgsConstructor -public class MessageUserServiceImpl implements MessageUserService { - - private final MessageUserMapper baseMapper; - - @Override - public MessageUnreadResp countUnreadMessageByUserId(Long userId, Boolean isDetail) { - MessageUnreadResp result = new MessageUnreadResp(); - Long total = 0L; - if (Boolean.TRUE.equals(isDetail)) { - List detailList = new ArrayList<>(); - for (MessageTypeEnum messageType : MessageTypeEnum.values()) { - MessageTypeUnreadResp resp = new MessageTypeUnreadResp(); - resp.setType(messageType); - Long count = baseMapper.selectUnreadCountByUserIdAndType(userId, messageType.getValue()); - resp.setCount(count); - detailList.add(resp); - total += count; - } - result.setDetails(detailList); - } else { - total = baseMapper.selectUnreadCountByUserIdAndType(userId, null); - } - result.setTotal(total); - return result; - } - - @Override - public void add(Long messageId, List userIdList) { - CheckUtils.throwIfEmpty(userIdList, "消息接收人不能为空"); - List messageUserList = userIdList.stream().map(userId -> { - MessageUserDO messageUser = new MessageUserDO(); - messageUser.setUserId(userId); - messageUser.setMessageId(messageId); - messageUser.setIsRead(false); - return messageUser; - }).toList(); - baseMapper.insert(messageUserList); - } - - @Override - public void readMessage(List ids) { - if (CollUtil.isEmpty(ids)) { - return; - } - baseMapper.lambdaUpdate() - .set(MessageUserDO::getIsRead, true) - .set(MessageUserDO::getReadTime, LocalDateTime.now()) - .eq(MessageUserDO::getIsRead, false) - .in(CollUtil.isNotEmpty(ids), MessageUserDO::getMessageId, ids) - .update(); - } - - @Override - public void deleteByMessageIds(List messageIds) { - if (CollUtil.isEmpty(messageIds)) { - return; - } - baseMapper.lambdaUpdate().in(MessageUserDO::getMessageId, messageIds).remove(); - } -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/NoticeServiceImpl.java b/wms-module-system/src/main/java/top/wms/admin/system/service/impl/NoticeServiceImpl.java deleted file mode 100644 index e60a13e..0000000 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/NoticeServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package top.wms.admin.system.service.impl; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import top.wms.admin.common.context.UserContextHolder; -import top.wms.admin.system.mapper.NoticeMapper; -import top.wms.admin.system.model.entity.NoticeDO; -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.model.resp.dashboard.DashboardNoticeResp; -import top.wms.admin.system.service.NoticeService; -import top.continew.starter.extension.crud.service.BaseServiceImpl; - -import java.util.List; - -/** - * 公告业务实现 - * - * @author Charles7c - * @since 2023/8/20 10:55 - */ -@Service -@RequiredArgsConstructor -public class NoticeServiceImpl extends BaseServiceImpl implements NoticeService { - - @Override - public List listDashboard() { - Long userId = UserContextHolder.isAdmin() ? null : UserContextHolder.getUserId(); - return baseMapper.selectDashboardList(userId); - } -} \ No newline at end of file diff --git a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/UserServiceImpl.java b/wms-module-system/src/main/java/top/wms/admin/system/service/impl/UserServiceImpl.java index 607645f..77bfd3c 100644 --- a/wms-module-system/src/main/java/top/wms/admin/system/service/impl/UserServiceImpl.java +++ b/wms-module-system/src/main/java/top/wms/admin/system/service/impl/UserServiceImpl.java @@ -459,6 +459,11 @@ public class UserServiceImpl extends BaseServiceImpl().eq("card_no", card)); + } + @Override public Long countByDeptIds(List deptIds) { return 0L; diff --git a/wms-module-system/src/main/java/top/wms/admin/weighManage/model/resp/MaterialResp.java b/wms-module-system/src/main/java/top/wms/admin/weighManage/model/resp/MaterialResp.java new file mode 100644 index 0000000..bcff365 --- /dev/null +++ b/wms-module-system/src/main/java/top/wms/admin/weighManage/model/resp/MaterialResp.java @@ -0,0 +1,15 @@ +package top.wms.admin.weighManage.model.resp; + + +import lombok.Data; + +@Data +public class MaterialResp { + private Long id; + private String materialCode; + private String materialName; + private String materialSpec; + private String weight; + private String imageUrl; + +} diff --git a/wms-module-system/src/main/resources/mapper/LogMapper.xml b/wms-module-system/src/main/resources/mapper/LogMapper.xml index 045d9c1..4b64a30 100644 --- a/wms-module-system/src/main/resources/mapper/LogMapper.xml +++ b/wms-module-system/src/main/resources/mapper/LogMapper.xml @@ -41,115 +41,4 @@ ${ew.customSqlSegment} - - - - - - - - - - - - - - - - - - - diff --git a/wms-module-system/src/main/resources/mapper/MessageMapper.xml b/wms-module-system/src/main/resources/mapper/MessageMapper.xml deleted file mode 100644 index b3ec9a3..0000000 --- a/wms-module-system/src/main/resources/mapper/MessageMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/wms-module-system/src/main/resources/mapper/MessageUserMapper.xml b/wms-module-system/src/main/resources/mapper/MessageUserMapper.xml deleted file mode 100644 index 92d0ba2..0000000 --- a/wms-module-system/src/main/resources/mapper/MessageUserMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/wms-module-system/src/main/resources/mapper/NoticeMapper.xml b/wms-module-system/src/main/resources/mapper/NoticeMapper.xml deleted file mode 100644 index 34f80f7..0000000 --- a/wms-module-system/src/main/resources/mapper/NoticeMapper.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java b/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java index c2b1268..c3c01dc 100644 --- a/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java +++ b/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java @@ -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; diff --git a/wms-webapi/src/main/java/top/wms/admin/controller/WeighManage/WeighController.java b/wms-webapi/src/main/java/top/wms/admin/controller/WeighManage/WeighController.java new file mode 100644 index 0000000..ee12868 --- /dev/null +++ b/wms-webapi/src/main/java/top/wms/admin/controller/WeighManage/WeighController.java @@ -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; + } + +} \ No newline at end of file diff --git a/wms-webapi/src/main/java/top/wms/admin/controller/common/DashboardController.java b/wms-webapi/src/main/java/top/wms/admin/controller/common/DashboardController.java deleted file mode 100644 index d8367b1..0000000 --- a/wms-webapi/src/main/java/top/wms/admin/controller/common/DashboardController.java +++ /dev/null @@ -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 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 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 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 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 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 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 getAnalysisBrowser() { - return dashboardService.getAnalysisBrowser(); - } -} diff --git a/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java b/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java index ffdcea2..1ec95cf 100644 --- a/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java +++ b/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java @@ -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() diff --git a/wms-webapi/src/main/java/top/wms/admin/controller/system/MessageController.java b/wms-webapi/src/main/java/top/wms/admin/controller/system/MessageController.java deleted file mode 100644 index 5deb90d..0000000 --- a/wms-webapi/src/main/java/top/wms/admin/controller/system/MessageController.java +++ /dev/null @@ -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 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 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 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); - } -} \ No newline at end of file diff --git a/wms-webapi/src/main/java/top/wms/admin/controller/system/NoticeController.java b/wms-webapi/src/main/java/top/wms/admin/controller/system/NoticeController.java deleted file mode 100644 index c94c9cb..0000000 --- a/wms-webapi/src/main/java/top/wms/admin/controller/system/NoticeController.java +++ /dev/null @@ -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 { - - @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(), "通知用户不能为空"); - } - } -} \ No newline at end of file