feat(crm): 添加根据钢卷ID查询订单信息功能
- 在CrmOrderController中新增getOrderByCoilId接口 - 实现钢卷ID到订单信息的查询链路:钢卷ID -> 发货明细 -> 发货单 -> 订单 - 添加WMS发货单和发货明细相关依赖注入 - 优化CrmOrderMapper.xml中的SQL字段对齐格式 - 提供null值检查和错误响应处理
This commit is contained in:
@@ -157,4 +157,20 @@ public class CrmOrderController extends BaseController {
|
|||||||
List<CrmOrderVo> orders = iCrmOrderService.queryByIds(orderIds);
|
List<CrmOrderVo> orders = iCrmOrderService.queryByIds(orderIds);
|
||||||
return R.ok(orders);
|
return R.ok(orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据钢卷ID查询对应的订单信息(含客户信息)
|
||||||
|
* 查询链路:钢卷ID -> 发货明细 -> 发货单 -> 订单
|
||||||
|
*
|
||||||
|
* @param coilId 钢卷ID
|
||||||
|
*/
|
||||||
|
@GetMapping("/getOrderByCoilId/{coilId}")
|
||||||
|
public R<CrmOrderVo> getOrderByCoilId(@NotNull(message = "钢卷ID不能为空")
|
||||||
|
@PathVariable Long coilId) {
|
||||||
|
CrmOrderVo order = iCrmOrderService.getOrderByCoilId(coilId);
|
||||||
|
if (order == null) {
|
||||||
|
return R.fail("未找到该钢卷对应的订单信息");
|
||||||
|
}
|
||||||
|
return R.ok(order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ public interface ICrmOrderService {
|
|||||||
*/
|
*/
|
||||||
List<CrmOrderVo> queryList(CrmOrderBo bo);
|
List<CrmOrderVo> queryList(CrmOrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据钢卷ID查询对应的订单信息(含客户信息)
|
||||||
|
* 查询链路:钢卷ID -> 发货明细 -> 发货单 -> 订单
|
||||||
|
*/
|
||||||
|
CrmOrderVo getOrderByCoilId(Long coilId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增正式订单主
|
* 新增正式订单主
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ import com.klp.domain.bo.WmsMaterialCoilBo;
|
|||||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||||
import com.klp.service.IWmsCoilContractRelService;
|
import com.klp.service.IWmsCoilContractRelService;
|
||||||
import com.klp.service.IWmsMaterialCoilService;
|
import com.klp.service.IWmsMaterialCoilService;
|
||||||
|
import com.klp.domain.WmsDeliveryWaybill;
|
||||||
|
import com.klp.domain.WmsDeliveryWaybillDetail;
|
||||||
|
import com.klp.mapper.WmsDeliveryWaybillDetailMapper;
|
||||||
|
import com.klp.mapper.WmsDeliveryWaybillMapper;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -45,6 +49,10 @@ public class CrmOrderServiceImpl implements ICrmOrderService {
|
|||||||
|
|
||||||
private final IWmsMaterialCoilService materialCoilService;
|
private final IWmsMaterialCoilService materialCoilService;
|
||||||
|
|
||||||
|
private final WmsDeliveryWaybillDetailMapper wmsDeliveryWaybillDetailMapper;
|
||||||
|
|
||||||
|
private final WmsDeliveryWaybillMapper wmsDeliveryWaybillMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询正式订单主
|
* 查询正式订单主
|
||||||
*/
|
*/
|
||||||
@@ -66,6 +74,27 @@ public class CrmOrderServiceImpl implements ICrmOrderService {
|
|||||||
return baseMapper.selectVoList(lqw);
|
return baseMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据钢卷ID查询对应的订单信息(含客户信息)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CrmOrderVo getOrderByCoilId(Long coilId) {
|
||||||
|
LambdaQueryWrapper<WmsDeliveryWaybillDetail> detailQuery = Wrappers.lambdaQuery();
|
||||||
|
detailQuery.eq(WmsDeliveryWaybillDetail::getCoilId, coilId);
|
||||||
|
detailQuery.eq(WmsDeliveryWaybillDetail::getDelFlag, 0);
|
||||||
|
WmsDeliveryWaybillDetail detail = wmsDeliveryWaybillDetailMapper.selectOne(detailQuery);
|
||||||
|
if (detail == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
WmsDeliveryWaybill waybill = wmsDeliveryWaybillMapper.selectById(detail.getWaybillId());
|
||||||
|
if (waybill == null || waybill.getOrderId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryById(String.valueOf(waybill.getOrderId()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询正式订单主列表
|
* 查询正式订单主列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -157,9 +157,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
co.deposit_ratio AS depositRatio,
|
co.deposit_ratio AS depositRatio,
|
||||||
co.status,
|
co.status,
|
||||||
co.contract_id AS contractId,
|
co.contract_id AS contractId,
|
||||||
co.annex_files AS annexFiles,
|
co.annex_files AS annexFiles,
|
||||||
co.is_top AS isTop,
|
co.is_top AS isTop,
|
||||||
co.create_by AS createBy,
|
co.create_by AS createBy,
|
||||||
co.create_time AS createTime,
|
co.create_time AS createTime,
|
||||||
co.update_by AS updateBy,
|
co.update_by AS updateBy,
|
||||||
co.update_time AS updateTime,
|
co.update_time AS updateTime,
|
||||||
|
|||||||
Reference in New Issue
Block a user