yangys
2024-03-28 23a939ed820ee32f9a4309f9c81b7bab5a566f30
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
package com.qianwen.smartman.modules.cps.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.lang.invoke.SerializedLambda;
import java.util.List;
import com.qianwen.smartman.common.utils.MessageUtils;
import com.qianwen.core.log.exception.ServiceException;
import com.qianwen.core.mp.base.BaseServiceImpl;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.cps.convert.WarehouseGridConvert;
import com.qianwen.smartman.modules.cps.entity.WarehouseGrid;
import com.qianwen.smartman.modules.cps.mapper.WarehouseGridMapper;
import com.qianwen.smartman.modules.cps.service.IWarehouseGridService;
import com.qianwen.smartman.modules.cps.service.IWarehouseStationService;
import com.qianwen.smartman.modules.cps.vo.WarehouseGridCreateVO;
import com.qianwen.smartman.modules.cps.vo.WarehouseGridUpdateVO;
import com.qianwen.smartman.modules.cps.vo.WarehouseGridVO;
import org.springframework.stereotype.Service;
 
@Service
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/WarehouseGridServiceImpl.class */
public class WarehouseGridServiceImpl extends BaseServiceImpl<WarehouseGridMapper, WarehouseGrid> implements IWarehouseGridService {
    private IWarehouseStationService warehouseStationService;
 
    private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
        String implMethodName = lambda.getImplMethodName();
        boolean z = true;
        switch (implMethodName.hashCode()) {
            case -2090991943:
                if (implMethodName.equals("getStationId")) {
                    z = false;
                    break;
                }
                break;
            case -75622813:
                if (implMethodName.equals("getCode")) {
                    z = true;
                    break;
                }
                break;
            case 98245393:
                if (implMethodName.equals("getId")) {
                    z = true;
                    break;
                }
                break;
        }
        switch (z) {
            case false:
                if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WarehouseGrid") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
                    return (v0) -> {
                        return v0.getStationId();
                    };
                }
                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();
                    };
                }
                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/WarehouseGrid") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
                    return (v0) -> {
                        return v0.getCode();
                    };
                }
                break;
        }
        throw new IllegalArgumentException("Invalid lambda deserialization");
    }
 
    public WarehouseGridServiceImpl(final IWarehouseStationService warehouseStationService) {
        this.warehouseStationService = warehouseStationService;
    }
 
    @Override // org.springblade.modules.cps.service.IWarehouseGridService
    public WarehouseGridVO create(WarehouseGridCreateVO warehouseGridCreateVO) {
        WarehouseGrid warehouseGrid = WarehouseGridConvert.INSTANCE.convert(warehouseGridCreateVO);
        checkWarehouseGrid(warehouseGrid);
        save(warehouseGrid);
        return WarehouseGridConvert.INSTANCE.convert(warehouseGrid);
    }
 
    @Override // org.springblade.modules.cps.service.IWarehouseGridService
    public WarehouseGridVO update(WarehouseGridUpdateVO warehouseGridUpdateVO) {
        WarehouseGrid warehouseGrid = WarehouseGridConvert.INSTANCE.convert(warehouseGridUpdateVO);
        checkWarehouseGrid(warehouseGrid);
        Long id = warehouseGrid.getId();
        WarehouseGrid old = (WarehouseGrid) getById(id);
        if (Func.isEmpty(old)) {
            throw new ServiceException(MessageUtils.message("cps.warehouse.grid.not.exists", new Object[0]));
        }
        updateById(warehouseGrid);
        return WarehouseGridConvert.INSTANCE.convert(warehouseGrid);
    }
 
    @Override // org.springblade.modules.cps.service.IWarehouseGridService
    public List<WarehouseGridVO> listByStationId(Long stationId) {
        List<WarehouseGrid> list = list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> {
            return v0.getStationId();
        }, stationId));
        return WarehouseGridConvert.INSTANCE.convert(list);
    }
 
    private void checkWarehouseGrid(WarehouseGrid warehouseGrid) {
        long count = count((Wrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(warehouseGrid.getId()), (v0) -> {
            return v0.getId();
        }, warehouseGrid.getId()).eq((v0) -> {
            return v0.getCode();
        }, warehouseGrid.getCode()));
        if (count > 0) {
            throw new ServiceException(MessageUtils.message("cps.warehouse.grid.code.already.exists", new Object[0]));
        }
    }
}