Merge branch 'technology/rakor-w3' into technology-init-lhj1119
This commit is contained in:
commit
6dedf39d96
|
|
@ -41,11 +41,11 @@ public class BomCostService extends ServiceImpl<BomCostMapper, BomCostEntity> {
|
|||
List<Long> forDelete = new ArrayList<>();
|
||||
datas.forEach(d -> {
|
||||
BomCostEntity entity = latest.stream().filter(l -> StrUtil.equals(l.getMaterialNo(), d.getMaterialNo())).findFirst().orElse(null);
|
||||
if (Objects.isNull(entity)) {
|
||||
forAdd.add(convert(d));
|
||||
} else if (!StringUtil.inSameInterval(entity.getVersion(), LocalDateTime.now().format(FORMATTER))) {
|
||||
if (Objects.nonNull(entity) && StringUtil.inSameInterval(entity.getVersion(), LocalDateTime.now().format(FORMATTER))) {
|
||||
forDelete.add(entity.getId());
|
||||
forAdd.add(convert(d));
|
||||
} else {
|
||||
forAdd.add(convert(d));
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(forAdd)) {
|
||||
|
|
@ -84,20 +84,23 @@ public class BomCostService extends ServiceImpl<BomCostMapper, BomCostEntity> {
|
|||
public List<BomCostEntity> getInfo(List<MaterialVersionCostQuery> query) {
|
||||
List<BomCostEntity> datas = new ArrayList<>(MapUtil.calculateInitialCapacity(query.size()));
|
||||
query.forEach(q -> {
|
||||
BomCostEntity entity;
|
||||
if (StrUtil.isBlank(q.getVersion())) {
|
||||
BomCostEntity entity = lambdaQuery()
|
||||
entity = lambdaQuery()
|
||||
.eq(BomCostEntity::getMaterialNo, q.getMaterialNo())
|
||||
.orderByDesc(BomCostEntity::getVersion)
|
||||
.one();
|
||||
if (Objects.nonNull(entity)) {
|
||||
entity.setVersion("");
|
||||
datas.add(entity);
|
||||
}
|
||||
} else {
|
||||
datas.add(lambdaQuery()
|
||||
entity = lambdaQuery()
|
||||
.eq(BomCostEntity::getMaterialNo, q.getMaterialNo())
|
||||
.eq(BomCostEntity::getVersion, q.getVersion())
|
||||
.one());
|
||||
.one();
|
||||
}
|
||||
if (Objects.nonNull(entity)) {
|
||||
datas.add(entity);
|
||||
}
|
||||
});
|
||||
return datas;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ public class StringUtilTest {
|
|||
|
||||
@Test
|
||||
public void test5() {
|
||||
String v1 = "20240521";
|
||||
String v2 = "20240531";
|
||||
Assertions.assertTrue(StringUtil.inSameInterval(v1, v2));
|
||||
String v1 = "20240106";
|
||||
String v2 = "20250110";
|
||||
Assertions.assertFalse(StringUtil.inSameInterval(v1, v2));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue