From d0c51ac702c57f2cae84a8d879a5b605f2dab630 Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Thu, 28 Sep 2023 09:50:45 +0000
Subject: [PATCH] 修改
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/CapitalServiceImpl.java | 168 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 106 insertions(+), 62 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/CapitalServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/CapitalServiceImpl.java
index 3668074..5b6ab66 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/CapitalServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/CapitalServiceImpl.java
@@ -20,11 +20,17 @@
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.assetManagement.domain.AssetManagement;
import me.zhengjie.modules.assetManagement.repository.AssetManagementRepository;
+import me.zhengjie.modules.capital.domain.CapitalAccountCompany;
+import me.zhengjie.modules.capital.repository.CapitalAccountCompanyRepository;
import me.zhengjie.modules.capitalFlow.domain.CapitalFlow;
import me.zhengjie.modules.capitalFlow.domain.CapitalFlowExpend;
+import me.zhengjie.modules.capitalFlow.domain.CapitalFlowIncome;
import me.zhengjie.modules.capitalFlow.repository.CapitalFlowExpendRepository;
+import me.zhengjie.modules.capitalFlow.repository.CapitalFlowIncomeRepository;
import me.zhengjie.modules.capitalFlow.repository.CapitalFlowRepository;
import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.contract.domain.ContractPayment;
+import me.zhengjie.modules.contract.repository.ContractPaymentRepository;
import me.zhengjie.modules.salary.domain.Salary;
import me.zhengjie.modules.salary.repository.SalaryRepository;
import me.zhengjie.modules.system.domain.SysCompany;
@@ -49,30 +55,32 @@
@RequiredArgsConstructor
public class CapitalServiceImpl{
- private final SysCompanyRepository sysCompanyRepository;
+ private final CapitalAccountCompanyRepository capitalAccountCompanyRepository;
private final UserService userService;
private final SalaryRepository salaryRepository;
private final AssetManagementRepository assetManagementRepository;
private final CapitalFlowRepository capitalFlowRepository;
private final CapitalFlowExpendRepository capitalFlowExpendRepository;
+ private final ContractPaymentRepository contractPaymentRepository;
+ private final CapitalFlowIncomeRepository capitalFlowIncomeRepository;
/**
* 向资金流水和流水指出添加数据
- * @param companyId
+ * @param accountCompanyId
* @param targetYearMonth
*/
- public void getCapitalInfo(Long companyId, String targetYearMonth){
- // 判断公司Id是否为空
- if(companyId != null){
- // 单个公司流水
- singleCompanyFlow(companyId, targetYearMonth);
+ public void getCapitalInfo(Long accountCompanyId, String targetYearMonth){
+ // 判断年度账号Id是否为空
+ if(accountCompanyId != null){
+ // 单个年度账号流水
+ singleAccountCompanyFlow(accountCompanyId, targetYearMonth);
}else{
- // 查询所有公司
- List<SysCompany> companyList = sysCompanyRepository.findAll();
- for(int i = 0; i < companyList.size(); i++){
+ // 查询所有年度账号
+ List<CapitalAccountCompany> capitalAccountCompanyList = capitalAccountCompanyRepository.findAll();
+ for(int i = 0; i < capitalAccountCompanyList.size(); i++){
try {
- // 单个公司流水
- singleCompanyFlow(companyList.get(i).getId(), targetYearMonth);
+ // 单个年度账号流水
+ singleAccountCompanyFlow(capitalAccountCompanyList.get(i).getId(), targetYearMonth);
}catch (Exception e){
// 跳过本次循环
continue;
@@ -82,11 +90,11 @@
}
/**
- * 单个公司流水
- * @param companyId
+ * 单个年度账号流水
+ * @param accountCompanyId
* @param targetYearMonth
*/
- public void singleCompanyFlow(Long companyId, String targetYearMonth){
+ public void singleAccountCompanyFlow(Long accountCompanyId, String targetYearMonth){
// 日历类
Calendar cal = Calendar.getInstance();
// 设置年份
@@ -105,13 +113,13 @@
cal.set(Calendar.MILLISECOND, 0);
// 查询资金流水
- CapitalFlow capitalFlow = capitalFlowRepository.findByFlowYearMonthAndCompanyId(new Timestamp(cal.getTime().getTime()), companyId);
+ CapitalFlow capitalFlow = capitalFlowRepository.findByFlowYearMonthAndAccountCompanyId(new Timestamp(cal.getTime().getTime()), accountCompanyId);
// 判断是否为空
if(ObjectUtils.isEmpty(capitalFlow)){
capitalFlow = new CapitalFlow();
}
capitalFlow.setFlowYearMonth(new Timestamp(cal.getTime().getTime()));
- capitalFlow.setCompanyId(companyId);
+ capitalFlow.setAccountCompanyId(accountCompanyId);
// 资金流水管理添加
capitalFlowRepository.save(capitalFlow);
@@ -122,58 +130,94 @@
capitalFlowExpendRepository.delete(capitalFlowExpends.get(i));
}
- // 工资支出总金额
- Double totalWageExpenditure = 0.0;
- // 用户检索类
- UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
- userQueryCriteria.setEnabled(true);
- // 获取用户列表
- List<UserDto> userDtoList = userService.queryAll(userQueryCriteria);
- for(int i = 0; i < userDtoList.size(); i++){
- // 判断员工是否属于当前公司
- if(userDtoList.get(i).getCompanyId().equals(companyId)){
- // 根据日期和员工查询工资条
- List<Salary> salaryList = salaryRepository.findByUserIdAndSalaryYearMonth(userDtoList.get(i).getId(), new Timestamp(cal.getTime().getTime()));
- for(int i1 = 0; i1 < salaryList.size(); i1++){
- totalWageExpenditure = totalWageExpenditure + Double.valueOf(salaryList.get(i1).getPreTaxAmount().toString());
- }
- }
- }
- // 工资支出总金额不为0的话就往流水支出管理添加数据
- if(!totalWageExpenditure.equals(0.0)){
- // 调用方法添加
- saveCapitalFlowExpend(capitalFlow.getId(),totalWageExpenditure, Constant.DAILY_PAYROLL_EXPEND);
+ // 查询流水收入管理
+ List<CapitalFlowIncome> capitalFlowIncomes = capitalFlowIncomeRepository.findByFlowId(capitalFlow.getId());
+ // 流水收入管理不为空,数据全部删除
+ for(int i = 0; i< capitalFlowIncomes.size(); i++){
+ capitalFlowIncomeRepository.delete(capitalFlowIncomes.get(i));
}
+// // 工资支出总金额
+// Double totalWageExpenditure = 0.0;
+// // 用户检索类
+// UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
+// userQueryCriteria.setEnabled(true);
+// // 获取用户列表
+// List<UserDto> userDtoList = userService.queryAll(userQueryCriteria);
+// for(int i = 0; i < userDtoList.size(); i++){
+// // 判断员工是否属于当前公司
+// if(userDtoList.get(i).getCompanyId().equals(companyId)){
+// // 根据日期和员工查询工资条
+// List<Salary> salaryList = salaryRepository.findByUserIdAndSalaryYearMonth(userDtoList.get(i).getId(), new Timestamp(cal.getTime().getTime()));
+// for(int i1 = 0; i1 < salaryList.size(); i1++){
+// totalWageExpenditure = totalWageExpenditure + Double.valueOf(salaryList.get(i1).getPreTaxAmount().toString());
+// }
+// }
+// }
+// // 工资支出总金额不为0的话就往流水支出管理添加数据
+// if(!totalWageExpenditure.equals(0.0)){
+// // 调用方法添加
+// saveCapitalFlowExpend(capitalFlow.getId(),totalWageExpenditure, Constant.DAILY_PAYROLL_EXPEND);
+// }
- // 资产支出总金额(固定)
- Double totalAssetsExpenditureFixed = 0.0;
- // 根据日期和公司查询固定资产
- List<AssetManagement> assetManagementList = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FIXED);
- for(int i = 0; i < assetManagementList.size(); i++){
- totalAssetsExpenditureFixed = totalAssetsExpenditureFixed + Double.valueOf(assetManagementList.get(i).getBuyMoney().toString());
- }
- // 固定资产支出总金额不为0的话就往流水支出管理添加数据
- if(!totalAssetsExpenditureFixed.equals(0.0)){
- // 调用方法添加
- saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFixed, Constant.ASSET_FLOW_EXPEND_G);
- }
- // 资产支出总金额(流动)
- Double totalAssetsExpenditureFlow = 0.0;
- // 根据日期和公司查询流动资产
- List<AssetManagement> assetManagementLists = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FLOW);
- for(int i = 0; i < assetManagementLists.size(); i++){
- totalAssetsExpenditureFlow = totalAssetsExpenditureFlow + Double.valueOf(assetManagementLists.get(i).getBuyMoney().toString());
- }
- // 流动资产支出总金额不为0的话就往流水支出管理添加数据
- if(!totalAssetsExpenditureFlow.equals(0.0)){
- // 调用方法添加
- saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFlow, Constant.ASSET_FLOW_EXPEND_L);
- }
+// // 资产支出总金额(固定)
+// Double totalAssetsExpenditureFixed = 0.0;
+// // 根据日期和公司查询固定资产
+// List<AssetManagement> assetManagementList = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FIXED);
+// for(int i = 0; i < assetManagementList.size(); i++){
+// totalAssetsExpenditureFixed = totalAssetsExpenditureFixed + Double.valueOf(assetManagementList.get(i).getBuyMoney().toString());
+// }
+// // 固定资产支出总金额不为0的话就往流水支出管理添加数据
+// if(!totalAssetsExpenditureFixed.equals(0.0)){
+// // 调用方法添加
+// saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFixed, Constant.ASSET_FLOW_EXPEND_G);
+// }
+// // 资产支出总金额(流动)
+// Double totalAssetsExpenditureFlow = 0.0;
+// // 根据日期和公司查询流动资产
+// List<AssetManagement> assetManagementLists = assetManagementRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.ACCET_TYPE_FLOW);
+// for(int i = 0; i < assetManagementLists.size(); i++){
+// totalAssetsExpenditureFlow = totalAssetsExpenditureFlow + Double.valueOf(assetManagementLists.get(i).getBuyMoney().toString());
+// }
+// // 流动资产支出总金额不为0的话就往流水支出管理添加数据
+// if(!totalAssetsExpenditureFlow.equals(0.0)){
+// // 调用方法添加
+// saveCapitalFlowExpend(capitalFlow.getId(),totalAssetsExpenditureFlow, Constant.ASSET_FLOW_EXPEND_L);
+// }
+
+// // 合同支出总金额
+// Double contractExpenditure = 0.0;
+// // 根据日期和公司查询合同付款
+// List<ContractPayment> contractPayments = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_EXPENDITURE);
+// for(int i = 0; i < contractPayments.size(); i++){
+// contractExpenditure = contractExpenditure + Double.valueOf(contractPayments.get(i).getPaymentAmount().toString());
+// }
+// // 合同支出总金额不为0的话就往流水支出管理添加数据
+// if(!contractExpenditure.equals(0.0)){
+// // 调用方法添加
+// saveCapitalFlowExpend(capitalFlow.getId(),contractExpenditure, Constant.CONTRACT_EXPENSES);
+// }
+
+// // 合同收入总金额
+// Double contractRevenue = 0.0;
+// // 根据日期和公司查询合同收入
+// List<ContractPayment> contractPaymentList = contractPaymentRepository.findByDateAndCompany(targetYearMonth.substring(0,7), companyId, Constant.CONTRACR_REVENUE);
+// for(int i = 0; i < contractPaymentList.size(); i++){
+// contractRevenue = contractRevenue + Double.valueOf(contractPaymentList.get(i).getPaymentAmount().toString());
+// }
+// // 合同收入总金额不为0就往流水收入管理添加数据
+// if(!contractRevenue.equals(0.0)){
+// CapitalFlowIncome capitalFlowIncome = new CapitalFlowIncome();
+// capitalFlowIncome.setFlowId(capitalFlow.getId());
+// capitalFlowIncome.setAmount(new BigDecimal(contractRevenue));
+// capitalFlowIncome.setTitle(Constant.CONTRACT_EXPENSES_S);
+// capitalFlowIncomeRepository.save(capitalFlowIncome);
+// }
}
+
/**
* 流水支出管理添加
* @param id
--
Gitblit v1.9.3