feat(order): 订单项查询中增加订单详情信息
- 在 CrmOrderBo 中新增 orderIds 字段用于批量查询 - 在 CrmOrderItemServiceImpl 中注入 ICrmOrderService 并实现订单信息关联查询 - 在 CrmOrderItemVo 中新增 orderInfo 字段存储订单详情 - 扩展 CrmOrderMapper 接口增加 selectVoPagePlus 批量查询方法 - 修改 CrmOrderServiceImpl 查询逻辑支持按订单ID列表过滤 - 在订单项分页查询时批量获取并关联订单基本信息
This commit is contained in:
@@ -7,6 +7,8 @@ import javax.validation.constraints.*;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
@@ -245,5 +247,7 @@ public class CrmOrderBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
|
private List<Long> orderIds;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,4 +173,9 @@ public class CrmOrderItemVo {
|
|||||||
@ExcelProperty(value = "用途")
|
@ExcelProperty(value = "用途")
|
||||||
private String purpose;
|
private String purpose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息
|
||||||
|
*/
|
||||||
|
private CrmOrderVo orderInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.klp.crm.domain.vo.CrmOrderVo;
|
|||||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 正式订单主Mapper接口
|
* 正式订单主Mapper接口
|
||||||
*
|
*
|
||||||
@@ -16,6 +18,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
public interface CrmOrderMapper extends BaseMapperPlus<CrmOrderMapper, CrmOrder, CrmOrderVo> {
|
public interface CrmOrderMapper extends BaseMapperPlus<CrmOrderMapper, CrmOrder, CrmOrderVo> {
|
||||||
|
|
||||||
Page<CrmOrderVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<CrmOrder> lqw);
|
Page<CrmOrderVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<CrmOrder> lqw);
|
||||||
|
List<CrmOrderVo> selectVoPagePlus(@Param("ew") QueryWrapper<CrmOrder> qw);
|
||||||
|
|
||||||
CrmOrderVo selectVoById(@Param("orderId") String orderId);
|
CrmOrderVo selectVoById(@Param("orderId") String orderId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.klp.common.utils.StringUtils;
|
import com.klp.common.utils.StringUtils;
|
||||||
import com.klp.crm.domain.CrmSalesObjection;
|
import com.klp.crm.domain.CrmSalesObjection;
|
||||||
|
import com.klp.crm.domain.bo.CrmOrderBo;
|
||||||
|
import com.klp.crm.domain.vo.CrmOrderVo;
|
||||||
|
import com.klp.crm.service.ICrmOrderService;
|
||||||
import com.klp.domain.WmsMaterialCoil;
|
import com.klp.domain.WmsMaterialCoil;
|
||||||
import com.klp.domain.WmsReceivable;
|
import com.klp.domain.WmsReceivable;
|
||||||
import com.klp.domain.vo.WmsDeliveryWaybillVo;
|
import com.klp.domain.vo.WmsDeliveryWaybillVo;
|
||||||
@@ -49,6 +52,7 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
|
|||||||
|
|
||||||
private final CrmOrderItemMapper baseMapper;
|
private final CrmOrderItemMapper baseMapper;
|
||||||
private final CrmOrderMapper crmOrderMapper;
|
private final CrmOrderMapper crmOrderMapper;
|
||||||
|
private final ICrmOrderService crmOrderService;
|
||||||
private final CrmSalesObjectionMapper crmSalesObjectionMapper;
|
private final CrmSalesObjectionMapper crmSalesObjectionMapper;
|
||||||
private final WmsReceivableMapper wmsReceivableMapper;
|
private final WmsReceivableMapper wmsReceivableMapper;
|
||||||
private final WmsDeliveryWaybillMapper wmsDeliveryWaybillMapper;
|
private final WmsDeliveryWaybillMapper wmsDeliveryWaybillMapper;
|
||||||
@@ -70,6 +74,24 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
|
|||||||
public TableDataInfo<CrmOrderItemVo> queryPageList(CrmOrderItemBo bo, PageQuery pageQuery) {
|
public TableDataInfo<CrmOrderItemVo> queryPageList(CrmOrderItemBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<CrmOrderItem> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<CrmOrderItem> lqw = buildQueryWrapper(bo);
|
||||||
Page<CrmOrderItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<CrmOrderItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
List<CrmOrderItemVo> records = result.getRecords();
|
||||||
|
if (records != null && !records.isEmpty()) {
|
||||||
|
List<Long> orderIds = records.stream()
|
||||||
|
.map(CrmOrderItemVo::getOrderId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!orderIds.isEmpty()) {
|
||||||
|
CrmOrderBo crmOrder = new CrmOrderBo();
|
||||||
|
crmOrder.setOrderIds(orderIds);
|
||||||
|
List<CrmOrderVo> orderList = crmOrderService.queryList(crmOrder);
|
||||||
|
Map<Long, CrmOrderVo> orderMap = orderList.stream()
|
||||||
|
.collect(Collectors.toMap(CrmOrderVo::getOrderId, o -> o, (a, b) -> a));
|
||||||
|
for (CrmOrderItemVo item : records) {
|
||||||
|
item.setOrderInfo(orderMap.get(item.getOrderId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -238,11 +238,14 @@ public class CrmOrderServiceImpl implements ICrmOrderService {
|
|||||||
qw.eq(bo.getContractId() != null, "co.contract_id", bo.getContractId());
|
qw.eq(bo.getContractId() != null, "co.contract_id", bo.getContractId());
|
||||||
qw.like(StringUtils.isNotBlank(bo.getAnnexFiles()), "co.annex_files", bo.getAnnexFiles());
|
qw.like(StringUtils.isNotBlank(bo.getAnnexFiles()), "co.annex_files", bo.getAnnexFiles());
|
||||||
qw.eq(bo.getIsTop() != null, "co.is_top", bo.getIsTop());
|
qw.eq(bo.getIsTop() != null, "co.is_top", bo.getIsTop());
|
||||||
|
if(bo.getOrderIds() !=null){
|
||||||
|
qw.in(!bo.getOrderIds().isEmpty(), "co.order_id", bo.getOrderIds());
|
||||||
|
}
|
||||||
//逻辑删除
|
//逻辑删除
|
||||||
qw.eq("co.del_flag", 0);
|
qw.eq("co.del_flag", 0);
|
||||||
//排序规则:
|
//排序规则:
|
||||||
// 1. 置顶优先 (is_top=1 排在前面)
|
// 1. 置顶优先 (is_top=1 排在前面)
|
||||||
// 2. 状态为1(已生效)的排在前面
|
// 2. 状态为1(已生效)的排在前面
|
||||||
// 3. 创建时间倒序
|
// 3. 创建时间倒序
|
||||||
qw.orderByDesc("co.is_top")
|
qw.orderByDesc("co.is_top")
|
||||||
.orderByDesc("CASE WHEN co.status = 1 THEN 1 ELSE 0 END")
|
.orderByDesc("CASE WHEN co.status = 1 THEN 1 ELSE 0 END")
|
||||||
@@ -255,62 +258,8 @@ public class CrmOrderServiceImpl implements ICrmOrderService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CrmOrderVo> queryList(CrmOrderBo bo) {
|
public List<CrmOrderVo> queryList(CrmOrderBo bo) {
|
||||||
LambdaQueryWrapper<CrmOrder> lqw = buildQueryWrapper(bo);
|
QueryWrapper<CrmOrder> lqw = buildQueryWrapperPlus(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
return baseMapper.selectVoPagePlus(lqw);
|
||||||
}
|
|
||||||
|
|
||||||
private LambdaQueryWrapper<CrmOrder> buildQueryWrapper(CrmOrderBo bo) {
|
|
||||||
Map<String, Object> params = bo.getParams();
|
|
||||||
LambdaQueryWrapper<CrmOrder> lqw = Wrappers.lambdaQuery();
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getOrderCode()), CrmOrder::getOrderCode, bo.getOrderCode());
|
|
||||||
lqw.eq(bo.getOrderType() != null, CrmOrder::getOrderType, bo.getOrderType());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getCustomerId()), CrmOrder::getCustomerId, bo.getCustomerId());
|
|
||||||
lqw.eq(bo.getOrderAmount() != null, CrmOrder::getOrderAmount, bo.getOrderAmount());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getSalesman()), CrmOrder::getSalesman, bo.getSalesman());
|
|
||||||
lqw.eq(bo.getDeliveryDate() != null, CrmOrder::getDeliveryDate, bo.getDeliveryDate());
|
|
||||||
lqw.eq(bo.getPreOrderStatus() != null, CrmOrder::getPreOrderStatus, bo.getPreOrderStatus());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getAuditUser()), CrmOrder::getAuditUser, bo.getAuditUser());
|
|
||||||
lqw.eq(bo.getAuditTime() != null, CrmOrder::getAuditTime, bo.getAuditTime());
|
|
||||||
lqw.eq(bo.getOrderStatus() != null, CrmOrder::getOrderStatus, bo.getOrderStatus());
|
|
||||||
lqw.eq(bo.getFinanceStatus() != null, CrmOrder::getFinanceStatus, bo.getFinanceStatus());
|
|
||||||
lqw.eq(bo.getUnpaidAmount() != null, CrmOrder::getUnpaidAmount, bo.getUnpaidAmount());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getContractCode()), CrmOrder::getContractCode, bo.getContractCode());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getContractName()), CrmOrder::getContractName, bo.getContractName());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getSupplier()), CrmOrder::getSupplier, bo.getSupplier());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCustomer()), CrmOrder::getCustomer, bo.getCustomer());
|
|
||||||
lqw.eq(bo.getSignTime() != null, CrmOrder::getSignTime, bo.getSignTime());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getSignLocation()), CrmOrder::getSignLocation, bo.getSignLocation());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getProductContent()), CrmOrder::getProductContent, bo.getProductContent());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getContractContent()), CrmOrder::getContractContent, bo.getContractContent());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getSupplierAddress()), CrmOrder::getSupplierAddress, bo.getSupplierAddress());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getSupplierPhone()), CrmOrder::getSupplierPhone, bo.getSupplierPhone());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getSupplierBank()), CrmOrder::getSupplierBank, bo.getSupplierBank());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getSupplierAccount()), CrmOrder::getSupplierAccount, bo.getSupplierAccount());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getSupplierTaxNo()), CrmOrder::getSupplierTaxNo, bo.getSupplierTaxNo());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCustomerAddress()), CrmOrder::getCustomerAddress, bo.getCustomerAddress());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCustomerPhone()), CrmOrder::getCustomerPhone, bo.getCustomerPhone());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCustomerBank()), CrmOrder::getCustomerBank, bo.getCustomerBank());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCustomerAccount()), CrmOrder::getCustomerAccount, bo.getCustomerAccount());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCustomerTaxNo()), CrmOrder::getCustomerTaxNo, bo.getCustomerTaxNo());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getTechAnnex()), CrmOrder::getTechAnnex, bo.getTechAnnex());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getBusinessAnnex()), CrmOrder::getBusinessAnnex, bo.getBusinessAnnex());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getProductionSchedule()), CrmOrder::getProductionSchedule, bo.getProductionSchedule());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getUnitPriceRemark()), CrmOrder::getUnitPriceRemark, bo.getUnitPriceRemark());
|
|
||||||
lqw.eq(bo.getDepositPayable() != null, CrmOrder::getDepositPayable, bo.getDepositPayable());
|
|
||||||
lqw.eq(bo.getDepositPaid() != null, CrmOrder::getDepositPaid, bo.getDepositPaid());
|
|
||||||
lqw.eq(bo.getDepositRatio() != null, CrmOrder::getDepositRatio, bo.getDepositRatio());
|
|
||||||
lqw.eq(bo.getStatus() != null, CrmOrder::getStatus, bo.getStatus());
|
|
||||||
lqw.eq(bo.getContractId() != null, CrmOrder::getContractId, bo.getContractId());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getAnnexFiles()), CrmOrder::getAnnexFiles, bo.getAnnexFiles());
|
|
||||||
lqw.eq(bo.getIsTop() != null, CrmOrder::getIsTop, bo.getIsTop());
|
|
||||||
//逻辑删除
|
|
||||||
lqw.eq(CrmOrder::getDelFlag, 0);
|
|
||||||
//排序规则:
|
|
||||||
// 1. 置顶优先 (is_top=1 排在前面)
|
|
||||||
// 2. 状态为1(已生效)的排在前面
|
|
||||||
// 3. 创建时间倒序
|
|
||||||
lqw.last("ORDER BY is_top DESC, CASE WHEN status = 1 THEN 1 ELSE 0 END DESC, create_time DESC");
|
|
||||||
return lqw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user