店铺修改操作密码校验验证码
This commit is contained in:
parent
6de7f4e044
commit
fb9346cd5d
|
|
@ -1,16 +1,20 @@
|
||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
||||||
import com.czg.account.dto.shopuser.ShopUserEditDTO;
|
import com.czg.account.dto.shopuser.ShopUserEditDTO;
|
||||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||||
import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
|
import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
|
import com.czg.account.entity.ShopUserFlow;
|
||||||
|
import com.czg.account.service.ShopUserFlowService;
|
||||||
import com.czg.account.service.ShopUserService;
|
import com.czg.account.service.ShopUserService;
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.annotation.SaStaffCheckPermission;
|
import com.czg.annotation.SaStaffCheckPermission;
|
||||||
import com.czg.enums.ShopUserFlowBizEnum;
|
import com.czg.enums.ShopUserFlowBizEnum;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.utils.PageUtil;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
@ -28,6 +32,8 @@ public class ShopUserController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
|
@Resource
|
||||||
|
private ShopUserFlowService shopUserFlowService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺用户概述信息
|
* 获取店铺用户概述信息
|
||||||
|
|
@ -41,6 +47,32 @@ public class ShopUserController {
|
||||||
return CzgResult.success(shopUserService.getSummary(StpKit.USER.getShopId(), isVip));
|
return CzgResult.success(shopUserService.getSummary(StpKit.USER.getShopId(), isVip));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取店铺用户充值记录
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param bizCode 充值类型 类型:
|
||||||
|
* cashIn 现金充值,
|
||||||
|
* wechatIn 微信小程序充值,
|
||||||
|
* alipayIn 支付宝小程序充值,
|
||||||
|
* awardIn 充值奖励,
|
||||||
|
* rechargeRefund 充值退款
|
||||||
|
* orderPay 订单消费,
|
||||||
|
* orderRefund 订单退款,
|
||||||
|
* adminIn 管理员充值
|
||||||
|
* adminOut管理员消费
|
||||||
|
* @return 充值记录
|
||||||
|
*/
|
||||||
|
@SaAdminCheckPermission("shopUser:flow")
|
||||||
|
@GetMapping("/flow")
|
||||||
|
public CzgResult<Page<ShopUserFlow>> flow(@RequestParam Integer userId, String bizCode) {
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper().eq(ShopUserFlow::getShopId, StpKit.USER.getShopId())
|
||||||
|
.eq(ShopUserFlow::getUserId, userId);
|
||||||
|
if (StrUtil.isNotBlank(bizCode)) {
|
||||||
|
queryWrapper.eq(ShopUserFlow::getBizCode, bizCode);
|
||||||
|
}
|
||||||
|
return CzgResult.success(shopUserFlowService.page(PageUtil.buildPage(), queryWrapper));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺用户列表
|
* 获取店铺用户列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ public class ShopInfoEditDTO {
|
||||||
@NotNull(message = "id不为空")
|
@NotNull(message = "id不为空")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 就餐模式 json形式['dine-in', 'take-out]
|
* 就餐模式 json形式['dine-in', 'take-out]
|
||||||
*/
|
*/
|
||||||
|
|
@ -81,7 +83,7 @@ public class ShopInfoEditDTO {
|
||||||
/**
|
/**
|
||||||
* 操作密码
|
* 操作密码
|
||||||
*/
|
*/
|
||||||
private Integer operationPwd;
|
private String operationPwd;
|
||||||
/**
|
/**
|
||||||
* 主店id
|
* 主店id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,17 @@ package com.czg.service.account.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import com.czg.account.dto.PageDTO;
|
import com.czg.account.dto.PageDTO;
|
||||||
import com.czg.account.dto.shopinfo.*;
|
import com.czg.account.dto.shopinfo.*;
|
||||||
import com.czg.account.entity.*;
|
import com.czg.account.entity.*;
|
||||||
import com.czg.account.service.*;
|
import com.czg.account.service.*;
|
||||||
|
import com.czg.config.RedisCst;
|
||||||
import com.czg.enums.StatusEnum;
|
import com.czg.enums.StatusEnum;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.service.RedisService;
|
||||||
import com.czg.service.account.mapper.ShopInfoMapper;
|
import com.czg.service.account.mapper.ShopInfoMapper;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.utils.GeoUtil;
|
import com.czg.utils.GeoUtil;
|
||||||
|
|
@ -48,6 +51,8 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
@Resource
|
@Resource
|
||||||
private ShopExtendService shopExtendService;
|
private ShopExtendService shopExtendService;
|
||||||
|
@Resource
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#id")
|
@Cacheable(key = "#id")
|
||||||
|
|
@ -140,6 +145,16 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
if (shopInfoEditDTO.getActivateCode() != null) {
|
if (shopInfoEditDTO.getActivateCode() != null) {
|
||||||
activateShop(shopInfo, shopInfoEditDTO.getActivateCode());
|
activateShop(shopInfo, shopInfoEditDTO.getActivateCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shopInfoEditDTO.getOperationPwd() != null) {
|
||||||
|
String key = "%s%s:%s".formatted(RedisCst.SMS_CODE, shopInfo.getPhone(), "editShopInfoOpePwd");
|
||||||
|
Object val = redisService.get(key);
|
||||||
|
if (val instanceof String code && !shopInfoEditDTO.getCode().equals(code)) {
|
||||||
|
throw new ApiNotPrintException("验证码错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
shopInfo.setOperationPwd(SecureUtil.md5(shopInfo.getId() + shopInfoEditDTO.getOperationPwd()));
|
||||||
|
}
|
||||||
return updateById(shopInfo);
|
return updateById(shopInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue