From 3f45e8fdfa31d7b764d60a7c0cb5dd11944ed418 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期一, 21 九月 2026 23:38:59 +0800
Subject: [PATCH] bug:统计数据修正

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TFinanceController.java |  152 ++++++++++++++++++++++++++++----------------------
 1 files changed, 84 insertions(+), 68 deletions(-)

diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TFinanceController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TFinanceController.java
index 0048826..fb1f317 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TFinanceController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TFinanceController.java
@@ -26,6 +26,7 @@
 import com.dsh.guns.core.util.ToolUtil;
 import com.dsh.guns.modular.system.model.*;
 import com.dsh.guns.modular.system.service.*;
+import com.dsh.guns.modular.system.util.ResultUtil;
 import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
 import com.sun.org.apache.bcel.internal.generic.NEW;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -77,69 +78,68 @@
     private SiteClient siteClient;
 
 
-    /**
-     * 跳转到充值记录页面
+    /*
+     * 充值记录功能已下线,保留原实现以便后续恢复。
+     *
+     * @RequestMapping("/rechargeRecords")
+     * public String index(Model model) {
+     *     List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
+     *     model.addAttribute("list",list);
+     *     Integer objectType = UserExt.getUser().getObjectType();
+     *     Integer objectId = UserExt.getUser().getObjectId();
+     *     model.addAttribute("userType",objectType);
+     *     String roleid = UserExt.getUser().getRoleid();
+     *     model.addAttribute("objectType",objectType);
+     *     return PREFIX + "RechargeRecords.html";
+     * }
+     *
+     * @RequestMapping(value = "/listAll")
+     * @ResponseBody
+     * public List<RechargeRecordsVO> list(String province, String city, String name, String phone, String time, Integer type) {
+     *     RechargeRecordsQuery coachQuery = new RechargeRecordsQuery();
+     *     Region provinceCode = regionService.getOne(new QueryWrapper<Region>().eq("code", province));
+     *     Region cityCode = regionService.getOne(new QueryWrapper<Region>().eq("code", city));
+     *     if (provinceCode != null) {
+     *         coachQuery.setProvince(provinceCode.getName());
+     *     } else {
+     *         coachQuery.setProvince(province);
+     *     }
+     *     if (cityCode != null) {
+     *         coachQuery.setCity(cityCode.getName());
+     *     } else {
+     *         coachQuery.setCity(city);
+     *     }
+     *     coachQuery.setName(name);
+     *     coachQuery.setPhone(phone);
+     *     coachQuery.setTime(time);
+     *     coachQuery.setType(type);
+     *     return financeClient.rechargeList(coachQuery);
+     * }
+     *
+     * @RequestMapping(value = "/getAmount")
+     * @ResponseBody
+     * public BigDecimal getAmount(String province, String city, String name, String phone, String time, Integer type) {
+     *     RechargeRecordsQuery coachQuery = new RechargeRecordsQuery();
+     *     coachQuery.setProvince(province);
+     *     coachQuery.setCity(city);
+     *     coachQuery.setName(name);
+     *     coachQuery.setPhone(phone);
+     *     coachQuery.setTime(time);
+     *     coachQuery.setType(type);
+     *     List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(coachQuery);
+     *     BigDecimal total = new BigDecimal("0.00");
+     *     for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) {
+     *         total = total.add(rechargeRecordsVO.getAmount());
+     *     }
+     *     return total;
+     * }
      */
-    @RequestMapping("/rechargeRecords")
-    public String index(Model model) {
-        List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
-        model.addAttribute("list",list);
-        Integer objectType = UserExt.getUser().getObjectType();
-        Integer objectId = UserExt.getUser().getObjectId();
-        model.addAttribute("userType",objectType);
-        String roleid = UserExt.getUser().getRoleid();
-        model.addAttribute("objectType",objectType);
-        return PREFIX + "RechargeRecords.html";
-    }
-    /**
-     * 获取充值记录
-     */
-    @RequestMapping(value = "/listAll")
-    @ResponseBody
-    public List<RechargeRecordsVO> list(String province, String city, String name, String phone,String time,Integer type) {
-        RechargeRecordsQuery coachQuery = new RechargeRecordsQuery();
-        Region provinceCode = regionService.getOne(new QueryWrapper<Region>().eq("code", province));
-        Region cityCode = regionService.getOne(new QueryWrapper<Region>().eq("code", city));
-        if (provinceCode!=null){
-            coachQuery.setProvince(provinceCode.getName());
-        }else{
-            coachQuery.setProvince(province);
-        }
-        if (cityCode!=null){
-            coachQuery.setCity(cityCode.getName());
-        }else{
-            coachQuery.setCity(city);
-        }
-        coachQuery.setName(name);
 
-        coachQuery.setPhone(phone);
-        coachQuery.setTime(time);
-        coachQuery.setType(type);
-        return financeClient.rechargeList(coachQuery);
-    }
-
-    /**
-     * 获取充值记录
-     */
-    @RequestMapping(value = "/getAmount")
+    /** 充值记录功能已下线,避免通过历史菜单或直接 URL 继续访问。 */
+    @RequestMapping({"/rechargeRecords", "/listAll", "/getAmount"})
     @ResponseBody
-    public BigDecimal getAmount(String province, String city, String name, String phone, String time, Integer type) {
-        RechargeRecordsQuery coachQuery = new RechargeRecordsQuery();
-        coachQuery.setProvince(province);
-        coachQuery.setCity(city);
-        coachQuery.setName(name);
-        coachQuery.setPhone(phone);
-        coachQuery.setTime(time);
-        coachQuery.setType(type);
-        List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(coachQuery);
-        BigDecimal total = new BigDecimal("0.00");
-        BigDecimal result = new BigDecimal("0.00");
-        for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) {
-            BigDecimal amount = rechargeRecordsVO.getAmount();
-            total = total.add(amount); // 将新的值赋给total
-            result = result.add(amount); // 将新的值赋给result
-        }
-        return total;
+    public ResultUtil rechargeRecordsUnavailable() {
+        return ResultUtil.error("充值记录功能暂不提供");
     }
     /**
      * 获取报名订单统计数据
@@ -340,6 +340,7 @@
                     TAppUser tAppUser = appUserClient.queryById(vipPayment.getAppUserId());
                     IncomeVO temp = new IncomeVO();
                     temp.setId(vipPayment.getId().toString());
+                    temp.setAppUserId(vipPayment.getAppUserId());
                     if (tAppUser!=null){
                         if (tAppUser.getProvince()!=null){
                             temp.setProvince(tAppUser.getProvince());
@@ -371,6 +372,7 @@
                     TAppUser tAppUser = appUserClient.queryById(rechargeRecordsVO.getAppUserId());
                     IncomeVO temp = new IncomeVO();
                     temp.setId(rechargeRecordsVO.getId().toString());
+                    temp.setAppUserId(rechargeRecordsVO.getAppUserId());
                     if (tAppUser!=null){
                         if (tAppUser.getProvince()!=null){
                             temp.setProvince(tAppUser.getProvince());
@@ -402,6 +404,7 @@
                     TAppUser tAppUser = appUserClient.queryById(registerOrderVO.getAppUserId());
                     IncomeVO temp = new IncomeVO();
                     temp.setId(registerOrderVO.getId().toString());
+                    temp.setAppUserId(registerOrderVO.getAppUserId());
                     if (tAppUser!=null){
                         if (tAppUser.getProvince()!=null){
                             temp.setProvince(tAppUser.getProvince());
@@ -440,8 +443,9 @@
                         if(null == competition1){
                             continue;
                         }
-                        if (!competition1.getStoreId().equals("")){
-                            String[] split = competition1.getStoreId().split(",");
+                        String competitionStoreIds = resolveCompetitionStoreIds(competition, competition1);
+                        if (ToolUtil.isNotEmpty(competitionStoreIds)){
+                            String[] split = competitionStoreIds.split(",");
                             List<Integer> list = new ArrayList<>();
                             for (String s : split) {
                                 list.add(Integer.valueOf(s));
@@ -457,6 +461,7 @@
                             temp.setStoreName(substring);
                         }
                         temp.setId(competition.getId().toString());
+                        temp.setAppUserId(competition.getAppUserId());
                         if (tAppUser!=null){
                             if (tAppUser.getProvince()!=null){
                                 temp.setProvince(tAppUser.getProvince());
@@ -491,6 +496,7 @@
                     Store store = storeClient.getStoreById(siteBooking.getStoreId());
 
                     temp.setId(siteBooking.getId().toString());
+                    temp.setAppUserId(siteBooking.getAppUserId());
                     temp.setProvince(siteBooking.getProvince());
                     temp.setCity(siteBooking.getCity());
                     temp.setStoreName(store.getName());
@@ -726,8 +732,9 @@
                     if(null == competition1){
                         continue;
                     }
-                    if (!competition1.getStoreId().equals("")){
-                        String[] split = competition1.getStoreId().split(",");
+                    String competitionStoreIds = resolveCompetitionStoreIds(competition, competition1);
+                    if (ToolUtil.isNotEmpty(competitionStoreIds)){
+                        String[] split = competitionStoreIds.split(",");
                         List<Integer> list = new ArrayList<>();
                         for (String s : split) {
                             list.add(Integer.valueOf(s));
@@ -898,10 +905,19 @@
         return coursePackagePaymentClient.listAllRegister(query);
     }
 
+    /**
+     * 获取收入记录对应的门店归属;新订单使用下单快照,兼容未回填的历史订单。
+     *
+     * @param paymentCompetition 活动支付记录
+     * @param competition 活动当前信息
+     * @return 逗号分隔的门店 ID 列表
+     */
+    private String resolveCompetitionStoreIds(PaymentCompetition paymentCompetition, Competition competition) {
+        if (ToolUtil.isNotEmpty(paymentCompetition.getCompetitionStoreIds())) {
+            return paymentCompetition.getCompetitionStoreIds();
+        }
+        return competition.getStoreId();
+    }
 
 
 }
-
-
-
-

--
Gitblit v1.7.1