yangys
2024-04-04 ed4a5236bab800094be4a8378f5098eebe3de6ac
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
package com.qianwen.smartman.modules.dnc.entity;
 
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import lombok.NonNull;
import com.qianwen.core.mp.base.BaseEntity;
import com.qianwen.smartman.modules.dnc.enums.FileType;
 
@TableName(File.TABLE_NAME)
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/dnc/entity/File.class */
public class File extends BaseEntity implements Serializable {
    public static final String TABLE_NAME = "blade_dnc_craft_file";
    private static final long serialVersionUID = 1;
    private static final String PATH_SPLIT = "/";
    @TableField("display_name")
    private String displayName;
    @TableField(value = "pid", insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
    private Long parentId;
    @TableField("all_path")
    private String allPath;
    @TableField("content_length")
    private Long contentLength;
    @TableField("content_type")
    private String contentType;
    @TableField("suffix")
    private String suffix;
    private Integer fileType;
    @TableField("object_key")
    private String objectKey;
    @TableField("content_md5")
    private String contentMd5;
    @TableField("is_locked")
    private boolean isLocked;
    @TableField("owner")
    private Long owner;
    @TableField("tenant_id")
    private String tenantId;
    private Boolean isCurrent;
    private Date coverTime;
    private String link;
    private Integer version;
    @TableField(exist = false)
    private Long mark;
 
    public void setDisplayName(final String displayName) {
        this.displayName = displayName;
    }
 
    public void setParentId(final Long parentId) {
        this.parentId = parentId;
    }
 
    public void setAllPath(final String allPath) {
        this.allPath = allPath;
    }
 
    public void setContentLength(final Long contentLength) {
        this.contentLength = contentLength;
    }
 
    public void setContentType(final String contentType) {
        this.contentType = contentType;
    }
 
    public void setSuffix(final String suffix) {
        this.suffix = suffix;
    }
 
    public void setFileType(final Integer fileType) {
        this.fileType = fileType;
    }
 
    public void setObjectKey(final String objectKey) {
        this.objectKey = objectKey;
    }
 
    public void setContentMd5(final String contentMd5) {
        this.contentMd5 = contentMd5;
    }
 
    public void setLocked(final boolean isLocked) {
        this.isLocked = isLocked;
    }
 
    public void setOwner(final Long owner) {
        this.owner = owner;
    }
 
    public void setTenantId(final String tenantId) {
        this.tenantId = tenantId;
    }
 
    public void setIsCurrent(final Boolean isCurrent) {
        this.isCurrent = isCurrent;
    }
 
    public void setCoverTime(final Date coverTime) {
        this.coverTime = coverTime;
    }
 
    public void setLink(final String link) {
        this.link = link;
    }
 
    public void setVersion(final Integer version) {
        this.version = version;
    }
 
    public void setMark(final Long mark) {
        this.mark = mark;
    }
 
    public String toString() {
        return "File(displayName=" + getDisplayName() + ", parentId=" + getParentId() + ", allPath=" + getAllPath() + ", contentLength=" + getContentLength() + ", contentType=" + getContentType() + ", suffix=" + getSuffix() + ", fileType=" + getFileType() + ", objectKey=" + getObjectKey() + ", contentMd5=" + getContentMd5() + ", isLocked=" + isLocked() + ", owner=" + getOwner() + ", tenantId=" + getTenantId() + ", isCurrent=" + getIsCurrent() + ", coverTime=" + getCoverTime() + ", link=" + getLink() + ", version=" + getVersion() + ", mark=" + getMark() + ")";
    }
 
    /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/dnc/entity/File$FileBuilder.class */
    public static class FileBuilder {
        private String displayName;
        private Long parentId;
        private String allPath;
        private boolean contentLength$set;
        private Long contentLength$value;
        private String contentType;
        private String suffix;
        private Integer fileType;
        private String objectKey;
        private String contentMd5;
        private boolean isLocked;
        private Long owner;
        private String tenantId;
        private Boolean isCurrent;
        private Date coverTime;
        private String link;
        private Integer version;
        private Long mark;
 
        FileBuilder() {
        }
 
        public FileBuilder displayName(final String displayName) {
            this.displayName = displayName;
            return this;
        }
 
        public FileBuilder parentId(final Long parentId) {
            this.parentId = parentId;
            return this;
        }
 
        public FileBuilder allPath(final String allPath) {
            this.allPath = allPath;
            return this;
        }
 
        public FileBuilder contentLength(final Long contentLength) {
            this.contentLength$value = contentLength;
            this.contentLength$set = true;
            return this;
        }
 
        public FileBuilder contentType(final String contentType) {
            this.contentType = contentType;
            return this;
        }
 
        public FileBuilder suffix(final String suffix) {
            this.suffix = suffix;
            return this;
        }
 
        public FileBuilder fileType(final Integer fileType) {
            this.fileType = fileType;
            return this;
        }
 
        public FileBuilder objectKey(final String objectKey) {
            this.objectKey = objectKey;
            return this;
        }
 
        public FileBuilder contentMd5(final String contentMd5) {
            this.contentMd5 = contentMd5;
            return this;
        }
 
        public FileBuilder isLocked(final boolean isLocked) {
            this.isLocked = isLocked;
            return this;
        }
 
        public FileBuilder owner(final Long owner) {
            this.owner = owner;
            return this;
        }
 
        public FileBuilder tenantId(final String tenantId) {
            this.tenantId = tenantId;
            return this;
        }
 
        public FileBuilder isCurrent(final Boolean isCurrent) {
            this.isCurrent = isCurrent;
            return this;
        }
 
        public FileBuilder coverTime(final Date coverTime) {
            this.coverTime = coverTime;
            return this;
        }
 
        public FileBuilder link(final String link) {
            this.link = link;
            return this;
        }
 
        public FileBuilder version(final Integer version) {
            this.version = version;
            return this;
        }
 
        public FileBuilder mark(final Long mark) {
            this.mark = mark;
            return this;
        }
 
        public File build() {
            Long contentLength$value = this.contentLength$value;
            if (!this.contentLength$set) {
                contentLength$value = File.access$000();
            }
            return new File(this.displayName, this.parentId, this.allPath, contentLength$value, this.contentType, this.suffix, this.fileType, this.objectKey, this.contentMd5, this.isLocked, this.owner, this.tenantId, this.isCurrent, this.coverTime, this.link, this.version, this.mark);
        }
 
        public String toString() {
            return "File.FileBuilder(displayName=" + this.displayName + ", parentId=" + this.parentId + ", allPath=" + this.allPath + ", contentLength$value=" + this.contentLength$value + ", contentType=" + this.contentType + ", suffix=" + this.suffix + ", fileType=" + this.fileType + ", objectKey=" + this.objectKey + ", contentMd5=" + this.contentMd5 + ", isLocked=" + this.isLocked + ", owner=" + this.owner + ", tenantId=" + this.tenantId + ", isCurrent=" + this.isCurrent + ", coverTime=" + this.coverTime + ", link=" + this.link + ", version=" + this.version + ", mark=" + this.mark + ")";
        }
    }
 
    private static Long $default$contentLength() {
        return 0L;
    }
 
    public static FileBuilder builder() {
        return new FileBuilder();
    }
 
    public File(final String displayName, final Long parentId, final String allPath, final Long contentLength, final String contentType, final String suffix, final Integer fileType, final String objectKey, final String contentMd5, final boolean isLocked, final Long owner, final String tenantId, final Boolean isCurrent, final Date coverTime, final String link, final Integer version, final Long mark) {
        this.displayName = displayName;
        this.parentId = parentId;
        this.allPath = allPath;
        this.contentLength = contentLength;
        this.contentType = contentType;
        this.suffix = suffix;
        this.fileType = fileType;
        this.objectKey = objectKey;
        this.contentMd5 = contentMd5;
        this.isLocked = isLocked;
        this.owner = owner;
        this.tenantId = tenantId;
        this.isCurrent = isCurrent;
        this.coverTime = coverTime;
        this.link = link;
        this.version = version;
        this.mark = mark;
    }
 
    public File() {
        this.contentLength = $default$contentLength();
    }
 
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (o instanceof File) {
            File other = (File) o;
            if (other.canEqual(this) && super.equals(o) && isLocked() == other.isLocked()) {
                Object this$parentId = getParentId();
                Object other$parentId = other.getParentId();
                if (this$parentId == null) {
                    if (other$parentId != null) {
                        return false;
                    }
                } else if (!this$parentId.equals(other$parentId)) {
                    return false;
                }
                Object this$contentLength = getContentLength();
                Object other$contentLength = other.getContentLength();
                if (this$contentLength == null) {
                    if (other$contentLength != null) {
                        return false;
                    }
                } else if (!this$contentLength.equals(other$contentLength)) {
                    return false;
                }
                Object this$fileType = getFileType();
                Object other$fileType = other.getFileType();
                if (this$fileType == null) {
                    if (other$fileType != null) {
                        return false;
                    }
                } else if (!this$fileType.equals(other$fileType)) {
                    return false;
                }
                Object this$owner = getOwner();
                Object other$owner = other.getOwner();
                if (this$owner == null) {
                    if (other$owner != null) {
                        return false;
                    }
                } else if (!this$owner.equals(other$owner)) {
                    return false;
                }
                Object this$isCurrent = getIsCurrent();
                Object other$isCurrent = other.getIsCurrent();
                if (this$isCurrent == null) {
                    if (other$isCurrent != null) {
                        return false;
                    }
                } else if (!this$isCurrent.equals(other$isCurrent)) {
                    return false;
                }
                Object this$version = getVersion();
                Object other$version = other.getVersion();
                if (this$version == null) {
                    if (other$version != null) {
                        return false;
                    }
                } else if (!this$version.equals(other$version)) {
                    return false;
                }
                Object this$mark = getMark();
                Object other$mark = other.getMark();
                if (this$mark == null) {
                    if (other$mark != null) {
                        return false;
                    }
                } else if (!this$mark.equals(other$mark)) {
                    return false;
                }
                Object this$displayName = getDisplayName();
                Object other$displayName = other.getDisplayName();
                if (this$displayName == null) {
                    if (other$displayName != null) {
                        return false;
                    }
                } else if (!this$displayName.equals(other$displayName)) {
                    return false;
                }
                Object this$allPath = getAllPath();
                Object other$allPath = other.getAllPath();
                if (this$allPath == null) {
                    if (other$allPath != null) {
                        return false;
                    }
                } else if (!this$allPath.equals(other$allPath)) {
                    return false;
                }
                Object this$contentType = getContentType();
                Object other$contentType = other.getContentType();
                if (this$contentType == null) {
                    if (other$contentType != null) {
                        return false;
                    }
                } else if (!this$contentType.equals(other$contentType)) {
                    return false;
                }
                Object this$suffix = getSuffix();
                Object other$suffix = other.getSuffix();
                if (this$suffix == null) {
                    if (other$suffix != null) {
                        return false;
                    }
                } else if (!this$suffix.equals(other$suffix)) {
                    return false;
                }
                Object this$objectKey = getObjectKey();
                Object other$objectKey = other.getObjectKey();
                if (this$objectKey == null) {
                    if (other$objectKey != null) {
                        return false;
                    }
                } else if (!this$objectKey.equals(other$objectKey)) {
                    return false;
                }
                Object this$contentMd5 = getContentMd5();
                Object other$contentMd5 = other.getContentMd5();
                if (this$contentMd5 == null) {
                    if (other$contentMd5 != null) {
                        return false;
                    }
                } else if (!this$contentMd5.equals(other$contentMd5)) {
                    return false;
                }
                Object this$tenantId = getTenantId();
                Object other$tenantId = other.getTenantId();
                if (this$tenantId == null) {
                    if (other$tenantId != null) {
                        return false;
                    }
                } else if (!this$tenantId.equals(other$tenantId)) {
                    return false;
                }
                Object this$coverTime = getCoverTime();
                Object other$coverTime = other.getCoverTime();
                if (this$coverTime == null) {
                    if (other$coverTime != null) {
                        return false;
                    }
                } else if (!this$coverTime.equals(other$coverTime)) {
                    return false;
                }
                Object this$link = getLink();
                Object other$link = other.getLink();
                return this$link == null ? other$link == null : this$link.equals(other$link);
            }
            return false;
        }
        return false;
    }
 
