yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
package com.qianwen.smartman.modules.cps.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.google.common.collect.Lists;
import java.lang.invoke.SerializedLambda;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.smartman.common.cache.RegionCache;
import com.qianwen.smartman.common.utils.ExtraLambdaQueryWrapper;
import com.qianwen.smartman.common.utils.Lambda;
import com.qianwen.smartman.common.utils.MessageUtils;
import com.qianwen.core.log.exception.ServiceException;
import com.qianwen.core.mp.service.impl.BladeServiceImpl;
import com.qianwen.core.tool.node.ForestNodeMerger;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.cps.convert.ProductionCraftProcessConvert;
import com.qianwen.smartman.modules.cps.convert.ProductionCraftProcessFileConvert;
import com.qianwen.smartman.modules.cps.convert.ProductionCraftProcessRelatedFixtureConvert;
import com.qianwen.smartman.modules.cps.convert.ProductionCraftProcessRelatedToolConvert;
import com.qianwen.smartman.modules.cps.dto.MainProcessSaveDTO;
import com.qianwen.smartman.modules.cps.dto.ProcessMainUpdateDTO;
import com.qianwen.smartman.modules.cps.dto.ProcessNmUpdateDTO;
import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcess;
import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcessFile;
import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcessRelatedFixture;
import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcessRelatedTool;
import com.qianwen.smartman.modules.cps.enums.MainProcessEnum;
import com.qianwen.smartman.modules.cps.enums.ProductionCraftStatusEnum;
import com.qianwen.smartman.modules.cps.mapper.ProductionCraftProcessMapper;
import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessFileService;
import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessRelatedFixtureService;
import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessRelatedToolService;
import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessService;
import com.qianwen.smartman.modules.cps.utils.ThrowFun;
import com.qianwen.smartman.modules.cps.vo.ChildProcessVO;
import com.qianwen.smartman.modules.cps.vo.ParallelProVO;
import com.qianwen.smartman.modules.cps.vo.ProcessParallelSaveVO;
import com.qianwen.smartman.modules.cps.vo.ProcessParallelUpdateVO;
import com.qianwen.smartman.modules.cps.vo.ProcessParallelVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessDeleteVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessDetailVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessFileVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessRelatedFixtureVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessRelatedToolVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessRemoveVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessUpdateSortVO;
import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessVO;
import com.qianwen.smartman.modules.cps.vo.UpdateParallelProcessVO;
import com.qianwen.smartman.modules.cps.vo.VersionProcessAddVO;
import com.qianwen.smartman.modules.cps.vo.VersionProcessParallelVO;
import com.qianwen.smartman.modules.cps.vo.VersionProcessTreeVO;
import com.qianwen.smartman.modules.cps.vo.VersionProcessUpdateVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/ProductionCraftProcessServiceImpl.class */
public class ProductionCraftProcessServiceImpl extends BladeServiceImpl<ProductionCraftProcessMapper, ProductionCraftProcess> implements IProductionCraftProcessService {
    private final IProductionCraftProcessFileService processFileService;
    private final IProductionCraftProcessRelatedToolService relatedToolService;
    private final IProductionCraftProcessRelatedFixtureService relatedFixtureService;
    private static final Logger log = LoggerFactory.getLogger(ProductionCraftProcessServiceImpl.class);
    private static final Integer CHILD_PROCESS_SIZE = 2;
 
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -1416707747:
                if (implMethodName.equals("getVersionId")) {
                    z = true;
                    break;
                }
                break;
            case -1291082392:
                if (implMethodName.equals("getVersionProcessId")) {
                    z = true;
                    break;
                }
                break;
            case -1130621541:
                if (implMethodName.equals("getYCoordinate")) {
                    z = true;
                    break;
                }
                break;
            case -470739956:
                if (implMethodName.equals("getSourceId")) {
                    z = true;
                    break;
                }
                break;
            case -75145708:
                if (implMethodName.equals("getSort")) {
                    z = true;
                    break;
                }
                break;
            case 98245393:
                if (implMethodName.equals("getId")) {
                    z = true;
                    break;
                }
                break;
            case 147927115:
                if (implMethodName.equals("getMainSequenceId")) {
                    z = true;
                    break;
                }
                break;
            case 474985501:
                if (implMethodName.equals("getHeight")) {
                    z = true;
                    break;
                }
                break;
            case 666329818:
                if (implMethodName.equals("getXCoordinate")) {
                    z = true;
                    break;
                }
                break;
            case 1635948546:
                if (implMethodName.equals("getTargetId")) {
                    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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTargetId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTargetId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getTargetId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSort();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSort();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSort();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSort();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSort();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getSort();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
                    return (v0) -> {
                        return v0.getHeight();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionId();
                    };
                }
                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.getVersionProcessId();
                    };
                }
                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.getVersionProcessId();
                    };
                }
                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/ProductionCraftProcessFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionProcessId();
                    };
                }
                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.getVersionProcessId();
                    };
                }
                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/ProductionCraftProcessRelatedTool") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionProcessId();
                    };
                }
                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/ProductionCraftProcessFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionProcessId();
                    };
                }
                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/ProductionCraftProcessRelatedTool") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getVersionProcessId();
                    };
                }
                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.getVersionProcessId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getYCoordinate();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getYCoordinate();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getYCoordinate();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getMainSequenceId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getMainSequenceId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getMainSequenceId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getMainSequenceId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getMainSequenceId();
                    };
                }
                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();
                    };
                }
                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();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getSourceId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getSourceId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getSourceId();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getXCoordinate();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getXCoordinate();
                    };
                }
                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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getXCoordinate();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
 
    public ProductionCraftProcessServiceImpl(final IProductionCraftProcessFileService processFileService, final IProductionCraftProcessRelatedToolService relatedToolService, final IProductionCraftProcessRelatedFixtureService relatedFixtureService) {
        this.processFileService = processFileService;
        this.relatedToolService = relatedToolService;
        this.relatedFixtureService = relatedFixtureService;
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    @Transactional(rollbackFor = {Exception.class})
    public List<ProductionCraftProcessVO> saveVersionProcess(Long versionId, List<VersionProcessAddVO> processList) {
        validFixVersion(versionId);
        List<ProductionCraftProcess> craftProcessList = saveAll(versionId, processList);
        if (Func.isNotEmpty(processList)) {
            Map<Integer, List<Integer>> sortMap = (Map) processList.stream().map((v0) -> {
                return v0.getSort();
            }).filter((v0) -> {
                return Func.notNull(v0);
            }).collect(Collectors.groupingBy(c -> {
                return c;
            }));
            if (sortMap.size() != processList.size()) {
                throw new ServiceException(MessageUtils.message("cps.production.craft.process.same.sort", new Object[0]));
            }
        }
        return ProductionCraftProcessConvert.INSTANCE.convert(craftProcessList);
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    @Transactional(rollbackFor = {Exception.class})
    public Boolean removeVersionProcess(List<Long> ids) {
        boolean flag = removeBatchByIds(ids);
        return Boolean.valueOf(flag && removeProcessAssociation(ids));
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public List<ProductionCraftProcess> listProcessByVersion(Long id) {
        return list((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> {
            return v0.getVersionId();
        }, id)).orderByAsc((v0) -> {
            return v0.getSort();
        }));
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public boolean useSameFixture(ProductionCraftProcess currentProcess, ProductionCraftProcess nextProcess) {
        List<ProductionCraftProcessRelatedFixture> currentFixture = this.relatedFixtureService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedFixture.class).eq((v0) -> {
            return v0.getVersionProcessId();
        }, currentProcess.getId()));
        List<ProductionCraftProcessRelatedFixture> nextFixture = this.relatedFixtureService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedFixture.class).eq((v0) -> {
            return v0.getVersionProcessId();
        }, nextProcess.getId()));
        int currentSize = currentFixture.size();
        int nextSize = nextFixture.size();
        if (currentSize != nextSize) {
            return false;
        }
        Set<Long> currentIds = (Set) currentFixture.stream().map((v0) -> {
            return v0.getFixtureId();
        }).collect(Collectors.toSet());
        Set<Long> nextIds = (Set) nextFixture.stream().map((v0) -> {
            return v0.getFixtureId();
        }).collect(Collectors.toSet());
        return currentIds.containsAll(nextIds);
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public Boolean updateSort(ProductionCraftProcessUpdateSortVO productionCraftProcessUpdateSortVO) {
        List<ProductionCraftProcess> list = (List) productionCraftProcessUpdateSortVO.getProcessList().stream().map(i -> {
            ProductionCraftProcess productionCraftProcess = new ProductionCraftProcess();
            productionCraftProcess.setId(i.getId());
            productionCraftProcess.setSort(i.getSort());
            productionCraftProcess.setTargetId(i.getTargetId());
            productionCraftProcess.setSourceId(i.getSourceId());
            productionCraftProcess.setXCoordinate(i.getXCoordinate());
            productionCraftProcess.setYCoordinate(i.getYCoordinate());
            return productionCraftProcess;
        }).collect(Collectors.toList());
        return Boolean.valueOf(updateBatchById(list));
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public ProductionCraftProcessDetailVO detailProcess(Long id) {
        ProductionCraftProcess process = (ProductionCraftProcess) getById(id);
        ProductionCraftProcessDetailVO vo = ProductionCraftProcessConvert.INSTANCE.convertDetailVO(process);
        Long mainSequenceId = process.getMainSequenceId();
        vo.setParentId(Long.valueOf(mainSequenceId == null ? 1024L : mainSequenceId.longValue()));
        List<ProductionCraftProcessFile> processFiles = this.processFileService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessFile.class).eq((v0) -> {
            return v0.getVersionProcessId();
        }, id));
        List<ProductionCraftProcessFileVO> fileList = ProductionCraftProcessFileConvert.INSTANCE.convert(processFiles);
        vo.setFiles(fileList);
        List<ProductionCraftProcessRelatedFixture> fixtures = this.relatedFixtureService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedFixture.class).eq((v0) -> {
            return v0.getVersionProcessId();
        }, id));
        List<ProductionCraftProcessRelatedFixtureVO> fixtureList = ProductionCraftProcessRelatedFixtureConvert.INSTANCE.convert(fixtures);
        vo.setFixtures(fixtureList);
        List<ProductionCraftProcessRelatedTool> tools = this.relatedToolService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedTool.class).eq((v0) -> {
            return v0.getVersionProcessId();
        }, id));
        List<ProductionCraftProcessRelatedToolVO> toolList = ProductionCraftProcessRelatedToolConvert.INSTANCE.convert(tools);
        vo.setTools(toolList);
        return vo;
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    @Transactional(rollbackFor = {Exception.class})
    public Boolean removeProcess(ProductionCraftProcessRemoveVO vo) {
        int versionStatus = this.baseMapper.getVersionStatus(vo.getVersionId());
        if (ProductionCraftStatusEnum.FINALIZED.getStatus().equals(Integer.valueOf(versionStatus))) {
            throw new ServiceException(MessageUtils.message("cps.production.craft.version.has.been.finalized.can.not.delete", new Object[0]));
        }
        Long versionProcessId = vo.getVersionProcessId();
        removeById(versionProcessId);
        remove(Lambda.eq((v0) -> {
            return v0.getMainSequenceId();
        }, versionProcessId));
        removeProcessAssociation(Lists.newArrayList(new Long[]{versionProcessId}));
        List<ProductionCraftProcessDeleteVO> voList = vo.getProductionCraftProcessDeleteVOList();
        if (Func.isNotEmpty(voList)) {
            List<ProductionCraftProcess> list = (List) voList.stream().filter(c -> {
                return !versionProcessId.equals(c.getId());
            }).map(i -> {
                ProductionCraftProcess productionCraftProcess = new ProductionCraftProcess();
                productionCraftProcess.setId(i.getId());
                productionCraftProcess.setSourceId(i.getSourceId());
                productionCraftProcess.setTargetId(i.getTargetId());
                productionCraftProcess.setXCoordinate(i.getXCoordinate());
                productionCraftProcess.setYCoordinate(i.getYCoordinate());
                return productionCraftProcess;
            }).collect(Collectors.toList());
            updateBatchById(list);
        }
        return true;
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    @Transactional(rollbackFor = {Exception.class})
    public Boolean updateVersionProcess(VersionProcessUpdateVO vo) {
        Long versionId = vo.getVersionId();
        int versionStatus = this.baseMapper.getVersionStatus(versionId);
        if (ProductionCraftStatusEnum.FINALIZED.getStatus().equals(Integer.valueOf(versionStatus))) {
            throw new ServiceException(MessageUtils.message("cps.production.craft.version.has.been.finalized.can.not.edit", new Object[0]));
        }
        ProductionCraftProcess productionCraftProcess = ProductionCraftProcessConvert.INSTANCE.convert(vo);
        Integer sort = productionCraftProcess.getSort();
        if (Func.notNull(sort)) {
            Long id = productionCraftProcess.getId();
            ProductionCraftProcess process = (ProductionCraftProcess) getById(id);
            if (Func.isNull(process.getMainSequenceId())) {
                List<ProductionCraftProcess> list = list((Wrapper) ((ExtraLambdaQueryWrapper) Lambda.eq((v0) -> {
                    return v0.getSort();
                }, sort).ne((v0) -> {
                    return v0.getId();
                }, vo.getId())).eq((v0) -> {
                    return v0.getVersionId();
                }, versionId));
                if (Func.isNotEmpty(list)) {
                    throw new ServiceException(MessageUtils.message("cps.production.craft.process.same.sort", new Object[0]));
                }
            }
        }
        updateById(productionCraftProcess);
        removeProcessAssociation(Lists.newArrayList(new Long[]{vo.getId()}));
        List<ProductionCraftProcessFile> fileList = Lists.newArrayList();
        List<ProductionCraftProcessRelatedTool> toolList = Lists.newArrayList();
        List<ProductionCraftProcessRelatedFixture> fixtureList = Lists.newArrayList();
        saveFileToolFixtures(vo.getId(), vo.getFiles(), vo.getTools(), vo.getFixtures(), fileList, toolList, fixtureList);
        if (Func.isNotEmpty(fileList)) {
            this.processFileService.saveBatch(fileList);
        }
        if (Func.isNotEmpty(toolList)) {
            this.relatedToolService.saveBatch(toolList);
        }
        if (Func.isNotEmpty(fixtureList)) {
            this.relatedFixtureService.saveBatch(fixtureList);
        }
        return true;
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public List<ProductionCraftProcessVO> listProcess(Long versionId) {
        List<ProductionCraftProcess> list = list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> {
            return v0.getVersionId();
        }, versionId));
        return ProductionCraftProcessConvert.INSTANCE.convert(list);
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    @Transactional(rollbackFor = {Exception.class})
    public Boolean saveParallel(VersionProcessParallelVO vo) {
        Long versionId = vo.getVersionId();
        List<ProcessParallelVO> childProcess = vo.getParallelVO();
        checkProcessType(childProcess);
        MainProcessSaveDTO build = MainProcessSaveDTO.builder().versionId(versionId).mainProcessName(vo.getProcessName()).mainProcessCode(vo.getProcessCode()).sort(vo.getSort()).targetId(vo.getTargetId()).sourceId(vo.getSourceId()).xCoordinate(vo.getXCoordinate()).yCoordinate(vo.getYCoordinate()).height(vo.getHeight()).build();
        ProductionCraftProcess craftProcess = saveMainProcess(build);
        return updateChildProcess(craftProcess, childProcess);
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public List<VersionProcessTreeVO> treeProcess(String versionId) {
        List<ProductionCraftProcess> list = list(Lambda.eq((v0) -> {
            return v0.getVersionId();
        }, versionId));
        List<VersionProcessTreeVO> vos = (List) list.stream().map(this::convert).collect(Collectors.toList());
        List<VersionProcessTreeVO> result = ForestNodeMerger.merge(vos);
        result.sort(Comparator.comparing((v0) -> {
            return v0.getSort();
        }));
        return result;
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public Boolean updateParallelProcess(UpdateParallelProcessVO vo) {
        ProductionCraftProcess process = new ProductionCraftProcess();
        process.setId(vo.getId());
        process.setProcessCode(vo.getProcessCode());
        process.setProcessName(vo.getProcessName());
        process.setSort(vo.getSort());
        return Boolean.valueOf(updateById(process) && ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) Lambda.updateWrapper(this.baseMapper).set((v0) -> {
            return v0.getSort();
        }, vo.getSort())).eq((v0) -> {
            return v0.getMainSequenceId();
        }, vo.getId())).update());
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    @Transactional(rollbackFor = {Exception.class})
    public List<ProductionCraftProcessVO> parallelSave(ProcessParallelSaveVO vo) {
        Long versionId = vo.getVersionId();
        validFixVersion(versionId);
        List<VersionProcessAddVO> normalProcessList = vo.getNormalProcessList();
        List<ProductionCraftProcessVO> res = Lists.newArrayList();
        List<Integer> sorts = Lists.newArrayList();
        if (Func.isNotEmpty(normalProcessList)) {
            List<Integer> sortList = (List) normalProcessList.stream().map((v0) -> {
                return v0.getSort();
            }).filter((v0) -> {
                return Func.notNull(v0);
            }).collect(Collectors.toList());
            sorts.addAll(sortList);
            List<ProductionCraftProcess> craftProcessList = saveAll(versionId, normalProcessList);
            res.addAll(ProductionCraftProcessConvert.INSTANCE.convert(craftProcessList));
        }
        List<ParallelProVO> parallelProcessList = vo.getParallelProcessList();
        if (Func.isNotEmpty(parallelProcessList)) {
            List<Integer> sortList2 = (List) parallelProcessList.stream().map((v0) -> {
                return v0.getSort();
            }).filter((v0) -> {
                return Func.notNull(v0);
            }).collect(Collectors.toList());
            sorts.addAll(sortList2);
            parallelProcessList.forEach(ppl -> {
                MainProcessSaveDTO build = MainProcessSaveDTO.builder().versionId(versionId).mainProcessName(ppl.getProcessName()).mainProcessCode(ppl.getProcessCode()).sort(ppl.getSort()).targetId(ppl.getTargetId()).sourceId(ppl.getSourceId()).xCoordinate(ppl.getXCoordinate()).yCoordinate(ppl.getYCoordinate()).height(ppl.getHeight()).build();
                ProductionCraftProcess mainProcess = saveMainProcess(build);
                res.add(ProductionCraftProcessConvert.INSTANCE.convert(mainProcess));
                List<VersionProcessAddVO> childProcessList = ppl.getChildProcessList();
                Map<Integer, List<VersionProcessAddVO>> collect = (Map) childProcessList.stream().collect(Collectors.groupingBy((v0) -> {
                    return v0.getProcessType();
                }));
                if (collect.size() > 1) {
                    throw new ServiceException(MessageUtils.message("cps.production.craft.version.child.process", new Object[0]));
                }
                List<ProductionCraftProcess> craftProcessList2 = saveAll(versionId, mainProcess.getId(), mainProcess.getSort(), childProcessList);
                res.addAll(ProductionCraftProcessConvert.INSTANCE.convert(craftProcessList2));
            });
        }
        Map<Integer, List<Integer>> collect = (Map) sorts.stream().collect(Collectors.groupingBy(c -> {
            return c;
        }));
        if (collect.size() != sorts.size()) {
            throw new ServiceException(MessageUtils.message("cps.production.craft.process.same.sort", new Object[0]));
        }
        return res;
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public List<ProductionCraftProcess> childProcessSave(ChildProcessVO vo) {
        List<VersionProcessAddVO> childProcess = vo.getChildProcess();
        Map<Integer, List<VersionProcessAddVO>> typeMap = (Map) childProcess.stream().collect(Collectors.groupingBy((v0) -> {
            return v0.getProcessType();
        }));
        if (typeMap.size() > 1) {
            throw new ServiceException(MessageUtils.message("cps.production.craft.version.child.process", new Object[0]));
        }
        Long mainId = vo.getMainId();
        Long versionId = vo.getVersionId();
        List<ProductionCraftProcess> list = list((Wrapper) Lambda.eq((v0) -> {
            return v0.getMainSequenceId();
        }, mainId).eq((v0) -> {
            return v0.getVersionId();
        }, versionId));
        if (Func.isNotEmpty(list)) {
            list.stream().map((v0) -> {
                return v0.getProcessType();
            }).findFirst().ifPresent(pt -> {
                if (!typeMap.containsKey(pt)) {
                    throw new ServiceException(MessageUtils.message("cps.production.craft.version.child.process", new Object[0]));
                }
            });
        }
        return saveAll(versionId, mainId, vo.getSort(), childProcess);
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    public Boolean childProcessRemove(String mainId, String childId) {
        return Boolean.valueOf(remove((Wrapper) Lambda.eq((v0) -> {
            return v0.getMainSequenceId();
        }, mainId).eq((v0) -> {
            return v0.getId();
        }, childId)));
    }
 
    @Override // org.springblade.modules.cps.service.IProductionCraftProcessService
    @Transactional(rollbackFor = {Exception.class})
    public Boolean childProcessUpdate(ProcessParallelUpdateVO vo) {
        Long versionId = vo.getVersionId();
        checkChildSize(vo.getMainProcess());
        boolean flag = changeAllProcess(versionId, vo.getNormalProcess(), vo.getMainProcess());
        return Boolean.valueOf(flag && removeChildProcess(versionId, vo.getRemoveIds()));
    }
 
    private boolean changeAllProcess(Long versionId, List<ProcessNmUpdateDTO> normalProcess, List<ProcessMainUpdateDTO> mainProcess) {
        List<Boolean> res = Lists.newArrayList();
        normalProcess.forEach(np -> {
            updateNormalInfo(versionId, np, res);
        });
        mainProcess.forEach(mp -> {
            boolean update = ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) Lambda.updateWrapper(this.baseMapper).set((v0) -> {
                return v0.getSort();
            }, mp.getSort())).set((v0) -> {
                return v0.getTargetId();
            }, mp.getTargetId())).set((v0) -> {
                return v0.getSourceId();
            }, mp.getSourceId())).set((v0) -> {
                return v0.getXCoordinate();
            }, mp.getXCoordinate())).set((v0) -> {
                return v0.getYCoordinate();
            }, mp.getYCoordinate())).set((v0) -> {
                return v0.getHeight();
            }, mp.getHeight())).eq((v0) -> {
                return v0.getId();
            }, mp.getId())).eq((v0) -> {
                return v0.getVersionId();
            }, versionId)).update();
            res.add(Boolean.valueOf(update));
            List<ProcessNmUpdateDTO> childList = mp.getChildList();
            childList.forEach(mcl -> {
                updateChildInfo(versionId, mcl, res);
            });
        });
        return res.stream().allMatch(c -> {
            return c.booleanValue();
        });
    }
 
    private void updateNormalInfo(Long versionId, ProcessNmUpdateDTO np, List<Boolean> res) {
        boolean update = ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) Lambda.updateWrapper(this.baseMapper).set((v0) -> {
            return v0.getSort();
        }, np.getSort())).set((v0) -> {
            return v0.getTargetId();
        }, np.getTargetId())).set((v0) -> {
            return v0.getSourceId();
        }, np.getSourceId())).set((v0) -> {
            return v0.getXCoordinate();
        }, np.getXCoordinate())).set((v0) -> {
            return v0.getYCoordinate();
        }, np.getYCoordinate())).set((v0) -> {
            return v0.getMainSequenceId();
        }, (Object) null)).eq((v0) -> {
            return v0.getId();
        }, np.getId())).eq((v0) -> {
            return v0.getVersionId();
        }, versionId)).update();
        res.add(Boolean.valueOf(update));
    }
 
    private void updateChildInfo(Long versionId, ProcessNmUpdateDTO np, List<Boolean> res) {
        boolean update = ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) Lambda.updateWrapper(this.baseMapper).set((v0) -> {
            return v0.getSort();
        }, np.getSort())).set((v0) -> {
            return v0.getTargetId();
        }, np.getTargetId())).set((v0) -> {
            return v0.getSourceId();
        }, np.getSourceId())).set((v0) -> {
            return v0.getXCoordinate();
        }, np.getXCoordinate())).set((v0) -> {
            return v0.getYCoordinate();
        }, np.getYCoordinate())).eq((v0) -> {
            return v0.getId();
        }, np.getId())).eq((v0) -> {
            return v0.getVersionId();
        }, versionId)).update();
        res.add(Boolean.valueOf(update));
    }
 
    /* JADX WARN: Removed duplicated region for block: B:7:0x0017  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private void checkChildSize(java.util.List<org.springblade.modules.cps.dto.ProcessMainUpdateDTO> r6) {
        /*
            r5 = this;
            r0 = r6
            boolean r0 = org.springblade.core.tool.utils.Func.isNotEmpty(r0)
            if (r0 == 0) goto L53
            r0 = r6
            java.util.Iterator r0 = r0.iterator()
            r7 = r0
        Le:
            r0 = r7
            boolean r0 = r0.hasNext()
            if (r0 == 0) goto L53
            r0 = r7
            java.lang.Object r0 = r0.next()
            org.springblade.modules.cps.dto.ProcessMainUpdateDTO r0 = (org.springblade.modules.cps.dto.ProcessMainUpdateDTO) r0
            r8 = r0
            r0 = r8
            java.util.List r0 = r0.getChildList()
            r9 = r0
            r0 = r9
            boolean r0 = org.springblade.core.tool.utils.Func.isEmpty(r0)
            if (r0 != 0) goto L3f
            r0 = r9
            int r0 = r0.size()
            java.lang.Integer r1 = org.springblade.modules.cps.service.impl.ProductionCraftProcessServiceImpl.CHILD_PROCESS_SIZE
            int r1 = r1.intValue()
            if (r0 >= r1) goto L50
        L3f:
            org.springblade.core.log.exception.ServiceException r0 = new org.springblade.core.log.exception.ServiceException
            r1 = r0
            java.lang.String r2 = "cps.production.craft.child.process.size.less"
            r3 = 0
            java.lang.Object[] r3 = new java.lang.Object[r3]
            java.lang.String r2 = org.springblade.common.utils.MessageUtils.message(r2, r3)
            r1.<init>(r2)
            throw r0
        L50:
            goto Le
        L53:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: org.springblade.modules.cps.service.impl.ProductionCraftProcessServiceImpl.checkChildSize(java.util.List):void");
    }
 
    private boolean removeChildProcess(Long versionId, List<Long> ids) {
        return Func.isEmpty(ids) || remove((Wrapper) Lambda.eq((v0) -> {
            return v0.getVersionId();
        }, versionId).in((v0) -> {
            return v0.getId();
        }, ids));
    }
 
    private List<ProductionCraftProcess> saveAll(Long versionId, List<VersionProcessAddVO> processList) {
        List<ProductionCraftProcess> list = Lists.newArrayList();
        processList.forEach(c -> {
            ProductionCraftProcess process = ProductionCraftProcessConvert.INSTANCE.convertAdd(c);
            process.setVersionId(versionId);
            save(process);
            saveOther(process.getId(), c);
            list.add(process);
        });
        return list;
    }
 
    private List<ProductionCraftProcess> saveAll(Long versionId, Long mainProcessId, Integer sort, List<VersionProcessAddVO> processList) {
        List<ProductionCraftProcess> list = Lists.newArrayList();
        processList.forEach(c -> {
            ProductionCraftProcess process = ProductionCraftProcessConvert.INSTANCE.convertAdd(c);
            process.setVersionId(versionId);
            process.setMainSequenceId(mainProcessId);
            process.setSort(sort);
            save(process);
            saveOther(process.getId(), c);
            list.add(process);
        });
        return list;
    }
 
    private void saveOther(Long versionProcessId, VersionProcessAddVO vo) {
        List<ProductionCraftProcessFile> fileList = Lists.newArrayList();
        List<ProductionCraftProcessRelatedTool> toolList = Lists.newArrayList();
        List<ProductionCraftProcessRelatedFixture> fixtureList = Lists.newArrayList();
        saveFileToolFixtures(versionProcessId, vo.getFiles(), vo.getTools(), vo.getFixtures(), fileList, toolList, fixtureList);
        if (Func.isNotEmpty(fileList)) {
            this.processFileService.saveBatch(fileList);
        }
        if (Func.isNotEmpty(toolList)) {
            this.relatedToolService.saveBatch(toolList);
        }
        if (Func.isNotEmpty(fixtureList)) {
            this.relatedFixtureService.saveBatch(fixtureList);
        }
    }
 
    private void validFixVersion(Long versionId) {
        int versionStatus = this.baseMapper.getVersionStatus(versionId);
        ThrowFun.isTrue(ProductionCraftStatusEnum.FINALIZED.getStatus().equals(Integer.valueOf(versionStatus))).throwMessage(MessageUtils.message("cps.production.craft.version.has.been.finalized.can.not.add", new Object[0]));
    }
 
    private VersionProcessTreeVO convert(ProductionCraftProcess process) {
        VersionProcessTreeVO vo = new VersionProcessTreeVO();
        vo.setId(process.getId());
        vo.setProcessId(process.getProcessId());
        vo.setProcessCode(process.getProcessCode());
        vo.setProcessName(process.getProcessName());
        vo.setSort(process.getSort());
        vo.setProcessType(process.getProcessType());
        Long sequenceId = process.getMainSequenceId();
        vo.setParentId(Long.valueOf(sequenceId == null ? 1024L : process.getMainSequenceId().longValue()));
        vo.setTargetId(process.getTargetId());
        vo.setSourceId(process.getSourceId());
        vo.setXCoordinate(process.getXCoordinate());
        vo.setYCoordinate(process.getYCoordinate());
        vo.setHeight(process.getHeight());
        return vo;
    }
 
    private ProductionCraftProcess saveMainProcess(MainProcessSaveDTO dto) {
        ProductionCraftProcess process = convertMainProcess(dto);
        save(process);
        return process;
    }
 
    private ProductionCraftProcess convertMainProcess(MainProcessSaveDTO dto) {
        return new ProductionCraftProcess().setVersionId(dto.getVersionId()).setProcessName(dto.getMainProcessName()).setProcessCode(dto.getMainProcessCode()).setWhetherParallel(MainProcessEnum.MAIN_PROCESS.getCode()).setSort(dto.getSort()).setTargetId(dto.getTargetId()).setSourceId(dto.getSourceId()).setXCoordinate(dto.getXCoordinate()).setYCoordinate(dto.getYCoordinate()).setHeight(dto.getHeight());
    }
 
    private Boolean updateChildProcess(ProductionCraftProcess mainProcess, List<ProcessParallelVO> childProcess) {
        List<ProductionCraftProcess> craftProcesses = (List) childProcess.stream().map(pro -> {
            ProductionCraftProcess process = new ProductionCraftProcess().setMainSequenceId(mainProcess.getId()).setWhetherParallel(MainProcessEnum.MAIN_PROCESS.getCode()).setSort(mainProcess.getSort());
            process.setId(pro.getVersionProcessId());
            return process;
        }).collect(Collectors.toList());
        return Boolean.valueOf(updateBatchById(craftProcesses));
    }
 
    private void checkProcessType(List<ProcessParallelVO> childProcess) {
        Map<Integer, List<ProcessParallelVO>> typeMap = (Map) childProcess.stream().collect(Collectors.groupingBy((v0) -> {
            return v0.getProcessType();
        }));
        if (typeMap.size() > 1) {
            throw new ServiceException(MessageUtils.message("cps.production.craft.version.child.process", new Object[0]));
        }
    }
 
    private void saveFileToolFixtures(Long versionProcessId, List<ProductionCraftProcessFileVO> files, List<ProductionCraftProcessRelatedToolVO> tools, List<ProductionCraftProcessRelatedFixtureVO> fixtures, List<ProductionCraftProcessFile> fileList, List<ProductionCraftProcessRelatedTool> toolList, List<ProductionCraftProcessRelatedFixture> fixtureList) {
        if (Func.isNotEmpty(files)) {
            fileList.addAll((Collection) files.stream().map(c -> {
                ProductionCraftProcessFile file = ProductionCraftProcessFileConvert.INSTANCE.convert(c);
                file.setVersionProcessId(versionProcessId);
                return file;
            }).collect(Collectors.toList()));
        }
        if (Func.isNotEmpty(tools)) {
            toolList.addAll((Collection) tools.stream().map(c2 -> {
                return new ProductionCraftProcessRelatedTool().setToolId(c2.getToolId()).setVersionProcessId(versionProcessId).setToolCode(c2.getToolCode()).setToolModelName(c2.getToolModelName()).setToolCategoryName(c2.getToolCategoryName());
            }).collect(Collectors.toList()));
        }
        if (Func.isNotEmpty(fixtures)) {
            fixtureList.addAll((Collection) fixtures.stream().map(c3 -> {
                return new ProductionCraftProcessRelatedFixture().setFixtureId(c3.getFixtureId()).setVersionProcessId(versionProcessId).setFixtureGroupName(c3.getFixtureGroupName()).setFixtureCode(c3.getFixtureCode()).setFixtureName(c3.getFixtureName());
            }).collect(Collectors.toList()));
        }
    }
 
    private boolean removeProcessAssociation(List<Long> ids) {
        this.processFileService.remove(Lambda.in((v0) -> {
            return v0.getVersionProcessId();
        }, ids));
        this.relatedToolService.remove(Lambda.in((v0) -> {
            return v0.getVersionProcessId();
        }, ids));
        this.relatedFixtureService.remove(Lambda.in((v0) -> {
            return v0.getVersionProcessId();
        }, ids));
        return true;
    }
}