|
|
@@ -1,19 +1,26 @@
|
|
|
package bus.service.impl;
|
|
|
|
|
|
+import bus.mapper.BPreBusMapper;
|
|
|
import bus.mapper.BUserPreMapper;
|
|
|
import bus.mapper.WChatUserMapper;
|
|
|
import bus.model.SnowflakeUtil;
|
|
|
import bus.model.dto.*;
|
|
|
+import bus.model.dto.req.BCourseUserPrePageDto;
|
|
|
+import bus.model.dto.req.BCourseUserPreReqDto;
|
|
|
import bus.model.dto.req.BUserPreDetailDto;
|
|
|
+import bus.model.dto.req.PreBusStatusDto;
|
|
|
+import bus.model.po.BPreBusPo;
|
|
|
import bus.model.po.BUserPrePo;
|
|
|
import bus.model.po.WChatUserPo;
|
|
|
import bus.model.vo.BCoursePreVo;
|
|
|
import bus.model.po.BCoursePrePo;
|
|
|
import bus.mapper.BCoursePreMapper;
|
|
|
|
|
|
+import bus.model.vo.BUserPreVo;
|
|
|
import bus.service.BCoursePreService;
|
|
|
import bus.service.BUserPreService;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
@@ -43,15 +50,18 @@ public class BCoursePreServiceImpl extends ServiceImpl<BCoursePreMapper, BCourse
|
|
|
@Autowired
|
|
|
private BUserPreMapper bUserPreMapper;
|
|
|
@Autowired
|
|
|
+ private BPreBusMapper bPreBusMapper;
|
|
|
+ @Autowired
|
|
|
private WChatUserMapper wChatUserMapper;
|
|
|
@Resource
|
|
|
private SnowflakeUtil snowflakeUtil;
|
|
|
|
|
|
@Override
|
|
|
- public BCoursePreTypeDto getDetailPre(String type) {
|
|
|
+ public BCoursePreTypeDto getDetailPre(String type,String courseId) {
|
|
|
ExtInfo extInfo = CurrentUserHolder.get();
|
|
|
String userId = extInfo.getUserId();
|
|
|
QueryWrapper<BCoursePrePo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("course_id", courseId);
|
|
|
List<BCoursePrePo> list = this.bCoursePreMapper.selectList(queryWrapper);
|
|
|
Map<String,List<BCoursePrePo>> map = list.stream().collect(Collectors.groupingBy(BCoursePrePo::getType, Collectors.toList()));
|
|
|
BCoursePreTypeDto typeDto = new BCoursePreTypeDto();
|
|
|
@@ -71,6 +81,7 @@ public class BCoursePreServiceImpl extends ServiceImpl<BCoursePreMapper, BCourse
|
|
|
statDto.setStartDate(DateUtil.parse(today, "yyyy-MM-dd"));
|
|
|
statDto.setEndDate(DateUtil.parse(sunday, "yyyy-MM-dd"));
|
|
|
statDto.setType(type);
|
|
|
+ statDto.setType(courseId);
|
|
|
// 查询各时间段预约数量
|
|
|
List<BUserPreCountVo> bUserPreCountVos = bUserPreMapper.countByDateAndType(statDto);
|
|
|
Map<String,BUserPreCountVo> s = bUserPreCountVos.stream().collect(Collectors.toMap(BUserPreCountVo::getPreId, a->a));
|
|
|
@@ -156,6 +167,7 @@ public class BCoursePreServiceImpl extends ServiceImpl<BCoursePreMapper, BCourse
|
|
|
BUserPrePo po = new BUserPrePo();
|
|
|
po.setCourseId(bCoursePrePo.getCourseId());
|
|
|
po.setPreId(dto.getPreId());
|
|
|
+ po.setPreTime(bCoursePrePo.getPreTime());
|
|
|
po.setPreDate(DateUtil.parse(today, "yyyy-MM-dd"));
|
|
|
po.setType(dto.getType());
|
|
|
po.setUserId(extInfo.getUserId());
|
|
|
@@ -167,6 +179,29 @@ public class BCoursePreServiceImpl extends ServiceImpl<BCoursePreMapper, BCourse
|
|
|
po.setCreatorName(extInfo.getUserName());
|
|
|
po.setUpdaterName(extInfo.getUserName());
|
|
|
bUserPreMapper.insert(po);
|
|
|
+ //首次保存预约状态表
|
|
|
+ QueryWrapper<BPreBusPo> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("pre_id",dto.getPreId());
|
|
|
+ queryWrapper1.eq("pre_time",po.getPreTime());
|
|
|
+ queryWrapper1.eq("pre_date",today);
|
|
|
+ List<BPreBusPo> list = bPreBusMapper.selectList(queryWrapper1);
|
|
|
+ if(CollectionUtil.isEmpty(list)) {
|
|
|
+ BPreBusPo bPreBusPo = new BPreBusPo();
|
|
|
+ bPreBusPo.setPreDate(po.getPreDate());
|
|
|
+ bPreBusPo.setPreId(dto.getPreId());
|
|
|
+ bPreBusPo.setPreTime(po.getPreTime());
|
|
|
+ bPreBusPo.setId(snowflakeUtil.snowflakeId());
|
|
|
+ bPreBusPo.setPreStatus("0");
|
|
|
+ bPreBusPo.setCreateTime(new Date());
|
|
|
+ bPreBusPo.setUpdateTime(new Date());
|
|
|
+ bPreBusPo.setCreatorId(extInfo.getUserId());
|
|
|
+ bPreBusPo.setUpdaterId(extInfo.getUserId());
|
|
|
+ bPreBusPo.setCreatorName(extInfo.getUserName());
|
|
|
+ bPreBusPo.setUpdaterName(extInfo.getUserName());
|
|
|
+ bPreBusMapper.insert(bPreBusPo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -188,6 +223,24 @@ public class BCoursePreServiceImpl extends ServiceImpl<BCoursePreMapper, BCourse
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<BCourseUserPrePageDto> getPreUserNum(BCourseUserPreReqDto reqDto) {
|
|
|
+ List<BCourseUserPrePageDto> preUserNum = bCoursePreMapper.getPreUserNum(reqDto);
|
|
|
+ return preUserNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void selectBusFc(PreBusStatusDto preBusStatusDto) {
|
|
|
+ ExtInfo extInfo = CurrentUserHolder.get();
|
|
|
+ String preBusId = preBusStatusDto.getPreBusId();
|
|
|
+ BPreBusPo bPreBusPo = bPreBusMapper.selectById(preBusId);
|
|
|
+ bPreBusPo.setBusId(preBusStatusDto.getBusId());
|
|
|
+ bPreBusPo.setPreStatus(preBusStatusDto.getPreStatus());
|
|
|
+ bPreBusPo.setUpdaterId(extInfo.getUserId());
|
|
|
+ bPreBusPo.setUpdateTime(new Date());
|
|
|
+ bPreBusMapper.updateById(bPreBusPo);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
* @param id
|