Files
Home-Care/hss-home-service/delivery-miniapp/pages/delivery/finish/finish.vue
comclib 01e1034cc1 feat: 全系统优化 — 并发控制 + 冗余清理 + 数据流修复 + 全面测试
核心修复:
- 状态机加 SELECT FOR UPDATE 行锁,消除并发竞态
- hss_md_staff 加 role 列,登录从数据库读取真实角色
- 申请重复校验排除自身,全流程 20 步闭环通过
- 派单 SQL 修复 + 支付状态机过渡 + 完成服务 plan_item_id 修复

并发控制新增:
- RedisLockService (SET NX PX + Lua 安全解锁)
- RateLimiterService (Redis 滑动窗口 + API 拦截器)
- TransactionIsolationConfig (SERIALIZABLE for 支付回调)
- MqttPublisher (异步队列 + JDK TCP 探测)
- ObjectStorageService (AWS SigV4 预签名, 纯 JDK)

冗余清理:
- 删除 6 个死代码文件 (~620 行)
- hutool-all → JDK MessageDigest, 去 MapStruct, 去 jsr310
- haversine 提取到 GeoUtil, count/round 提取到 JdbcUtil
- 创建 platform layout 组件

前端修复:
- 登录页移除角色选择器, 由后端 JWT 返回
- 移除 ClientOnly 包裹, 页面正常渲染
- SPA fallback Nginx 配置修复

Docker: 运行时镜像 eclipse-temurin:17-jre-jammy (缩小 ~300MB)

文档: 新增系统实现与修复报告.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 11:48:07 +08:00

66 lines
2.9 KiB
Vue

<template>
<view class="page">
<text class="title">签退完成</text>
<view class="card"><text class="label">执行摘要</text><text class="val">{{ completedCount }} / {{ totalCount }} 项已完成</text></view>
<textarea v-model="summary" placeholder="服务总结(选填)" class="textarea" />
<view class="card"><text class="label">签退定位</text><text v-if="loc" class="val">经度 {{ loc.longitude.toFixed(6) }} 纬度 {{ loc.latitude.toFixed(6) }}</text></view>
<button @click="submit" :loading="submitting" class="btn">提交完成</button>
</view>
</template>
<script>
import { apiPost, getLocation, apiGet } from '@/common/api.js';
import { stopTrajectory } from '@/common/api.js';
import { OfflineQueue } from '@/common/offline.js';
const offline = new OfflineQueue();
export default {
data() { return { workOrderId: 0, summary: '', loc: null, submitting: false, items: [] }; },
computed: {
totalCount() { return this.items.length; },
completedCount() { return this.items.filter(i => i.status !== 'PENDING').length; }
},
async onLoad(options) {
this.workOrderId = parseInt(options.id) || 0;
try {
const res = await apiGet('/delivery/work-orders/' + this.workOrderId + '/detail');
this.items = res.data?.data?.items || [];
} catch(e) {}
try { this.loc = await getLocation(); } catch(e) {}
},
methods: {
async submit() {
stopTrajectory();
this.submitting = true;
const records = this.items.filter(i => i.status !== 'PENDING').map(i => ({ planItemId: i.id, status: i.status, notes: '' }));
const payload = {
executionRecords: records,
serviceSummary: this.summary,
signOffLatitude: this.loc?.latitude || 0,
signOffLongitude: this.loc?.longitude || 0
};
try {
const res = await apiPost('/work-orders/' + this.workOrderId + '/finish', payload);
if (res.data.code === 200) { uni.showToast({ title: '服务完成' }); setTimeout(() => uni.navigateBack(), 800); }
else { uni.showToast({ title: res.data.message, icon: 'none' }); }
} catch(e) {
offline.add({ path: '/work-orders/' + this.workOrderId + '/finish', data: payload });
uni.showToast({ title: '已缓存,待补传', icon: 'none' });
}
this.submitting = false;
}
}
};
</script>
<style>
.page { padding: 24rpx; background: #F8F8F8; min-height: 100vh; }
.title { font-size: 36rpx; font-weight: 700; display: block; margin-bottom: 24rpx; }
.card { background: #fff; border-radius: 16rpx; padding: 24rpx; margin-bottom: 16rpx; }
.label { font-size: 26rpx; color: #999; display: block; margin-bottom: 8rpx; }
.val { font-size: 28rpx; color: #333; }
.textarea { width: 100%; height: 150rpx; border: 1px solid #ddd; border-radius: 12rpx; padding: 16rpx; font-size: 28rpx; margin-bottom: 24rpx; background: #fff; }
.btn { background: #155EEF; color: #fff; border-radius: 12rpx; padding: 24rpx; font-size: 32rpx; font-weight: 600; }
</style>