Browse Source

add 平台统计

xuhaifeng 2 months ago
parent
commit
f62a7af690

+ 4 - 4
admin-ui/.env.development

@@ -5,10 +5,10 @@ VUE_APP_TITLE = 一七管理系统
 ENV = 'development'
 
 
-# VUE_APP_BASE_API_HOST = 'http://127.0.0.1:9801'
-# VUE_APP_BASE_API = 'http://127.0.0.1:9801'
-VUE_APP_BASE_API_HOST = 'http://139.224.65.227:8091/prod-api'
-VUE_APP_BASE_API = 'http://139.224.65.227:8091/prod-api'
+VUE_APP_BASE_API_HOST = 'http://192.168.5.247:9801'
+VUE_APP_BASE_API = 'http://192.168.5.247:9801'
+#VUE_APP_BASE_API_HOST = 'http://139.224.65.227:8091/prod-api'
+#VUE_APP_BASE_API = 'http://139.224.65.227:8091/prod-api'
 # VUE_APP_BASE_API_HOST = 'http://192.168.98.9:9801'
 # VUE_APP_BASE_API = 'http://192.168.98.9:9801/'
 

+ 34 - 0
admin-ui/src/api/settlement/statistics.js

@@ -120,3 +120,37 @@ export function factoryDashborad() {
     method: 'get'
   })
 }
