eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractServiceImpl.java
@@ -2423,6 +2423,59 @@ } finalData.put("typeData", typeDataMap); } else if (type.equals(6)) { // 模块6统计数据 if (criteria.getSignDate().isEmpty()) { throw new BadRequestException("检索时间不存在"); } List<Map<String, Object>> incomeDataList = new ArrayList<>(); BigDecimal totalRecoveryFund = new BigDecimal(0); BigDecimal totalUnRecoveryFund = new BigDecimal(0); for (Long companyId : companyIds) { Map<String, Object> incomeDataMap = new HashMap<>(); // 获取合同信息 ContractQueryCriteria queryCriteria = new ContractQueryCriteria(); queryCriteria.setCompanyId(companyId); queryCriteria.setSignDate(criteria.getSignDate()); queryCriteria.setRecoveryStatus(Constant.RECOVERY_STATUS_ABANDON); List<Contract> contractList = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,queryCriteria,criteriaBuilder)); // 过滤收入合同(仅乙方) List<Contract> incomeContractList = contractList.stream().filter(item -> ElAdminConstant.Enum.CompanySuffix.findByCompanyName(firstMap.get(item.getFirstId())) == null && ElAdminConstant.Enum.CompanySuffix.findByCompanyName(secondMap.get(item.getSecondId())) != null).collect(Collectors.toList()); // 初始化统计参数 BigDecimal recoveryFund = new BigDecimal(0); BigDecimal unRecoveryFund = new BigDecimal(0); for (Contract incomeContract : incomeContractList) { BigDecimal currentContractAmount = incomeContract.getContractAmount() != null ? incomeContract.getContractAmount() : new BigDecimal(0); BigDecimal currentServiceAmount = incomeContract.getServiceAmount() != null ? incomeContract.getServiceAmount() : new BigDecimal(0); BigDecimal paidAmount = contractPaymentRepository.countTotalAmountByContractId(incomeContract.getContractId()); paidAmount = paidAmount != null ? paidAmount : new BigDecimal(0); BigDecimal unpaidAmount = currentContractAmount.add(currentServiceAmount).subtract(paidAmount); recoveryFund = recoveryFund.add(paidAmount); unRecoveryFund = unRecoveryFund.add(unpaidAmount); // 总额计算 totalRecoveryFund = totalRecoveryFund.add(paidAmount); totalUnRecoveryFund = totalUnRecoveryFund.add(unpaidAmount); } // 保存数据 incomeDataMap.put("companyName", companyMap.get(companyId)); incomeDataMap.put("recoveryFund", recoveryFund); incomeDataMap.put("unRecoveryFund", unRecoveryFund); incomeDataList.add(incomeDataMap); } // 总计数据 Map<String, Object> totalIncomeDataMap = new HashMap<>(); totalIncomeDataMap.put("companyName", "总计"); totalIncomeDataMap.put("recoveryFund", totalRecoveryFund); totalIncomeDataMap.put("unRecoveryFund", totalUnRecoveryFund); finalData.put("total", totalIncomeDataMap); finalData.put("income", incomeDataList); } return finalData; eladmin-web-master/src/api/contract/contract.js
@@ -140,4 +140,11 @@ }) } export function statisticsRecovery(params) { return request({ url: 'api/contract/statistics/6' + '?' + qs.stringify(params, { indices: false }), method: 'get' }) } export default { getAll, add, edit, del } eladmin-web-master/src/views/contract/contractStatistics/index.vue
@@ -26,6 +26,33 @@ <el-col :span="12"> <div class="grid-content"> <el-card v-loading="recovery.loading"> <div slot="header" class="card-header-box"> <span>合同收入损失</span> <div class="form-box"> <el-date-picker v-model="recovery.queryForm.signDate" type="daterange" value-format="yyyy-MM-dd 00:00:00" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 360px;" class="filter-item" @keyup.enter.native="queryStatisticsQuantity" /> <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStatisticsQuantity">搜索</el-button> </div> </div> <div class="card-content-box"> <el-table :data="recovery.preprocessData" size="small" style="width: 100%;"> <el-table-column :show-overflow-tooltip="true" prop="companyName" label="公司" /> <el-table-column :show-overflow-tooltip="true" prop="unRecoveryFund" label="收入损失" width="200"> <template slot-scope="scope"> <span style="color: red;">{{ scope.row.unRecoveryFund }}</span> </template> </el-table-column> </el-table> </div> </el-card> </div> </el-col> </el-row> <el-row :gutter="20" class="module-row data-row"> <el-col :span="24"> <div class="grid-content"> <el-card v-loading="amount.loading"> <div slot="header" class="card-header-box"> <span>合同金额</span> @@ -184,7 +211,7 @@ </template> <script> import { statisticsQuantity, statisticsAmount, statisticsDelay, statisticsGoal, statisticsIncomeExpense } from '@/api/contract/contract' import { statisticsQuantity, statisticsAmount, statisticsDelay, statisticsGoal, statisticsIncomeExpense, statisticsRecovery } from '@/api/contract/contract' import { parseTime } from '@/utils/index' import LineChart from './LineChart' import BarStack from './BarStack' @@ -233,6 +260,14 @@ loading: false, sourceData: null, preprocessData: {} }, recovery: { queryForm: { signDate: [] }, loading: false, sourceData: null, preprocessData: null } } }, @@ -243,6 +278,7 @@ const firstDayOfYear = new Date(currentYear, 0, 1) const lastDayOfYear = new Date(currentYear, 11, 31) that.quantity.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)] that.recovery.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)] that.amount.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)] that.delay.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)] that.goal.queryForm.signDateEqual = parseTime(firstDayOfYear) @@ -252,6 +288,7 @@ that.queryStatisticsDelay() that.queryStatisticsGoal() that.queryStatisticsIncomeExpense() that.queryStatisticsRecovery() }, methods: { queryStatisticsQuantity() { @@ -454,6 +491,17 @@ }).catch(() => { that.incomeExpense.loading = false }) }, queryStatisticsRecovery() { const that = this that.recovery.loading = true statisticsRecovery(that.recovery.queryForm).then(res => { that.recovery.sourceData = res that.recovery.preprocessData = res.income that.recovery.loading = false }).catch(() => { that.recovery.loading = false }) } } }