sfd
2025-05-21 a78add24db92e8d276f9473e077a136c44dc5625
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsMaterialProductGroupManagementServiceImpl.java
@@ -123,7 +123,8 @@
            List<ApsMaterialProductGroupManagement> list = new ArrayList<>();
            /*数据列从1开始*/
            for (int i = 1; i <= rows; i++) {
            Set<String> keys = new HashSet<>();
            for (int i = rows; i > 0; --i) {
                Row row = sheet.getRow(i);
                if (row.getCell(0) == null) {
                    continue;
@@ -149,20 +150,19 @@
                    item.setIsMain(isMain);
                    item.setCreateBy(SecurityUtils.getUsername());
                    item.setCreateTime(DateUtils.getNowDate());
                    if (!keys.contains(item.getKey())) {
                        keys.add(item.getKey());
                    list.add(item);
                }
            }
            }
            if (!list.isEmpty()) {
                Set<String> facCodeKey = apsMaterialProductGroupManagementMapper.selectByFacOrMaterial(
                        list.stream().map(ApsMaterialProductGroupManagement::getFactory).collect(Collectors.toSet()),
                        list.stream().map(ApsMaterialProductGroupManagement::getMaterialCode).collect(Collectors.toSet())
                );
                Set<String> facCodeKey = apsMaterialProductGroupManagementMapper.selectByFacOrMaterial(keys);
                if (!facCodeKey.isEmpty()) {
                    Iterator<ApsMaterialProductGroupManagement> it = list.iterator();
                    while (it.hasNext()) {
                        ApsMaterialProductGroupManagement item = it.next();
                        String key = item.getFactory() + "##" + item.getMaterialCode();
                        if (facCodeKey.contains(key)) {
                        if (facCodeKey.contains(item.getKey())) {
                            LambdaUpdateWrapper<ApsMaterialProductGroupManagement> wrapper = new LambdaUpdateWrapper<>();
                            wrapper.eq(ApsMaterialProductGroupManagement::getFactory, item.getFactory());
                            wrapper.eq(ApsMaterialProductGroupManagement::getMaterialCode, item.getMaterialCode());