yangys
2024-03-28 13ada1093cb8de6e31a718d2222429ded70133c8
smart-man-boot/src/main/java/com/qianwen/smartman/modules/cps/service/impl/FixtureServiceImpl.java
@@ -40,6 +40,7 @@
import com.qianwen.smartman.modules.cps.entity.CommonGroup;
import com.qianwen.smartman.modules.cps.entity.CommonGroupOfItem;
import com.qianwen.smartman.modules.cps.entity.Fixture;
import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcessRelatedFixture;
import com.qianwen.smartman.modules.cps.entity.ToolAppendix;
import com.qianwen.smartman.modules.cps.entity.TrayFixture;
import com.qianwen.smartman.modules.cps.enums.CommonGroupEnum;
@@ -66,8 +67,10 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
/**
 * 夹具服务
 */
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/FixtureServiceImpl.class */
public class FixtureServiceImpl extends BaseServiceImpl<FixtureMapper, Fixture> implements IFixtureService {
    private static final Logger log = LoggerFactory.getLogger(FixtureServiceImpl.class);
    private final ICommonGroupOfItemService commonGroupOfItemService;
@@ -77,127 +80,6 @@
    private final OssBuilder ossBuilder;
    private final ICodeGeneratorService codeGeneratorService;
    private final IProductionCraftProcessRelatedFixtureService relatedFixtureService;
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -75622813:
                if (implMethodName.equals("getCode")) {
                    z = true;
                    break;
                }
                break;
            case -75308287:
                if (implMethodName.equals("getName")) {
                    z = true;
                    break;
                }
                break;
            case 98245393:
                if (implMethodName.equals("getId")) {
                    z = true;
                    break;
                }
                break;
            case 517353092:
                if (implMethodName.equals("getItemId")) {
                    z = false;
                    break;
                }
                break;
            case 1183913550:
                if (implMethodName.equals("getFixtureId")) {
                    z = true;
                    break;
                }
                break;
            case 1330288580:
                if (implMethodName.equals("getGroupId")) {
                    z = true;
                    break;
                }
                break;
            case 1953270362:
                if (implMethodName.equals("getFixId")) {
                    z = true;
                    break;
                }
                break;
        }
        switch (z) {
            case false:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CommonGroupOfItem") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getItemId();
                    };
                }
                break;
            case true:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/Fixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getName();
                    };
                }
                break;
            case true:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/TrayFixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getFixId();
                    };
                }
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/TrayFixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getFixId();
                    };
                }
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/TrayFixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getFixId();
                    };
                }
                break;
            case true:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getId();
                    };
                }
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CommonGroup") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getId();
                    };
                }
                break;
            case true:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/Fixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getCode();
                    };
                }
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/Fixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getCode();
                    };
                }
                break;
            case RegionCache.VILLAGE_LEVEL /* 5 */:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CommonGroupOfItem") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getGroupId();
                    };
                }
                break;
            case true:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCraftProcessRelatedFixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getFixtureId();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
    public FixtureServiceImpl(final ICommonGroupOfItemService commonGroupOfItemService, final IToolAppendixService toolAppendixService, final ICommonGroupService commonGroupService, final ITrayFixtureService trayFixtureService, final OssBuilder ossBuilder, final ICodeGeneratorService codeGeneratorService, final IProductionCraftProcessRelatedFixtureService relatedFixtureService) {
        this.commonGroupOfItemService = commonGroupOfItemService;
@@ -214,13 +96,14 @@
        if (ids.isEmpty()) {
            return false;
        }
        long countRelatedFixture = this.relatedFixtureService.count(Wrappers.<ProductionCraftProcessRelatedFixture>lambdaQuery()
                .in(ProductionCraftProcessRelatedFixture::getFixtureId, ids));
        /*
        long countRelatedFixture = this.relatedFixtureService.count((Wrapper) Wrappers.lambdaQuery().in((v0) -> {
            return v0.getFixtureId();
        }, ids));
        }, ids));*/
        ThrowFun.isTrue(countRelatedFixture > 0).throwMessage(MessageUtils.message("cps.system.banding.not.remove", new Object[0]));
        this.trayFixtureService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> {
            return v0.getFixId();
        }, ids));
        this.trayFixtureService.remove(Wrappers.<TrayFixture>lambdaQuery().in(TrayFixture::getFixId, ids));
        return Boolean.valueOf(removeByIds(ids));
    }