    protected boolean canEqual(final Object other) {
        return other instanceof File;
    }
 
    public int hashCode() {
        int result = super.hashCode();
        int result2 = (result * 59) + (isLocked() ? 79 : 97);
        Object $parentId = getParentId();
        int result3 = (result2 * 59) + ($parentId == null ? 43 : $parentId.hashCode());
        Object $contentLength = getContentLength();
        int result4 = (result3 * 59) + ($contentLength == null ? 43 : $contentLength.hashCode());
        Object $fileType = getFileType();
        int result5 = (result4 * 59) + ($fileType == null ? 43 : $fileType.hashCode());
        Object $owner = getOwner();
        int result6 = (result5 * 59) + ($owner == null ? 43 : $owner.hashCode());
        Object $isCurrent = getIsCurrent();
        int result7 = (result6 * 59) + ($isCurrent == null ? 43 : $isCurrent.hashCode());
        Object $version = getVersion();
        int result8 = (result7 * 59) + ($version == null ? 43 : $version.hashCode());
        Object $mark = getMark();
        int result9 = (result8 * 59) + ($mark == null ? 43 : $mark.hashCode());
        Object $displayName = getDisplayName();
        int result10 = (result9 * 59) + ($displayName == null ? 43 : $displayName.hashCode());
        Object $allPath = getAllPath();
        int result11 = (result10 * 59) + ($allPath == null ? 43 : $allPath.hashCode());
        Object $contentType = getContentType();
        int result12 = (result11 * 59) + ($contentType == null ? 43 : $contentType.hashCode());
        Object $suffix = getSuffix();
        int result13 = (result12 * 59) + ($suffix == null ? 43 : $suffix.hashCode());
        Object $objectKey = getObjectKey();
        int result14 = (result13 * 59) + ($objectKey == null ? 43 : $objectKey.hashCode());
        Object $contentMd5 = getContentMd5();
        int result15 = (result14 * 59) + ($contentMd5 == null ? 43 : $contentMd5.hashCode());
        Object $tenantId = getTenantId();
        int result16 = (result15 * 59) + ($tenantId == null ? 43 : $tenantId.hashCode());
        Object $coverTime = getCoverTime();
        int result17 = (result16 * 59) + ($coverTime == null ? 43 : $coverTime.hashCode());
        Object $link = getLink();
        return (result17 * 59) + ($link == null ? 43 : $link.hashCode());
    }
 
