This commit is contained in:
wyn
2026-04-30 09:54:18 +08:00
parent 6bc3f33d3d
commit a4edccc7de
15 changed files with 278 additions and 117 deletions

View File

@@ -32,4 +32,5 @@ public class BuyOrderRefund implements Serializable {
private int status;
private String remark;
private Date createTime;
private String wxRefundNo;
}

View File

@@ -27,7 +27,7 @@ public class BuyOrderRefundLog implements Serializable {
private Date createTime;
private int type;
private int status;
private int reason;
@TableField(exist = false)
private String title;

View File

@@ -6,4 +6,5 @@ import com.peanut.modules.common.entity.BuyOrderRefundLog;
public interface BuyOrderRefundLogService extends IService<BuyOrderRefundLog> {
void insertRefundLog(int buyOrderRefundId, int type, int status);
void insertRefundLog(int buyOrderRefundId, int type, int status, String reason);
}

View File

@@ -9,4 +9,6 @@ import java.math.BigDecimal;
public interface BuyOrderRefundService extends IService<BuyOrderRefund> {
int insertBuyOrderRefund(BuyOrder buyOrder, BigDecimal refundFee, int deductShipping,String remark);
String genRefundNo();
BuyOrderRefund getRefundInfoByOrderId(int orderId);
}

View File

@@ -2,6 +2,7 @@ package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.BuyOrderRefundLogDao;
import com.peanut.modules.common.entity.BuyOrder;
import com.peanut.modules.common.entity.BuyOrderRefund;
import com.peanut.modules.common.entity.BuyOrderRefundLog;
import com.peanut.modules.common.service.BuyOrderRefundLogService;
@@ -19,4 +20,12 @@ public class BuyOrderRefundLogServiceImpl extends ServiceImpl<BuyOrderRefundLogD
log.setStatus(status);
this.save(log);
}
@Override
public void insertRefundLog(int refundId, int type, int status, String reason){
BuyOrderRefundLog log = new BuyOrderRefundLog();
log.setRefundId(refundId);
log.setType(type);
log.setStatus(status);
this.save(log);
}
}

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.BuyOrderRefundDao;
import com.peanut.modules.common.entity.BuyOrder;
@@ -37,4 +38,11 @@ public class BuyOrderRefundServiceImpl extends ServiceImpl<BuyOrderRefundDao, Bu
int random = new Random().nextInt(900) + 100; // 100~999
return "RF" + time + random;
}
@Override
public BuyOrderRefund getRefundInfoByOrderId(int orderId){
QueryWrapper<BuyOrderRefund> wrapperRefund = new QueryWrapper<>();
wrapperRefund.eq("order_id",orderId).last("LIMIT 1");
BuyOrderRefund refundInfo = this.getOne(wrapperRefund);
return refundInfo;
}
}

View File

@@ -7,8 +7,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.ExpressOrderUtil;
import com.peanut.common.utils.Query;
import com.peanut.config.Constants;
import com.peanut.modules.common.dao.*;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.BuyOrderRefundService;
import com.peanut.modules.common.service.BuyOrderService;
import com.peanut.modules.common.to.PrepareOrderDto;
import com.peanut.modules.common.vo.UserBaseVo;
@@ -44,6 +46,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
private AiBuyConfigDao aiBuyConfigDao;
@Autowired
private ShopProductCourseDao shopProductCourseDao;
@Autowired
private BuyOrderRefundService buyOrderRefundService;
@Override
public Map<String, Object> initPrepareOrder(PrepareOrderDto prepareOrderDto) {
@@ -75,7 +79,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
wrapper.eq(BuyOrder::getUserId,params.get("userId"));
wrapper.eq(BuyOrder::getCome,params.get("come"));
if(StringUtils.isEmpty(params.get("orderStatus").toString())){
Integer[] sts = {0,1,2,3,6};
Integer[] sts = {0,1,2,3,6,7};
wrapper.in(BuyOrder::getOrderStatus,sts);
}else{
wrapper.eq(BuyOrder::getOrderStatus,params.get("orderStatus").toString());
@@ -147,7 +151,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
b.setExpressList(expressOrders);
}
}
b.setRefundableStatus(b.getOrderStatus().equals("6")?false:refundableStatus);
b.setRefundableStatus(b.getOrderStatus().equals("6") || b.getOrderStatus().equals("7")|| Constants.PAYMENT_METHOD_ALI_PAY.equals(b.getPaymentMethod())?false:refundableStatus);
}
}
return page;