Przeglądaj źródła

fix: 结算状态改为待结算、日志按日压缩归档、站点列显示优化

- 结算记录初始状态改为待结算,需财务确认后改为已结算
- 结算列表补上 stationName,前端站点列改为上下结构显示 ID/名称
- logback 改用 SizeAndTimeBasedRollingPolicy,按日压缩 + 100MB 分片,保留 30 天
- 补充 t_settlement_record 缺 company_id 列的迁移脚本

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 11 godzin temu
rodzic
commit
c3879d6e2f

+ 25 - 2
admin-web-new/src/views/admin/finance/settlement.vue

@@ -29,7 +29,7 @@ const state = reactive({
     data: [] as Array<any>,
     loading: false,
     columns: [
-      { label: "站点名称", prop: "stationName", width: 180 },
+      { label: "站点", prop: "stationId", width: 180 },
       { label: "结算周期", prop: "settlementPeriod", width: 120 },
       { label: "期初余额(元)", prop: "openingPendingBalance", width: 150 },
       { label: "总充值(元)", prop: "totalRecharge", width: 140 },
@@ -162,7 +162,13 @@ const formatMoney = (value: number) => {
         </template>
         <el-table-column v-for="col in state.tableData.columns" :key="col.prop" :prop="col.prop" :label="col.label" :width="col.width" show-overflow-tooltip>
           <template #default="{ row }">
-            <template v-if="col.prop === 'status'">
+            <template v-if="col.prop === 'stationId'">
+              <div class="station-cell">
+                <span class="station-id">{{ row.stationId }}</span>
+                <span class="station-name">{{ row.stationName }}</span>
+              </div>
+            </template>
+            <template v-else-if="col.prop === 'status'">
               <el-tag :type="getDictColor('Settlement.status', row.status)" size="small">
                 {{ formatDict('Settlement.status', row.status) }}
               </el-tag>
@@ -206,6 +212,23 @@ const formatMoney = (value: number) => {
   margin-bottom: 16px;
 }
 
+.station-cell {
+  display: flex;
+  flex-direction: column;
+  line-height: 1.6;
+
+  .station-id {
+    font-size: 13px;
+    color: #909399;
+  }
+
+  .station-name {
+    font-size: 14px;
+    color: #303133;
+    font-weight: 500;
+  }
+}
+
 .pagination-container {
   display: flex;
   justify-content: flex-end;

+ 25 - 2
admin-web/src/views/admin/finance/settlement.vue

@@ -19,6 +19,23 @@
   margin-bottom: 20px;
 }
 
+.station-cell {
+  display: flex;
+  flex-direction: column;
+  line-height: 1.6;
+
+  .station-id {
+    font-size: 13px;
+    color: #909399;
+  }
+
+  .station-name {
+    font-size: 14px;
+    color: #303133;
+    font-weight: 500;
+  }
+}
+
 .page-pager {
   background-color: var(--el-color-white);
   height: 24px;
@@ -91,7 +108,13 @@
             :show-overflow-tooltip="!field.fixed&&field.width>150">
 
           <template #default="{row}">
-            <template v-if="field.prop==='status'">
+            <template v-if="field.prop==='stationId'">
+              <div class="station-cell">
+                <span class="station-id">{{ row.stationId }}</span>
+                <span class="station-name">{{ row.stationName }}</span>
+              </div>
+            </template>
+            <template v-else-if="field.prop==='status'">
               <el-tag :type="getStatusType(row.status)" size="small">
                 {{ getStatusLabel(row.status) }}
               </el-tag>
@@ -142,7 +165,7 @@ const state = reactive({
     loading: false
   },
   columns: [
-    {label: '站点名称', width: 180, prop: 'stationName', resizable: true},
+    {label: '站点', width: 180, prop: 'stationId', resizable: true},
     {label: '结算周期', width: 120, prop: 'settlementPeriod', resizable: true},
     {label: '期初余额(元)', width: 150, prop: 'openingPendingBalance', resizable: true},
     {label: '总充值(元)', width: 140, prop: 'totalRecharge', resizable: true},

+ 6 - 2
car-wash-admin/src/main/resources/logback-spring.xml

@@ -11,8 +11,12 @@
     </appender>
     <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${log.path}</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>./logs/car-wash-admin/car-wash-admin-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>./logs/car-wash-admin/car-wash-admin-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
+            <maxHistory>30</maxHistory>
+            <totalSizeCap>5GB</totalSizeCap>
+            <maxFileSize>100MB</maxFileSize>
+            <cleanHistoryOnStart>true</cleanHistoryOnStart>
         </rollingPolicy>
         <encoder>
             <pattern>%d{HH:mm:ss.SSS}|%thread|%-5level|%F:%L|%X{ip}|%X{seq}|%msg%n</pattern>

+ 9 - 0
car-wash-entity/src/main/resources/sql/v18_add_settlement_company_id.sql

@@ -0,0 +1,9 @@
+-- ====================================================
+-- V18 — 补充 t_settlement_record 表缺少的 company_id 列
+-- 原因:实体类继承 BaseEntity,后者映射 company_id 列,
+-- 但建表脚本漏加了该列,导致月统计查询报错 Unknown column 'company_id'
+-- ====================================================
+
+ALTER TABLE `t_settlement_record`
+    ADD COLUMN `company_id` BIGINT DEFAULT NULL COMMENT '公司(租户)ID'
+    AFTER `remark`;

+ 6 - 2
car-wash-miniapp/src/main/resources/logback-spring.xml

@@ -11,8 +11,12 @@
     </appender>
     <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${log.path}</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>./logs/car-wash-miniapp/car-wash-miniapp-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>./logs/car-wash-miniapp/car-wash-miniapp-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
+            <maxHistory>30</maxHistory>
+            <totalSizeCap>5GB</totalSizeCap>
+            <maxFileSize>100MB</maxFileSize>
+            <cleanHistoryOnStart>true</cleanHistoryOnStart>
         </rollingPolicy>
         <encoder>
             <pattern>%d{HH:mm:ss.SSS}|%thread|%-5level|%F:%L|%X{ip}|%X{seq}|%msg%n</pattern>

+ 3 - 1
car-wash-service/src/main/java/com/kym/service/impl/SettlementServiceImpl.java

@@ -12,6 +12,7 @@ import com.kym.mapper.SettlementRecordMapper;
 import com.kym.service.SettlementService;
 import com.kym.service.PlatformAccountService;
 import com.kym.service.PlatformRevenueRecordService;
+import com.kym.service.cache.KymCache;
 import com.kym.service.SplitRecordService;
 import com.kym.service.StationAccountService;
 import com.kym.service.mybatisplus.MyBaseServiceImpl;
@@ -131,7 +132,7 @@ public class SettlementServiceImpl extends MyBaseServiceImpl<SettlementRecordMap
             // 正常结算
             record.setSettlementAmount(available)
                     .setClosingPendingBalance(0)
-                    .setStatus(SettlementRecord.STATUS_结算);
+                    .setStatus(SettlementRecord.STATUS_结算);
 
             // 增加站点可提现金额
             stationAccountService.lambdaUpdate()
@@ -198,6 +199,7 @@ public class SettlementServiceImpl extends MyBaseServiceImpl<SettlementRecordMap
         var voList = res.stream().map(item -> {
             var vo = new SettlementRecordVo();
             BeanUtils.copyProperties(item, vo);
+            vo.setStationName(KymCache.INSTANCE.getStationNameById(item.getStationId()));
             return vo;
         }).toList();
         return new PageBean<>(voList);