补充票务服务缺少的接口
This commit is contained in:
parent
20e2e387b9
commit
3b80e3b72a
@ -26,20 +26,20 @@ public class CheckTicketApi {
|
||||
@Resource
|
||||
private LoginClient loginClient;
|
||||
|
||||
// @GetMapping()
|
||||
// @Operation(summary = "获得日期当天的检票人数")
|
||||
// public Long checkTicketTotal(String starTime, String endTime, String checkStationName) {
|
||||
// String replace = starTime.replace("-", "");
|
||||
// String replace1 = endTime.replace("-", "");
|
||||
// return checkTicketService.checkTicketTotal(replace,replace1, checkStationName);
|
||||
// }
|
||||
|
||||
@GetMapping()
|
||||
@Operation(summary = "获得日期当天某检查点的检票人数")
|
||||
public Long checkTicketTotal(String starTime, String endTime, String checkStationName) {
|
||||
@Operation(summary = "获得日期当天的检票人数")
|
||||
public Long checkTicketTotal(String starTime, String endTime) {
|
||||
String replace = starTime.replace("-", "");
|
||||
String replace1 = endTime.replace("-", "");
|
||||
return checkTicketService.checkTicketTotal(replace,replace1, checkStationName);
|
||||
return checkTicketService.checkTicketTotal(replace,replace1);
|
||||
}
|
||||
|
||||
@GetMapping("/selectTotalByCheckStationName")
|
||||
@Operation(summary = "获得日期当天某检查点的检票人数")
|
||||
public Long checkTicketTotalByCheckStationName(String starTime, String endTime, String checkStationName) {
|
||||
String replace = starTime.replace("-", "");
|
||||
String replace1 = endTime.replace("-", "");
|
||||
return checkTicketService.checkTicketTotalByCheckStationName(replace,replace1, checkStationName);
|
||||
}
|
||||
|
||||
@GetMapping("/qushi")
|
||||
|
@ -14,9 +14,10 @@ public interface CheckTicketRepository extends MongoRepository<CheckTicket,Strin
|
||||
@Query("{'name': {'$regex': '?0', '$options': 'i'}}")
|
||||
Page<CheckTicket> findByName(String q, PageRequest pageable);
|
||||
|
||||
@Query("{'checkticketdate':{'$gte': ?0, '$lt': ?1}}")
|
||||
List<CheckTicket> countByCheckticketdateBetween(String starTime, String endTime);
|
||||
@Query("{'checkticketdate':{'$gte': ?0, '$lt': ?1}, 'checkstationname': {'$regex': ?2, '$options': 'i'}}")
|
||||
List<CheckTicket> countByCheckticketdateBetween(String starTime, String endTime, String checkStationName);
|
||||
|
||||
List<CheckTicket> countByCheckStationNameAndCheckticketdateBetween(String starTime, String endTime, String checkStationName);
|
||||
@Query("{'checktickettime':{'$gte': ?0, '$lt': ?1},'checkticketdate':{'$dt': ?2}}")
|
||||
List<CheckTicket> findByTimestampBetweenAndCheckticketdate(String startTime, String endTime,String day);
|
||||
|
||||
|
@ -24,5 +24,6 @@ public interface CheckTicketService {
|
||||
* @param starTime 日期
|
||||
* @return long 检票人数
|
||||
*/
|
||||
public long checkTicketTotal(String starTime, String endTime, String checkStationName);
|
||||
public long checkTicketTotal(String starTime, String endTime);
|
||||
public long checkTicketTotalByCheckStationName(String starTime, String endTime, String checkStationName);
|
||||
}
|
@ -92,7 +92,7 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long checkTicketTotal(String starTime, String endTime, String checkStationName) {
|
||||
public long checkTicketTotal(String starTime, String endTime) {
|
||||
// 创建 DateTimeFormatter 实例以解析指定日期的格式
|
||||
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
// 解析指定日期字符串为 LocalDate 对象
|
||||
@ -102,7 +102,21 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
||||
// 格式化指定日期和下一天
|
||||
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
String formattedNextDay = nextDay.format(outputFormatter);
|
||||
return checkTicketRepository.countByCheckticketdateBetween(starTime,formattedNextDay, checkStationName).size();
|
||||
return checkTicketRepository.countByCheckticketdateBetween(starTime,formattedNextDay).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long checkTicketTotalByCheckStationName(String starTime, String endTime, String checkStationName) {
|
||||
// 创建 DateTimeFormatter 实例以解析指定日期的格式
|
||||
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
// 解析指定日期字符串为 LocalDate 对象
|
||||
LocalDate specifiedDate = LocalDate.parse(endTime, inputFormatter);
|
||||
// 获取指定日期的下一天
|
||||
LocalDate nextDay = specifiedDate.plusDays(1);
|
||||
// 格式化指定日期和下一天
|
||||
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
String formattedNextDay = nextDay.format(outputFormatter);
|
||||
return checkTicketRepository.countByCheckStationNameAndCheckticketdateBetween(starTime,formattedNextDay, checkStationName).size();
|
||||
}
|
||||
|
||||
public String publicMethod(String endTime){
|
||||
|
Loading…
Reference in New Issue
Block a user