    static /* synthetic */ Long access$000() {
        return $default$contentLength();
    }
 
    public String getDisplayName() {
        return this.displayName;
    }
 
    public Long getParentId() {
        return this.parentId;
    }
 
    public String getAllPath() {
        return this.allPath;
    }
 
    public Long getContentLength() {
        return this.contentLength;
    }
 
    public String getContentType() {
        return this.contentType;
    }
 
    public String getSuffix() {
        return this.suffix;
    }
 
    public Integer getFileType() {
        return this.fileType;
    }
 
    public String getObjectKey() {
        return this.objectKey;
    }
 
    public String getContentMd5() {
        return this.contentMd5;
    }
 
    public boolean isLocked() {
        return this.isLocked;
    }
 
    public Long getOwner() {
        return this.owner;
    }
 
    public String getTenantId() {
        return this.tenantId;
    }
 
    public Boolean getIsCurrent() {
        return this.isCurrent;
    }
 
    public Date getCoverTime() {
        return this.coverTime;
    }
 
    public String getLink() {
        return this.link;
    }
 
    public Integer getVersion() {
        return this.version;
    }
 
    public Long getMark() {
        return this.mark;
    }
 
    public static File newFolder(Long owner, Long parentId, final String displayName) {
        return builder().displayName((String) Optional.ofNullable(displayName).orElse("新建文件夹")).parentId(parentId).owner(owner).fileType(Integer.valueOf(FileType.FOLDER.getValue())).isCurrent(true).build();
    }
 
