Pārlūkot izejas kodu

律所 导入 导出

qxy 3 nedēļas atpakaļ
vecāks
revīzija
c11ee9d9a2

+ 19 - 0
alien-entity/src/main/java/shop/alien/mapper/LawFirmPaymentMapper.java

@@ -0,0 +1,19 @@
+package shop.alien.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import shop.alien.entity.store.LawFirmPayment;
+
+/**
+ * <p>
+ * 律所子表 Mapper 接口
+ * </p>
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Mapper
+public interface LawFirmPaymentMapper extends BaseMapper<LawFirmPayment> {
+
+}
+

+ 0 - 1
alien-gateway/src/main/java/shop/alien/gateway/service/impl/LawyerUserLogInServiceImpl.java

@@ -126,7 +126,6 @@ public class LawyerUserLogInServiceImpl extends ServiceImpl<LawyerUserMapper, La
                 String lawFirmIds = lawyerUsers.stream().map(u -> String.valueOf(u.getFirmId())).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
                 LawFirm lawFirm = new LawFirm();
                 lawFirm.setId(lawyerUserDto.getFirmId());
-                lawFirm.setPaymentAccount(lawFirmIds);
                 lawFirmMapper.updateById(lawFirm);
             }
             user.setPassType(0);

+ 31 - 27
alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawFirmController.java

@@ -33,16 +33,22 @@ public class LawFirmController {
 
     private final LawFirmService lawFirmService;
 
-    @ApiOperation("新增律所")
+    @ApiOperation(value = "新增律所", notes = "新增律所信息,支持同时添加收款账号列表。收款账号(payment_account)必须唯一,不能重复添加。")
     @ApiOperationSupport(order = 1)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "lawFirm", value = "律所信息对象,包含paymentList(收款账号列表)", dataType = "LawFirm", paramType = "body", required = true)
+    })
     @PostMapping("/addLawFirm")
     public R<LawFirm> addLawFirm(@RequestBody LawFirm lawFirm) {
         log.info("LawFirmController.addLawFirm?lawFirm={}", lawFirm);
         return lawFirmService.addLawFirm(lawFirm);
     }
 
-    @ApiOperation("编辑律所")
+    @ApiOperation(value = "编辑律所", notes = "编辑律所信息,支持同时新增、修改、删除收款账号。收款账号(payment_account)必须唯一,不能重复添加。")
     @ApiOperationSupport(order = 2)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "lawFirm", value = "律所信息对象,必须包含id。paymentList中:有id的为更新,无id的为新增,不在列表中的将被删除", dataType = "LawFirm", paramType = "body", required = true)
+    })
     @PostMapping("/editLawFirm")
     public R<LawFirm> editLawFirm(@RequestBody LawFirm lawFirm) {
         log.info("LawFirmController.editLawFirm?lawFirm={}", lawFirm);
@@ -57,7 +63,7 @@ public class LawFirmController {
         return lawFirmService.deleteLawFirm(id);
     }
 
-    @ApiOperation("保存或更新律所")
+    @ApiOperation(value = "保存或更新律所", notes = "根据是否有id判断新增或更新。注意:此接口不支持收款账号的关联操作,建议使用addLawFirm或editLawFirm接口")
     @ApiOperationSupport(order = 4)
     @PostMapping("/saveOrUpdate")
     public R<LawFirm> saveOrUpdate(@RequestBody LawFirm lawFirm) {
@@ -69,7 +75,7 @@ public class LawFirmController {
         return R.fail("操作失败");
     }
 
-    @ApiOperation("通用列表查询")
+    @ApiOperation(value = "通用列表查询", notes = "查询律所列表,包含收款账号列表(paymentList)")
     @ApiOperationSupport(order = 5)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "主键", dataType = "Integer", paramType = "query"),
@@ -89,10 +95,12 @@ public class LawFirmController {
                 .likeFields("firmName", "creditCode")  // 律所名称和统一社会信用代码支持模糊查询
                 .build()
                 .list(lawFirmService);
+        // 批量填充收款账号列表
+        lawFirmService.fillPaymentList(list);
         return R.data(list);
     }
 
-    @ApiOperation("通用分页查询")
+    @ApiOperation(value = "通用分页查询", notes = "分页查询律所列表,包含收款账号列表(paymentList)")
     @ApiOperationSupport(order = 6)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "page", value = "页数(默认1)", dataType = "int", paramType = "query"),
@@ -119,18 +127,25 @@ public class LawFirmController {
                 .page(pageNum, pageSize)
                 .build()
                 .page(lawFirmService);
+        // 批量填充收款账号列表
+        if (pageResult != null && pageResult.getRecords() != null && !pageResult.getRecords().isEmpty()) {
+            lawFirmService.fillPaymentList(pageResult.getRecords());
+        }
         return R.data(pageResult);
     }
 
-//    @ApiOperation("律所注册")
-//    @ApiOperationSupport(order = 7)
-//    @PostMapping("/register")
-//    public R<LawFirm> register(@RequestBody LawFirm lawFirm) {
-//        log.info("LawFirmController.register?lawFirm={}", lawFirm);
-//        return lawFirmService.register(lawFirm);
-//    }
+    @ApiOperation(value = "获取律所详情", notes = "获取律所详细信息,包含收款账号列表(paymentList)")
+    @ApiOperationSupport(order = 7)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "律所ID", dataType = "Integer", paramType = "query", required = true)
+    })
+    @GetMapping("/getDetail")
+    public R<LawFirm> getLawFirmDetail(@RequestParam(value = "id") Integer id) {
+        log.info("LawFirmController.getLawFirmDetail?id={}", id);
+        return lawFirmService.getLawFirmDetail(id);
+    }
 
-    @ApiOperation("导出律所数据到Excel")
+    @ApiOperation(value = "导出律所数据到Excel", notes = "导出律所数据到Excel文件,包含收款账号信息")
     @ApiOperationSupport(order = 8)
     @GetMapping("/export")
     public R<String> exportLawFirm(HttpServletResponse response) {
@@ -138,26 +153,15 @@ public class LawFirmController {
         return lawFirmService.exportLawFirm(response);
     }
 
-    @ApiOperation("从Excel导入律所数据")
+    @ApiOperation(value = "从Excel导入律所数据", notes = "从Excel文件导入律所数据,支持批量导入。导入时会自动校验收款账号的唯一性,重复的收款账号将导致导入失败")
     @ApiOperationSupport(order = 9)
     @PostMapping("/import")
     public R<String> importLawFirm(MultipartFile file) {
-        log.info("LawFirmController.importLawFirm fileName={}", file.getOriginalFilename());
+        log.info("LawFirmController.importLawFirm fileName={}", file != null ? file.getOriginalFilename() : "null");
         return lawFirmService.importLawFirm(file);
     }
 
-    @ApiOperation("获取律所详情")
-    @ApiOperationSupport(order = 8)
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "律所ID", dataType = "Integer", paramType = "query", required = true)
-    })
-    @GetMapping("/getDetail")
-    public R<LawFirm> getLawFirmDetail(@RequestParam(value = "id") Integer id) {
-        log.info("LawFirmController.getLawFirmDetail?id={}", id);
-        return lawFirmService.getLawFirmDetail(id);
-    }
-
-    @ApiOperation("下载律所Excel导入模板")
+    @ApiOperation(value = "下载律所Excel导入模板", notes = "下载律所数据导入的Excel模板文件")
     @ApiOperationSupport(order = 10)
     @GetMapping("/downloadTemplate")
     public void downloadTemplate(HttpServletResponse response) throws IOException {

+ 15 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/LawFirmPaymentService.java

@@ -0,0 +1,15 @@
+package shop.alien.lawyer.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.store.LawFirmPayment;
+
+/**
+ * 律所子表 服务类
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+public interface LawFirmPaymentService extends IService<LawFirmPayment> {
+
+}
+

+ 8 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/LawFirmService.java

@@ -8,6 +8,7 @@ import shop.alien.entity.store.LawFirm;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.List;
 
 /**
  * 律所表 服务类
@@ -91,6 +92,13 @@ public interface LawFirmService extends IService<LawFirm> {
      * @throws IOException IO异常
      */
     void downloadTemplate(HttpServletResponse response) throws IOException;
+
+    /**
+     * 批量填充律所的收款账号列表
+     *
+     * @param lawFirmList 律所列表
+     */
+    void fillPaymentList(List<LawFirm> lawFirmList);
 }
 
 

+ 27 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawFirmPaymentServiceImpl.java

@@ -0,0 +1,27 @@
+package shop.alien.lawyer.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import shop.alien.entity.store.LawFirmPayment;
+import shop.alien.lawyer.service.LawFirmPaymentService;
+import shop.alien.mapper.LawFirmPaymentMapper;
+
+/**
+ * 律所子表 服务实现类
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Slf4j
+@Transactional
+@Service
+@RequiredArgsConstructor
+public class LawFirmPaymentServiceImpl extends ServiceImpl<LawFirmPaymentMapper, LawFirmPayment> implements LawFirmPaymentService {
+
+    private final LawFirmPaymentMapper lawFirmPaymentMapper;
+
+}
+

+ 211 - 52
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawFirmServiceImpl.java

@@ -16,8 +16,10 @@ import org.springframework.util.StringUtils;
 import org.springframework.web.multipart.MultipartFile;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.LawFirm;
+import shop.alien.entity.store.LawFirmPayment;
 import shop.alien.entity.store.excelVo.LawFirmExcelVo;
 import shop.alien.entity.store.excelVo.util.ExcelHeader;
+import shop.alien.lawyer.service.LawFirmPaymentService;
 import shop.alien.lawyer.service.LawFirmService;
 import shop.alien.mapper.LawFirmMapper;
 
@@ -47,6 +49,7 @@ import java.util.stream.Collectors;
 public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> implements LawFirmService {
 
     private final LawFirmMapper lawFirmMapper;
+    private final LawFirmPaymentService lawFirmPaymentService;
 
     @Override
     public R<IPage<LawFirm>> getLawFirmList(int pageNum, int pageSize, String firmName, Integer status) {
@@ -68,21 +71,129 @@ public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> impl
     @Override
     public R<LawFirm> addLawFirm(LawFirm lawFirm) {
         log.info("LawFirmServiceImpl.addLawFirm?lawFirm={}", lawFirm);
+        
+        // 校验收款账号唯一性
+        if (lawFirm.getPaymentList() != null && !lawFirm.getPaymentList().isEmpty()) {
+            for (LawFirmPayment payment : lawFirm.getPaymentList()) {
+                if (StringUtils.hasText(payment.getPaymentAccount())) {
+                    // 检查收款账号是否已存在
+                    LambdaQueryWrapper<LawFirmPayment> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.eq(LawFirmPayment::getPaymentAccount, payment.getPaymentAccount());
+                    queryWrapper.eq(LawFirmPayment::getDeleteFlag, 0);
+                    long count = lawFirmPaymentService.count(queryWrapper);
+                    if (count > 0) {
+                        return R.fail("收款账号[" + payment.getPaymentAccount() + "]已存在,不能重复添加");
+                    }
+                }
+            }
+        }
+        
+        // 保存主表
         boolean result = this.save(lawFirm);
-        if (result) {
-            return R.data(lawFirm);
+        if (!result) {
+            return R.fail("新增失败");
         }
-        return R.fail("新增失败");
+        
+        // 保存子表数据
+        if (lawFirm.getPaymentList() != null && !lawFirm.getPaymentList().isEmpty()) {
+            for (LawFirmPayment payment : lawFirm.getPaymentList()) {
+                try {
+                    // 创建新的对象,避免污染原对象
+                    LawFirmPayment newPayment = new LawFirmPayment();
+                    newPayment.setFirmId(lawFirm.getId());
+                    newPayment.setPaymentAccount(payment.getPaymentAccount().trim());
+                    if (StringUtils.hasText(payment.getAddress())) {
+                        newPayment.setAddress(payment.getAddress().trim());
+                    }
+
+                    boolean saveResult = lawFirmPaymentService.save(newPayment);
+                    if (!saveResult) {
+                        log.error("保存收款账号失败,firmId={}, paymentAccount={}", lawFirm.getId(), payment.getPaymentAccount());
+                        return R.fail("保存收款账号失败:" + payment.getPaymentAccount());
+                    }
+                    log.info("保存收款账号成功,firmId={}, paymentAccount={}, id={}", lawFirm.getId(), payment.getPaymentAccount(), newPayment.getId());
+                } catch (Exception e) {
+                    log.error("保存收款账号异常,firmId={}, paymentAccount={}", lawFirm.getId(), payment.getPaymentAccount(), e);
+                    return R.fail("保存收款账号异常:" + e.getMessage());
+                }
+            }
+        }
+        return R.data(lawFirm);
     }
 
     @Override
     public R<LawFirm> editLawFirm(LawFirm lawFirm) {
         log.info("LawFirmServiceImpl.editLawFirm?lawFirm={}", lawFirm);
+        
+        if (lawFirm.getId() == null) {
+            return R.fail("律所ID不能为空");
+        }
+        
+        // 校验收款账号唯一性(排除当前律所的账号)
+        if (lawFirm.getPaymentList() != null && !lawFirm.getPaymentList().isEmpty()) {
+            for (LawFirmPayment payment : lawFirm.getPaymentList()) {
+                if (StringUtils.hasText(payment.getPaymentAccount())) {
+                    // 检查收款账号是否已存在(排除当前律所和当前记录)
+                    LambdaQueryWrapper<LawFirmPayment> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.eq(LawFirmPayment::getPaymentAccount, payment.getPaymentAccount());
+                    queryWrapper.eq(LawFirmPayment::getDeleteFlag, 0);
+                    queryWrapper.ne(LawFirmPayment::getFirmId, lawFirm.getId());
+                    // 如果是更新操作,排除当前记录
+                    if (payment.getId() != null) {
+                        queryWrapper.ne(LawFirmPayment::getId, payment.getId());
+                    }
+                    long count = lawFirmPaymentService.count(queryWrapper);
+                    if (count > 0) {
+                        return R.fail("收款账号[" + payment.getPaymentAccount() + "]已存在,不能重复添加");
+                    }
+                }
+            }
+        }
+        
+        // 更新主表
         boolean result = this.updateById(lawFirm);
-        if (result) {
-            return R.data(lawFirm);
+        if (!result) {
+            return R.fail("修改失败");
+        }
+        
+        // 处理子表数据
+        if (lawFirm.getPaymentList() != null) {
+            // 查询现有的收款账号记录
+            LambdaQueryWrapper<LawFirmPayment> existingWrapper = new LambdaQueryWrapper<>();
+            existingWrapper.eq(LawFirmPayment::getFirmId, lawFirm.getId());
+            existingWrapper.eq(LawFirmPayment::getDeleteFlag, 0);
+            List<LawFirmPayment> existingPayments = lawFirmPaymentService.list(existingWrapper);
+            
+            // 收集前端传来的收款账号ID
+            Set<Integer> incomingIds = lawFirm.getPaymentList().stream()
+                    .filter(p -> p.getId() != null)
+                    .map(LawFirmPayment::getId)
+                    .collect(Collectors.toSet());
+            
+            // 删除不在前端列表中的记录(逻辑删除)
+            for (LawFirmPayment existing : existingPayments) {
+                if (!incomingIds.contains(existing.getId())) {
+                    existing.setDeleteFlag(1);
+                    lawFirmPaymentService.updateById(existing);
+                }
+            }
+            
+            // 新增或更新收款账号记录
+            for (LawFirmPayment payment : lawFirm.getPaymentList()) {
+                payment.setFirmId(lawFirm.getId());
+                if (payment.getId() != null) {
+                    // 更新
+                    payment.setDeleteFlag(0);
+                    lawFirmPaymentService.updateById(payment);
+                } else {
+                    // 新增
+                    payment.setDeleteFlag(0);
+                    lawFirmPaymentService.save(payment);
+                }
+            }
         }
-        return R.fail("修改失败");
+        
+        return R.data(lawFirm);
     }
 
     @Override
@@ -204,13 +315,20 @@ public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> impl
 
             for (Map.Entry<String, List<LawFirm>> entry : firmNameMap.entrySet()) {
                 List<LawFirm> firms = entry.getValue();
-                // 合并所有账号
-                String allPaymentAccounts = firms.stream()
-                        .map(LawFirm::getPaymentAccount)
-                        .filter(Objects::nonNull)
-                        .filter(acc -> !acc.trim().isEmpty())
-                        .distinct()
-                        .collect(Collectors.joining(","));
+                // 合并所有账号(从子表获取)
+                Set<String> accountSet = new HashSet<>();
+                for (LawFirm firm : firms) {
+                    LambdaQueryWrapper<LawFirmPayment> paymentWrapper = new LambdaQueryWrapper<>();
+                    paymentWrapper.eq(LawFirmPayment::getFirmId, firm.getId());
+                    paymentWrapper.eq(LawFirmPayment::getDeleteFlag, 0);
+                    List<LawFirmPayment> payments = lawFirmPaymentService.list(paymentWrapper);
+                    for (LawFirmPayment payment : payments) {
+                        if (StringUtils.hasText(payment.getPaymentAccount())) {
+                            accountSet.add(payment.getPaymentAccount());
+                        }
+                    }
+                }
+                String allPaymentAccounts = String.join(",", accountSet);
 
                 // 为每个账号创建一行(如果账号为空,至少创建一行)
                 if (firms.isEmpty()) {
@@ -389,25 +507,19 @@ public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> impl
 
             // 检查数据库中是否已存在这些账号
             if (!allImportAccounts.isEmpty()) {
-                // 查询数据库中所有已存在的收款账号
-                LambdaQueryWrapper<LawFirm> queryWrapper = new LambdaQueryWrapper<>();
-                queryWrapper.eq(LawFirm::getDeleteFlag, 0);
-                queryWrapper.isNotNull(LawFirm::getPaymentAccount);
-                queryWrapper.ne(LawFirm::getPaymentAccount, "");
-                List<LawFirm> existingLawFirms = this.list(queryWrapper);
+                // 查询数据库中所有已存在的收款账号(从子表查询)
+                LambdaQueryWrapper<LawFirmPayment> paymentWrapper = new LambdaQueryWrapper<>();
+                paymentWrapper.eq(LawFirmPayment::getDeleteFlag, 0);
+                paymentWrapper.isNotNull(LawFirmPayment::getPaymentAccount);
+                paymentWrapper.ne(LawFirmPayment::getPaymentAccount, "");
+                List<LawFirmPayment> existingPayments = lawFirmPaymentService.list(paymentWrapper);
 
                 // 收集数据库中所有已存在的账号
                 Set<String> existingAccounts = new HashSet<>();
-                for (LawFirm firm : existingLawFirms) {
-                    String paymentAccount = firm.getPaymentAccount();
+                for (LawFirmPayment payment : existingPayments) {
+                    String paymentAccount = payment.getPaymentAccount();
                     if (StringUtils.hasText(paymentAccount)) {
-                        String[] accounts = paymentAccount.split(",");
-                        for (String account : accounts) {
-                            String trimmedAccount = account.trim();
-                            if (!trimmedAccount.isEmpty()) {
-                                existingAccounts.add(trimmedAccount);
-                            }
-                        }
+                        existingAccounts.add(paymentAccount.trim());
                     }
                 }
 
@@ -448,7 +560,29 @@ public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> impl
                 // 使用第一个数据作为主数据
                 LawFirmExcelVo firstVo = voList.get(0);
                 LawFirm lawFirm = convertToLawFirm(firstVo);
-                lawFirm.setPaymentAccount(paymentAccounts);
+                
+                // 保存主表
+                boolean saveResult = this.save(lawFirm);
+                if (!saveResult) {
+                    importErrors.add("律所[" + firmName + "]保存失败");
+                    failCount++;
+                    continue;
+                }
+                
+                // 保存子表收款账号
+                if (StringUtils.hasText(paymentAccounts)) {
+                    String[] accounts = paymentAccounts.split(",");
+                    for (String account : accounts) {
+                        String trimmedAccount = account.trim();
+                        if (!trimmedAccount.isEmpty()) {
+                            LawFirmPayment payment = new LawFirmPayment();
+                            payment.setFirmId(lawFirm.getId());
+                            payment.setPaymentAccount(trimmedAccount);
+                            payment.setDeleteFlag(0);
+                            lawFirmPaymentService.save(payment);
+                        }
+                    }
+                }
 
                 // 校验统一社会信用代码是否已存在
 //                LambdaQueryWrapper<LawFirm> creditCodeWrapper = new LambdaQueryWrapper<>();
@@ -465,33 +599,12 @@ public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> impl
                 if (lawFirm.getStatus() == null) {
                     lawFirm.setStatus(1);
                 }
-//                if (lawFirm.getCertificationStatus() == null) {
-//                    lawFirm.setCertificationStatus(0);
-//                }
                 if (lawFirm.getDeleteFlag() == null) {
                     lawFirm.setDeleteFlag(0);
                 }
-//                if (lawFirm.getIsRecommended() == null) {
-//                    lawFirm.setIsRecommended(0);
-//                }
-//                if (lawFirm.getLawyerCount() == null) {
-//                    lawFirm.setLawyerCount(0);
-//                }
-//                if (lawFirm.getPartnerCount() == null) {
-//                    lawFirm.setPartnerCount(0);
-//                }
-//                if (lawFirm.getPlatformCommissionRatio() == null) {
-//                    lawFirm.setPlatformCommissionRatio(new BigDecimal("3.00"));
-//                }
 
-                // 保存
-                boolean result = this.save(lawFirm);
-                if (result) {
-                    successCount++;
-                } else {
-                    importErrors.add("律所[" + firmName + "]保存失败");
-                    failCount++;
-                }
+                // 保存主表(已在上面保存)
+                successCount++;
             }
 
             String resultMsg = String.format("导入完成:成功%d条,失败%d条", successCount, failCount);
@@ -881,6 +994,13 @@ public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> impl
             return R.fail("律所已被删除");
         }
 
+        // 查询收款账号列表
+        LambdaQueryWrapper<LawFirmPayment> paymentWrapper = new LambdaQueryWrapper<>();
+        paymentWrapper.eq(LawFirmPayment::getFirmId, id);
+        paymentWrapper.eq(LawFirmPayment::getDeleteFlag, 0);
+        List<LawFirmPayment> paymentList = lawFirmPaymentService.list(paymentWrapper);
+        lawFirm.setPaymentList(paymentList);
+
         return R.data(lawFirm, "查询成功");
     }
 
@@ -938,6 +1058,45 @@ public class LawFirmServiceImpl extends ServiceImpl<LawFirmMapper, LawFirm> impl
             }
         }
     }
+
+    /**
+     * 批量填充律所的收款账号列表
+     *
+     * @param lawFirmList 律所列表
+     */
+    @Override
+    public void fillPaymentList(List<LawFirm> lawFirmList) {
+        if (lawFirmList == null || lawFirmList.isEmpty()) {
+            return;
+        }
+
+        // 收集所有律所ID
+        List<Integer> firmIds = lawFirmList.stream()
+                .map(LawFirm::getId)
+                .filter(Objects::nonNull)
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (firmIds.isEmpty()) {
+            return;
+        }
+
+        // 批量查询所有收款账号
+        LambdaQueryWrapper<LawFirmPayment> paymentWrapper = new LambdaQueryWrapper<>();
+        paymentWrapper.in(LawFirmPayment::getFirmId, firmIds);
+        paymentWrapper.eq(LawFirmPayment::getDeleteFlag, 0);
+        List<LawFirmPayment> allPayments = lawFirmPaymentService.list(paymentWrapper);
+
+        // 按律所ID分组
+        Map<Integer, List<LawFirmPayment>> paymentMap = allPayments.stream()
+                .collect(Collectors.groupingBy(LawFirmPayment::getFirmId));
+
+        // 为每个律所设置收款账号列表
+        lawFirmList.forEach(lawFirm -> {
+            List<LawFirmPayment> paymentList = paymentMap.getOrDefault(lawFirm.getId(), Collections.emptyList());
+            lawFirm.setPaymentList(paymentList);
+        });
+    }
 }