# LocationInqManagerImpl.java

    package com.mycim.server.reticle.manager.imp;

    import com.mycim.framework.utils.lang.StringUtils;

    import com.mycim.server.ems.manager.EquipmentInqManager;

    import com.mycim.server.reticle.dao.LocationInqDAO;
    import com.mycim.server.reticle.manager.LocationInqManager;
    import com.mycim.valueobject.ems.Location;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;

    /**
     * location 查询 manager实现类
     *
     * @author can.yang
     */
    @Service
    public class LocationInqManagerImpl implements LocationInqManager {
        @Autowired
        private LocationInqDAO locationInqDAO;

        @Autowired
        private EquipmentInqManager equipmentInqManager;

        @Override
        public Location getLocationById(String locationId) {
            return locationInqDAO.getLocationById(locationId);
        }

        @Override
        public Location getLocationByRrn(Long locationRrn) {
            return locationInqDAO.getLocationByRrn(locationRrn);
        }

        @Override
        public String getLocationIdOrEquipmentId(Long locationRrn) {
            String locationId;
            Location location = getLocationByRrn(locationRrn);
            if (location != null) {
                locationId = location.getLocationId();
            }else {
                locationId = equipmentInqManager.getEquipmentId(locationRrn);
            }
            return StringUtils.isNotBlank(locationId) ? locationId : StringUtils.EMPTY;
        }
    }