1.预约详情

2.取消预约
3.小程序-预约记录
4.小程序-预约详情
5.导出预约记录
6.小程序-取消预约
main
862857010@qq.com 2 years ago
parent 0522ba8482
commit 084e5198aa
  1. 34
      src/main/java/com/cjy/back/ybsjAppointment/controller/YbsjyAppletsAppointmentController.java
  2. 35
      src/main/java/com/cjy/back/ybsjAppointment/controller/YbsjyAppointmentRecordController.java
  3. 54
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.java
  4. 169
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.xml
  5. 20
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentSettingMapper.java
  6. 9
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentSettingMapper.xml
  7. 3
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/AppletsAppointmentListVO.java
  8. 85
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/AppointmentDocumentsDetails.java
  9. 3
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/AppointmentFormVO.java
  10. 19
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/AppointmentPersonVO.java
  11. 30
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/GetAppointmentRecordVO.java
  12. 3
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/ReservationNowVO.java
  13. 53
      src/main/java/com/cjy/back/ybsjAppointment/service/YbsjyAppointmentRecordService.java
  14. 17
      src/main/java/com/cjy/back/ybsjAppointment/service/YbsjyAppointmentSettingService.java
  15. 219
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentRecordImpl.java
  16. 62
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentSettingServiceImpl.java
  17. 42
      src/main/java/com/cjy/back/ybsjAppointment/task/HandleExpiredAppointmentsTask.java
  18. 5
      src/main/java/com/cjy/config/DefaultView.java
  19. 12
      src/main/resources/application.properties

@ -1,6 +1,8 @@
package com.cjy.back.ybsjAppointment.controller;
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO;
import com.cjy.back.ybsjAppointment.entity.vo.ReservationNowVO;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentRecordService;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentSettingService;
import com.cjy.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,7 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
public class YbsjyAppletsAppointmentController {
@Autowired
YbsjyAppointmentSettingService ybsjyAppointmentSettingService;
@Autowired
YbsjyAppointmentRecordService ybsjyAppointmentRecordService;
/**
* 通过日期和景区参数去获取预约列表
*/
@ -35,4 +38,33 @@ public class YbsjyAppletsAppointmentController {
return ybsjyAppointmentSettingService.reservationNow(reservationNowVO);
}
/**
* 小程序取消预约
* @param id
* @param unionId
* @return
*/
@RequestMapping("appletsCancelAppointment")
public ServerResponse appletsCancelAppointment( Long id,String unionId) {
return ybsjyAppointmentRecordService.cancelAppointment(id,unionId);
}
/**
* 小程序预约记录
*/
@RequestMapping("appletsAppointmentRecord")
public ServerResponse appletsAppointmentRecord(@RequestBody GetAppointmentRecordVO getAppointmentRecordVO) {
return ybsjyAppointmentSettingService.appletsAppointmentRecord(getAppointmentRecordVO);
}
/**
* 小程序预约详情
*/
@RequestMapping("appletsAppointmentDocumentsDetails")
public ServerResponse appletsAppointmentDocumentsDetails(Long id){
return ybsjyAppointmentSettingService.appletsAppointmentDocumentsDetails(id);
}
}

@ -4,12 +4,15 @@ import com.cjy.back.sysUser.entity.SysUser;
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentRecordService;
import com.cjy.util.ServerResponse;
import jxl.write.WriteException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author liangjiawei
@ -52,4 +55,36 @@ public class YbsjyAppointmentRecordController {
return ybsjyAppointmentRecordService.deleteAppointmentRecord(id,user.getUserid());
}
/**
* 取消预约
*/
@RequestMapping("cancelAppointment")
public ServerResponse cancelAppointment(HttpServletRequest request,Long id){
SysUser user = (SysUser) request.getSession().getAttribute("admin");
if (user == null) {
return ServerResponse.createByError("请重新登陆");
}
return ybsjyAppointmentRecordService.cancelAppointment(id,user.getUserid());
}
/**
* 预约详情
*/
@RequestMapping("appointmentDocumentsDetails")
public ServerResponse appointmentDocumentsDetails(HttpServletRequest request,Long id){
SysUser user = (SysUser) request.getSession().getAttribute("admin");
if (user == null) {
return ServerResponse.createByError("请重新登陆");
}
return ybsjyAppointmentRecordService.appointmentDocumentsDetails(id);
}
/**
* 导出
*/
@RequestMapping("/exportReserveRecord")
public void exportReserveList(HttpServletRequest request, HttpServletResponse response,@RequestBody GetAppointmentRecordVO getAppointmentRecordVO) throws IOException, WriteException {
ybsjyAppointmentRecordService.exportReserveRecord(request,response,getAppointmentRecordVO);
}
}

