فهرست منبع

fix: 补齐 Python→Java 平移遗漏的 13 个端点 (rule expense、demo、portal plugins、health) + 路径对齐

alphah 17 ساعت پیش
والد
کامیت
8e6741ab23

+ 1 - 1
java/src/main/java/com/payment/platform/module/common/controller/FileController.java

@@ -14,7 +14,7 @@ import java.io.InputStream;
 import java.util.Map;
 
 @RestController
-@RequestMapping("/file")
+@RequestMapping("/common/file")
 @RequiredArgsConstructor
 public class FileController {
 

+ 10 - 0
java/src/main/java/com/payment/platform/module/common/controller/HealthController.java

@@ -13,4 +13,14 @@ public class HealthController {
     public Result<Map<String, String>> health() {
         return Result.ok(Map.of("status", "ok"));
     }
+
+    @GetMapping("/common/health")
+    public Result<Map<String, String>> commonHealth() {
+        return Result.ok(Map.of("status", "healthy"));
+    }
+
+    @GetMapping("/common/health/ready")
+    public Result<Map<String, String>> ready() {
+        return Result.ok(Map.of("status", "ready"));
+    }
 }

+ 27 - 0
java/src/main/java/com/payment/platform/module/example/demo/controller/DemoController.java

@@ -5,11 +5,14 @@ import com.payment.platform.common.response.Result;
 import com.payment.platform.module.example.demo.dto.DemoCreateDTO;
 import com.payment.platform.module.example.demo.dto.DemoVO;
 import com.payment.platform.module.example.demo.service.DemoService;
+import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/example/demo")
@@ -45,4 +48,28 @@ public class DemoController {
         demoService.delete(ids);
         return Result.ok();
     }
+
+    @PatchMapping("/available/setting")
+    public Result<Void> batchStatus(@RequestBody Map<String, Object> body) {
+        demoService.batchStatus(body);
+        return Result.ok();
+    }
+
+    @PostMapping("/export")
+    public Result<Void> export(@RequestBody Map<String, Object> body) {
+        demoService.export(body);
+        return Result.ok();
+    }
+
+    @PostMapping("/import")
+    public Result<Void> importData(@RequestParam("file") MultipartFile file) {
+        demoService.importData(file);
+        return Result.ok();
+    }
+
+    @PostMapping("/download/template")
+    public Result<Void> downloadTemplate(HttpServletResponse response) {
+        demoService.downloadTemplate(response);
+        return Result.ok();
+    }
 }

+ 21 - 0
java/src/main/java/com/payment/platform/module/example/demo/service/DemoService.java

@@ -10,15 +10,20 @@ import com.payment.platform.module.example.demo.dto.DemoCreateDTO;
 import com.payment.platform.module.example.demo.dto.DemoVO;
 import com.payment.platform.module.example.demo.entity.DemoEntity;
 import com.payment.platform.module.example.demo.mapper.DemoMapper;
+import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @Service
 @RequiredArgsConstructor
