Compare commits
6 Commits
6bce644663
...
yanyang
| Author | SHA1 | Date | |
|---|---|---|---|
| 46f51e656e | |||
| e950cbbe9c | |||
| f9af03b030 | |||
| 095bdc1e23 | |||
| fd4c383fcc | |||
| e5128e3c1f |
@@ -28,10 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 包装箱表
|
* 包装箱表
|
||||||
@@ -143,9 +141,22 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
|
|||||||
// matchColor(dto);
|
// matchColor(dto);
|
||||||
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
|
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo());
|
wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo());
|
||||||
wrapper.orderByAsc(WoPackagingBoxSubstrate.SLOT);
|
//重复上片基板去重
|
||||||
|
// wrapper.orderByAsc(WoPackagingBoxSubstrate.SLOT);
|
||||||
List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper);
|
List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper);
|
||||||
dto.setSubstrateList(woPackagingBoxSubstrateList);
|
List<WoPackagingBoxSubstrate> distinctList = new ArrayList<>();
|
||||||
|
Map<String, List<WoPackagingBoxSubstrate>> map = woPackagingBoxSubstrateList.stream().sorted(Comparator.comparing(WoPackagingBoxSubstrate::getCreateTime).reversed())
|
||||||
|
.collect(Collectors.groupingBy(WoPackagingBoxSubstrate::getWoSubstrateId));
|
||||||
|
for (Map.Entry<String, List<WoPackagingBoxSubstrate>> entry : map.entrySet()) {
|
||||||
|
//取list首并放入到新list中
|
||||||
|
distinctList.add(entry.getValue().get(0));
|
||||||
|
}
|
||||||
|
// List<WoPackagingBoxSubstrate> distinctList = woPackagingBoxSubstrateList.stream().collect(
|
||||||
|
// Collectors.collectingAndThen(
|
||||||
|
// Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WoPackagingBoxSubstrate::getWoSubstrateId))), ArrayList::new)
|
||||||
|
// );
|
||||||
|
List<WoPackagingBoxSubstrate> sortedDistinctList = distinctList.stream().sorted(Comparator.comparing(WoPackagingBoxSubstrate::getSlot)).collect(Collectors.toList());
|
||||||
|
dto.setSubstrateList(sortedDistinctList);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user