optimize(ebom): 优化性能
This commit is contained in:
parent
0e7cc1e877
commit
3762a37841
|
|
@ -174,8 +174,6 @@ public class OriginalBomApi extends BaseApi {
|
||||||
ebomParentService.getBaseMapper().updateRootState();
|
ebomParentService.getBaseMapper().updateRootState();
|
||||||
ebomParentService.getBaseMapper().updateRootForWaitReview();
|
ebomParentService.getBaseMapper().updateRootForWaitReview();
|
||||||
|
|
||||||
ebomParentService.resetAllBomExist();
|
|
||||||
|
|
||||||
return ResultVO.success(result);
|
return ResultVO.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
||||||
|
|
||||||
Set<String> getMaterialParent(@Param("materialNos") Collection<String> materialNos ,@Param("createdBy") String createdBy);
|
Set<String> getMaterialParent(@Param("materialNos") Collection<String> materialNos ,@Param("createdBy") String createdBy);
|
||||||
|
|
||||||
void resetAllBomExist();
|
void resetAllBomExist(Set<String> materialNos);
|
||||||
|
|
||||||
|
|
||||||
List<BomNewEbomParentEntity> getEBomParentByMaterialNos(@Param("job") Integer job, @Param("createdBy")String createdBy, @Param("materialNos") List<String> materialNos);
|
List<BomNewEbomParentEntity> getEBomParentByMaterialNos(@Param("job") Integer job, @Param("createdBy")String createdBy, @Param("materialNos") List<String> materialNos);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.mzt.logapi.context.LogRecordContext;
|
import com.mzt.logapi.context.LogRecordContext;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
|
|
@ -1910,17 +1909,24 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
&& item.getBomRowId() != null && item.getBomRowId().longValue() > 0
|
&& item.getBomRowId() != null && item.getBomRowId().longValue() > 0
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(superTagList)) {
|
||||||
|
List<BomNewEbomParentEntity> list = lambdaQuery()
|
||||||
|
.in(BomNewEbomParentEntity::getRowId, superTagList.stream().map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toSet()))
|
||||||
|
.list();
|
||||||
List<BomNewEbomParentEntity> updateList = new ArrayList<>();
|
List<BomNewEbomParentEntity> updateList = new ArrayList<>();
|
||||||
for (BomNewEbomParentVO vo : superTagList) {
|
for (BomNewEbomParentVO vo : superTagList) {
|
||||||
|
if (list.stream().noneMatch(l -> l.getRowId().equals(vo.getBomRowId())
|
||||||
|
&& Objects.equals(l.getSuperMaterialStatus(), vo.getSuperMaterialStatus()))) {
|
||||||
BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
|
BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
|
||||||
entity.setRowId(vo.getBomRowId());
|
entity.setRowId(vo.getBomRowId());
|
||||||
entity.setSuperMaterialStatus(vo.getSuperMaterialStatus());
|
entity.setSuperMaterialStatus(vo.getSuperMaterialStatus());
|
||||||
updateList.add(entity);
|
updateList.add(entity);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(updateList)) {
|
if (CollUtil.isNotEmpty(updateList)) {
|
||||||
this.updateBatchById(updateList);
|
this.updateBatchById(updateList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2279,9 +2285,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
/**
|
/**
|
||||||
* 重置所有BOM存在状态
|
* 重置所有BOM存在状态
|
||||||
*/
|
*/
|
||||||
public void resetAllBomExist() {
|
public void resetAllBomExist(Set<String> materialNos) {
|
||||||
log.debug("resetAllBomExist");
|
log.debug("resetAllBomExist");
|
||||||
this.getBaseMapper().resetAllBomExist();
|
this.getBaseMapper().resetAllBomExist(materialNos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<BomNewEbomParentVO> workDetailsListByPageNew(BomNewEbomParentQuery query) {
|
public Page<BomNewEbomParentVO> workDetailsListByPageNew(BomNewEbomParentQuery query) {
|
||||||
|
|
|
||||||
|
|
@ -622,6 +622,8 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
//更新并保存异常信息
|
//更新并保存异常信息
|
||||||
ebomParentService.checkAndSaveEBomException(ebomRowId);
|
ebomParentService.checkAndSaveEBomException(ebomRowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ebomParentService.resetAllBomExist(bomNewOriginalParentEntities.stream().map(BomNewOriginalParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
return importOriginalBomVOList;
|
return importOriginalBomVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -385,7 +385,10 @@
|
||||||
<select id="resetAllBomExist">
|
<select id="resetAllBomExist">
|
||||||
UPDATE t_bom_new_ebom_parent p
|
UPDATE t_bom_new_ebom_parent p
|
||||||
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0))
|
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0))
|
||||||
WHERE p.status < 4;
|
WHERE p.status < 4 AND p.material_no IN
|
||||||
|
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getEBomParentByMaterialNos" resultType="com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity">
|
<select id="getEBomParentByMaterialNos" resultType="com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue