Compare commits
2 Commits
b769ff9f71
...
4146d4cf03
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4146d4cf03 | ||
|
|
041259e92c |
@@ -7,7 +7,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.redis.debounce.RedisDebounce;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.ForgetPwdSmsRequest;
|
||||
import org.springblade.modules.api.request.ResetPasswordRequest;
|
||||
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
||||
import org.springblade.modules.common.service.ICommonRegionsInfoService;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
@@ -49,4 +52,22 @@ public class APPCommonController {
|
||||
}
|
||||
|
||||
|
||||
// 发送忘记密码的短信
|
||||
@RedisDebounce(key = "sms:forget_pwd", param = "#request.phone", interval = 60, includeRemainingTime = true, message = "短信发送过于频繁")
|
||||
@PostMapping("/send-forget-pwd-sms")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "发送忘记密码短信")
|
||||
public R<Boolean> sendForgetPwdSms(@RequestBody ForgetPwdSmsRequest request) {
|
||||
return R.status(userService.sendForgetPwdSms(request));
|
||||
}
|
||||
|
||||
// 提交验证码和新密码进行修改
|
||||
@PostMapping("/retrieve-password")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "重置密码")
|
||||
public R<Boolean> retrievePassword(@RequestBody ResetPasswordRequest request) {
|
||||
return R.status(userService.retrievePassword(request));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ForgetPwdSmsRequest implements Serializable {
|
||||
|
||||
private String phone;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ResetPasswordRequest implements Serializable {
|
||||
|
||||
private String phone;
|
||||
private String smsCode;
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package org.springblade.modules.common.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import org.springblade.modules.common.wrapper.UserSmsLogWrapper;
|
||||
import org.springblade.modules.common.service.IUserSmsLogService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 用户短信日志 控制器
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("common/usersmslog")
|
||||
@Tag(name = "用户短信日志", description = "用户短信日志接口")
|
||||
public class UserSmsLogController extends BladeController {
|
||||
|
||||
private final IUserSmsLogService userSmsLogService;
|
||||
|
||||
/**
|
||||
* 用户短信日志 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入userSmsLog")
|
||||
public R<UserSmsLogVO> detail(UserSmsLogEntity userSmsLog) {
|
||||
UserSmsLogEntity detail = userSmsLogService.getOne(Condition.getQueryWrapper(userSmsLog));
|
||||
return R.data(UserSmsLogWrapper.build().entityVO(detail));
|
||||
}
|
||||
/**
|
||||
* 用户短信日志 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入userSmsLog")
|
||||
public R<IPage<UserSmsLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userSmsLog, Query query) {
|
||||
IPage<UserSmsLogEntity> pages = userSmsLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userSmsLog, UserSmsLogEntity.class));
|
||||
return R.data(UserSmsLogWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户短信日志 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入userSmsLog")
|
||||
public R<IPage<UserSmsLogVO>> page(UserSmsLogVO userSmsLog, Query query) {
|
||||
IPage<UserSmsLogVO> pages = userSmsLogService.selectUserSmsLogPage(Condition.getPage(query), userSmsLog);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户短信日志 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入userSmsLog")
|
||||
public R save(@Valid @RequestBody UserSmsLogEntity userSmsLog) {
|
||||
return R.status(userSmsLogService.save(userSmsLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户短信日志 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入userSmsLog")
|
||||
public R update(@Valid @RequestBody UserSmsLogEntity userSmsLog) {
|
||||
return R.status(userSmsLogService.updateById(userSmsLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户短信日志 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入userSmsLog")
|
||||
public R submit(@Valid @RequestBody UserSmsLogEntity userSmsLog) {
|
||||
return R.status(userSmsLogService.saveOrUpdate(userSmsLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户短信日志 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(userSmsLogService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.springblade.modules.common.mapper;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户短信日志 Mapper 接口
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
public interface UserSmsLogMapper extends BaseMapper<UserSmsLogEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param userSmsLog 查询参数
|
||||
* @return List<UserSmsLogVO>
|
||||
*/
|
||||
List<UserSmsLogVO> selectUserSmsLogPage(IPage page, UserSmsLogVO userSmsLog);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.modules.common.mapper.UserSmsLogMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="userSmsLogResultMap" type="org.springblade.modules.common.pojo.entity.UserSmsLogEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="sms_type" property="smsType"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="stat_date" property="statDate"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectUserSmsLogPage" resultMap="userSmsLogResultMap">
|
||||
select * from user_sms_log where is_deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.dto;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户短信日志 数据传输对象实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserSmsLogDTO extends UserSmsLogEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.springblade.modules.common.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户短信日志 实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("user_sms_log")
|
||||
@Schema(description = "UserSmsLog对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class UserSmsLogEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 短信类型 0-找回密码
|
||||
*/
|
||||
@Schema(description = "短信类型 0-找回密码")
|
||||
private Integer smsType;
|
||||
/**
|
||||
* 存储短信业务发送的具体内容,用于回溯审计
|
||||
*/
|
||||
@Schema(description = "存储短信业务发送的具体内容,用于回溯审计")
|
||||
private String content;
|
||||
/**
|
||||
* 统计日期
|
||||
*/
|
||||
@Schema(description = "统计日期")
|
||||
private Date statDate;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remarks;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户短信日志 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserSmsLogVO extends UserSmsLogEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.springblade.modules.common.service;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
/**
|
||||
* 用户短信日志 服务类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
public interface IUserSmsLogService extends BaseService<UserSmsLogEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param userSmsLog 查询参数
|
||||
* @return IPage<UserSmsLogVO>
|
||||
*/
|
||||
IPage<UserSmsLogVO> selectUserSmsLogPage(IPage<UserSmsLogVO> page, UserSmsLogVO userSmsLog);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import org.springblade.modules.common.mapper.UserSmsLogMapper;
|
||||
import org.springblade.modules.common.service.IUserSmsLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
|
||||
/**
|
||||
* 用户短信日志 服务实现类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
@Service
|
||||
public class UserSmsLogServiceImpl extends BaseServiceImpl<UserSmsLogMapper, UserSmsLogEntity> implements IUserSmsLogService {
|
||||
|
||||
@Override
|
||||
public IPage<UserSmsLogVO> selectUserSmsLogPage(IPage<UserSmsLogVO> page, UserSmsLogVO userSmsLog) {
|
||||
return page.setRecords(baseMapper.selectUserSmsLogPage(page, userSmsLog));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.pojo.vo.UserSmsLogVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户短信日志 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-24
|
||||
*/
|
||||
public class UserSmsLogWrapper extends BaseEntityWrapper<UserSmsLogEntity, UserSmsLogVO> {
|
||||
|
||||
public static UserSmsLogWrapper build() {
|
||||
return new UserSmsLogWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserSmsLogVO entityVO(UserSmsLogEntity userSmsLog) {
|
||||
UserSmsLogVO userSmsLogVO = Objects.requireNonNull(BeanUtil.copyProperties(userSmsLog, UserSmsLogVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(userSmsLog.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(userSmsLog.getUpdateUser());
|
||||
//userSmsLogVO.setCreateUserName(createUser.getName());
|
||||
//userSmsLogVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return userSmsLogVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -53,8 +53,8 @@ public class MarketBenefitPackageController extends BladeController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
|
||||
public R<IPage<MarketBenefitPackageVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackage, Query query) {
|
||||
IPage<MarketBenefitPackageEntity> pages = userMarketBenefitPackageService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackage, MarketBenefitPackageEntity.class).orderByDesc("id"));
|
||||
public R<IPage<MarketBenefitPackageVO>> list(MarketBenefitPackageEntity userMarketBenefitPackage, Query query) {
|
||||
IPage<MarketBenefitPackageEntity> pages = userMarketBenefitPackageService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackage).orderByDesc("id"));
|
||||
return R.data(MarketBenefitPackageWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ public class MarketBenefitPackageLogController extends BladeController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入userMarketBenefitPackageLog")
|
||||
public R<IPage<MarketBenefitPackageLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackageLog, Query query) {
|
||||
IPage<MarketBenefitPackageLogEntity> pages = userMarketBenefitPackageLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackageLog, MarketBenefitPackageLogEntity.class).orderByDesc("id"));
|
||||
public R<IPage<MarketBenefitPackageLogVO>> list(MarketBenefitPackageLogEntity userMarketBenefitPackageLog, Query query) {
|
||||
IPage<MarketBenefitPackageLogEntity> pages = userMarketBenefitPackageLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackageLog).orderByDesc("id"));
|
||||
return R.data(MarketBenefitPackageLogWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface MarketUserCommissionLogMapper extends BaseMapper<MarketUserComm
|
||||
* @param userCommissionLog 查询参数
|
||||
* @return List<UserCommissionLogVO>
|
||||
*/
|
||||
List<MarketUserCommissionLogVO> selectUserCommissionLogPage(IPage page, MarketUserCommissionLogVO userCommissionLog);
|
||||
List<MarketUserCommissionLogVO> selectUserCommissionLogPage(IPage page, MarketUserCommissionLogVO commissionLog);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,8 +25,17 @@
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectUserCommissionLogPage" resultMap="userCommissionLogResultMap">
|
||||
select * from user_commission_log where is_deleted = 0
|
||||
<select id="selectUserCommissionLogPage" resultType="org.springblade.modules.market.pojo.vo.MarketUserCommissionLogVO">
|
||||
select
|
||||
ucl.*,
|
||||
bu.account
|
||||
from blade_user bu
|
||||
left join user_commission_log ucl on bu.id = ucl.user_id
|
||||
where bu.is_deleted = 0 and bu.user_type = 2 and ucl.is_deleted = 0 and ucl.is_complete = 1
|
||||
<if test="commissionLog.account != null">
|
||||
and bu.account = #{commissionLog.account}
|
||||
</if>
|
||||
order by ucl.id desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,17 @@
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectUserCommissionPage" resultMap="userCommissionResultMap">
|
||||
select * from user_commission where is_deleted = 0
|
||||
<select id="selectUserCommissionPage" resultType="org.springblade.modules.market.pojo.vo.MarketUserCommissionVO">
|
||||
select
|
||||
uc.*,
|
||||
bu.account
|
||||
from blade_user bu
|
||||
left join user_commission uc on bu.id = uc.id
|
||||
where bu.is_deleted = 0 and uc.is_deleted = 0
|
||||
<if test="userCommission.account != null">
|
||||
and bu.account = #{userCommission.account}
|
||||
</if>
|
||||
order by uc.id desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
import java.io.Serial;
|
||||
|
||||
@@ -44,6 +45,7 @@ import java.io.Serial;
|
||||
@TableName("user_commission_log")
|
||||
@Schema(description = "UserCommissionLog对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class MarketUserCommissionLogEntity extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
|
||||
@@ -42,4 +42,6 @@ public class MarketUserCommissionLogVO extends MarketUserCommissionLogEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String account;
|
||||
|
||||
}
|
||||
|
||||
@@ -42,4 +42,6 @@ public class MarketUserCommissionVO extends MarketUserCommissionEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String account;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.modules.api.request.ForgetPwdSmsRequest;
|
||||
import org.springblade.modules.api.request.ResetPasswordRequest;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||
import org.springblade.modules.auth.provider.UserType;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
@@ -309,4 +311,7 @@ public interface IUserService extends BaseService<User> {
|
||||
|
||||
User getByPhone(String phoneNumber);
|
||||
|
||||
boolean sendForgetPwdSms(ForgetPwdSmsRequest request);
|
||||
|
||||
boolean retrievePassword(ResetPasswordRequest request);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.cache.*;
|
||||
import org.springblade.common.constant.CommonConstant;
|
||||
import org.springblade.common.constant.TenantConstant;
|
||||
@@ -19,15 +20,22 @@ import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.oauth2.exception.ExceptionCode;
|
||||
import org.springblade.core.oauth2.exception.OAuth2Exception;
|
||||
import org.springblade.core.oauth2.exception.UserInvalidException;
|
||||
import org.springblade.core.oauth2.props.OAuth2Properties;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tenant.BladeTenantProperties;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.jackson.JsonUtil;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.*;
|
||||
import org.springblade.modules.api.request.ForgetPwdSmsRequest;
|
||||
import org.springblade.modules.api.request.ResetPasswordRequest;
|
||||
import org.springblade.modules.auth.provider.UserType;
|
||||
import org.springblade.modules.common.pojo.entity.UserSmsLogEntity;
|
||||
import org.springblade.modules.common.service.IUserSmsLogService;
|
||||
import org.springblade.modules.resource.utils.AliyunDynpsService;
|
||||
import org.springblade.modules.system.excel.UserExcel;
|
||||
import org.springblade.modules.system.mapper.UserMapper;
|
||||
import org.springblade.modules.system.pojo.entity.*;
|
||||
@@ -38,14 +46,16 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static org.springblade.common.constant.CommonConstant.*;
|
||||
import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE;
|
||||
import static org.springblade.core.oauth2.constant.OAuth2TokenConstant.USER_PHONE_NOT_FOUND;
|
||||
import static org.springblade.modules.auth.constant.BladeAuthConstant.INIT_PASSWD_VALUE;
|
||||
import static org.springblade.modules.auth.constant.BladeAuthConstant.SMS_SIMPLE_VALUE;
|
||||
import static org.springblade.modules.resource.utils.SmsUtil.SEND_FAIL;
|
||||
import static org.springblade.modules.resource.utils.SmsUtil.SEND_SUCCESS;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -53,6 +63,7 @@ import static org.springblade.modules.auth.constant.BladeAuthConstant.INIT_PASSW
|
||||
* @author Chill
|
||||
*/
|
||||
//@Master
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implements IUserService {
|
||||
@@ -64,6 +75,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
private final BladeTenantProperties tenantProperties;
|
||||
private final BladeRedis bladeRedis;
|
||||
private final OAuth2Properties properties;
|
||||
private final AliyunDynpsService dynpsService;
|
||||
private final IUserSmsLogService userSmsLogService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -620,4 +633,102 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
return getOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, phoneNumber).eq(User::getIsDeleted, 0).eq(User::getStatus, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendForgetPwdSms(ForgetPwdSmsRequest request) {
|
||||
String decryptedPhone = SM2Util.decrypt(request.getPhone(), properties.getPublicKey(), properties.getPrivateKey());
|
||||
if (StringUtil.isBlank(decryptedPhone)) {
|
||||
throw new ServiceException("手机号码有误!");
|
||||
}
|
||||
Boolean simpleSMSOpen = Func.toBoolean(ParamCache.getValue(SMS_SIMPLE_VALUE), false);
|
||||
|
||||
User userInfo = getOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, decryptedPhone));
|
||||
if (userInfo == null) {
|
||||
throw new ServiceException("该用户未注册!");
|
||||
}
|
||||
|
||||
if (!simpleSMSOpen) {
|
||||
throw new UserInvalidException("短信功能暂未开启,请联系管理员");
|
||||
}
|
||||
|
||||
long count = userSmsLogService.count(
|
||||
Wrappers.lambdaQuery(UserSmsLogEntity.class)
|
||||
.eq(UserSmsLogEntity::getUserId, userInfo.getId())
|
||||
.eq(UserSmsLogEntity::getSmsType, 0)
|
||||
.eq(UserSmsLogEntity::getStatDate, org.springblade.common.utils.date.DateUtil.getToday())
|
||||
);
|
||||
if (count > 0) {
|
||||
throw new ServiceException("今日发送次数已达上限,请明天再试!");
|
||||
}
|
||||
|
||||
try {
|
||||
Boolean sendResult = dynpsService.sendSms(decryptedPhone);
|
||||
if (Boolean.TRUE.equals(sendResult)) {
|
||||
UserSmsLogEntity logEntity = new UserSmsLogEntity()
|
||||
.setUserId(userInfo.getId())
|
||||
.setSmsType(0)
|
||||
.setContent("忘记密码-发送短信")
|
||||
.setStatDate(org.springblade.common.utils.date.DateUtil.getToday()); // 设置日期
|
||||
|
||||
boolean saveSuccess = userSmsLogService.save(logEntity);
|
||||
if (!saveSuccess) {
|
||||
log.error("用户 {} 发送忘记密码短信,日志保存失败", decryptedPhone);
|
||||
throw new ServiceException("系统繁忙,请稍后再试");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
throw new ServiceException("短信服务商返回发送失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
if (msg != null && msg.startsWith("您的访问次数")) {
|
||||
msg = "您的访问次数已超限";
|
||||
}
|
||||
log.error("用户 {} 发送忘记密码短信异常: {}", decryptedPhone, msg, e);
|
||||
throw new ServiceException(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retrievePassword(ResetPasswordRequest request) {
|
||||
|
||||
String decryptedPhone = SM2Util.decrypt(request.getPhone(), properties.getPublicKey(), properties.getPrivateKey());
|
||||
if (StringUtil.isBlank(decryptedPhone)) {
|
||||
throw new ServiceException("手机号码有误!");
|
||||
}
|
||||
|
||||
User userInfo = getOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, decryptedPhone));
|
||||
if (userInfo == null) {
|
||||
throw new ServiceException("该手机号未注册!");
|
||||
}
|
||||
|
||||
if (StringUtil.isBlank(request.getSmsCode())) {
|
||||
throw new ServiceException("无效验证码");
|
||||
}
|
||||
|
||||
String decryptPassword = SM2Util.decrypt(request.getPassword(), properties.getPublicKey(), properties.getPrivateKey());
|
||||
|
||||
if (!isPasswordValid(decryptPassword)) {
|
||||
throw new ServiceException("密码必须包含大小写字母、数字,长度8-12位");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!dynpsService.verifySms(decryptedPhone, request.getSmsCode())) {
|
||||
throw new UserInvalidException("验证码验证失败");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new ServiceException("验证码验证失败");
|
||||
}
|
||||
|
||||
|
||||
|
||||
userInfo.setPassword(DigestUtil.encrypt(decryptPassword));
|
||||
return updateById(userInfo);
|
||||
}
|
||||
|
||||
private boolean isPasswordValid(String password) {
|
||||
// 规则: 必须包含大小写字母和数字, 长度8-12位, 仅允许字母和数字
|
||||
return password.matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{8,12}$");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -243,6 +243,8 @@ blade:
|
||||
- /app-mall/categories
|
||||
- /app-mall/list
|
||||
- /app-mall/detail
|
||||
- /app-common/send-forget-pwd-sms
|
||||
- /app-common/retrieve-password
|
||||
#授权认证配置
|
||||
auth:
|
||||
- method: ALL
|
||||
|
||||
Reference in New Issue
Block a user