| | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/TrayFixtureServiceImpl.class */ |
| | | |
| | | public class TrayFixtureServiceImpl extends BladeServiceImpl<TrayFixtureMapper, TrayFixture> implements ITrayFixtureService { |
| | | private static final Logger log = LoggerFactory.getLogger(TrayFixtureServiceImpl.class); |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private ICommonGroupOfItemService itemService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -494860379: |
| | | if (implMethodName.equals("getFixtureStatus")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1956157548: |
| | | if (implMethodName.equals("getInUse")) { |
| | | z = false; |
| | | 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/Fixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getInUse(); |
| | | }; |
| | | } |
| | | 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/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getInUse(); |
| | | }; |
| | | } |
| | | 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/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getFixtureStatus(); |
| | | }; |
| | | } |
| | | 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/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getFixtureStatus(); |
| | | }; |
| | | } |
| | | 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/core/mp/base/BaseEntity") && 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/Tray") && 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; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ITrayFixtureService |
| | | public List<TrayFaceFixtureVO> listFixture(String faceId) { |
| | | return this.baseMapper.listFixture(faceId); |
| | |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public List<TrayFixtureVO> addFaceFixture(TrayFaceFixtureAddVO vo) { |
| | | List<Long> fixIds = vo.getFixIds(); |
| | | List<TrayFixture> fixtures = (List) fixIds.stream().map(c -> { |
| | | List<TrayFixture> fixtures = fixIds.stream().map(c -> { |
| | | TrayFixture trayFixture = new TrayFixture(); |
| | | trayFixture.setTrayId(vo.getTrayId()); |
| | | trayFixture.setFaceId(vo.getFaceId()); |
| | |
| | | return trayFixture; |
| | | }).collect(Collectors.toList()); |
| | | saveBatch(fixtures); |
| | | Tray tray = (Tray) this.trayService.getById(vo.getTrayId()); |
| | | Tray tray = this.trayService.getById(vo.getTrayId()); |
| | | this.fixtureService.update(Wrappers.<Fixture>lambdaUpdate() |
| | | .set(Fixture::getInUse, ToolingConstant.TOOLING_IN_USE) |
| | | .set(Fixture::getFixtureStatus, tray.getAvailability()) |
| | | .in(Fixture::getId, fixIds)); |
| | | /* |
| | | this.fixtureService.update((Wrapper) ((LambdaUpdateWrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getInUse(); |
| | | }, ToolingConstant.TOOLING_IN_USE)).set((v0) -> { |
| | | return v0.getFixtureStatus(); |
| | | }, tray.getAvailability())).in((v0) -> { |
| | | return v0.getId(); |
| | | }, fixIds)); |
| | | }, fixIds));*/ |
| | | return TrayFixtureConvert.INSTANCE.convert(fixtures); |
| | | } |
| | | |
| | |
| | | fixIds.add(s.getOthersId()); |
| | | }); |
| | | boolean remove = removeByIds(idList); |
| | | |
| | | boolean update = this.fixtureService.update(Wrappers.<Fixture>lambdaUpdate() |
| | | .set(Fixture::getInUse, ToolingConstant.TOOLING_NOT_USE) |
| | | .set(Fixture::getFixtureStatus, null) |
| | | .in(Fixture::getId, fixIds)); |
| | | /* |
| | | boolean update = this.fixtureService.update((Wrapper) ((LambdaUpdateWrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getInUse(); |
| | | }, ToolingConstant.TOOLING_NOT_USE)).set((v0) -> { |
| | |
| | | }, (Object) null)).in((v0) -> { |
| | | return v0.getId(); |
| | | }, fixIds)); |
| | | */ |
| | | return Boolean.valueOf(remove && update); |
| | | } |
| | | |
| | |
| | | return exportFailFile(failExcel); |
| | | } |
| | | if (Func.isNotEmpty(needSaveTray)) { |
| | | Map<String, Tray> needSaveTrayMap = (Map) needSaveTray.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, Tray> needSaveTrayMap = needSaveTray.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, Function.identity(), v1, v2 -> { |
| | | }, Function.identity(), (v1, v2) -> { |
| | | return v1; |
| | | })); |
| | | Collection<Tray> trays = needSaveTrayMap.values(); |
| | | this.trayService.saveBatch(trays); |
| | | List<CommonGroupOfItem> items = (List) trays.stream().map(tray -> { |
| | | List<CommonGroupOfItem> items = trays.stream().map(tray -> { |
| | | return CommonGroupOfItem.builder().groupId(105L).itemId(tray.getId()).groupType(CommonGroupTypeEnum.TRAY.getName()).groupCategory(CommonGroupConstant.DEFAULT_CATEGORY).build(); |
| | | }).collect(Collectors.toList()); |
| | | this.itemService.saveBatch(items); |
| | | trayMap.putAll(needSaveTrayMap); |
| | | } |
| | | if (Func.isNotEmpty(needSaveFace)) { |
| | | Map<String, TraySurface> needSaveFaceMap = (Map) needSaveFace.stream().collect(Collectors.toMap(k -> { |
| | | Map<String, TraySurface> needSaveFaceMap = needSaveFace.stream().collect(Collectors.toMap(k -> { |
| | | return StringUtils.getKey(k.getTrayId(), k.getCode()); |
| | | }, Function.identity(), v12, v22 -> { |
| | | }, Function.identity(), (v12, v22) -> { |
| | | return v12; |
| | | })); |
| | | this.traySurfaceService.saveBatch(needSaveFaceMap.values()); |
| | | trayFaceMap.putAll(needSaveFaceMap); |
| | | } |
| | | if (Func.isNotEmpty(needSaveFixture)) { |
| | | Map<String, Fixture> needSaveFixtureMap = (Map) needSaveFixture.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, Fixture> needSaveFixtureMap = needSaveFixture.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, Function.identity(), v13, v23 -> { |
| | | }, Function.identity(), (v13, v23) -> { |
| | | return v13; |
| | | })); |
| | | Collection<Fixture> fixtures = needSaveFixtureMap.values(); |
| | | this.fixtureService.saveBatch(fixtures); |
| | | List<CommonGroupOfItem> items2 = (List) fixtures.stream().map(fixture -> { |
| | | List<CommonGroupOfItem> items2 = fixtures.stream().map(fixture -> { |
| | | return CommonGroupOfItem.builder().groupId(104L).itemId(fixture.getId()).groupCategory(CommonGroupConstant.DEFAULT_CATEGORY).groupType(CommonGroupTypeEnum.FIXTURE.getName()).build(); |
| | | }).collect(Collectors.toList()); |
| | | this.itemService.saveBatch(items2); |
| | |
| | | } |
| | | }); |
| | | List<TrayFixture> trayFixtures = list(); |
| | | Map<String, TrayFixture> trayFixtureMap = (Map) trayFixtures.stream().collect(Collectors.toMap(k -> { |
| | | Map<String, TrayFixture> trayFixtureMap = trayFixtures.stream().collect(Collectors.toMap(k -> { |
| | | return StringUtils.getKey(k.getTrayId(), k.getFaceId(), k.getFixId()); |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | List<TrayFixture> list = (List) trayFixtureList.stream().distinct().filter(c -> { |
| | | List<TrayFixture> list = trayFixtureList.stream().distinct().filter(c -> { |
| | | return !trayFixtureMap.containsKey(StringUtils.getKey(c.getTrayId(), c.getFaceId(), c.getFixId())); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(list)) { |
| | |
| | | } |
| | | |
| | | private void getTrayFixtureMap(List<TrayFixtureImport> rawData, Map<String, Tray> trayMap, Map<String, Fixture> fixtureMap, Map<String, TraySurface> surfaceMap) { |
| | | Wrapper lambdaQuery = Wrappers.lambdaQuery(); |
| | | Wrapper lambdaQuery2 = Wrappers.lambdaQuery(); |
| | | Wrapper<TrayFixtureImport> query = Wrappers.query(); |
| | | LambdaQueryWrapper<Tray> trayQuery = Wrappers.lambdaQuery(); |
| | | //Wrapper lambdaQuery = Wrappers.lambdaQuery(); |
| | | |
| | | |
| | | |
| | | LambdaQueryWrapper<Fixture> fixtureQuery = Wrappers.lambdaQuery(); |
| | | // Wrapper lambdaQuery2 = Wrappers.lambdaQuery(); |
| | | |
| | | QueryWrapper<TrayFixtureImport> query = Wrappers.query(); |
| | | boolean flag1 = false; |
| | | boolean flag2 = false; |
| | | boolean flag3 = false; |
| | | for (TrayFixtureImport data : rawData) { |
| | | if (trayCodeNameRequired(data)) { |
| | | if (flag1) { |
| | | lambdaQuery.or(); |
| | | trayQuery.or(); |
| | | } |
| | | flag1 = true; |
| | | lambdaQuery.eq((v0) -> { |
| | | trayQuery.eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, data.getTrayCode()); |
| | | } |
| | | if (fixtureCodeNameRequired(data)) { |
| | | if (flag2) { |
| | | lambdaQuery2.or(); |
| | | fixtureQuery.or(); |
| | | } |
| | | flag2 = true; |
| | | lambdaQuery2.eq((v0) -> { |
| | | fixtureQuery.eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, data.getFixtureCode()); |
| | | } |
| | |
| | | } |
| | | flag3 = true; |
| | | query.nested(i -> { |
| | | QueryWrapper queryWrapper = (QueryWrapper) ((QueryWrapper) i.eq("bt.code", data.getTrayCode())).eq("bts.code", data.getTrayFaceCode()); |
| | | i.eq("bt.code", data.getTrayCode()).eq("bts.code", data.getTrayFaceCode()); |
| | | }); |
| | | } |
| | | } |
| | | String sqlSegment1 = lambdaQuery.getSqlSegment(); |
| | | String sqlSegment1 = trayQuery.getSqlSegment(); |
| | | if (Func.isNotEmpty(sqlSegment1)) { |
| | | List<Tray> trays = this.trayService.list(lambdaQuery); |
| | | List<Tray> trays = this.trayService.list(trayQuery); |
| | | if (Func.isNotEmpty(trays)) { |
| | | trayMap.putAll((Map) trays.stream().collect(Collectors.toMap((v0) -> { |
| | | trayMap.putAll(trays.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, v -> { |
| | | return v; |
| | | }))); |
| | | } |
| | | } |
| | | String sqlSegment2 = lambdaQuery2.getSqlSegment(); |
| | | String sqlSegment2 = fixtureQuery.getSqlSegment(); |
| | | if (Func.isNotEmpty(sqlSegment2)) { |
| | | List<Fixture> fixtures = this.fixtureService.list(lambdaQuery2); |
| | | List<Fixture> fixtures = this.fixtureService.list(fixtureQuery); |
| | | if (Func.isNotEmpty(fixtures)) { |
| | | fixtureMap.putAll((Map) fixtures.stream().collect(Collectors.toMap((v0) -> { |
| | | fixtureMap.putAll(fixtures.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, v2 -> { |
| | | return v2; |
| | |
| | | if (Func.isNotEmpty(sqlSegment3)) { |
| | | List<TraySurface> traySurfaces = this.traySurfaceService.listByTrayCodeName(query); |
| | | if (Func.isNotEmpty(traySurfaces)) { |
| | | surfaceMap.putAll((Map) traySurfaces.stream().collect(Collectors.toMap(k -> { |
| | | surfaceMap.putAll(traySurfaces.stream().collect(Collectors.toMap(k -> { |
| | | return StringUtils.getKey(k.getTrayId(), k.getCode()); |
| | | }, v3 -> { |
| | | return v3; |