| | |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.context.event.ApplicationReadyEvent; |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | |
| | | private AreaAgvService areaAgvService; |
| | | |
| | | // launcher ------------------------------------------------------- |
| | | @EventListener(ApplicationReadyEvent.class) |
| | | // @EventListener(ApplicationReadyEvent.class) |
| | | @PostConstruct |
| | | public void init() { |
| | | List<Area> areaList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getStatus, StatusType.ENABLE.val)); |
| | | if (Cools.isEmpty(areaList)) { |
| | |
| | | return areaIds; |
| | | } |
| | | |
| | | // checkout list of code by code data |
| | | public List<String> queryCodesByOneCode(String code) { |
| | | Set<String> codeSet = new HashSet<>(); |
| | | for (Map.Entry<Long, List<String>> entry : AREA_CODE.entrySet()) { |
| | | List<String> codeList = entry.getValue(); |
| | | if (!Cools.isEmpty(codeList) && codeList.contains(code)) { |
| | | codeSet.addAll(codeList); |
| | | } |
| | | } |
| | | return new ArrayList<>(codeSet); |
| | | } |
| | | |
| | | // checkout list of code by area ids |
| | | public List<String> queryCodes(List<Long> areaIds) { |
| | | if (Cools.isEmpty(areaIds)) { |
| | |
| | | public Boolean removeArea(Long areaId) { |
| | | if (null == areaId) { return false; } |
| | | List<String> codeList = AREA_CODE.get(areaId); |
| | | AREA_CODE.get(areaId).clear(); |
| | | AREA_CODE.remove(areaId); |
| | | if (!Cools.isEmpty(codeList)) { |
| | | AREA_CODE.get(areaId).clear(); |
| | | AREA_CODE.remove(areaId); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |