From 546e9011a753a9f9825f56f016807ef3c114b03c Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Fri, 14 Apr 2023 03:06:23 +0000
Subject: [PATCH] 账户月度明细

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/impl/CapitalFlowServiceImpl.java |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/impl/CapitalFlowServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/impl/CapitalFlowServiceImpl.java
index ffbbc13..9352a13 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/impl/CapitalFlowServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capitalFlow/service/impl/CapitalFlowServiceImpl.java
@@ -16,6 +16,8 @@
 package me.zhengjie.modules.capitalFlow.service.impl;
 
 import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.capital.service.CapitalAccountCompanyService;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanyDto;
 import me.zhengjie.modules.capitalFlow.domain.CapitalFlow;
 import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend;
 import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome;
@@ -55,10 +57,10 @@
 
     private final CapitalFlowRepository capitalFlowRepository;
     private final CapitalFlowMapper capitalFlowMapper;
-    private final SysCompanyServiceImpl sysCompanyServiceImpl;
     private final CapitalFlowExpendRepository capitalFlowExpendRepository;
     private final CapitalFlowIncomeRepository capitalFlowIncomeRepository;
     private final CapitalServiceImpl capitalService;
+    private final CapitalAccountCompanyService capitalAccountCompanyService;
 
     @Override
     public Map<String,Object> queryAll(CapitalFlowQueryCriteria criteria, Pageable pageable){
@@ -74,8 +76,8 @@
             public CapitalFlowDto apply(CapitalFlow t) {
                 // 将实体类转换成DTO
                 CapitalFlowDto capitalFlowDto = capitalFlowMapper.toDto(t);
-                // 公司名称
-                capitalFlowDto.setCompanyName(companyName(t));
+                // 年度账户名称
+                capitalFlowDto.setAccountCompanyName(accountCompanyName(t));
                 // 流水支出
                 capitalFlowDto.setCapitalFlowExpends(capitalFlowExpendRepository.findByFlowId(t.getId()));
                 // 流水支出金额
@@ -99,7 +101,7 @@
             // 资金流水
             CapitalFlowDto capitalFlowDto = capitalFlowDtoList.get(i);
             // DTO赋值
-            capitalFlowDto.setCompanyName(companyName(capitalFlowMapper.toEntity(capitalFlowDto)));
+            capitalFlowDto.setAccountCompanyName(accountCompanyName(capitalFlowMapper.toEntity(capitalFlowDto)));
         }
         return capitalFlowDtoList;
     }
@@ -148,10 +150,10 @@
     public void download(List<CapitalFlowDto> all, HttpServletResponse response) throws IOException {
         List<Map<String, Object>> list = new ArrayList<>();
         for (CapitalFlowDto capitalFlow : all) {
-            String companyName = companyName(capitalFlowMapper.toEntity(capitalFlow));
+            String accountCompanyName = accountCompanyName(capitalFlowMapper.toEntity(capitalFlow));
             Map<String,Object> map = new LinkedHashMap<>();
             map.put("流水年月", capitalFlow.getFlowYearMonth());
-            map.put("所属公司", companyName);
+            map.put("所属年度账户", accountCompanyName);
             map.put("备注", capitalFlow.getRemarks());
             map.put("创建者", capitalFlow.getCreateBy());
             map.put("创建时间", capitalFlow.getCreateTime());
@@ -178,17 +180,17 @@
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         // 目标年月
         String targetYearMonth = sdf.format(resources.getFlowYearMonth().getTime());
-        capitalService.getCapitalInfo(resources.getCompanyId(), targetYearMonth);
+        capitalService.getCapitalInfo(resources.getAccountCompanyId(), targetYearMonth);
     }
 
     /**
-     * 公司名称
+     * 年度账户名称
      * @param resources
      * @return
      */
-    private String companyName(CapitalFlow resources) {
+    private String accountCompanyName(CapitalFlow resources) {
         // 查询公司数据
-        SysCompanyDto sysCompanyDto = sysCompanyServiceImpl.findById(resources.getCompanyId());
-        return sysCompanyDto.getLabel();
+        CapitalAccountCompanyDto capitalAccountCompanyDto = capitalAccountCompanyService.findById(resources.getAccountCompanyId());
+        return capitalAccountCompanyDto.getAccountName();
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3