feat(crm): 新增客户相关订单数据查询接口
- 添加根据客户ID查询异议和财务信息的功能 - 添加根据客户ID查询发货单配卷的功能 - 实现客户订单关联数据的多层查询逻辑 - 集成CRM订单、异议、应收和发货单据的数据关联 - 提供完整的客户订单数据视图支持
This commit is contained in:
@@ -118,4 +118,18 @@ public class CrmOrderItemController extends BaseController {
|
|||||||
@PathVariable Long contractId) {
|
@PathVariable Long contractId) {
|
||||||
return R.ok(iCrmOrderItemService.queryCoilsByContractId(contractId));
|
return R.ok(iCrmOrderItemService.queryCoilsByContractId(contractId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据客户id查询该客户下属订单关联的异议和财务信息。
|
||||||
|
@GetMapping("/customerFinance/{customerId}")
|
||||||
|
public R<CrmContractOrderFinanceVo> getCustomerFinance(@NotNull(message = "客户ID不能为空")
|
||||||
|
@PathVariable String customerId) {
|
||||||
|
return R.ok(iCrmOrderItemService.queryFinanceAndObjectionByCustomerId(customerId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据客户id查询发货单据中的配卷。
|
||||||
|
@GetMapping("/coils/customer/{customerId}")
|
||||||
|
public R<List<WmsMaterialCoilVo>> getCoilsByCustomerId(@NotNull(message = "客户ID不能为空")
|
||||||
|
@PathVariable String customerId) {
|
||||||
|
return R.ok(iCrmOrderItemService.queryCoilsByCustomerId(customerId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,4 +65,14 @@ public interface ICrmOrderItemService {
|
|||||||
* 根据合同ID查询发货单配卷
|
* 根据合同ID查询发货单配卷
|
||||||
*/
|
*/
|
||||||
List<WmsMaterialCoilVo> queryCoilsByContractId(Long contractId);
|
List<WmsMaterialCoilVo> queryCoilsByContractId(Long contractId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户ID查询下属订单的异议和财务信息
|
||||||
|
*/
|
||||||
|
CrmContractOrderFinanceVo queryFinanceAndObjectionByCustomerId(String customerId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户ID查询发货单配卷
|
||||||
|
*/
|
||||||
|
List<WmsMaterialCoilVo> queryCoilsByCustomerId(String customerId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,4 +249,77 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
|
|||||||
coilBo.setCoilIds(coilIds);
|
coilBo.setCoilIds(coilIds);
|
||||||
return iWmsMaterialCoilService.queryList(coilBo);
|
return iWmsMaterialCoilService.queryList(coilBo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CrmContractOrderFinanceVo queryFinanceAndObjectionByCustomerId(String customerId) {
|
||||||
|
CrmContractOrderFinanceVo result = new CrmContractOrderFinanceVo();
|
||||||
|
|
||||||
|
LambdaQueryWrapper<CrmOrder> orderWrapper = new LambdaQueryWrapper<>();
|
||||||
|
orderWrapper.eq(CrmOrder::getCustomerId, customerId);
|
||||||
|
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<>();
|
||||||
|
objectionWrapper.in(CrmSalesObjection::getOrderId, orderIds);
|
||||||
|
List<CrmSalesObjectionVo> objectionList = crmSalesObjectionMapper.selectVoList(objectionWrapper);
|
||||||
|
result.setObjectionList(objectionList);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<com.klp.domain.WmsReceivable> receivableWrapper = new LambdaQueryWrapper<>();
|
||||||
|
receivableWrapper.in(WmsReceivable::getOrderId, orderIds);
|
||||||
|
List<WmsReceivableVo> receivableList = wmsReceivableMapper.selectVoList(receivableWrapper);
|
||||||
|
result.setReceivableList(receivableList);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WmsMaterialCoilVo> queryCoilsByCustomerId(String customerId) {
|
||||||
|
LambdaQueryWrapper<CrmOrder> orderWrapper = new LambdaQueryWrapper<>();
|
||||||
|
orderWrapper.eq(CrmOrder::getCustomerId, customerId);
|
||||||
|
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<>();
|
||||||
|
waybillWrapper.in(WmsDeliveryWaybill::getOrderId, orderIds);
|
||||||
|
List<WmsDeliveryWaybill> waybills = wmsDeliveryWaybillMapper.selectList(waybillWrapper);
|
||||||
|
|
||||||
|
if (waybills == null || waybills.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> waybillIds = waybills.stream()
|
||||||
|
.map(WmsDeliveryWaybill::getWaybillId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
LambdaQueryWrapper<WmsDeliveryWaybillDetail> detailWrapper = new LambdaQueryWrapper<>();
|
||||||
|
detailWrapper.in(WmsDeliveryWaybillDetail::getWaybillId, waybillIds);
|
||||||
|
List<WmsDeliveryWaybillDetail> details = wmsDeliveryWaybillDetailMapper.selectList(detailWrapper);
|
||||||
|
|
||||||
|
if (details == null || details.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
String coilIds = details.stream()
|
||||||
|
.map(WmsDeliveryWaybillDetail::getCoilId)
|
||||||
|
.map(String::valueOf)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
WmsMaterialCoilBo coilBo = new WmsMaterialCoilBo();
|
||||||
|
coilBo.setCoilIds(coilIds);
|
||||||
|
return iWmsMaterialCoilService.queryList(coilBo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user