收款汇总

This commit is contained in:
wuchunlei
2026-02-03 09:58:22 +08:00
parent 8d1b5cfcb6
commit bbdc98ccf8
2 changed files with 35 additions and 7 deletions

View File

@@ -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")

View File

@@ -41,6 +41,41 @@ public class StatisticsController {
@Autowired
private IFinanceOrderService financeOrderService;
//汇总统计
@RequestMapping("/getStatistics")
public R getStatistics(@RequestBody Map<String,Object> params){
List<Map<String,Object>> paymentSummary = ordersService.listMaps(new MPJLambdaWrapper<Orders>()
.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<Map<String,Object>> physicalAndTraining = ordersService.listMaps(new MPJLambdaWrapper<Orders>()
.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<String,Object> params){