| | |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import com.zy.acs.manager.core.domain.SortCodeDto; |
| | | import com.zy.acs.manager.core.service.astart.domain.DynamicNode; |
| | | import com.zy.acs.manager.core.utils.RouteGenerator; |
| | | import com.zy.acs.manager.manager.entity.Code; |
| | | import com.zy.acs.manager.manager.entity.Route; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.service.CodeService; |
| | | import com.zy.acs.manager.manager.service.RouteService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | return mapMatrix; |
| | | } |
| | | |
| | | public synchronized void initRouteMap(Integer lev) { |
| | | log.info("There is initializing Route Map......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |
| | | Set<String> routeKeys = redis.getMapKeys(RedisConstant.AGV_MAP_ROUTE_HASH_FLAG); |
| | | List<Route> routeList = routeService.list(new LambdaQueryWrapper<Route>().eq(Route::getStatus, StatusType.ENABLE.val)); |
| | | if (routeKeys.size() == routeList.size()) { |
| | | return; |
| | | } |
| | | for (Route route : routeList) { |
| | | Code startCode = codeService.getById(route.getStartCode()); |
| | | Code endCode = codeService.getById(route.getEndCode()); |
| | | String routeKey = RouteGenerator.generateRouteKey(startCode.getData(), endCode.getData()); |
| | | if (Cools.isEmpty(routeKey)) { |
| | | continue; |
| | | } |
| | | redis.setMap(RedisConstant.AGV_MAP_ROUTE_HASH_FLAG, routeKey, Boolean.TRUE); |
| | | } |
| | | } |
| | | |
| | | public synchronized String[][] initCodeMatrix(Integer lev) { |
| | | log.info("There is initializing Code Matrix......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |