From cf8dc9ea458b5efc54d6d6d9d8e89db49ca6cf0f Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Tue, 23 Jun 2026 22:02:11 +0800
Subject: [PATCH] feat(system): 添加汇率配置管理功能

---
 src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
index 7432165..76e08b9 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
@@ -33,6 +33,7 @@
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.io.IOException;
@@ -41,6 +42,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.PrivateKey;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -134,6 +136,51 @@
         return new FebsResponse().success().message("保存成功");
     }
 
+    @GetMapping(value = "/moneyChangeList")
+    public FebsResponse moneyChangeList() {
+        List<DataDictionaryCustom> list = dataDictionaryCustomMapper.selectDicByType("MONEY_CHANGE");
+        Map<String, Object> data = new HashMap<>();
+        data.put("rows", list);
+        data.put("total", list.size());
+        return new FebsResponse().success().data(data);
+    }
+
+    @PostMapping(value = "/moneyChangeSave")
+    @ControllerEndpoint(operation = "保存汇率配置")
+    public FebsResponse moneyChangeSave(@RequestParam Map<String, String> params) {
+        String id = params.get("id");
+        String code = params.get("code");
+        String value = params.get("value");
+        String description = params.get("description");
+
+        if (StrUtil.isBlank(code)) return new FebsResponse().fail().message("货币编码不能为空");
+        if (StrUtil.isBlank(value)) return new FebsResponse().fail().message("汇率不能为空");
+        if (StrUtil.isBlank(description)) return new FebsResponse().fail().message("符号不能为空");
+
+        code = code.toUpperCase();
+
+        // 编辑模式:先删旧记录
+        if (StrUtil.isNotBlank(id)) {
+            dataDictionaryCustomMapper.deleteById(Long.valueOf(id));
+        }
+
+        // 检查编码是否已存在(避免重复)
+        DataDictionaryCustom exist = dataDictionaryCustomMapper.selectDicDataByTypeAndCode("MONEY_CHANGE", code);
+        if (exist != null) {
+            return new FebsResponse().fail().message("货币编码 " + code + " 已存在");
+        }
+
+        commonService.addDataDic("MONEY_CHANGE", code, value, description, false);
+        return new FebsResponse().success().message("保存成功");
+    }
+
+    @GetMapping(value = "/moneyChangeDelete/{id}")
+    @ControllerEndpoint(operation = "删除汇率配置")
+    public FebsResponse moneyChangeDelete(@PathVariable Long id) {
+        dataDictionaryCustomMapper.deleteById(id);
+        return new FebsResponse().success().message("删除成功");
+    }
+
     @GetMapping("countryDeliveryList")
     public FebsResponse countryDeliveryList(MallCountryDelivery dto, QueryRequest request) {
         Map<String, Object> data = getDataTable(countryDeliveryService.countryDeliveryList(dto, request));

--
Gitblit v1.9.1