获得去年日期往前推十天的数据接口优化
This commit is contained in:
parent
3a0ac36aab
commit
5a85f52f32
@ -11,6 +11,8 @@ import javax.annotation.Resource;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@ -40,7 +42,14 @@ public class SaleDataApi {
|
|||||||
@GetMapping("/lastyear/{startTime}")
|
@GetMapping("/lastyear/{startTime}")
|
||||||
@Operation(summary = "获得去年日期往前推十天的数据")
|
@Operation(summary = "获得去年日期往前推十天的数据")
|
||||||
public List<Map<String, String>> lastyearNum(@PathVariable("startTime") String startTime) {
|
public List<Map<String, String>> lastyearNum(@PathVariable("startTime") String startTime) {
|
||||||
return saleDataService.findCheckticketcountBytime(startTime);
|
String resultStr = startTime.replaceAll("-", "");
|
||||||
|
// 正则表达式匹配 yyyyMMdd 格式
|
||||||
|
Pattern pattern = Pattern.compile("^\\d{8}$");
|
||||||
|
Matcher matcher = pattern.matcher(resultStr);
|
||||||
|
if (matcher.matches()){
|
||||||
|
return saleDataService.findCheckticketcountBytime(resultStr);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/gender")
|
@GetMapping("/gender")
|
||||||
|
Loading…
Reference in New Issue
Block a user