@ -1,6 +1,8 @@
package com.cjy.back.ybsjAppointment.dao;
import com.cjy.back.ybsjAppointment.entity.YbsjyAppointmentSettingEntity;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentDocumentsDetails;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO;
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO;
import com.cjy.common.mybatis.page.PageParameter;
import org.apache.ibatis.annotations.Param;
@ -20,6 +22,7 @@ public interface YbsjyAppointmentRecordMapper {
* @return
*/
List<Map<String, Object>> getAppointmentRecordListByPage(@Param("page") PageParameter page, @Param("getAppointmentRecordVO") GetAppointmentRecordVO getAppointmentRecordVO);
List<Map<String, Object>> getappletsAppointmentRecordListByPage(@Param("page") PageParameter page, @Param("getAppointmentRecordVO") GetAppointmentRecordVO getAppointmentRecordVO);
/**
* 删除预约单
@ -27,4 +30,55 @@ public interface YbsjyAppointmentRecordMapper {
* @return
*/
int deleteAppointmentRecord(@Param("id") Long id,@Param("userId") int userId);
/**
* 修改预约单状态
* @param id
* @param userId
* @return
*/
int updateCancelDocuments(@Param("id") Long id,@Param("userId") String userId);
/**
* 修改预约单中人的状态
* @param id
* @param userId
* @return
*/
int updateAppointmentPeopleInfo(@Param("id") Long id,@Param("userId") String userId);
/**
* 获取预约单信息
* @param id
* @return
*/
AppointmentDocumentsDetails getAppointmentDocumentsInfo(Long id);
AppointmentDocumentsDetails getAppletsAppointmentDocumentsInfo(Long id);
/**
* 获取预约单人员信息
* @param id
* @return
*/
List<AppointmentPersonVO> getAppointmentPersonInfo(Long id);
/**
* 获取导出预约记录数据
* @param getAppointmentRecordVO
* @return
*/
List<Map<String,Object>> getExportReserveRecordList( @Param("getAppointmentRecordVO") GetAppointmentRecordVO getAppointmentRecordVO);
/**
* 获取当天预约且为核销的预约数据
*/
List<AppointmentPersonVO> getAppointmentNotWrittenOffRecord();
/**
* 修改预约单状态
* @param id
* @return
*/
int updateAppointmentRecordSate(Long id);
}

