chenfeng 7 months ago
parent 78564c096c
commit 2a1a6a64fe
  1. 3
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentSettingServiceImpl.java
  2. 20
      src/main/java/com/cjy/back/ybsjHandset/controller/YbsjHandsetController.java
  3. 31
      src/main/java/com/cjy/back/ybsjHandset/dao/YbsjHandsetMapper.java
  4. 76
      src/main/java/com/cjy/back/ybsjHandset/dao/YbsjHandsetMapper.xml
  5. 23
      src/main/java/com/cjy/back/ybsjHandset/service/Impl/YbsjHandsetServiceImpl.java
  6. 8
      src/main/java/com/cjy/back/ybsjHandset/service/YbsjHandsetService.java

@ -270,8 +270,9 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
map.put("timeList", list);
map.put("canReserveDayNumber", ybsjyAppointmentSettingMapper.getAppointmentSettingByScenicId(scenicId, bookingCategory));
if (list.size()>0){
map.put("visitTypesList", ybsjyAppointmentSettingMapper.getVisitTypes(list.get(0).getVisitTypes()));
}
return ServerResponse.createBySuccess(map);
}

@ -7,6 +7,10 @@ import com.cjy.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 手持机相关代码
@ -26,7 +30,7 @@ public class YbsjHandsetController {
* @return
*/
@RequestMapping("requestForWriteOff")
public ServerResponse requestForWriteOff(WriteOffVo writeOffVo){
public ServerResponse requestForWriteOff(WriteOffVo writeOffVo) {
return ybsjHandsetService.writeOff(writeOffVo);
}
@ -84,4 +88,18 @@ public class YbsjHandsetController {
public ServerResponse getAppointmentRecordDetails(@RequestParam("id") String id) {
return ybsjHandsetService.getAppointmentRecordDetails(id);
}
@RequestMapping("selectScjCount")
public ServerResponse selectScjCount(@RequestParam("dateType") Integer dateType) {
List<Map<String, Object>> list = ybsjHandsetService.selectScjCount(dateType);
Map<String, Object> param = new HashMap<>();
param.put("list",list);
int total = list.stream()
.filter(map -> map.containsKey("total_data"))
.mapToInt(map -> Integer.parseInt(map.get("total_data").toString()) )
.sum();
param.put("total",total);
return ServerResponse.createBySuccess(param);
}
}

@ -60,7 +60,7 @@ public interface YbsjHandsetMapper {
* @param id
* @return
*/
List<Map<String, Object>> getVisitorList(@Param("id") String id,@Param("appointmentDocumentsId") String appointmentDocumentsId);
List<Map<String, Object>> getVisitorList(@Param("id") String id, @Param("appointmentDocumentsId") String appointmentDocumentsId);
/**
* 查询当前个人预约单还有没有未核销的订单
@ -75,8 +75,8 @@ public interface YbsjHandsetMapper {
*
* @return
*/
Map<String, Object> getAppointmentPeopleInfo(@Param("reservationCode") String reservationCode,@Param("qrContent") String qrContent
,@Param("documentsNumber") String documentsNumber);
Map<String, Object> getAppointmentPeopleInfo(@Param("reservationCode") String reservationCode, @Param("qrContent") String qrContent
, @Param("documentsNumber") String documentsNumber);
/**
* 手持机-通过预约人员信息表id修改状态
@ -84,7 +84,7 @@ public interface YbsjHandsetMapper {
* @param id
* @return
*/
int updatePeopleInfoId(@Param("id") String id, @Param("writeOff") String writeOff,@Param("ticketChecker") String ticketChecker);
int updatePeopleInfoId(@Param("id") String id, @Param("writeOff") String writeOff, @Param("ticketChecker") String ticketChecker);
/**
* 手持机-通过预约单信息表appointmentDocumentsId修改状态
@ -92,7 +92,7 @@ public interface YbsjHandsetMapper {
* @param appointmentDocumentsId
* @return
*/
int updateAppointmentDocumentsId(@Param("appointmentDocumentsId") String appointmentDocumentsId, @Param("writeOff") String writeOff,@Param("ticketChecker") String ticketChecker);
int updateAppointmentDocumentsId(@Param("appointmentDocumentsId") String appointmentDocumentsId, @Param("writeOff") String writeOff, @Param("ticketChecker") String ticketChecker);
/**
* 手持机-通过预约单信息表appointmentDocumentsId修改预约单表状态
@ -100,7 +100,7 @@ public interface YbsjHandsetMapper {
* @param appointmentDocumentsId
* @return
*/
int updateAppointmentDocumentsInfo(@Param("appointmentDocumentsId") String appointmentDocumentsId, @Param("writeOff") String writeOff,@Param("ticketChecker") String ticketChecker);
int updateAppointmentDocumentsInfo(@Param("appointmentDocumentsId") String appointmentDocumentsId, @Param("writeOff") String writeOff, @Param("ticketChecker") String ticketChecker);
/**
* 查询景区基本信息
@ -112,9 +112,26 @@ public interface YbsjHandsetMapper {
/**
* 查询团队预约和研学预约
*
* @param appointmentDocumentsId
* @return
*/
List<Map<String,Object>>getPeopleInfo(Integer appointmentDocumentsId);
List<Map<String, Object>> getPeopleInfo(Integer appointmentDocumentsId);
/**
* 手持机-查询统计
*
* @param dateType
* @return
*/
List<Map<String, Object>> selectScjCount(Integer dateType);
/**
* 手持机-查询统计-研学
*
* @param dateType
* @return
*/
List<Map<String, Object>> selectScjCountTwo(Integer dateType);
}

@ -225,4 +225,80 @@
where appointment_documents_id =#{appointmentDocumentsId}
and write_off = 1
</select>
<select id="selectScjCount" resultType="map">
SELECT
generated_date,
IFNULL(sum(appointment_count), 0) AS total_data
FROM
(
SELECT
CASE
WHEN #{dateType} = 1 THEN
CURDATE() + INTERVAL seq DAY
WHEN #{dateType} = 2 THEN
CURDATE() - INTERVAL seq DAY
END AS generated_date
FROM
(
SELECT 1 AS seq UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5 UNION ALL
SELECT 6 UNION ALL
SELECT 7
) AS seq_table
) AS date_generation
LEFT JOIN ybsj_appointment_documents_info ON date_generation.generated_date = ybsj_appointment_documents_info.appointment_date
AND ybsj_appointment_documents_info.appointment_documents_write_off =
CASE
WHEN #{dateType} = 1 THEN 0
ELSE 1
END
AND ybsj_appointment_documents_info.appointment_type_id != 5701
GROUP BY
generated_date
ORDER BY
generated_date
</select>
<select id="selectScjCountTwo" resultType="map">
SELECT
generated_date,
IFNULL(SUM(CASE
WHEN ybsj_appointment_documents_info.appointment_type_id = 5701
THEN 1 ELSE 0
END), 0) AS total_data
FROM
(
SELECT
CASE
WHEN #{dateType} = 1 THEN CURDATE() + INTERVAL seq DAY
WHEN #{dateType} = 2 THEN CURDATE() - INTERVAL seq DAY
END AS generated_date
FROM
(
SELECT 1 AS seq UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5 UNION ALL
SELECT 6 UNION ALL
SELECT 7
) AS seq_table
) AS date_generation
LEFT JOIN ybsj_appointment_people_info
ON date_generation.generated_date = ybsj_appointment_people_info.appointment_date
AND ybsj_appointment_people_info.write_off = CASE WHEN #{dateType} = 1 THEN 0 ELSE 1 END
LEFT JOIN ybsj_appointment_documents_info
ON ybsj_appointment_people_info.appointment_documents_id = ybsj_appointment_documents_info.id
AND ybsj_appointment_documents_info.appointment_type_id = 5701
GROUP BY
generated_date
ORDER BY
generated_date
</select>
</mapper>

@ -35,6 +35,8 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
public class YbsjHandsetServiceImpl implements YbsjHandsetService {
@ -403,6 +405,27 @@ public class YbsjHandsetServiceImpl implements YbsjHandsetService {
return ServerResponse.createBySuccess(param);
}
@Override
public List<Map<String, Object>> selectScjCount(Integer dateType) {
List<Map<String, Object>> selectScjCount =ybsjHandsetMapper.selectScjCount(dateType);
List<Map<String, Object>> selectScjCountTwo = ybsjHandsetMapper.selectScjCountTwo(dateType);
List<Map<String, Object>> mergedList = Stream.concat(selectScjCount.stream(), selectScjCountTwo.stream())
.collect(Collectors.groupingBy(
map -> String.valueOf(map.get("generated_date")) ,
Collectors.summingInt(map -> Integer.parseInt(map.get("total_data").toString()) )
))
.entrySet()
.stream()
.map(entry -> {
Map<String, Object> newMap = new HashMap<>();
newMap.put("generated_date", entry.getKey());
newMap.put("total_data", entry.getValue());
return newMap;
})
.collect(Collectors.toList());
return mergedList;
}
// 18位身份证正则
private static final Pattern ID_PATTERN = Pattern.compile("^[1-9]\\d{5}(18|19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}[0-9Xx]$");

@ -4,6 +4,7 @@ import com.cjy.back.ybsjHandset.controller.vo.HandsetVo;
import com.cjy.back.ybsjHandset.controller.vo.WriteOffVo;
import com.cjy.util.ServerResponse;
import java.util.List;
import java.util.Map;
public interface YbsjHandsetService {
@ -57,4 +58,11 @@ public interface YbsjHandsetService {
* @return
*/
ServerResponse getAppointmentRecordDetails(String id);
/**
* 手持机-查询统计
* @param dateType
* @return
*/
List<Map<String, Object>> selectScjCount(Integer dateType);
}

Loading…
Cancel
Save