|
|
@@ -1,9 +1,12 @@
|
|
|
package bus.service.impl;
|
|
|
|
|
|
import bus.mapper.BUserPreMapper;
|
|
|
+import bus.mapper.WChatUserMapper;
|
|
|
import bus.model.SnowflakeUtil;
|
|
|
import bus.model.dto.*;
|
|
|
+import bus.model.dto.req.BUserPreDetailDto;
|
|
|
import bus.model.po.BUserPrePo;
|
|
|
+import bus.model.po.WChatUserPo;
|
|
|
import bus.model.vo.BCoursePreVo;
|
|
|
import bus.model.po.BCoursePrePo;
|
|
|
import bus.mapper.BCoursePreMapper;
|
|
|
@@ -23,9 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -41,11 +42,15 @@ public class BCoursePreServiceImpl extends ServiceImpl<BCoursePreMapper, BCourse
|
|
|
private BCoursePreMapper bCoursePreMapper;
|
|
|
@Autowired
|
|
|
private BUserPreMapper bUserPreMapper;
|
|
|
+ @Autowired
|
|
|
+ private WChatUserMapper wChatUserMapper;
|
|
|
@Resource
|
|
|
private SnowflakeUtil snowflakeUtil;
|
|
|
|
|
|
@Override
|
|
|
public BCoursePreTypeDto getDetailPre(String type) {
|
|
|
+ ExtInfo extInfo = CurrentUserHolder.get();
|
|
|
+ String userId = extInfo.getUserId();
|
|
|
QueryWrapper<BCoursePrePo> queryWrapper = new QueryWrapper<>();
|
|
|
List<BCoursePrePo> list = this.bCoursePreMapper.selectList(queryWrapper);
|
|
|
Map<String,List<BCoursePrePo>> map = list.stream().collect(Collectors.groupingBy(BCoursePrePo::getType, Collectors.toList()));
|
|
|
@@ -75,15 +80,52 @@ public class BCoursePreServiceImpl extends ServiceImpl<BCoursePreMapper, BCourse
|
|
|
BUserPreCountVo bUserPreCountVo = s.get(pre.getId());
|
|
|
if(bUserPreCountVo == null){
|
|
|
pre.setCounts(0);
|
|
|
+ pre.setIsLocal("0");
|
|
|
}else{
|
|
|
pre.setCounts(bUserPreCountVo.getCount());
|
|
|
+ String userIdStr = bUserPreCountVo.getUserIdStr();
|
|
|
+ List<String> userIdList = Arrays.asList(userIdStr.split(","));
|
|
|
+ if(userIdList.contains(userId)){
|
|
|
+ pre.setIsLocal("1");
|
|
|
+ }else{
|
|
|
+ pre.setIsLocal("0");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
});
|
|
|
|
|
|
return typeDto;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<BUserPreDetailDto> getPreUserByCourse(String courseId, String preId) {
|
|
|
+ List<BUserPreDetailDto> ss = new ArrayList<>();
|
|
|
+ QueryWrapper<BUserPrePo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("pre_id",preId);
|
|
|
+ queryWrapper.eq("course_id",courseId);
|
|
|
+ List<BUserPrePo> list = bUserPreMapper.selectList(queryWrapper);
|
|
|
+ List<String> userIdList = list.stream().map(BUserPrePo::getUserId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ QueryWrapper<WChatUserPo> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.in("user_id",userIdList);
|
|
|
+ List<WChatUserPo> list1 = wChatUserMapper.selectList(queryWrapper1);
|
|
|
+ Map<String,WChatUserPo> map = list1.stream().collect(Collectors.toMap(WChatUserPo::getUserId, a->a));
|
|
|
+ for (BUserPrePo bUserPrePo : list) {
|
|
|
+ BUserPreDetailDto detailDto = new BUserPreDetailDto();
|
|
|
+ String userId = bUserPrePo.getUserId();
|
|
|
+ WChatUserPo wChatUserPo = map.get(userId);
|
|
|
+ if(wChatUserPo !=null) {
|
|
|
+ detailDto.setWxName(wChatUserPo.getWxName());
|
|
|
+ detailDto.setWxPhone(wChatUserPo.getWxPhone());
|
|
|
+ detailDto.setPreDate(DateUtil.format(bUserPrePo.getPreDate(),"yyyy-MM-dd"));
|
|
|
+ ss.add(detailDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ss;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 用户保存预约保存
|
|
|
*
|