Merge branch 'refs/heads/feature/DM/nflg-bom-dq' into feature/DM/nflg-bom
This commit is contained in:
commit
e5bf19a2ac
|
|
@ -254,9 +254,9 @@ public class DQBomApi extends BaseApi {
|
|||
* @param query 查询条件
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("queryMaterial")
|
||||
@PostMapping("queryMaterials")
|
||||
@ApiOperation("批量查询物料信息")
|
||||
public ResultVO<List<BaseMaterialVO>> queryMaterial(@Valid @RequestBody QueryMaterialsQuery query) {
|
||||
public ResultVO<List<BaseMaterialVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQuery> query) {
|
||||
return ResultVO.success(dQBomService.queryMaterials(query));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/5/25 14:17:04
|
||||
|
|
@ -19,16 +15,14 @@ import java.util.List;
|
|||
public class QueryMaterialsQuery {
|
||||
|
||||
/**
|
||||
* 数据类别,0-物料编号;1-图号
|
||||
* 图号
|
||||
*/
|
||||
@ApiModelProperty(value = "数据类别,0-物料编号;1-图号")
|
||||
@NotNull
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "图号")
|
||||
private String drawingNo;
|
||||
|
||||
/**
|
||||
* 物料编号或者图号
|
||||
* 物料编码
|
||||
*/
|
||||
@ApiModelProperty(value = "物料编号或者图号")
|
||||
@NotEmpty
|
||||
private List<String> keys;
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
private String materialNo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
|
||||
|
|
@ -26,7 +25,6 @@ import com.nflg.product.bomnew.util.BomUtil;
|
|||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -668,13 +666,23 @@ public class DQBomService {
|
|||
return datas;
|
||||
}
|
||||
|
||||
public List<BaseMaterialVO> queryMaterials(QueryMaterialsQuery query) {
|
||||
if (query.getType() == 0) {
|
||||
return SpringUtil.getBean(MaterialMainMapper.class).getMaterialBaseInfo(query.getKeys());
|
||||
} else if (query.getType() == 1) {
|
||||
return SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(query.getKeys());
|
||||
} else {
|
||||
throw new NflgBusinessException(STATE.BusinessError, "无效的类别");
|
||||
public List<BaseMaterialVO> queryMaterials(List<QueryMaterialsQuery> query) {
|
||||
List<BaseMaterialVO> datas = new ArrayList<>();
|
||||
List<String> keys = query.stream().map(QueryMaterialsQuery::getMaterialNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(keys)) {
|
||||
datas.addAll(SpringUtil.getBean(MaterialMainMapper.class).getMaterialBaseInfo(keys));
|
||||
}
|
||||
keys = query.stream()
|
||||
.filter(it -> StrUtil.isBlank(it.getMaterialNo()) && StrUtil.isNotBlank(it.getDrawingNo()))
|
||||
.map(QueryMaterialsQuery::getDrawingNo)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(keys)) {
|
||||
datas.addAll(SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(keys));
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue