预约功能优化

This commit is contained in:
cjw 2024-08-21 14:45:05 +08:00
parent abb4a0f1d5
commit c790894d86
10 changed files with 105 additions and 14 deletions

View File

@ -13,10 +13,7 @@ import org.dromara.scale.domain.bo.CounselorBo;
import org.dromara.scale.domain.bo.CounselorExperienceBo; import org.dromara.scale.domain.bo.CounselorExperienceBo;
import org.dromara.scale.domain.bo.CounselorQualificationBo; import org.dromara.scale.domain.bo.CounselorQualificationBo;
import org.dromara.scale.domain.bo.ReservationDayBo; import org.dromara.scale.domain.bo.ReservationDayBo;
import org.dromara.scale.domain.vo.CounselorExperienceVo; import org.dromara.scale.domain.vo.*;
import org.dromara.scale.domain.vo.CounselorQualificationVo;
import org.dromara.scale.domain.vo.CounselorVo;
import org.dromara.scale.domain.vo.ReservationDateVo;
import org.dromara.scale.service.ICounselorExperienceService; import org.dromara.scale.service.ICounselorExperienceService;
import org.dromara.scale.service.ICounselorQualificationService; import org.dromara.scale.service.ICounselorQualificationService;
import org.dromara.scale.service.ICounselorService; import org.dromara.scale.service.ICounselorService;
@ -70,12 +67,24 @@ public class WxCounselorController extends BaseController {
* 获取咨询师预约日历 * 获取咨询师预约日历
* *
* @param time - * @param time -
* @param counselorId 咨询师id
* @return * @return
*/ */
@GetMapping("/date") @GetMapping("/reservation/date")
public R<List<ReservationDateVo>> getReservationList(String time, Long counselorId) { public R<List<ReservationDateVo>> getReservationList(String time) {
return R.ok(reservationService.selectDateList(time, counselorId)); Long userId = LoginHelper.getUserId();
return R.ok(reservationService.selectDateList(time, userId));
}
/**
* 获取预约订单
*
* @param time -
* @return
*/
@GetMapping("/reservation/order")
public R<List<ReservationOrderVo>> getReservationOrder(String time) {
Long userId = LoginHelper.getUserId();
return R.ok(reservationService.selectOrderList(time, userId));
} }
/** /**

View File

@ -91,5 +91,15 @@ public class CounselorVo implements Serializable {
*/ */
private String countyCode; private String countyCode;
/**
* 家庭住址
*/
private String address;
/**
* 用户性别
*/
private String sex;
} }

View File

@ -6,7 +6,7 @@ import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
/** /**
* <p>TODO<p> * <p>预约日历表<p>
* *
* @author cjw * @author cjw
* @version V1.0.0 * @version V1.0.0

View File

@ -0,0 +1,28 @@
package org.dromara.scale.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* <p>预约订单<p>
*
* @author cjw
* @version V1.0.0
* @date 2024/8/20 10:23
*/
@Data
public class ReservationOrderVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private String name;
private String startTime;
private String endTime;
private Integer status;
}

View File

@ -6,6 +6,7 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.scale.domain.ReservationDay; import org.dromara.scale.domain.ReservationDay;
import org.dromara.scale.domain.vo.ReservationDateVo; import org.dromara.scale.domain.vo.ReservationDateVo;
import org.dromara.scale.domain.vo.ReservationDayVo; import org.dromara.scale.domain.vo.ReservationDayVo;
import org.dromara.scale.domain.vo.ReservationOrderVo;
import java.util.List; import java.util.List;
@ -19,4 +20,6 @@ import java.util.List;
public interface ReservationDayMapper extends BaseMapperPlus<ReservationDay, ReservationDayVo> { public interface ReservationDayMapper extends BaseMapperPlus<ReservationDay, ReservationDayVo> {
List<ReservationDateVo> selectDateList(@Param("time") String time, @Param("userId") Long userId); List<ReservationDateVo> selectDateList(@Param("time") String time, @Param("userId") Long userId);
List<ReservationOrderVo> selectOrderList(@Param("time") String time, @Param("userId") Long userId);
} }

View File

