From 2194496b31fdc61d525636f63a3565a34b15adc7 Mon Sep 17 00:00:00 2001 From: lijianlin Date: Fri, 4 Jul 2025 16:15:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- .../com/example/demo/domain/vo/AuditRequest.java | 3 ++- .../com/example/demo/domain/vo/RechargeAudit.java | 4 ++++ .../com/example/demo/domain/vo/RefundAudit.java | 4 ++++ .../com/example/demo/service/WorkbenchService.java | 6 ++++-- .../demo/serviceImpl/WorkbenchServiceImpl.java | 25 +++++++++++++++++++++- src/main/resources/mapper/AuditMapper.xml | 19 +++++++++++++++- 7 files changed, 58 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index feb0b53..8bdb93a 100644 --- a/pom.xml +++ b/pom.xml @@ -175,7 +175,7 @@ - + diff --git a/src/main/java/com/example/demo/domain/vo/AuditRequest.java b/src/main/java/com/example/demo/domain/vo/AuditRequest.java index 3be612a..6276f91 100644 --- a/src/main/java/com/example/demo/domain/vo/AuditRequest.java +++ b/src/main/java/com/example/demo/domain/vo/AuditRequest.java @@ -13,6 +13,7 @@ public class AuditRequest { private Integer auditId; //审核人id private Integer action; //操作 private String rejectReason; //驳回理由 - + private String sortField; //排序字段 + private String sortOrder; //排序顺序 } \ No newline at end of file diff --git a/src/main/java/com/example/demo/domain/vo/RechargeAudit.java b/src/main/java/com/example/demo/domain/vo/RechargeAudit.java index 4438ea6..d1a5cac 100644 --- a/src/main/java/com/example/demo/domain/vo/RechargeAudit.java +++ b/src/main/java/com/example/demo/domain/vo/RechargeAudit.java @@ -1,6 +1,7 @@ package com.example.demo.domain.vo; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -19,6 +20,7 @@ import java.util.Date; @Data @NoArgsConstructor @AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) public class RechargeAudit { private static final long serialVersionUID = 1L; @@ -54,4 +56,6 @@ public class RechargeAudit { private Date endTime; // 结束时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") private Date auditTime; // 审核时间 + private String sortField; //排序字段 + private String sortOrder; //排序顺序 } diff --git a/src/main/java/com/example/demo/domain/vo/RefundAudit.java b/src/main/java/com/example/demo/domain/vo/RefundAudit.java index 3c18eb6..727b2e4 100644 --- a/src/main/java/com/example/demo/domain/vo/RefundAudit.java +++ b/src/main/java/com/example/demo/domain/vo/RefundAudit.java @@ -1,6 +1,7 @@ package com.example.demo.domain.vo; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -19,6 +20,7 @@ import java.util.Date; @Data @NoArgsConstructor @AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) public class RefundAudit { private static final long serialVersionUID = 1L; private String name; // 客户姓名 @@ -51,4 +53,6 @@ public class RefundAudit { private Date endTime; // 结束时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") private Date auditTime; // 审核时间 + private String sortField; //排序字段 + private String sortOrder; //排序顺序 } diff --git a/src/main/java/com/example/demo/service/WorkbenchService.java b/src/main/java/com/example/demo/service/WorkbenchService.java index 70b26f0..406d3e8 100644 --- a/src/main/java/com/example/demo/service/WorkbenchService.java +++ b/src/main/java/com/example/demo/service/WorkbenchService.java @@ -27,9 +27,11 @@ public interface WorkbenchService { WorkbenchCard getGraph(String token, Date startDate, Date endDate, List markets); //根据类型获取年初至今的统计数据 Map calculateAllSum(String market, Date startDate, Date endDate); - //获取该日期该市场的日同比 + //获取该日期该市场的日环比 Integer calculateDayOverDay(String market,Date date); - //获取该日期该市场的周环比 + //获取总体日环比 + //Integer calculateAllDayOverDay(Date date); + //获取该日期该市场的周同比 Integer calculateWeekOverWeek(String market, Date date); //获取与传入的日期相差XX天的日期 Date addDays(Date date, int days); diff --git a/src/main/java/com/example/demo/serviceImpl/WorkbenchServiceImpl.java b/src/main/java/com/example/demo/serviceImpl/WorkbenchServiceImpl.java index ee6a562..5ce282f 100644 --- a/src/main/java/com/example/demo/serviceImpl/WorkbenchServiceImpl.java +++ b/src/main/java/com/example/demo/serviceImpl/WorkbenchServiceImpl.java @@ -233,7 +233,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { } /* - 获取该日期该市场的日同比 + 获取该日期该市场的日环比 */ @Override public Integer calculateDayOverDay(String market, Date date) { @@ -259,6 +259,29 @@ public class WorkbenchServiceImpl implements WorkbenchService { double rate = ((double) (currentStatistics.getRechargeNum() - yesterdayStatistics.getRechargeNum()) / yesterdayStatistics.getRechargeNum()) * 100; return (int) Math.round(rate); } + // 计算所有市场总体日环比 + /* @Override + public Integer calculateAllDayOverDay(Date date) { + //获取起止时间为当天零点与最后一秒 + LocalDateTime startTime = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().with(LocalTime.MIN); + LocalDateTime endTime= startTime.plusDays(1).minusSeconds(1); + + //int currentTotalRechargeNum = statisticsMapper.countAllMarketRechargeNum( + Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()), + Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant())); + + if (currentTotalRechargeNum == 0) return 0; // 避免除以零的情况 + + Date yesterday = addDays(date, -1); // 昨天 + int yesterdayTotalRechargeNum = statisticsMapper.countAllMarketRechargeNum( + Date.from(yesterday.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().with(LocalTime.MIN).atZone(ZoneId.systemDefault()).toInstant()), + Date.from(yesterday.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().with(LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant())); + + if (yesterdayTotalRechargeNum == 0) return 0; // 避免除以零的情况 + + double rate = ((double)(currentTotalRechargeNum - yesterdayTotalRechargeNum) / yesterdayTotalRechargeNum) * 100; + return (int)Math.round(rate); + }*/ /* 获取该日期该市场的周环比 */ diff --git a/src/main/resources/mapper/AuditMapper.xml b/src/main/resources/mapper/AuditMapper.xml index 15f4f28..3fc612e 100644 --- a/src/main/resources/mapper/AuditMapper.xml +++ b/src/main/resources/mapper/AuditMapper.xml @@ -38,6 +38,7 @@