feat(delivery): 添加按负责人查询已绑定钢卷功能
- 在 IWmsDeliveryWaybillDetailService 中新增 getBoundCoilIdsByPrincipal 方法 - 在 WmsDeliveryWaybillDetailController 中添加 coilListByPrincipal 接口 - 实现 WmsDeliveryWaybillDetailServiceImpl 中的 getBoundCoilIdsByPrincipal 逻辑 - 使用 LambdaQueryWrapper 查询指定负责人的运单及关联钢卷信息 - 添加参数校验和空值处理机制
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.klp.domain.vo.WmsMaterialCoilBindVo;
|
||||
@@ -172,4 +170,21 @@ public class WmsDeliveryWaybillDetailController extends BaseController {
|
||||
bo.setCoilIds(boundCoilIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
||||
return R.ok(iWmsMaterialCoilService.getStatistics(bo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据负责人(principal)查询已发货绑定的钢卷列表
|
||||
*/
|
||||
@GetMapping("/coilListByPrincipal")
|
||||
public List<WmsMaterialCoilVo> coilListByPrincipal(
|
||||
@RequestParam(required = false) String principal) {
|
||||
List<Long> boundCoilIds = iWmsDeliveryWaybillDetailService.getBoundCoilIdsByPrincipal(principal);
|
||||
if (boundCoilIds == null || boundCoilIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
WmsMaterialCoilBo wmsMaterialCoilBo = new WmsMaterialCoilBo();
|
||||
wmsMaterialCoilBo.setCoilIds(boundCoilIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
||||
return iWmsMaterialCoilService.queryList(wmsMaterialCoilBo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,4 +68,9 @@ public interface IWmsDeliveryWaybillDetailService {
|
||||
* 根据时间段查询已绑定的钢卷ID列表
|
||||
*/
|
||||
List<Long> getBoundCoilIdsByTimeRange(Date startTime, Date endTime);
|
||||
|
||||
/**
|
||||
* 根据负责人(principal)查询已绑定的钢卷ID列表
|
||||
*/
|
||||
List<Long> getBoundCoilIdsByPrincipal(String principal);
|
||||
}
|
||||
|
||||
@@ -337,5 +337,30 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
|
||||
List<WmsDeliveryWaybillDetail> list = baseMapper.selectList(detailWrapper);
|
||||
return list.stream().map(WmsDeliveryWaybillDetail::getCoilId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getBoundCoilIdsByPrincipal(String principal) {
|
||||
if (principal == null || principal.trim().isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<WmsDeliveryWaybill> waybillWrapper = Wrappers.lambdaQuery();
|
||||
waybillWrapper.eq(WmsDeliveryWaybill::getPrincipal, principal);
|
||||
waybillWrapper.eq(WmsDeliveryWaybill::getDelFlag, 0);
|
||||
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 = Wrappers.lambdaQuery();
|
||||
detailWrapper.in(WmsDeliveryWaybillDetail::getWaybillId, waybillIds);
|
||||
detailWrapper.isNotNull(WmsDeliveryWaybillDetail::getCoilId);
|
||||
detailWrapper.eq(WmsDeliveryWaybillDetail::getDelFlag, 0);
|
||||
detailWrapper.select(WmsDeliveryWaybillDetail::getCoilId);
|
||||
List<WmsDeliveryWaybillDetail> list = baseMapper.selectList(detailWrapper);
|
||||
return list.stream().map(WmsDeliveryWaybillDetail::getCoilId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user