@ -5,8 +5,26 @@
<mapper namespace="com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentRecordMapper">
<update id="deleteAppointmentRecord">
update ybsj_appointment_documents_info
set del_flag= 2,update_by=#{userId}
where id=#{id}
set del_flag= 2,
update_by=#{userId}
where id = #{id}
</update>
<update id="updateCancelDocuments">
update ybsj_appointment_documents_info
set appointment_documents_write_off=3,
update_by=#{userId},
update_time= NOW()
where id = #{id}
</update>
<update id="updateAppointmentPeopleInfo">
update ybsj_appointment_people_info
set write_off=3,
update_by=#{userId},
update_time= NOW()
where appointment_documents_id = #{id}
</update>
<update id="updateAppointmentRecordSate">
update ybsj_appointment_people_info set expired_state=1,write_off=3 where id=#{id}
</update>
<select id="getAppointmentRecordListByPage" resultType="java.util.Map">
@ -43,7 +61,154 @@
<if test="getAppointmentRecordVO.state !=null and getAppointmentRecordVO.state !=''">
and t1.appointment_documents_write_off =#{getAppointmentRecordVO.state}
</if>
<if test="getAppointmentRecordVO.unionId !=null and getAppointmentRecordVO.unionId!='' ">
and t1.union_id =#{getAppointmentRecordVO.unionId}
</if>
<if test="getAppointmentRecordVO.scenicId !=null and getAppointmentRecordVO.scenicId !='' ">
and t1.scenic_id =#{getAppointmentRecordVO.scenicId}
</if>
GROUP BY t1.id
ORDER BY t1.create_time desc
</select>
<select id="getAppointmentDocumentsInfo"
resultType="com.cjy.back.ybsjAppointment.entity.vo.AppointmentDocumentsDetails">
SELECT t1.appointment_number as appointmentNumber,
t2.sname as scenicName,
t1.appointment_date as appointmentDate,
CONCAT(t3.start_time, '~', t3.end_time) as appointmentSlot,
t1.appointment_count as appointmentCount,
DATE_FORMAT(t1.create_time, '%Y-%m-%d %H:%i:%s') AS submissionDate
FROM ybsj_appointment_documents_info t1
LEFT JOIN ybsj_scenic_info t2 on t1.scenic_id = t2.guid
LEFT JOIN ybsj_appointment_time_info t3 on t1.appointment_time_info_id = t3.id
where t1.id = #{id}
</select>
<select id="getAppointmentPersonInfo"
resultType="com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO">
select name,
phone,
documents_type as documentsType,
documents_number as documentsNumber,
reservation_code as reservationCode,
write_off as writeOff,
write_off_date as writeOffDate,
qr_content as qrContent
from ybsj_appointment_people_info
where appointment_documents_id = #{id}
</select>
<select id="getappletsAppointmentRecordListByPage" resultType="java.util.Map">
SELECT
t1.id,
t1.appointment_number,
t1.appointment_count,
CONCAT( DATE_FORMAT(t1.appointment_date, '%Y年%m月%d日'), ' ', CONCAT( t3.start_time, '-', t3.end_time ) ) as
periodTime
FROM
ybsj_appointment_people_info t4
LEFT join ybsj_appointment_documents_info t1 on t1.id=t4.appointment_documents_id and t1.del_flag != 2
LEFT JOIN ybsj_scenic_info t2 ON t1.scenic_id = t2.guid
LEFT JOIN ybsj_appointment_time_info t3 ON t1.appointment_time_info_id = t3.id
where 1=1
and t4.reservation_person=0
<if test="getAppointmentRecordVO.scenicName !=null and getAppointmentRecordVO.scenicName!=''">
and t2.sname LIKE CONCAT('%',#{getAppointmentRecordVO.scenicName},'%')
</if>
<if test="getAppointmentRecordVO.reservationDate !=null and getAppointmentRecordVO.reservationDate!=''">
and t1.appointment_date= #{getAppointmentRecordVO.reservationDate}
</if>
<if test="getAppointmentRecordVO.reservationPersonName !=null and getAppointmentRecordVO.reservationPersonName !=''">
and t4.name LIKE CONCAT('%',#{getAppointmentRecordVO.reservationPersonName},'%')
</if>
<if test="getAppointmentRecordVO.reservationPersonPhone !=null and getAppointmentRecordVO.reservationPersonPhone !=''">
and t4.phone LIKE CONCAT('%',#{getAppointmentRecordVO.reservationPersonPhone},'%')
</if>
<if test="getAppointmentRecordVO.state !=null and getAppointmentRecordVO.state !=''">
and t1.appointment_documents_write_off =#{getAppointmentRecordVO.state}
</if>
<if test="getAppointmentRecordVO.unionId !=null and getAppointmentRecordVO.unionId!='' ">
and t1.union_id =#{getAppointmentRecordVO.unionId}
</if>
<if test="getAppointmentRecordVO.scenicId !=null and getAppointmentRecordVO.scenicId !='' ">
and t1.scenic_id =#{getAppointmentRecordVO.scenicId}
</if>
GROUP BY t1.id
ORDER BY t1.create_time desc
</select>
<select id="getAppletsAppointmentDocumentsInfo"
resultType="com.cjy.back.ybsjAppointment.entity.vo.AppointmentDocumentsDetails">
SELECT t1.id,
t1.appointment_number,
t1.appointment_count,
CONCAT(DATE_FORMAT(t1.appointment_date, '%Y年%m月%d日'), ' ', CONCAT(t3.start_time, '-', t3.end_time)) as
appointmentSlot
FROM ybsj_appointment_documents_info t1
LEFT JOIN ybsj_appointment_time_info t3 ON t1.appointment_time_info_id = t3.id
where 1 = 1
and t1.id = #{id}
and t1.del_flag != 2
</select>
<select id="getExportReserveRecordList" resultType="java.util.Map">
SELECT
t1.id,
t1.appointment_number as appointmentNumber,
t2.sname as scenicName,
t1.appointment_date as appointmentDate,
CONCAT( t3.start_time, '~', t3.end_time ) as appointmentSlot,
t4.name,
t4.phone,
t5.dicname as documentsType,
t4.documents_number as documentsNumber,
t4.reservation_code as reservationCode,
t4.write_off as state,
IFNULL(t4.write_off_date, '') as writeOffDate
FROM
ybsj_appointment_people_info t4
LEFT join ybsj_appointment_documents_info t1 on t1.id=t4.appointment_documents_id and t1.del_flag != 2
LEFT JOIN ybsj_scenic_info t2 ON t1.scenic_id = t2.guid
LEFT JOIN ybsj_appointment_time_info t3 ON t1.appointment_time_info_id = t3.id
LEFT JOIN sys_dictionary t5 ON t4.documents_type =t5.dicnum
<if test="getAppointmentRecordVO.scenicName !=null and getAppointmentRecordVO.scenicName!=''">
and t2.sname LIKE CONCAT('%',#{getAppointmentRecordVO.scenicName},'%')
</if>
<if test="getAppointmentRecordVO.reservationDate !=null and getAppointmentRecordVO.reservationDate!=''">
and t1.appointment_date= #{getAppointmentRecordVO.reservationDate}
</if>
<if test="getAppointmentRecordVO.reservationPersonName !=null and getAppointmentRecordVO.reservationPersonName !=''">
and t4.name LIKE CONCAT('%',#{getAppointmentRecordVO.reservationPersonName},'%')
</if>
<if test="getAppointmentRecordVO.reservationPersonPhone !=null and getAppointmentRecordVO.reservationPersonPhone !=''">
and t4.phone LIKE CONCAT('%',#{getAppointmentRecordVO.reservationPersonPhone},'%')
</if>
<if test="getAppointmentRecordVO.state !=null and getAppointmentRecordVO.state !=''">
and t1.appointment_documents_write_off =#{getAppointmentRecordVO.state}
</if>
</select>
<select id="getAppointmentNotWrittenOffRecord"
resultType="com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO">
SELECT
t1.id,
t1.`name`,
t1.phone,
t1.documents_type as documentsType ,
t1.documents_number as documentsNumber,
t1.reservation_code as reservationCode,
t1.appointment_documents_id as appointmentDocumentsId,
t1.appointment_time_info_id as appointmentTimeInfoId,
t1.qr_content as qrContent,
t1.appointment_date as appointmentDate,
t1.reservation_person as reservationPerson,
t2.end_time as endTime
FROM
ybsj_appointment_people_info t1
LEFT JOIN ybsj_appointment_time_info t2 on t1.appointment_time_info_id=t2.id
WHERE
t1.write_off_date IS NULL
AND t1.appointment_date = CURDATE() and write_off =0 and del_flag!=2
</select>
</mapper>

@ -8,7 +8,6 @@ import com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO;
import com.cjy.common.mybatis.page.PageParameter;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -139,7 +138,26 @@ public interface YbsjyAppointmentSettingMapper {
int getAppointmentCount(@Param("appointmentTimeInfoId")Long appointmentTimeInfoId,@Param("date") String date);
/**
* 获取时间段信息
* @param id
* @return
*/
AppointmentTimeInfoEntity getPeriodInfo(@Param("id") Long id);
/**
* 保存预约单信息
* @param appointmentFormVO
* @return
*/
int saveAppointmentDocumentsInfo(AppointmentFormVO appointmentFormVO);
/**
* 保存预约人信息
* @param list
* @return
*/
int saveAppointmentPeopleInfo(@Param("list") List<AppointmentPersonVO> list);
int getReservationInformation(@Param("appointmentTimeInfoId") Long appointmentTimeInfoId, @Param("list") List<AppointmentPersonVO> appointmentPersonVOS,@Param("date") String date);
}

@ -38,7 +38,7 @@
VALUES
<foreach item="item" collection="list" separator=",">
( #{item.name}, #{item.phone}, #{item.documentsType}, #{item.documentsNumber}, #{item.reservationCode},
#{item.appointmentDocumentsId}, #{item.appointmentTimeInfoId}, #{item.qrContent}, #{item.appointmentDate}),#{item.reservationPerson}
#{item.appointmentDocumentsId}, #{item.appointmentTimeInfoId}, #{item.qrContent}, #{item.appointmentDate},#{item.reservationPerson})
</foreach>
</insert>
@ -165,4 +165,11 @@
from ybsj_appointment_time_info
where id = #{id}
</select>
<select id="getReservationInformation" resultType="java.lang.Integer">
select count(*) from ybsj_appointment_people_info where
appointment_time_info_id=#{appointmentTimeInfoId} and appointment_date=#{date} and documents_number in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.documentsNumber}
</foreach>
</select>
</mapper>

@ -1,9 +1,12 @@
package com.cjy.back.ybsjAppointment.entity.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* @author liangjiawei
* @createDate 2023/7/26
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class AppletsAppointmentListVO {
//预约时间段的id

@ -0,0 +1,85 @@
package com.cjy.back.ybsjAppointment.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import java.util.List;
/**
* @author liangjiawei
* @createDate 2023/7/28
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class AppointmentDocumentsDetails {
//预约单号
private String appointmentNumber;
//景区名称
private String scenicName;
//预约日期
private String appointmentDate;
//预约时间段
private String appointmentSlot;
//预约人数
private String appointmentCount;
//提交日期
private String submissionDate;
//预约人集合
private List<AppointmentPersonVO> list=new ArrayList<>();
public String getAppointmentNumber() {
return appointmentNumber;
}
public void setAppointmentNumber(String appointmentNumber) {
this.appointmentNumber = appointmentNumber;
}
public String getScenicName() {
return scenicName;
}
public void setScenicName(String scenicName) {
this.scenicName = scenicName;
}
public String getAppointmentDate() {
return appointmentDate;
}
public void setAppointmentDate(String appointmentDate) {
this.appointmentDate = appointmentDate;
}
public String getAppointmentSlot() {
return appointmentSlot;
}
public void setAppointmentSlot(String appointmentSlot) {
this.appointmentSlot = appointmentSlot;
}
public String getAppointmentCount() {
return appointmentCount;
}
public void setAppointmentCount(String appointmentCount) {
this.appointmentCount = appointmentCount;
}
public String getSubmissionDate() {
return submissionDate;
}
public void setSubmissionDate(String submissionDate) {
this.submissionDate = submissionDate;
}
public List<AppointmentPersonVO> getList() {
return list;
}
public void setList(List<AppointmentPersonVO> list) {
this.list = list;
}
}

@ -1,9 +1,12 @@
package com.cjy.back.ybsjAppointment.entity.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* @author liangjiawei
* @createDate 2023/7/27
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class AppointmentFormVO {
private Long id;
private String appointmentNumber;

@ -1,11 +1,14 @@
package com.cjy.back.ybsjAppointment.entity.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* @author liangjiawei
* @createDate 2023/7/26
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class AppointmentPersonVO {
private int id;
private Long id;
//姓名
private String name;
//手机号
@ -33,6 +36,8 @@ public class AppointmentPersonVO {
//是否是预约人
private int reservationPerson;
private String endTime;
public int getReservationPerson() {
return reservationPerson;
}
@ -41,11 +46,11 @@ public class AppointmentPersonVO {
this.reservationPerson = reservationPerson;
}
public int getId() {
public Long getId() {
return id;
}
public void setId(int id) {
public void setId(Long id) {
this.id = id;
}
@ -144,4 +149,12 @@ public class AppointmentPersonVO {
public void setAppointmentDate(String appointmentDate) {
this.appointmentDate = appointmentDate;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}

@ -1,18 +1,40 @@
package com.cjy.back.ybsjAppointment.entity.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* @author liangjiawei
* @createDate 2023/7/27
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class GetAppointmentRecordVO {
//景区名字
private String scenicName;
//预约人名字
private String reservationPersonName;
//预约人手机号
private String reservationPersonPhone;
//预约日期
private String reservationDate;
//状态
private String state;
//分页参数
private String page;
//分页参数
private String limit;
//用户标识
private String unionId;
//景区id
private String scenicId;
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getScenicName() {
return scenicName;
}
@ -68,4 +90,12 @@ public class GetAppointmentRecordVO {
public void setLimit(String limit) {
this.limit = limit;
}
public String getScenicId() {
return scenicId;
}
public void setScenicId(String scenicId) {
this.scenicId = scenicId;
}
}

@ -1,5 +1,7 @@
package com.cjy.back.ybsjAppointment.entity.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import java.util.List;
@ -7,6 +9,7 @@ import java.util.List;
* @author liangjiawei
* @createDate 2023/7/26
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class ReservationNowVO {
//预约时间段id
private Long appointmentTimeInfoId;

@ -1,7 +1,14 @@
package com.cjy.back.ybsjAppointment.service;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO;
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO;
import com.cjy.util.ServerResponse;
import jxl.write.WriteException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author liangjiawei
@ -21,4 +28,50 @@ public interface YbsjyAppointmentRecordService {
* @return
*/
ServerResponse deleteAppointmentRecord(Long id,int userId);
/**
* 取消预约
* @param id
* @param userId
* @return
*/
ServerResponse cancelAppointment(Long id,int userId);
/**
* 小程序取消预约
* @param id
* @param unionId
* @return
*/
ServerResponse cancelAppointment(Long id,String unionId);
/**
* 获取预约单详情
* @param id
* @return
*/
ServerResponse appointmentDocumentsDetails(Long id);
/**
* 导出预约记录
* @param request
* @param response
* @param getAppointmentRecordVO
* @throws IOException
* @throws WriteException
*/
public void exportReserveRecord(HttpServletRequest request , HttpServletResponse response, GetAppointmentRecordVO getAppointmentRecordVO) throws IOException, WriteException;
/**
* 获取预约为核销的数据
* @return
*/
List<AppointmentPersonVO> getAppointmentNotWrittenOffRecord();
/**
* 修改预约单状态
* @param id
* @return
*/
int updateAppointmentRecordSate(Long id);
}

@ -1,6 +1,7 @@
package com.cjy.back.ybsjAppointment.service;
import com.cjy.back.ybsjAppointment.entity.YbsjyAppointmentSettingEntity;
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO;
import com.cjy.back.ybsjAppointment.entity.vo.ReservationNowVO;
import com.cjy.util.ServerResponse;
@ -85,4 +86,20 @@ public interface YbsjyAppointmentSettingService {
*/
ServerResponse reservationNow(ReservationNowVO reservationNowVO);
/**
* 小程序获取预约记录
* @param getAppointmentRecordVO
* @return
*/
ServerResponse appletsAppointmentRecord(GetAppointmentRecordVO getAppointmentRecordVO);
/**
* 小程序获取预约详情
* @param id
* @return
*/
ServerResponse appletsAppointmentDocumentsDetails(Long id);
}

@ -1,13 +1,31 @@
package com.cjy.back.ybsjAppointment.service.impl;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentRecordMapper;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentDocumentsDetails;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO;
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentRecordService;
import com.cjy.common.PageWrapper;
import com.cjy.util.ServerResponse;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -23,6 +41,7 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
/**
* 查询预约记录
*
* @param getAppointmentRecordVO
* @return
*/
@ -44,7 +63,7 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
//根据条件进行分页查询数据
List<Map<String, Object>> list = ybsjyAppointmentRecordMapper.getAppointmentRecordListByPage(pw.getPage(), getAppointmentRecordVO);
list.stream().forEach(item->{
list.stream().forEach(item -> {
});
// 查询总行数
@ -60,12 +79,206 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
/**
* 删除预约单
*
* @param id
* @return
*/
@Override
public ServerResponse deleteAppointmentRecord(Long id,int userId) {
ybsjyAppointmentRecordMapper.deleteAppointmentRecord(id,userId);
public ServerResponse deleteAppointmentRecord(Long id, int userId) {
ybsjyAppointmentRecordMapper.deleteAppointmentRecord(id, userId);
return ServerResponse.createBySuccess("删除成功");
}
/**
* 取消预约
*
* @param id
* @param userId
* @return
*/
@Override
public ServerResponse cancelAppointment(Long id, int userId) {
//第一步修改取消单状态
ybsjyAppointmentRecordMapper.updateCancelDocuments(id, userId+"");
//第二步修改预约单下人的状态
ybsjyAppointmentRecordMapper.updateAppointmentPeopleInfo(id, userId+"");
return ServerResponse.createBySuccess("取消成功");
}
/**
* 小程序取消预约
* @param id
* @param unionId
* @return
*/
@Override
public ServerResponse cancelAppointment(Long id, String unionId) {
//第一步修改取消单状态
ybsjyAppointmentRecordMapper.updateCancelDocuments(id, unionId);
//第二步修改预约单下人的状态
ybsjyAppointmentRecordMapper.updateAppointmentPeopleInfo(id, unionId);
return ServerResponse.createBySuccess("取消成功");
}
/**
* 获取预约单详情
*
* @param id
* @return
*/
@Override
public ServerResponse appointmentDocumentsDetails(Long id) {
//第一步通过预约单id获取 单号、景区、预约日期、预约时间段、预约人数、提交时间
AppointmentDocumentsDetails appointmentDocumentsDetails = ybsjyAppointmentRecordMapper.getAppointmentDocumentsInfo(id);
List<AppointmentPersonVO> list = ybsjyAppointmentRecordMapper.getAppointmentPersonInfo(id);
//获取人信息
appointmentDocumentsDetails.setList(list);
return ServerResponse.createBySuccess(appointmentDocumentsDetails);
}
@Override
public void exportReserveRecord(HttpServletRequest request, HttpServletResponse response, GetAppointmentRecordVO getAppointmentRecordVO) throws IOException, WriteException {
List<Map<String, Object>> list = ybsjyAppointmentRecordMapper.getExportReserveRecordList(getAppointmentRecordVO);
String filename = "预约记录.xls";
int pageSize = 30000;
int sheetCount = (int) Math.ceil((double) list.size() / pageSize);
HSSFWorkbook wb = new HSSFWorkbook();
for (int i = 0; i < sheetCount; i++) {
HSSFSheet sheet = wb.createSheet("预约记录" + i);
int startIndex = i * pageSize;
int endIndex = Math.min(startIndex + pageSize, list.size());
sheet.setDefaultRowHeightInPoints(18);
sheet.setDefaultColumnWidth(12);
sheet.setColumnWidth(10, (int) (128 *(40+0.72)));
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
//设置水平对齐
cellStyle.setAlignment(HorizontalAlignment.CENTER);
HSSFCellStyle cellStyleTable = wb.createCellStyle();
cellStyleTable.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
cellStyleTable.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cellStyleTable.setBorderBottom(BorderStyle.THIN);
cellStyleTable.setBottomBorderColor(IndexedColors.BLACK.getIndex());
cellStyleTable.setBorderLeft(BorderStyle.THIN);
cellStyleTable.setLeftBorderColor(IndexedColors.BLACK.getIndex());
cellStyleTable.setBorderRight(BorderStyle.THIN);
cellStyleTable.setRightBorderColor(IndexedColors.BLACK.getIndex());
cellStyleTable.setBorderTop(BorderStyle.THIN);
cellStyleTable.setTopBorderColor(IndexedColors.BLACK.getIndex());
//设置水平对齐
cellStyleTable.setAlignment(HorizontalAlignment.CENTER);
HSSFFont font = wb.createFont();
font.setColor(IndexedColors.BLACK.getIndex());
cellStyleTable.setFont(font);
HSSFRow row1 = sheet.createRow(0);
String[] headerinfo = new String[]{"预约单号", "景区名称", "预约日期", "预约时段", "预约人姓名", "预约人手机号", "证件类型", "证件号码", "预约码", "状态", "核销时间"};
for (int b = 0; b < headerinfo.length; b++) {
HSSFCell cell = row1.createCell(b);
cell.setCellValue(headerinfo[b]);
cell.setCellStyle(cellStyleTable);
}
int rownum = 1;
for (int j = startIndex; j < endIndex; j++) {
Map<String, Object> data = list.get(j);
HSSFRow row = sheet.createRow(rownum);
HSSFCell cell = row.createCell(0);
cell.setCellValue(data.get("appointmentNumber").toString());
cell.setCellStyle(cellStyle);
cell = row.createCell(1);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("scenicName").toString());
cell = row.createCell(2);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("appointmentDate").toString());
cell = row.createCell(3);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("appointmentSlot").toString());
cell = row.createCell(4);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("name").toString());
cell = row.createCell(5);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("phone").toString());
cell = row.createCell(6);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("documentsType").toString());
cell = row.createCell(7);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("documentsNumber").toString());
cell = row.createCell(8);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("reservationCode").toString());
String state="";
if(data.get("state").toString().equals("0")){
state="未核销";
}else if(data.get("state").toString().equals("1")){
state="已核销";
}else {
state="取消";
}
cell = row.createCell(9);
cell.setCellStyle(cellStyle);
cell.setCellValue(state);
cell = row.createCell(10);
cell.setCellStyle(cellStyle);
cell.setCellValue(data.get("writeOffDate").toString());
rownum++;
}
}
OutputStream output = response.getOutputStream();
String formatfilename = URLEncoder.encode(filename, "UTF-8");
response.reset();
// 设置文件下载头
response.setHeader("Content-Disposition", "attachment;filename=" + formatfilename);
// 设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("application/vnd.ms-excel");
wb.write(output);
output.close();
}
@Override
public List<AppointmentPersonVO> getAppointmentNotWrittenOffRecord() {
return ybsjyAppointmentRecordMapper.getAppointmentNotWrittenOffRecord();
}
/**
* 修改预约单状态
* @param id
* @return
*/
@Override
public int updateAppointmentRecordSate(Long id) {
return ybsjyAppointmentRecordMapper.updateAppointmentRecordSate(id);
}
}

@ -1,11 +1,10 @@
package com.cjy.back.ybsjAppointment.service.impl;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentRecordMapper;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentSettingMapper;
import com.cjy.back.ybsjAppointment.entity.AppointmentTimeInfoEntity;
import com.cjy.back.ybsjAppointment.entity.YbsjyAppointmentSettingEntity;
import com.cjy.back.ybsjAppointment.entity.vo.AppletsAppointmentListVO;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentFormVO;
import com.cjy.back.ybsjAppointment.entity.vo.ReservationNowVO;
import com.cjy.back.ybsjAppointment.entity.vo.*;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentSettingService;
import com.cjy.back.ybsjAppointment.utils.AppointmentNumberUtil;
import com.cjy.back.ybsjAppointment.utils.DateUtil;
@ -27,7 +26,8 @@ import java.util.Map;
public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSettingService {
@Autowired
YbsjyAppointmentSettingMapper ybsjyAppointmentSettingMapper;
@Autowired
YbsjyAppointmentRecordMapper ybsjyAppointmentRecordMapper;
/**
* 预约设置添加
@ -239,12 +239,17 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
}
//插入预约单
ybsjyAppointmentSettingMapper.saveAppointmentDocumentsInfo(appointmentFormVO);
//这里还需要判断一下预约人中是否有过预约的
if(ybsjyAppointmentSettingMapper.getReservationInformation(reservationNowVO.getAppointmentTimeInfoId(),reservationNowVO.getAppointmentPersonList(),reservationNowVO.getAppointmentDate()) >0){
return ServerResponse.createByError("预约失败,预约单中有人已预约。");
}
//插入预约人信息表
reservationNowVO.getAppointmentPersonList().stream().forEach(item ->{
item.setReservationCode(AppointmentNumberUtil.generateOrderNumber());
item.setAppointmentTimeInfoId(reservationNowVO.getAppointmentTimeInfoId());
item.setAppointmentDocumentsId(appointmentFormVO.getId());
item.setAppointmentDate(reservationNowVO.getAppointmentDate());
});
ybsjyAppointmentSettingMapper.saveAppointmentPeopleInfo(reservationNowVO.getAppointmentPersonList());
//设置权限
@ -255,4 +260,53 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
return ServerResponse.createBySuccess("预约成功");
}
@Override
public ServerResponse appletsAppointmentRecord(GetAppointmentRecordVO getAppointmentRecordVO) {
// 获取当前页码,在分页组件里 参数固定为currentPage
String cpage = getAppointmentRecordVO.getPage();
// 显示行数
int limit = Integer.valueOf(getAppointmentRecordVO.getLimit());
int pageNo = 1;
if (cpage != null && !("").equals(cpage)) {
pageNo = Integer.parseInt(cpage);
}
/* 分页信息开始 */
PageWrapper pw = new PageWrapper();
pw.getPage().setCurrentPage(pageNo);
pw.getPage().setPageSize(limit); // 每页条数
/* 分页信息结束 */
//根据条件进行分页查询数据
List<Map<String, Object>> list = ybsjyAppointmentRecordMapper.getappletsAppointmentRecordListByPage(pw.getPage(), getAppointmentRecordVO);
list.stream().forEach(item->{
});
// 查询总行数
int userCount = pw.getPage().getTotalCount();
//返回数据
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("count", userCount);
resultMap.put("data", list);
resultMap.put("msg", "查询成功");
resultMap.put("code", 0);
return ServerResponse.createBySuccess(resultMap);
}
/**
* 小程序获取预约详情
* @param id
* @return
*/
@Override
public ServerResponse appletsAppointmentDocumentsDetails(Long id) {
//第一步通过预约单id获取 单号、景区、预约日期、预约时间段、预约人数、提交时间
AppointmentDocumentsDetails appointmentDocumentsDetails=ybsjyAppointmentRecordMapper.getAppletsAppointmentDocumentsInfo(id);
List<AppointmentPersonVO> list = ybsjyAppointmentRecordMapper.getAppointmentPersonInfo(id);
//获取人信息
appointmentDocumentsDetails.setList(list);
return ServerResponse.createBySuccess(appointmentDocumentsDetails);
}
}