    public static File newFile(Long owner, Long parentId, final String displayName) {
        return builder().displayName((String) Optional.ofNullable(displayName).orElse("新建文本文件")).fileType(Integer.valueOf(FileType.FILE.getValue())).parentId(parentId).owner(owner).contentType("text/plain").suffix(".txt").build();
    }
 
    public void changeParent(Long parentId) {
        this.parentId = parentId;
    }
 
    public void rename(@NonNull String newName) {
        if (newName == null) {
            throw new NullPointerException("newName is marked non-null but is null");
        }
        this.displayName = newName;
    }
 
    public void joinPath(String parentPath) {
        String idStr = (String) Optional.ofNullable(getId()).map((v0) -> {
            return v0.toString();
        }).orElse("");
        this.allPath = (String) Optional.ofNullable(this.allPath).orElse(idStr);
        this.allPath = (String) Optional.ofNullable(parentPath).map(c -> {
            return c + "/" + this.allPath;
        }).orElse(this.allPath);
    }
 
    public void path(File targetFile, @NonNull File startFile) {
        if (startFile == null) {
            throw new NullPointerException("startFile is marked non-null but is null");
        }
        setAllPath(combPath(targetFile, startFile));
    }
 
    private String combPath(File targetFile, @NonNull File startFile) {
        if (startFile == null) {
            throw new NullPointerException("startFile is marked non-null but is null");
        }
        List<String> targetFilePath = (List) Optional.ofNullable(targetFile).map((v0) -> {
            return v0.pathList();
        }).orElse(new ArrayList());
        String startPath = startFile.getId().toString();
        List<String> thisPath = pathList();
        int startIndex = thisPath.indexOf(startPath);
        Collection<? extends String> otherPath = (List) thisPath.stream().skip(startIndex == -1 ? 0L : startIndex).collect(Collectors.toList());
        List<String> newList = new ArrayList<>();
        newList.addAll(targetFilePath);
        newList.addAll(targetFilePath.size(), otherPath);
        return String.join("/", newList);
    }
 