+
+//工厂端首页dashboard
+export function platformDashborad() {
+  return request({
+    url: '/mapi/platform/statistics/dashborad',
+    method: 'get'
+  })
+}
+
+// 获取工厂总统计数据
+export function getplatformDayTrend(query) {
+  return request({
+    url: '/mapi/platform/statistics/trend',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询工厂按日期统计列表
+export function listplatformStatisticsByDate(query) {
+  return request({
+    url: '/mapi/platform/statistics/order/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function listplatformStatisticsByStore(query) {
+  return request({
+    url: '/mapi/platform/statistics/order/bystore',
+    method: 'get',
+    params: query
+  })
+}

+ 8 - 9
admin-ui/src/views/cloth/clothItem/index.vue

@@ -39,9 +39,9 @@
                 <el-table-column label="衣服信息" align="left" min-width="200">
                     <template slot-scope="scope">
                         <div class="goods-info">
-                            <el-image 
+                            <el-image
                                 class="goods-image"
-                                :src="scope.row.imgUrl" 
+                                :src="scope.row.imgUrl"
                                 :preview-src-list="[scope.row.imgUrl]"
                                 fit="cover">
                                 <div slot="error" class="image-slot">
@@ -152,7 +152,7 @@
                             </el-col>
                         </el-row>
                     </el-tab-pane>
-                    
+
                     <el-tab-pane label="图片与描述" name="media">
                         <el-form-item label="商品图片" prop="imgUrl">
                             <div class="image-upload-container">
@@ -235,7 +235,6 @@ export default {
                 isCalArea: [{ required: true, message: '是否按面积计算不能为空', trigger: 'blur' }],
                 isSpecial: [{ required: true, message: '是否特殊产品不能为空', trigger: 'blur' }],
                 imgUrl: [{ required: true, message: '衣服图片不能为空', trigger: 'blur' }],
-                content: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
                 sort: [{ required: true, message: '显示顺序不能为空', trigger: 'blur' }]
             },
             clothTypeList: [],
@@ -508,20 +507,20 @@ export default {
     .el-dialog__body {
         padding: 20px 30px;
     }
-    
+
     .el-tabs__nav {
         padding-left: 20px;
     }
-    
+
     .image-upload-container {
         display: flex;
         align-items: flex-start;
-        
+
         .image-tips {
             margin-left: 20px;
             color: #909399;
             font-size: 12px;
-            
+
             p {
                 margin: 0;
                 line-height: 1.8;
@@ -539,7 +538,7 @@ export default {
     display: flex;
     flex-direction: column;
     align-items: center;
-    
+
     .el-tag + .el-tag {
         margin-top: 5px;
     }

+ 154 - 104
admin-ui/src/views/index.vue

@@ -2,35 +2,51 @@
   <div class="app-container home">
     <!-- 累积统计卡片行 -->
     <el-row :gutter="20" class="panel-group">
-      <el-col :xs="12" :sm="12" :lg="6">
+      <el-col :xs="12" :sm="12" :lg="4">
         <div class="stat-card stat-card-blue">
-          <div class="stat-card-title">累积洗衣件数</div>
+          <div class="stat-card-title">洗衣件数</div>
           <div class="stat-card-value">
-            <count-to :start-val="0" :end-val="statistics.dailyInFactoryCount" :duration="2600" />
+            <count-to :start-val="0" :end-val="statistics.clothCount" :duration="2600" />
           </div>
         </div>
       </el-col>
-      <el-col :xs="12" :sm="12" :lg="6">
+      <el-col :xs="12" :sm="12" :lg="4">
         <div class="stat-card stat-card-green">
-          <div class="stat-card-title">累积洗衣金额</div>
+          <div class="stat-card-title">洗衣金额</div>
           <div class="stat-card-value">
-            <count-to :start-val="0" :end-val="statistics.dailyInFactoryAmount" :duration="2600" prefix="¥" />
+            <count-to :start-val="0" :end-val="statistics.clothReceiveAmount" :duration="2600" prefix="¥" />
           </div>
         </div>
       </el-col>
-      <el-col :xs="12" :sm="12" :lg="6">
-        <div class="stat-card stat-card-red">
-          <div class="stat-card-title">累积撤衣件数</div>
+      <el-col :xs="12" :sm="12" :lg="4">
+        <div class="stat-card stat-card-purple">
+          <div class="stat-card-title">零售订单数</div>
           <div class="stat-card-value">
-            <count-to :start-val="0" :end-val="statistics.dailyRefundCount" :duration="2600" />
+            <count-to :start-val="0" :end-val="statistics.goodsOrderCount" :duration="2600" />
           </div>
         </div>
       </el-col>
-      <el-col :xs="12" :sm="12" :lg="6">
+      <el-col :xs="12" :sm="12" :lg="4">
         <div class="stat-card stat-card-orange">
-          <div class="stat-card-title">累积撤衣金额</div>
+          <div class="stat-card-title">零售金额</div>
           <div class="stat-card-value">
-            <count-to :start-val="0" :end-val="statistics.dailyRefundAmount" :duration="2600" prefix="¥" />
+            <count-to :start-val="0" :end-val="statistics.goodsReceiveAmount" :duration="2600" prefix="¥" />
+          </div>
+        </div>
+      </el-col>
+      <el-col :xs="12" :sm="12" :lg="4">
+        <div class="stat-card stat-card-red">
+          <div class="stat-card-title">充值笔数</div>
+          <div class="stat-card-value">
+            <count-to :start-val="0" :end-val="statistics.chargeCount" :duration="2600" />
+          </div>
+        </div>
+      </el-col>
+      <el-col :xs="12" :sm="12" :lg="4">
+        <div class="stat-card stat-card-cyan">
+          <div class="stat-card-title">充值金额</div>
+          <div class="stat-card-value">
+            <count-to :start-val="0" :end-val="statistics.chargeAmount" :duration="2600" prefix="¥" />
           </div>
         </div>
       </el-col>
@@ -53,47 +69,69 @@
           </div>
           <div class="chart-content-1">
             <el-row :gutter="20" class="panel-group">
-              <el-col :xs="12" :sm="12" :lg="6">
+              <el-col :xs="12" :sm="12" :lg="4">
                 <div class="card-panel">
                   <div class="card-panel-icon-wrapper icon-orders">
                     <svg-icon icon-class="form" class-name="card-panel-icon" />
                   </div>
                   <div class="card-panel-description">
                     <div class="card-panel-text">洗衣件数</div>
-                    <count-to :start-val="0" :end-val="factoryStatistics.dailyInFactoryCount" :duration="2600" class="card-panel-num" />
+                    <count-to :start-val="0" :end-val="dayStatistics.clothCount" :duration="2600" class="card-panel-num" />
                   </div>
                 </div>
               </el-col>
-              <el-col :xs="12" :sm="12" :lg="6">
+              <el-col :xs="12" :sm="12" :lg="4">
                 <div class="card-panel">
                   <div class="card-panel-icon-wrapper icon-revenue">
                     <svg-icon icon-class="money" class-name="card-panel-icon" />
                   </div>
                   <div class="card-panel-description">
                     <div class="card-panel-text">洗衣金额</div>
-                    <count-to :start-val="0" :end-val="factoryStatistics.dailyInFactoryAmount" :duration="2600" class="card-panel-num" prefix="¥" />
+                    <count-to :start-val="0" :end-val="dayStatistics.clothReceiveAmount" :duration="2600" class="card-panel-num" prefix="¥" />
+                  </div>
+                </div>
+              </el-col>
+              <el-col :xs="12" :sm="12" :lg="4">
+                <div class="card-panel">
+                  <div class="card-panel-icon-wrapper icon-goods">
+                    <svg-icon icon-class="shopping" class-name="card-panel-icon" />
+                  </div>
+                  <div class="card-panel-description">
+                    <div class="card-panel-text">零售订单数</div>
+                    <count-to :start-val="0" :end-val="dayStatistics.goodsOrderCount" :duration="2600" class="card-panel-num" />
                   </div>
                 </div>
               </el-col>
-              <el-col :xs="12" :sm="12" :lg="6">
+              <el-col :xs="12" :sm="12" :lg="4">
                 <div class="card-panel">
-                  <div class="card-panel-icon-wrapper icon-cancel">
+                  <div class="card-panel-icon-wrapper icon-goods-amount">
+                    <svg-icon icon-class="money" class-name="card-panel-icon" />
+                  </div>
+                  <div class="card-panel-description">
+                    <div class="card-panel-text">零售金额</div>
+                    <count-to :start-val="0" :end-val="dayStatistics.goodsReceiveAmount" :duration="2600" class="card-panel-num" prefix="¥" />
+                  </div>
+                </div>
+              </el-col>
+              <el-col :xs="12" :sm="12" :lg="4">
+                <div class="card-panel">
+                  <div class="card-panel-icon-wrapper icon-charge">
                     <svg-icon icon-class="form" class-name="card-panel-icon" />
                   </div>
                   <div class="card-panel-description">
-                    <div class="card-panel-text">撤单件数</div>
-                    <count-to :start-val="0" :end-val="factoryStatistics.dailyRefundCount" :duration="2600" class="card-panel-num" />
+                    <div class="card-panel-text">充值笔数</div>
+                    <count-to :start-val="0" :end-val="dayStatistics.chargeCount" :duration="2600" class="card-panel-num" />
                   </div>
                 </div>
               </el-col>
-              <el-col :xs="12" :sm="12" :lg="6">
+              <el-col :xs="12" :sm="12" :lg="4">
                 <div class="card-panel">
-                  <div class="card-panel-icon-wrapper icon-cancel-amount">
+                  <div class="card-panel-icon-wrapper icon-charge-amount">
                     <svg-icon icon-class="money" class-name="card-panel-icon" />
                   </div>
                   <div class="card-panel-description">
-                    <div class="card-panel-text">撤单金额</div>
-                    <count-to :start-val="0" :end-val="factoryStatistics.dailyRefundAmount" :duration="2600" class="card-panel-num" prefix="¥" />
+                    <div class="card-panel-text">充值金额</div>
+                    <count-to :start-val="0" :end-val="dayStatistics.chargeAmount" :duration="2600" class="card-panel-num" prefix="¥" />
                   </div>
                 </div>
               </el-col>
@@ -105,19 +143,27 @@
 
     <!-- 交易图表展示 -->
     <el-row :gutter="32" style="margin-top: 32px">
-      <el-col :xs="24" :sm="24" :lg="12">
+      <el-col :xs="24" :sm="24" :lg="8">
+        <div class="chart-wrapper">
+          <div class="chart-title">洗衣交易趋势</div>
+          <div class="chart-content">
+            <amount-trend-chart :data="clothTrendData" />
+          </div>
+        </div>
+      </el-col>
+      <el-col :xs="24" :sm="24" :lg="8">
         <div class="chart-wrapper">
-          <div class="chart-title">交易金额趋势</div>
+          <div class="chart-title">零售交易趋势</div>
           <div class="chart-content">
-            <amount-trend-chart :data="amountTrendData" />
+            <amount-trend-chart :data="goodsTrendData" />
           </div>
         </div>
       </el-col>
-      <el-col :xs="24" :sm="24" :lg="12">
+      <el-col :xs="24" :sm="24" :lg="8">
         <div class="chart-wrapper">
-          <div class="chart-title">交易件数趋势</div>
+          <div class="chart-title">充值交易趋势</div>
           <div class="chart-content">
-            <count-trend-chart :data="countTrendData" />
+            <amount-trend-chart :data="chargeTrendData" />
           </div>
         </div>
       </el-col>
@@ -128,7 +174,7 @@
       <el-col :xs="24" :sm="24" :lg="24">
         <div class="chart-wrapper">
           <div class="chart-header">
-            <div class="chart-title">门店洗衣排行</div>
+            <div class="chart-title">门店营收排行</div>
             <div class="chart-actions">
               <el-radio-group v-model="rankingTimeRange" size="small" @change="handleRankingTimeRangeChange">
                 <el-radio-button label="week">近一周</el-radio-button>
@@ -141,19 +187,24 @@
             <el-table :data="storeRankings" style="width: 100%" :show-header="true">
               <el-table-column prop="index" type="index" label="排名" width="80" />
               <el-table-column label="门店名称" align="center" prop="storeName" />
-              <el-table-column label="入厂金额" align="center" prop="dailyInFactoryAmount">
+              <el-table-column label="洗衣件数" align="center" prop="clothCount" />
+              <el-table-column label="洗衣金额" align="center" prop="clothReceiveAmount">
                 <template slot-scope="scope">
-                  ¥{{ scope.row.dailyInFactoryAmount }}
+                  ¥{{ scope.row.clothReceiveAmount }}
                 </template>
               </el-table-column>
-              <el-table-column label="退单金额" align="center" prop="dailyRefundAmount">
+              <el-table-column label="零售单数" align="center" prop="goodsOrderCount" />
+              <el-table-column label="零售金额" align="center" prop="goodsReceiveAmount">
                 <template slot-scope="scope">
-                  ¥{{ scope.row.dailyRefundAmount }}
+                  ¥{{ scope.row.goodsReceiveAmount }}
+                </template>
+              </el-table-column>
+              <el-table-column label="充值笔数" align="center" prop="chargeCount" />
+              <el-table-column label="充值金额" align="center" prop="chargeAmount">
+                <template slot-scope="scope">
+                  ¥{{ scope.row.dailyChargeAmount }}
                 </template>
               </el-table-column>
-              <el-table-column label="入厂衣服数" align="center" prop="dailyInFactoryCount" />
-              <el-table-column label="检查衣服数" align="center" prop="dailyCheckedCount" />
-              <el-table-column label="出厂衣服数" align="center" prop="dailyOutFactoryCount" />
             </el-table>
           </div>
         </div>
@@ -164,76 +215,55 @@
 
 <script>
 import CountTo from 'vue-count-to'
-import { getTotalStatistics, listStatisticsByDate, listFactoryStatisticsByStore, factoryDashborad } from '@/api/settlement/statistics'
-import { getTimeoutClothing } from '@/api/statistics/reception'
+import {
+  platformDashborad, getplatformDayTrend, listplatformStatisticsByDate, listplatformStatisticsByStore
+} from '@/api/settlement/statistics'
 import AmountTrendChart from './components/AmountTrendChart'
-import CountTrendChart from './components/CountTrendChart'
 
 export default {
   name: 'Index',
-  dicts: ['sys_source_type'],
   components: {
     CountTo,
-    AmountTrendChart,
-    CountTrendChart
+    AmountTrendChart
   },
   data() {
     return {
       version: "3.8.4",
-      timeoutClothing: {},
-      roleType: false,
       statistics: {
-        totalClothCount: 0,
-        totalClothAmount: 0,
-        totalCancelCount: 0,
-        totalCancelAmount: 0
+        clothCount: 0,
+        clothReceiveAmount: 0,
+        goodsReceiveAmount: 0,
+        goodsOrderCount: 0,
+        chargeCount: 0,
+        chargeAmount: 0
       },
-      factoryStatistics: {
-        dailyInFactoryCount: 0,
-        dailyInFactoryAmount: 0,
-        dailyRefundCount: 0,
-        dailyRefundAmount: 0,
-        dailyActualSettlementAmount: 0
+      dayStatistics: {
+        clothCount: 0,
+        clothReceiveAmount: 0,
+        goodsReceiveAmount: 0,
+        goodsOrderCount: 0,
+        chargeCount: 0,
+        chargeAmount: 0
       },
       revenueTimeRange: 'today',
       rankingTimeRange: 'week',
-      amountTrendData: [],
-      countTrendData: [],
+      clothTrendData: [],
+      goodsTrendData: [],
+      chargeTrendData: [],
       storeRankings: []
     }
   },
   created() {
-    // this.getroletype()
-    // this.getTimeout()
     this.getStatistics()
     this.getFactoryStatisticsData()
     this.getStoreRankings()
     this.getTrendData()
   },
   methods: {
-    getroletype() {
-      let name = ''
-      this.dict.type.sys_source_type.map(item => {
-        if (item.value === this.$store.getters.user.userType) {
-          name = item.label
-        }
-      })
-    },
-    goTarget(href) {
-      window.open(href, "_blank");
-    },
-    getTimeout() {
-      getTimeoutClothing(this.queryParams).then(response => {
-        this.timeoutClothing = response.data;
-      });
-    },
-    btn_goto(type) {
-      this.$router.push({ path: '/query/overtimeOrders' })
-    },
     getStatistics() {
       // 获取累积统计数据
-      factoryDashborad({}).then(response => {
-        this.statistics = response.data
+      platformDashborad({}).then(response => {
+        this.statistics = response.data.orderStats
       })
     },
     handleRevenueTimeRangeChange() {
@@ -248,8 +278,10 @@ export default {
         startDate: this.getStartDateByTimeRange(),
         endDate: this.formatDate(new Date())
       }
-      getTotalStatistics(params).then(response => {
-        this.factoryStatistics = response.data
+      getplatformDayTrend(params).then(response => {
+        if(response.data.orderTrend) {
+          this.dayStatistics = response.data.orderTrend
+        }
       })
     },
     getStartDateByTimeRange() {
@@ -292,7 +324,7 @@ export default {
       }
 
       // 使用 listFactoryStatisticsByStore 方法获取门店排行数据
-      listFactoryStatisticsByStore(params).then(response => {
+      listplatformStatisticsByStore(params).then(response => {
         this.storeRankings = response.rows || []
       })
     },
@@ -308,22 +340,26 @@ export default {
       }
 
       // 获取趋势数据
-      listStatisticsByDate(params).then(response => {
-        const data = response.rows || []
+      listplatformStatisticsByDate(params).then(response => {
+        const data = response.data || []
 
-        // 处理金额趋势数据
-        this.amountTrendData = data.map(item => ({
-          date: item.statisticsDate,
-          value: item.dailyInFactoryAmount || 0
+        // 处理洗衣交易趋势数据
+        this.clothTrendData = data.map(item => ({
+          date: item.day,
+          value: item.clothOrderAmount || 0
         }))
 
-        // 处理件数趋势数据 - 确保格式正确
-        this.countTrendData = {
-          dates: data.map(item => item.statisticsDate || ''),
-          inFactory: data.map(item => item.dailyInFactoryCount || 0),
-          checked: data.map(item => item.dailyCheckedCount || 0),
-          outFactory: data.map(item => item.dailyOutFactoryCount || 0)
-        }
+        // 处理零售交易趋势数据
+        this.goodsTrendData = data.map(item => ({
+          date: item.day,
+          value: item.goodsReceiveAmount || 0
+        }))
+
+        // 处理充值交易趋势数据
+        this.chargeTrendData = data.map(item => ({
+          date: item.day,
+          value: item.chargeAmount || 0
+        }))
       })
     }
   }
@@ -371,14 +407,22 @@ export default {
       background: linear-gradient(135deg, #52c41a, #73d13d);
     }
 
-    .stat-card-red {
-      background: linear-gradient(135deg, #f5222d, #ff4d4f);
+    .stat-card-purple {
+      background: linear-gradient(135deg, #722ed1, #9254de);
     }
 
     .stat-card-orange {
       background: linear-gradient(135deg, #fa8c16, #ffa940);
     }
 
+    .stat-card-red {
+      background: linear-gradient(135deg, #f5222d, #ff4d4f);
+    }
+
+    .stat-card-cyan {
+      background: linear-gradient(135deg, #13c2c2, #36cfc9);
+    }
+
     .card-panel {
       height: 108px;
       cursor: pointer;
@@ -399,11 +443,17 @@ export default {
         .icon-revenue {
           background: #34bfa3;
         }
-        .icon-cancel {
-          background: #f4516c;
+        .icon-goods {
+          background: #722ed1;
+        }
+        .icon-goods-amount {
+          background: #fa8c16;
+        }
+        .icon-charge {
+          background: #f5222d;
         }
-        .icon-cancel-amount {
-          background: #ff9800;
+        .icon-charge-amount {
+          background: #13c2c2;
         }
       }
       .card-panel-icon-wrapper {

+ 3 - 32
yiqi-admin/src/main/java/com/yiqi/admin/controller/settlement/PlatformStatisticsController.java

@@ -41,14 +41,8 @@ public class PlatformStatisticsController extends BaseController {
     public AjaxResult dashboard() {
         // 获取订单统计数据
         SettlementStoreStatistics orderStats = settlementStoreStatisticsService.orderStatistics(null, null, null);
-
-        // 获取充值统计数据
-        StoreChargeStatistics chargeStats = settlementStoreStatisticsService.chargeTotal(null);
-
         Map<String, Object> result = new HashMap<>();
         result.put("orderStats", orderStats);
-        result.put("chargeStats", chargeStats);
-
         return AjaxResult.success(result);
     }
 
@@ -61,20 +55,14 @@ public class PlatformStatisticsController extends BaseController {
         Date start = DateUtils.parseDate(startDate);
         Date end = DateUtils.parseDate(endDate);
         // 获取订单统计趋势
-        List<SettlementStoreStatistics> orderTrend = settlementStoreStatisticsService.generatePlatformStatisticsByDate(start, end);
-
-        // 获取充值统计趋势
-        List<StoreChargeStatistics> chargeTrend = settlementStoreStatisticsService.generateChargeStatisticsByDate(0L, start, end);
-
+        SettlementStoreStatistics orderStats = settlementStoreStatisticsService.orderStatistics(null, DateUtils.parseDate(startDate), DateUtils.parseDate(endDate));
         Map<String, Object> result = new HashMap<>();
-        result.put("orderTrend", orderTrend);
-        result.put("chargeTrend", chargeTrend);
-
+        result.put("orderTrend", orderStats);
         return AjaxResult.success(result);
     }
 
     /**
-     * 获取门店每日交易统计列表
+     * 获取每日交易统计列表
      */
     @GetMapping("/order/list")
     public AjaxResult list(@RequestParam(required = false) String startDate,
@@ -89,23 +77,6 @@ public class PlatformStatisticsController extends BaseController {
         return AjaxResult.success(orderTrend);
     }
 
-    /**
-     * 获取门店每日充值统计列表
-     */
-    @GetMapping("/charge/list")
-    public AjaxResult chargeList(@RequestParam(required = false) String startDate,
-                                 @RequestParam(required = false) String endDate,
-                                 @RequestParam(required = false) Integer sort,
-                                 @RequestParam(defaultValue = "1") Integer pageNum,
-                                 @RequestParam(defaultValue = "15") Integer pageSize) {
-        Date start = DateUtils.parseDate(startDate);
-        Date end = DateUtils.parseDate(endDate);
-
-        // 获取充值统计趋势
-        List<StoreChargeStatistics> chargeTrend = settlementStoreStatisticsService.generateChargeStatisticsByDate(0L, start, end);
-        return AjaxResult.success(chargeTrend);
-    }
-
     /**
      * 获取门店每日订单统计列表
      */

+ 42 - 0
yiqi-common/src/main/java/com/yiqi/core/domain/SettlementStoreStatistics.java

@@ -278,4 +278,46 @@ public class SettlementStoreStatistics extends BaseEntity {
     @ApiModelProperty("福利支付金额")
     private BigDecimal goodsMemberRefundAmount;
 
+    /**
+     * 充值订单数
+     */
+    @Excel(name = "充值订单数")
+    @ApiModelProperty("充值订单数")
+    private Integer chargeCount;
+
+    /**
+     * 充值金额
+     */
+    @Excel(name = "充值金额")
+    @ApiModelProperty("充值金额")
+    private BigDecimal chargeAmount;
+
+    /**
+     * 充值到账金额
+     */
+    @Excel(name = "充值到账金额")
+    @ApiModelProperty("充值到账金额")
+    private BigDecimal chargeArriveAmount;
+
+    /**
+     * 充值订单数
+     */
+    @Excel(name = "充值退款数")
+    @ApiModelProperty("充值退款数")
+    private Integer chargeRefundCount;
+
+    /**
+     * 充值金额
+     */
+    @Excel(name = "充值金额")
+    @ApiModelProperty("充值金额")
+    private BigDecimal chargeRefundAmount;
+
+
+    /**
+     * 充值退款到账金额
+     */
+    @Excel(name = "充值退款到账金额")
+    @ApiModelProperty("充值退款到账金额")
+    private BigDecimal chargeRefundArriveAmount;
 }

+ 7 - 0
yiqi-common/src/main/java/com/yiqi/order/domain/OrderGoods.java

@@ -76,6 +76,13 @@ public class OrderGoods extends BaseEntity {
     @ApiModelProperty("商品类别")
     private String goodsType;
 
+    /**
+     * 商品数量
+     */
+    @Excel(name = "商品数量")
+    @ApiModelProperty("商品数量")
+    private Integer goodsCount;
+
     /**
      * 商品订单类型
      */

+ 5 - 0
yiqi-common/src/main/java/com/yiqi/settlement/domain/dto/OrderStatisticsVO.java

@@ -13,6 +13,11 @@ public class OrderStatisticsVO {
      * 订单数量
      */
     private Integer orderCount;
+
+    /**
+     * 商品数量 或者 衣服件数
+     */
+    private Integer goodsCount;
     
     /**
      * 交易笔数

+ 12 - 0
yiqi-core/src/main/java/com/yiqi/core/service/impl/SettlementManageBillServiceImpl.java

@@ -234,6 +234,12 @@ public class SettlementManageBillServiceImpl extends ServiceImpl<SettlementManag
         stats.setTransactionRefundAmount(BigDecimal.ZERO);
         // 1. 订单数量统计
         stats.setOrderCount(orderList.size());
+        stats.setGoodsCount(
+                orderList.stream()
+                        .map(OrderCloth::getOrderClothCount)
+                        .filter(Objects::nonNull)
+                        .reduce(0, Integer::sum)
+        );
         // 2. 交易订单数量统计
         stats.setTransactionCount(orderList.stream()
                 .filter(order -> PayStatus.HAS_PAY.getCode().equals(order.getOrderStatus()))
@@ -291,6 +297,12 @@ public class SettlementManageBillServiceImpl extends ServiceImpl<SettlementManag
         stats.setTransactionCount(orderList.stream()
                 .filter(order -> PayStatus.HAS_PAY.getCode().equals(order.getPayStatus()))
                 .count());
+//        stats.setGoodsCount(
+//                orderList.stream()
+//                        .map(OrderGoods::get)
+//                        .filter(Objects::nonNull)
+//                        .reduce(0, Integer::sum)
+//        );
 
         // 2. 订单金额统计
         BigDecimal totalAmount = orderList.stream()

+ 25 - 4
yiqi-core/src/main/java/com/yiqi/core/service/impl/SettlementStoreStatisticsServiceImpl.java

@@ -11,6 +11,7 @@ import com.yiqi.common.enums.PayStatus;
 import com.yiqi.common.enums.PayType;
 import com.yiqi.common.enums.RechargeRefundStatusType;
 import com.yiqi.common.enums.StatusType;
+import com.yiqi.common.utils.CurrencyUtil;
 import com.yiqi.common.utils.DateUtils;
 import com.yiqi.common.utils.SecurityUtils;
 import com.yiqi.core.service.ISettlementManageBillService;
@@ -79,8 +80,8 @@ public class SettlementStoreStatisticsServiceImpl extends ServiceImpl<Settlement
 
     @Override
     public SettlementStoreStatistics orderStatistics(Long storeId, Date start, Date end) {
-        Integer startDay = start!=null ? Integer.parseInt(DateUtil.format(start, "yyyyMMdd")) : null;
-        Integer endDay = end!=null ? Integer.parseInt(DateUtil.format(end, "yyyyMMdd")) : null;
+        Integer startDay = start != null ? Integer.parseInt(DateUtil.format(start, "yyyyMMdd")) : null;
+        Integer endDay = end != null ? Integer.parseInt(DateUtil.format(end, "yyyyMMdd")) : null;
         return baseMapper.orderStatistics(storeId, startDay, endDay);
     }
 
@@ -133,6 +134,15 @@ public class SettlementStoreStatisticsServiceImpl extends ServiceImpl<Settlement
         // 2. 遍历门店生成统计数据
         for (SysStore store : storeList) {
             SettlementStoreStatistics settlementStoreStatistics = generateStoreStatistics(date, store.getId());
+            //充值统计
+            StoreChargeStatistics storeChargeStatistics = generateChargeStatistics(date, store.getId());
+            settlementStoreStatistics.setChargeAmount(storeChargeStatistics.getRechargePayAmount());
+            settlementStoreStatistics.setChargeCount(storeChargeStatistics.getRechargeCount());
+            settlementStoreStatistics.setChargeRefundCount(storeChargeStatistics.getRefundCount());
+            settlementStoreStatistics.setChargeRefundAmount(storeChargeStatistics.getRefundAmount());
+            settlementStoreStatistics.setChargeArriveAmount(CurrencyUtil.add(storeChargeStatistics.getArriveCashAmount(), storeChargeStatistics.getArriveGiveAmount(), storeChargeStatistics.getArriveWelfareAmount()));
+            settlementStoreStatistics.setChargeRefundArriveAmount(CurrencyUtil.add(storeChargeStatistics.getArriveCashRefundAmount(), storeChargeStatistics.getArriveGiveRefundAmount(), storeChargeStatistics.getArriveWelfareRefundAmount()));
+
             // 2.6 检查是否已存在当日统计数据
             QueryWrapper<SettlementStoreStatistics> queryWrapper = new QueryWrapper<>();
             queryWrapper.lambda()
@@ -151,6 +161,14 @@ public class SettlementStoreStatisticsServiceImpl extends ServiceImpl<Settlement
         }
         //生成平台商品统计
         SettlementStoreStatistics settlementStoreStatistics = generateStoreStatistics(date, 0L);
+//        StoreChargeStatistics storeChargeStatistics = generateChargeStatistics(date, null);
+//        settlementStoreStatistics.setChargeAmount(storeChargeStatistics.getRechargePayAmount());
+//        settlementStoreStatistics.setChargeCount(storeChargeStatistics.getRechargeCount());
+//        settlementStoreStatistics.setChargeRefundCount(storeChargeStatistics.getRefundCount());
+//        settlementStoreStatistics.setChargeRefundAmount(storeChargeStatistics.getRefundAmount());
+//        settlementStoreStatistics.setChargeArriveAmount(CurrencyUtil.add(storeChargeStatistics.getArriveCashAmount(), storeChargeStatistics.getArriveGiveAmount(), storeChargeStatistics.getArriveWelfareAmount()));
+//        settlementStoreStatistics.setChargeRefundArriveAmount(CurrencyUtil.add(storeChargeStatistics.getArriveCashRefundAmount(), storeChargeStatistics.getArriveGiveRefundAmount(), storeChargeStatistics.getArriveWelfareRefundAmount()));
+
         // 2.6 检查是否已存在当日统计数据
         QueryWrapper<SettlementStoreStatistics> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda()
@@ -201,6 +219,7 @@ public class SettlementStoreStatisticsServiceImpl extends ServiceImpl<Settlement
         OrderStatisticsVO clothStats = statistics.getClothOrderStats();
         if (clothStats != null) {
             storeStatistics.setClothOrderCount(clothStats.getOrderCount());
+            storeStatistics.setClothCount(clothStats.getGoodsCount());
             storeStatistics.setClothOrderAmount(clothStats.getTotalAmount());
             storeStatistics.setClothReceiveAmount(clothStats.getTransactionAmount());
             storeStatistics.setClothWechatAmount(clothStats.getWechatAmount());
@@ -219,6 +238,7 @@ public class SettlementStoreStatisticsServiceImpl extends ServiceImpl<Settlement
         OrderStatisticsVO goodsStats = statistics.getGoodsOrderStats();
         if (goodsStats != null) {
             storeStatistics.setGoodsOrderCount(goodsStats.getOrderCount());
+            storeStatistics.setGoodsCount(goodsStats.getGoodsCount());
             storeStatistics.setGoodsOrderAmount(goodsStats.getTotalAmount());
             storeStatistics.setGoodsWechatAmount(goodsStats.getWechatAmount());
             storeStatistics.setGoodsAlipayAmount(goodsStats.getAlipayAmount());
@@ -231,6 +251,7 @@ public class SettlementStoreStatisticsServiceImpl extends ServiceImpl<Settlement
             storeStatistics.setGoodsCashRefundAmount(goodsStats.getCashRefundAmount());
             storeStatistics.setGoodsUnionRefundAmount(goodsStats.getUnionRefundAmount());
             storeStatistics.setGoodsMemberRefundAmount(goodsStats.getMemberRefundAmount());
+            storeStatistics.setGoodsReceiveAmount(goodsStats.getTransactionAmount());
         }
         return storeStatistics;
     }
@@ -240,14 +261,14 @@ public class SettlementStoreStatisticsServiceImpl extends ServiceImpl<Settlement
         try {
             // 1. 查询门店当日充值记录
             List<OrderRecharge> rechargeList = orderRechargeService.list(new QueryWrapper<OrderRecharge>().lambda()
-                    .eq(OrderRecharge::getStoreId, storeId)
+                    .eq(storeId != null, OrderRecharge::getStoreId, storeId)
                     .eq(OrderRecharge::getPayStatus, PayStatus.HAS_PAY.getCode())
                     .eq(OrderRecharge::getDelFlag, StatusType.OK.getCode())
                     .between(OrderRecharge::getPayTime, DateUtils.getStartTime(date), DateUtils.getEndTime(date)));
 
             // 2. 查询门店当日充值退款记录
             List<OrderRechargeRefund> refundList = orderRechargeRefundService.list(new QueryWrapper<OrderRechargeRefund>().lambda()
-                    .eq(OrderRechargeRefund::getStoreId, storeId)
+                    .eq(storeId != null, OrderRechargeRefund::getStoreId, storeId)
                     .eq(OrderRechargeRefund::getRefundStatus, RechargeRefundStatusType.REFUND_AGREE.getCode())
                     .eq(OrderRechargeRefund::getDelFlag, StatusType.OK.getCode())
                     .between(OrderRechargeRefund::getRefundTime, DateUtils.getStartTime(date), DateUtils.getEndTime(date)));

+ 23 - 3
yiqi-core/src/main/resources/mapper/core/SettlementStoreStatisticsMapper.xml

@@ -283,7 +283,14 @@
             sum(goods_wechat_refund_amount) as goodsWechatRefundAmount,
             sum(goods_cash_refund_amount) as goodsCashRefundAmount,
             sum(goods_union_refund_amount) as goodsUnionRefundAmount,
-            sum(goods_member_refund_amount) as goodsMemberRefundAmount
+            sum(goods_member_refund_amount) as goodsMemberRefundAmount,
+
+            sum(charge_refund_arrive_amount) as chargeRefundArriveAmount,
+            sum(charge_refund_amount) as chargeRefundAmount,
+            sum(charge_arrive_amount) as chargeArriveAmount,
+            sum(charge_amount) as chargeAmount,
+            sum(charge_refund_count) as chargeRefundCount,
+            sum(charge_count) as chargeCount
         from settlement_store_statistics where day >= #{startDay} and day &lt;= #{endDay} group by day order by day asc
     </select>
     <select id="totalByStore" resultType="com.yiqi.core.domain.SettlementStoreStatistics">
@@ -320,7 +327,14 @@
             sum(goods_wechat_refund_amount) as goodsWechatRefundAmount,
             sum(goods_cash_refund_amount) as goodsCashRefundAmount,
             sum(goods_union_refund_amount) as goodsUnionRefundAmount,
-            sum(goods_member_refund_amount) as goodsMemberRefundAmount
+            sum(goods_member_refund_amount) as goodsMemberRefundAmount,
+
+            sum(charge_refund_arrive_amount) as chargeRefundArriveAmount,
+            sum(charge_refund_amount) as chargeRefundAmount,
+            sum(charge_arrive_amount) as chargeArriveAmount,
+            sum(charge_amount) as chargeAmount,
+            sum(charge_refund_count) as chargeRefundCount,
+            sum(charge_count) as chargeCount
         from settlement_store_statistics where day >= #{startDay} and day &lt;= #{endDay} and store_id !=0 group by store_id order by clothOrderAmount desc
     </select>
     <select id="orderStatistics" resultType="com.yiqi.core.domain.SettlementStoreStatistics">
@@ -356,7 +370,13 @@
             sum(goods_wechat_refund_amount) as goodsWechatRefundAmount,
             sum(goods_cash_refund_amount) as goodsCashRefundAmount,
             sum(goods_union_refund_amount) as goodsUnionRefundAmount,
-            sum(goods_member_refund_amount) as goodsMemberRefundAmount
+            sum(goods_member_refund_amount) as goodsMemberRefundAmount,
+        sum(charge_refund_arrive_amount) as chargeRefundArriveAmount,
+        sum(charge_refund_amount) as chargeRefundAmount,
+        sum(charge_arrive_amount) as chargeArriveAmount,
+        sum(charge_amount) as chargeAmount,
+        sum(charge_refund_count) as chargeRefundCount,
+        sum(charge_count) as chargeCount
         from settlement_store_statistics where 1 = 1
         <if test="startDay!=null">
             and  day >= #{startDay}