zy 7 bulan lalu
induk
melakukan
2367790a5f

+ 3 - 0
bus-biz/src/main/java/bus/service/BCourseInfoService.java

@@ -87,4 +87,7 @@ public interface BCourseInfoService extends IService<BCourseInfoPo> {
     List<WCourseInfoByTypeDto> getMapAllCourse();
 
      WCourseDetailDto getCourseDetail(String courseId) ;
+
+
+    List<WBusInfoDto> getCourseBusByCourseId(String courseId);
 }

+ 11 - 4
bus-biz/src/main/java/bus/service/BCoursePreService.java

@@ -1,9 +1,7 @@
 package bus.service;
 
-import bus.model.dto.BCoursePreDto;
-import bus.model.dto.BCoursePrePageDto;
-import bus.model.dto.BCoursePreTypeDto;
-import bus.model.dto.BUserPreDto;
+import bus.model.dto.*;
+import bus.model.dto.req.BUserPreDetailDto;
 import bus.model.vo.BCoursePreVo;
 import bus.model.po.BCoursePrePo;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -26,6 +24,15 @@ public interface BCoursePreService extends IService<BCoursePrePo> {
     BCoursePreTypeDto getDetailPre(String type);
 
 
+    /**
+     * 查询某路线时刻人数
+     * @param courseId
+     * @param preId
+     * @return
+     */
+    List<BUserPreDetailDto> getPreUserByCourse(String courseId, String preId);
+
+
     /**
      * 用户保存预约保存
      * @param dto

+ 17 - 0
bus-biz/src/main/java/bus/service/impl/BCourseInfoServiceImpl.java

@@ -804,4 +804,21 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
         }
         return detailDto;
     }
+
+    @Override
+    public List<WBusInfoDto> getCourseBusByCourseId(String courseId) {
+        QueryWrapper<BCourseBusPo> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.eq("course_id", courseId);
+        queryWrapper3.orderByAsc("sort");
+        List<BCourseBusPo> list3 = bCourseBusService.list(queryWrapper3);
+        if(CollectionUtil.isNotEmpty(list3)) {
+            List<String> busIds = list3.stream().map(BCourseBusPo::getBusId).collect(Collectors.toList());
+            QueryWrapper<BBusInfoPo> queryWrapper4 = new QueryWrapper<>();
+            queryWrapper4.in("id", busIds);
+            List<BBusInfoPo> list4 = bBusInfoService.list(queryWrapper4);
+            List<WBusInfoDto> wBusInfoDtos = BeanUtil.copyToList(list4, WBusInfoDto.class);
+            return wBusInfoDtos;
+        }
+        return CollectionUtil.newArrayList();
+    }
 }

+ 45 - 3
bus-biz/src/main/java/bus/service/impl/BCoursePreServiceImpl.java

@@ -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;
+    }
+
     /**
      * 用户保存预约保存
      *

+ 1 - 0
bus-biz/src/main/resources/mapper/BUserPreMapper.xml

@@ -24,6 +24,7 @@
      <select id="countByDateAndType" resultType="bus.model.dto.BUserPreCountVo">
         SELECT
             pre_id,
+            group_concat(user_id) as userIdStr,
             COUNT(*) AS count
         FROM b_user_pre
         <where>

+ 2 - 0
bus-common/src/main/java/bus/model/dto/BCoursePreDto.java

@@ -26,5 +26,7 @@ public class BCoursePreDto{
     private String type;
     @ApiModelProperty("预约次数")
     private Integer counts;
+    @ApiModelProperty("当前用户是否预约 1预约")
+    private String isLocal;
 
 }

+ 1 - 0
bus-common/src/main/java/bus/model/dto/BUserPreCountVo.java

@@ -5,5 +5,6 @@ import lombok.Data;
 @Data
 public class BUserPreCountVo {
     private String preId;
+    private String userIdStr;
     private Integer count;
 }

+ 30 - 0
bus-common/src/main/java/bus/model/dto/req/BCourseUserPrePageDto.java

@@ -0,0 +1,30 @@
+package bus.model.dto.req;
+
+import bus.model.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @Program: bus
+* @Description: 描述
+* @Author: zy
+* @Date: 2025-03-17 21:07:13
+**/
+@Data
+public class BCourseUserPrePageDto  {
+
+    @ApiModelProperty("路线id")
+    private String courseId;
+    @ApiModelProperty("路线名称")
+    private String courseName;
+    @ApiModelProperty("预约时刻id")
+    private String preId;
+    @ApiModelProperty("预约时刻")
+    private String preTime;
+    @ApiModelProperty("预约日期")
+    private Date preDate;
+    @ApiModelProperty("预约人数")
+    private Integer userNum;
+}

+ 21 - 0
bus-common/src/main/java/bus/model/dto/req/BUserPreDetailDto.java

@@ -0,0 +1,21 @@
+package bus.model.dto.req;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @Program: bus
+* @Description: 描述
+* @Author: zy
+* @Date: 2025-03-17 21:07:13
+**/
+@Data
+public class BUserPreDetailDto {
+
+    @ApiModelProperty("微信昵称")
+    private String wxName;
+    @ApiModelProperty("手机号")
+    private String wxPhone;
+    @ApiModelProperty("预约日期")
+    private String preDate;
+}

+ 1 - 0
bus-common/src/main/java/bus/model/po/WChatUserPo.java

@@ -22,6 +22,7 @@ public class WChatUserPo{
     private String id;
     private String wxName;
     private String wxPhone;
+    private String userId;
     private String miniOpenId;
     private Date registerTime;
     private Date lastLoginTime;

+ 26 - 4
bus-web/src/main/java/bus/controller/biz/BCoursePreController.java

@@ -1,11 +1,10 @@
 package bus.controller.biz;
 
-import bus.model.dto.BCoursePreTypeDto;
-import bus.model.dto.BUserPreDto;
+import bus.model.dto.*;
+import bus.model.dto.req.BUserPreDetailDto;
+import bus.service.BCourseInfoService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageSerializable;
-import bus.model.dto.BCoursePreDto;
-import bus.model.dto.BCoursePrePageDto;
 import bus.model.vo.BCoursePreVo;
 import bus.service.BCoursePreService;
 import io.swagger.annotations.Api;
@@ -15,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.qzwisdom.qzframework.core.tool.base.controller.BaseController;
 
+import java.util.List;
 
 
 /**
@@ -32,6 +32,8 @@ public class BCoursePreController implements BaseController {
 
     @Autowired
     private BCoursePreService bCoursePreService;
+    @Autowired
+    private BCourseInfoService bCourseInfoService;
 
     /**
      * 预约时刻详情
@@ -43,6 +45,26 @@ public class BCoursePreController implements BaseController {
          return bCoursePreService.getDetailPre(type);
      }
 
+    /**
+     * 查询某路线时刻人数
+     * @param courseId
+     * @param preId
+     * @return
+     */
+    @ApiOperation("查询某路线时刻人")
+    @GetMapping(value = "getPreUserByCourse")
+    public List<BUserPreDetailDto> getPreUserByCourse(@RequestParam String courseId, @RequestParam String preId){
+        return bCoursePreService.getPreUserByCourse(courseId,preId);
+    }
+
+
+
+    @ApiOperation("根据路线查询绑定车辆")
+    @GetMapping(value = "getCourseBusByCourseId")
+    public List<WBusInfoDto> getCourseBusByCourseId(@RequestParam String courseId){
+        return bCourseInfoService.getCourseBusByCourseId(courseId);
+    }
+
     /**
      * 用户保存预约保存
      * @param dto

+ 20 - 3
bus-web/src/main/java/bus/controller/biz/BNoticeUserController.java

@@ -1,5 +1,8 @@
 package bus.controller.biz;
 
+import bus.model.BaseEntity;
+import bus.model.dto.BNoticeInfoDto;
+import bus.model.dto.page.BNoticeInfoPageDto;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageSerializable;
 import bus.model.dto.BNoticeUserDto;
@@ -13,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.qzwisdom.qzframework.core.tool.base.controller.BaseController;
 
+import java.util.List;
 
 
 /**
@@ -24,23 +28,36 @@ import com.qzwisdom.qzframework.core.tool.base.controller.BaseController;
 @Slf4j
 @CrossOrigin
 @RestController
-@Api(tags = "bNoticeUser接口")
+@Api(tags = "公告用户接口")
 @RequestMapping(value="/bNoticeUser")
 public class BNoticeUserController implements BaseController {
 
     @Autowired
     private BNoticeUserService bNoticeUserService;
 
-    @ApiOperation("添加通知用户")
+    @ApiOperation("查看后已读")
     @PostMapping("/add")
     public void add(@RequestBody BNoticeUserDto dto) {
         bNoticeUserService.addNoticeUser(dto);
     }
 
-    @ApiOperation("批量添加通知用户")
+    @ApiOperation("一键已读")
     @PostMapping("/addAll")
     public void addAll() {
         bNoticeUserService.addNoticeUserAll();
     }
 
+    /**
+     * 查询 公告(包括是否已读)
+     * @return 公告列表,包含已读状态
+     */
+    @ApiOperation("小程序公告")
+    @PostMapping("/getNoticeInfoList")
+    public PageSerializable<BNoticeInfoDto> getNoticeInfoList(@RequestBody BaseEntity dto){
+        PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
+        List<BNoticeInfoDto> noticeInfoList = bNoticeUserService.getNoticeInfoList();
+        return new PageSerializable<>(noticeInfoList);
+    }
+
+
 }