fix(order): 修复合同ID查询逻辑错误

- 修正了销售异议查询中的订单ID参数错误
- 修正了应收账款查询中的订单ID参数错误
- 修正了运单查询中的订单ID参数错误
- 简化了合同ID直接查询逻辑,移除冗余订单查询步骤
- 修复了线圈材料查询中的订单ID条件错误
This commit is contained in:
2026-07-05 10:14:46 +08:00
parent 7d65f76923
commit 660e8049cd

View File

@@ -259,30 +259,18 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
public CrmContractOrderFinanceVo queryFinanceAndObjectionByContractId(Long contractId) { public CrmContractOrderFinanceVo queryFinanceAndObjectionByContractId(Long contractId) {
CrmContractOrderFinanceVo result = new CrmContractOrderFinanceVo(); CrmContractOrderFinanceVo result = new CrmContractOrderFinanceVo();
LambdaQueryWrapper<CrmOrder> orderWrapper = new LambdaQueryWrapper<>();
orderWrapper.eq(CrmOrder::getContractId, contractId);
List<CrmOrder> orders = crmOrderMapper.selectList(orderWrapper);
if (orders == null || orders.isEmpty()) {
return result;
}
List<Long> orderIds = orders.stream()
.map(CrmOrder::getOrderId)
.collect(Collectors.toList());
LambdaQueryWrapper<CrmSalesObjection> objectionWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CrmSalesObjection> objectionWrapper = new LambdaQueryWrapper<>();
objectionWrapper.in(CrmSalesObjection::getOrderId, orderIds); objectionWrapper.in(CrmSalesObjection::getOrderId, contractId);
List<CrmSalesObjectionVo> objectionList = crmSalesObjectionMapper.selectVoList(objectionWrapper); List<CrmSalesObjectionVo> objectionList = crmSalesObjectionMapper.selectVoList(objectionWrapper);
result.setObjectionList(objectionList); result.setObjectionList(objectionList);
LambdaQueryWrapper<com.klp.domain.WmsReceivable> receivableWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<com.klp.domain.WmsReceivable> receivableWrapper = new LambdaQueryWrapper<>();
receivableWrapper.in(WmsReceivable::getOrderId, orderIds); receivableWrapper.in(WmsReceivable::getOrderId, contractId);
List<WmsReceivableVo> receivableList = wmsReceivableMapper.selectVoList(receivableWrapper); List<WmsReceivableVo> receivableList = wmsReceivableMapper.selectVoList(receivableWrapper);
result.setReceivableList(receivableList); result.setReceivableList(receivableList);
LambdaQueryWrapper<WmsDeliveryWaybill> waybillWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WmsDeliveryWaybill> waybillWrapper = new LambdaQueryWrapper<>();
waybillWrapper.in(WmsDeliveryWaybill::getOrderId, orderIds); waybillWrapper.in(WmsDeliveryWaybill::getOrderId, contractId);
List<WmsDeliveryWaybillVo> wmsDeliveryWaybills = wmsDeliveryWaybillMapper.selectVoList(waybillWrapper); List<WmsDeliveryWaybillVo> wmsDeliveryWaybills = wmsDeliveryWaybillMapper.selectVoList(waybillWrapper);
result.setWmsDeliveryWaybills(wmsDeliveryWaybills); result.setWmsDeliveryWaybills(wmsDeliveryWaybills);
@@ -442,18 +430,9 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
@Override @Override
public List<WmsMaterialCoilVo> queryCoilsByContractId(Long contractId) { public List<WmsMaterialCoilVo> queryCoilsByContractId(Long contractId) {
LambdaQueryWrapper<CrmOrder> orderWrapper = new LambdaQueryWrapper<>();
orderWrapper.eq(CrmOrder::getContractId, contractId);
List<CrmOrder> orders = crmOrderMapper.selectList(orderWrapper);
if (orders == null || orders.isEmpty()) {
return Collections.emptyList();
}
List<Long> orderIds = orders.stream()
.map(CrmOrder::getOrderId)
.collect(Collectors.toList());
LambdaQueryWrapper<WmsDeliveryWaybill> waybillWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WmsDeliveryWaybill> waybillWrapper = new LambdaQueryWrapper<>();
waybillWrapper.in(WmsDeliveryWaybill::getOrderId, orderIds); waybillWrapper.eq(WmsDeliveryWaybill::getOrderId, contractId);
List<WmsDeliveryWaybill> waybills = wmsDeliveryWaybillMapper.selectList(waybillWrapper); List<WmsDeliveryWaybill> waybills = wmsDeliveryWaybillMapper.selectList(waybillWrapper);
if (waybills == null || waybills.isEmpty()) { if (waybills == null || waybills.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();