地图绘制进路数据、延续保护数据、信号机接近区段数据维护接口添加

This commit is contained in:
walker-sheng 2021-05-27 10:19:56 +08:00
parent d656a5071b
commit bc5b9c5009
20 changed files with 456 additions and 144 deletions

View File

@ -34,8 +34,8 @@ public class AuthenticateInterceptor implements HandlerInterceptor {
throws Exception { throws Exception {
// 登陆权限验证 // 登陆权限验证
if(RequestMethod.OPTIONS.name().equals(request.getMethod())) return true; if(RequestMethod.OPTIONS.name().equals(request.getMethod())) return true;
log.debug(String.format("request[Method: '%s', RequestURI: '%s']", log.debug(String.format("request[%s %s from:%s]",
request.getMethod(), request.getRequestURI())); request.getMethod(), request.getRequestURI(), request.getRemoteAddr()));
String token = request.getHeader("X-Token"); String token = request.getHeader("X-Token");
BusinessExceptionAssertEnum.NOT_LOGIN.assertTrue(StringUtils.hasText(token)); BusinessExceptionAssertEnum.NOT_LOGIN.assertTrue(StringUtils.hasText(token));
LoginUserInfoVO loginUserInfoVO = null; LoginUserInfoVO loginUserInfoVO = null;

View File

@ -342,38 +342,38 @@ public class DraftMapController {
} }
/*-------------- 延续保护 ------------------*/ /*-------------- 延续保护 ------------------*/
//
@ApiOperation(value = "创建延续保护") // @ApiOperation(value = "创建延续保护")
@PostMapping(path = "/overlap") // @PostMapping(path = "/overlap")
public void createOverlap(@RequestBody @Validated MapOverlapVO mapOverlapVO) { // public void createOverlap(@RequestBody @Validated MapOverlapVO mapOverlapVO) {
this.iDraftMapService.createOverlap(mapOverlapVO); // this.iDraftMapService.createOverlap(mapOverlapVO);
} // }
//
@ApiOperation(value = "分页查询延续保护列表") // @ApiOperation(value = "分页查询延续保护列表")
@GetMapping(path = "/{mapId}/overlap/paging") // @GetMapping(path = "/{mapId}/overlap/paging")
public PageVO<MapOverlapVO> queryPagedOverlap( // public PageVO<MapOverlapVO> queryPagedOverlap(
@PathVariable Long mapId, // @PathVariable Long mapId,
MapOverlapQueryVO queryVO) { // MapOverlapQueryVO queryVO) {
return this.iDraftMapService.queryPagedOverlap(mapId, queryVO); // return this.iDraftMapService.queryPagedOverlap(mapId, queryVO);
} // }
//
@ApiOperation(value = "根据id查询延续保护") // @ApiOperation(value = "根据id查询延续保护")
@GetMapping(path = "/overlap/{id}") // @GetMapping(path = "/overlap/{id}")
public MapOverlapVO getOverlapById(@PathVariable Long id) { // public MapOverlapVO getOverlapById(@PathVariable Long id) {
return this.iDraftMapService.getOverlapById(id); // return this.iDraftMapService.getOverlapById(id);
} // }
//
@ApiOperation(value = "更新延续保护") // @ApiOperation(value = "更新延续保护")
@PutMapping(path = "/overlap/{id}") // @PutMapping(path = "/overlap/{id}")
public void updateOverlap(@PathVariable Long id, @RequestBody @Validated MapOverlapVO mapOverlapVO) { // public void updateOverlap(@PathVariable Long id, @RequestBody @Validated MapOverlapVO mapOverlapVO) {
this.iDraftMapService.updateOverlap(id, mapOverlapVO); // this.iDraftMapService.updateOverlap(id, mapOverlapVO);
} // }
//
@ApiOperation(value = "删除延续保护") // @ApiOperation(value = "删除延续保护")
@DeleteMapping(path = "/overlap/{id}") // @DeleteMapping(path = "/overlap/{id}")
public void deleteOverlap(@PathVariable Long id) { // public void deleteOverlap(@PathVariable Long id) {
this.iDraftMapService.deleteOverlap(id); // this.iDraftMapService.deleteOverlap(id);
} // }
/*-------------- 自动折返 ------------------*/ /*-------------- 自动折返 ------------------*/

View File

@ -0,0 +1,41 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.DraftMapOverlapService;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapOverlapQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapOverlapVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/draftMap/{id}/overlap")
@Slf4j
public class DraftMapOverlapController {
@Autowired
private DraftMapOverlapService draftMapOverlapService;
@GetMapping("/paging")
public PageVO<MapOverlapVO> pagingQuery(@PathVariable Long id, MapOverlapQueryVO queryVO) {
return this.draftMapOverlapService.pagingQuery(id, queryVO);
}
@GetMapping("/all")
public List<MapOverlapVO> queryAll(@PathVariable Long id) {
return this.draftMapOverlapService.queryAll(id);
}
@PutMapping("/{code}")
public void update(@PathVariable Long id, @PathVariable String code, @RequestBody MapOverlapVO vo) {
this.draftMapOverlapService.update(id, code, vo);
}
@DeleteMapping("/{code}")
public void delete(@PathVariable Long id, @PathVariable String code) {
this.draftMapOverlapService.delete(id, code);
}
}

View File

@ -1,6 +1,8 @@
package club.joylink.rtss.controller.draft; package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.DraftMapRouteService; import club.joylink.rtss.services.draftData.DraftMapRouteService;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteNewVO; import club.joylink.rtss.vo.client.map.newmap.MapRouteNewVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -21,11 +23,21 @@ public class DraftMapRouteController {
return this.draftMapRouteService.createRailwayRoute(id, routeNewVO); return this.draftMapRouteService.createRailwayRoute(id, routeNewVO);
} }
@GetMapping("/paging")
public PageVO<MapRouteNewVO> pagingQuery(@PathVariable Long id, MapRouteQueryVO queryVO) {
return this.draftMapRouteService.pagingQuery(id, queryVO);
}
@GetMapping("/all") @GetMapping("/all")
public List<MapRouteNewVO> queryAllRoutes(@PathVariable Long id) { public List<MapRouteNewVO> queryAllRoutes(@PathVariable Long id) {
return this.draftMapRouteService.queryAllRoutes(id); return this.draftMapRouteService.queryAllRoutes(id);
} }
@PutMapping("/{code}")
public void update(@PathVariable Long id, @PathVariable String code, @RequestBody MapRouteNewVO routeNewVO) {
this.draftMapRouteService.update(id, code, routeNewVO);
}
@DeleteMapping("/{code}") @DeleteMapping("/{code}")
public void delete(@PathVariable Long id, @PathVariable String code) { public void delete(@PathVariable Long id, @PathVariable String code) {
this.draftMapRouteService.deleteRoute(id, code); this.draftMapRouteService.deleteRoute(id, code);

View File

@ -0,0 +1,36 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.DraftMapSignalApproachSectionService;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapSASQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapSignalApproachSectionVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/draftMap/{id}/signalApproachSection")
@Slf4j
public class DraftMapSignalApproachSectionController {
@Autowired
private DraftMapSignalApproachSectionService draftMapSignalApproachSectionService;
@GetMapping("/paging")
public PageVO<MapSignalApproachSectionVO> pagingQuery(@PathVariable Long id, MapSASQueryVO queryVO) {
return this.draftMapSignalApproachSectionService.pagingQuery(id, queryVO);
}
@GetMapping("/all")
public List<MapSignalApproachSectionVO> queryAll(@PathVariable Long id) {
return this.draftMapSignalApproachSectionService.queryAll(id);
}
@PutMapping("/{signalCode}")
public void update(@PathVariable Long id, @PathVariable String signalCode, @RequestBody MapSignalApproachSectionVO vo) {
this.draftMapSignalApproachSectionService.update(id, signalCode, vo);
}
}

View File

@ -865,9 +865,6 @@ public class DraftMapService implements IDraftMapService {
if (StringUtils.hasText(queryVO.getEndSignalCode())) { if (StringUtils.hasText(queryVO.getEndSignalCode())) {
criteria.andEndSignalCodeEqualTo(queryVO.getEndSignalCode()); criteria.andEndSignalCodeEqualTo(queryVO.getEndSignalCode());
} }
if (StringUtils.hasText(queryVO.getNearSectionCode())) {
criteria.andNearSectionCodeEqualTo(queryVO.getNearSectionCode());
}
Page<DraftMapRoute> pageTotal = (Page<DraftMapRoute>) draftMapRouteDAO.selectByExampleWithBLOBs(example); Page<DraftMapRoute> pageTotal = (Page<DraftMapRoute>) draftMapRouteDAO.selectByExampleWithBLOBs(example);
List<MapRouteVO> routeVOList = pageTotal.getResult().stream().map(MapRouteVO::convert2VO).collect(Collectors.toList()); List<MapRouteVO> routeVOList = pageTotal.getResult().stream().map(MapRouteVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(pageTotal, routeVOList); return PageVO.convert(pageTotal, routeVOList);
@ -936,50 +933,50 @@ public class DraftMapService implements IDraftMapService {
/*------------ Route END ---------------------*/ /*------------ Route END ---------------------*/
/*------------overlap start ---------------------*/ /*------------overlap start ---------------------*/
@Override // @Override
public void createOverlap(MapOverlapVO mapOverlapVO) { // public void createOverlap(MapOverlapVO mapOverlapVO) {
if (StringUtils.hasText(mapOverlapVO.getName())) { // if (StringUtils.hasText(mapOverlapVO.getName())) {
confirmOverlapNameNotRepeat(mapOverlapVO); // confirmOverlapNameNotRepeat(mapOverlapVO);
} // }
DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft(); // DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft();
this.draftMapOverlapDAO.insert(draftMapOverlap); // this.draftMapOverlapDAO.insert(draftMapOverlap);
} // }
//
@Override // @Override
public PageVO<MapOverlapVO> queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO) { // public PageVO<MapOverlapVO> queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO) {
Objects.requireNonNull(mapId); // Objects.requireNonNull(mapId);
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); // PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
DraftMapOverlapExample example = new DraftMapOverlapExample(); // DraftMapOverlapExample example = new DraftMapOverlapExample();
DraftMapOverlapExample.Criteria criteria = example.createCriteria(); // DraftMapOverlapExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(mapId); // criteria.andMapIdEqualTo(mapId);
if (StringUtils.hasText(queryVO.getCode())) { // if (StringUtils.hasText(queryVO.getCode())) {
criteria.andCodeEqualTo(queryVO.getCode()); // criteria.andCodeEqualTo(queryVO.getCode());
} // }
Page<DraftMapOverlap> page = (Page<DraftMapOverlap>) // Page<DraftMapOverlap> page = (Page<DraftMapOverlap>)
this.draftMapOverlapDAO.selectByExampleWithBLOBs(example); // this.draftMapOverlapDAO.selectByExampleWithBLOBs(example);
List<MapOverlapVO> voList = page.getResult().stream().map(MapOverlapVO::convert2VO).collect(Collectors.toList()); // List<MapOverlapVO> voList = page.getResult().stream().map(MapOverlapVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(page, voList); // return PageVO.convert(page, voList);
} // }
//
@Override // @Override
public MapOverlapVO getOverlapById(Long id) { // public MapOverlapVO getOverlapById(Long id) {
Objects.requireNonNull(id); // Objects.requireNonNull(id);
DraftMapOverlap draftMapOverlap = getDraftMapOverlapEntity(id); // DraftMapOverlap draftMapOverlap = getDraftMapOverlapEntity(id);
return MapOverlapVO.convert2VO(draftMapOverlap); // return MapOverlapVO.convert2VO(draftMapOverlap);
} // }
//
@Override // @Override
public void updateOverlap(Long id, MapOverlapVO mapOverlapVO) { // public void updateOverlap(Long id, MapOverlapVO mapOverlapVO) {
getDraftMapOverlapEntity(id); // getDraftMapOverlapEntity(id);
DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft(); // DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft();
draftMapOverlap.setId(id); // draftMapOverlap.setId(id);
this.draftMapOverlapDAO.updateByPrimaryKeySelective(draftMapOverlap); // this.draftMapOverlapDAO.updateByPrimaryKeySelective(draftMapOverlap);
} // }
//
@Override // @Override
public void deleteOverlap(Long id) { // public void deleteOverlap(Long id) {
this.draftMapOverlapDAO.deleteByPrimaryKey(id); // this.draftMapOverlapDAO.deleteByPrimaryKey(id);
} // }
/*------------ Overlap END ---------------------*/ /*------------ Overlap END ---------------------*/

View File

@ -241,15 +241,15 @@ public interface IDraftMapService {
void deleteRoute(Long routeId); void deleteRoute(Long routeId);
/*------------overlap start ---------------------*/ /*------------overlap start ---------------------*/
//
void createOverlap(MapOverlapVO mapOverlapVO); // void createOverlap(MapOverlapVO mapOverlapVO);
//
PageVO<MapOverlapVO> queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO); // PageVO<MapOverlapVO> queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO);
//
MapOverlapVO getOverlapById(Long id); // MapOverlapVO getOverlapById(Long id);
//
void updateOverlap(Long id, MapOverlapVO mapOverlapVO); // void updateOverlap(Long id, MapOverlapVO mapOverlapVO);
void deleteOverlap(Long id); // void deleteOverlap(Long id);
/*------------autoReentry start ---------------------*/ /*------------autoReentry start ---------------------*/

View File

@ -79,23 +79,23 @@ public class DraftMapDataHandleServiceImpl implements DraftMapDataHandleService
if (!CollectionUtils.isEmpty(draftMapOverlapList)) { if (!CollectionUtils.isEmpty(draftMapOverlapList)) {
for (DraftMapOverlap overlap : draftMapOverlapList) { for (DraftMapOverlap overlap : draftMapOverlapList) {
// 丢失道岔处理 // 丢失道岔处理
MapOverlapVO mapOverlapVO = MapOverlapVO.convertRel2VO(overlap); // MapOverlapVO mapOverlapVO = MapOverlapVO.convertRel2VO(overlap);
List<MapOverlapRelSectionSwitchVO> list = mapOverlapVO.getRelSectionSwitchList(); // List<MapOverlapRelSectionSwitchVO> list = mapOverlapVO.getRelSectionSwitchList();
for (MapOverlapRelSectionSwitchVO vo : list) { // for (MapOverlapRelSectionSwitchVO vo : list) {
if (!CollectionUtils.isEmpty(vo.getRouteOverlapSwitchList())) { // if (!CollectionUtils.isEmpty(vo.getRouteOverlapSwitchList())) {
List<MapCISwitchVO> removeList = new ArrayList<>(); // List<MapCISwitchVO> removeList = new ArrayList<>();
for (MapCISwitchVO mapCISwitchVO : vo.getRouteOverlapSwitchList()) { // for (MapCISwitchVO mapCISwitchVO : vo.getRouteOverlapSwitchList()) {
if (Objects.isNull(switchMap.get(mapCISwitchVO.getSwitchCode()))) { // if (Objects.isNull(switchMap.get(mapCISwitchVO.getSwitchCode()))) {
removeList.add(mapCISwitchVO); // removeList.add(mapCISwitchVO);
} // }
} // }
if (!CollectionUtils.isEmpty(removeList)) { // if (!CollectionUtils.isEmpty(removeList)) {
vo.getRouteOverlapSwitchList().removeAll(removeList); // vo.getRouteOverlapSwitchList().removeAll(removeList);
overlap.setRelData(mapOverlapVO.convert2Draft().getRelData()); // overlap.setRelData(mapOverlapVO.convert2Draft().getRelData());
this.draftMapOverlapDAO.updateByPrimaryKeyWithBLOBs(overlap); // this.draftMapOverlapDAO.updateByPrimaryKeyWithBLOBs(overlap);
} // }
} // }
} // }
} }
} }
} }

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapOverlapQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapOverlapVO;
import java.util.List;
public interface DraftMapOverlapService {
PageVO<MapOverlapVO> pagingQuery(Long id, MapOverlapQueryVO queryVO);
List<MapOverlapVO> queryAll(Long id);
void update(Long id, String code, MapOverlapVO vo);
void delete(Long id, String code);
}

View File

@ -0,0 +1,79 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapOverlapDAO;
import club.joylink.rtss.entity.DraftMapOverlap;
import club.joylink.rtss.entity.DraftMapOverlapExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapOverlapQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapOverlapVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class DraftMapOverlapServiceImpl implements DraftMapOverlapService {
@Autowired
private DraftMapOverlapDAO draftMapOverlapDAO;
@Override
public PageVO<MapOverlapVO> pagingQuery(Long id, MapOverlapQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
DraftMapOverlapExample example = new DraftMapOverlapExample();
DraftMapOverlapExample.Criteria criteria = example.createCriteria()
.andMapIdEqualTo(id);
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
Page<DraftMapOverlap> mapOverlaps = (Page<DraftMapOverlap>) this.draftMapOverlapDAO.selectByExampleWithBLOBs(example);
List<MapOverlapVO> voList = mapOverlaps.getResult().stream()
.map(MapOverlapVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(mapOverlaps, voList);
}
@Override
public List<MapOverlapVO> queryAll(Long id) {
DraftMapOverlapExample example = new DraftMapOverlapExample();
example.createCriteria()
.andMapIdEqualTo(id);
List<DraftMapOverlap> overlapList = this.draftMapOverlapDAO.selectByExampleWithBLOBs(example);
return overlapList.stream()
.map(MapOverlapVO::convert2VO)
.collect(Collectors.toList());
}
@Override
public void update(Long id, String code, MapOverlapVO vo) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(vo.getName());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(vo.getPathList());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(vo.getUnlockTime());
DraftMapOverlapExample example = new DraftMapOverlapExample();
example.createCriteria()
.andMapIdEqualTo(id)
.andCodeEqualTo(code);
List<DraftMapOverlap> draftMapOverlaps = this.draftMapOverlapDAO.selectByExampleWithBLOBs(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(draftMapOverlaps);
MapOverlapVO update = MapOverlapVO.convert2VO(draftMapOverlaps.get(0));
update.setName(vo.getName());
update.setUnlockTime(vo.getUnlockTime());
update.setPathList(vo.getPathList());
DraftMapOverlap db = update.convert2Draft();
this.draftMapOverlapDAO.updateByPrimaryKeyWithBLOBs(db);
}
@Override
public void delete(Long id, String code) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(code);
DraftMapOverlapExample example = new DraftMapOverlapExample();
example.createCriteria()
.andMapIdEqualTo(id)
.andCodeEqualTo(code);
this.draftMapOverlapDAO.deleteByExample(example);
}
}

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.services.draftData; package club.joylink.rtss.services.draftData;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteNewVO; import club.joylink.rtss.vo.client.map.newmap.MapRouteNewVO;
import java.util.List; import java.util.List;
@ -7,7 +9,11 @@ import java.util.List;
public interface DraftMapRouteService { public interface DraftMapRouteService {
MapRouteNewVO createRailwayRoute(Long id, MapRouteNewVO routeNewVO); MapRouteNewVO createRailwayRoute(Long id, MapRouteNewVO routeNewVO);
PageVO<MapRouteNewVO> pagingQuery(Long id, MapRouteQueryVO queryVO);
List<MapRouteNewVO> queryAllRoutes(Long id); List<MapRouteNewVO> queryAllRoutes(Long id);
void update(Long id, String routeCode, MapRouteNewVO routeNewVO);
void deleteRoute(Long id, String code); void deleteRoute(Long id, String code);
} }

View File

@ -7,12 +7,17 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IDraftMapService; import club.joylink.rtss.services.IDraftMapService;
import club.joylink.rtss.simulation.rt.repo.CommonRepository; import club.joylink.rtss.simulation.rt.repo.CommonRepository;
import club.joylink.rtss.simulation.rt.repo.CommonRepositoryBuilder; import club.joylink.rtss.simulation.rt.repo.CommonRepositoryBuilder;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRouteQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapGraphDataNewVO; import club.joylink.rtss.vo.client.map.newmap.MapGraphDataNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteNewVO; import club.joylink.rtss.vo.client.map.newmap.MapRouteNewVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -62,6 +67,34 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
return routeNewVO; return routeNewVO;
} }
@Override
public PageVO<MapRouteNewVO> pagingQuery(Long id, MapRouteQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
DraftMapRouteExample example = new DraftMapRouteExample();
DraftMapRouteExample.Criteria criteria = example.createCriteria();
criteria.andMapIdEqualTo(id);
if (StringUtils.hasText(queryVO.getCode())) {
criteria.andCodeEqualTo(queryVO.getCode());
}
if (StringUtils.hasText(queryVO.getName())) {
queryVO.setName(String.format("%%%s%%", queryVO.getName()));
criteria.andNameLike(queryVO.getName());
}
if (StringUtils.hasText(queryVO.getStationCode())) {
criteria.andStationCodeEqualTo(queryVO.getStationCode());
}
if (StringUtils.hasText(queryVO.getStartSignalCode())) {
criteria.andStartSignalCodeEqualTo(queryVO.getStartSignalCode());
}
if (StringUtils.hasText(queryVO.getEndSignalCode())) {
criteria.andEndSignalCodeEqualTo(queryVO.getEndSignalCode());
}
Page<DraftMapRoute> pageTotal = (Page<DraftMapRoute>) draftMapRouteDAO.selectByExampleWithBLOBs(example);
List<MapRouteNewVO> routeVOList = pageTotal.getResult().stream()
.map(MapRouteNewVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(pageTotal, routeVOList);
}
@Override @Override
public List<MapRouteNewVO> queryAllRoutes(Long id) { public List<MapRouteNewVO> queryAllRoutes(Long id) {
DraftMapRouteExample example = new DraftMapRouteExample(); DraftMapRouteExample example = new DraftMapRouteExample();
@ -71,6 +104,25 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
return MapRouteNewVO.convertDraft2VOList(routeList); return MapRouteNewVO.convertDraft2VOList(routeList);
} }
@Override
public void update(Long id, String routeCode, MapRouteNewVO routeNewVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(routeNewVO.getName());
DraftMapRouteExample example = new DraftMapRouteExample();
example.createCriteria()
.andMapIdEqualTo(id)
.andCodeEqualTo(routeCode);
List<DraftMapRoute> draftMapRoutes = this.draftMapRouteDAO.selectByExampleWithBLOBs(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(draftMapRoutes);
DraftMapRoute draftMapRoute = draftMapRoutes.get(0);
MapRouteNewVO update = MapRouteNewVO.convert2VO(draftMapRoute);
update.setFlt(routeNewVO.isFlt());
update.setArc(routeNewVO.isArc());
update.setArs(routeNewVO.isArs());
update.setName(routeNewVO.getName());
DraftMapRoute db = update.convert2Draft();
this.draftMapRouteDAO.updateByPrimaryKeyWithBLOBs(db);
}
@Transactional @Transactional
@Override @Override
public void deleteRoute(Long id, String code) { public void deleteRoute(Long id, String code) {

View File

@ -0,0 +1,16 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapSASQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapSignalApproachSectionVO;
import java.util.List;
public interface DraftMapSignalApproachSectionService {
PageVO<MapSignalApproachSectionVO> pagingQuery(Long id, MapSASQueryVO queryVO);
List<MapSignalApproachSectionVO> queryAll(Long id);
void update(Long id, String signalCode, MapSignalApproachSectionVO vo);
}

View File

@ -0,0 +1,67 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapSignalApproachSectionDAO;
import club.joylink.rtss.entity.DraftMapSignalApproachSection;
import club.joylink.rtss.entity.DraftMapSignalApproachSectionExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapSASQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapSignalApproachSectionVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class DraftMapSignalApproachSectionServiceImpl implements DraftMapSignalApproachSectionService {
@Autowired
private DraftMapSignalApproachSectionDAO draftMapSignalApproachSectionDAO;
@Override
public PageVO<MapSignalApproachSectionVO> pagingQuery(Long id, MapSASQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
DraftMapSignalApproachSectionExample example = new DraftMapSignalApproachSectionExample();
DraftMapSignalApproachSectionExample.Criteria criteria = example.createCriteria()
.andMapIdEqualTo(id);
if (StringUtils.hasText(queryVO.getSignalCode())) {
criteria.andSignalCodeEqualTo(queryVO.getSignalCode());
}
Page<DraftMapSignalApproachSection> mapOverlaps = (Page<DraftMapSignalApproachSection>) this.draftMapSignalApproachSectionDAO.selectByExampleWithBLOBs(example);
List<MapSignalApproachSectionVO> voList = mapOverlaps.getResult().stream()
.map(MapSignalApproachSectionVO::convert2VO)
.collect(Collectors.toList());
return PageVO.convert(mapOverlaps, voList);
}
@Override
public List<MapSignalApproachSectionVO> queryAll(Long id) {
DraftMapSignalApproachSectionExample example = new DraftMapSignalApproachSectionExample();
DraftMapSignalApproachSectionExample.Criteria criteria = example.createCriteria()
.andMapIdEqualTo(id);
Page<DraftMapSignalApproachSection> mapOverlaps = (Page<DraftMapSignalApproachSection>) this.draftMapSignalApproachSectionDAO.selectByExampleWithBLOBs(example);
return mapOverlaps.getResult().stream()
.map(MapSignalApproachSectionVO::convert2VO)
.collect(Collectors.toList());
}
@Override
public void update(Long id, String signalCode, MapSignalApproachSectionVO vo) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(vo.getReleaseTime());
DraftMapSignalApproachSectionExample example = new DraftMapSignalApproachSectionExample();
example.createCriteria()
.andMapIdEqualTo(id)
.andSignalCodeEqualTo(signalCode);
List<DraftMapSignalApproachSection> approachSections = this.draftMapSignalApproachSectionDAO.selectByExampleWithBLOBs(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(approachSections);
MapSignalApproachSectionVO update = MapSignalApproachSectionVO.convert2VO(approachSections.get(0));
update.setReleaseTime(vo.getReleaseTime());
update.setSectionPathList(vo.getSectionPathList());
DraftMapSignalApproachSection db = update.convert2Draft();
this.draftMapSignalApproachSectionDAO.updateByPrimaryKeyWithBLOBs(db);
}
}

View File

@ -26,7 +26,4 @@ public class MapRouteQueryVO extends PageQueryVO {
@ApiModelProperty(value="终端信号机") @ApiModelProperty(value="终端信号机")
private String endSignalCode; private String endSignalCode;
@ApiModelProperty(value="接近区段")
private String nearSectionCode;
} }

View File

@ -11,6 +11,6 @@ import lombok.Setter;
@Setter @Setter
public class MapOverlapQueryVO extends PageQueryVO { public class MapOverlapQueryVO extends PageQueryVO {
@ApiModelProperty(value="延续保护唯一编号") @ApiModelProperty(value="延续保护名称")
private String code; private String name;
} }

View File

@ -13,9 +13,7 @@ import lombok.Setter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -70,17 +68,11 @@ public class MapOverlapVO {
private List<MapSectionPathVO> triggerPathList; private List<MapSectionPathVO> triggerPathList;
/**
* 延续保护线路列表
*/
@NotEmpty(message="延续保护线路列表至少有一条")
private List<MapOverlapRelSectionSwitchVO> relSectionSwitchList;
@ApiModelProperty(value = "延续保护路径列表") @ApiModelProperty(value = "延续保护路径列表")
private List<MapSectionPathVO> pathList; private List<MapSectionPathVO> pathList;
public MapOverlapVO() { public MapOverlapVO() {
relSectionSwitchList = new ArrayList<>();
} }
public static MapOverlapVO convert2VO(DraftMapOverlap draftMapOverlap) { public static MapOverlapVO convert2VO(DraftMapOverlap draftMapOverlap) {
@ -114,7 +106,7 @@ public class MapOverlapVO {
draftMapOverlap.setId(getId()); draftMapOverlap.setId(getId());
draftMapOverlap.setCode(getCode()); draftMapOverlap.setCode(getCode());
draftMapOverlap.setMapId(getMapId()); draftMapOverlap.setMapId(getMapId());
// draftMapOverlap.setName(getName()); draftMapOverlap.setName(getName());
// relData中不包含id和mapId // relData中不包含id和mapId
draftMapOverlap.setRelData(getJsonData()); draftMapOverlap.setRelData(getJsonData());
return draftMapOverlap; return draftMapOverlap;

View File

@ -15,7 +15,9 @@ import org.springframework.util.CollectionUtils;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ApiModel @ApiModel
@ -135,10 +137,6 @@ public class MapRouteNewVO {
*/ */
private boolean flt; private boolean flt;
/** 是否先锁闭——办理过程直接先锁闭区段 */
@ApiModelProperty(value = "是否先锁闭——办理过程直接先锁闭区段")
private boolean lockFirst;
/** /**
* 延时解锁时间单位秒s * 延时解锁时间单位秒s
*/ */

View File

@ -0,0 +1,13 @@
package club.joylink.rtss.vo.client.map.newmap;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class MapSASQueryVO extends PageQueryVO {
private String signalCode;
}

View File

@ -1,11 +1,11 @@
package club.joylink.rtss.vo.client.map.newmap; package club.joylink.rtss.vo.client.map.newmap;
import club.joylink.rtss.entity.DraftMapSignalApproachSection;
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.util.JsonUtils;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.entity.DraftMapSignalApproachSection;
import club.joylink.rtss.util.JsonUtils;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
@ -33,9 +33,6 @@ public class MapSignalApproachSectionVO {
@NotNull(message = "地图id不能为空") @NotNull(message = "地图id不能为空")
private Long mapId; private Long mapId;
// @NotBlank(message = "接近区段编号不能为空")
// private String code;
/** /**
* 始端信号机 编号 * 始端信号机 编号
*/ */
@ -43,21 +40,14 @@ public class MapSignalApproachSectionVO {
@ApiModelProperty(value="始端信号机", required=true) @ApiModelProperty(value="始端信号机", required=true)
private String signalCode; private String signalCode;
@ApiModelProperty(value="接近区段CBTC模式数据列表") /**
private List<String> routeSectionList; * 接近锁闭解锁时间
*/
@ApiModelProperty(value = "接近区段(后备模式)列表")
private List<String> blockSectionList;
@ApiModelProperty(value = "是否引导信号机")
private Boolean callOn;
private Integer releaseTime; private Integer releaseTime;
private List<MapSectionPathVO> sectionPathList; private List<MapSectionPathVO> sectionPathList;
public MapSignalApproachSectionVO() { public MapSignalApproachSectionVO() {
this.routeSectionList = new ArrayList<>();
} }
public static MapSignalApproachSectionVO convert2VO(DraftMapSignalApproachSection approachSection) { public static MapSignalApproachSectionVO convert2VO(DraftMapSignalApproachSection approachSection) {
@ -88,7 +78,6 @@ public class MapSignalApproachSectionVO {
DraftMapSignalApproachSection approachSection = new DraftMapSignalApproachSection(); DraftMapSignalApproachSection approachSection = new DraftMapSignalApproachSection();
approachSection.setId(this.getId()); approachSection.setId(this.getId());
approachSection.setMapId(this.getMapId()); approachSection.setMapId(this.getMapId());
// approachSection.setCode(this.getCode());
approachSection.setSignalCode(this.getSignalCode()); approachSection.setSignalCode(this.getSignalCode());
approachSection.setRelData(this.getJsonData()); approachSection.setRelData(this.getJsonData());
return approachSection; return approachSection;