zwhui 1 éve
szülő
commit
10b2236a9d

+ 6 - 2
wholesale/src/main/java/com/yhlxj/service/wholesale/impl/WebInfoServiceImpl.java

@@ -60,7 +60,7 @@ public class WebInfoServiceImpl extends ServiceImpl<WebInfoMapper, WebInfo> impl
      * @param password 密码
      * @throws IllegalArgumentException 如果密码格式不正确
      */
-    private void validatePassword(String password) {
+    private static void validatePassword(String password) {
         if (password == null || password.trim().isEmpty()) {
             throw new IllegalArgumentException("密码不能为空");
         }
@@ -68,9 +68,13 @@ public class WebInfoServiceImpl extends ServiceImpl<WebInfoMapper, WebInfo> impl
             throw new IllegalArgumentException("密码长度必须在6-20个字符之间");
         }
         if (!PASSWORD_PATTERN.matcher(password).matches()) {
-            throw new IllegalArgumentException("密码必须包含字母和数字");
+            throw new IllegalArgumentException("密码必须包含字母和数字,不能包含特殊符号");
         }
     }
+
+    public static void main(String[] args) {
+        validatePassword("qqwe123.");
+    }
     
     /**
      * 验证WebInfo对象

+ 19 - 0
wholesale/src/main/java/com/yhlxj/web/controller/manage/WholesaleController.java

@@ -1,6 +1,7 @@
 package com.yhlxj.web.controller.manage;
 
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.common.exception.BusinessRuntimeException;
@@ -8,6 +9,7 @@ import com.yhlxj.dao.model.dto.Result;
 import com.yhlxj.dao.model.entity.WebInfo;
 import com.yhlxj.dao.model.entity.WholesaleUser;
 import com.yhlxj.dao.model.enums.GatewayResponse;
+import com.yhlxj.dao.model.view.WebInfoView;
 import com.yhlxj.service.wholesale.WebInfoService;
 import com.yhlxj.service.wholesale.WholesaleUserService;
 import lombok.RequiredArgsConstructor;
@@ -136,4 +138,21 @@ public class WholesaleController {
                 Wrappers.lambdaQuery(WholesaleUser.class).eq(WholesaleUser::getWholesaleId, wholesaleId).like(WholesaleUser::getUsername, username)));
     }
 
+
+    /**
+     * 通过前缀查询店铺信息
+     */
+    @GetMapping("/getWebInfoByPrefix")
+    public WebInfoView getWebInfoByPrefix(@RequestParam String prefix) {
+        WebInfo webInfo = webInfoService.getOne(Wrappers.lambdaQuery(WebInfo.class).eq(WebInfo::getPrefix, prefix).last(" limit 1"));
+        if (webInfo == null) {
+            throw new BusinessRuntimeException("店铺不存在.");
+        }
+        if (!webInfo.getStatus()){
+            throw new BusinessRuntimeException("店铺已关闭.");
+        }
+        WebInfoView view = new WebInfoView();
+        BeanUtil.copyProperties(webInfo, view);
+        return view;
+    }
 }