optimize(dqbom): 优化查询物料信息接口
This commit is contained in:
parent
e3488681d1
commit
4b80bda416
|
|
@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 曹鹏飞
|
* @author 曹鹏飞
|
||||||
* @date 2024/5/25 14:17:04
|
* @date 2024/5/25 14:17:04
|
||||||
|
|
@ -25,4 +27,16 @@ public class QueryMaterialsQuery {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "物料编码")
|
@ApiModelProperty(value = "物料编码")
|
||||||
private String materialNo;
|
private String materialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单重
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "单重")
|
||||||
|
private BigDecimal unitWeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目类别
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("项目类别")
|
||||||
|
private String projectType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,23 @@ public class DQBomService {
|
||||||
if (CollUtil.isNotEmpty(keys)) {
|
if (CollUtil.isNotEmpty(keys)) {
|
||||||
datas.addAll(SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(keys));
|
datas.addAll(SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(keys));
|
||||||
}
|
}
|
||||||
return Convert.toList(QueryMaterialsVO.class, datas);
|
List<QueryMaterialsVO> vos = Convert.toList(QueryMaterialsVO.class, datas);
|
||||||
|
query.forEach(it -> {
|
||||||
|
if (Objects.nonNull(it.getUnitWeight()) || StrUtil.isNotBlank(it.getProjectType())) {
|
||||||
|
QueryMaterialsVO vo = vos.stream().filter(m -> StrUtil.equals(m.getMaterialNo(), it.getMaterialNo())
|
||||||
|
|| StrUtil.equals(m.getDrawingNo(), it.getDrawingNo()))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
if (Objects.nonNull(vo)) {
|
||||||
|
if (Objects.nonNull(it.getUnitWeight())) {
|
||||||
|
vo.setUnitWeight(it.getUnitWeight());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(it.getProjectType())) {
|
||||||
|
vo.setProjectType(it.getProjectType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return vos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryMaterialsVO queryMaterial(QueryMaterialsQuery query) {
|
public QueryMaterialsVO queryMaterial(QueryMaterialsQuery query) {
|
||||||
|
|
@ -694,7 +710,14 @@ public class DQBomService {
|
||||||
vos = SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(Collections.singletonList(query.getDrawingNo()));
|
vos = SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(Collections.singletonList(query.getDrawingNo()));
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(vos)) {
|
if (CollUtil.isNotEmpty(vos)) {
|
||||||
return Convert.convert(QueryMaterialsVO.class, vos.get(0));
|
QueryMaterialsVO vo = Convert.convert(QueryMaterialsVO.class, vos.get(0));
|
||||||
|
if (Objects.nonNull(query.getUnitWeight())) {
|
||||||
|
vo.setUnitWeight(query.getUnitWeight());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(query.getProjectType())) {
|
||||||
|
vo.setProjectType(query.getProjectType());
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue