From bbdc98ccf8eb6785ad6d51a595d22b3ab196db7b Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Tue, 3 Feb 2026 09:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E6=B1=87=E6=80=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/OrdersController.java | 7 ---- .../controller/StatisticsController.java | 35 +++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/zmzm/finance/common/controller/OrdersController.java b/src/main/java/com/zmzm/finance/common/controller/OrdersController.java index d6fd75b..a23c0c3 100644 --- a/src/main/java/com/zmzm/finance/common/controller/OrdersController.java +++ b/src/main/java/com/zmzm/finance/common/controller/OrdersController.java @@ -8,19 +8,14 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.zmzm.finance.common.entity.*; import com.zmzm.finance.common.service.IOrdersService; import com.zmzm.finance.common.service.IUserService; -import com.zmzm.finance.common.service.WumenUserService; import com.zmzm.finance.util.R; import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - import java.math.BigDecimal; import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -32,8 +27,6 @@ public class OrdersController { private IOrdersService ordersService; @Autowired private IUserService userService; - @Autowired - private WumenUserService wumenUserService; //账单列表 @RequestMapping("/getPointOrdersListNoUse") diff --git a/src/main/java/com/zmzm/finance/common/controller/StatisticsController.java b/src/main/java/com/zmzm/finance/common/controller/StatisticsController.java index 6ee298f..e82047e 100644 --- a/src/main/java/com/zmzm/finance/common/controller/StatisticsController.java +++ b/src/main/java/com/zmzm/finance/common/controller/StatisticsController.java @@ -41,6 +41,41 @@ public class StatisticsController { @Autowired private IFinanceOrderService financeOrderService; + //汇总统计 + @RequestMapping("/getStatistics") + public R getStatistics(@RequestBody Map params){ + List> paymentSummary = ordersService.listMaps(new MPJLambdaWrapper() + .leftJoin(PaymentToOrder.class,PaymentToOrder::getOrderId,Orders::getId) + .leftJoin(Payment.class,Payment::getId,PaymentToOrder::getPaymentId) + .eq(Orders::getUseFlag,1).eq(Orders::getPayType,0) + .apply("DATE_FORMAT(t.order_time,'%Y-%m') = '"+params.get("orderTime")+"'") + .select(""" + IF(t2.type=0,'微信',IF(t2.type=1,'支付宝','银行')) as plat, + sum(t.fee) as sumFee, + sum(case when t.type = 3 then t.fee else 0 end) as shiwu, + sum(case when t.type = 4 then t.fee else 0 end) as peixun, + sum(case when t.type = 1 then t.fee else 0 end) as vip, + sum(case when t.type = 2 then t.fee else 0 end) as kecheng, + sum(case when t.type = 0 then t.fee else 0 end) as tianyibi + """) + .groupBy("plat")); + List> physicalAndTraining = ordersService.listMaps(new MPJLambdaWrapper() + .leftJoin(PaymentToOrder.class,PaymentToOrder::getOrderId,Orders::getId) + .leftJoin(Payment.class,Payment::getId,PaymentToOrder::getPaymentId) + .eq(Orders::getUseFlag,1).in(Orders::getType,3,4) + .apply("DATE_FORMAT(t.order_time,'%Y-%m') = '"+params.get("orderTime")+"'") + .select(""" + IF(t.type=3,'实物','培训班') as type, + sum(t.fee) as sumFee, + sum(case when t.pay_type = 0&&t2.type = 0 then t.fee else 0 end) as wx, + sum(case when t.pay_type = 0&&t2.type = 1 then t.fee else 0 end) as zfb, + sum(case when t.pay_type = 0&&t2.type = 2 then t.fee else 0 end) as bank, + sum(case when t.pay_type = 1 then t.fee else 0 end) as tianyibi + """) + .groupBy("type")); + return R.ok().putData("paymentSummary",paymentSummary).putData("physicalAndTraining",physicalAndTraining); + } + //天医币统计 @RequestMapping("/pointStatistics") public R pointStatistics(@RequestBody Map params){