1.分时预约统计接口

dev
862857010@qq.com 2 years ago
parent b7600b8630
commit ad2a0873f7
  1. 1
      cjy-project/src/main/java/com/cjy/reservation/mapper/AppointmentStatisticsTaskMapper.java
  2. 1
      cjy-project/src/main/java/com/cjy/reservation/service/AppointmentStatisticsTaskService.java
  3. 6
      cjy-project/src/main/java/com/cjy/reservation/service/impl/AppointmentStatisticsTaskServiceImpl.java
  4. 110
      cjy-project/src/main/java/com/cjy/reservation/task/AppointmentStatisticsTask.java
  5. 17
      cjy-project/src/main/resources/mapper/reservationAge/AppointmentStatisticsTaskMapper.xml

@ -48,6 +48,7 @@ public interface AppointmentStatisticsTaskMapper {
* @return
*/
List<Map<String, Object>> getResourceCodeList();
List<Map<String, Object>> getResourceCodeListTeam();
/**

@ -47,6 +47,7 @@ public interface AppointmentStatisticsTaskService {
* @return
*/
List<Map<String, Object>> getResourceCodeList();
List<Map<String, Object>> getResourceCodeListTeam();
/**

@ -71,6 +71,12 @@ public class AppointmentStatisticsTaskServiceImpl implements AppointmentStatisti
return appointmentStatisticsTaskMapper.getResourceCodeList();
}
@Override
public List<Map<String, Object>> getResourceCodeListTeam() {
return appointmentStatisticsTaskMapper.getResourceCodeListTeam();
}
/**
* 通过景区编码获取当天已核销的数量
* @param resourceCode

@ -45,42 +45,108 @@ public class AppointmentStatisticsTask {
//15分钟 实时
public void getAppointmentLiveData() {
//获取到今天的预约记录 然后统计数据 预约数量和入园数量
List<Map<String, Object>> list = appointmentStatisticsTaskService.getAppointmentNumberAndAdmissionNumber();
//
list.stream().forEach(item -> {
if (item.get("resourceCode") != null && !item.get("resourceCode").toString().isEmpty()) {
List<Map<String, Object>> resourceCodelist = appointmentStatisticsTaskService.getResourceCodeListTeam();
resourceCodelist.stream().forEach(i -> {
//团队数据
Long groupAppointmentCount = reservationRealtimeService.getGroupAppointmentCount(i.get("resourceCode").toString());
List<Map<String, Object>> list = appointmentStatisticsTaskService.getAppointmentNumberAndAdmissionNumber();
//如果团队和个人数据都不是0
if (groupAppointmentCount != 0 && !list.isEmpty()) {
list.stream().forEach(item -> {
if (item.get("resourceCode") != null && !item.get("resourceCode").toString().isEmpty()) {
ReservationRealtime reservationRealtime = new ReservationRealtime();
reservationRealtime.setResourceCode(Long.parseLong(item.get("resourceCode").toString()));
reservationRealtime.setOrganCode(Long.parseLong(item.get("organCode").toString()));
reservationRealtime.setCreateBy(1 + "");
reservationRealtime.setCreateTime(DateUtils.getNowDate());
reservationRealtime.setUpdateBy(1 + "");
reservationRealtime.setUpdateTime(DateUtils.getNowDate());
reservationRealtime.setDelFlag("0");
reservationRealtime.setDataSources("2");
reservationRealtime.setPrebookNum(Long.parseLong(item.get("appointmentNumber").toString()) + groupAppointmentCount);
reservationRealtime.setInNum(Integer.parseInt(item.get("admissionNumber").toString()) + groupAppointmentCount.intValue());
reservationRealtime.setIntoNum(Integer.parseInt(item.get("admissionNumber").toString()) + groupAppointmentCount.intValue());
//先删除
reservationRealtimeService.deleteReservationRealtimeByResourceCode(item.get("resourceCode").toString());
//在插入
reservationRealtimeService.insertReservationRealtime(reservationRealtime);
}
});
} else if (groupAppointmentCount == 0 && !list.isEmpty()) {
list.stream().forEach(item -> {
if (item.get("resourceCode") != null && !item.get("resourceCode").toString().isEmpty()) {
ReservationRealtime reservationRealtime = new ReservationRealtime();
reservationRealtime.setResourceCode(Long.parseLong(item.get("resourceCode").toString()));
reservationRealtime.setOrganCode(Long.parseLong(item.get("organCode").toString()));
reservationRealtime.setCreateBy(1 + "");
reservationRealtime.setCreateTime(DateUtils.getNowDate());
reservationRealtime.setUpdateBy(1 + "");
reservationRealtime.setUpdateTime(DateUtils.getNowDate());
reservationRealtime.setDelFlag("0");
reservationRealtime.setDataSources("2");
reservationRealtime.setPrebookNum(Long.parseLong(item.get("appointmentNumber").toString()));
reservationRealtime.setInNum(Integer.parseInt(item.get("admissionNumber").toString()));
reservationRealtime.setIntoNum(Integer.parseInt(item.get("admissionNumber").toString()));
//先删除
reservationRealtimeService.deleteReservationRealtimeByResourceCode(item.get("resourceCode").toString());
//在插入
reservationRealtimeService.insertReservationRealtime(reservationRealtime);
}
});
} else if (list.isEmpty() && groupAppointmentCount != 0 ) {
ReservationRealtime reservationRealtime = new ReservationRealtime();
reservationRealtime.setResourceCode(Long.parseLong(i.get("resourceCode").toString()));
reservationRealtime.setOrganCode(Long.parseLong(i.get("organCode").toString()));
reservationRealtime.setCreateBy(1 + "");
reservationRealtime.setCreateTime(DateUtils.getNowDate());
reservationRealtime.setUpdateBy(1 + "");
reservationRealtime.setUpdateTime(DateUtils.getNowDate());
reservationRealtime.setDelFlag("0");
reservationRealtime.setDataSources("2");
reservationRealtime.setPrebookNum(groupAppointmentCount);
reservationRealtime.setInNum(groupAppointmentCount.intValue());
reservationRealtime.setIntoNum(groupAppointmentCount.intValue());
//先删除
reservationRealtimeService.deleteReservationRealtimeByResourceCode(i.get("resourceCode").toString());
//在插入
reservationRealtimeService.insertReservationRealtime(reservationRealtime);
}else if(groupAppointmentCount == 0 && list.isEmpty()) {
ReservationRealtime reservationRealtime = new ReservationRealtime();
reservationRealtime.setResourceCode(Long.parseLong(item.get("resourceCode").toString()));
reservationRealtime.setOrganCode(Long.parseLong(item.get("organCode").toString()));
reservationRealtime.setResourceCode(Long.parseLong(i.get("resourceCode").toString()));
reservationRealtime.setOrganCode(Long.parseLong(i.get("organCode").toString()));
reservationRealtime.setCreateBy(1 + "");
reservationRealtime.setCreateTime(DateUtils.getNowDate());
reservationRealtime.setUpdateBy(1 + "");
reservationRealtime.setUpdateTime(DateUtils.getNowDate());
reservationRealtime.setDelFlag("0");
reservationRealtime.setDataSources("2");
//获取预约日期是今天的团队预约数量
Long groupAppointmentCount=reservationRealtimeService.getGroupAppointmentCount(item.get("resourceCode").toString());
reservationRealtime.setPrebookNum(Long.parseLong(item.get("appointmentNumber").toString())+groupAppointmentCount);
reservationRealtime.setInNum(Integer.parseInt(item.get("admissionNumber").toString())+groupAppointmentCount.intValue());
reservationRealtime.setIntoNum(Integer.parseInt(item.get("admissionNumber").toString())+groupAppointmentCount.intValue());
reservationRealtime.setPrebookNum(0L);
reservationRealtime.setInNum(0);
reservationRealtime.setIntoNum(0);
//先删除
reservationRealtimeService.deleteReservationRealtimeByResourceCode(item.get("resourceCode").toString());
reservationRealtimeService.deleteReservationRealtimeByResourceCode(i.get("resourceCode").toString());
//在插入
reservationRealtimeService.insertReservationRealtime(reservationRealtime);
}
});
}
//每小时的小时 第五分钟执行 上上小时到上小时的数据
public void getHourAppointmentLiveData() {
List<Map<String, Object>> list = appointmentStatisticsTaskService.getResourceCodeList();
list.stream().forEach(item ->{
if(null !=item.get("resourceCode")){
list.stream().forEach(item -> {
if (null != item.get("resourceCode")) {
// 查询预约量
String startTime = DateUtils.getNHoursAgo(1);
String endTime = DateUtils.getNHoursAgo(0);
int appointmentNum = appointmentStatisticsTaskService.selectAppointmentsNumber(item.get("resourceCode")+"",startTime,endTime);
int appointmentNum = appointmentStatisticsTaskService.selectAppointmentsNumber(item.get("resourceCode") + "", startTime, endTime);
// 查询核销量
int writeOffCount = appointmentStatisticsTaskService.getWriteOffPreviousHourDate(item.get("resourceCode").toString(), startTime, endTime);
ReservationHour reservationHour = new ReservationHour();
@ -92,10 +158,10 @@ public class AppointmentStatisticsTask {
reservationHour.setUpdateTime(DateUtils.getNowDate());
reservationHour.setDelFlag("0");
reservationHour.setDataSources("2");
Long groupAppointmentCount=reservationRealtimeService.getGroupAppointmentCount(item.get("resourceCode").toString());
reservationHour.setPrebookNum(appointmentNum+groupAppointmentCount.intValue());
reservationHour.setInNum(writeOffCount+groupAppointmentCount.intValue());
reservationHour.setIntoNum(writeOffCount+groupAppointmentCount.intValue());
Long groupAppointmentCount = reservationRealtimeService.getGroupAppointmentCount(item.get("resourceCode").toString());
reservationHour.setPrebookNum(appointmentNum + groupAppointmentCount.intValue());
reservationHour.setInNum(writeOffCount + groupAppointmentCount.intValue());
reservationHour.setIntoNum(writeOffCount + groupAppointmentCount.intValue());
reservationHour.setHour(Integer.parseInt(endTime.split(":")[0]));
//在插入
reservationHourService.insertReservationHour(reservationHour);
@ -136,10 +202,10 @@ public class AppointmentStatisticsTask {
if (item.get("resourceCode") != null && !item.get("resourceCode").toString().isEmpty()) {
List<String> dataList = appointmentStatisticsTaskService.getAppointmentLiveDataList(item.get("resourceCode").toString());
//获取团队预约的身份证号
List<String> teamDataList=appointmentStatisticsTaskService.getReamAppointmentLiveDataList(item.get("resourceCode").toString());
List<String> teamDataList = appointmentStatisticsTaskService.getReamAppointmentLiveDataList(item.get("resourceCode").toString());
dataList.addAll(teamDataList);
//然后添加到dataList中
if(dataList.isEmpty()){
if (dataList.isEmpty()) {
return;
}
//女 数量

@ -62,6 +62,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.organ_code,
t2.id
</select>
<select id="getResourceCodeListTeam" resultType="java.util.Map">
SELECT
IFNULL(t2.resource_code,"") AS resourceCode,
t1.organ_code AS organCode,
ifnull(t2.id,'') as resourceId
FROM
appointment_team_data t1
LEFT JOIN b_tour_info t2 on t1.scenic_code = t2.resource_code
where t1.del_flag!=2
GROUP BY
t2.resource_code,
t1.organ_code,
t2.id
</select>
<select id="getWriteOffDate" resultType="java.lang.Integer">
SELECT
count(*)
@ -135,7 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
appointment_team_data t1
LEFT JOIN appointment_people_info t2 on t1.id =t2.appointment_form
and t2.del_flag !=2
WHERE t1.scenic_code=#{resourceCode} and t1.del_flag !=2 and t1.appointment_date=DATE_FORMAT( NOW(), '%Y-%m-%d' )
WHERE t1.scenic_code=#{resourceCode} and t1.del_flag !=2 and t1.appointment_date=DATE_FORMAT( NOW(), '%Y-%m-%d' ) and t2.certificate_type='5501'
</select>
</mapper>
Loading…
Cancel
Save