Blame view

src/main/java/com/huaheng/pc/config/station/service/StationService.java 3.09 KB
mahuandong authored
1
package com.huaheng.pc.config.station.service;
mahuandong authored
2
周鸿 authored
3
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
周鸿 authored
4
import com.huaheng.common.constant.QuantityConstant;
5
import com.huaheng.common.utils.StringUtils;
周鸿 authored
6
import com.huaheng.common.utils.Wrappers;
周鸿 authored
7
8
9
10
import com.huaheng.pc.config.container.domain.Container;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.config.containerType.domain.ContainerType;
import com.huaheng.pc.config.containerType.service.ContainerTypeService;
mahuandong authored
11
import org.springframework.stereotype.Service;
周鸿 authored
12
13
14

import java.util.ArrayList;
import java.util.HashMap;
mahuandong authored
15
import java.util.List;
周鸿 authored
16
import java.util.Map;
周鸿 authored
17
mahuandong authored
18
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
mahuandong authored
19
20
import com.huaheng.pc.config.station.domain.Station;
import com.huaheng.pc.config.station.mapper.StationMapper;
周鸿 authored
21
22
23

import javax.annotation.Resource;
mahuandong authored
24
25
26
27
/**
 * Created by Enzo Cotter on 2019/10/11.
 */
周鸿 authored
28
@Service("stationService")
mahuandong authored
29
public class StationService extends ServiceImpl<StationMapper, Station> {
周鸿 authored
30
31
32
33
34
    @Resource
    private ContainerService containerService;
    @Resource
    private ContainerTypeService containerTypeService;
mahuandong authored
35
周鸿 authored
36
37
38
39
40
    public List<Station> selectlist(){
        LambdaQueryWrapper<Station> lambdaQueryWrapper = Wrappers.lambdaQuery();
        List<Station> list =  this.list(lambdaQueryWrapper);
        return list;
    }
周鸿 authored
41
42
43
44
45
46
47
48
    public Station getStaionByCode(String code,String warehouseCode){
        Station station = this.getOne(
                new LambdaQueryWrapper<Station>()
                        .eq(Station::getWarehouseCode, warehouseCode)
                        .eq(Station::getCode, code)
                        .last("limit 1"));
        return station;
    }
49
    public List<Station> getStationByAreaType(String area,String stationtype,String warehouseCode){
周鸿 authored
50
        LambdaQueryWrapper<Station> queryWrapper = Wrappers.lambdaQuery();
51
52
53
54
55
56
        queryWrapper.eq(StringUtils.isNotEmpty(area),Station::getArea, area);
        queryWrapper.eq(StringUtils.isNotEmpty(stationtype),Station::getStationType, stationtype);
        queryWrapper.eq(StringUtils.isNotEmpty(warehouseCode),Station::getWarehouseCode, warehouseCode);
        List<Station> stationList = this.list(queryWrapper);
        return stationList;
    }
周鸿 authored
57
58
    public List<Station> getStationByContainers(String containerCode,String type,String warehouseCode){
        Container container = containerService.getContainerByCode(containerCode,warehouseCode);
59
60
61
62
63
64
65
66
67
68
69
        ContainerType containerType = containerTypeService.getContainerTypeByCode(container.getContainerType(), container.getWarehouseCode());
        Map<String, Object> map = new HashMap<>();
        if (container == null) {
            return null;
        }
        String area=containerType.getArea();

        LambdaQueryWrapper<Station> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(StringUtils.isNotEmpty(area),Station::getArea, area);
        queryWrapper.eq(StringUtils.isNotEmpty(type),Station::getType, type);
        queryWrapper.eq(Station::getRoadway,1);
周鸿 authored
70
71
72
        List<Station> stationList = this.list(queryWrapper);
        return stationList;
    }
周鸿 authored
73
mahuandong authored
74
}