    public String lastPathId() {
        return (String) Optional.of(pathList()).filter(c -> {
            return !c.isEmpty();
        }).map(c2 -> {
            return (String) c2.get(c2.size() - 1);
        }).orElse(null);
    }
 
    public List<String> pathList() {
        Optional<String> path = Optional.ofNullable(this.allPath);
        return (List) path.map(c -> {
            return Arrays.asList(c.split("\\/"));
        }).orElse(new ArrayList());
    }
 
    public void joinPath(List<String> pathList, String startPath) {
        List<String> originPath = pathList();
        int startIndex = originPath.indexOf(startPath);
        Collection<? extends String> list = (List) originPath.stream().skip(startIndex).collect(Collectors.toList());
        List<String> newList = new ArrayList<>();
        newList.addAll(pathList);
        newList.addAll(pathList.size(), list);
        this.allPath = String.join("/", newList);
    }
 
    /* JADX WARN: Multi-variable type inference failed */
    public void changeParent(Map<String, String> keyMap, Long defaultValue) {
        boolean isFromRoot = this.parentId == null && defaultValue != null;
        if (isFromRoot) {
            changeParent(defaultValue);
            return;
        }
        String key = (String) Optional.ofNullable(this.parentId).map((v0) -> {
            return v0.toString();
        }).orElse("");
        String pid = (String) keyMap.getOrDefault(key, Optional.ofNullable(defaultValue).map((v0) -> {
            return v0.toString();
        }).orElse(null));
        changeParent(pid, defaultValue);
    }
 
    public void changeChildPath(Map<String, String> keyMap) {
        List<String> originPath = pathList();
        List<String> newList1 = (List) originPath.stream().map(c -> {
            return (String) keyMap.getOrDefault(c, c);
        }).collect(Collectors.toList());
        this.allPath = String.join("/", newList1);
    }
 
    public File copy() {
        return builder().contentType(getContentType()).displayName(getDisplayName()).parentId(getParentId()).allPath(getAllPath()).objectKey(getObjectKey()).owner(getOwner()).contentLength(getContentLength()).suffix(getSuffix()).fileType(getFileType()).isCurrent(this.isCurrent).mark(this.mark).version(this.version).link(this.link).contentMd5(this.contentMd5).build();
    }
 
    public void setNewName(List<String> fileNames) {
        setDisplayName(getNewName(fileNames, getDisplayName(), getDisplayName(), 0));
    }
 
    private String getNewName(List<String> fileNames, String originalName, String newName, Integer index) {
        if (fileNames.contains(newName)) {
            Integer index2 = Integer.valueOf(index.intValue() + 1);
            return getNewName(fileNames, originalName, this.fileType.intValue() == FileType.FILE.getValue() ? originalName.split("\\.")[0] + "(" + index2 + ")." + originalName.split("\\.")[1] : originalName + "(" + index2 + ")", index2);
        }
        return newName;
    }
 
    private void changeParent(String pid, Long defaultValue) {
        if (pid == null) {
            changeParent(defaultValue);
        } else {
            changeParent(Long.valueOf(pid));
        }
    }
}