Merge pull request 'yanyang' (#40) from yanyang into master

Reviewed-on: #40
This commit is contained in:
闫阳 2024-02-05 10:53:45 +08:00
bovenliggende e5128e3c1f 095bdc1e23
commit f9af03b030

Bestand weergeven

@ -28,10 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 包装箱表
@ -143,9 +141,16 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
// matchColor(dto);
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo());
wrapper.orderByAsc(WoPackagingBoxSubstrate.SLOT);
//重复上片基板去重
// wrapper.select("DISTINCT WO_SUBSTRATE_ID").orderByDesc("CREATE_TIME");
// wrapper.orderByAsc(WoPackagingBoxSubstrate.SLOT);
List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper);
dto.setSubstrateList(woPackagingBoxSubstrateList);
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;
}