Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a8a3a311bf
|
|
@ -1,16 +1,20 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserEditDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
|
||||
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.annotation.SaAdminCheckPermission;
|
||||
import com.czg.annotation.SaStaffCheckPermission;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -28,6 +32,8 @@ public class ShopUserController {
|
|||
|
||||
@Resource
|
||||
private ShopUserService shopUserService;
|
||||
@Resource
|
||||
private ShopUserFlowService shopUserFlowService;
|
||||
|
||||
/**
|
||||
* 获取店铺用户概述信息
|
||||
|
|
@ -41,6 +47,32 @@ public class ShopUserController {
|
|||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺用户列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.czg.controller.admin;
|
|||
|
||||
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.entity.SysUser;
|
||||
import com.czg.account.entity.SysUsersRoles;
|
||||
import com.czg.account.service.SysUserService;
|
||||
|
|
@ -9,6 +10,7 @@ import com.czg.account.vo.SysUserDetailVO;
|
|||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.annotation.SaAdminCheckRole;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
|
@ -65,6 +67,17 @@ public class SysController {
|
|||
return CzgResult.success(sysUserService.edit(sysUserEditDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录账号密码修改
|
||||
* @param sysUserEditPwdDTO 修改西悉尼
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckRole("admin")
|
||||
@PutMapping("/pwd")
|
||||
public CzgResult<Boolean> editPwd(@RequestBody @Validated SysUserEditPwdDTO sysUserEditPwdDTO) {
|
||||
return CzgResult.success(sysUserService.editPwd(StpKit.USER.getLoginIdAsLong(), sysUserEditPwdDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统用户删除
|
||||
* @param id 用户id
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.czg.account.dto.print;
|
|||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +25,7 @@ public class PrinterEditDTO {
|
|||
/**
|
||||
* ip地址
|
||||
*/
|
||||
@NotBlank(message = "地址不为空")
|
||||
@Size(min = 1, message = "地址不为空")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
|
|
@ -41,7 +42,7 @@ public class PrinterEditDTO {
|
|||
/**
|
||||
* 打印机品牌
|
||||
*/
|
||||
@NotBlank(message = "打印机品牌不为空")
|
||||
@Size(min = 1, message = "打印机品牌不为空")
|
||||
private String contentType;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ public class ShopInfoEditDTO {
|
|||
@NotNull(message = "id不为空")
|
||||
private Integer id;
|
||||
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 就餐模式 json形式['dine-in', 'take-out]
|
||||
*/
|
||||
|
|
@ -81,7 +83,7 @@ public class ShopInfoEditDTO {
|
|||
/**
|
||||
* 操作密码
|
||||
*/
|
||||
private Integer operationPwd;
|
||||
private String operationPwd;
|
||||
/**
|
||||
* 主店id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import jakarta.validation.constraints.Size;
|
|||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.czg.account.dto.user;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class SysUserEditPwdDTO {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 原密码
|
||||
*/
|
||||
@NotBlank(message = "原密码不为空")
|
||||
private String originalPassword;
|
||||
|
||||
/**
|
||||
* 确认密码
|
||||
*/
|
||||
@NotBlank(message = "确认密码不为空")
|
||||
private String checkPassword;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Size(min = 1, message = "密码不为空")
|
||||
private String password;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.czg.account.service;
|
|||
|
||||
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.entity.SysUser;
|
||||
import com.czg.account.vo.SysUserDetailVO;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
|
|
@ -35,4 +36,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
void download(String key, String startTime, String endTime, Integer status, HttpServletResponse response) throws IOException;
|
||||
|
||||
SysUserDetailVO detail(Integer id);
|
||||
|
||||
Boolean editPwd(long sysUserId, SysUserEditPwdDTO sysUserEditPwdDTO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,17 @@ package com.czg.service.account.service.impl;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.czg.account.dto.PageDTO;
|
||||
import com.czg.account.dto.shopinfo.*;
|
||||
import com.czg.account.entity.*;
|
||||
import com.czg.account.service.*;
|
||||
import com.czg.config.RedisCst;
|
||||
import com.czg.enums.StatusEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.account.mapper.ShopInfoMapper;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.GeoUtil;
|
||||
|
|
@ -48,6 +51,8 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||
private ShopUserService shopUserService;
|
||||
@Resource
|
||||
private ShopExtendService shopExtendService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#id")
|
||||
|
|
@ -140,6 +145,16 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||
if (shopInfoEditDTO.getActivateCode() != null) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import cn.hutool.poi.excel.ExcelUtil;
|
|||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
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.entity.SysRole;
|
||||
import com.czg.account.entity.SysUser;
|
||||
import com.czg.account.entity.SysUsersRoles;
|
||||
|
|
@ -203,4 +204,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
|||
sysUserDetailVO.setRoleId(usersRoles.getRoleId());
|
||||
return sysUserDetailVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean editPwd(long sysUserId, SysUserEditPwdDTO sysUserEditPwdDTO) {
|
||||
SysUser sysUser = getById(sysUserId);
|
||||
if (!sysUserEditPwdDTO.getPassword().equals(SecureUtil.md5(sysUser.getId() + sysUserEditPwdDTO.getOriginalPassword()))) {
|
||||
throw new ApiNotPrintException("原密码不正确");
|
||||
}
|
||||
|
||||
if (!sysUserEditPwdDTO.getPassword().equals(sysUserEditPwdDTO.getCheckPassword())) {
|
||||
throw new ApiNotPrintException("两次密码不一致");
|
||||
}
|
||||
|
||||
sysUser.setPassword(SecureUtil.md5(sysUser.getId() + sysUserEditPwdDTO.getPassword()));
|
||||
|
||||
return updateById(sysUser);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public class OrderPayParamDTO {
|
|||
// @NotNull(message = "店铺不能为空")
|
||||
private Long shopId;
|
||||
private Long shopUserId;
|
||||
private Long creditBuyerId;
|
||||
private String buyerRemark;
|
||||
private String returnUrl;
|
||||
private String payType;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.czg.order.entity.OrderDetail;
|
|||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.enums.PayEnums;
|
||||
import com.czg.order.service.CreditBuyerOrderService;
|
||||
import com.czg.order.service.OrderDetailService;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
|
|
@ -84,6 +85,8 @@ public class PayServiceImpl implements PayService {
|
|||
@Resource
|
||||
private OrderPaymentService paymentService;
|
||||
@Resource
|
||||
private CreditBuyerOrderService buyerOrderService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private RabbitPublisher rabbitPublisher;
|
||||
|
|
@ -131,11 +134,14 @@ public class PayServiceImpl implements PayService {
|
|||
@Override
|
||||
@Transactional
|
||||
public CzgResult<Object> creditPayOrder(OrderPayParamDTO payParam) {
|
||||
AssertUtil.isNull(payParam.getCreditBuyerId(), "挂账人不可为空");
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
orderInfo.setCreditBuyerId(payParam.getCreditBuyerId());
|
||||
orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
||||
LocalDateTime.now(), null, PayEnums.CREDIT_PAY);
|
||||
//挂账后续逻辑
|
||||
buyerOrderService.save(payParam.getCreditBuyerId().toString(), orderInfo.getId());
|
||||
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
|
||||
//TODO 挂账后续逻辑
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue