parent
86de41d335
commit
0522ba8482
@ -0,0 +1,55 @@ |
||||
package com.cjy.back.ybsjAppointment.controller; |
||||
|
||||
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 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; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/7/27 |
||||
*/ |
||||
@RequestMapping("appointmentRecord") |
||||
@RestController |
||||
public class YbsjyAppointmentRecordController { |
||||
@Autowired |
||||
YbsjyAppointmentRecordService ybsjyAppointmentRecordService; |
||||
|
||||
/** |
||||
* 查询预约记录 |
||||
* @param request |
||||
* @param getAppointmentRecordVO |
||||
* @return |
||||
*/ |
||||
@RequestMapping("getAppointmentRecord") |
||||
public ServerResponse getAppointmentRecord(HttpServletRequest request,@RequestBody GetAppointmentRecordVO getAppointmentRecordVO){ |
||||
SysUser user = (SysUser) request.getSession().getAttribute("admin"); |
||||
if (user == null) { |
||||
return ServerResponse.createByError("请重新登陆"); |
||||
} |
||||
|
||||
return ybsjyAppointmentRecordService.getAppointmentRecord(getAppointmentRecordVO); |
||||
} |
||||
|
||||
/** |
||||
* 删除预约单 |
||||
* @param request |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@RequestMapping("deleteAppointmentRecord") |
||||
public ServerResponse deleteAppointmentRecord(HttpServletRequest request,Long id){ |
||||
SysUser user = (SysUser) request.getSession().getAttribute("admin"); |
||||
if (user == null) { |
||||
return ServerResponse.createByError("请重新登陆"); |
||||
} |
||||
|
||||
return ybsjyAppointmentRecordService.deleteAppointmentRecord(id,user.getUserid()); |
||||
} |
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
package com.cjy.back.ybsjAppointment.dao; |
||||
|
||||
import com.cjy.back.ybsjAppointment.entity.YbsjyAppointmentSettingEntity; |
||||
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO; |
||||
import com.cjy.common.mybatis.page.PageParameter; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/7/27 |
||||
*/ |
||||
public interface YbsjyAppointmentRecordMapper { |
||||
/** |
||||
* 查询预约记录 |
||||
* @param page |
||||
* @param getAppointmentRecordVO |
||||
* @return |
||||
*/ |
||||
List<Map<String, Object>> getAppointmentRecordListByPage(@Param("page") PageParameter page, @Param("getAppointmentRecordVO") GetAppointmentRecordVO getAppointmentRecordVO); |
||||
|
||||
/** |
||||
* 删除预约单 |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
int deleteAppointmentRecord(@Param("id") Long id,@Param("userId") int userId); |
||||
} |
||||
@ -0,0 +1,49 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<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} |
||||
</update> |
||||
|
||||
<select id="getAppointmentRecordListByPage" resultType="java.util.Map"> |
||||
SELECT |
||||
t1.id, |
||||
t1.appointment_number, |
||||
t2.sname, |
||||
t1.appointment_count, |
||||
t1.appointment_date, |
||||
CONCAT( t3.start_time, '~', t3.end_time ) as periodTime, |
||||
t4.name, |
||||
t4.phone |
||||
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> |
||||
GROUP BY t1.id |
||||
ORDER BY t1.create_time desc |
||||
</select> |
||||
</mapper> |
||||
@ -0,0 +1,89 @@ |
||||
package com.cjy.back.ybsjAppointment.entity.vo; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/7/27 |
||||
*/ |
||||
public class AppointmentFormVO { |
||||
private Long id; |
||||
private String appointmentNumber; |
||||
private int appointmentCount; |
||||
private String appointmentDate; |
||||
private Long appointmentTimeInfoId; |
||||
private String unionId; |
||||
private String createBy; |
||||
private String scenicId; |
||||
private String appointmentDocumentsWriteOff; |
||||
|
||||
public String getAppointmentDocumentsWriteOff() { |
||||
return appointmentDocumentsWriteOff; |
||||
} |
||||
|
||||
public void setAppointmentDocumentsWriteOff(String appointmentDocumentsWriteOff) { |
||||
this.appointmentDocumentsWriteOff = appointmentDocumentsWriteOff; |
||||
} |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getAppointmentNumber() { |
||||
return appointmentNumber; |
||||
} |
||||
|
||||
public void setAppointmentNumber(String appointmentNumber) { |
||||
this.appointmentNumber = appointmentNumber; |
||||
} |
||||
|
||||
public int getAppointmentCount() { |
||||
return appointmentCount; |
||||
} |
||||
|
||||
public void setAppointmentCount(int appointmentCount) { |
||||
this.appointmentCount = appointmentCount; |
||||
} |
||||
|
||||
public String getAppointmentDate() { |
||||
return appointmentDate; |
||||
} |
||||
|
||||
public void setAppointmentDate(String appointmentDate) { |
||||
this.appointmentDate = appointmentDate; |
||||
} |
||||
|
||||
public Long getAppointmentTimeInfoId() { |
||||
return appointmentTimeInfoId; |
||||
} |
||||
|
||||
public void setAppointmentTimeInfoId(Long appointmentTimeInfoId) { |
||||
this.appointmentTimeInfoId = appointmentTimeInfoId; |
||||
} |
||||
|
||||
public String getUnionId() { |
||||
return unionId; |
||||
} |
||||
|
||||
public void setUnionId(String unionId) { |
||||
this.unionId = unionId; |
||||
} |
||||
|
||||
public String getCreateBy() { |
||||
return createBy; |
||||
} |
||||
|
||||
public void setCreateBy(String createBy) { |
||||
this.createBy = createBy; |
||||
} |
||||
|
||||
public String getScenicId() { |
||||
return scenicId; |
||||
} |
||||
|
||||
public void setScenicId(String scenicId) { |
||||
this.scenicId = scenicId; |
||||
} |
||||
} |
||||
@ -0,0 +1,71 @@ |
||||
package com.cjy.back.ybsjAppointment.entity.vo; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/7/27 |
||||
*/ |
||||
public class GetAppointmentRecordVO { |
||||
private String scenicName; |
||||
private String reservationPersonName; |
||||
private String reservationPersonPhone; |
||||
private String reservationDate; |
||||
private String state; |
||||
private String page; |
||||
private String limit; |
||||
|
||||
public String getScenicName() { |
||||
return scenicName; |
||||
} |
||||
|
||||
public void setScenicName(String scenicName) { |
||||
this.scenicName = scenicName; |
||||
} |
||||
|
||||
public String getReservationPersonName() { |
||||
return reservationPersonName; |
||||
} |
||||
|
||||
public void setReservationPersonName(String reservationPersonName) { |
||||
this.reservationPersonName = reservationPersonName; |
||||
} |
||||
|
||||
public String getReservationPersonPhone() { |
||||
return reservationPersonPhone; |
||||
} |
||||
|
||||
public void setReservationPersonPhone(String reservationPersonPhone) { |
||||
this.reservationPersonPhone = reservationPersonPhone; |
||||
} |
||||
|
||||
public String getReservationDate() { |
||||
return reservationDate; |
||||
} |
||||
|
||||
public void setReservationDate(String reservationDate) { |
||||
this.reservationDate = reservationDate; |
||||
} |
||||
|
||||
public String getState() { |
||||
return state; |
||||
} |
||||
|
||||
public void setState(String state) { |
||||
this.state = state; |
||||
} |
||||
|
||||
public String getPage() { |
||||
return page; |
||||
} |
||||
|
||||
public void setPage(String page) { |
||||
this.page = page; |
||||
} |
||||
|
||||
public String getLimit() { |
||||
return limit; |
||||
} |
||||
|
||||
public void setLimit(String limit) { |
||||
this.limit = limit; |
||||
} |
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
package com.cjy.back.ybsjAppointment.service; |
||||
|
||||
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO; |
||||
import com.cjy.util.ServerResponse; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/7/27 |
||||
*/ |
||||
public interface YbsjyAppointmentRecordService { |
||||
/** |
||||
* 查询预约记录 |
||||
* @param getAppointmentRecordVO |
||||
* @return |
||||
*/ |
||||
ServerResponse getAppointmentRecord(GetAppointmentRecordVO getAppointmentRecordVO); |
||||
|
||||
/** |
||||
* 删除预约单 |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
ServerResponse deleteAppointmentRecord(Long id,int userId); |
||||
} |
||||
@ -0,0 +1,71 @@ |
||||
package com.cjy.back.ybsjAppointment.service.impl; |
||||
|
||||
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentRecordMapper; |
||||
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 org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/7/27 |
||||
*/ |
||||
@Service |
||||
public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService { |
||||
@Autowired |
||||
YbsjyAppointmentRecordMapper ybsjyAppointmentRecordMapper; |
||||
|
||||
/** |
||||
* 查询预约记录 |
||||
* @param getAppointmentRecordVO |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public ServerResponse getAppointmentRecord(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.getAppointmentRecordListByPage(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 deleteAppointmentRecord(Long id,int userId) { |
||||
ybsjyAppointmentRecordMapper.deleteAppointmentRecord(id,userId); |
||||
return ServerResponse.createBySuccess("删除成功"); |
||||
} |
||||
} |
||||
@ -0,0 +1,35 @@ |
||||
package com.cjy.back.ybsjAppointment.utils; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.util.Random; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/7/27 |
||||
*/ |
||||
public class AppointmentNumberUtil { |
||||
public static String generateOrderNumber() { |
||||
// 获取当前时间
|
||||
LocalDateTime currentTime = LocalDateTime.now(); |
||||
|
||||
// 定义日期时间格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
||||
|
||||
// 格式化当前时间为字符串
|
||||
String timestamp = currentTime.format(formatter); |
||||
|
||||
// 生成随机数
|
||||
Random random = new Random(); |
||||
String randomDigits = String.format("%04d", random.nextInt(10000)); |
||||
|
||||
// 拼接单号
|
||||
String orderNumber = timestamp + randomDigits; |
||||
|
||||
return orderNumber; |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
System.out.println(AppointmentNumberUtil.generateOrderNumber()); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue