diff --git a/src/main/java/club/joylink/rtss/controller/advice/AuthenticateInterceptor.java b/src/main/java/club/joylink/rtss/controller/advice/AuthenticateInterceptor.java index 9eaed2b32..455d40ccb 100644 --- a/src/main/java/club/joylink/rtss/controller/advice/AuthenticateInterceptor.java +++ b/src/main/java/club/joylink/rtss/controller/advice/AuthenticateInterceptor.java @@ -34,8 +34,8 @@ public class AuthenticateInterceptor implements HandlerInterceptor { throws Exception { // 登陆权限验证 if(RequestMethod.OPTIONS.name().equals(request.getMethod())) return true; - log.debug(String.format("request[Method: '%s', RequestURI: '%s']", - request.getMethod(), request.getRequestURI())); + log.debug(String.format("request[%s %s from:%s]", + request.getMethod(), request.getRequestURI(), request.getRemoteAddr())); String token = request.getHeader("X-Token"); BusinessExceptionAssertEnum.NOT_LOGIN.assertTrue(StringUtils.hasText(token)); LoginUserInfoVO loginUserInfoVO = null; diff --git a/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java b/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java index 9ad3635af..610aeefca 100644 --- a/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java +++ b/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java @@ -342,38 +342,38 @@ public class DraftMapController { } /*-------------- 延续保护 ------------------*/ - - @ApiOperation(value = "创建延续保护") - @PostMapping(path = "/overlap") - public void createOverlap(@RequestBody @Validated MapOverlapVO mapOverlapVO) { - this.iDraftMapService.createOverlap(mapOverlapVO); - } - - @ApiOperation(value = "分页查询延续保护列表") - @GetMapping(path = "/{mapId}/overlap/paging") - public PageVO queryPagedOverlap( - @PathVariable Long mapId, - MapOverlapQueryVO queryVO) { - return this.iDraftMapService.queryPagedOverlap(mapId, queryVO); - } - - @ApiOperation(value = "根据id查询延续保护") - @GetMapping(path = "/overlap/{id}") - public MapOverlapVO getOverlapById(@PathVariable Long id) { - return this.iDraftMapService.getOverlapById(id); - } - - @ApiOperation(value = "更新延续保护") - @PutMapping(path = "/overlap/{id}") - public void updateOverlap(@PathVariable Long id, @RequestBody @Validated MapOverlapVO mapOverlapVO) { - this.iDraftMapService.updateOverlap(id, mapOverlapVO); - } - - @ApiOperation(value = "删除延续保护") - @DeleteMapping(path = "/overlap/{id}") - public void deleteOverlap(@PathVariable Long id) { - this.iDraftMapService.deleteOverlap(id); - } +// +// @ApiOperation(value = "创建延续保护") +// @PostMapping(path = "/overlap") +// public void createOverlap(@RequestBody @Validated MapOverlapVO mapOverlapVO) { +// this.iDraftMapService.createOverlap(mapOverlapVO); +// } +// +// @ApiOperation(value = "分页查询延续保护列表") +// @GetMapping(path = "/{mapId}/overlap/paging") +// public PageVO queryPagedOverlap( +// @PathVariable Long mapId, +// MapOverlapQueryVO queryVO) { +// return this.iDraftMapService.queryPagedOverlap(mapId, queryVO); +// } +// +// @ApiOperation(value = "根据id查询延续保护") +// @GetMapping(path = "/overlap/{id}") +// public MapOverlapVO getOverlapById(@PathVariable Long id) { +// return this.iDraftMapService.getOverlapById(id); +// } +// +// @ApiOperation(value = "更新延续保护") +// @PutMapping(path = "/overlap/{id}") +// public void updateOverlap(@PathVariable Long id, @RequestBody @Validated MapOverlapVO mapOverlapVO) { +// this.iDraftMapService.updateOverlap(id, mapOverlapVO); +// } +// +// @ApiOperation(value = "删除延续保护") +// @DeleteMapping(path = "/overlap/{id}") +// public void deleteOverlap(@PathVariable Long id) { +// this.iDraftMapService.deleteOverlap(id); +// } /*-------------- 自动折返 ------------------*/ diff --git a/src/main/java/club/joylink/rtss/controller/draft/DraftMapOverlapController.java b/src/main/java/club/joylink/rtss/controller/draft/DraftMapOverlapController.java new file mode 100644 index 000000000..51a847160 --- /dev/null +++ b/src/main/java/club/joylink/rtss/controller/draft/DraftMapOverlapController.java @@ -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 pagingQuery(@PathVariable Long id, MapOverlapQueryVO queryVO) { + return this.draftMapOverlapService.pagingQuery(id, queryVO); + } + + @GetMapping("/all") + public List 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); + } + +} diff --git a/src/main/java/club/joylink/rtss/controller/draft/DraftMapRouteController.java b/src/main/java/club/joylink/rtss/controller/draft/DraftMapRouteController.java index 0f3a24f39..3b51eceed 100644 --- a/src/main/java/club/joylink/rtss/controller/draft/DraftMapRouteController.java +++ b/src/main/java/club/joylink/rtss/controller/draft/DraftMapRouteController.java @@ -1,6 +1,8 @@ package club.joylink.rtss.controller.draft; 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 lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -21,11 +23,21 @@ public class DraftMapRouteController { return this.draftMapRouteService.createRailwayRoute(id, routeNewVO); } + @GetMapping("/paging") + public PageVO pagingQuery(@PathVariable Long id, MapRouteQueryVO queryVO) { + return this.draftMapRouteService.pagingQuery(id, queryVO); + } + @GetMapping("/all") public List queryAllRoutes(@PathVariable Long 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}") public void delete(@PathVariable Long id, @PathVariable String code) { this.draftMapRouteService.deleteRoute(id, code); diff --git a/src/main/java/club/joylink/rtss/controller/draft/DraftMapSignalApproachSectionController.java b/src/main/java/club/joylink/rtss/controller/draft/DraftMapSignalApproachSectionController.java new file mode 100644 index 000000000..1c200e3f1 --- /dev/null +++ b/src/main/java/club/joylink/rtss/controller/draft/DraftMapSignalApproachSectionController.java @@ -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 pagingQuery(@PathVariable Long id, MapSASQueryVO queryVO) { + return this.draftMapSignalApproachSectionService.pagingQuery(id, queryVO); + } + + @GetMapping("/all") + public List 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); + } + +} diff --git a/src/main/java/club/joylink/rtss/services/DraftMapService.java b/src/main/java/club/joylink/rtss/services/DraftMapService.java index bc0611954..b93980d95 100644 --- a/src/main/java/club/joylink/rtss/services/DraftMapService.java +++ b/src/main/java/club/joylink/rtss/services/DraftMapService.java @@ -865,9 +865,6 @@ public class DraftMapService implements IDraftMapService { if (StringUtils.hasText(queryVO.getEndSignalCode())) { criteria.andEndSignalCodeEqualTo(queryVO.getEndSignalCode()); } - if (StringUtils.hasText(queryVO.getNearSectionCode())) { - criteria.andNearSectionCodeEqualTo(queryVO.getNearSectionCode()); - } Page pageTotal = (Page) draftMapRouteDAO.selectByExampleWithBLOBs(example); List routeVOList = pageTotal.getResult().stream().map(MapRouteVO::convert2VO).collect(Collectors.toList()); return PageVO.convert(pageTotal, routeVOList); @@ -936,50 +933,50 @@ public class DraftMapService implements IDraftMapService { /*------------ Route END ---------------------*/ /*------------overlap start ---------------------*/ - @Override - public void createOverlap(MapOverlapVO mapOverlapVO) { - if (StringUtils.hasText(mapOverlapVO.getName())) { - confirmOverlapNameNotRepeat(mapOverlapVO); - } - DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft(); - this.draftMapOverlapDAO.insert(draftMapOverlap); - } - - @Override - public PageVO queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO) { - Objects.requireNonNull(mapId); - PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); - DraftMapOverlapExample example = new DraftMapOverlapExample(); - DraftMapOverlapExample.Criteria criteria = example.createCriteria(); - criteria.andMapIdEqualTo(mapId); - if (StringUtils.hasText(queryVO.getCode())) { - criteria.andCodeEqualTo(queryVO.getCode()); - } - Page page = (Page) - this.draftMapOverlapDAO.selectByExampleWithBLOBs(example); - List voList = page.getResult().stream().map(MapOverlapVO::convert2VO).collect(Collectors.toList()); - return PageVO.convert(page, voList); - } - - @Override - public MapOverlapVO getOverlapById(Long id) { - Objects.requireNonNull(id); - DraftMapOverlap draftMapOverlap = getDraftMapOverlapEntity(id); - return MapOverlapVO.convert2VO(draftMapOverlap); - } - - @Override - public void updateOverlap(Long id, MapOverlapVO mapOverlapVO) { - getDraftMapOverlapEntity(id); - DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft(); - draftMapOverlap.setId(id); - this.draftMapOverlapDAO.updateByPrimaryKeySelective(draftMapOverlap); - } - - @Override - public void deleteOverlap(Long id) { - this.draftMapOverlapDAO.deleteByPrimaryKey(id); - } +// @Override +// public void createOverlap(MapOverlapVO mapOverlapVO) { +// if (StringUtils.hasText(mapOverlapVO.getName())) { +// confirmOverlapNameNotRepeat(mapOverlapVO); +// } +// DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft(); +// this.draftMapOverlapDAO.insert(draftMapOverlap); +// } +// +// @Override +// public PageVO queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO) { +// Objects.requireNonNull(mapId); +// PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); +// DraftMapOverlapExample example = new DraftMapOverlapExample(); +// DraftMapOverlapExample.Criteria criteria = example.createCriteria(); +// criteria.andMapIdEqualTo(mapId); +// if (StringUtils.hasText(queryVO.getCode())) { +// criteria.andCodeEqualTo(queryVO.getCode()); +// } +// Page page = (Page) +// this.draftMapOverlapDAO.selectByExampleWithBLOBs(example); +// List voList = page.getResult().stream().map(MapOverlapVO::convert2VO).collect(Collectors.toList()); +// return PageVO.convert(page, voList); +// } +// +// @Override +// public MapOverlapVO getOverlapById(Long id) { +// Objects.requireNonNull(id); +// DraftMapOverlap draftMapOverlap = getDraftMapOverlapEntity(id); +// return MapOverlapVO.convert2VO(draftMapOverlap); +// } +// +// @Override +// public void updateOverlap(Long id, MapOverlapVO mapOverlapVO) { +// getDraftMapOverlapEntity(id); +// DraftMapOverlap draftMapOverlap = mapOverlapVO.convert2Draft(); +// draftMapOverlap.setId(id); +// this.draftMapOverlapDAO.updateByPrimaryKeySelective(draftMapOverlap); +// } +// +// @Override +// public void deleteOverlap(Long id) { +// this.draftMapOverlapDAO.deleteByPrimaryKey(id); +// } /*------------ Overlap END ---------------------*/ diff --git a/src/main/java/club/joylink/rtss/services/IDraftMapService.java b/src/main/java/club/joylink/rtss/services/IDraftMapService.java index 19b595985..add6b7378 100644 --- a/src/main/java/club/joylink/rtss/services/IDraftMapService.java +++ b/src/main/java/club/joylink/rtss/services/IDraftMapService.java @@ -241,15 +241,15 @@ public interface IDraftMapService { void deleteRoute(Long routeId); /*------------overlap start ---------------------*/ - - void createOverlap(MapOverlapVO mapOverlapVO); - - PageVO queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO); - - MapOverlapVO getOverlapById(Long id); - - void updateOverlap(Long id, MapOverlapVO mapOverlapVO); - void deleteOverlap(Long id); +// +// void createOverlap(MapOverlapVO mapOverlapVO); +// +// PageVO queryPagedOverlap(Long mapId, MapOverlapQueryVO queryVO); +// +// MapOverlapVO getOverlapById(Long id); +// +// void updateOverlap(Long id, MapOverlapVO mapOverlapVO); +// void deleteOverlap(Long id); /*------------autoReentry start ---------------------*/ diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapDataHandleServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapDataHandleServiceImpl.java index 94f7669db..3f04d89e6 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapDataHandleServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapDataHandleServiceImpl.java @@ -79,23 +79,23 @@ public class DraftMapDataHandleServiceImpl implements DraftMapDataHandleService if (!CollectionUtils.isEmpty(draftMapOverlapList)) { for (DraftMapOverlap overlap : draftMapOverlapList) { // 丢失道岔处理 - MapOverlapVO mapOverlapVO = MapOverlapVO.convertRel2VO(overlap); - List list = mapOverlapVO.getRelSectionSwitchList(); - for (MapOverlapRelSectionSwitchVO vo : list) { - if (!CollectionUtils.isEmpty(vo.getRouteOverlapSwitchList())) { - List removeList = new ArrayList<>(); - for (MapCISwitchVO mapCISwitchVO : vo.getRouteOverlapSwitchList()) { - if (Objects.isNull(switchMap.get(mapCISwitchVO.getSwitchCode()))) { - removeList.add(mapCISwitchVO); - } - } - if (!CollectionUtils.isEmpty(removeList)) { - vo.getRouteOverlapSwitchList().removeAll(removeList); - overlap.setRelData(mapOverlapVO.convert2Draft().getRelData()); - this.draftMapOverlapDAO.updateByPrimaryKeyWithBLOBs(overlap); - } - } - } +// MapOverlapVO mapOverlapVO = MapOverlapVO.convertRel2VO(overlap); +// List list = mapOverlapVO.getRelSectionSwitchList(); +// for (MapOverlapRelSectionSwitchVO vo : list) { +// if (!CollectionUtils.isEmpty(vo.getRouteOverlapSwitchList())) { +// List removeList = new ArrayList<>(); +// for (MapCISwitchVO mapCISwitchVO : vo.getRouteOverlapSwitchList()) { +// if (Objects.isNull(switchMap.get(mapCISwitchVO.getSwitchCode()))) { +// removeList.add(mapCISwitchVO); +// } +// } +// if (!CollectionUtils.isEmpty(removeList)) { +// vo.getRouteOverlapSwitchList().removeAll(removeList); +// overlap.setRelData(mapOverlapVO.convert2Draft().getRelData()); +// this.draftMapOverlapDAO.updateByPrimaryKeyWithBLOBs(overlap); +// } +// } +// } } } } diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverlapService.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverlapService.java new file mode 100644 index 000000000..6299f576e --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverlapService.java @@ -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 pagingQuery(Long id, MapOverlapQueryVO queryVO); + + List queryAll(Long id); + + void update(Long id, String code, MapOverlapVO vo); + + void delete(Long id, String code); +} diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverlapServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverlapServiceImpl.java new file mode 100644 index 000000000..9cf73246a --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverlapServiceImpl.java @@ -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 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 mapOverlaps = (Page) this.draftMapOverlapDAO.selectByExampleWithBLOBs(example); + List voList = mapOverlaps.getResult().stream() + .map(MapOverlapVO::convert2VO).collect(Collectors.toList()); + return PageVO.convert(mapOverlaps, voList); + } + + @Override + public List queryAll(Long id) { + DraftMapOverlapExample example = new DraftMapOverlapExample(); + example.createCriteria() + .andMapIdEqualTo(id); + List 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 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); + } +} diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteService.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteService.java index e9fc7885e..bae36a62b 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteService.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteService.java @@ -1,5 +1,7 @@ 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 java.util.List; @@ -7,7 +9,11 @@ import java.util.List; public interface DraftMapRouteService { MapRouteNewVO createRailwayRoute(Long id, MapRouteNewVO routeNewVO); + PageVO pagingQuery(Long id, MapRouteQueryVO queryVO); + List queryAllRoutes(Long id); + void update(Long id, String routeCode, MapRouteNewVO routeNewVO); + void deleteRoute(Long id, String code); } diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java index 0720fcd5d..7aa0c62fb 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java @@ -7,12 +7,17 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.IDraftMapService; import club.joylink.rtss.simulation.rt.repo.CommonRepository; 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.MapRouteNewVO; +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.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; @@ -62,6 +67,34 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService { return routeNewVO; } + @Override + public PageVO 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 pageTotal = (Page) draftMapRouteDAO.selectByExampleWithBLOBs(example); + List routeVOList = pageTotal.getResult().stream() + .map(MapRouteNewVO::convert2VO).collect(Collectors.toList()); + return PageVO.convert(pageTotal, routeVOList); + } + @Override public List queryAllRoutes(Long id) { DraftMapRouteExample example = new DraftMapRouteExample(); @@ -71,6 +104,25 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService { 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 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 @Override public void deleteRoute(Long id, String code) { diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapSignalApproachSectionService.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapSignalApproachSectionService.java new file mode 100644 index 000000000..d8e8ef86f --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapSignalApproachSectionService.java @@ -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 pagingQuery(Long id, MapSASQueryVO queryVO); + + List queryAll(Long id); + + void update(Long id, String signalCode, MapSignalApproachSectionVO vo); + +} diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapSignalApproachSectionServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapSignalApproachSectionServiceImpl.java new file mode 100644 index 000000000..2842e88b4 --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapSignalApproachSectionServiceImpl.java @@ -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 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 mapOverlaps = (Page) this.draftMapSignalApproachSectionDAO.selectByExampleWithBLOBs(example); + List voList = mapOverlaps.getResult().stream() + .map(MapSignalApproachSectionVO::convert2VO) + .collect(Collectors.toList()); + return PageVO.convert(mapOverlaps, voList); + } + + @Override + public List queryAll(Long id) { + DraftMapSignalApproachSectionExample example = new DraftMapSignalApproachSectionExample(); + DraftMapSignalApproachSectionExample.Criteria criteria = example.createCriteria() + .andMapIdEqualTo(id); + Page mapOverlaps = (Page) 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 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); + } + +} diff --git a/src/main/java/club/joylink/rtss/vo/client/map/MapRouteQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/map/MapRouteQueryVO.java index 6b0263dc9..7fe39a0b3 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/MapRouteQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/MapRouteQueryVO.java @@ -26,7 +26,4 @@ public class MapRouteQueryVO extends PageQueryVO { @ApiModelProperty(value="终端信号机") private String endSignalCode; - @ApiModelProperty(value="接近区段") - private String nearSectionCode; - } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapQueryVO.java index 863f2ea24..df956f264 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapQueryVO.java @@ -11,6 +11,6 @@ import lombok.Setter; @Setter public class MapOverlapQueryVO extends PageQueryVO { - @ApiModelProperty(value="延续保护唯一编号") - private String code; + @ApiModelProperty(value="延续保护名称") + private String name; } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapVO.java index 44989539e..508985a8d 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapOverlapVO.java @@ -13,9 +13,7 @@ import lombok.Setter; import org.springframework.util.CollectionUtils; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; -import java.util.ArrayList; import java.util.List; /** @@ -70,17 +68,11 @@ public class MapOverlapVO { private List triggerPathList; - /** - * 延续保护线路列表 - */ - @NotEmpty(message="延续保护线路列表至少有一条") - private List relSectionSwitchList; - @ApiModelProperty(value = "延续保护路径列表") private List pathList; public MapOverlapVO() { - relSectionSwitchList = new ArrayList<>(); + } public static MapOverlapVO convert2VO(DraftMapOverlap draftMapOverlap) { @@ -114,7 +106,7 @@ public class MapOverlapVO { draftMapOverlap.setId(getId()); draftMapOverlap.setCode(getCode()); draftMapOverlap.setMapId(getMapId()); -// draftMapOverlap.setName(getName()); + draftMapOverlap.setName(getName()); // relData中不包含id和mapId draftMapOverlap.setRelData(getJsonData()); return draftMapOverlap; diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteNewVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteNewVO.java index 398033ea6..528741d83 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteNewVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteNewVO.java @@ -15,7 +15,9 @@ import org.springframework.util.CollectionUtils; import javax.validation.Valid; import javax.validation.constraints.NotBlank; 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; @ApiModel @@ -135,10 +137,6 @@ public class MapRouteNewVO { */ private boolean flt; - /** 是否先锁闭——办理过程直接先锁闭区段 */ - @ApiModelProperty(value = "是否先锁闭——办理过程直接先锁闭区段") - private boolean lockFirst; - /** * 延时解锁时间:单位秒(s) */ diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSASQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSASQueryVO.java new file mode 100644 index 000000000..03f6efc61 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSASQueryVO.java @@ -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; +} diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalApproachSectionVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalApproachSectionVO.java index a745054e5..e8dec77ad 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalApproachSectionVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSignalApproachSectionVO.java @@ -1,11 +1,11 @@ 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.databind.annotation.JsonSerialize; 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.ApiModelProperty; import lombok.Getter; @@ -33,9 +33,6 @@ public class MapSignalApproachSectionVO { @NotNull(message = "地图id不能为空") private Long mapId; -// @NotBlank(message = "接近区段编号不能为空") -// private String code; - /** * 始端信号机 编号 */ @@ -43,21 +40,14 @@ public class MapSignalApproachSectionVO { @ApiModelProperty(value="始端信号机", required=true) private String signalCode; - @ApiModelProperty(value="接近区段(CBTC模式)数据列表") - private List routeSectionList; - - @ApiModelProperty(value = "接近区段(后备模式)列表") - private List blockSectionList; - - @ApiModelProperty(value = "是否引导信号机") - private Boolean callOn; - + /** + * 接近锁闭解锁时间 + */ private Integer releaseTime; private List sectionPathList; public MapSignalApproachSectionVO() { - this.routeSectionList = new ArrayList<>(); } public static MapSignalApproachSectionVO convert2VO(DraftMapSignalApproachSection approachSection) { @@ -88,7 +78,6 @@ public class MapSignalApproachSectionVO { DraftMapSignalApproachSection approachSection = new DraftMapSignalApproachSection(); approachSection.setId(this.getId()); approachSection.setMapId(this.getMapId()); -// approachSection.setCode(this.getCode()); approachSection.setSignalCode(this.getSignalCode()); approachSection.setRelData(this.getJsonData()); return approachSection;