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