#
vincentlu
2 天以前 b0d8223aa90f5a812ecbd6bab9eaf4382b62f5b2
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/RouteServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.common.utils.GsonUtils;
import com.zy.acs.common.utils.Utils;
import com.zy.acs.framework.exception.CoolException;
import com.zy.acs.manager.manager.entity.Code;
import com.zy.acs.manager.manager.entity.Route;
@@ -32,6 +33,7 @@
            return null;
        }
        Route route = this.findByCodeOfBoth(startCode.getId(), endCode.getId());
        boolean created = false;
        direction = Optional.ofNullable(direction).orElse(0);
        if (null == route) {
            Date now = new Date();
@@ -48,6 +50,12 @@
            if (!this.save(route)) {
                throw new CoolException(route.getCodeArr()+" save fail![Route]");
            }
            created = true;
        }
        if (created) {
            List<Long> codes = Utils.singletonList(startCode.getId());
            codes.add(endCode.getId());
            codeService.refreshCornerByCodeIds(codes);
        }
        return route;
    }
@@ -57,10 +65,10 @@
        List<String> neighborCodeList = new ArrayList<>();
        for (Route route : this.list(new LambdaQueryWrapper<Route>().eq(Route::getStartCode, code))) {
            neighborCodeList.add(codeService.getById(route.getEndCode()).getData());
            neighborCodeList.add(codeService.getCacheById(route.getEndCode()).getData());
        }
        for (Route route : this.list(new LambdaQueryWrapper<Route>().eq(Route::getEndCode, code))) {
            neighborCodeList.add(codeService.getById(route.getStartCode()).getData());
            neighborCodeList.add(codeService.getCacheById(route.getStartCode()).getData());
        }
        return neighborCodeList;