订单异议问题修复,跟进合同优化

This commit is contained in:
朱昊天
2026-05-22 18:00:00 +08:00
parent 7686d70e59
commit 4408e80e1c
8 changed files with 265 additions and 15 deletions

View File

@@ -52,6 +52,11 @@ public class GearReturnExchange extends BaseEntity {
* 涉及金额
*/
private BigDecimal amount;
/**
* 销售员ID
*/
private Long salesmanId;
/**
* 删除标志0=正常1=已删除)
*/

View File

@@ -58,6 +58,11 @@ public class GearReturnExchangeBo extends BaseEntity {
*/
private BigDecimal amount;
/**
* 销售员ID
*/
private Long salesmanId;
//订单id
private Long orderId;

View File

@@ -41,6 +41,16 @@ public class GearReturnExchangeVo {
@ExcelProperty(value = "订单ID")
private Long orderId;
/**
* 销售员ID
*/
private Long salesmanId;
/**
* 销售员姓名
*/
private String salesmanName;
/**
* 客户ID
*/

View File

@@ -12,7 +12,11 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.gear.oa.domain.bo.GearReturnExchangeBo;
import com.gear.oa.domain.vo.GearReturnExchangeVo;
import com.gear.oa.domain.GearOrder;
import com.gear.oa.domain.GearOrderDetail;
import com.gear.oa.domain.GearReturnExchange;
import com.gear.oa.mapper.GearOrderDetailMapper;
import com.gear.oa.mapper.GearOrderMapper;
import com.gear.oa.mapper.GearReturnExchangeMapper;
import com.gear.oa.service.IGearReturnExchangeService;
@@ -31,6 +35,8 @@ import java.util.Collection;
public class GearReturnExchangeServiceImpl implements IGearReturnExchangeService {
private final GearReturnExchangeMapper baseMapper;
private final GearOrderDetailMapper orderDetailMapper;
private final GearOrderMapper orderMapper;
/**
* 查询退换货管理
@@ -103,6 +109,9 @@ public class GearReturnExchangeServiceImpl implements IGearReturnExchangeService
*/
@Override
public Boolean insertByBo(GearReturnExchangeBo bo) {
if (bo.getSalesmanId() == null) {
bo.setSalesmanId(resolveSalesmanIdByOrderDetail(bo.getOrderDetailId()));
}
GearReturnExchange add = BeanUtil.toBean(bo, GearReturnExchange.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
@@ -117,11 +126,29 @@ public class GearReturnExchangeServiceImpl implements IGearReturnExchangeService
*/
@Override
public Boolean updateByBo(GearReturnExchangeBo bo) {
if (bo.getSalesmanId() == null) {
bo.setSalesmanId(resolveSalesmanIdByOrderDetail(bo.getOrderDetailId()));
}
GearReturnExchange update = BeanUtil.toBean(bo, GearReturnExchange.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
private Long resolveSalesmanIdByOrderDetail(Long orderDetailId) {
if (orderDetailId == null) {
return null;
}
GearOrderDetail detail = orderDetailMapper.selectById(orderDetailId);
if (detail == null || detail.getOrderId() == null) {
return null;
}
GearOrder order = orderMapper.selectById(detail.getOrderId());
if (order == null) {
return null;
}
return order.getSalesmanId();
}
/**
* 保存前的数据校验
*/

View File

@@ -12,6 +12,7 @@
<result property="reason" column="reason"/>
<result property="status" column="status"/>
<result property="amount" column="amount"/>
<result property="salesmanId" column="salesman_id"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
@@ -28,12 +29,17 @@
gre.reason,
gre.status,
gre.amount,
(CASE
WHEN o.salesman_id IS NOT NULL THEN o.salesman_id
ELSE gre.salesman_id
END) AS salesmanId,
gre.del_flag,
gre.create_time,
gre.create_by,
gre.update_time,
gre.update_by,
god.order_id,
gs.name AS salesmanName,
gp.product_id AS productId,
gp.product_code AS productCode,
gp.product_name AS productName,
@@ -44,6 +50,8 @@
god.no_tax_price AS noTaxPrice
FROM gear_return_exchange gre
LEFT JOIN gear_order_detail god ON gre.order_detail_id = god.detail_id
LEFT JOIN gear_order o ON god.order_id = o.order_id AND o.del_flag = 0
LEFT JOIN gear_salesman gs ON o.salesman_id = gs.salesman_id AND gs.del_flag = 0
LEFT JOIN gear_product gp ON god.product_id = gp.product_id
LEFT JOIN gear_customer gc ON gre.customer_id = gc.customer_id
${ew.customSqlSegment}