@@ -260,11 +143,14 @@
    @Override // org.springblade.modules.cps.service.IFixtureService
    public void checkFixture(Fixture fixture) {
       long count = count(Wrappers.<Fixture>lambdaQuery().eq(Fixture::getCode, fixture.getCode())
             .ne(Func.isNotEmpty(fixture.getId()), Fixture::getId, fixture.getId()));
       /*
        long count = count(((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> {
            return v0.getCode();
        }, fixture.getCode())).ne(Func.isNotEmpty(fixture.getId()), (v0) -> {
            return v0.getId();
        }, fixture.getId()));
        }, fixture.getId()));*/
        if (count > 0) {
            throw new ServiceException(MessageUtils.message("cps.fixture.code.already.exists", new Object[0]));
        }
@@ -274,9 +160,8 @@
    @Transactional(rollbackFor = {Exception.class})
    public boolean remove(List<Long> ids) {
        removeByIds(ids);
        this.trayFixtureService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> {
            return v0.getFixId();
        }, ids));
        this.trayFixtureService.remove(Wrappers.<TrayFixture>lambdaQuery().in(TrayFixture::getFixId, ids));
        return true;
    }
@@ -297,13 +182,12 @@
        if (Func.isEmpty(fixtureGroupFixtureVOList)) {
            return Lists.newArrayList();
        }
        List<Long> groupIdList = (List) fixtureGroupFixtureVOList.stream().map((v0) -> {
        List<Long> groupIdList = fixtureGroupFixtureVOList.stream().map((v0) -> {
            return v0.getParentId();
        }).collect(Collectors.toList());
        List<CommonGroup> commonGroupList = this.commonGroupService.list((Wrapper) Wrappers.lambdaQuery().in((v0) -> {
            return v0.getId();
        }, groupIdList));
        List<FixtureGroupFixtureVO> groupList = (List) commonGroupList.stream().map(c -> {
        List<CommonGroup> commonGroupList = this.commonGroupService.list(Wrappers.<CommonGroup>lambdaQuery().in(CommonGroup::getId, groupIdList));
        List<FixtureGroupFixtureVO> groupList = commonGroupList.stream().map(c -> {
            FixtureGroupFixtureVO fixtureGroupFixtureVO = new FixtureGroupFixtureVO();
            fixtureGroupFixtureVO.setId(c.getId());
            fixtureGroupFixtureVO.setName(c.getName());
@@ -362,6 +246,10 @@
            String fixtureCode = fix.getFixtureCode();
            if (fixtureCodeSet.contains(fixtureCode)) {
                String name = fix.getName();
                update(Wrappers.<Fixture>lambdaUpdate().eq(Fixture::getCode, fixtureCode).set(Fixture::getName, Func.isBlank(name) ? fixtureCode : name));
                this.commonGroupOfItemService.update(Wrappers.<CommonGroupOfItem>update().lambda().eq(CommonGroupOfItem::getItemId, ((Fixture)fixtureMap.get(fixtureCode)).getId()).set(CommonGroupOfItem::getGroupId, commonGroupNameMap.get(fix.getFixtureGroupName())));
                /*
                update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().eq((v0) -> {
                    return v0.getCode();
                }, fixtureCode)).set((v0) -> {
@@ -371,7 +259,7 @@
                    return v0.getItemId();
                }, ((Fixture) fixtureMap.get(fixtureCode)).getId())).set((v0) -> {
                    return v0.getGroupId();
                }, commonGroupNameMap.get(fix.getFixtureGroupName())));
                }, commonGroupNameMap.get(fix.getFixtureGroupName())));*/
                return;
            }
            FixtureVO fixtureVO = new FixtureVO();
@@ -399,9 +287,11 @@
        Fixture fixture = FixtureConvert.INSTANCE.convert(vo);
        checkFixture(fixture);
        updateById(fixture);
        this.trayFixtureService.remove(Wrappers.<TrayFixture>lambdaQuery().eq(TrayFixture::getFixId, vo.getId()));
        /*
        this.trayFixtureService.remove((Wrapper) Wrappers.lambdaQuery().eq((v0) -> {
            return v0.getFixId();
        }, vo.getId()));
        }, vo.getId()));*/
        TrayFixture trayFixture = new TrayFixture().setFixId(vo.getId()).setTrayId(vo.getTrayId()).setFaceId(vo.getSurfaceId());
        this.trayFixtureService.save(trayFixture);
        return FixtureConvert.INSTANCE.convert(fixture);