Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-03-05 16:34:45 +08:00
11 changed files with 135 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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();
}