@ -0,0 +1,42 @@
package com.cjy.back.ybsjAppointment.task;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentRecordService;
import com.cjy.back.ybsjAppointment.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author liangjiawei
* @createDate 2023/7/28
*/
@Component("handleExpiredAppointmentsTask")
public class HandleExpiredAppointmentsTask {
@Autowired
YbsjyAppointmentRecordService ybsjyAppointmentRecordService;
/**
* 处理过期预约人信息
*
*/
public void handleExpiredAppointments() {
// 第一步先获取到 当天 未核销的数据
List<AppointmentPersonVO> list = ybsjyAppointmentRecordService.getAppointmentNotWrittenOffRecord();
list.stream().forEach(item -> {
//如果当前时间大于结束时间
if (DateUtil.isAfterEndTime(item.getEndTime())) {
//就将该数据修改取消 且是过期的
ybsjyAppointmentRecordService.updateAppointmentRecordSate(item.getId());
// List<AppointmentPersonVO> appointmentPersonVOList=ybsjyAppointmentRecordService.getAppointmentRecordByAppointmentDocumentsId(item.getAppointmentDocumentsId());
}
});
}
/**
* 处理过期预约单
*/
}

@ -47,9 +47,8 @@ public class DefaultView extends WebMvcConfigurerAdapter {
} else {
//linux 和mac
registry.addResourceHandler("/upload/**")
.addResourceLocations("file:///Users/liangjiawei/Downloads/upload/") //媒体资源
.addResourceLocations("file:///Users/liangjiawei/Download/upload/") //媒体资源
.addResourceLocations("file:///Users/liangjiawei/Download/upload/"); //媒体资源
.addResourceLocations("file:"+InitParam.filepath+"/upload/") ; //媒体资源
}
}

@ -111,13 +111,13 @@ secret=a369f9770e54abfecd386f4bba218937
wechat_timeout=604800000
#文件上传路径 例子:FILEPATH+"/2018/10/23/filename.jpg"
filepath= C:
filepath= /Users/liangjiawei/Downloads
#轮播图上传路径
image_filepath=/Users/liangjiawei/Downloads/upload/image
video_filepath=/Users/liangjiawei/Downloads/upload/video
app_filepath=/Users/liangjiawei/Downloads/upload/app
other_filepath=/Users/liangjiawei/Downloads/upload/other
codeUrl_filepath=/Users/liangjiawei/Downloads/upload/code
image_filepath=/upload/image
video_filepath= /upload/video
app_filepath= /upload/app
other_filepath= /upload/other
codeUrl_filepath= /upload/code
#资源映射路径为/image/**,使用url访问的请求路径

Loading…
Cancel
Save