@ -23,6 +23,14 @@ public interface ICounselorService {
*/ */
CounselorVo queryById(Long id); CounselorVo queryById(Long id);
/**
* 查询心理咨询师-微信端
*
* @param id 主键
* @return 心理咨询师
*/
CounselorVo queryCounselorVoById(Long id);
/** /**
* 分页查询心理咨询师列表 * 分页查询心理咨询师列表
* *

View File

@ -2,6 +2,7 @@ package org.dromara.scale.service;
import org.dromara.scale.domain.bo.ReservationDayBo; import org.dromara.scale.domain.bo.ReservationDayBo;
import org.dromara.scale.domain.vo.ReservationDateVo; import org.dromara.scale.domain.vo.ReservationDateVo;
import org.dromara.scale.domain.vo.ReservationOrderVo;
import java.util.List; import java.util.List;
@ -15,5 +16,7 @@ public interface IReservationService {
*/ */
Boolean insertByBo(ReservationDayBo bo); Boolean insertByBo(ReservationDayBo bo);
List<ReservationDateVo> selectDateList(String time, Long userId); List<ReservationDateVo> selectDateList(String time, Long counselorId);
List<ReservationOrderVo> selectOrderList(String time, Long counselorId);
} }

View File

@ -17,6 +17,7 @@ import org.dromara.scale.domain.vo.CounselorVo;
import org.dromara.scale.mapper.CounselorMapper; import org.dromara.scale.mapper.CounselorMapper;
import org.dromara.scale.service.ICounselorService; import org.dromara.scale.service.ICounselorService;
import org.dromara.system.domain.bo.SysUserBo; import org.dromara.system.domain.bo.SysUserBo;
import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.service.ISysUserService; import org.dromara.system.service.ISysUserService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -49,6 +50,15 @@ public class CounselorServiceImpl implements ICounselorService {
return baseMapper.selectVoById(id); return baseMapper.selectVoById(id);
} }
@Override
public CounselorVo queryCounselorVoById(Long id) {
CounselorVo counselorVo = baseMapper.selectVoById(id);
SysUserVo user = userService.selectUserById(id);
counselorVo.setAddress(user.getAddress());
counselorVo.setSex(user.getSex());
return counselorVo;
}
/** /**
* 分页查询心理咨询师列表 * 分页查询心理咨询师列表
* *

View File

@ -10,6 +10,7 @@ import org.dromara.scale.domain.ReservationDay;
import org.dromara.scale.domain.ReservationTime; import org.dromara.scale.domain.ReservationTime;
import org.dromara.scale.domain.bo.ReservationDayBo; import org.dromara.scale.domain.bo.ReservationDayBo;
import org.dromara.scale.domain.vo.ReservationDateVo; import org.dromara.scale.domain.vo.ReservationDateVo;
import org.dromara.scale.domain.vo.ReservationOrderVo;
import org.dromara.scale.mapper.ReservationDayMapper; import org.dromara.scale.mapper.ReservationDayMapper;
import org.dromara.scale.mapper.ReservationTimeMapper; import org.dromara.scale.mapper.ReservationTimeMapper;
import org.dromara.scale.service.IReservationService; import org.dromara.scale.service.IReservationService;
@ -74,4 +75,9 @@ public class ReservationServiceImpl implements IReservationService {
public List<ReservationDateVo> selectDateList(String time, Long counselorId) { public List<ReservationDateVo> selectDateList(String time, Long counselorId) {
return dayMapper.selectDateList(time, counselorId); return dayMapper.selectDateList(time, counselorId);
} }
@Override
public List<ReservationOrderVo> selectOrderList(String time, Long counselorId) {
return dayMapper.selectOrderList(time, counselorId);
}
} }

View File

@ -9,9 +9,23 @@
left join (select count(*) as num, day_id left join (select count(*) as num, day_id
from m_reservation_time from m_reservation_time
where counselor_id = #{userId} where counselor_id = #{userId}
and status = 0 and status = 1
group by day_id) t on t.day_id = rd.id group by day_id) t on t.day_id = rd.id
where rd.counselor_id = #{userId} where rd.counselor_id = #{userId}
and DATE_FORMAT(rd.day_time, '%Y-%m') = #{time} and DATE_FORMAT(rd.day_time, '%Y-%m') = #{time}
</select> </select>
<select id="selectOrderList" resultType="org.dromara.scale.domain.vo.ReservationOrderVo">
select u.nick_name as name,
DATE_FORMAT(rt.start_time, '%H:%i') as startTime,
DATE_FORMAT(rt.end_time, '%H:%i') as endTime,
rt.status
from m_reservation_time rt
left join m_reservation_day rd on rd.id = rt.day_id
left join m_reservation_order ro on ro.time_id = rt.id
left join sys_user u on u.user_id = ro.create_by
where rt.counselor_id = #{userId}
and DATE_FORMAT(rd.day_time, '%Y-%m') = #{time}
and rt.`status` > 0
</select>
</mapper> </mapper>