Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-03-19 16:42:00 +08:00
9 changed files with 53 additions and 18 deletions

View File

@@ -45,4 +45,5 @@ public class VipRefundDTO implements Serializable {
private String platformType;
private String pwd;
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
@@ -43,6 +44,7 @@ import com.czg.utils.AssertUtil;
import com.czg.utils.MD5Util;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.update.UpdateChain;
import io.seata.spring.annotation.GlobalTransactional;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotBlank;
import lombok.NonNull;
@@ -346,7 +348,8 @@ public class PayServiceImpl implements PayService {
AssertUtil.isNull(shopInfo, "店铺不存在");
if (shopInfo.getIsMemberInPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!shopInfo.getOperationPwd().equals(MD5Util.md5AsHex(payParam.getPwd()))) {
AssertUtil.isBlank(payParam.getPwd(), "请输入操作密码后充值");
if (!shopInfo.getOperationPwd().equals(SecureUtil.md5(payParam.getPwd()))) {
return CzgResult.failure("支付密码错误");
}
}
@@ -465,7 +468,15 @@ public class PayServiceImpl implements PayService {
}
@Override
@GlobalTransactional
public CzgResult<Object> refundVip(VipRefundDTO refPayParam) {
ShopInfo shopInfo = shopInfoService.getById(refPayParam.getShopId());
if (shopInfo.getIsReturnPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!SecureUtil.md5(refPayParam.getPwd()).equals(shopInfo.getOperationPwd())) {
throw new CzgException("操作密码错误");
}
}
ShopUser shopUser = shopUserService.getShopUserInfo(refPayParam.getShopId(), refPayParam.getUserId());
ShopUserFlow inFlow = userFlowService.getById(refPayParam.getFlowId());
AssertUtil.isNull(inFlow, "充值记录不存在");
@@ -546,9 +557,10 @@ public class PayServiceImpl implements PayService {
}
@Override
@Transactional
@GlobalTransactional
public CzgResult<Object> refundOrderBefore(OrderInfoRefundDTO param) {
OrderInfo orderInfo = orderInfoService.getById(param.getOrderId());
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
Map<String, BigDecimal> returnProMap = new HashMap<>();
boolean isPay = true;
String refPayOrderNo = "REFO" + IdUtil.getSnowflakeNextId();
@@ -556,7 +568,13 @@ public class PayServiceImpl implements PayService {
isPay = false;
refPayOrderNo = "";
}
if (isPay) {
if(isPay){
if (shopInfo.getIsReturnPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!SecureUtil.md5(param.getPwd()).equals(shopInfo.getOperationPwd())) {
throw new CzgException("操作密码错误");
}
}
orderInfo.setRefundAmount(orderInfo.getRefundAmount().add(param.getRefundAmount()));
if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) > 0) {
throw new ValidateException("退单失败,可退金额不足");