optimize(ebom反查): 修复一些问题;数量限制为1000条
This commit is contained in:
parent
e64860e506
commit
80d321c4b2
|
|
@ -15,11 +15,11 @@ import java.util.Objects;
|
||||||
@Data
|
@Data
|
||||||
public class ReverseReportVO {
|
public class ReverseReportVO {
|
||||||
|
|
||||||
@ApiModelProperty("bom-rowId(parent表)")
|
// @ApiModelProperty("bom-rowId(parent表)")
|
||||||
private Long rowId;
|
// private Long rowId;
|
||||||
|
|
||||||
@ApiModelProperty("层级")
|
// @ApiModelProperty("层级")
|
||||||
private String orderNumber;
|
// private String orderNumber;
|
||||||
|
|
||||||
@ApiModelProperty("图号")
|
@ApiModelProperty("图号")
|
||||||
private String drawingNo;
|
private String drawingNo;
|
||||||
|
|
@ -33,8 +33,8 @@ public class ReverseReportVO {
|
||||||
@ApiModelProperty("项目类别")
|
@ApiModelProperty("项目类别")
|
||||||
private String projectType;
|
private String projectType;
|
||||||
|
|
||||||
@ApiModelProperty("物料类别名称")
|
// @ApiModelProperty("物料类别名称")
|
||||||
private String materialCategoryName;
|
// private String materialCategoryName;
|
||||||
|
|
||||||
@ApiModelProperty("物料描述")
|
@ApiModelProperty("物料描述")
|
||||||
private String materialDesc;
|
private String materialDesc;
|
||||||
|
|
@ -54,11 +54,11 @@ public class ReverseReportVO {
|
||||||
@ApiModelProperty(value = "版本过期时间=下个版本的创建时间")
|
@ApiModelProperty(value = "版本过期时间=下个版本的创建时间")
|
||||||
private LocalDateTime expireEndTime;
|
private LocalDateTime expireEndTime;
|
||||||
|
|
||||||
@ApiModelProperty("是否子级 0-否 1-是")
|
// @ApiModelProperty("是否子级 0-否 1-是")
|
||||||
private Integer childIs;
|
// private Integer childIs;
|
||||||
|
//
|
||||||
@ApiModelProperty("父级行ID")
|
// @ApiModelProperty("父级行ID")
|
||||||
private Long parentRowId;
|
// private Long parentRowId;
|
||||||
|
|
||||||
@ApiModelProperty("子级报表")
|
@ApiModelProperty("子级报表")
|
||||||
private String childDrawingNo;
|
private String childDrawingNo;
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,14 @@ package com.nflg.product.bomnew.service.domain.ReverseReport;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentFormalEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentFormalEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||||
import com.nflg.product.bomnew.service.*;
|
import com.nflg.product.bomnew.service.*;
|
||||||
|
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -43,12 +45,18 @@ public class EBomQueryService {
|
||||||
@Resource
|
@Resource
|
||||||
MaterialMainService materialMainService;
|
MaterialMainService materialMainService;
|
||||||
|
|
||||||
|
private static final ThreadLocal<Boolean> ADD = new ThreadLocal<>();
|
||||||
|
|
||||||
public void report(ReverseReportQuery queryParam , List<ReverseReportVO> result) {
|
public void report(ReverseReportQuery queryParam , List<ReverseReportVO> result) {
|
||||||
if(queryParam.getQueryType().equals(0)) {
|
if(queryParam.getQueryType().equals(0)) {
|
||||||
result.addAll(singleLevelReport(queryParam));
|
result.addAll(singleLevelReport(queryParam));
|
||||||
}else {
|
}else {
|
||||||
result.addAll(multipleLevelReport(queryParam));
|
try {
|
||||||
|
ADD.set(true);
|
||||||
|
result.addAll(multipleLevelReport(queryParam));
|
||||||
|
} finally {
|
||||||
|
ADD.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,7 +108,20 @@ public class EBomQueryService {
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(version)) {
|
if (StrUtil.isBlank(version)) {
|
||||||
List<BomNewPbomParentVO> pVOs = ebomChildFormalService.getSuperiorByMaterialNo(queryParam.getMaterialNo());
|
List<BomNewPbomParentVO> pVOs = ebomChildFormalService.getSuperiorByMaterialNo(queryParam.getMaterialNo());
|
||||||
|
List<String> materialNos = pVOs.stream().map(BomNewPbomParentVO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(materialNos);
|
||||||
pVOs.forEach(p -> {
|
pVOs.forEach(p -> {
|
||||||
|
if (!ADD.get()) return;
|
||||||
|
BaseMaterialVO materialMainEntity = materialVOS.stream()
|
||||||
|
.filter(m -> StrUtil.equals(m.getMaterialNo(), p.getMaterialNo()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (Objects.nonNull(materialMainEntity)) {
|
||||||
|
if (MaterialshouldBomExistUtil.checkShouldBomExist(materialMainEntity.getMaterialCategoryCode()
|
||||||
|
, materialMainEntity.getMaterialGetType())) {
|
||||||
|
p.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||||
|
}
|
||||||
|
}
|
||||||
vos.add(createVO(p, 1));
|
vos.add(createVO(p, 1));
|
||||||
bindData(p, 1, vos);
|
bindData(p, 1, vos);
|
||||||
});
|
});
|
||||||
|
|
@ -113,6 +134,7 @@ public class EBomQueryService {
|
||||||
|
|
||||||
List<BomNewPbomParentVO> pVOs = getSuperiors(parent.getRowId());
|
List<BomNewPbomParentVO> pVOs = getSuperiors(parent.getRowId());
|
||||||
pVOs.forEach(p -> {
|
pVOs.forEach(p -> {
|
||||||
|
if (!ADD.get()) return;
|
||||||
vos.add(createVO(p, 1));
|
vos.add(createVO(p, 1));
|
||||||
bindData(p, 1, vos);
|
bindData(p, 1, vos);
|
||||||
});
|
});
|
||||||
|
|
@ -136,14 +158,20 @@ public class EBomQueryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindData(BomNewPbomParentVO pVO, Integer level, List<ReverseReportVO> vos) {
|
private void bindData(BomNewPbomParentVO pVO, Integer level, List<ReverseReportVO> vos) {
|
||||||
|
if (!ADD.get()) return;
|
||||||
if (Objects.nonNull(pVO.getParentRowId())) {
|
if (Objects.nonNull(pVO.getParentRowId())) {
|
||||||
List<BomNewPbomParentVO> parents = getSuperiors(pVO.getParentRowId());
|
List<BomNewPbomParentVO> parents = getSuperiors(pVO.getParentRowId());
|
||||||
level++;
|
level++;
|
||||||
Integer finalLevel = level;
|
Integer finalLevel = level;
|
||||||
parents.forEach(it -> {
|
for (BomNewPbomParentVO it : parents) {
|
||||||
|
if (!ADD.get()) return;
|
||||||
vos.add(createVO(it, finalLevel));
|
vos.add(createVO(it, finalLevel));
|
||||||
|
if (vos.size() >= 1000) {
|
||||||
|
ADD.set(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
bindData(it, finalLevel, vos);
|
bindData(it, finalLevel, vos);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<select id="getSuperiorByMaterialNo" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
<select id="getSuperiorByMaterialNo" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||||
SELECT cf.num, cf.project_type, cf.parent_row_id parentRowId, pf.*
|
SELECT pf.row_id parentRowId, pf.expire_end_time, pf.current_version, cf.*
|
||||||
FROM t_bom_new_ebom_child_formal cf
|
FROM t_bom_new_ebom_child_formal cf
|
||||||
INNER JOIN t_bom_new_ebom_parent_formal pf ON cf.bom_version_row_id = pf.row_id
|
INNER JOIN t_bom_new_ebom_parent_formal pf ON cf.parent_row_id = pf.row_id
|
||||||
WHERE cf.material_no = #{materialNo}
|
WHERE cf.material_no = #{materialNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue