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 4a94318..c708a85 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,7 +13,6 @@ 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; @@ -106,7 +105,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(), "此账号所属部门已被禁用,如有疑问,请联系管理员"); + // 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/handler/CardLoginHandler.java b/wms-module-system/src/main/java/top/wms/admin/auth/handler/CardLoginHandler.java index 3847914..745fa3a 100644 --- 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 @@ -1,24 +1,23 @@ package top.wms.admin.auth.handler; import jakarta.servlet.http.HttpServletRequest; -import top.continew.starter.cache.redisson.util.RedisUtils; +import org.springframework.stereotype.Component; 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 { +@Component +public class CardLoginHandler extends AbstractLoginHandler { @Override public LoginResp login(CardLoginReq req, ClientResp client, HttpServletRequest request) { // 验证手机号 UserDO user = userService.getByCard(req.getCardNumber()); - ValidationUtils.throwIfNull(user, "此手机号未绑定本系统账号"); + ValidationUtils.throwIfNull(user, "此卡号未绑定本系统账号"); // 检查用户状态 super.checkUserStatus(user); // 执行认证 @@ -27,17 +26,12 @@ public class CardLoginHandler extends AbstractLoginHandler { } @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); + public void preLogin(CardLoginReq req, ClientResp client, HttpServletRequest request) { + super.preLogin(req, client, request); } @Override public AuthTypeEnum getAuthType() { - return AuthTypeEnum.PHONE; + return AuthTypeEnum.CARD; } } diff --git a/wms-module-system/src/main/java/top/wms/admin/system/mapper/UserMapper.java b/wms-module-system/src/main/java/top/wms/admin/system/mapper/UserMapper.java index b06dba9..d58b8aa 100644 --- a/wms-module-system/src/main/java/top/wms/admin/system/mapper/UserMapper.java +++ b/wms-module-system/src/main/java/top/wms/admin/system/mapper/UserMapper.java @@ -94,4 +94,13 @@ public interface UserMapper extends DataPermissionMapper { * @return 用户数量 */ Long selectCountByPhone(@FieldEncrypt @Param("phone") String phone, @Param("id") Long id); + + /** + * 根据卡片号查询 + * + * @param card 卡片号 + * @return 用户信息 + */ + @Select("SELECT * FROM sys_user WHERE card_no = #{card}") + UserDO selectByCard(@Param("card") String card); } 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 77bfd3c..528d53c 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 @@ -461,7 +461,7 @@ public class UserServiceImpl extends BaseServiceImpl().eq("card_no", card)); + return baseMapper.selectByCard(card); } @Override 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 index bcff365..723f024 100644 --- 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 @@ -1,6 +1,5 @@ package top.wms.admin.weighManage.model.resp; - import lombok.Data; @Data 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 index ee12868..e61ebce 100644 --- 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 @@ -18,7 +18,6 @@ import top.wms.admin.weighManage.model.resp.MaterialResp; @RequestMapping("/weighManage/material") public class WeighController { - /** * 获取材料详细信息 */