退菜不需要操作密码

This commit is contained in:
2025-03-19 15:57:04 +08:00
parent 8c0b1a7ae5
commit a25833ef3d

View File

@@ -44,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;
@@ -467,6 +468,7 @@ public class PayServiceImpl implements PayService {
}
@Override
@GlobalTransactional
public CzgResult<Object> refundVip(VipRefundDTO refPayParam) {
ShopInfo shopInfo = shopInfoService.getById(refPayParam.getShopId());
if (shopInfo.getIsReturnPwd().equals(1)) {
@@ -555,16 +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());
if (shopInfo.getIsReturnPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!SecureUtil.md5(param.getPwd()).equals(shopInfo.getOperationPwd())) {
throw new CzgException("操作密码错误");
}
}
Map<String, BigDecimal> returnProMap = new HashMap<>();
boolean isPay = true;
String refPayOrderNo = "REFO" + IdUtil.getSnowflakeNextId();
@@ -572,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("退单失败,可退金额不足");