|
|
@ -59,7 +59,7 @@ public class StatisticsController {
|
|
|
|
@Data
|
|
|
|
@Data
|
|
|
|
static class SSParam {
|
|
|
|
static class SSParam {
|
|
|
|
@Schema(title = "时间条件", description = "1今日;2本周;3本月;4全年")
|
|
|
|
@Schema(title = "时间条件", description = "1今日;2本周;3本月;4全年")
|
|
|
|
private Integer dateCondition;
|
|
|
|
private int dateCondition;
|
|
|
|
@Schema(title = "开始时间(yyyy-MM-dd HH:mm:ss)", description = "如果传入dateCondition以月份区间为条件")
|
|
|
|
@Schema(title = "开始时间(yyyy-MM-dd HH:mm:ss)", description = "如果传入dateCondition以月份区间为条件")
|
|
|
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
|
private LocalDateTime beginTime;
|
|
|
|
private LocalDateTime beginTime;
|
|
|
@ -72,14 +72,15 @@ public class StatisticsController {
|
|
|
|
@PostMapping("/data2")
|
|
|
|
@PostMapping("/data2")
|
|
|
|
@AdminTokenValid
|
|
|
|
@AdminTokenValid
|
|
|
|
public Result data2(@Validated @RequestBody SSParam param) {
|
|
|
|
public Result data2(@Validated @RequestBody SSParam param) {
|
|
|
|
|
|
|
|
Integer condition = param.getDateCondition();
|
|
|
|
|
|
|
|
System.out.println(condition);
|
|
|
|
QueryWrapper<Video> qw = new QueryWrapper<>();
|
|
|
|
QueryWrapper<Video> qw = new QueryWrapper<>();
|
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
DateTimeFormatter df2 = DateTimeFormatter.ofPattern("yyyy-MM");
|
|
|
|
DateTimeFormatter df2 = DateTimeFormatter.ofPattern("yyyy-MM");
|
|
|
|
LocalDate now = LocalDateTime.now().toLocalDate();
|
|
|
|
LocalDate now = LocalDateTime.now().toLocalDate();
|
|
|
|
LocalDate before =now.with(TemporalAdjusters.firstDayOfMonth());
|
|
|
|
LocalDate before =now.with(TemporalAdjusters.firstDayOfMonth());
|
|
|
|
if (null != param.getDateCondition()) {
|
|
|
|
if (null != condition) {
|
|
|
|
switch (param.getDateCondition()) {
|
|
|
|
switch (condition) {
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
before = now;
|
|
|
|
before = now;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -99,7 +100,7 @@ public class StatisticsController {
|
|
|
|
now = param.getEndTime() != null ? param.getEndTime().toLocalDate() : now;
|
|
|
|
now = param.getEndTime() != null ? param.getEndTime().toLocalDate() : now;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ArrayList<JSONObject> res = new ArrayList<>();
|
|
|
|
ArrayList<JSONObject> res = new ArrayList<>();
|
|
|
|
if(param.getDateCondition() == 4){
|
|
|
|
if(condition == 4){
|
|
|
|
qw.between("date_format(creatAt, '%Y-%m')", before.format(df2), now.plusMonths(1).format(df2));
|
|
|
|
qw.between("date_format(creatAt, '%Y-%m')", before.format(df2), now.plusMonths(1).format(df2));
|
|
|
|
List<JSONObject> videoDataBydDay =adminMapper.statistics3(qw);
|
|
|
|
List<JSONObject> videoDataBydDay =adminMapper.statistics3(qw);
|
|
|
|
if (videoDataBydDay == null || videoDataBydDay.size() == 0) {
|
|
|
|
if (videoDataBydDay == null || videoDataBydDay.size() == 0) {
|
|
|
|