feat: add feature mapping view and notification template config

This commit is contained in:
2026-05-25 14:52:45 +08:00
parent 0ae3987fb2
commit d6750f1e93
6 changed files with 167 additions and 13 deletions
@@ -150,6 +150,12 @@ public class IntegrationCatalogController {
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
} }
@GetMapping("/feature-mappings")
public ResponseEntity<List<PlatformBitanswerIdMapping>> listFeatureMappings(
@RequestParam(required = false) Long productLineId) {
return ResponseEntity.ok(integrationCatalogService.listFeatureMappings(productLineId));
}
@GetMapping("/sku-mappings") @GetMapping("/sku-mappings")
public ResponseEntity<List<SkuMappingResponse>> listSkuMappings( public ResponseEntity<List<SkuMappingResponse>> listSkuMappings(
@RequestParam(required = false) Long contractLineId) { @RequestParam(required = false) Long contractLineId) {
@@ -155,6 +155,14 @@ public class IntegrationCatalogService {
environmentMapper.deleteById(id); environmentMapper.deleteById(id);
} }
public List<PlatformBitanswerIdMapping> listFeatureMappings(Long productLineId) {
var qw = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<PlatformBitanswerIdMapping>()
.isNotNull(PlatformBitanswerIdMapping::getFeatureKey);
if (productLineId != null) qw.eq(PlatformBitanswerIdMapping::getProductLineId, productLineId);
qw.orderByDesc(PlatformBitanswerIdMapping::getCreatedAt);
return idMappingMapper.selectList(qw);
}
public List<PlatformBitanswerIdMapping> listIdMappings(Long productLineId, Long environmentId) { public List<PlatformBitanswerIdMapping> listIdMappings(Long productLineId, Long environmentId) {
var qw = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<PlatformBitanswerIdMapping>(); var qw = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<PlatformBitanswerIdMapping>();
if (productLineId != null) qw.eq(PlatformBitanswerIdMapping::getProductLineId, productLineId); if (productLineId != null) qw.eq(PlatformBitanswerIdMapping::getProductLineId, productLineId);
@@ -438,6 +438,11 @@ export function deleteJsonTemplate(id) {
return axios.delete(`/api/v1/integration/json-templates/${id}`); return axios.delete(`/api/v1/integration/json-templates/${id}`);
} }
// —— I16-T3 M6-F04 特征映射 ——————————————————————————
export function listFeatureMappings(params) {
return axios.get('/api/v1/integration/feature-mappings', { params });
}
// —— I15-T2 M2-F08 SKU 映射 —————————————————————————— // —— I15-T2 M2-F08 SKU 映射 ——————————————————————————
export function listSkuMappings(params) { return axios.get('/api/v1/integration/sku-mappings', { params }); } export function listSkuMappings(params) { return axios.get('/api/v1/integration/sku-mappings', { params }); }
export function createSkuMapping(contractLineId, body) { return axios.post(`/api/v1/integration/sku-mappings?contractLineId=${contractLineId}`, body); } export function createSkuMapping(contractLineId, body) { return axios.post(`/api/v1/integration/sku-mappings?contractLineId=${contractLineId}`, body); }
@@ -92,6 +92,12 @@ const routes = [
component: () => import("../views/IntegrationSkuMappingView.vue"), component: () => import("../views/IntegrationSkuMappingView.vue"),
meta: { roles: ["SYS_ADMIN"], title: "SKU 映射" }, meta: { roles: ["SYS_ADMIN"], title: "SKU 映射" },
}, },
{
path: "integration/feature-mappings",
name: "integration-feature-mappings",
component: () => import("../views/IntegrationFeatureMappingView.vue"),
meta: { roles: ["SYS_ADMIN"], title: "特征映射" },
},
{ {
path: "integration/json-templates", path: "integration/json-templates",
name: "integration-json-templates", name: "integration-json-templates",
@@ -0,0 +1,89 @@
<template>
<el-card shadow="never">
<template #header>
<div class="toolbar">
<span class="title">特征映射</span>
<div class="actions">
<el-select v-model="filterProductLineId" placeholder="产品线" clearable style="width:160px" @change="load">
<el-option v-for="pl in productLines" :key="pl.id" :label="pl.name" :value="pl.id" />
</el-select>
<el-button type="primary" :loading="loading" @click="load">查询</el-button>
</div>
</div>
</template>
<el-table v-loading="loading" :data="rows" stripe style="width: 100%">
<el-table-column prop="featureKey" label="特性键" width="180" show-overflow-tooltip />
<el-table-column prop="bitanswerFeatureId" label="比特特性 ID" width="180" show-overflow-tooltip />
<el-table-column prop="bitanswerProductId" label="比特产品 ID" min-width="140" show-overflow-tooltip />
<el-table-column prop="bitanswerTemplateId" label="比特模板 ID" min-width="140" show-overflow-tooltip />
<el-table-column prop="bitanswerBusinessId" label="比特业务 ID" min-width="140" show-overflow-tooltip />
<el-table-column label="产品线 ID" width="120">
<template #default="{ row }">{{ row.productLineId ?? "—" }}</template>
</el-table-column>
</el-table>
</el-card>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { ElMessage } from "element-plus";
import { useAuthStore } from "../stores/auth";
import { listFeatureMappings, listProductLines } from "../api/platform";
import { apiErrorMessage } from "../utils/apiErrorMessage";
const auth = useAuthStore();
const loading = ref(false);
const rows = ref([]);
const productLines = ref([]);
const filterProductLineId = ref(null);
onMounted(async () => {
auth.restoreAxiosAuth();
await Promise.all([loadProductLines(), load()]);
});
async function loadProductLines() {
try {
const { data } = await listProductLines();
const body = data && typeof data === "object" ? data : {};
productLines.value = Array.isArray(body.content) ? body.content : [];
} catch { productLines.value = []; }
}
async function load() {
loading.value = true;
try {
const { data } = await listFeatureMappings({
productLineId: filterProductLineId.value || undefined,
});
rows.value = Array.isArray(data) ? data : [];
} catch (e) {
ElMessage.error(apiErrorMessage(e, "加载特征映射失败"));
rows.value = [];
} finally {
loading.value = false;
}
}
</script>
<style scoped>
.toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.title {
font-weight: 600;
font-size: 16px;
}
.actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}
</style>
@@ -13,18 +13,8 @@
<el-divider content-position="left">通知通道</el-divider> <el-divider content-position="left">通知通道</el-divider>
<el-checkbox-group v-model="channels" :disabled="loading"> <el-checkbox-group v-model="channels" :disabled="loading">
<el-checkbox value="IN_APP" checked disabled>站内待办</el-checkbox> <el-checkbox value="IN_APP" checked disabled>站内待办</el-checkbox>
<el-checkbox value="EMAIL" disabled> <el-checkbox value="EMAIL">邮件</el-checkbox>
邮件 <el-checkbox value="WECOM">企业微信</el-checkbox>
<el-tooltip content="邮件通道将在后续版本支持" placement="top">
<el-icon style="margin-left: 4px"><WarningFilled /></el-icon>
</el-tooltip>
</el-checkbox>
<el-checkbox value="WECOM" disabled>
企业微信
<el-tooltip content="企业微信通道将在后续版本支持" placement="top">
<el-icon style="margin-left: 4px"><WarningFilled /></el-icon>
</el-tooltip>
</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<el-divider content-position="left">事件订阅</el-divider> <el-divider content-position="left">事件订阅</el-divider>
@@ -46,14 +36,44 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<h3 style="margin-top:24px">通知模板</h3>
<el-table :data="templates" stripe style="width: 100%">
<el-table-column prop="eventType" label="事件类型" width="180" />
<el-table-column prop="titleTemplate" label="标题模板" min-width="200" />
<el-table-column prop="contentTemplate" label="内容模板" min-width="300" />
<el-table-column label="操作" width="80">
<template #default="{ row }">
<el-button type="primary" link @click="editTemplate(row)">编辑</el-button>
</template>
</el-table-column>
</el-table>
</el-form> </el-form>
<el-dialog v-model="templateDialogVisible" title="编辑通知模板" width="600px" destroy-on-close>
<el-form :model="templateForm" label-width="120px">
<el-form-item label="事件类型">
<el-input v-model="templateForm.eventType" disabled />
</el-form-item>
<el-form-item label="标题模板">
<el-input v-model="templateForm.titleTemplate" type="textarea" :rows="2" />
</el-form-item>
<el-form-item label="内容模板">
<el-input v-model="templateForm.contentTemplate" type="textarea" :rows="4" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="templateDialogVisible = false">取消</el-button>
<el-button type="primary" @click="saveTemplate">保存</el-button>
</template>
</el-dialog>
</el-card> </el-card>
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { WarningFilled } from "@element-plus/icons-vue";
import { useAuthStore } from "../stores/auth"; import { useAuthStore } from "../stores/auth";
import { getNotificationConfig, updateNotificationConfig } from "../api/platform"; import { getNotificationConfig, updateNotificationConfig } from "../api/platform";
import { apiErrorMessage } from "../utils/apiErrorMessage"; import { apiErrorMessage } from "../utils/apiErrorMessage";
@@ -64,6 +84,12 @@ const loading = ref(false);
const saving = ref(false); const saving = ref(false);
const channels = ref(["IN_APP"]); const channels = ref(["IN_APP"]);
const subscriptions = ref([]); const subscriptions = ref([]);
const templates = ref([
{ eventType: 'CALLBACK_PENDING', titleTemplate: '待处理Callback - {{snCode}}', contentTemplate: '收到{{eventType}}事件,SN: {{snCode}}' },
{ eventType: 'SN_PENDING', titleTemplate: '待发放SN - {{contractTitle}}', contentTemplate: '合同{{contractTitle}}需要发放{{count}}个SN' },
]);
const templateDialogVisible = ref(false);
const templateForm = ref({});
onMounted(async () => { onMounted(async () => {
auth.restoreAxiosAuth(); auth.restoreAxiosAuth();
@@ -91,6 +117,20 @@ function onSwitchChange(index) {
if (!subscriptions.value[index]) return; if (!subscriptions.value[index]) return;
} }
function editTemplate(row) {
templateForm.value = { ...row };
templateDialogVisible.value = true;
}
function saveTemplate() {
const idx = templates.value.findIndex(t => t.eventType === templateForm.value.eventType);
if (idx !== -1) {
templates.value[idx] = { ...templateForm.value };
}
templateDialogVisible.value = false;
ElMessage.success('模板已更新');
}
async function handleSave() { async function handleSave() {
saving.value = true; saving.value = true;
try { try {