|
@@ -45,6 +45,8 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
|
|
|
@Resource
|
|
@Resource
|
|
|
private BCourseTimeService bCourseTimeService;
|
|
private BCourseTimeService bCourseTimeService;
|
|
|
@Resource
|
|
@Resource
|
|
|
|
|
+ private BCoursePreService bCoursePreService;
|
|
|
|
|
+ @Resource
|
|
|
private BCourseStationService bCourseStationService;
|
|
private BCourseStationService bCourseStationService;
|
|
|
@Resource
|
|
@Resource
|
|
|
private BStationInfoService bStationInfoService;
|
|
private BStationInfoService bStationInfoService;
|
|
@@ -75,6 +77,12 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
|
|
|
List<BCourseTimePo> list = bCourseTimeService.list(queryWrapper);
|
|
List<BCourseTimePo> list = bCourseTimeService.list(queryWrapper);
|
|
|
bCourseInfoDto.setBCourseTimeList(BeanUtil.copyToList(list, BCourseTimeDto.class));
|
|
bCourseInfoDto.setBCourseTimeList(BeanUtil.copyToList(list, BCourseTimeDto.class));
|
|
|
|
|
|
|
|
|
|
+ QueryWrapper<BCoursePrePo> queryWrapper6 = new QueryWrapper<>();
|
|
|
|
|
+ queryWrapper6.eq("course_id", id);
|
|
|
|
|
+ queryWrapper6.orderByAsc("sort");
|
|
|
|
|
+ List<BCoursePrePo> list6 = bCoursePreService.list(queryWrapper6);
|
|
|
|
|
+ bCourseInfoDto.setBCoursePreList(BeanUtil.copyToList(list6, BCoursePreDto.class));
|
|
|
|
|
+
|
|
|
QueryWrapper<BCourseStationPo> queryWrapper1 = new QueryWrapper<>();
|
|
QueryWrapper<BCourseStationPo> queryWrapper1 = new QueryWrapper<>();
|
|
|
queryWrapper1.eq("course_id", id);
|
|
queryWrapper1.eq("course_id", id);
|
|
|
queryWrapper1.orderByAsc("sort");
|
|
queryWrapper1.orderByAsc("sort");
|
|
@@ -174,6 +182,11 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
|
|
|
po.setFirstBusSpace(bCourseTimeList.get(0).getBusSpace());
|
|
po.setFirstBusSpace(bCourseTimeList.get(0).getBusSpace());
|
|
|
List<BCourseTimePo> bCourseTimePoList = handleCourseTime(bCourseTimeList, extInfo, po.getId(), false);
|
|
List<BCourseTimePo> bCourseTimePoList = handleCourseTime(bCourseTimeList, extInfo, po.getId(), false);
|
|
|
bCourseTimeService.saveBatch(bCourseTimePoList);
|
|
bCourseTimeService.saveBatch(bCourseTimePoList);
|
|
|
|
|
+ //处理预约时刻
|
|
|
|
|
+ List<BCoursePreDto> bCoursePreList = dto.getBCoursePreList();
|
|
|
|
|
+ List<BCoursePrePo> bCoursePrePos = handleCoursePre(bCoursePreList, extInfo, po.getId(), false);
|
|
|
|
|
+ bCoursePreService.saveBatch(bCoursePrePos);
|
|
|
|
|
+
|
|
|
//处理标志点
|
|
//处理标志点
|
|
|
List<BCourseStationDto> bCourseStationList = dto.getBCourseStationList();
|
|
List<BCourseStationDto> bCourseStationList = dto.getBCourseStationList();
|
|
|
|
|
|
|
@@ -192,13 +205,13 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
|
|
|
|
|
|
|
|
//处理车辆
|
|
//处理车辆
|
|
|
List<BCourseBusDto> bCourseBusList = dto.getBCourseBusList();
|
|
List<BCourseBusDto> bCourseBusList = dto.getBCourseBusList();
|
|
|
- List<String> busId = bCourseBusList.stream().map(BCourseBusDto::getBusId).collect(Collectors.toList());
|
|
|
|
|
- QueryWrapper<BCourseBusPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
- queryWrapper.in("bus_id", busId);
|
|
|
|
|
- List<BCourseBusPo> list = bCourseBusService.list(queryWrapper);
|
|
|
|
|
- if(CollectionUtil.isNotEmpty(list)){
|
|
|
|
|
- throw new BusinessException("存在车辆已被绑定");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// List<String> busId = bCourseBusList.stream().map(BCourseBusDto::getBusId).collect(Collectors.toList());
|
|
|
|
|
+// QueryWrapper<BCourseBusPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+// queryWrapper.in("bus_id", busId);
|
|
|
|
|
+// List<BCourseBusPo> list = bCourseBusService.list(queryWrapper);
|
|
|
|
|
+// if(CollectionUtil.isNotEmpty(list)){
|
|
|
|
|
+// throw new BusinessException("存在车辆已被绑定");
|
|
|
|
|
+// }
|
|
|
List<BCourseBusPo> bCourseBusPos = handleCourseBus(bCourseBusList, extInfo, po.getId(), true);
|
|
List<BCourseBusPo> bCourseBusPos = handleCourseBus(bCourseBusList, extInfo, po.getId(), true);
|
|
|
bCourseBusService.saveBatch(bCourseBusPos);
|
|
bCourseBusService.saveBatch(bCourseBusPos);
|
|
|
this.bCourseInfoMapper.insert(po);
|
|
this.bCourseInfoMapper.insert(po);
|
|
@@ -237,6 +250,12 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
|
|
|
po.setFirstBusSpace(bCourseTimeList.get(0).getBusSpace());
|
|
po.setFirstBusSpace(bCourseTimeList.get(0).getBusSpace());
|
|
|
List<BCourseTimePo> bCourseTimePoList = handleCourseTime(bCourseTimeList, extInfo, po.getId(), false);
|
|
List<BCourseTimePo> bCourseTimePoList = handleCourseTime(bCourseTimeList, extInfo, po.getId(), false);
|
|
|
bCourseTimeService.saveBatch(bCourseTimePoList);
|
|
bCourseTimeService.saveBatch(bCourseTimePoList);
|
|
|
|
|
+
|
|
|
|
|
+ //处理预约时刻
|
|
|
|
|
+ bCoursePreService.deleteByCourseId(po.getId());
|
|
|
|
|
+ List<BCoursePreDto> bCoursePreList = dto.getBCoursePreList();
|
|
|
|
|
+ List<BCoursePrePo> bCoursePrePos = handleCoursePre(bCoursePreList, extInfo, po.getId(), false);
|
|
|
|
|
+ bCoursePreService.saveBatch(bCoursePrePos);
|
|
|
//处理标志点
|
|
//处理标志点
|
|
|
bCourseStationService.deleteByCourseId(po.getId());
|
|
bCourseStationService.deleteByCourseId(po.getId());
|
|
|
List<BCourseStationDto> bCourseStationList = dto.getBCourseStationList();
|
|
List<BCourseStationDto> bCourseStationList = dto.getBCourseStationList();
|
|
@@ -250,14 +269,14 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
|
|
|
//处理车辆
|
|
//处理车辆
|
|
|
bCourseBusService.deleteByCourseId(po.getId());
|
|
bCourseBusService.deleteByCourseId(po.getId());
|
|
|
List<BCourseBusDto> bCourseBusList = dto.getBCourseBusList();
|
|
List<BCourseBusDto> bCourseBusList = dto.getBCourseBusList();
|
|
|
- List<String> busId = bCourseBusList.stream().map(BCourseBusDto::getBusId).collect(Collectors.toList());
|
|
|
|
|
- QueryWrapper<BCourseBusPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
- queryWrapper.in("bus_id", busId);
|
|
|
|
|
- queryWrapper.ne("id",dto.getId());
|
|
|
|
|
- List<BCourseBusPo> list = bCourseBusService.list(queryWrapper);
|
|
|
|
|
- if(CollectionUtil.isNotEmpty(list)){
|
|
|
|
|
- throw new BusinessException("存在车辆已被绑定");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// List<String> busId = bCourseBusList.stream().map(BCourseBusDto::getBusId).collect(Collectors.toList());
|
|
|
|
|
+// QueryWrapper<BCourseBusPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+// queryWrapper.in("bus_id", busId);
|
|
|
|
|
+// queryWrapper.ne("id",dto.getId());
|
|
|
|
|
+// List<BCourseBusPo> list = bCourseBusService.list(queryWrapper);
|
|
|
|
|
+// if(CollectionUtil.isNotEmpty(list)){
|
|
|
|
|
+// throw new BusinessException("存在车辆已被绑定");
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
List<BCourseBusPo> bCourseBusPos = handleCourseBus(bCourseBusList, extInfo, po.getId(), false);
|
|
List<BCourseBusPo> bCourseBusPos = handleCourseBus(bCourseBusList, extInfo, po.getId(), false);
|
|
|
bCourseBusService.saveBatch(bCourseBusPos);
|
|
bCourseBusService.saveBatch(bCourseBusPos);
|
|
@@ -292,6 +311,30 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
|
|
|
}
|
|
}
|
|
|
return bCourseTimePoList;
|
|
return bCourseTimePoList;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private List<BCoursePrePo> handleCoursePre(List<BCoursePreDto> timeList,
|
|
|
|
|
+ ExtInfo extInfo,
|
|
|
|
|
+ String courseId,
|
|
|
|
|
+ Boolean isCreate) {
|
|
|
|
|
+ List<BCoursePrePo> bCoursePrePoList = new ArrayList<>();
|
|
|
|
|
+ for (int i = 0; i < timeList.size(); i++) {
|
|
|
|
|
+ BCoursePreDto bCoursePreDto = timeList.get(i);
|
|
|
|
|
+ BCoursePrePo bCoursePrePo = BeanUtil.toBean(bCoursePreDto, BCoursePrePo.class);
|
|
|
|
|
+ bCoursePrePo.setId(snowflakeUtil.snowflakeId());
|
|
|
|
|
+ bCoursePrePo.setCourseId(courseId);
|
|
|
|
|
+ if(isCreate){
|
|
|
|
|
+ bCoursePrePo.setCreateTime(new Date());
|
|
|
|
|
+ bCoursePrePo.setCreatorId(extInfo.getUserId());
|
|
|
|
|
+ bCoursePrePo.setCreatorName(extInfo.getUserName());
|
|
|
|
|
+ }
|
|
|
|
|
+ bCoursePrePo.setUpdateTime(new Date());
|
|
|
|
|
+ bCoursePrePo.setUpdaterId(extInfo.getUserId());
|
|
|
|
|
+ bCoursePrePo.setUpdaterName(extInfo.getUserName());
|
|
|
|
|
+
|
|
|
|
|
+ bCoursePrePoList.add(bCoursePrePo);
|
|
|
|
|
+ }
|
|
|
|
|
+ return bCoursePrePoList;
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 处理站点信息
|
|
* 处理站点信息
|
|
|
*/
|
|
*/
|