创建店铺密码强度校验

修改密码 可通过验证码
发送验证码类型限制
This commit is contained in:
2026-04-27 10:08:16 +08:00
parent c3ae15c7cc
commit 91fc6643a8
10 changed files with 93 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
package com.czg.controller.admin;
import cn.hutool.core.util.StrUtil;
import com.czg.account.service.CommonService;
import com.czg.resp.CzgResult;
import com.czg.service.account.util.AliOssUtil;
@@ -8,6 +9,8 @@ import org.apache.commons.io.FilenameUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 公共接口
* @author Administrator
@@ -20,13 +23,19 @@ public class CommonController {
@Resource
private AliOssUtil aliOssUtil;
private static final List<String> SMS_CODE_TYPE = List.of("editShopInfoOpePwd", "wxMiniPwd", "shopPwd");
/**
* 发送验证码
* @param type 验证码类型
* @param type 验证码类型 目前
* editShopInfoOpePwd 店铺操作密码
* wxMiniPwd 微信小程序用户登录密码
* shopPwd 店铺登录密码
* @return 是否成功
*/
@GetMapping("/sms")
public CzgResult<Boolean> sendSms(@RequestParam String type) {
if(StrUtil.isEmpty(type) || !SMS_CODE_TYPE.contains(type)) return CzgResult.failure("验证码类型错误");
return CzgResult.success(commonService.sendSms(type));
}

View File

@@ -40,7 +40,7 @@ public class ShopInfoController {
@SaAdminCheckRole("管理员")
@SaAdminCheckPermission(parentName = "店铺管理接口", value = "shopInfo:list", name = "店铺列表")
@GetMapping
public CzgResult<Page<ShopInfo>> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop) {
public CzgResult<Page<ShopDetailDTO>> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop) {
return CzgResult.success(shopInfoService.get(pageDTO, profiles, phone, shopName, status, isHeadShop));
}
@@ -49,7 +49,7 @@ public class ShopInfoController {
*
*/
@GetMapping("/otherShop")
public CzgResult<Page<ShopInfo>> getShopByMainId(PageDTO pageDTO, String shopName, Integer status) {
public CzgResult<Page<ShopDetailDTO>> getShopByMainId(PageDTO pageDTO, String shopName, Integer status) {
return CzgResult.success(shopInfoService.getShopByMainId(pageDTO, shopName, status));
}

View File

@@ -1,11 +1,13 @@
package com.czg.controller.admin;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.user.SysUserAddDTO;
import com.czg.account.dto.user.SysUserEditDTO;
import com.czg.account.dto.user.SysUserEditPwdDTO;
import com.czg.account.service.SysUserService;
import com.czg.account.vo.SysUserDetailVO;
import com.czg.annotation.SaAdminCheckRole;
import com.czg.exception.CzgException;
import com.czg.resp.CzgResult;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
@@ -17,6 +19,7 @@ import java.io.IOException;
/**
* 系统用户管理
*
* @author Administrator
*/
@RestController
@@ -27,10 +30,11 @@ public class SysController {
/**
* 系统用户列表
* @param key 名称或邮箱搜索
*
* @param key 名称或邮箱搜索
* @param startTime 开始时间
* @param endTime 结束时间
* @param status 状态1启用、0禁用
* @param endTime 结束时间
* @param status 状态1启用、0禁用
* @return 分页数据
*/
// @SaAdminCheckPermission("sysUser:list")
@@ -42,6 +46,7 @@ public class SysController {
/**
* 员工相信信息
*
* @param id 用户id
* @return 员工信息
*/
@@ -53,6 +58,7 @@ public class SysController {
/**
* 系统账号修改
*
* @param sysUserEditDTO 修改信息
* @return 是否成功
*/
@@ -65,16 +71,22 @@ public class SysController {
/**
* 登录账号密码修改
* @param sysUserEditPwdDTO 修改西悉尼
*
* @param sysUserEditPwdDTO 修改密码
* 原密码与验证码 二选一
* @return 是否成功
*/
@PutMapping("/pwd")
public CzgResult<Boolean> editPwd(@RequestBody @Validated SysUserEditPwdDTO sysUserEditPwdDTO) {
if (StrUtil.isBlank(sysUserEditPwdDTO.getOriginalPassword()) || StrUtil.isBlank(sysUserEditPwdDTO.getCode())) {
throw new CzgException("原密码或验证码不能同时为空");
}
return CzgResult.success(sysUserService.editPwd(sysUserEditPwdDTO));
}
/**
* 系统用户删除
*
* @param id 用户id
* @return 是否成功
*/
@@ -87,6 +99,7 @@ public class SysController {
/**
* 系统用户添加
*
* @param sysUserAddDTO 添加信息
* @return 是否成功
*/
@@ -98,10 +111,11 @@ public class SysController {
/**
* 系统用户导出
* @param key 名称或邮箱搜索
*
* @param key 名称或邮箱搜索
* @param startTime 开始时间
* @param endTime 结束时间
* @param status 状态1启用、0禁用
* @param endTime 结束时间
* @param status 状态1启用、0禁用
* @throws IOException IO异常
*/
@SaAdminCheckRole("admin")