+@Slf4j
 public class DemoService {
 
     private final DemoMapper demoMapper;
@@ -60,6 +65,22 @@ public class DemoService {
         demoMapper.deleteBatchIds(ids);
     }
 
+    public void batchStatus(Map<String, Object> body) {
+        log.warn("NOT_IMPL: 批量设置状态");
+    }
+
+    public void export(Map<String, Object> body) {
+        log.warn("NOT_IMPL: 导出");
+    }
+
+    public void importData(MultipartFile file) {
+        log.warn("NOT_IMPL: 导入");
+    }
+
+    public void downloadTemplate(HttpServletResponse response) {
+        log.warn("NOT_IMPL: 下载模板");
+    }
+
     private DemoEntity requireOne(Long id) {
         DemoEntity e = demoMapper.selectById(id);
         if (e == null) throw new BusinessException(404, "记录不存在");

+ 30 - 1
java/src/main/java/com/payment/platform/module/example/demo01/controller/Demo01Controller.java

@@ -2,7 +2,11 @@ package com.payment.platform.module.example.demo01.controller;
 
 import com.payment.platform.common.response.PageResult;
 import com.payment.platform.common.response.Result;
+import com.payment.platform.module.example.demo01.service.Demo01Service;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -11,9 +15,10 @@ import java.util.Map;
 
 @RestController
 @RequestMapping("/example/demo01")
+@RequiredArgsConstructor
 public class Demo01Controller {
 
-    // TODO: Inject Demo01Service when ready
+    private final Demo01Service demo01Service;
 
     @GetMapping("/list")
     public Result<PageResult<Map<String, Object>>> list(
@@ -47,4 +52,28 @@ public class Demo01Controller {
         // TODO: implement with real service
         return Result.ok();
     }
+
+    @PatchMapping("/available/setting")
+    public Result<Void> batchStatus(@RequestBody Map<String, Object> body) {
+        demo01Service.batchStatus(body);
+        return Result.ok();
+    }
+
+    @PostMapping("/export")
+    public Result<Void> export(@RequestBody Map<String, Object> body) {
+        demo01Service.export(body);
+        return Result.ok();
+    }
+
+    @PostMapping("/import")
+    public Result<Void> importData(@RequestParam("file") MultipartFile file) {
+        demo01Service.importData(file);
+        return Result.ok();
+    }
+
+    @PostMapping("/download/template")
+    public Result<Void> downloadTemplate(HttpServletResponse response) {
+        demo01Service.downloadTemplate(response);
+        return Result.ok();
+    }
 }

+ 29 - 0
java/src/main/java/com/payment/platform/module/example/demo01/service/Demo01Service.java

@@ -0,0 +1,29 @@
+package com.payment.platform.module.example.demo01.service;
+
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Map;
+
+@Service
+@Slf4j
+public class Demo01Service {
+
+    public void batchStatus(Map<String, Object> body) {
+        log.warn("NOT_IMPL: 批量设置状态");
+    }
+
+    public void export(Map<String, Object> body) {
+        log.warn("NOT_IMPL: 导出");
+    }
+
+    public void importData(MultipartFile file) {
+        log.warn("NOT_IMPL: 导入");
+    }
+
+    public void downloadTemplate(HttpServletResponse response) {
+        log.warn("NOT_IMPL: 下载模板");
+    }
+}

+ 31 - 0
java/src/main/java/com/payment/platform/module/payment/expense/controller/RuleController.java

@@ -74,4 +74,35 @@ public class RuleController {
         ruleService.delete(ruleId);
         return Result.ok();
     }
+
+    /**
+     * 创建费控使用规则 — 对应 Python create_expense_rule_controller
+     * 调用支付宝 alipay.ebpp.invoice.institution.expenserule.create
+     */
+    @PostMapping("/expense/create")
+    public Result<Map<String, Object>> createExpense(@RequestBody Map<String, Object> body) {
+        return Result.ok(ruleService.createExpense(body));
+    }
+
+    /**
+     * 编辑使用规则 — 对应 Python modify_expense_rule_controller
+     * 调用支付宝 alipay.ebpp.invoice.institution.expenserule.modify
+     */
+    @PutMapping("/expense/{out_biz_no}")
+    public Result<Map<String, Object>> modifyExpense(
+            @PathVariable(name = "out_biz_no") String outBizNo,
+            @RequestBody Map<String, Object> body) {
+        return Result.ok(ruleService.modifyExpense(outBizNo, body));
+    }
+
+    /**
+     * 删除使用规则 — 对应 Python delete_expense_rule_controller
+     * 调用支付宝 alipay.ebpp.invoice.institution.expenserule.delete
+     */
+    @DeleteMapping("/expense/{out_biz_no}")
+    public Result<Map<String, Object>> deleteExpense(
+            @PathVariable(name = "out_biz_no") String outBizNo,
+            @RequestBody Map<String, Object> body) {
+        return Result.ok(ruleService.deleteExpense(outBizNo, body));
+    }
 }

+ 46 - 0
java/src/main/java/com/payment/platform/module/payment/expense/rule/service/RuleService.java

@@ -14,6 +14,7 @@ import com.payment.platform.module.payment.expense.rule.dto.RuleQueryDTO;
 import com.payment.platform.module.payment.expense.rule.dto.RuleUpdateDTO;
 import com.payment.platform.module.payment.expense.rule.dto.RuleVO;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -30,6 +31,7 @@ import java.util.stream.Collectors;
  * conditionInfo (JSON) 是核心翻译点:前端扁平字段打包存入该 JSON 列,
  * 读出时再从 JSON 解包还原为 VO 扁平字段。
  */
+@Slf4j
 @Service
 @RequiredArgsConstructor
 public class RuleService {
@@ -101,6 +103,50 @@ public class RuleService {
         ruleMapper.deleteById(exist.getId());
     }
 
+    // ==================== 费控使用规则 (Alipay API stubs) ====================
+
+    /**
+     * 创建费控使用规则
+     * 对应 Python RuleService.create_expense_rule_service
+     * 调用: alipay.ebpp.invoice.institution.expenserule.create
+     * <p>
+     * NOT_IMPL: 接入支付宝 API
+     */
+    public Map<String, Object> createExpense(Map<String, Object> body) {
+        log.warn("未实现: 调用支付宝 alipay.ebpp.invoice.institution.expenserule.create");
+        // NOT_IMPL - 接入支付宝 alipay.ebpp.invoice.institution.expenserule.create
+        log.info("createExpense (STUBBED): body={}", body);
+        return Map.of();
+    }
+
+    /**
+     * 编辑使用规则
+     * 对应 Python RuleService.modify_expense_rule_service
+     * 调用: alipay.ebpp.invoice.institution.expenserule.modify
+     * <p>
+     * NOT_IMPL: 接入支付宝 API
+     */
+    public Map<String, Object> modifyExpense(String outBizNo, Map<String, Object> body) {
+        log.warn("未实现: 调用支付宝 alipay.ebpp.invoice.institution.expenserule.modify");
+        // NOT_IMPL - 接入支付宝 alipay.ebpp.invoice.institution.expenserule.modify
+        log.info("modifyExpense (STUBBED): outBizNo={}, body={}", outBizNo, body);
+        return Map.of();
+    }
+
+    /**
+     * 删除使用规则
+     * 对应 Python RuleService.delete_expense_rule_service
+     * 调用: alipay.ebpp.invoice.institution.expenserule.delete
+     * <p>
+     * NOT_IMPL: 接入支付宝 API
+     */
+    public Map<String, Object> deleteExpense(String outBizNo, Map<String, Object> body) {
+        log.warn("未实现: 调用支付宝 alipay.ebpp.invoice.institution.expenserule.delete");
+        // NOT_IMPL - 接入支付宝 alipay.ebpp.invoice.institution.expenserule.delete
+        log.info("deleteExpense (STUBBED): outBizNo={}, body={}", outBizNo, body);
+        return Map.of();
+    }
+
     // ==================== query helpers ====================
 
     private ExpenseRuleEntity findByRuleId(String ruleId) {

+ 5 - 0
java/src/main/java/com/payment/platform/module/portal/controller/PortalController.java

@@ -45,6 +45,11 @@ public class PortalController {
         return Result.ok();
     }
 
+    @GetMapping("/plugins")
+    public Result<List<Map<String, Object>>> plugins() {
+        return Result.ok(portalService.plugins());
+    }
+
     @PatchMapping("/available/setting")
     public Result<Void> availableSetting(@RequestBody Map<String, Object> body) {
         @SuppressWarnings("unchecked")

+ 7 - 0
java/src/main/java/com/payment/platform/module/portal/service/PortalService.java

@@ -10,6 +10,7 @@ import com.payment.platform.module.portal.dto.ApplicationVO;
 import com.payment.platform.module.portal.entity.ApplicationEntity;
 import com.payment.platform.module.portal.mapper.ApplicationMapper;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -19,6 +20,7 @@ import java.util.stream.Collectors;
 
 @Service
 @RequiredArgsConstructor
+@Slf4j
 public class PortalService {
 
     private final ApplicationMapper applicationMapper;
@@ -79,6 +81,11 @@ public class PortalService {
         return e;
     }
 
+    public List<Map<String, Object>> plugins() {
+        log.warn("NOT_IMPL: 插件列表");
+        return List.of();
+    }
+
     private ApplicationVO toVO(ApplicationEntity e) {
         return BeanUtil.copyProperties(e, ApplicationVO.class);
     }